Commit fc81b705 authored by tinogo@blue-cable.de's avatar tinogo@blue-cable.de

- moved some method out of the "modules" class into the new "view" class

- renamed and splitted the methods getCurrentKeywordsOrDescription and getKeywordsOrDescription inside the "seo" class
parent 6020fa60
......@@ -8,7 +8,7 @@
<body>
<div id="maintenance">
{$MAINTENANCE_MSG}
{$content}
</div>
</body>
</html>
\ No newline at end of file
......@@ -141,7 +141,7 @@ class date
$tpl->assign('datepicker', $datepicker);
return modules::fetchTemplate('common/date.tpl');
return view::fetchTemplate('common/date.tpl');
}
/**
* Gibt ein formatiertes Datum zurück
......
......@@ -76,84 +76,6 @@ class modules
}
return $mod_list;
}
/**
* Gibt die Seite aus
*/
public static function outputPage() {
global $auth, $uri;
if (!$auth->isUser() === true && defined('IN_ADM') === true && $uri->mod !== 'users' && $uri->file !== 'login') {
$redirect_uri = base64_encode(substr(str_replace(PHP_SELF, '', htmlentities($_SERVER['PHP_SELF'], ENT_QUOTES)), 1));
$uri->redirect('acp/users/login/redirect_' . $redirect_uri);
}
switch (modules::check()) {
// Seite ausgeben
case 1:
global $date, $db, $lang, $tpl;
require MODULES_DIR . '' . $uri->mod . '/' . $uri->file . '.php';
// Evtl. gesetzten Content-Type des Servers überschreiben
header('Content-Type: ' . (defined('CUSTOM_CONTENT_TYPE') ? CUSTOM_CONTENT_TYPE : 'text/html') . '; charset=UTF-8');
$tpl->assign('PAGE_TITLE', CONFIG_SEO_TITLE);
$tpl->assign('TITLE', breadcrumb::output(2));
$tpl->assign('BREADCRUMB', breadcrumb::output());
$tpl->assign('KEYWORDS', seo::getCurrentKeywordsOrDescription());
$tpl->assign('DESCRIPTION', seo::getCurrentKeywordsOrDescription(2));
$tpl->assign('CONTENT', !empty($content) ? $content : '');
$minify = ROOT_DIR . 'includes/min/' . (CONFIG_SEO_MOD_REWRITE === true && defined('IN_ADM') === false ? '' : '?') . 'g=%s&amp;' . CONFIG_DESIGN;
$tpl->assign('MIN_JAVASCRIPT', sprintf($minify, 'js'));
$tpl->assign('MIN_STYLESHEET', sprintf($minify, 'css'));
$tpl->assign('MIN_STYLESHEET_SIMPLE', sprintf($minify, 'css_simple'));
// Falls ein Modul ein eigenes Layout verwenden möchte, dieses auch zulassen
self::displayTemplate(defined('CUSTOM_LAYOUT') === true ? CUSTOM_LAYOUT : 'layout.tpl');
break;
// Kein Zugriff auf die Seite
case 0:
$uri->redirect('errors/403');
break;
// Seite nicht gefunden
default:
$uri->redirect('errors/404');
}
}
/**
* Gibt ein Template direkt aus
*
* @param string $template
* @param mixed $cache_id
* @param integer $cache_lifetime
*/
public static function displayTemplate($template, $cache_id = null, $compile_id = null, $parent = null)
{
self::fetchTemplate($template, $cache_id, $compile_id, $parent, true);
}
/**
* Gibt ein Template aus
*
* @param string $template
* @param mixed $cache_id
* @param mixed $compile_id
* @param object $parent
* @param boolean $display
* @return string
*/
public static function fetchTemplate($template, $cache_id = null, $compile_id = null, $parent = null, $display = false)
{
global $lang, $tpl;
if ($tpl->templateExists($template)) {
return $tpl->fetch($template, $cache_id, $compile_id, $parent, $display);
} elseif (defined('DEBUG') === true && DEBUG === true) {
return sprintf($lang->t('errors', 'tpl_not_found'), $template);
}
return '';
}
/**
* Durchläuft für das angeforderte Modul den <info> Abschnitt in der
* module.xml und gibt die gefundenen Informationen als Array zurück
......
......@@ -62,31 +62,6 @@ class seo
return cache::output('aliases');
}
/**
* Gibt die Keywords und Beschreibung der aktuell angezeigten Seite oder der
* Elternseite aus
*
* @param integer $mode
* @return string
*/
public static function getCurrentKeywordsOrDescription($mode = 1)
{
global $uri;
if ($mode === 1) {
$keywords = self::getKeywordsOrDescription($uri->query);
if (empty($keywords))
$keywords = self::getKeywordsOrDescription($uri->mod);
return !empty($keywords) ? $keywords : CONFIG_SEO_META_KEYWORDS;
} else {
$description = self::getKeywordsOrDescription($uri->query, 'description');
if (empty($description))
$description = self::getKeywordsOrDescription($uri->mod, 'description');
return !empty($description) ? $description : CONFIG_SEO_META_DESCRIPTION;
}
}
/**
* Überprüft, ob ein URI-Alias existiert
*
......@@ -116,20 +91,66 @@ class seo
return !empty(self::$aliases[$path]['alias']) ? self::$aliases[$path]['alias'] : $path;
}
/**
* Gibt die Schlüsselwörter oder Beschreibung der Seite aus
* Gibt die Beschreibung der aktuell angezeigten Seite oder der
* Elternseite aus
*
* @return string
*/
public static function getCurrentDescription()
{
global $uri;
$description = self::getDescription($uri->query);
if (empty($description))
$description = self::getDescription($uri->mod);
return !empty($description) ? $description : CONFIG_SEO_META_DESCRIPTION;
}
/**
* Gibt die Keywords der aktuell angezeigten Seite oder der
* Elternseite aus
*
* @return string
*/
public static function getCurrentKeywords()
{
global $uri;
$keywords = self::getKeywords($uri->query);
if (empty($keywords))
$keywords = self::getKeywords($uri->mod);
return !empty($keywords) ? $keywords : CONFIG_SEO_META_KEYWORDS;
}
/**
* Gibt die Schlüsselwörter der Seite aus
*
* @param string $path
* @return string
*/
public static function getKeywords($path)
{
if (empty(self::$aliases))
self::$aliases = self::getSEOCache();
$path.= !preg_match('/\/$/', $path) ? '/' : '';
return !empty(self::$aliases[$path]['keywords']) ? self::$aliases[$path]['keywords'] : '';
}
/**
* Gibt die Beschreibung der Seite aus
*
* @param string $path
* @param string $field
* @return string
*/
public static function getKeywordsOrDescription($path, $field = 'keywords')
public static function getDescription($path)
{
if (empty(self::$aliases))
self::$aliases = self::getSEOCache();
$path.= !preg_match('/\/$/', $path) ? '/' : '';
return !empty(self::$aliases[$path][$field]) ? self::$aliases[$path][$field] : '';
return !empty(self::$aliases[$path]['description']) ? self::$aliases[$path]['description'] : '';
}
/**
* Trägt einen URI-Alias in die Datenbank ein bzw. aktualisiert den Eintrag
......
<?php
/**
* View
*
* @author Goratsch Webdesign
* @package ACP3
* @subpackage Core
*/
if (defined('IN_ACP3') === false)
exit;
/**
* Klasse für die Ausgabe der Seite
*
* @author Goratsch Webdesign
* @package ACP3
* @subpackage Core
*/
class view
{
/**
* Der auszugebende Inhalt der Seite
*
* @var string
*/
private static $content = '';
/**
* Der auszugebende Content-Type der Seite
* @var string
*/
private static $content_type = 'Content-Type: text/html; charset=UTF-8';
/**
* Das zuverwendende Seitenlayout
*
* @var string
*/
private static $layout = 'layout.tpl';
/**
* Weist dem Template den auszugebenden Inhalt zu
*
* @param string $data
*/
public static function setContent($data)
{
self::$content = $data;
}
/**
* Weist der aktuell auszugebenden Seite den Content-Type zu
*
* @param string $data
*/
public static function setContentType($data)
{
self::$content_type = $data;
}
/**
* Weist der aktuell auszugebenden Seite ein Layout zu
*
* @param string $file
*/
public static function assignLayout($file)
{
self::$layout = $file;
}
/**
* Gibt die Seite aus
*/
public static function outputPage() {
global $auth, $uri;
if (!$auth->isUser() === true && defined('IN_ADM') === true && $uri->mod !== 'users' && $uri->file !== 'login') {
$redirect_uri = base64_encode(substr(str_replace(PHP_SELF, '', htmlentities($_SERVER['PHP_SELF'], ENT_QUOTES)), 1));
$uri->redirect('acp/users/login/redirect_' . $redirect_uri);
}
switch (modules::check()) {
// Seite ausgeben
case 1:
global $date, $db, $lang, $tpl;
require MODULES_DIR . '' . $uri->mod . '/' . $uri->file . '.php';
// Evtl. gesetzten Content-Type des Servers überschreiben
header(self::$content_type);
if (self::$layout !== '') {
$tpl->assign('PAGE_TITLE', CONFIG_SEO_TITLE);
$tpl->assign('TITLE', breadcrumb::output(2));
$tpl->assign('BREADCRUMB', breadcrumb::output());
$tpl->assign('KEYWORDS', seo::getCurrentKeywords());
$tpl->assign('DESCRIPTION', seo::getCurrentDescription());
$tpl->assign('CONTENT', self::$content);
$minify = ROOT_DIR . 'includes/min/' . (CONFIG_SEO_MOD_REWRITE === true && defined('IN_ADM') === false ? '' : '?') . 'g=%s&amp;' . CONFIG_DESIGN;
$tpl->assign('MIN_JAVASCRIPT', sprintf($minify, 'js'));
$tpl->assign('MIN_STYLESHEET', sprintf($minify, 'css'));
$tpl->assign('MIN_STYLESHEET_SIMPLE', sprintf($minify, 'css_simple'));
self::displayTemplate(self::$layout);
} else {
echo self::$content;
}
break;
// Kein Zugriff auf die Seite
case 0:
$uri->redirect('errors/403');
break;
// Seite nicht gefunden
default:
$uri->redirect('errors/404');
}
}
/**
* Gibt ein Template direkt aus
*
* @param string $template
* @param mixed $cache_id
* @param integer $cache_lifetime
*/
public static function displayTemplate($template, $cache_id = null, $compile_id = null, $parent = null)
{
self::fetchTemplate($template, $cache_id, $compile_id, $parent, true);
}
/**
* Gibt ein Template aus
*
* @param string $template
* @param mixed $cache_id
* @param mixed $compile_id
* @param object $parent
* @param boolean $display
* @return string
*/
public static function fetchTemplate($template, $cache_id = null, $compile_id = null, $parent = null, $display = false)
{
global $lang, $tpl;
if ($tpl->templateExists($template)) {
return $tpl->fetch($template, $cache_id, $compile_id, $parent, $display);
} elseif (defined('DEBUG') === true && DEBUG === true) {
return sprintf($lang->t('errors', 'tpl_not_found'), $template);
}
return '';
}
}
\ No newline at end of file
......@@ -73,6 +73,6 @@ $tpl->assign('LANG', CONFIG_LANG);
// Falls der Wartungsmodus aktiv ist, Wartungsnachricht ausgeben
if (defined('IN_ADM') === false && CONFIG_MAINTENANCE_MODE === true) {
$tpl->assign('MAINTENANCE_MSG', CONFIG_MAINTENANCE_MESSAGE);
define('CUSTOM_LAYOUT', 'maintenance.tpl');
view::setContent(CONFIG_MAINTENANCE_MESSAGE);
view::assignLayout('maintenance.tpl');
}
\ No newline at end of file
......@@ -57,7 +57,7 @@ function captcha($captcha_length = 5)
$captcha['width'] = $captcha_length * 25;
$captcha['height'] = 30;
$tpl->assign('captcha', $captcha);
return modules::fetchTemplate('common/captcha.tpl');
return view::fetchTemplate('common/captcha.tpl');
}
return '';
}
......@@ -80,7 +80,7 @@ function comboBox($text, $forward = 0, $backward = 0, $colorbox = 0)
if (is_array($text) && empty($forward) && empty($backward)) {
$tpl->assign('text', $text);
return modules::fetchTemplate('common/error.tpl');
return view::fetchTemplate('common/error.tpl');
} elseif (!empty($text) && (!empty($forward) || !empty($backward))) {
$combo = array(
'text' => $text,
......@@ -91,7 +91,7 @@ function comboBox($text, $forward = 0, $backward = 0, $colorbox = 0)
$combo['backward'] = $backward;
$tpl->assign('combo', $combo);
return modules::fetchTemplate('common/combo.tpl');
return view::fetchTemplate('common/combo.tpl');
}
return '';
}
......@@ -353,7 +353,7 @@ function pagination($rows, $fragment = '')
$tpl->assign('pagination', $pagination);
return modules::fetchTemplate('common/pagination.tpl');
return view::fetchTemplate('common/pagination.tpl');
}
}
/**
......
......@@ -10,4 +10,4 @@ define('IN_ACP3', true);
define('ACP3_ROOT', realpath(dirname(__FILE__)) . '/');
require ACP3_ROOT . 'includes/common.php';
modules::outputPage();
\ No newline at end of file
view::outputPage();
\ No newline at end of file
......@@ -19,4 +19,4 @@ if ($c_roles > 0) {
}
$tpl->assign('roles', $roles);
}
$content = modules::fetchTemplate('access/adm_list.tpl');
view::setContent(view::fetchTemplate('access/adm_list.tpl'));
......@@ -20,4 +20,4 @@ for ($i = 0; $i < $c_resources; ++$i) {
ksort($output);
$tpl->assign('resources', $output);
$content = modules::fetchTemplate('access/adm_list_resources.tpl');
\ No newline at end of file
view::setContent(view::fetchTemplate('access/adm_list_resources.tpl'));
\ No newline at end of file
......@@ -50,7 +50,7 @@ if (isset($_POST['form'])) {
acl::setRolesCache();
$content = comboBox($bool ? $lang->t('common', 'create_success') : $lang->t('common', 'create_error'), $uri->route('acp/access'));
view::setContent(comboBox($bool ? $lang->t('common', 'create_success') : $lang->t('common', 'create_error'), $uri->route('acp/access')));
}
}
if (!isset($_POST['form']) || isset($errors) && is_array($errors)) {
......@@ -94,5 +94,5 @@ if (!isset($_POST['form']) || isset($errors) && is_array($errors)) {
ksort($modules);
$tpl->assign('modules', $modules);
$content = modules::fetchTemplate('access/create.tpl');
view::setContent(view::fetchTemplate('access/create.tpl'));
}
......@@ -16,10 +16,10 @@ elseif (validate::deleteEntries($uri->entries))
$entries = $uri->entries;
if (!isset($entries)) {
$content = comboBox(array($lang->t('common', 'no_entries_selected')));
view::setContent(comboBox(array($lang->t('common', 'no_entries_selected'))));
} elseif (is_array($entries)) {
$marked_entries = implode('|', $entries);
$content = comboBox($lang->t('common', 'confirm_delete'), $uri->route('acp/access/delete/entries_' . $marked_entries . '/action_confirmed/'), $uri->route('acp/access'));
view::setContent(comboBox($lang->t('common', 'confirm_delete'), $uri->route('acp/access/delete/entries_' . $marked_entries . '/action_confirmed/'), $uri->route('acp/access')));
} elseif (validate::deleteEntries($entries) && $uri->action == 'confirmed') {
require_once MODULES_DIR . 'access/functions.php';
......@@ -44,7 +44,7 @@ if (!isset($entries)) {
} else {
$text = $bool !== null && $bool2 !== null && $bool3 !== null ? $lang->t('common', 'delete_success') : $lang->t('common', 'delete_error');
}
$content = comboBox($text, $uri->route('acp/access'));
view::setContent(comboBox($text, $uri->route('acp/access')));
} else {
$uri->redirect('acp/errors/404');
}
......@@ -21,10 +21,10 @@ breadcrumb::assign($lang->t('access', 'adm_list_resources'), $uri->route('acp/ac
breadcrumb::assign($lang->t('access', 'delete_resources'));
if (!isset($entries)) {
$content = comboBox(array($lang->t('common', 'no_entries_selected')));
view::setContent(comboBox(array($lang->t('common', 'no_entries_selected'))));
} elseif (is_array($entries)) {
$marked_entries = implode('|', $entries);
$content = comboBox($lang->t('common', 'confirm_delete'), $uri->route('acp/access/delete_resources/entries_' . $marked_entries . '/action_confirmed/'), $uri->route('acp/access/adm_list_resources'));
view::setContent(comboBox($lang->t('common', 'confirm_delete'), $uri->route('acp/access/delete_resources/entries_' . $marked_entries . '/action_confirmed/'), $uri->route('acp/access/adm_list_resources')));
} elseif (validate::deleteEntries($entries) && $uri->action == 'confirmed') {
$marked_entries = explode('|', $entries);
$bool = null;
......@@ -37,7 +37,7 @@ if (!isset($entries)) {
acl::setResourcesCache();
$text = $bool !== null ? $lang->t('common', 'delete_success') : $lang->t('common', 'delete_error');
$content = comboBox($text, $uri->route('acp/access/adm_list_resources'));
view::setContent(comboBox($text, $uri->route('acp/access/adm_list_resources')));
} else {
$uri->redirect('acp/errors/404');
}
......@@ -47,7 +47,7 @@ if (validate::isNumber($uri->id) && $db->countRows('*', 'acl_roles', 'id = \'' .
// Cache der ACL zurücksetzen
cache::purge(0, 'acl');
$content = comboBox($bool !== null ? $lang->t('common', 'edit_success') : $lang->t('common', 'edit_error'), $uri->route('acp/access'));
view::setContent(comboBox($bool !== null ? $lang->t('common', 'edit_success') : $lang->t('common', 'edit_error'), $uri->route('acp/access')));
}
}
if (!isset($_POST['form']) || isset($errors) && is_array($errors)) {
......@@ -105,7 +105,7 @@ if (validate::isNumber($uri->id) && $db->countRows('*', 'acl_roles', 'id = \'' .
$tpl->assign('form', isset($form) ? $form : $role[0]);
$content = modules::fetchTemplate('access/edit.tpl');
view::setContent(view::fetchTemplate('access/edit.tpl'));
}
} else {
$uri->redirect('errors/404');
......
......@@ -36,7 +36,7 @@ if (validate::isNumber($uri->id) && $db->countRows('*', 'acl_resources', 'id = \
acl::setResourcesCache();
$content = comboBox($bool !== null ? $lang->t('common', 'edit_success') : $lang->t('common', 'edit_error'), $uri->route('acp/access/adm_list_resources'));
view::setContent(comboBox($bool !== null ? $lang->t('common', 'edit_success') : $lang->t('common', 'edit_error'), $uri->route('acp/access/adm_list_resources')));
}
}
if (!isset($_POST['form']) || isset($errors) && is_array($errors)) {
......@@ -49,7 +49,7 @@ if (validate::isNumber($uri->id) && $db->countRows('*', 'acl_resources', 'id = \
}
$tpl->assign('privileges', $privileges);
$content = modules::fetchTemplate('access/edit_resource.tpl');
view::setContent(view::fetchTemplate('access/edit_resource.tpl'));
}
} else {
$uri->redirect('errors/404');
......
......@@ -25,4 +25,4 @@ foreach ($mod_list as $name => $info) {
}
$tpl->assign('modules', $mods);
$content = modules::fetchTemplate('acp/adm_list.tpl');
view::setContent(view::fetchTemplate('acp/adm_list.tpl'));
......@@ -23,4 +23,4 @@ if ($c_categories > 0) {
}
$tpl->assign('categories', $categories);
}
$content = modules::fetchTemplate('categories/adm_list.tpl');
view::setContent(view::fetchTemplate('categories/adm_list.tpl'));
......@@ -58,7 +58,7 @@ if (isset($_POST['form'])) {
$bool = $db->insert('categories', $insert_values);
setCategoriesCache($form['module']);
$content = comboBox($bool ? $lang->t('common', 'create_success') : $lang->t('common', 'create_error'), $uri->route('acp/categories'));
view::setContent(comboBox($bool ? $lang->t('common', 'create_success') : $lang->t('common', 'create_error'), $uri->route('acp/categories')));
}
}
if (!isset($_POST['form']) || isset($errors) && is_array($errors)) {
......@@ -75,5 +75,5 @@ if (!isset($_POST['form']) || isset($errors) && is_array($errors)) {
}
$tpl->assign('mod_list', $mod_list);
$content = modules::fetchTemplate('categories/create.tpl');
view::setContent(view::fetchTemplate('categories/create.tpl'));
}
......@@ -16,10 +16,10 @@ elseif (validate::deleteEntries($uri->entries))
$entries = $uri->entries;
if (!isset($entries)) {
$content = comboBox(array($lang->t('common', 'no_entries_selected')));
view::setContent(comboBox(array($lang->t('common', 'no_entries_selected'))));
} elseif (is_array($entries)) {
$marked_entries = implode('|', $entries);
$content = comboBox($lang->t('common', 'confirm_delete'), $uri->route('acp/categories/delete/entries_' . $marked_entries . '/action_confirmed/'), $uri->route('acp/categories'));
view::setContent(comboBox($lang->t('common', 'confirm_delete'), $uri->route('acp/categories/delete/entries_' . $marked_entries . '/action_confirmed/'), $uri->route('acp/categories')));
} elseif (validate::deleteEntries($entries) && $uri->action == 'confirmed') {
require_once MODULES_DIR . 'categories/functions.php';
......@@ -51,7 +51,7 @@ if (!isset($entries)) {
} else {
$text = $bool !== null ? $lang->t('common', 'delete_success') : $lang->t('common', 'delete_error');
}
$content = comboBox($text, $uri->route('acp/categories'));
view::setContent(comboBox($text, $uri->route('acp/categories')));
} else {
$uri->redirect('acp/errors/404');
}
......@@ -60,7 +60,7 @@ if (validate::isNumber($uri->id) && $db->countRows('*', 'categories', 'id = \''
setCategoriesCache($db->escape($module[0]['module'], 3));
$content = comboBox($bool !== null ? $lang->t('common', 'edit_success') : $lang->t('common', 'edit_error'), $uri->route('acp/categories'));
view::setContent(comboBox($bool !== null ? $lang->t('common', 'edit_success') : $lang->t('common', 'edit_error'), $uri->route('acp/categories')));
}
}
if (!isset($_POST['form']) || isset($errors) && is_array($errors)) {
......@@ -70,7 +70,7 @@ if (validate::isNumber($uri->id) && $db->countRows('*', 'categories', 'id = \''
$tpl->assign('form', isset($form) ? $form : $category[0]);
$content = modules::fetchTemplate('categories/edit.tpl');
view::setContent(view::fetchTemplate('categories/edit.tpl'));
}
} else {
$uri->redirect('errors/404');
......
......@@ -123,5 +123,5 @@ function categoriesList($module, $category_id = '', $category_create = false, $c
$categories['create']['value'] = isset($_POST['form'][$categories['create']['name']]) ? $_POST['form'][$categories['create']['name']] : '';
}
$tpl->assign('categories', $categories);
return modules::fetchTemplate('categories/create_list.tpl');
return view::fetchTemplate('categories/create_list.tpl');
}
......@@ -25,7 +25,7 @@ if (isset($_POST['form'])) {
} else {
$bool = config::module('categories', $form);
$content = comboBox($bool ? $lang->t('common', 'settings_success') : $lang->t('common', 'settings_error'), $uri->route('acp/categories'));
view::setContent(comboBox($bool ? $lang->t('common', 'settings_success') : $lang->t('common', 'settings_error'), $uri->route('acp/categories')));
}
}
if (!isset($_POST['form']) || isset($errors) && is_array($errors)) {
......@@ -33,5 +33,5 @@ if (!isset($_POST['form']) || isset($errors) && is_array($errors)) {
$tpl->assign('form', isset($form) ? $form : $settings);
$content = modules::fetchTemplate('categories/settings.tpl');
view::setContent(view::fetchTemplate('categories/settings.tpl'));
}
......@@ -26,7 +26,7 @@ if (empty($module) || !empty($module) && $db->countRows('*', 'comments', 'module
$tpl->assign('comments', $comments);
}
$content = modules::fetchTemplate('comments/adm_list_module.tpl');
view::setContent(view::fetchTemplate('comments/adm_list_module.tpl'));
} else {
//Brotkrümelspur
breadcrumb::assign($lang->t('common', 'acp'), $uri->route('acp'));
......@@ -58,5 +58,5 @@ if (empty($module) || !empty($module) && $db->countRows('*', 'comments', 'module
$tpl->assign('comments', $comments);
}
$content = modules::fetchTemplate('comments/adm_list_comments.tpl');
view::setContent(view::fetchTemplate('comments/adm_list_comments.tpl'));
}
\ No newline at end of file
......@@ -97,6 +97,6 @@ function commentsCreate($module, $entry_id)
$tpl->assign('form', isset($form) ? array_merge($defaults, $form) : $defaults);
$tpl->assign('captcha', captcha());