-
Notifications
You must be signed in to change notification settings - Fork 0
/
database.php
56 lines (43 loc) · 1.15 KB
/
database.php
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
//to fake the database. Be between classes and JSON Files
// for BOOKMARK
function databaseBookmarkNameFile() {
require 'config.php';
return $bookmarks_file;
}
function databaseBookmarkFullFile() {
require 'config.php';
return $folder_json_files . databaseBookmarkNameFile();
}
function saveBookmarkList($bookmarks) {
$file = fopen(databaseBookmarkFullFile(), "w");
fwrite($file, json_encode($bookmarks));
fclose($file);
}
function readBookmarkFile() {
return json_decode(haveBookmarkJSONfile(), true);
}
function haveBookmarkJSONfile() {
return file_get_contents(databaseBookmarkFullFile());
}
// for BOT
function databaseBotNameFile() {
require 'config.php'; //else require_once do nothing
return $bot_file;
}
function databaseBotFullFile() {
require 'config.php';
return $folder_json_files . databaseBotNameFile();
}
function saveBotList($bots) {
$file = fopen(databaseBotFullFile(), "w");
fwrite($file, json_encode($bots));
fclose($file);
}
function readBotFile() {
return json_decode(haveBotJSONfile(), true);
}
function haveBotJSONfile() {
return file_get_contents(databaseBotFullFile());
}
?>