From 5b27274fa7bb214bc673ccd036f27e1a3f3b2b5f Mon Sep 17 00:00:00 2001 From: genuineparts Date: Mon, 23 Jun 2025 20:13:52 +0200 Subject: [PATCH] Improvements and typos --- admin/adduser.apnl.php | 2 +- admin/config.apnl.php | 2 +- admin/editusers.apnl.php | 30 ++++++------- core/init_core.inc.php | 17 ++++---- inc/panel.class.php | 55 +++++++++++++----------- install/sql/dump.sql | 6 +-- modules/contact/contact.module.php | 7 ++- modules/news/news.module.php | 6 +-- modules/text/admin/add.apnl.php | 2 +- modules/text/admin/addcategory.apnl.php | 2 +- modules/text/admin/edit.apnl.php | 6 +-- modules/text/admin/editcategory.apnl.php | 14 +++--- modules/text/text.module.php | 4 +- 13 files changed, 78 insertions(+), 75 deletions(-) diff --git a/admin/adduser.apnl.php b/admin/adduser.apnl.php index d716681..dd28e87 100644 --- a/admin/adduser.apnl.php +++ b/admin/adduser.apnl.php @@ -1,4 +1,4 @@ -query("SELECT * FROM `" . $config["prefix"] . "config` v LEFT JOIN `" . $config["prefix"] . "config_categorys` c ON v.`category`=c.`cid`"); + $result = $db->query("SELECT * FROM `" . $config["prefix"] . "config` v LEFT JOIN `" . $config["prefix"] . "config_categories` c ON v.`category`=c.`cid`"); while ($row = $db->fetch_array($result)){ $data[$row["categoryname"]][]=$row; } diff --git a/admin/editusers.apnl.php b/admin/editusers.apnl.php index 9c9441d..a63091a 100644 --- a/admin/editusers.apnl.php +++ b/admin/editusers.apnl.php @@ -1,4 +1,4 @@ -content.=" - - - - - - + + + + + + "; if(!empty($user)){ foreach($user as $u){ @@ -131,22 +131,22 @@ class editusers_panel extends admin_module{ $u['activestyle']='style="font-style:italic;"'; } $panel->content.=" - - - - - "; + + + + + "; if($u["uid"]==$session->userdata["uid"]){ - $panel->content.=" + $panel->content.=""; }else{ - $panel->content.=" + $panel->content.=""; } } }else{ $panel->content.=" - + "; } $panel->content.="
".$lang->_('ID')."".$lang->_('USERNAME')."".$lang->_('REALNAME')."".$lang->_('ROLE')."".$lang->_('STATUS')."".$lang->_('ACTION')."".$lang->_('ID')."".$lang->_('USERNAME')."".$lang->_('REALNAME')."".$lang->_('ROLE')."".$lang->_('STATUS')."".$lang->_('ACTION')."
".$u["uid"]."".$u["username"]."".$u["realname"]."".$u["role_name"]."".$u['activetext']."".$u["uid"]."".$u["username"]."".$u["realname"]."".$u["role_name"]."".$u['activetext']."_('BADIDEA')."')\" href=\"".$config["path"]."/admin/index.php?panel=editusers&action=delete&user=".$u["uid"]."\"> _('BADIDEA')."')\" href=\"".$config["path"]."/admin/index.php?panel=editusers&action=delete&user=".$u["uid"]."\">
_('DELETEUSER'),$u["username"])."')\" href=\"".$config["path"]."/admin/index.php?panel=editusers&action=delete&user=".$u["uid"]."\"> _('DELETEUSER'),$u["username"])."')\" href=\"".$config["path"]."/admin/index.php?panel=editusers&action=delete&user=".$u["uid"]."\">
".$lang->_('NOUSERS')."".$lang->_('NOUSERS')."

"; diff --git a/core/init_core.inc.php b/core/init_core.inc.php index a98b936..646f8f2 100644 --- a/core/init_core.inc.php +++ b/core/init_core.inc.php @@ -68,11 +68,6 @@ require dirname(__FILE__, 2) .'/inc/logger.class.php'; */ require dirname(__FILE__, 2) .'/inc/datacache.class.php'; -/** -* Cache -*/ -require dirname(__FILE__, 2) .'/inc/cache.class.php'; - /** * Errors */ @@ -119,10 +114,16 @@ if($config['LCLANG']){ $cache=new datacache(); /** -* Start Datacache -* +* Start Cache +* I think this is vestigial and can be deleted. Hesitant to remove it because some instance in the wild may use this? */ -$ccache=new cache(); +if(isset($config['MEMCACHE_SERVER'])) { + /** + * Cache + */ + require dirname(__FILE__, 2) .'/inc/cache.class.php'; + $ccache = new cache(); +} /** * Look if we have a path Variable and try to autoset if not. diff --git a/inc/panel.class.php b/inc/panel.class.php index 850b6ba..5e934a5 100644 --- a/inc/panel.class.php +++ b/inc/panel.class.php @@ -2,7 +2,7 @@ /** * Project: BeCast Webengine - simple site engine * File: /inc/panel.class.php - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either @@ -26,23 +26,23 @@ */ $module["panel"]["name"]="Panel Class"; -$module["panel"]["ver"]="0.3.5"; +$module["panel"]["ver"]="0.3.6"; class panel { - var $sidebar=""; - var $page=""; - var $bodyext=""; - var $title=""; - var $content=""; - var $meta=""; - var $form=""; - var $foot=""; - var $head=""; - var $menu_items =""; + var string $sidebar=""; + var string $page=""; + var string $bodyext=""; + var string $title=""; + var string $content=""; + var string $meta=""; + var string $form=""; + var string $foot=""; + var string $head=""; + var string $menu_items =""; function page($additional_title="",$meta=""){ global $config,$db,$core; return ' - + '.$config['sitetitle'].' @@ -77,24 +77,26 @@ class panel { exit(); } - function menu_item($panel,$text, $img=""){ + function menu_item($panel,$text, $img=""): void + { global $config, $userdata, $userinfo, $session, $meta; if($panel=="group_only"){ $this->menu_items.="
  • ".$text."
  • "; }elseif($panel=="admin_home"){ - $this->menu_items.="
  • ".$text."
  • "; + $this->menu_items.="
  • ".$img." ".$text."
  • "; }elseif($panel=="page_home"){ - $this->menu_items.="
  • ".$text."
  • "; + $this->menu_items.="
  • ".$img." ".$text."
  • "; }else{ if($img!=""){ - $this->menu_items.="
  • ".$text."
  • "; + $this->menu_items.="
  • ".$img." ".$text."
  • "; }else{ $this->menu_items.="
  • ".$text."
  • "; } } } - function admin_message($title,$message,$redirect=FALSE,$panel="",$time="4"){ + function admin_message($title,$message,$redirect=FALSE,$panel="",$time="4"): void + { global $config,$session,$lang; $session->page_begin("Admin Message", True); if($panel!="" && $redirect){ @@ -111,7 +113,8 @@ class panel { } - function menu(){ + function menu(): string + { return ''; @@ -120,8 +123,8 @@ class panel { function form ($args = array(),$return=FALSE,$extra=""){ - $method = $args["method"] ? $args["method"] : 'post'; - $action = $args["action"] ? $args["action"] : $_SERVER['PHP_SELF']; + $method = $args["method"] ?? 'POST'; + $action = $args["action"] ?? $_SERVER['PHP_SELF']; $form = '
    '; if(!$return){ $this->content .= $form; @@ -129,7 +132,7 @@ class panel { return $form; } } - function formClose () + function formClose ($return=FALSE) { $form = '
    '; @@ -214,10 +217,10 @@ class panel { */ function textarea ($args = array(),$extra="",$return=FALSE) { - $name = $args["name"] ? $args["name"] : 'field'; - $rows = $args["rows"] ? $args["rows"] : '3'; - $cols = $args["cols"] ? $args["cols"] : '30'; - $text = $args["value"] ? $args["value"] : ''; + $name = $args["name"] ?? 'field'; + $rows = $args["rows"] ?? '3'; + $cols = $args["cols"] ?? '30'; + $text = $args["value"] ?? ''; $fld = ''; if(!$return){ diff --git a/install/sql/dump.sql b/install/sql/dump.sql index 2ae01e1..c5fc2c1 100755 --- a/install/sql/dump.sql +++ b/install/sql/dump.sql @@ -73,8 +73,8 @@ INSERT INTO `as_config` (`name`, `value`, `title`, `description`, `option`, `cat -- Tabellenstruktur für Tabelle `as_config_categorys` -- -DROP TABLE IF EXISTS `as_config_categorys`; -CREATE TABLE IF NOT EXISTS `as_config_categorys` ( +DROP TABLE IF EXISTS `as_config_categories`; +CREATE TABLE IF NOT EXISTS `as_config_categories` ( `cid` int(11) NOT NULL auto_increment, `categoryname` varchar(200) NOT NULL, PRIMARY KEY (`cid`) @@ -84,7 +84,7 @@ CREATE TABLE IF NOT EXISTS `as_config_categorys` ( -- Daten für Tabelle `as_config_categorys` -- -INSERT INTO `as_config_categorys` (`cid`, `categoryname`) VALUES +INSERT INTO `as_config_categories` (`cid`, `categoryname`) VALUES (1, 'Allgemein'), (2, 'Wartungsmodus'), (3, 'Registrierung'), diff --git a/modules/contact/contact.module.php b/modules/contact/contact.module.php index acfdf7c..9e55382 100644 --- a/modules/contact/contact.module.php +++ b/modules/contact/contact.module.php @@ -3,22 +3,21 @@ class module_contact extends admin_module{ function admin_panels(){ - panels=array(); - return $panels; + return array(); } function get_info(){ $info["name"]="Kontaktformular"; $info["file"]="contact"; $info["author"]="BeCast"; - $info["version"]="1.0.0"; + $info["version"]="1.0.1"; $info["url"]="http://www.becast.at"; return $info; } function install(){ global $config, $db; - $db->query("INSERT INTO `" . $config["prefix"] . "config_categorys` ( + $db->query("INSERT INTO `" . $config["prefix"] . "config_categories` ( `cid` , `categoryname` ) diff --git a/modules/news/news.module.php b/modules/news/news.module.php index 9f65751..087b158 100644 --- a/modules/news/news.module.php +++ b/modules/news/news.module.php @@ -10,9 +10,9 @@ class module_news extends admin_module{ function get_info(){ $info["name"]="Newsmodul"; $info["file"]="news"; - $info["author"]="astat"; - $info["version"]="1.0.0"; - $info["url"]="http://www.astat.org"; + $info["author"]="BeCast"; + $info["version"]="1.0.1"; + $info["url"]="http://www.becast.at"; return $info; } diff --git a/modules/text/admin/add.apnl.php b/modules/text/admin/add.apnl.php index c449969..b9eeb0f 100644 --- a/modules/text/admin/add.apnl.php +++ b/modules/text/admin/add.apnl.php @@ -81,7 +81,7 @@ class add_text_panel extends admin_module{ $panel->content.="

    Kategorien:

    "; - $resultk=$db->query("SELECT `id`,`categoryname` FROM `" . $config["prefix"] . "article_categorys` WHERE `active`='true'") or die($db->error()); + $resultk=$db->query("SELECT `id`,`categoryname` FROM `" . $config["prefix"] . "article_categories` WHERE `active`='true'") or die($db->error()); while($row=$db->fetch_array($resultk)){ $navs[]=$row; } diff --git a/modules/text/admin/addcategory.apnl.php b/modules/text/admin/addcategory.apnl.php index 8306352..ca7c3b9 100644 --- a/modules/text/admin/addcategory.apnl.php +++ b/modules/text/admin/addcategory.apnl.php @@ -52,7 +52,7 @@ class addcategory_text_panel extends admin_module{ } $categoryname=$db->escape($_POST['categoryname']); $active=$db->escape($_POST['active']); - $db->query("INSERT INTO `" . $config["prefix"]. "article_categorys` (`categoryname`,`picture`,`active`) VALUES ('".$categoryname."','".$userfile_name."','".$active."')") or die ($db->error()); + $db->query("INSERT INTO `" . $config["prefix"]. "article_categories` (`categoryname`,`picture`,`active`) VALUES ('".$categoryname."','".$userfile_name."','".$active."')") or die ($db->error()); $panel->admin_message("Danke", "Die Kategorie wurde erfolgreich eingetragen!.",TRUE,"addcategory_text"); }else{ $fail="Der Kategoriename muss angegeben werden!"; diff --git a/modules/text/admin/edit.apnl.php b/modules/text/admin/edit.apnl.php index 8d533e4..f08e37a 100644 --- a/modules/text/admin/edit.apnl.php +++ b/modules/text/admin/edit.apnl.php @@ -1,4 +1,4 @@ -fetch_array($resultn)){ $cat[$rowa["c_id"]]=TRUE; } - $resultk=$db->query("SELECT `id`,`categoryname` FROM `" . $config["prefix"] . "article_categorys` WHERE `active`='true'"); + $resultk=$db->query("SELECT `id`,`categoryname` FROM `" . $config["prefix"] . "article_categories` WHERE `active`='true'"); while($row=$db->fetch_array($resultk)){ if($cat[$row["id"]]==TRUE){ $row["checked"]="checked=\"checked\""; @@ -132,7 +132,7 @@ class edit_text_panel extends admin_module{ }else{ $result = $db->query("SELECT a.title,a.id,a.active,a.date,a.url,u.username FROM `" . $config["prefix"] . "article` a LEFT JOIN `" . $config["prefix"] . "users` u on a.`author`=u.`uid`"); while($row=$db->fetch_array($result, $db->ASSOC)){ - $cresult=$db->query("SELECT a.`categoryname` FROM `" . $config["prefix"] . "article_categorys` a LEFT JOIN `" . $config["prefix"] . "article_category` c on a.`id`=c.`c_id` WHERE c.`a_id`='".$row["id"]."'"); + $cresult=$db->query("SELECT a.`categoryname` FROM `" . $config["prefix"] . "article_categories` a LEFT JOIN `" . $config["prefix"] . "article_category` c on a.`id`=c.`c_id` WHERE c.`a_id`='".$row["id"]."'"); while($crow=$db->fetch_array($cresult, $db->ASSOC)){ if(!$row["categoryname"]){ $row["categoryname"]=$crow["categoryname"]; diff --git a/modules/text/admin/editcategory.apnl.php b/modules/text/admin/editcategory.apnl.php index cf3166d..08fb4f4 100644 --- a/modules/text/admin/editcategory.apnl.php +++ b/modules/text/admin/editcategory.apnl.php @@ -1,4 +1,4 @@ -admin_message("Fehler", "Das Bild konnte nicht hochgeladen wrden
    Der Fehler war: ". $ret,TRUE,"editcategory_text"); } - $result=$db->query("SELECT `picture` FROM `" . $config["prefix"]. "article_categorys` WHERE `id`='".intval($_POST["id"])."' LIMIT 1"); + $result=$db->query("SELECT `picture` FROM `" . $config["prefix"]. "article_categories` WHERE `id`='".intval($_POST["id"])."' LIMIT 1"); $file=$db->fetch_array($result); @unlink($filedir.$file['picture']); $db->query("UPDATE `" . $config["prefix"]. "article_categorys` SET `picture`='".$userfile_name."' WHERE `id`='".intval($_POST["id"])."'"); }elseif($_POST["delimg"]==1){ - $result=$db->query("SELECT `picture` FROM `" . $config["prefix"]. "article_categorys` WHERE `id`='".intval($_POST["id"])."' LIMIT 1"); + $result=$db->query("SELECT `picture` FROM `" . $config["prefix"]. "article_categories` WHERE `id`='".intval($_POST["id"])."' LIMIT 1"); $file=$db->fetch_array($result); @unlink($filedir.$file['picture']); $db->query("UPDATE `" . $config["prefix"]. "article_categorys` SET `picture`='' WHERE `id`='".intval($_POST["id"])."'") or die($db->error()); @@ -71,7 +71,7 @@ class editcategory_text_panel extends admin_module{ }elseif(isset($_GET['id'])&& $_GET['id']!=""){ if($_GET['action']=="edit"){ - $result = $db->query("SELECT * FROM `" . $config["prefix"] . "article_categorys` WHERE `id`='".intval($_GET['id'])."'"); + $result = $db->query("SELECT * FROM `" . $config["prefix"] . "article_categories` WHERE `id`='".intval($_GET['id'])."'"); $_POST=$db->fetch_array($result); /*$resultna=$db->query("SELECT id,name FROM " . $config["prefix"] . "menue"); while($rowa=$db->fetch_array($resultna)){ @@ -112,15 +112,15 @@ class editcategory_text_panel extends admin_module{ $panel->parse_page(); }elseif($_GET["action"]=="delete" && $_GET["id"]){ - $result=$db->query("SELECT `picture` FROM `" . $config["prefix"] . "article_categorys` where `id`='".intval($_GET["id"])."'"); + $result=$db->query("SELECT `picture` FROM `" . $config["prefix"] . "article_categories` where `id`='".intval($_GET["id"])."'"); $row = $db->fetch_array($result); @unlink($root.'/catimages/'.$row["picture"]); - $db->query("DELETE FROM `" . $config["prefix"] . "article_categorys` WHERE `id`='".intval($_GET["id"])."'"); + $db->query("DELETE FROM `" . $config["prefix"] . "article_categories` WHERE `id`='".intval($_GET["id"])."'"); $panel->admin_message("Kategorie gelöscht!","Die Kategorie wurde erfolgreich gelöscht.",True,"editcategory_text",3); } }else{ - $result = $db->query("SELECT * FROM `" . $config["prefix"] . "article_categorys`"); + $result = $db->query("SELECT * FROM `" . $config["prefix"] . "article_categories`"); while($row=$db->fetch_array($result, $db->ASSOC)){ $articles[]=$row; } diff --git a/modules/text/text.module.php b/modules/text/text.module.php index 4fa2e73..d140103 100644 --- a/modules/text/text.module.php +++ b/modules/text/text.module.php @@ -36,7 +36,7 @@ class module_text extends admin_module{ KEY `eid` (`eid`) ) ENGINE=MyISAM"); - $db->query("CREATE TABLE IF NOT EXISTS `" . $config["prefix"] . "article_categorys` ( + $db->query("CREATE TABLE IF NOT EXISTS `" . $config["prefix"] . "article_categories` ( `id` int(11) NOT NULL auto_increment, `categoryname` varchar(80) NOT NULL default '', `picture` varchar(80) NOT NULL default '', @@ -68,7 +68,7 @@ class module_text extends admin_module{ function uninstall(){ global $config, $db; $db->query("DROP TABLE `" . $config["prefix"] . "article`"); - $db->query("DROP TABLE `" . $config["prefix"] . "article_categorys`"); + $db->query("DROP TABLE `" . $config["prefix"] . "article_categories`"); $db->query("DROP TABLE `" . $config["prefix"] . "article_category`"); $db->query("DROP TABLE `" . $config["prefix"] . "article_menue`"); @$this->recursive($_SERVER["DOCUMENT_ROOT"]."/catimages");