projects
/
platal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
make add(Js|Css)Link don't need the extra css/ or javascript/ link, so
[platal.git]
/
classes
/
Platal.php
diff --git
a/classes/Platal.php
b/classes/Platal.php
index
88c6fd1
..
c34d34d
100644
(file)
--- a/
classes/Platal.php
+++ b/
classes/Platal.php
@@
-34,18
+34,32
@@
class Platal
function Platal()
{
$modules = func_get_args();
function Platal()
{
$modules = func_get_args();
- $this->path = trim(Get::_get('
p
', null), '/');
+ $this->path = trim(Get::_get('
n
', null), '/');
$this->__mods = array();
$this->__hooks = array();
array_unshift($modules, 'core');
foreach ($modules as $module) {
$this->__mods = array();
$this->__hooks = array();
array_unshift($modules, 'core');
foreach ($modules as $module) {
- $this->__mods[$module] = $m = PLModule::factory($
this, $
module);
+ $this->__mods[$module] = $m = PLModule::factory($module);
$this->__hooks += $m->handlers();
}
}
$this->__hooks += $m->handlers();
}
}
+ function pl_self($n = null)
+ {
+ if (is_null($n))
+ return $this->path;
+
+ if ($n >= 0)
+ return join('/', array_slice($this->argv, 0, $n + 1));
+
+ if ($n <= -count($this->argv))
+ return $this->argv[0];
+
+ return join('/', array_slice($this->argv, 0, $n));
+ }
+
function find_hook()
{
$p = $this->path;
function find_hook()
{
$p = $this->path;
@@
-86,17
+100,31
@@
class Platal
if ($hook['auth'] > S::v('auth', AUTH_PUBLIC)) {
// FIXME: don't use 'session' object anymore
if ($hook['auth'] > S::v('auth', AUTH_PUBLIC)) {
// FIXME: don't use 'session' object anymore
- $_SESSION['session']->doAuth($page);
+ if (!$_SESSION['session']->doAuth()) {
+ $this->force_login($page);
+ }
}
return call_user_func_array($hook['hook'], $args);
}
}
return call_user_func_array($hook['hook'], $args);
}
+ function force_login(&$page)
+ {
+ if (S::logged() and !$new_name) {
+ $page->changeTpl('password_prompt_logged.tpl');
+ $page->addJsLink('do_challenge_response_logged.js');
+ } else {
+ $page->changeTpl('password_prompt.tpl');
+ $page->addJsLink('do_challenge_response.js');
+ }
+ $page->run();
+ }
+
function run()
{
global $page;
function run()
{
global $page;
- new_skinned_page('index.tpl'
, AUTH_PUBLIC
);
+ new_skinned_page('index.tpl');
if (empty($this->path)) {
$this->path = 'index';
if (empty($this->path)) {
$this->path = 'index';
@@
-114,6
+142,16
@@
class Platal
$page->assign_by_ref('platal', $this);
$page->run();
}
$page->assign_by_ref('platal', $this);
$page->run();
}
+
+ function on_subscribe($forlife, $uid, $promo, $pass)
+ {
+ $args = func_get_args();
+ foreach ($this->__mods as $mod) {
+ if (!is_callable($mod, 'on_subscribe'))
+ continue;
+ call_user_func_array(array($mod, 'on_subscribe'), $args);
+ }
+ }
}
?>
}
?>