/** * The translation definitions are located in two files: a definition file, * containing all the tags plus the translation - usually - in Enlish and * a translation containing all other files. Read in the information from * these files and return it in a tag-sorted array. * * @param dictionaryName string The name of the dictionary from where to * look up definitions * * @return array containing all definitions */ private function getTranslationArray($dictionaryName) { try { $dictionaryBase = Config::get_config('install_path') . "/dictionaries/"; $definitionPath = $dictionaryBase . $dictionaryName . ".definition.json"; $translationPath = $dictionaryBase . $dictionaryName . ".translation.json"; include_once 'file_io.php'; $definitionFile = File_IO::readFromFile($definitionPath); $translationFile = File_IO::readFromFile($translationPath); } catch (FileException $fexp) { } if (isset($definitionFile)) { $definitions = (array) json_decode($definitionFile); } else { Logger::log_event(LOG_WARNING, "Could not load definitions for " . "dictionary with name {$dictionaryName}!"); return null; } if (isset($translationFile)) { $translations = (array) json_decode($translationFile); foreach ($translations as $tag => $entry) { $definitions[$tag] = array_merge((array) $definitions[$tag], (array) $entry); } } return $definitions; }
/** * get the custom mail template defined per NREN * * @param $nren string the name of the NREN for which the custom template * exists */ private function fetchNRENMailTpl($nren) { $tpl_path = Config::get_config('custom_mail_tpl') . $nren . '/custom.tpl'; if (file_exists($tpl_path) === true) { try { $tpl_string = File_IO::readFromFile($tpl_path); return $tpl_string; } catch (FileException $fexp) { Framework::error_output("Could not open NREN-specific notification " . "template! Server said " . htmlentities($fexp->getMessage()) . "!"); } } $main_tpl_path = Config::get_config('install_path') . ConfusaConstants::$SMARTY_TEMPLATES; $main_tpl_path .= 'email/notification.tpl'; try { $tpl_string = File_IO::readFromFile($main_tpl_path); return $tpl_string; } catch (FileException $fexp) { Framework::error_output("Could not open Confusa's default notification " . "mail template! Server said " . htmlentities($fexp->getMessage()) . "!"); Logger::log_event(LOG_WARNING, "[nadm] Could not open Confusa's default " . "notification mail template! Server said " . $fexp->getMessage()); } }