Events, CurrentScan, pluginsState, ENABLE_PLUGINS work

This commit is contained in:
Jokob-sk
2023-08-12 11:56:35 +10:00
parent 82d7c28fd7
commit 5397edc14d
9 changed files with 78 additions and 59 deletions

View File

@@ -13,7 +13,7 @@
-->
<?php
require 'php/templates/header.php';
require 'php/templates/header.php';
?>
<!-- Page ------------------------------------------------------------------ -->
@@ -22,7 +22,7 @@
<!-- Content header--------------------------------------------------------- -->
<section class="content-header">
<h1 id="pageTitle">
<i class=\"fa fa-bolt\"></i>
<i class="fa fa-bolt"></i>
<?= lang('Events_Title');?>
</h1>

View File

@@ -366,7 +366,7 @@ function encode_single_quotes ($val) {
function getDateFromPeriod () {
$period = $_REQUEST['period'];
return '"'. date ('Y-m-d', strtotime ('+1 day -'. $period) ) .'"';
return '"'. date ('Y-m-d', strtotime ('+2 day -'. $period) ) .'"';
}
// -------------------------------------------------------------------------------------------

View File

@@ -1,4 +1,30 @@
from time import strftime
import pytz
from datetime import datetime
#-------------------------------------------------------------------------------
def read_config_file():
"""
retuns dict on the config file key:value pairs
config_dir[key]
"""
filename = '/home/pi/pialert/config/pialert.conf'
print('[plugin_helper] reading config file')
# load the variables from pialert.conf
code = compile(filename.read_text(), filename.name, "exec")
confDict = {} # config dictionary
exec(code, {"__builtins__": {}}, confDict)
return confDict
# -------------------------------------------------------------------
pialertConfigFile = read_config_file()
timeZoneSetting = pialertConfigFile['TIMEZONE']
timeZone = pytz.timezone(timeZoneSetting)
# -------------------------------------------------------------------
@@ -23,7 +49,7 @@ class Plugin_Object:
self.pluginPref = ""
self.primaryId = primaryId
self.secondaryId = secondaryId
self.created = strftime("%Y-%m-%d %H:%M:%S")
self.created = datetime.now(timeZone).strftime("%Y-%m-%d %H:%M:%S")
self.changed = ""
self.watched1 = watched1
self.watched2 = watched2
@@ -51,6 +77,7 @@ class Plugin_Object:
self.foreignKey,
)
return line
class Plugin_Objects:
@@ -94,3 +121,7 @@ class Plugin_Objects:
for obj in self.objects:
fp.write(obj.write())
fp.close()