Add error message if public dictionary not found

This commit is contained in:
Robbie Antenesse 2019-05-28 22:23:59 -06:00
parent 538e20b8c6
commit 6aab9f4ea1
1 changed files with 6 additions and 1 deletions

View File

@ -1,10 +1,10 @@
<?php
$view = isset($_GET['view']) ? $_GET['view'] : false;
$dict = isset($_GET['dict']) ? $_GET['dict'] : false;
switch ($view) {
case 'publicview': {
$html = file_get_contents('../view.html');
$dict = isset($_GET['dict']) ? $_GET['dict'] : false;
if ($dict !== false) {
require_once('./Dictionary.php');
$dictionary = new Dictionary();
@ -16,6 +16,11 @@ switch ($view) {
$html = str_replace('{{public_name}}', $dictionary_data['createdBy'], $html);
$dictionary_json = json_encode($dictionary_data);
$html = str_replace('{{dict_json}}', addslashes($dictionary_json), $html);
} else {
$html = str_replace('{{dict}}', 'error', $html);
$html = str_replace('{{dict_name}}', 'Error: Dictionary Not Found', $html);
$html = str_replace('{{public_name}}', 'Error', $html);
$html = str_replace('{{dict_json}}', '{"name": "Error:", "specification": "Dictionary Not Found", "words": []}', $html);
}
echo $html;
}