summaryrefslogtreecommitdiffstats
path: root/skeleton/admin.php
blob: aaf6136692dd6d71cf48bf57f2e2b1cbf33ef08d (plain)
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
<?php

/**
* ownCloud - Sample application
*
* @author Jakob Sack
* @copyright 2011 Jakob Sack kde@jakobsack.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
*
*/

// Do not prepare the file system (for demonstration purpose)
// We HAVE TO set this var before including base.php
$RUNTIME_NOSETUPFS = true;

// Init owncloud
require_once('../lib/base.php');

// We need the file system although we said do not load it! Do it by hand now
OC_UTIL::setupFS();

// We load OC_TEMPLATE, too. This one is not loaded by base
require( 'template.php' );

// The user should have admin rights. This is an admin page!
if( !OC_USER::isLoggedIn() || !OC_USER::ingroup( $_SESSION['username'], 'admin' )){
	// Bad boy! Go to the very first page of owncloud
	header( "Location: ".OC_HELPER::linkTo( "index.php" ));
	exit();
}

// Do some crazy Stuff over here
$myvar = 2;
$myarray = array( "foo" => array( 0, 1, 2 ), "bar" => "baz" );

// Preparing for output!
$tmpl = new OC_TEMPLATE( "skeleton", "admin", "admin" ); // Programname, template, mode
// Assign the vars
$tmpl->assign( "var", $myvar );
$tmpl->assign( "array", $myarray );
// Print page
$tmpl->printPage();

?>