Skip to content

Commit

Permalink
Merge pull request #6 from TiagoDGomes/version-2.4
Browse files Browse the repository at this point in the history
Version 2.4
  • Loading branch information
TiagoDGomes authored Oct 11, 2024
2 parents 97c57b7 + 48a8969 commit e3e4d09
Show file tree
Hide file tree
Showing 24 changed files with 500 additions and 145 deletions.
8 changes: 8 additions & 0 deletions classes/AccessCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,12 @@ public static function isRequestingInvalidDatabase() {
public static function isRequestingNewDatabase() {
return !Database::isValidDatabase();
}

public static function isValidStyle(){
if (!isset($_GET['s'])){
return true;
} else {
return (file_exists(Style::getCurrentPathStyle() . '/' . $_GET['s'] . '/' . $_GET['s'] . '.css'));
}
}
}
72 changes: 72 additions & 0 deletions classes/Style.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php

class Style {
public static function getCurrentPathStyle(){
if (AccessCheck::isValidAdminPage()){
return 'media/custom-admin';
} else {
return 'media/custom';
}

}
public static function getStyleURL($style, $admin=FALSE){
$url = "?i=" . $_GET['i'] . "&s=" . $style;
if ($admin){
$url .= "&g=" . $_GET['g'];
}
return $url;
}
public static function HTMLMenu(){
echo '<hr>';
Style::HTMLMenuItems('media/custom', FALSE);
if (AccessCheck::isValidAdminPage()){
echo '<hr>';
Style::HTMLMenuItems('media/custom-admin', TRUE);
}
}
public static function HTMLMenuItems($path, $admin=FALSE){
global $HIDE_STYLES;
$files = array_diff(scandir($path), array('..', '.'));
foreach ($files as $file){
if (in_array($file, $HIDE_STYLES)){
//
} else {
if (file_exists("$path/$file/$file.png")){
$style_in_line = "background-image: url($path/$file/$file.png);";
} else if (file_exists("$path/$file/$file.svg")){
$style_in_line = "background-image: url($path/$file/$file.svg);";
} else {
$style_in_line = '';
}
?>

<div class="item selector">
<a title="<?=$file?>" href="<?= Style::getStyleURL($file,$admin) ?>"><i style="<?= $style_in_line ?>" class="icon <?= $file ?>"></i></a>
</div>

<?php
}

}
}
public static function getCurrentStyle(){
return @$_GET['s'];
}
public static function HTMLHeadCurrentStyle(){
global $APP_VERSION;
$s = Style::getCurrentStyle();

if ($s){
?><link rel="stylesheet" href="<?= Style::getCurrentPathStyle() ?>/<?= $s ?>/<?= $s ?>.css?v=<?= @$APP_VERSION ?>"><?php
}
if (!AccessCheck::isValidAdminPage() || !$s){
?>

<link rel="stylesheet" href="media/default.css?v=<?= @$APP_VERSION ?>">
<link rel="stylesheet" href="media/button.css?v=<?= @$APP_VERSION ?>">

<?php
}

}
}
11 changes: 10 additions & 1 deletion config.php-default
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
<?php

// Defina o número máximo de arquivos databases:
$MAX_DATABASES = 1;

// Pasta onde serão armazenados os arquivos databases:
$DATABASE_PATH = __DIR__ . "/databases";

// Tamanho do nome do ID do arquivo database:
$ID_LENGTH = 12;

// Esconder estilos:
$HIDE_STYLES = array('blank');

// Número de pings para fazer a sincronização:
$SYNC_PING_COUNT = 4;
1 change: 1 addition & 0 deletions core/classes.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
require_once 'classes/Filter.php';
require_once 'classes/Database.php';
require_once 'classes/Timer.php';
require_once 'classes/Style.php';


11 changes: 8 additions & 3 deletions core/core.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

$APP_VERSION = "2.3";
$APP_VERSION = "2.4";
$APP_TITLE = "Painel";

define('PCORE', true);
Expand All @@ -15,12 +15,17 @@
if (!isset($MAX_DATABASES)){
$MAX_DATABASES = 6;
}
if (!isset($MAX_DATABASES)){
if (!isset($ID_LENGTH)){
$ID_LENGTH = 12;
}
if (!isset($MAX_DATABASES)){
if (!isset($SYNC_PING_COUNT)){
$SYNC_PING_COUNT = 4;
}
if (!isset($HIDE_STYLES)){
$HIDE_STYLES = array();
}


require_once 'classes.php';


Expand Down
12 changes: 2 additions & 10 deletions core/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,6 @@
require_once 'core/info.php';
}

$flag_access = AccessCheck::isValidAdminPage() ? 'admin' : 'user';

if (AccessCheck::isValidAdminPage()) {
$flag_access = 'admin';
$full_screen_url = '?i=' . $_GET['i'];
$target_full_screen = '';
} else {
$flag_access = 'user';
$full_screen_url = 'javascript:fullScreen();';
$target_full_screen = '';
if (!AccessCheck::isValidStyle()){
HTTPResponse::forbidden('Invalid style.');
}
38 changes: 26 additions & 12 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,49 @@
<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title><?= @$APP_TITLE ?></title>
<link rel="stylesheet" href="media/default.css?v=<?= @$APP_VERSION ?>">
<link rel="stylesheet" href="media/button.css?v=<?= @$APP_VERSION ?>">

<link rel="stylesheet" href="media/minimal.css?v=<?= @$APP_VERSION ?>">

<?php Style::HTMLHeadCurrentStyle(); ?>

<meta name="theme-color" content="var(--timer-default-color)">

<script>
var GLOBAL_ID = '<?= $_GET['i'] ?>';
var SYNC_PING_COUNT = <?= $SYNC_PING_COUNT * 1 ?>;
var GLOBAL_ID = '<?= $_GET['i'] ?>';
var CURRENT_URL = window.location.href;
var SYNC_PING_COUNT = <?= $SYNC_PING_COUNT * 1 ?>;
</script>
</script>

<script src="scripts/default.js?v=<?= @$APP_VERSION ?>"></script>
<script src="scripts/classes.js?v=<?= @$APP_VERSION ?>"></script>
<link rel="stylesheet" href="media/<?= $flag_access ?>.css?v=<?= @$APP_VERSION ?>">
<meta name="theme-color" content="var(--timer-default-color)">
<script src="scripts/qrcode.js?v=<?= @$APP_VERSION ?>"></script>
</head>
<body class="<?= $flag_access ?>">
<body class="<?= Style::getCurrentStyle() . ' ' . (AccessCheck::isValidAdminPage() ? 'admin': '') ?>">
<div id="main">
<div id="visible" style="display:none">

<div class="container-timer">
<div id="timer"></div>
</div>

<div class="container-toolbar">
<div class="item">
<a title="Acessar versão em tela inteira" target="<?= $target_full_screen ?>" href="<?= $full_screen_url ?>"><i class="icon full-screen"></i></a>

<div class="item full-screen">
<a title="Mostrar em tela inteira" href="javascript:fullScreen();"><i class="icon full-screen"></i></a>
</div>
<div class="item">
<a id="qcode" href="#" title="Mostrar QRCode" onclick="alternarQRCode()"><i class="icon qrcode"></i></a>

<div class="item qrcode">
<a title="Mostrar QRCode" href="javascript:alternarQRCode();"><i class="icon qrcode"></i></a>
</div>

<?php if (AccessCheck::isValidAdminPage()): ?>

<?php Style::HTMLMenu(); ?>

<?php endif; ?>

</div>
<?php if (AccessCheck::isSystemMessageActive()): ?>

Expand Down
15 changes: 0 additions & 15 deletions media/admin.css

This file was deleted.

Empty file.
55 changes: 55 additions & 0 deletions media/custom-admin/obs-panel/obs-panel.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
:root{
--timer-ready-color: blue;
}

body.obs-panel {
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
background-color: black;
color: white;
}

.obs-panel button {
background-color: var(--timer-ready-color);
color: white;
border-radius: 6px;
padding: 6px;
cursor: pointer;
}

.obs-panel button:hover {
background-color: rgb(100, 99, 99);
}

.obs-panel .container-timer {
font-size: 2em;
text-align: center;
min-height: 1.5em;
margin-top: 1em;
}
.obs-panel .command-buttons{
text-align: center;
margin: 1em 0;
}
.obs-panel button {
min-width: 60px;
}

.obs-panel .container-toolbar{
display: none;
}

.obs-panel .container-status{
position: fixed;
top: 0;
}

.obs-panel .big.start{
background-color: green;
}
.obs-panel .big.pause{
background-color: blue;
}
.obs-panel #debug{
position: fixed;
bottom: 0;
}
6 changes: 6 additions & 0 deletions media/custom-admin/obs-panel/obs-panel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 61 additions & 0 deletions media/custom/full-screen-mode/full-screen-mode.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
body.full-screen-mode{
width: 100%;
color: var(--timer-font-color);
background-color: var(--timer-default-color);
}

body.full-screen-mode .container-timer {
margin: 0 auto;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);

}

@media (max-width: 400px) {
body.full-screen-mode #qrcode {
display: none;
}
}

@media (orientation: landscape) {
body.full-screen-mode .container-timer {
font-size: 60vh;
}
}

@media (orientation: portrait) {
body.full-screen-mode .container-timer {
font-size: 68pt;
}
}
body.full-screen-mode #status-basic {
display: none
}

body.full-screen-mode.timer-ready {
background-color: var(--timer-ready-color);
}

body.full-screen-mode.timer-semaphore.ready,
body.full-screen-mode.timer-zero {
background-color: var(--timer-semaphore-ready);
}

body.full-screen-mode.timer-ending {
background-color: var(--timer-ending-color);
}

body.full-screen-mode.timer-sync.timer-sync-error{
background-color: var(--timer-sync-error-color);
}

body.full-screen-mode.timer-semaphore.set,
body.full-screen-mode.timer-ending.timer-alert {
background-color: var(--timer-semaphore-set);
}

body.full-screen-mode #qrcode {
bottom: 2px
}
17 changes: 17 additions & 0 deletions media/custom/full-screen-mode/full-screen-mode.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e3e4d09

Please sign in to comment.