1 |
<?php |
2 |
|
3 |
class YakkaMethodView { |
4 |
function YakkaMethodView(&$engine) { |
5 |
$this->engine = &$engine; |
6 |
} |
7 |
|
8 |
function run() { |
9 |
/* getting pagesource from edit/create */ |
10 |
if ($pageSource = $this->engine->arguments->getArgument("page-source")) { |
11 |
$this->engine->runtime->page->setSource($pageSource); |
12 |
$this->engine->runtime->page->setModifyUser($this->engine->runtime->user); |
13 |
$this->engine->runtime->page->save(); |
14 |
if ($pageParent = $this->engine->arguments->getArgument("page-parent")) { |
15 |
$this->engine->runtime->page->copyGrantsOf($pageParent); |
16 |
$this->engine->runtime->page->copyRevokesOf($pageParent); |
17 |
} |
18 |
} |
19 |
|
20 |
/* login */ |
21 |
if (($username = $this->engine->arguments->getArgument("username")) && ($password = $this->engine->arguments->getArgument("password"))) { |
22 |
$this->engine->runtime->user = new YakkaUser(); |
23 |
$this->engine->runtime->user->authenticate($username, $password); |
24 |
$this->engine->session->user = $this->engine->runtime->user->toString(); |
25 |
} |
26 |
|
27 |
return "<method id='view' access-privilege='read'/>"; |
28 |
} |
29 |
} |
30 |
|
31 |
?> |