Improvements and typos

This commit is contained in:
genuineparts 2025-06-23 20:13:52 +02:00
parent 3bdbc74b0e
commit 5b27274fa7
13 changed files with 78 additions and 75 deletions

View file

@ -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 '<!DOCTYPE html>
<html>
<html lang="de">
<head>
<title>'.$config['sitetitle'].'</title>
<link rel="stylesheet" type="text/css" href="admin.css" />
@ -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.="<li><strong>".$text."</strong></li>";
}elseif($panel=="admin_home"){
$this->menu_items.="<li><a href=\"".$config["path"]."/admin/index.php\"><img src=\"".$config["path"]."/admin/images/icons/".$img.".png\" /> ".$text."</a></li>";
$this->menu_items.="<li><a href=\"".$config["path"]."/admin/index.php\"><img src=\"".$config["path"]."/admin/images/icons/".$img.".png\" alt='".$img."'> ".$text."</a></li>";
}elseif($panel=="page_home"){
$this->menu_items.="<li><a href=\"".$config["path"]."/index.php\"><img src=\"".$config["path"]."/admin/images/icons/".$img.".png\" /> ".$text."</a></li>";
$this->menu_items.="<li><a href=\"".$config["path"]."/index.php\"><img src=\"".$config["path"]."/admin/images/icons/".$img.".png\" alt='".$img."'> ".$text."</a></li>";
}else{
if($img!=""){
$this->menu_items.="<li><a href=\"".$config["path"]."/admin/index.php?panel=".$panel."\"><img src=\"".$config["path"]."/admin/images/icons/".$img.".png\" /> ".$text."</a></li>";
$this->menu_items.="<li><a href=\"".$config["path"]."/admin/index.php?panel=".$panel."\"><img src=\"".$config["path"]."/admin/images/icons/".$img.".png\" alt='".$img."'> ".$text."</a></li>";
}else{
$this->menu_items.="<li><a href=\"".$config["path"]."/admin/index.php?panel=".$panel."\">".$text."</a></li>";
}
}
}
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 '<div id="menu">
<ul>'.$this->menu_items.'</ul></div>';
@ -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 = '<form action="' .$action. '" method="' .$method. '"' .$extra. '>';
if(!$return){
$this->content .= $form;
@ -129,7 +132,7 @@ class panel {
return $form;
}
}
function formClose ()
function formClose ($return=FALSE)
{
$form = '</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 = '<textarea name="' .$name. '" rows="' .$rows. '" cols="' .$cols. '"' .$extra. '>' .$text. '</textarea>';
if(!$return){