knowndiaspora/Pages/Admin.php

39 lines
1.2 KiB
PHP
Raw Normal View History

2015-01-17 23:12:58 +01:00
<?php
/**
2015-01-17 23:21:25 +01:00
* Diaspora pages
2015-01-17 23:12:58 +01:00
*/
2015-01-17 23:21:25 +01:00
namespace IdnoPlugins\Diaspora\Pages {
2015-01-17 23:12:58 +01:00
/**
2015-01-17 23:21:25 +01:00
* Default class to serve Diaspora settings in administration
2015-01-17 23:12:58 +01:00
*/
class Admin extends \Idno\Common\Page
{
function getContent()
{
$this->adminGatekeeper(); // Admins only
$t = \Idno\Core\site()->template();
2015-01-17 23:21:25 +01:00
$body = $t->draw('admin/diaspora');
$t->__(array('title' => 'Diaspora', 'body' => $body))->drawPage();
2015-01-17 23:12:58 +01:00
}
function postContent() {
$this->adminGatekeeper(); // Admins only
$appId = $this->getInput('appId');
$secret = $this->getInput('secret');
2015-01-17 23:21:25 +01:00
\Idno\Core\site()->config->config['diaspora'] = array(
2015-01-17 23:12:58 +01:00
'appId' => $appId,
'secret' => $secret
);
\Idno\Core\site()->config()->save();
2015-01-17 23:21:25 +01:00
\Idno\Core\site()->session()->addMessage('Your Diaspora application details were saved.');
$this->forward(\Idno\Core\site()->config()->getDisplayURL() . 'admin/diaspora/');
2015-01-17 23:12:58 +01:00
}
}
2015-01-17 23:21:25 +01:00
}