- if ($k == 'platal_perms') {
- $this->perms = explode(':', $v);
- return;
- }
+ $this->content[$k] = $v;
+ }
+ }
+
+ /** Save the content of the wiki page based on the
+ * fetched content.
+ */
+ private function saveContent()
+ {
+ if (is_null($this->content)) {
+ return false;
+ }
+ $lines = array();
+ foreach ($this->content as $k => $v) {
+ $lines[] = "$k=$v";
+ }
+ return file_put_contents($this->filename(), implode("\n", $lines)) !== false;
+ }
+
+ /** Get a field from the wiki content.
+ */
+ public function getField($name)
+ {
+ $this->fetchContent();
+ return @$this->content[$name];
+ }
+
+ /** Fetch the permissions.
+ */
+ private function fetchPerms()
+ {
+ if (!is_null($this->perms)) {
+ return;
+ }
+ $this->fetchContent();
+ if (isset($this->content['platal_perms'])) {
+ $this->perms = explode(':', $this->content['platal_perms']);
+ } else {
+ $this->perms = self::$defaulPerms;