1 |
bareface |
1.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 |
bareface |
1.2 |
|
14 |
|
|
switch($this->engine->arguments->getArgument("page-version-severity")) { |
15 |
|
|
case "release": |
16 |
|
|
$this->engine->runtime->page->increaseReleaseVersion(); |
17 |
|
|
break; |
18 |
|
|
case "major": |
19 |
|
|
$this->engine->runtime->page->increaseMajorVersion(); |
20 |
|
|
break; |
21 |
|
|
case "minor": |
22 |
|
|
$this->engine->runtime->page->increaseMinorVersion(); |
23 |
|
|
break; |
24 |
|
|
case "create": |
25 |
|
|
$this->engine->runtime->page->setVersion("0.1.0"); |
26 |
|
|
break; |
27 |
|
|
} |
28 |
bareface |
1.1 |
$this->engine->runtime->page->save(); |
29 |
|
|
if ($pageParent = $this->engine->arguments->getArgument("page-parent")) { |
30 |
|
|
$this->engine->runtime->page->copyGrantsOf($pageParent); |
31 |
|
|
$this->engine->runtime->page->copyRevokesOf($pageParent); |
32 |
|
|
} |
33 |
|
|
} |
34 |
|
|
|
35 |
|
|
/* login */ |
36 |
|
|
if (($username = $this->engine->arguments->getArgument("username")) && ($password = $this->engine->arguments->getArgument("password"))) { |
37 |
|
|
$this->engine->runtime->user = new YakkaUser(); |
38 |
|
|
$this->engine->runtime->user->authenticate($username, $password); |
39 |
|
|
$this->engine->session->user = $this->engine->runtime->user->toString(); |
40 |
|
|
} |
41 |
|
|
|
42 |
|
|
return "<method id='view' access-privilege='read'/>"; |
43 |
|
|
} |
44 |
|
|
} |
45 |
|
|
|
46 |
|
|
?> |