ctucx.git: tinyDAV

[php] Cal-/ CardDAV server with a simple web-GUI based on SabreDAV

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 <?php
define('PATH', __DIR__);

require(PATH.'/lib/JSONDB.php');

if (php_sapi_name() !== 'cli') {
	die("run me on a shell.");
}

if (!file_exists(PATH.'/../data/users.json')) {
	mkdir(PATH.'/../data');
	mkdir(PATH.'/../data/addressbooks');
	mkdir(PATH.'/../data/calendars');
	mkdir(PATH.'/../data/files');


	$db = new JSONDB(PATH.'/../data');
	$db->insert( 'users.json', [ 
			'id'       => 1,
			'username' => 'admin',
			'password' => password_hash("admin", PASSWORD_DEFAULT),
			'active'   => true,
		]);
}