/** * validate the logical structure of a lang-file * * This function is similar to function checkLanguage() (see below) but checks for all * lang-files and outputs more helpful information. * * @return string system message */ function checkAllLanguages() { // TODO: lng object should not be used in this class global $lng; // set path to directory where lang-files reside $d = dir($this->lang_path); $tmpPath = getcwd(); chdir($this->lang_path); // for giving a message when no lang-file was found $found = false; // get available lang-files while ($entry = $d->read()) { if (is_file($entry) && ereg("(^ilias_.{2}\\.lang\$)", $entry)) { // textmeldung, wenn langfile gefunden wurde $output .= "<br/><br/>" . $lng->txt("langfile_found") . ": " . $entry; $content = file($entry); $found = true; $error = false; if ($content = ilObjLanguage::cut_header($content)) { foreach ($content as $key => $val) { $separated = explode($this->separator, trim($val)); $num = count($separated); if ($num != 3) { $error = true; $line = $key + 37; $output .= "<br/><b/>" . $lng->txt("err_in_line") . " " . $line . " !</b> "; $output .= $lng->txt("module") . ": " . $separated[0]; $output .= ", " . $lng->txt("identifier") . ": " . $separated[1]; $output .= ", " . $lng->txt("value") . ": " . $separated[2]; switch ($num) { case 1: if (empty($separated[0])) { $output .= "<br/>" . $lng->txt("err_no_param") . " " . $lng->txt("check_langfile"); } else { $output .= "<br/>" . $lng->txt("err_1_param") . " " . $lng->txt("check_langfile"); } break; case 2: $output .= "<br/>" . $lng->txt("err_2_param") . " " . $lng->txt("check_langfile"); break; default: $output .= "<br/>" . $lng->txt("err_over_3_param") . " " . $lng->txt("check_langfile"); break; } } } if ($error) { $output .= "<br/>" . $lng->txt("file_not_valid") . " " . $lng->txt("err_count_param"); } else { $output .= "<br/>" . $lng->txt("file_valid"); } } else { $output .= "<br/>" . $lng->txt("file_not_valid") . " " . $lng->txt("err_wrong_header"); } } } $d->close(); if (!$found) { $output .= "<br/>" . $lng->txt("err_no_langfile_found"); } chdir($tmpPath); return $output; }