-
Notifications
You must be signed in to change notification settings - Fork 1
/
api_key.php
25 lines (23 loc) · 1.05 KB
/
api_key.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
<?php
require_once('runtime.php');
require_once(ROOT_DIR.'/lib/core/ApiKeyList.class.php');
require_once(ROOT_DIR.'/lib/core/Router.class.php');
require_once(ROOT_DIR.'/lib/core/User.class.php');
if($_GET['section'] == "insert_add") {
//add new api key
do {
$api_key = new ApiKey(false, ApiKey::generateApiKey(), (int)$_GET['object_id'], $_GET['object_type'], $_POST['description']);
$api_key_id = $api_key->store();
} while(!$api_key_id);
$message[] = array("Es wurde ein neuer API-Key ".$api_key->getApiKey()." generiert und gespeichert.", 1);
Message::setMessage($message);
header('Location: ./api_key_list.php?object_id='.$_GET['object_id'].'&object_type='.$_GET['object_type']);
} elseif($_GET['section'] == "delete") {
$api_key = new ApiKey((int)$_GET['api_key_id']);
$api_key->fetch();
$message[] = array("Der API-Key ".$api_key->getApiKey()." wurde gelöscht.", 1);
$api_key->delete();
Message::setMessage($message);
header('Location: ./api_key_list.php?object_id='.$_GET['object_id'].'&object_type='.$_GET['object_type']);
}
?>