aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Settings.php
blob: 79031c98f704470286e85e87fc90d99c70dba498 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
namespace Zotlabs\Module; /** @file */

require_once('include/zot.php');
require_once('include/security.php');

class Settings extends \Zotlabs\Web\Controller {

	private $sm = null;

	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';
		}	

		$this->sm = new \Zotlabs\Web\SubModule();
	}
	
	
	function post() {
	
		if(! local_channel())
			return;
	
		if($_SESSION['delegate'])
			return;
	
		// logger('mod_settings: ' . print_r($_REQUEST,true));
	
		if(argc() > 1) {
			if($this->sm->call('post') !== false) {
				return;
			}
		}
	
		goaway(z_root() . '/settings' );
		return; // NOTREACHED
	}
	
	
	
	function get() {
	
		nav_set_selected('Settings');
	
		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']);
	
		$o = $this->sm->call('get');
		if($o !== false)
			return $o;

		$o = '';

	
	}	
}