- renamed Modules::check into Modules::hasPermission

- added Modules::actionExists
- use camelCase consequently in module actions
parent 33add6a5
......@@ -148,11 +148,11 @@ class Application {
$uri->redirect('users/login/redirect_' . $redirect_uri);
}
if (Core\Modules::check($uri->mod, $uri->file) === true) {
if (Core\Modules::hasPermission($uri->mod, $uri->file) === true) {
$module = ucfirst($uri->mod);
$section = defined('IN_ADM') === true ? 'Admin' : 'Frontend';
$className = "\\ACP3\\Modules\\" . $module . "\\" . $module . $section;
$action = 'action' . ucfirst(defined('IN_ADM') === true ? substr($uri->file, 4) : $uri->file);
$action = 'action' . preg_replace('/(\s+)/', '', ucwords(strtolower(str_replace('_', ' ', defined('IN_ADM') === true ? substr($uri->file, 4) : $uri->file))));
// Modul einbinden
$mod = new $className();
......
......@@ -20,36 +20,39 @@ namespace ACP3\Core;
abstract class Modules {
/**
* Überpüft, ob ein Modul überhaupt existiert,
* bzw. der Benutzer auf ein Modul Zugriff hat
* Überpüft, ob eine Modulaktion existiert und der Benutzer darauf Zugriff hat
*
* @param string $module
* Zu überprüfendes Modul
* @param string $file
* Zu überprüfende Moduldatei
* @param string $action
* Zu überprüfende Aktion
*
* @return integer
*/
public static function check($module, $file) {
$module = strtolower($module);
$moduleUc = ucfirst($module);
$section = strpos($file, 'acp_') === 0 ? 'Admin' : 'Frontend';
public static function hasPermission($module, $action) {
if (self::actionExists($module, $action) === true && self::isActive($module) === true) {
$module = strtolower($module);
return ACL::canAccessResource($module . '/' . $action . '/');
}
return 0;
}
/**
* berprüft, ob eine Modulaktion überhaupt existier
*
* @param string $module
* @param string $action
* @return boolean
*/
public static function actionExists($module, $action) {
$moduleUc = ucfirst($module);
$section = strpos($action, 'acp_') === 0 ? 'Admin' : 'Frontend';
$path = MODULES_DIR . $moduleUc . '/' . $moduleUc . $section . '.php';
$className = "\\ACP3\\Modules\\" . $moduleUc . "\\" . $moduleUc . $section;
$action = 'action' . preg_replace('/(\s+)/', '', ucwords(strtolower(str_replace('_', ' ', $section === 'Admin' ? substr($action, 4) : $action))));
if (is_file($path) === true) {
$className = "\\ACP3\\Modules\\" . $moduleUc . "\\" . $moduleUc . $section;
$method = 'action' . ucfirst($section === 'Admin' ? substr($file, 4) : $file);
if (method_exists($className, $method) === true) {
if (self::isActive($module) === true) {
return ACL::canAccessResource($module . '/' . $file . '/');
}
}
return 0;
}
return -1;
return (is_file($path) === true && method_exists($className, $action) === true);
}
/**
* Gibt zurück, ob ein Modul aktiv ist oder nicht
*
......
<?php
/**
* URI
*
......@@ -16,8 +17,8 @@ namespace ACP3\Core;
* @package ACP3
* @subpackage Core
*/
class URI
{
class URI {
/**
* Array, welches die URI Parameter enthält
*
......@@ -25,6 +26,7 @@ class URI
* @access protected
*/
private $params = array();
/**
* Die komplette übergebene URL
*
......@@ -37,8 +39,7 @@ class URI
/**
* Zerlegt u.a. die übergebenen Parameter in der URI in ihre Bestandteile
*/
function __construct($defaultModule = '', $defaultFile = '')
{
function __construct($defaultModule = '', $defaultFile = '') {
// Minify von der URI-Verarbeitung ausschließen
if ((bool) preg_match('=(includes/min/index\.php|libraries/kcfinder)=', $_SERVER['PHP_SELF']) === false) {
$this->preprocessUriQuery();
......@@ -52,45 +53,45 @@ class URI
$this->setUriParameters($defaultModule, $defaultFile);
}
}
/**
* Gibt einen URI Parameter aus
*
* @param string $key
* @return string|integer|null
*/
public function __get($key)
{
public function __get($key) {
return isset($this->params[$key]) === true ? $this->params[$key] : null;
}
/**
* Setzt einen neuen URI Parameter
*
* @param string $key
* @param string|integer $value
*/
public function __set($key, $value)
{
public function __set($key, $value) {
// Parameter sollten nicht überschrieben werden können
if (isset($this->params[$key]) === false)
$this->params[$key] = $value;
}
/**
* Überprüft, ob ein URI-Parameter existiert
*
* @param string $key
* @return boolean
*/
public function __isset($key)
{
public function __isset($key) {
return isset($this->params[$key]);
}
/**
* Grundlegende Verarbeitung der URI-Query
*/
private function preprocessUriQuery()
{
private function preprocessUriQuery() {
$this->query = substr(str_replace(PHP_SELF, '', htmlentities($_SERVER['PHP_SELF'], ENT_QUOTES)), 1);
$this->query.= !preg_match('/\/$/', $this->query) ? '/' : '';
$this->query.=!preg_match('/\/$/', $this->query) ? '/' : '';
if (preg_match(self::PATTERN, $this->query)) {
// Definieren, dass man sich im Administrationsbereich befindet
......@@ -101,27 +102,27 @@ class URI
return;
}
/**
* Überprüft die URI auf einen möglichen URI-Alias und
* macht im Erfolgsfall einen Redirect darauf
*
* @return
*/
private function checkForUriAlias()
{
private function checkForUriAlias() {
// Nur ausführen, falls URI-Aliase aktiviert sind
if ((bool) (bool) CONFIG_SEO_ALIASES === true && !defined('IN_ADM')) {
if ((bool) CONFIG_SEO_ALIASES === true && !defined('IN_ADM')) {
// Falls für Query ein Alias existiert, zu diesem weiterleiten
if (SEO::uriAliasExists($this->query) === true)
// URI-Alias wird von uri::route() erzeugt
// URI-Alias wird von uri::route() erzeugt
$this->redirect($this->query, 0, 1);
$prob_query = $this->query;
// Annehmen, dass ein URI Alias mit zusätzlichen Parametern übergeben wurde
if (preg_match('/^([a-z]{1}[a-z\d\-]*\/)+(([a-z\d\-]+)_(.+)\/)+$/', $this->query)) {
$query = preg_split('=/=', $this->query, -1, PREG_SPLIT_NO_EMPTY);
$className = "\\ACP3\\Modules\\" . ucfirst($query[0]) . "\\" . ucfirst($query[0]) . 'Frontend';
// Keine entsprechende Module-Action gefunden -> muss Alias sein
if (method_exists($className, 'action' . ucfirst($query[1])) === false) {
if (Modules::actionExists($query[0], $query[1]) === false) {
$length = 0;
foreach ($query as $row) {
if (strpos($row, '_') === false) {
......@@ -131,12 +132,12 @@ class URI
}
}
$params = substr($this->query, $length);
$this->query = substr($this->query, 0, $length);
$prob_query = substr($this->query, 0, $length);
}
}
// Nachschauen, ob ein URI-Alias für die aktuelle Seite festgelegt wurde
$alias = Registry::get('Db')->fetchAssoc('SELECT uri FROM ' . DB_PRE . 'seo WHERE alias = ?', array(substr($this->query, 0, -1)));
$alias = Registry::get('Db')->fetchAssoc('SELECT uri FROM ' . DB_PRE . 'seo WHERE alias = ?', array(substr($prob_query, 0, -1)));
if (!empty($alias)) {
$this->query = $alias['uri'] . (!empty($params) ? $params : '');
}
......@@ -144,6 +145,7 @@ class URI
return;
}
/**
* Setzt alle in URI::query enthaltenen Parameter
*
......@@ -151,8 +153,7 @@ class URI
* @param string $defaultFile
* @return
*/
private function setUriParameters($defaultModule, $defaultFile)
{
private function setUriParameters($defaultModule, $defaultFile) {
$query = preg_split('=/=', $this->query, -1, PREG_SPLIT_NO_EMPTY);
if (empty($defaultModule) && empty($defaultFile)) {
......@@ -181,17 +182,17 @@ class URI
// Position
if (preg_match('/^(page_(\d+))$/', $query[$i])) {
$this->page = (int) substr($query[$i], 5);
// ID eines Datensatzes
// ID eines Datensatzes
} elseif (preg_match('/^(id_(\d+))$/', $query[$i])) {
$this->id = (int) substr($query[$i], 3);
// Additional URI parameters
// Additional URI parameters
} elseif (preg_match('/^(([a-z0-9-]+)_(.+))$/', $query[$i])) {
$param = explode('_', $query[$i], 2);
$this->$param[0] = $param[1];
}
}
// Workaround für Securitytoken-Generierung,
// falls die URL nur aus dem Modulnamen besteht
// Workaround für Securitytoken-Generierung,
// falls die URL nur aus dem Modulnamen besteht
} elseif (isset($query[0]) && !isset($query[1])) {
$this->query.= $defaultFile . '/';
} elseif (!isset($query[0]) && !isset($query[1])) {
......@@ -205,24 +206,25 @@ class URI
return;
}
/**
* Gibt die URI-Parameter aus
*
* @return array
*/
public function getParameters()
{
public function getParameters() {
return $this->params;
}
/**
* Gibt die bereinigte URI-Query aus, d.h. ohne die anzuzeigende Seite
*
* @return string
*/
public function getCleanQuery()
{
public function getCleanQuery() {
return preg_replace('/\/page_(\d+)\//', '/', $this->query);
}
/**
* Umleitung auf andere URLs
*
......@@ -231,8 +233,7 @@ class URI
* @param string $new_page
* Leitet auf eine externe Seite weiter
*/
public function redirect($args, $new_page = 0, $moved_permanently = 0)
{
public function redirect($args, $new_page = 0, $moved_permanently = 0) {
if (!empty($args)) {
$protocol = empty($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) === 'off' ? 'http://' : 'https://';
$host = $_SERVER['HTTP_HOST'];
......@@ -245,18 +246,18 @@ class URI
header('Location:' . str_replace('&amp;', '&', $new_page));
exit;
}
/**
* Generiert die ACP3 internen Hyperlinks
*
* @param string $uri
* Inhalt der zu generierenden URL
* @param integer $alias
* Gibt an, ob für die auszugebende Seite der URI-Alias ausgegeben werden soll,
* falls dieser existiert
* Gibt an, ob für die auszugebende Seite der URI-Alias ausgegeben werden soll,
* falls dieser existiert
* @return string
*/
public function route($path, $alias = 1)
{
public function route($path, $alias = 1) {
$path = $path . (!preg_match('/\/$/', $path) ? '/' : '');
if ((bool) CONFIG_SEO_ALIASES === true && !preg_match(self::PATTERN, $path)) {
......@@ -271,4 +272,5 @@ class URI
$prefix = (bool) CONFIG_SEO_MOD_REWRITE === false || preg_match(self::PATTERN, $path) ? PHP_SELF . '/' : ROOT_DIR;
return $prefix . $path;
}
}
\ No newline at end of file
......@@ -12,7 +12,7 @@ function smarty_function_check_access($params)
$action[1] = isset($query[1]) ? $query[1] : 'list';
}
if (\ACP3\Core\Modules::check($action[0], $action[1]) === true) {
if (\ACP3\Core\Modules::hasPermission($action[0], $action[1]) === true) {
$access_check = array();
$access_check['uri'] = \ACP3\Core\Registry::get('URI')->route($params['path']);
......
......@@ -2,7 +2,7 @@
function smarty_function_has_permission($params)
{
if (isset($params['mod'], $params['file'])) {
return \ACP3\Core\Modules::check($params['mod'], $params['file']);
return \ACP3\Core\Modules::hasPermission($params['mod'], $params['file']);
} else {
return false;
}
......
......@@ -3,7 +3,7 @@ function smarty_function_load_module($params)
{
$module = explode('|', $params['module']);
if (\ACP3\Core\Modules::check($module[0], $module[1]) === true) {
if (\ACP3\Core\Modules::hasPermission($module[0], $module[1]) === true) {
$className = "\\ACP3\\Modules\\" . ucfirst($module[0]) . "\\" . ucfirst($module[0]) . 'Frontend';
$action = 'action' . ucfirst($module[1]);
$mod = new $className();
......
......@@ -19,6 +19,7 @@ class Application {
self::initializeInstallerClasses();
self::outputPage();
}
/**
*
*/
......@@ -144,7 +145,7 @@ class Application {
}
if (!empty($_COOKIE['ACP3_INSTALLER_LANG']) && !preg_match('=/=', $_COOKIE['ACP3_INSTALLER_LANG']) &&
is_file(ACP3_ROOT_DIR . 'installation/languages/' . $_COOKIE['ACP3_INSTALLER_LANG'] . '.xml') === true) {
is_file(ACP3_ROOT_DIR . 'installation/languages/' . $_COOKIE['ACP3_INSTALLER_LANG'] . '.xml') === true) {
define('LANG', $_COOKIE['ACP3_INSTALLER_LANG']);
} else {
define('LANG', \ACP3\Core\Lang::parseAcceptLanguage());
......@@ -166,7 +167,7 @@ class Application {
$module = ucfirst($uri->mod);
$className = "\\ACP3\\Installer\\Modules\\" . $module . "\\" . $module;
$action = 'action' . ucfirst($uri->file);
$action = 'action' . preg_replace('/(\s+)/', '', ucwords(strtolower(str_replace('_', ' ', $uri->file))));
if (method_exists($className, $action) === true) {
// Modul einbinden
......
......@@ -18,7 +18,7 @@ class AcpAdmin extends Core\ModuleController {
foreach ($mod_list as $name => $info) {
$dir = strtolower($info['dir']);
if (Core\Modules::check($dir, 'acp_list') === true && $dir !== 'acp') {
if (Core\Modules::hasPermission($dir, 'acp_list') === true && $dir !== 'acp') {
$mods[$name]['name'] = $name;
$mods[$name]['dir'] = $dir;
}
......
......@@ -13,7 +13,7 @@ class ArticlesAdmin extends Core\ModuleController {
public function actionCreate()
{
$access_to_menus = Core\Modules::check('menus', 'acp_create_item');
$access_to_menus = Core\Modules::hasPermission('menus', 'acp_create_item');
if (isset($_POST['submit']) === true) {
if (Core\Validate::date($_POST['start'], $_POST['end']) === false)
......@@ -218,7 +218,7 @@ class ArticlesAdmin extends Core\ModuleController {
$c_articles = count($articles);
if ($c_articles > 0) {
$can_delete = Core\Modules::check('articles', 'acp_delete');
$can_delete = Core\Modules::hasPermission('articles', 'acp_delete');
$config = array(
'element' => '#acp-table',
'sort_col' => $can_delete === true ? 2 : 1,
......
......@@ -200,7 +200,7 @@ class CategoriesAdmin extends Core\ModuleController {
$c_categories = count($categories);
if ($c_categories > 0) {
$can_delete = Core\Modules::check('categories', 'acp_delete');
$can_delete = Core\Modules::hasPermission('categories', 'acp_delete');
$config = array(
'element' => '#acp-table',
'sort_col' => $can_delete === true ? 1 : 0,
......
......@@ -117,7 +117,7 @@ abstract class CategoriesFunctions {
} else {
$categories['categories'] = array();
}
if ($category_create === true && Core\Modules::check('categories', 'acp_create') === true) {
if ($category_create === true && Core\Modules::hasPermission('categories', 'acp_create') === true) {
$categories['create']['name'] = $form_field_name . '_create';
$categories['create']['value'] = isset($_POST[$categories['create']['name']]) ? $_POST[$categories['create']['name']] : '';
}
......
......@@ -34,7 +34,7 @@ class CommentsAdmin extends Core\ModuleController {
}
}
public function actionDelete_comments() {
public function actionDeleteComments() {
if (isset($_POST['entries']) && is_array($_POST['entries']) === true)
$entries = $_POST['entries'];
elseif (Core\Validate::deleteEntries(Core\Registry::get('URI')->entries) === true)
......@@ -113,7 +113,7 @@ class CommentsAdmin extends Core\ModuleController {
$c_comments = count($comments);
if ($c_comments > 0) {
$can_delete = Core\Modules::check('comments', 'acp_delete');
$can_delete = Core\Modules::hasPermission('comments', 'acp_delete');
$config = array(
'element' => '#acp-table',
'sort_col' => $can_delete === true ? 1 : 0,
......@@ -129,7 +129,7 @@ class CommentsAdmin extends Core\ModuleController {
}
}
public function actionList_comments() {
public function actionListComments() {
Core\Functions::getRedirectMessage();
if (Core\Validate::isNumber(Core\Registry::get('URI')->id) &&
......@@ -143,7 +143,7 @@ class CommentsAdmin extends Core\ModuleController {
$c_comments = count($comments);
if ($c_comments > 0) {
$can_delete = Core\Modules::check('comments', 'acp_delete_comments');
$can_delete = Core\Modules::hasPermission('comments', 'acp_delete_comments');
$config = array(
'element' => '#acp-table',
'sort_col' => $can_delete === true ? 5 : 4,
......
......@@ -20,7 +20,7 @@ class CommentsFrontend extends Core\ModuleController {
}
public function actionCreate() {
$captchaAccess = Core\Modules::check('captcha', 'image');
$captchaAccess = Core\Modules::hasPermission('captcha', 'image');
// Formular für das Eintragen von Kommentaren
if (isset($_POST['submit']) === true) {
......@@ -141,7 +141,7 @@ class CommentsFrontend extends Core\ModuleController {
Core\Registry::get('View')->assign('comments', $comments);
}
if (Core\Modules::check('comments', 'create') === true) {
if (Core\Modules::hasPermission('comments', 'create') === true) {
Core\Registry::get('View')->assign('comments_create_form', $this->actionCreate());
}
......
......@@ -13,7 +13,7 @@ class ContactFrontend extends Core\ModuleController {
public function actionList()
{
$captchaAccess = Core\Modules::check('captcha', 'image');
$captchaAccess = Core\Modules::hasPermission('captcha', 'image');
if (isset($_POST['submit']) === true) {
if (empty($_POST['name']))
......
......@@ -158,7 +158,7 @@ class EmoticonsAdmin extends Core\ModuleController {
$c_emoticons = count($emoticons);
if ($c_emoticons > 0) {
$can_delete = Core\Modules::check('emoticons', 'acp_delete');
$can_delete = Core\Modules::hasPermission('emoticons', 'acp_delete');
$config = array(
'element' => '#acp-table',
'sort_col' => $can_delete === true ? 4 : 3,
......
......@@ -15,7 +15,7 @@ class FeedsFrontend extends Core\ModuleController {
$module = Core\Registry::get('URI')->feed;
$className = "\\ACP3\\Modules\\Feeds\\FeedsExtensions";
$action = strtolower($module) . 'Feed';
if (Core\Modules::check($module, 'list') === true &&
if (Core\Modules::hasPermission($module, 'list') === true &&
method_exists($className, $action) === true) {
$settings = Core\Config::getSettings('feeds');
......
......@@ -279,7 +279,7 @@ class FilesAdmin extends Core\ModuleController {
$c_files = count($files);
if ($c_files > 0) {
$can_delete = Core\Modules::check('files', 'acp_delete');
$can_delete = Core\Modules::hasPermission('files', 'acp_delete');
$config = array(
'element' => '#acp-table',
'sort_col' => $can_delete === true ? 1 : 0,
......
......@@ -59,7 +59,7 @@ class FilesFrontend extends Core\ModuleController {
$file['date_iso'] = Core\Registry::get('Date')->format($file['start'], 'c');
Core\Registry::get('View')->assign('file', $file);
if ($settings['comments'] == 1 && $file['comments'] == 1 && Core\Modules::check('comments', 'list') === true) {
if ($settings['comments'] == 1 && $file['comments'] == 1 && Core\Modules::hasPermission('comments', 'list') === true) {
$comments = new \ACP3\Modules\Comments\CommentsFrontend($this->injector, 'files', Core\Registry::get('URI')->id);
Core\Registry::get('View')->assign('comments', $comments->actionList());
}
......
......@@ -55,7 +55,7 @@ class GalleryAdmin extends Core\ModuleController {
}
}
public function actionCreate_picture() {
public function actionCreatePicture() {
if (Core\Validate::isNumber(Core\Registry::get('URI')->id) === true &&
Core\Registry::get('Db')->fetchColumn('SELECT COUNT(*) FROM ' . DB_PRE . 'gallery WHERE id = ?', array(Core\Registry::get('URI')->id)) == 1) {
$gallery = Core\Registry::get('Db')->fetchColumn('SELECT title FROM ' . DB_PRE . 'gallery WHERE id = ?', array(Core\Registry::get('URI')->id));
......@@ -169,7 +169,7 @@ class GalleryAdmin extends Core\ModuleController {
}
}
public function actionDelete_picture() {
public function actionDeletePicture() {
if (isset($_POST['entries']) && is_array($_POST['entries']) === true)
$entries = $_POST['entries'];
elseif (Core\Validate::deleteEntries(Core\Registry::get('URI')->entries) === true)
......@@ -256,7 +256,7 @@ class GalleryAdmin extends Core\ModuleController {
$c_pictures = count($pictures);
if ($c_pictures > 0) {
$can_delete = Core\Modules::check('gallery', 'acp_delete_picture');
$can_delete = Core\Modules::hasPermission('gallery', 'acp_delete_picture');
$config = array(
'element' => '#acp-table',
'hide_col_sort' => $can_delete === true ? 0 : ''
......@@ -269,8 +269,8 @@ class GalleryAdmin extends Core\ModuleController {
}
Core\Registry::get('View')->assign('pictures', $pictures);
Core\Registry::get('View')->assign('can_delete', $can_delete);
Core\Registry::get('View')->assign('can_order', Core\Modules::check('gallery', 'acp_order'));
Core\Registry::get('View')->assign('can_edit_picture', Core\Modules::check('gallery', 'acp_edit_picture'));
Core\Registry::get('View')->assign('can_order', Core\Modules::hasPermission('gallery', 'acp_order'));
Core\Registry::get('View')->assign('can_edit_picture', Core\Modules::hasPermission('gallery', 'acp_edit_picture'));
}
Core\Registry::get('Session')->generateFormToken();
......@@ -280,7 +280,7 @@ class GalleryAdmin extends Core\ModuleController {
}
}
public function actionEdit_picture() {
public function actionEditPicture() {
if (Core\Validate::isNumber(Core\Registry::get('URI')->id) === true &&
Core\Registry::get('Db')->fetchColumn('SELECT COUNT(*) FROM ' . DB_PRE . 'gallery_pictures WHERE id = ?', array(Core\Registry::get('URI')->id)) == 1) {
$picture = Core\Registry::get('Db')->fetchAssoc('SELECT p.gallery_id, p.file, p.description, p.comments, g.title AS gallery_title FROM ' . DB_PRE . 'gallery_pictures AS p, ' . DB_PRE . 'gallery AS g WHERE p.id = ? AND p.gallery_id = g.id', array(Core\Registry::get('URI')->id));
......@@ -359,7 +359,7 @@ class GalleryAdmin extends Core\ModuleController {
$c_galleries = count($galleries);
if ($c_galleries > 0) {
$can_delete = Core\Modules::check('gallery', 'acp_delete');
$can_delete = Core\Modules::hasPermission('gallery', 'acp_delete');
$config = array(
'element' => '#acp-table',
'sort_col' => $can_delete === true ? 1 : 0,
......
......@@ -62,7 +62,7 @@ class GalleryFrontend extends Core\ModuleController {
Core\Registry::get('View')->assign('picture_next', $picture_next);
}
if ($settings['overlay'] == 0 && $settings['comments'] == 1 && $picture['comments'] == 1 && Core\Modules::check('comments', 'list') === true) {
if ($settings['overlay'] == 0 && $settings['comments'] == 1 && $picture['comments'] == 1 && Core\Modules::hasPermission('comments', 'list') === true) {
$comments = new \ACP3\Modules\Comments\CommentsFrontend($this->injector, 'gallery', Core\Registry::get('URI')->id);
Core\Registry::get('View')->assign('comments', $comments->actionList());
}
......
......@@ -100,7 +100,7 @@ class GuestbookAdmin extends Core\ModuleController {
$c_guestbook = count($guestbook);
if ($c_guestbook > 0) {
$can_delete = Core\Modules::check('guestbook', 'acp_delete');
$can_delete = Core\Modules::hasPermission('guestbook', 'acp_delete');
$config = array(
'element' => '#acp-table',
'sort_col' => $can_delete === true ? 1 : 0,
......
......@@ -17,8 +17,8 @@ class GuestbookFrontend extends Core\ModuleController {
->append(Core\Registry::get('Lang')->t('guestbook', 'create'));
$settings = Core\Config::getSettings('guestbook');
$newsletterAccess = Core\Modules::check('newsletter', 'list') === true && $settings['newsletter_integration'] == 1;
$captchaAccess = Core\Modules::check('captcha', 'image');
$newsletterAccess = Core\Modules::hasPermission('newsletter', 'list') === true && $settings['newsletter_integration'] == 1;
$captchaAccess = Core\Modules::hasPermission('captcha', 'image');
$overlay_active = false;
if (Core\Registry::get('URI')->layout === 'simple') {
......
......@@ -46,7 +46,7 @@ class MenusAdmin extends Core\ModuleController {
}
}
public function actionCreate_item()
public function actionCreateItem()
{
if (isset($_POST['submit']) === true) {
if (Core\Validate::isNumber($_POST['mode']) === false)
......@@ -207,7 +207,7 @@ class MenusAdmin extends Core\ModuleController {
}
}
public function actionDelete_item()
public function actionDeleteItem()
{
if (isset($_POST['entries']) && is_array($_POST['entries']) === true)
$entries = $_POST['entries'];
......@@ -281,7 +281,7 @@ class MenusAdmin extends Core\ModuleController {
}
}
public function actionEdit_item()
public function actionEditItem()
{
if (Core\Validate::isNumber(Core\Registry::get('URI')->id) === true &&
Core\Registry::get('Db')->fetchColumn('SELECT COUNT(*) FROM ' . DB_PRE . 'menu_items WHERE id = ?', array(Core\Registry::get('URI')->id)) == 1) {
......@@ -416,12 +416,12 @@ class MenusAdmin extends Core\ModuleController {
$c_menus = count($menus);
if ($c_menus > 0) {
$can_delete_item = Core\Modules::check('menus', 'acp_delete_item');
$can_order_item = Core\Modules::check('menus', 'acp_order');
$can_delete_item = Core\Modules::hasPermission('menus', 'acp_delete_item');
$can_order_item = Core\Modules::hasPermission('menus', 'acp_order');
Core\Registry::get('View')->assign('can_delete_item', $can_delete_item);
Core\Registry::get('View')->assign('can_order_item', $can_order_item);
Core\Registry::get('View')->assign('can_delete', Core\Modules::check('menus', 'acp_delete'));
Core\Registry::get('View')->assign('can_edit', Core\Modules::check('menus', 'acp_edit'));
Core\Registry::get('View')->assign('can_delete', Core\Modules::hasPermission('menus', 'acp_delete'));
Core\Registry::get('View')->assign('can_edit', Core\Modules::hasPermission('menus', 'acp_edit'));
Core\Registry::get('View')->assign('colspan', $can_delete_item && $can_order_item ? 5 : ($can_delete_item || $can_order_item ? 4 : 3));
$pages_list = MenusFunctions::menuItemsList();
......
......@@ -232,7 +232,7 @@ class NewsAdmin extends Core\ModuleController {
$c_news = count($news);
if ($c_news > 0) {
$can_delete = Core\Modules::check('news', 'acp_delete');
$can_delete = Core\Modules::hasPermission('news', 'acp_delete');
$config = array(
'element' => '#acp-table',
'sort_col' => $can_delete === true ? 1 : 0,
......
......@@ -40,7 +40,7 @@ class NewsFrontend extends Core\ModuleController {
Core\Registry::get('View')->assign('news', $news);
if ($settings['comments'] == 1 && $news['comments'] == 1 && Core\Modules::check('comments', 'list') === true) {
if ($settings['comments'] == 1 && $news['comments'] == 1 && Core\Modules::hasPermission('comments', 'list') === true) {
$comments = new \ACP3\Modules\Comments\CommentsFrontend('news', Core\Registry::get('URI')->id);
Core\Registry::get('View')->assign('comments', $comments->actionList());
}
......
......@@ -105,7 +105,7 @@ class NewsletterAdmin extends Core\ModuleController {
}
}
public function actionDelete_account() {
public function actionDeleteAccount() {
if (isset($_POST['entries']) && is_array($_POST['entries']) === true)
$entries = $_POST['entries'];
elseif (Core\Validate::deleteEntries(Core\Registry::get('URI')->entries) === true)
......@@ -208,7 +208,7 @@ class NewsletterAdmin extends Core\ModuleController {
$c_newsletter = count($newsletter);
if ($c_newsletter > 0) {
$can_delete = Core\Modules::check('newsletter', 'acp_delete');
$can_delete = Core\Modules::hasPermission('newsletter', 'acp_delete');
$config = array(
'element' => '#acp-table',
'sort_col' => $can_delete === true ? 1 : 0,
......@@ -225,18 +225,18 @@ class NewsletterAdmin extends Core\ModuleController {
}
Core\Registry::get('View')->assign('newsletter', $newsletter);
Core\Registry::get('View')->assign('can_delete', $can_delete);
Core\Registry::get('View')->assign('can_send', Core\Modules::check('newsletter', 'acp_send'));