Commit 88baa44b authored by fettesvieh's avatar fettesvieh

- created a class called "lang"

- moved the lang() function to the lang class and renamed it to t() (example: $lang->t('yourMod', 'yourKey'))
- language files are now cached
parent 38b7733b
......@@ -63,7 +63,7 @@ class breadcrumb
*/
public static function output($mode = 1, $id = '')
{
global $uri, $tpl;
global $lang, $uri, $tpl;
$module = $uri->mod;
$page = $uri->page;
......@@ -124,27 +124,27 @@ class breadcrumb
if (!empty(self::$end)) {
$tpl->assign('end', self::$end);
} elseif ($page == 'list') {
$tpl->assign('end', lang($module, $module));
$tpl->assign('end', $lang->t($module, $module));
} else {
$tpl->assign('end', lang($module, $page));
$tpl->assign('end', $lang->t($module, $page));
}
}
return $tpl->fetch('common/breadcrumb.html');
// Brotkrümelspur für das Admin Panel
} elseif (defined('IN_ADM') && $mode == 1) {
if ($page == 'adm_list' && count(self::$steps) == 0 && empty(self::$end)) {
self::assign(lang('common', 'acp'), uri('acp'));
self::assign($lang->t('common', 'acp'), uri('acp'));
$tpl->assign('breadcrumb', self::$steps);
$tpl->assign('end', lang($module, $module));
$tpl->assign('end', $lang->t($module, $module));
} elseif (count(self::$steps) > 0 || !empty(self::$end)) {
$tpl->assign('breadcrumb', self::$steps);
$tpl->assign('end', self::$end);
// Falls keine zusätzlichen Brotkrumen angegeben sind, jeweiligen Seitennamen der Moduldatei ausgeben
} else {
self::assign(lang('common', 'acp'), uri('acp'));
self::assign(lang($module, $module), uri('acp/' . $module));
self::assign($lang->t('common', 'acp'), uri('acp'));
self::assign($lang->t($module, $module), uri('acp/' . $module));
$tpl->assign('breadcrumb', self::$steps);
$tpl->assign('end', lang($module, $page));
$tpl->assign('end', $lang->t($module, $page));
}
return $tpl->fetch('common/breadcrumb.html');
// Nur Seitentitel ausgeben
......@@ -152,7 +152,7 @@ class breadcrumb
if (!empty(self::$end)) {
return self::$end;
} else {
return $page != 'list' && $page != 'adm_list' ? lang($module, $page) : lang($module, $module);
return $page != 'list' && $page != 'adm_list' ? $lang->t($module, $page) : $lang->t($module, $module);
}
}
}
......
......@@ -7,7 +7,7 @@
* @subpackage Core
*/
/**
* Erstellt den Cache für bestimmte SQL Abfragen, um die Leistung des ACP3 zu steigern
* lasse zur Ersetllung des Caches, um die Leistung von bestimmten Aktionen des ACP3 zu steigern
*
* @author Goratsch Webdesign
* @package ACP3
......@@ -16,31 +16,31 @@
class cache
{
/**
* Überprüft, ob der SQL Cache für eine bestimmte Abfrage schon erstellt wurde
* Überprüft, ob der Cache für eine bestimmte Abfrage schon erstellt wurde
*
* @param string $filename
* @return boolean
*/
public static function check($filename)
{
if (is_file(ACP3_ROOT . 'cache/sql_' . md5($filename) . '.php')) {
if (is_file(ACP3_ROOT . 'cache/cache_' . md5($filename) . '.php')) {
return true;
}
return false;
}
/**
* Erstellt den SQL Cache
* Erstellt den Cache
*
* @param string $filename
* Gewünschter Dateiname des SQL Caches
* @param array $sql_results
* Datensätze der SQL Abfrage
* Gewünschter Dateiname des Caches
* @param array $data
* Daten, welche gecachet werden sollen
* @return boolean
*/
public static function create($filename, $sql_results)
public static function create($filename, $data)
{
if (!empty($sql_results)) {
$bool = @file_put_contents(ACP3_ROOT . 'cache/sql_' . md5($filename) . '.php', serialize($sql_results));
if (!empty($data)) {
$bool = @file_put_contents(ACP3_ROOT . 'cache/cache_' . md5($filename) . '.php', serialize($data));
return $bool ? true : false;
} elseif (self::check($filename)) {
......@@ -49,7 +49,7 @@ class cache
return false;
}
/**
* Löscht den SQL Cache für einen bestimmten SQL Cache
* Löscht eine bestimmte gecachete Datei
*
* @param string $filename
* Zu löschende Datei
......@@ -58,12 +58,12 @@ class cache
public static function delete($filename)
{
if (self::check($filename)) {
return unlink(ACP3_ROOT . 'cache/sql_' . md5($filename) . '.php');
return unlink(ACP3_ROOT . 'cache/cache_' . md5($filename) . '.php');
}
return false;
}
/**
* Ausgabe des SQL Caches
* Ausgabe der gecacheten Aktion
*
* @param string $filename
* Auszugebende Datei
......@@ -72,12 +72,12 @@ class cache
public static function output($filename)
{
if (self::check($filename)) {
return unserialize(@file_get_contents(ACP3_ROOT . 'cache/sql_' . md5($filename) . '.php'));
return unserialize(@file_get_contents(ACP3_ROOT . 'cache/cache_' . md5($filename) . '.php'));
}
return array();
}
/**
* Löscht alle gecacheten SQL Queries
* Löscht en gesamten Cache
*/
public static function purge()
{
......
<?php
/**
* Language
*
* @author Goratsch Webdesign
* @package ACP3
* @subpackage Core
*/
/**
* Stellt Funktionen bereit, um das ACP3 in verschiendene Sprachen zu übersetzen
*
* @author Goratsch Webdesign
* @package ACP3
* @subpackage Core
*/
class lang
{
/**
* Die zur Zeit eingestellte Sprache
*
* @var string
* @access private
*/
private $lang = CONFIG_LANG;
function __construct()
{
global $auth;
$info = $auth->getUserInfo();
if (!empty($info)) {
$this->lang = $info['language'];
}
}
/**
* Cached die Sprachfiles, um diese schneller verarbeiten zu können
*/
public function createLangCache()
{
$data = array();
$path = ACP3_ROOT . 'languages/' . $this->lang . '/';
$dir = scandir($path);
foreach ($dir as $row) {
$module = substr($row, 0, strrpos($row, '.'));
if (is_file($path . $module . '.xml')) {
$xml = simplexml_load_file($path . $module . '.xml');
foreach ($xml->item as $row) {
$data[$module][(string) $row->name] = (string) $row->message;
}
}
}
cache::create('language_' . $this->lang, $data);
}
/**
* Gibt den angeforderten Sprachstring aus
*
* @param string $module
* @param string $key
* @return string
*/
public function t($module, $key)
{
static $lang_data = array();
if (empty($lang_data)) {
$lang_data = $this->outputLangCache();
}
$path = ACP3_ROOT . 'languages/' . $this->lang . '/' . $module . '.xml';
return isset($lang_data[$module][$key]) ? $lang_data[$module][$key] : strtoupper('{' . $module . '_' . $key . '}');
}
/**
* Gibt die gecacheten Sprachstrings aus
*
* @return array
*/
private function outputLangCache()
{
$filename = 'language_' . $this->lang;
if (!cache::check($filename)) {
$this->createLangCache();
}
return cache::output($filename);
}
}
?>
\ No newline at end of file
......@@ -92,12 +92,14 @@ class modules
*/
public static function parseInfo($module)
{
global $lang;
$mod_info = xml::parseXmlFile(ACP3_ROOT . 'modules/' . $module . '/module.xml', 'info');
if (is_array($mod_info)) {
$mod_info['dir'] = $module;
$mod_info['description'] = isset($mod_info['description']['lang']) && $mod_info['description']['lang'] == 'true' ? lang($module, 'mod_description') : $mod_info['description']['lang'];
$mod_info['name'] = isset($mod_info['name']['lang']) && $mod_info['name']['lang'] == 'true' ? lang($module, $module) : $mod_info['name'];
$mod_info['description'] = isset($mod_info['description']['lang']) && $mod_info['description']['lang'] == 'true' ? $lang->t($module, 'mod_description') : $mod_info['description']['lang'];
$mod_info['name'] = isset($mod_info['name']['lang']) && $mod_info['name']['lang'] == 'true' ? $lang->t($module, $module) : $mod_info['name'];
$mod_info['tables'] = !empty($mod_info['tables']) ? explode(',', $mod_info['tables']) : false;
$mod_info['categories'] = isset($mod_info['categories']) ? true : false;
$mod_info['protected'] = isset($mod_info['protected']) ? true : false;
......
......@@ -67,4 +67,7 @@ if (CONFIG_MAINTENANCE == '1' && defined('IN_ACP3')) {
$tpl->assign('MODULES', new modules);
require_once ACP3_ROOT . 'includes/functions.php';
$auth = new auth;
$lang = new lang;
?>
\ No newline at end of file
......@@ -123,36 +123,6 @@ function calcFilesize($value)
}
return round($value, 3) . ' ' . $units[$i];
}
/**
* Diese Funktion gibt den Inhalt der angeforderten Sprachkonstante aus
*
* @param string $mod
* Betroffenes Modul
* @param string $key
* Betroffene Konstante
* @return string
*/
function lang($module, $key)
{
static $lang = 0, $lang_data = array();
if (empty($lang)) {
global $auth;
$info = $auth->getUserInfo();
$lang = !empty($info) ? $info['language'] : CONFIG_LANG;
}
$path = ACP3_ROOT . 'languages/' . $lang . '/' . $module . '.xml';
if (!isset($lang_data[$module][$key]) && is_file($path)) {
$xml = simplexml_load_file($path);
foreach ($xml->item as $row) {
$lang_data[$module][(string) $row->name] = (string) $row->message;
}
}
return isset($lang_data[$module][$key]) ? $lang_data[$module][$key] : strtoupper('{' . $module . '_' . $key . '}');
}
/**
* Hochgeladene Dateien verschieben und umbenennen
*
......@@ -176,7 +146,9 @@ function moveFile($tmp_filename, $filename, $dir)
}
if (is_writable($path)) {
if (!@move_uploaded_file($tmp_filename, $path . $new_name . $ext)) {
echo sprintf(lang('common', 'upload_error'), $filename);
global $lang;
echo sprintf($lang->t('common', 'upload_error'), $filename);
} else {
$new_file['name'] = $new_name . $ext;
$new_file['size'] = calcFilesize(filesize($path . $new_file['name']));
......@@ -356,13 +328,15 @@ function selectEntry($name, $value, $field_value = '', $attr = 'selected')
*/
function timeZones($value)
{
global $lang;
$time_zones = array(-12, -11, -10, -9.5, -9, -8, -7, -6, -5, -4, -3.5, -3, -2, -1, 0, 1, 2, 3, 3.5, 4, 4.5, 5, 5.5, 5.75, 6, 6.5, 7, 8, 8.75, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 14);
$time_zone = array();
$i = 0;
foreach ($time_zones as $row) {
$time_zone[$i]['value'] = $row * 3600;
$time_zone[$i]['selected'] = selectEntry('time_zone', $row * 3600, $value);
$time_zone[$i]['lang'] = lang('common', 'utc' . $row);
$time_zone[$i]['lang'] = $lang->t('common', 'utc' . $row);
$i++;
}
return $time_zone;
......
<?php
function smarty_function_lang($params)
{
global $lang;
$values = explode('|', $params['values']);
return lang($values[0], $values[1]);
return $lang->t($values[0], $values[1]);
}
/* vim: set expandtab: */
?>
\ No newline at end of file
......@@ -4,7 +4,7 @@ function smarty_function_load_module($params)
$module = explode('|', $params['module']);
if (modules::check($module[0], $module[1])) {
global $auth, $db, $tpl, $uri;
global $auth, $db, $lang, $tpl, $uri;
include ACP3_ROOT . 'modules/' . $module[0] . '/' . $module[1] . '.php';
}
......
......@@ -6,14 +6,12 @@
* @package ACP3
* @subpackage Core
*/
$time_start = microtime(true);
ob_start();
define('ACP3_ROOT', './');
require ACP3_ROOT . 'includes/common.php';
$auth = new auth;
if (modules::check()) {
include ACP3_ROOT . 'modules/' . $uri->mod . '/' . $uri->page . '.php';
$tpl->assign('CONTENT', !empty($content) ? $content : '');
......@@ -34,4 +32,5 @@ $tpl->assign('BREADCRUMB', breadcrumb::output());
$tpl->display(defined('CUSTOM_LAYOUT') ? CUSTOM_LAYOUT : 'layout.html');
ob_end_flush();
echo microtime(true) - $time_start;
?>
\ No newline at end of file
......@@ -16,11 +16,11 @@ if (isset($_POST['submit'])) {
$form = $_POST['form'];
if (empty($form['name']))
$errors[] = lang('common', 'name_to_short');
$errors[] = $lang->t('common', 'name_to_short');
if (!empty($form['name']) && $db->select('id', 'access', 'name = \'' . $db->escape($form['name']) . '\'', 0, 0, 0, 1) == '1')
$errors[] = lang('access', 'access_level_already_exist');
$errors[] = $lang->t('access', 'access_level_already_exist');
if (emptyCheck($form['modules']))
$errors[] = lang('access', 'select_modules');
$errors[] = $lang->t('access', 'select_modules');
if (isset($errors)) {
$tpl->assign('error_msg', comboBox($errors));
......@@ -33,7 +33,7 @@ if (isset($_POST['submit'])) {
$bool = $db->insert('access', $insert_values);
$content = comboBox($bool ? lang('access', 'create_success') : lang('access', 'create_error'), uri('acp/access'));
$content = comboBox($bool ? $lang->t('access', 'create_success') : $lang->t('access', 'create_error'), uri('acp/access'));
}
}
if (!isset($_POST['submit']) || isset($errors) && is_array($errors)) {
......
......@@ -16,10 +16,10 @@ elseif (preg_match('/^([\d|]+)$/', $uri->entries))
$entries = $uri->entries;
if (!isset($entries)) {
$content = comboBox(array(lang('common', 'no_entries_selected')));
$content = comboBox(array($lang->t('common', 'no_entries_selected')));
} elseif (is_array($entries)) {
$marked_entries = implode('|', $entries);
$content = comboBox(lang('access', 'confirm_delete'), uri('acp/access/delete/entries_' . $marked_entries), uri('acp/access'));
$content = comboBox($lang->t('access', 'confirm_delete'), uri('acp/access/delete/entries_' . $marked_entries), uri('acp/access'));
} elseif (preg_match('/^([\d|]+)$/', $entries) && $uri->confirmed) {
$marked_entries = explode('|', $entries);
$bool = 0;
......@@ -35,9 +35,9 @@ if (!isset($entries)) {
}
}
if ($level_undeletable) {
$text = lang('access', 'access_level_undeletable');
$text = $lang->t('access', 'access_level_undeletable');
} else {
$text = $bool ? lang('access', 'delete_success') : lang('access', 'delete_error');
$text = $bool ? $lang->t('access', 'delete_success') : $lang->t('access', 'delete_error');
}
$content = comboBox($text, uri('acp/access'));
}
......
......@@ -17,11 +17,11 @@ if (validate::isNumber($uri->id) && $db->select('id', 'access', 'id = \'' . $uri
$form = $_POST['form'];
if (empty($form['name']))
$errors[] = lang('common', 'name_to_short');
$errors[] = $lang->t('common', 'name_to_short');
if (!empty($form['name']) && $db->select('id', 'access', 'id != \'' . $uri->id . '\' AND name = \'' . $db->escape($form['name']) . '\'', 0, 0, 0, 1) == '1')
$errors[] = lang('access', 'access_level_already_exist');
$errors[] = $lang->t('access', 'access_level_already_exist');
if (emptyCheck($form['modules']))
$errors[] = lang('access', 'select_modules');
$errors[] = $lang->t('access', 'select_modules');
if (isset($errors)) {
$tpl->assign('error_msg', comboBox($errors));
......@@ -33,7 +33,7 @@ if (validate::isNumber($uri->id) && $db->select('id', 'access', 'id = \'' . $uri
$bool = $db->update('access', $update_values, 'id = \'' . $uri->id . '\'');
$content = comboBox($bool ? lang('access', 'edit_success') : lang('access', 'edit_error'), uri('acp/access'));
$content = comboBox($bool ? $lang->t('access', 'edit_success') : $lang->t('access', 'edit_error'), uri('acp/access'));
}
}
if (!isset($_POST['submit']) || isset($errors) && is_array($errors)) {
......
......@@ -10,7 +10,7 @@
if (! defined('IN_ADM'))
exit();
breadcrumb::assign(lang('common', 'acp'));
breadcrumb::assign($lang->t('common', 'acp'));
// Module einholen
$mod_list = modules::modulesList();
......@@ -27,15 +27,15 @@ $tpl->assign('modules', $mods);
//Server Infos
if (modules::check('system', 'server_config')) {
$server_info[0]['col_left'] = lang('system', 'architecture');
$server_info[0]['col_left'] = $lang->t('system', 'architecture');
$server_info[0]['col_right'] = @php_uname('m');
$server_info[1]['col_left'] = lang('system', 'operating_system');
$server_info[1]['col_left'] = $lang->t('system', 'operating_system');
$server_info[1]['col_right'] = @php_uname('s') . ' ' . @php_uname('r');
$server_info[2]['col_left'] = lang('system', 'server_software');
$server_info[2]['col_left'] = $lang->t('system', 'server_software');
$server_info[2]['col_right'] = $_SERVER['SERVER_SOFTWARE'];
$server_info[3]['col_left'] = lang('system', 'php_version');
$server_info[3]['col_left'] = $lang->t('system', 'php_version');
$server_info[3]['col_right'] = phpversion();
$server_info[4]['col_left'] = lang('system', 'mysql_version');
$server_info[4]['col_left'] = $lang->t('system', 'mysql_version');
$server_info[4]['col_right'] = CONFIG_DB_TYPE == 'mysqli' ? mysqli_get_server_info($db->link) : mysql_get_server_info($db->link);
$tpl->assign('server_info', $server_info);
......
......@@ -20,15 +20,15 @@ if (isset($_POST['submit'])) {
$settings = config::output('categories');
if (strlen($form['name']) < 3)
$errors[] = lang('categories', 'name_to_short');
$errors[] = $lang->t('categories', 'name_to_short');
if (strlen($form['description']) < 3)
$errors[] = lang('categories', 'description_to_short');
$errors[] = $lang->t('categories', 'description_to_short');
if (!empty($file) && (empty($file['tmp_name']) || empty($file['size']) || !validate::isPicture($file['tmp_name'], $settings['width'], $settings['height'], $settings['filesize'])))
$errors[] = lang('categories', 'invalid_image_selected');
$errors[] = $lang->t('categories', 'invalid_image_selected');
if (empty($form['module']))
$errors[] = lang('categories', 'select_module');
$errors[] = $lang->t('categories', 'select_module');
if (strlen($form['name']) > 3 && !empty($form['module']) && $db->select('id', 'categories', 'name = \'' . $db->escape($form['name']) . '\' AND module = \'' . $db->escape($form['module'], 2) . '\'', 0, 0, 0, 1) > 0)
$errors[] = lang('categories', 'category_already_exists');
$errors[] = $lang->t('categories', 'category_already_exists');
if (isset($errors)) {
$tpl->assign('error_msg', comboBox($errors));
......@@ -53,7 +53,7 @@ if (isset($_POST['submit'])) {
cache::create('categories_' . $form['module'], $db->select('id, name, picture, description', 'categories', 'module = \'' . $form['module'] . '\'', 'name ASC'));
$content = comboBox($bool ? lang('categories', 'create_success') : lang('categories', 'create_error'), uri('acp/categories'));
$content = comboBox($bool ? $lang->t('categories', 'create_success') : $lang->t('categories', 'create_error'), uri('acp/categories'));
}
}
if (!isset($_POST['submit']) || isset($errors) && is_array($errors)) {
......
......@@ -16,10 +16,10 @@ elseif (preg_match('/^([\d|]+)$/', $uri->entries))
$entries = $uri->entries;
if (!isset($entries)) {
$content = comboBox(array(lang('common', 'no_entries_selected')));
$content = comboBox(array($lang->t('common', 'no_entries_selected')));
} elseif (is_array($entries)) {
$marked_entries = implode('|', $entries);
$content = comboBox(lang('categories', 'confirm_delete'), uri('acp/categories/delete/entries_' . $marked_entries), uri('acp/categories'));
$content = comboBox($lang->t('categories', 'confirm_delete'), uri('acp/categories/delete/entries_' . $marked_entries), uri('acp/categories'));
} elseif (preg_match('/^([\d|]+)$/', $entries) && $uri->confirmed) {
$marked_entries = explode('|', $entries);
$bool = 0;
......@@ -45,9 +45,9 @@ if (!isset($entries)) {
}
if ($in_use) {
$text = lang('categories', 'category_is_in_use');
$text = $lang->t('categories', 'category_is_in_use');
} else {
$text = $bool ? lang('categories', 'delete_success') : lang('categories', 'delete_error');
$text = $bool ? $lang->t('categories', 'delete_success') : $lang->t('categories', 'delete_error');
}
$content = comboBox($text, uri('acp/categories'));
}
......
......@@ -21,13 +21,13 @@ if (validate::isNumber($uri->id) && $db->select('id', 'categories', 'id = \'' .
$settings = config::output('categories');
if (strlen($form['name']) < 3)
$errors[] = lang('categories', 'name_to_short');
$errors[] = $lang->t('categories', 'name_to_short');
if (strlen($form['description']) < 3)
$errors[] = lang('categories', 'description_to_short');
$errors[] = $lang->t('categories', 'description_to_short');
if (!empty($file) && (empty($file['tmp_name']) || empty($file['size']) || !validate::isPicture($file['tmp_name'], $settings['width'], $settings['height'], $settings['filesize'])))
$errors[] = lang('categories', 'invalid_image_selected');
$errors[] = $lang->t('categories', 'invalid_image_selected');
if (strlen($form['name']) > 3 && !empty($form['module']) && $db->select('id', 'categories', 'id != \'' . $uri->id . '\' AND name = \'' . $db->escape($form['name']) . '\' AND module = \'' . $db->escape($form['module'], 2) . '\'', 0, 0, 0, 1) > 0)
$errors[] = lang('categories', 'category_already_exists');
$errors[] = $lang->t('categories', 'category_already_exists');
if (isset($errors)) {
$tpl->assign('error_msg', comboBox($errors));
......@@ -55,7 +55,7 @@ if (validate::isNumber($uri->id) && $db->select('id', 'categories', 'id = \'' .
cache::create('categories_' . $db->escape($category[0]['module'], 3), $db->select('id, name, picture, description', 'categories', 'module = \'' . $db->escape($category[0]['module'], 3) . '\'', 'name ASC'));
$content = comboBox($bool ? lang('categories', 'edit_success') : lang('categories', 'edit_error'), uri('acp/categories'));
$content = comboBox($bool ? $lang->t('categories', 'edit_success') : $lang->t('categories', 'edit_error'), uri('acp/categories'));
}
}
if (!isset($_POST['submit']) || isset($errors) && is_array($errors)) {
......
......@@ -14,18 +14,18 @@ if (isset($_POST['submit'])) {
$form = $_POST['form'];
if (!validate::isNumber($form['width']))
$errors[] = lang('categories', 'invalid_image_width_entered');
$errors[] = $lang->t('categories', 'invalid_image_width_entered');
if (!validate::isNumber($form['height']))
$errors[] = lang('categories', 'invalid_image_height_entered');
$errors[] = $lang->t('categories', 'invalid_image_height_entered');
if (!validate::isNumber($form['filesize']))
$errors[] = lang('categories', 'invalid_image_filesize_entered');
$errors[] = $lang->t('categories', 'invalid_image_filesize_entered');
if (isset($errors)) {
$tpl->assign('error_msg', comboBox($errors));
} else {
$bool = config::module('categories', $form);
$content = comboBox($bool ? lang('categories', 'settings_success') : lang('categories', 'settings_error'), uri('acp/categories'));
$content = comboBox($bool ? $lang->t('categories', 'settings_success') : $lang->t('categories', 'settings_error'), uri('acp/categories'));
}
}
if (!isset($_POST['submit']) || isset($errors) && is_array($errors)) {
......
......@@ -20,16 +20,16 @@ if (empty($module) || !empty($module) && $db->select('id', 'comments', 'module =
if ($c_comments > 0) {
$tpl->assign('pagination', pagination($db->query('SELECT module FROM ' . CONFIG_DB_PRE . 'comments GROUP BY module', 1)));
for ($i = 0; $i < $c_comments; ++$i) {
$comments[$i]['name'] = lang($comments[$i]['module'], $comments[$i]['module']);
$comments[$i]['name'] = $lang->t($comments[$i]['module'], $comments[$i]['module']);
$comments[$i]['count'] = $db->select('id', 'comments', 'module = \'' . $comments[$i]['module'] . '\'', 0, 0, 0, 1);
}
$tpl->assign('comments', $comments);
}
} elseif (!empty($module) && $db->select('id', 'comments', 'module = \'' . $module . '\'', 0, 0, 0, 1) > '0') {
//Brotkrümelspur
breadcrumb::assign(lang('common', 'acp'), uri('acp'));
breadcrumb::assign(lang('comments', 'comments'), uri('acp/comments'));
breadcrumb::assign(lang($module, $module));
breadcrumb::assign($lang->t('common', 'acp'), uri('acp'));
breadcrumb::assign($lang->t('comments', 'comments'), uri('acp/comments'));
breadcrumb::assign($lang->t($module, $module));
$comments = $db->select('id, ip, date, name, message', 'comments', 'module = \'' . $module . '\'', 'date DESC', POS, CONFIG_ENTRIES);
$c_comments = count($comments);
......
......@@ -16,10 +16,10 @@ elseif (preg_match('/^([\d|]+)$/', $uri->entries))
$entries = $uri->entries;
if (!isset($entries)) {
$content = comboBox(array(lang('common', 'no_entries_selected')));
$content = comboBox(array($lang->t('common', 'no_entries_selected')));
} elseif (is_array($entries)) {
$marked_entries = implode('|', $entries);
$content = comboBox(lang('comments', 'confirm_delete'), uri('acp/comments/delete_comments/entries_' . $marked_entries), uri('acp/comments'));
$content = comboBox($lang->t('comments', 'confirm_delete'), uri('acp/comments/delete_comments/entries_' . $marked_entries), uri('acp/comments'));
} elseif (preg_match('/^([\d|]+)$/', $entries) && $uri->confirmed) {
$marked_entries = explode('|', $entries);
$bool = 0;
......@@ -28,6 +28,6 @@ if (!isset($entries)) {
$bool = $db->delete('comments', 'id = \'' . $entry . '\'');
}
}
$content = comboBox($bool ? lang('comments', 'delete_success') : lang('comments', 'delete_error'), uri('acp/comments'));
$content = comboBox($bool ? $lang->t('comments', 'delete_success') : $lang->t('comments', 'delete_error'), uri('acp/comments'));
}
?>
\ No newline at end of file
......@@ -16,10 +16,10 @@ elseif (preg_match('/^([\w|]+)$/', $uri->entries))
$entries = $uri->entries;
if (!isset($entries)) {
$content = comboBox(array(lang('common', 'no_entries_selected')));
$content = comboBox(array($lang->t('common', 'no_entries_selected')));
} elseif (is_array($entries)) {
$marked_entries = implode('|', $entries);
$content = comboBox(lang('comments', 'confirm_delete'), uri('acp/comments/delete_comments_per_module/entries_' . $marked_entries), uri('acp/comments'));
$content = comboBox($lang->t('comments', 'confirm_delete'), uri('acp/comments/delete_comments_per_module/entries_' . $marked_entries), uri('acp/comments'));
} elseif (preg_match('/^([\w|]+)$/', $entries) && $uri->confirmed) {
$marked_entries = explode('|', $entries);
$bool = 0;
......@@ -28,6 +28,6 @@ if (!isset($entries)) {
$bool = $db->delete('comments', 'module = \'' . $entry . '\'');
}
}
$content = comboBox($bool ? lang('comments', 'delete_success') : lang('comments', 'delete_error'), uri('acp/comments'));
$content = comboBox($bool ? $lang->t('comments', 'delete_success') : $lang->t('comments', 'delete_error'), uri('acp/comments'));
}
?>
\ No newline at end of file
......@@ -14,18 +14,18 @@ if (validate::isNumber($uri->id) && $db->select('id', 'comments', 'id = \'' . $u
$comment = $db->select('name, message, module', 'comments', 'id = \'' . $uri->id . '\'');
$comment[0]['module'] = $db->escape($comment[0]['module'], 3);
breadcrumb::assign(lang('common', 'acp'), uri('acp'));