streams/Zotlabs/Module/Settings.php

86 lines
1.3 KiB
PHP
Raw Normal View History

2016-04-19 03:38:38 +00:00
<?php
2019-10-11 23:45:04 +00:00
namespace Zotlabs\Module;
2016-04-19 03:38:38 +00:00
2019-10-11 23:45:04 +00:00
use App;
use Zotlabs\Web\Controller;
use Zotlabs\Web\SubModule;
2018-06-01 02:42:13 +00:00
require_once('include/security.php');
2016-04-19 03:38:38 +00:00
2019-10-11 23:45:04 +00:00
class Settings extends Controller {
2016-04-19 03:38:38 +00:00
2016-09-07 03:10:56 +00:00
private $sm = null;
2016-04-19 03:38:38 +00:00
function init() {
2019-10-11 23:45:04 +00:00
if (! local_channel()) {
2016-04-19 03:38:38 +00:00
return;
2019-10-11 23:45:04 +00:00
}
2016-04-19 03:38:38 +00:00
2019-10-11 23:45:04 +00:00
if ($_SESSION['delegate']) {
2016-04-19 03:38:38 +00:00
return;
2019-10-11 23:45:04 +00:00
}
2016-04-19 03:38:38 +00:00
2019-10-11 23:45:04 +00:00
App::$profile_uid = local_channel();
2016-04-19 03:38:38 +00:00
// default is channel settings in the absence of other arguments
2019-10-11 23:45:04 +00:00
if (argc() == 1) {
2016-04-19 03:38:38 +00:00
// We are setting these values - don't use the argc(), argv() functions here
2019-10-11 23:45:04 +00:00
App::$argc = 2;
App::$argv[] = 'channel';
2016-07-19 04:37:34 +00:00
}
2016-09-07 03:10:56 +00:00
2019-10-11 23:45:04 +00:00
$this->sm = new SubModule();
2016-04-19 03:38:38 +00:00
}
2016-07-04 05:47:46 +00:00
function post() {
2016-04-19 03:38:38 +00:00
2019-10-11 23:45:04 +00:00
if (! local_channel()) {
2016-04-19 03:38:38 +00:00
return;
2019-10-11 23:45:04 +00:00
}
2016-04-19 03:38:38 +00:00
2019-10-11 23:45:04 +00:00
if ($_SESSION['delegate']) {
2016-04-19 03:38:38 +00:00
return;
2019-10-11 23:45:04 +00:00
}
2016-04-19 03:38:38 +00:00
2016-07-04 05:47:46 +00:00
// logger('mod_settings: ' . print_r($_REQUEST,true));
2016-04-19 03:38:38 +00:00
2019-10-11 23:45:04 +00:00
if (argc() > 1) {
if ($this->sm->call('post') !== false) {
return;
}
2016-04-19 03:38:38 +00:00
}
goaway(z_root() . '/settings' );
}
2016-09-07 03:10:56 +00:00
2016-04-19 03:38:38 +00:00
2016-06-01 04:45:33 +00:00
function get() {
2016-04-19 03:38:38 +00:00
nav_set_selected('Settings');
2016-04-19 03:38:38 +00:00
2019-10-11 23:45:04 +00:00
if ((! local_channel()) || ($_SESSION['delegate'])) {
2016-04-19 03:38:38 +00:00
notice( t('Permission denied.') . EOL );
return login();
}
2019-10-11 23:45:04 +00:00
$channel = App::get_channel();
if ($channel) {
2016-04-19 03:38:38 +00:00
head_set_icon($channel['xchan_photo_s']);
2019-10-11 23:45:04 +00:00
}
2016-09-07 03:10:56 +00:00
$o = $this->sm->call('get');
2019-10-11 23:45:04 +00:00
if ($o !== false) {
2016-04-19 03:38:38 +00:00
return $o;
2019-10-11 23:45:04 +00:00
}
2019-10-11 23:45:04 +00:00
$o = EMPTY_STR;
2016-09-07 03:10:56 +00:00
}
}
2016-04-19 03:38:38 +00:00