diff options
author | mattpiwik <matthieu.aubry@gmail.com> | 2007-08-30 14:03:59 +0400 |
---|---|---|
committer | mattpiwik <matthieu.aubry@gmail.com> | 2007-08-30 14:03:59 +0400 |
commit | fee947eb1fe09f09fc308863a3d4e83f3e9649d1 (patch) | |
tree | 6fd59c69e7bfe4e4fe04d7019182be60e7dd775a | |
parent | 62ff9b52a06d97bd7edecd9d81bb95d060763800 (diff) |
git-svn-id: http://dev.piwik.org/svn/trunk@52 59fd770c-687e-43c8-a1e3-f5a4ff64c105
-rwxr-xr-x | libs/Html/Common.php (renamed from libs/HTML/Common.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm.php (renamed from libs/HTML/QuickForm.php) | 6 | ||||
-rwxr-xr-x | libs/Html/QuickForm/Renderer.php (renamed from libs/HTML/QuickForm/Renderer.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/Renderer/Array.php (renamed from libs/HTML/QuickForm/Renderer/Array.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/Renderer/ArraySmarty.php (renamed from libs/HTML/QuickForm/Renderer/ArraySmarty.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/Renderer/Default.php (renamed from libs/HTML/QuickForm/Renderer/Default.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/Renderer/ITDynamic.php (renamed from libs/HTML/QuickForm/Renderer/ITDynamic.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/Renderer/ITStatic.php (renamed from libs/HTML/QuickForm/Renderer/ITStatic.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/Renderer/Object.php (renamed from libs/HTML/QuickForm/Renderer/Object.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/Renderer/ObjectFlexy.php (renamed from libs/HTML/QuickForm/Renderer/ObjectFlexy.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/Renderer/QuickHtml.php (renamed from libs/HTML/QuickForm/Renderer/QuickHtml.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/Rule.php (renamed from libs/HTML/QuickForm/Rule.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/Rule/Callback.php (renamed from libs/HTML/QuickForm/Rule/Callback.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/Rule/Compare.php (renamed from libs/HTML/QuickForm/Rule/Compare.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/Rule/Email.php (renamed from libs/HTML/QuickForm/Rule/Email.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/Rule/Range.php (renamed from libs/HTML/QuickForm/Rule/Range.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/Rule/Regex.php (renamed from libs/HTML/QuickForm/Rule/Regex.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/Rule/Required.php (renamed from libs/HTML/QuickForm/Rule/Required.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/RuleRegistry.php (renamed from libs/HTML/QuickForm/RuleRegistry.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/advcheckbox.php (renamed from libs/HTML/QuickForm/advcheckbox.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/autocomplete.php (renamed from libs/HTML/QuickForm/autocomplete.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/button.php (renamed from libs/HTML/QuickForm/button.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/checkbox.php (renamed from libs/HTML/QuickForm/checkbox.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/date.php (renamed from libs/HTML/QuickForm/date.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/element.php (renamed from libs/HTML/QuickForm/element.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/file.php (renamed from libs/HTML/QuickForm/file.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/group.php (renamed from libs/HTML/QuickForm/group.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/header.php (renamed from libs/HTML/QuickForm/header.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/hidden.php (renamed from libs/HTML/QuickForm/hidden.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/hiddenselect.php (renamed from libs/HTML/QuickForm/hiddenselect.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/hierselect.php (renamed from libs/HTML/QuickForm/hierselect.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/html.php (renamed from libs/HTML/QuickForm/html.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/image.php (renamed from libs/HTML/QuickForm/image.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/input.php (renamed from libs/HTML/QuickForm/input.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/link.php (renamed from libs/HTML/QuickForm/link.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/password.php (renamed from libs/HTML/QuickForm/password.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/radio.php (renamed from libs/HTML/QuickForm/radio.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/reset.php (renamed from libs/HTML/QuickForm/reset.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/select.php (renamed from libs/HTML/QuickForm/select.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/static.php (renamed from libs/HTML/QuickForm/static.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/submit.php (renamed from libs/HTML/QuickForm/submit.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/text.php (renamed from libs/HTML/QuickForm/text.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/textarea.php (renamed from libs/HTML/QuickForm/textarea.php) | 0 | ||||
-rwxr-xr-x | libs/Html/QuickForm/xbutton.php (renamed from libs/HTML/QuickForm/xbutton.php) | 0 | ||||
-rw-r--r-- | modules/Form.php | 13 | ||||
-rw-r--r-- | modules/View.php | 96 | ||||
-rw-r--r-- | plugins/Login/Controller.php | 61 | ||||
-rw-r--r-- | plugins/Login/Form.php | 11 | ||||
-rw-r--r-- | themes/default/home.tpl | 4 |
49 files changed, 163 insertions, 28 deletions
diff --git a/libs/HTML/Common.php b/libs/Html/Common.php index 9b7bae4a6c..9b7bae4a6c 100755 --- a/libs/HTML/Common.php +++ b/libs/Html/Common.php diff --git a/libs/HTML/QuickForm.php b/libs/Html/QuickForm.php index f32ad07342..4513668f43 100755 --- a/libs/HTML/QuickForm.php +++ b/libs/Html/QuickForm.php @@ -594,7 +594,7 @@ class HTML_QuickForm extends HTML_Common $className = $GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES'][$type][1];
$includeFile = $GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES'][$type][0];
include_once($includeFile);
- $elementObject =& new $className();
+ $elementObject = new $className();
for ($i = 0; $i < 5; $i++) {
if (!isset($args[$i])) {
$args[$i] = null;
@@ -1693,7 +1693,7 @@ class HTML_QuickForm extends HTML_Common {
if (!isset($GLOBALS['_HTML_QuickForm_default_renderer'])) {
include_once('HTML/QuickForm/Renderer/Default.php');
- $GLOBALS['_HTML_QuickForm_default_renderer'] =& new HTML_QuickForm_Renderer_Default();
+ $GLOBALS['_HTML_QuickForm_default_renderer'] = new HTML_QuickForm_Renderer_Default();
}
return $GLOBALS['_HTML_QuickForm_default_renderer'];
} // end func defaultRenderer
@@ -1850,7 +1850,7 @@ class HTML_QuickForm extends HTML_Common function toArray($collectHidden = false)
{
include_once 'HTML/QuickForm/Renderer/Array.php';
- $renderer =& new HTML_QuickForm_Renderer_Array($collectHidden);
+ $renderer = new HTML_QuickForm_Renderer_Array($collectHidden);
$this->accept($renderer);
return $renderer->toArray();
} // end func toArray
diff --git a/libs/HTML/QuickForm/Renderer.php b/libs/Html/QuickForm/Renderer.php index 9524dfd4f7..9524dfd4f7 100755 --- a/libs/HTML/QuickForm/Renderer.php +++ b/libs/Html/QuickForm/Renderer.php diff --git a/libs/HTML/QuickForm/Renderer/Array.php b/libs/Html/QuickForm/Renderer/Array.php index 24874ecb5a..24874ecb5a 100755 --- a/libs/HTML/QuickForm/Renderer/Array.php +++ b/libs/Html/QuickForm/Renderer/Array.php diff --git a/libs/HTML/QuickForm/Renderer/ArraySmarty.php b/libs/Html/QuickForm/Renderer/ArraySmarty.php index 0a87d56f0d..0a87d56f0d 100755 --- a/libs/HTML/QuickForm/Renderer/ArraySmarty.php +++ b/libs/Html/QuickForm/Renderer/ArraySmarty.php diff --git a/libs/HTML/QuickForm/Renderer/Default.php b/libs/Html/QuickForm/Renderer/Default.php index d119b3534b..d119b3534b 100755 --- a/libs/HTML/QuickForm/Renderer/Default.php +++ b/libs/Html/QuickForm/Renderer/Default.php diff --git a/libs/HTML/QuickForm/Renderer/ITDynamic.php b/libs/Html/QuickForm/Renderer/ITDynamic.php index 479cc4b876..479cc4b876 100755 --- a/libs/HTML/QuickForm/Renderer/ITDynamic.php +++ b/libs/Html/QuickForm/Renderer/ITDynamic.php diff --git a/libs/HTML/QuickForm/Renderer/ITStatic.php b/libs/Html/QuickForm/Renderer/ITStatic.php index 578a8baed7..578a8baed7 100755 --- a/libs/HTML/QuickForm/Renderer/ITStatic.php +++ b/libs/Html/QuickForm/Renderer/ITStatic.php diff --git a/libs/HTML/QuickForm/Renderer/Object.php b/libs/Html/QuickForm/Renderer/Object.php index 42f9b8be0f..42f9b8be0f 100755 --- a/libs/HTML/QuickForm/Renderer/Object.php +++ b/libs/Html/QuickForm/Renderer/Object.php diff --git a/libs/HTML/QuickForm/Renderer/ObjectFlexy.php b/libs/Html/QuickForm/Renderer/ObjectFlexy.php index ea6f6e645f..ea6f6e645f 100755 --- a/libs/HTML/QuickForm/Renderer/ObjectFlexy.php +++ b/libs/Html/QuickForm/Renderer/ObjectFlexy.php diff --git a/libs/HTML/QuickForm/Renderer/QuickHtml.php b/libs/Html/QuickForm/Renderer/QuickHtml.php index 71472e23b3..71472e23b3 100755 --- a/libs/HTML/QuickForm/Renderer/QuickHtml.php +++ b/libs/Html/QuickForm/Renderer/QuickHtml.php diff --git a/libs/HTML/QuickForm/Rule.php b/libs/Html/QuickForm/Rule.php index 8f66a847a0..8f66a847a0 100755 --- a/libs/HTML/QuickForm/Rule.php +++ b/libs/Html/QuickForm/Rule.php diff --git a/libs/HTML/QuickForm/Rule/Callback.php b/libs/Html/QuickForm/Rule/Callback.php index 6c1e9b22b8..6c1e9b22b8 100755 --- a/libs/HTML/QuickForm/Rule/Callback.php +++ b/libs/Html/QuickForm/Rule/Callback.php diff --git a/libs/HTML/QuickForm/Rule/Compare.php b/libs/Html/QuickForm/Rule/Compare.php index fd51708f8a..fd51708f8a 100755 --- a/libs/HTML/QuickForm/Rule/Compare.php +++ b/libs/Html/QuickForm/Rule/Compare.php diff --git a/libs/HTML/QuickForm/Rule/Email.php b/libs/Html/QuickForm/Rule/Email.php index 1c39823f14..1c39823f14 100755 --- a/libs/HTML/QuickForm/Rule/Email.php +++ b/libs/Html/QuickForm/Rule/Email.php diff --git a/libs/HTML/QuickForm/Rule/Range.php b/libs/Html/QuickForm/Rule/Range.php index 5acba2c97f..5acba2c97f 100755 --- a/libs/HTML/QuickForm/Rule/Range.php +++ b/libs/Html/QuickForm/Rule/Range.php diff --git a/libs/HTML/QuickForm/Rule/Regex.php b/libs/Html/QuickForm/Rule/Regex.php index 666581ac00..666581ac00 100755 --- a/libs/HTML/QuickForm/Rule/Regex.php +++ b/libs/Html/QuickForm/Rule/Regex.php diff --git a/libs/HTML/QuickForm/Rule/Required.php b/libs/Html/QuickForm/Rule/Required.php index 9612d3e3ca..9612d3e3ca 100755 --- a/libs/HTML/QuickForm/Rule/Required.php +++ b/libs/Html/QuickForm/Rule/Required.php diff --git a/libs/HTML/QuickForm/RuleRegistry.php b/libs/Html/QuickForm/RuleRegistry.php index 4fdba99c30..4fdba99c30 100755 --- a/libs/HTML/QuickForm/RuleRegistry.php +++ b/libs/Html/QuickForm/RuleRegistry.php diff --git a/libs/HTML/QuickForm/advcheckbox.php b/libs/Html/QuickForm/advcheckbox.php index 54f2c49bcc..54f2c49bcc 100755 --- a/libs/HTML/QuickForm/advcheckbox.php +++ b/libs/Html/QuickForm/advcheckbox.php diff --git a/libs/HTML/QuickForm/autocomplete.php b/libs/Html/QuickForm/autocomplete.php index fdb7b3549d..fdb7b3549d 100755 --- a/libs/HTML/QuickForm/autocomplete.php +++ b/libs/Html/QuickForm/autocomplete.php diff --git a/libs/HTML/QuickForm/button.php b/libs/Html/QuickForm/button.php index ed54612469..ed54612469 100755 --- a/libs/HTML/QuickForm/button.php +++ b/libs/Html/QuickForm/button.php diff --git a/libs/HTML/QuickForm/checkbox.php b/libs/Html/QuickForm/checkbox.php index 9ded15cfbe..9ded15cfbe 100755 --- a/libs/HTML/QuickForm/checkbox.php +++ b/libs/Html/QuickForm/checkbox.php diff --git a/libs/HTML/QuickForm/date.php b/libs/Html/QuickForm/date.php index bf3858ae00..bf3858ae00 100755 --- a/libs/HTML/QuickForm/date.php +++ b/libs/Html/QuickForm/date.php diff --git a/libs/HTML/QuickForm/element.php b/libs/Html/QuickForm/element.php index f2bb6e0c67..f2bb6e0c67 100755 --- a/libs/HTML/QuickForm/element.php +++ b/libs/Html/QuickForm/element.php diff --git a/libs/HTML/QuickForm/file.php b/libs/Html/QuickForm/file.php index 35a186e6ac..35a186e6ac 100755 --- a/libs/HTML/QuickForm/file.php +++ b/libs/Html/QuickForm/file.php diff --git a/libs/HTML/QuickForm/group.php b/libs/Html/QuickForm/group.php index e48f26118a..e48f26118a 100755 --- a/libs/HTML/QuickForm/group.php +++ b/libs/Html/QuickForm/group.php diff --git a/libs/HTML/QuickForm/header.php b/libs/Html/QuickForm/header.php index 90e6f0517c..90e6f0517c 100755 --- a/libs/HTML/QuickForm/header.php +++ b/libs/Html/QuickForm/header.php diff --git a/libs/HTML/QuickForm/hidden.php b/libs/Html/QuickForm/hidden.php index 95417b6a7e..95417b6a7e 100755 --- a/libs/HTML/QuickForm/hidden.php +++ b/libs/Html/QuickForm/hidden.php diff --git a/libs/HTML/QuickForm/hiddenselect.php b/libs/Html/QuickForm/hiddenselect.php index 8d3d97b172..8d3d97b172 100755 --- a/libs/HTML/QuickForm/hiddenselect.php +++ b/libs/Html/QuickForm/hiddenselect.php diff --git a/libs/HTML/QuickForm/hierselect.php b/libs/Html/QuickForm/hierselect.php index 9e46f07bed..9e46f07bed 100755 --- a/libs/HTML/QuickForm/hierselect.php +++ b/libs/Html/QuickForm/hierselect.php diff --git a/libs/HTML/QuickForm/html.php b/libs/Html/QuickForm/html.php index 03651a4c14..03651a4c14 100755 --- a/libs/HTML/QuickForm/html.php +++ b/libs/Html/QuickForm/html.php diff --git a/libs/HTML/QuickForm/image.php b/libs/Html/QuickForm/image.php index 0c3c3a7553..0c3c3a7553 100755 --- a/libs/HTML/QuickForm/image.php +++ b/libs/Html/QuickForm/image.php diff --git a/libs/HTML/QuickForm/input.php b/libs/Html/QuickForm/input.php index fa82558a6a..fa82558a6a 100755 --- a/libs/HTML/QuickForm/input.php +++ b/libs/Html/QuickForm/input.php diff --git a/libs/HTML/QuickForm/link.php b/libs/Html/QuickForm/link.php index fd39cceea1..fd39cceea1 100755 --- a/libs/HTML/QuickForm/link.php +++ b/libs/Html/QuickForm/link.php diff --git a/libs/HTML/QuickForm/password.php b/libs/Html/QuickForm/password.php index a848aa0ac3..a848aa0ac3 100755 --- a/libs/HTML/QuickForm/password.php +++ b/libs/Html/QuickForm/password.php diff --git a/libs/HTML/QuickForm/radio.php b/libs/Html/QuickForm/radio.php index a90f199536..a90f199536 100755 --- a/libs/HTML/QuickForm/radio.php +++ b/libs/Html/QuickForm/radio.php diff --git a/libs/HTML/QuickForm/reset.php b/libs/Html/QuickForm/reset.php index 2f43a24b11..2f43a24b11 100755 --- a/libs/HTML/QuickForm/reset.php +++ b/libs/Html/QuickForm/reset.php diff --git a/libs/HTML/QuickForm/select.php b/libs/Html/QuickForm/select.php index 9c5108ab31..9c5108ab31 100755 --- a/libs/HTML/QuickForm/select.php +++ b/libs/Html/QuickForm/select.php diff --git a/libs/HTML/QuickForm/static.php b/libs/Html/QuickForm/static.php index 02875e6109..02875e6109 100755 --- a/libs/HTML/QuickForm/static.php +++ b/libs/Html/QuickForm/static.php diff --git a/libs/HTML/QuickForm/submit.php b/libs/Html/QuickForm/submit.php index 53156f993d..53156f993d 100755 --- a/libs/HTML/QuickForm/submit.php +++ b/libs/Html/QuickForm/submit.php diff --git a/libs/HTML/QuickForm/text.php b/libs/Html/QuickForm/text.php index cb1c10a254..cb1c10a254 100755 --- a/libs/HTML/QuickForm/text.php +++ b/libs/Html/QuickForm/text.php diff --git a/libs/HTML/QuickForm/textarea.php b/libs/Html/QuickForm/textarea.php index 4e72b59eee..4e72b59eee 100755 --- a/libs/HTML/QuickForm/textarea.php +++ b/libs/Html/QuickForm/textarea.php diff --git a/libs/HTML/QuickForm/xbutton.php b/libs/Html/QuickForm/xbutton.php index 7e4d49ceba..7e4d49ceba 100755 --- a/libs/HTML/QuickForm/xbutton.php +++ b/libs/Html/QuickForm/xbutton.php diff --git a/modules/Form.php b/modules/Form.php new file mode 100644 index 0000000000..134c6447e1 --- /dev/null +++ b/modules/Form.php @@ -0,0 +1,13 @@ +<?php + +require_once "HTML/QuickForm.php"; +require_once "HTML/QuickForm/Renderer/ArraySmarty.php"; + +class Piwik_Form extends HTML_QuickForm +{ + function __construct( $action = '' ) + { + parent::HTML_QuickForm('form', 'POST', $action); + } + +} diff --git a/modules/View.php b/modules/View.php new file mode 100644 index 0000000000..2e530dad4f --- /dev/null +++ b/modules/View.php @@ -0,0 +1,96 @@ +<?php +require_once 'Smarty/Smarty.class.php'; + +class Piwik_View +{ + private $smarty = false; + private $variables = array(); + + public function __construct( $templateFile, $smConf = array()) + { + $this->template = $templateFile; + $this->smarty = new Smarty(); + + foreach($smConf as $key => $value) + { + $this->smarty->$key = $value; + } + } + + /** + * Directly assigns a variable to the view script. + * VAR names may not be prefixed with '_'. + * @param string $key The variable name. + * @param mixed $val The variable value. + * @return void + */ + public function __set($key, $val) + { + $this->variables[$key] = $val; + } + + /** + * Retrieves an assigned variable. + * VAR names may not be prefixed with '_'. + * @param string $key The variable name. + * @return mixed The variable value. + */ + public function __get($key) + { + if(!isset($this->variables[$key])) + { + throw new Exception("Variable $key not known!"); + } + return $this->variables[$key]; + } + + public function render() + { + $this->smarty->assign('smarty', $this); + return $this->smarty->fetch($this->template); + } + + public function addForm( $form ) + { + // Create the renderer object + $renderer = new HTML_QuickForm_Renderer_ArraySmarty($this->smarty); + + // build the HTML for the form + $form->accept($renderer); + + // assign array with form data + $this->smarty->assign('form', $renderer->toArray()); + } + + public function assign($var, $value=null) + { + if (is_string($var)) + { + $this->smarty->assign($var, $value); + } + elseif (is_array($var)) + { + foreach ($var as $key => $value) + { + $this->smarty->assign($key, $value); + } + } + } + +/* public function isCached($template) + { + if ($this->smarty->is_cached($template)) + { + return true; + } + return false; + } + + + public function setCaching($caching) + { + $this->smarty->caching = $caching; + } +*/ +} +?> diff --git a/plugins/Login/Controller.php b/plugins/Login/Controller.php index aa4c119880..03d1fe92a7 100644 --- a/plugins/Login/Controller.php +++ b/plugins/Login/Controller.php @@ -1,5 +1,6 @@ <?php require_once "UsersManager.php"; +require_once "Form.php"; class Piwik_Login_Controller extends Piwik_Controller { function getDefaultAction() @@ -11,38 +12,48 @@ class Piwik_Login_Controller extends Piwik_Controller { print("<br>-----------<br>--LOGIN PAGE<br>-----------"); - $authCookieName = 'piwik-auth'; - $authCookieExpiry = time() + 3600; - - // value submitted in form - $login = 'root'; - $password = 'nintendo'; + $form = new Piwik_Login_Form; - $baseUrl = Piwik_Url::getCurrentHost() . Piwik_Url::getCurrentScriptName(); - - $urlToRedirect = Piwik_Common::getRequestVar('url', $baseUrl, 'string', $_POST); - $currentUrl = Piwik_Url::getCurrentUrl(); - - $tokenAuth = Piwik_UsersManager_API::getTokenAuth($login,$password); - - Piwik_Login::prepareAuthObject($login, $tokenAuth); - - $auth = Zend_Registry::get('auth'); - - if($auth->authenticate()->isValid()) + if($form->validate()) { - print("Authenticated, redirecting to $urlToRedirect"); + $authCookieName = 'piwik-auth'; + $authCookieExpiry = time() + 3600; + + // value submitted in form + $login = 'root'; + $password = 'nintendo'; + + $baseUrl = Piwik_Url::getCurrentHost() . Piwik_Url::getCurrentScriptName(); + + $urlToRedirect = Piwik_Common::getRequestVar('url', $baseUrl, 'string', $_POST); + $currentUrl = Piwik_Url::getCurrentUrl(); + + $tokenAuth = Piwik_UsersManager_API::getTokenAuth($login,$password); + + Piwik_Login::prepareAuthObject($login, $tokenAuth); + $auth = Zend_Registry::get('auth'); - if($currentUrl === $urlToRedirect) + if($auth->authenticate()->isValid()) { - print("We redirect to the homepage! $baseUrl"); + print("Authenticated, redirecting to $urlToRedirect"); + + + if($currentUrl === $urlToRedirect) + { + print("We redirect to the homepage! $baseUrl"); + } + } + else + { + print("Error authenticated"); + } } - else - { - print("Error authenticated"); - } + + $view = new Piwik_View('home.tpl'); + $view->addForm( $form ); + $view->render(); } } ?> diff --git a/plugins/Login/Form.php b/plugins/Login/Form.php new file mode 100644 index 0000000000..998a55897a --- /dev/null +++ b/plugins/Login/Form.php @@ -0,0 +1,11 @@ +<?php +require_once "modules/Form.php"; +class Piwik_Login_Form extends Piwik_Form +{ + function __construct() + { + parent::__construct(); + } + +} +?> diff --git a/themes/default/home.tpl b/themes/default/home.tpl new file mode 100644 index 0000000000..92b6fd0093 --- /dev/null +++ b/themes/default/home.tpl @@ -0,0 +1,4 @@ +Home TEMPLATE SMARTY + + +{debug}
\ No newline at end of file |