Fix some things that have caused errors to get logged

This commit is contained in:
Robbie Antenesse 2019-08-26 15:39:21 -06:00
parent 122282d1a7
commit 9d08bbb337
3 changed files with 8 additions and 5 deletions

View File

@ -95,7 +95,7 @@ VALUES ($new_id, ?, ?, ?, ?, ?, ?)";
$result = $this->db->query($query)->fetch();
if ($result) {
// Default json values in case they are somehow not created by front end first
$partsOfSpeech = $result['parts_of_speech'] !== '' ? $result['parts_of_speech'] : $this->defaults['partsOfSpeech'];
$partsOfSpeech = isset($result['parts_of_speech']) && $result['parts_of_speech'] !== '' ? $result['parts_of_speech'] : $this->defaults['partsOfSpeech'];
return array(
'externalID' => $result['id'],

View File

@ -29,7 +29,7 @@ class PublicDictionary {
$result = $this->db->query($query, array($dictionary))->fetch();
if ($result) {
// Default json values in case they are somehow not created by front end first
$partsOfSpeech = $result['parts_of_speech'] !== '' ? $result['parts_of_speech'] : $this->defaults['partsOfSpeech'];
$partsOfSpeech = isset($result['parts_of_speech']) && $result['parts_of_speech'] !== '' ? $result['parts_of_speech'] : $this->defaults['partsOfSpeech'];
return array(
'externalID' => $result['id'],

View File

@ -31,8 +31,10 @@ switch ($view) {
if ($dictionary_data !== false) {
$dictionary_data['words'] = $dictionary->words;
$html = str_replace('{{dict}}', $dict, $html);
$html = str_replace('{{dict_name}}', $dictionary_data['name'] . ' ' . $dictionary_data['specification'], $html);
$html = str_replace('{{public_name}}', $dictionary_data['createdBy'], $html);
$dictionary_name = (isset($dictionary_data['name']) ? $dictionary_data['name'] : 'Unnamed')
. ' ' . (isset($dictionary_data['specification']) ? $dictionary_data['specification'] : 'Dictionary');
$html = str_replace('{{dict_name}}', $dictionary_name, $html);
$html = str_replace('{{public_name}}', isset($dictionary_data['createdBy']) ? $dictionary_data['createdBy'] : 'Someone', $html);
$dictionary_json = json_encode(utf8ize($dictionary_data));
$html = str_replace('{{dict_json}}', addslashes($dictionary_json), $html);
} else {
@ -54,7 +56,8 @@ switch ($view) {
$dictionary = new PublicDictionary($dict, true);
$dictionary_data = $dictionary->details;
if ($dictionary_data !== false) {
$dictionary_name = $dictionary_data['name'] . ' ' . $dictionary_data['specification'];
$dictionary_name = (isset($dictionary_data['name']) ? $dictionary_data['name'] : 'Unnamed')
. ' ' . (isset($dictionary_data['specification']) ? $dictionary_data['specification'] : 'Dictionary');
$word_data = $dictionary->getSpecificPublicDictionaryWord($dict, $word);
if ($word_data === false) {
$word_data = array(