streams/Zotlabs/Module/Settings.php

79 lines
1.2 KiB
PHP
Raw Normal View History

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