logging cleanup
This commit is contained in:
126
back/pialert.py
126
back/pialert.py
@@ -234,6 +234,7 @@ mqtt_thread_up = False
|
|||||||
# timestamps of last execution times
|
# timestamps of last execution times
|
||||||
time_now = datetime.datetime.now()
|
time_now = datetime.datetime.now()
|
||||||
log_timestamp = time_now
|
log_timestamp = time_now
|
||||||
|
startTime = time_now
|
||||||
now_minus_24h = time_now - timedelta(hours = 24)
|
now_minus_24h = time_now - timedelta(hours = 24)
|
||||||
|
|
||||||
last_network_scan = now_minus_24h
|
last_network_scan = now_minus_24h
|
||||||
@@ -275,12 +276,11 @@ def main ():
|
|||||||
reporting = False
|
reporting = False
|
||||||
|
|
||||||
# Header
|
# Header
|
||||||
file_print('\nLoop start')
|
file_print('[', time_now.replace (microsecond=0), '] Loop start ')
|
||||||
file_print('---------------------------')
|
|
||||||
|
|
||||||
# Timestamp
|
# Timestamp
|
||||||
startTime = time_now
|
startTime = time_now
|
||||||
startTime = startTime.replace (second=0, microsecond=0)
|
startTime = startTime.replace (microsecond=0)
|
||||||
|
|
||||||
# re-load user configuration
|
# re-load user configuration
|
||||||
importConfig()
|
importConfig()
|
||||||
@@ -317,16 +317,14 @@ def main ():
|
|||||||
|
|
||||||
# Final menssage
|
# Final menssage
|
||||||
if cycle != "":
|
if cycle != "":
|
||||||
file_print('\nFinished cycle: ', cycle, '\n')
|
file_print('[', time_now.replace (microsecond=0), '] Last action: ', cycle)
|
||||||
cycle = ""
|
cycle = ""
|
||||||
|
|
||||||
# Footer
|
# Footer
|
||||||
file_print('\nLoop end')
|
file_print('[', time_now.replace (microsecond=0), '] Loop end')
|
||||||
file_print('---------------------------')
|
|
||||||
else:
|
else:
|
||||||
# do something
|
# do something
|
||||||
cycle = ""
|
cycle = ""
|
||||||
file_print('\n Wait 20s')
|
|
||||||
|
|
||||||
#loop - recursion
|
#loop - recursion
|
||||||
time.sleep(20) # wait for N seconds
|
time.sleep(20) # wait for N seconds
|
||||||
@@ -339,11 +337,10 @@ def check_internet_IP ():
|
|||||||
reporting = False
|
reporting = False
|
||||||
|
|
||||||
# Header
|
# Header
|
||||||
file_print('Check Internet IP')
|
file_print('[', startTime, '] Check Internet IP:')
|
||||||
file_print(' Timestamp:', startTime )
|
|
||||||
|
|
||||||
# Get Internet IP
|
# Get Internet IP
|
||||||
file_print('\n Retrieving Internet IP...')
|
file_print(' Retrieving Internet IP:')
|
||||||
internet_IP = get_internet_IP()
|
internet_IP = get_internet_IP()
|
||||||
# TESTING - Force IP
|
# TESTING - Force IP
|
||||||
# internet_IP = "1.2.3.4"
|
# internet_IP = "1.2.3.4"
|
||||||
@@ -351,12 +348,12 @@ def check_internet_IP ():
|
|||||||
# Check result = IP
|
# Check result = IP
|
||||||
if internet_IP == "" :
|
if internet_IP == "" :
|
||||||
file_print(' Error retrieving Internet IP')
|
file_print(' Error retrieving Internet IP')
|
||||||
file_print(' Exiting...\n')
|
file_print(' Exiting...')
|
||||||
return False
|
return False
|
||||||
file_print(' ', internet_IP)
|
file_print(' ', internet_IP)
|
||||||
|
|
||||||
# Get previous stored IP
|
# Get previous stored IP
|
||||||
file_print('\n Retrieving previous IP...')
|
file_print(' Retrieving previous IP:')
|
||||||
openDB()
|
openDB()
|
||||||
previous_IP = get_previous_internet_IP ()
|
previous_IP = get_previous_internet_IP ()
|
||||||
file_print(' ', previous_IP)
|
file_print(' ', previous_IP)
|
||||||
@@ -373,26 +370,26 @@ def check_internet_IP ():
|
|||||||
|
|
||||||
# Get Dynamic DNS IP
|
# Get Dynamic DNS IP
|
||||||
if DDNS_ACTIVE :
|
if DDNS_ACTIVE :
|
||||||
file_print('\n Retrieving Dynamic DNS IP...')
|
file_print(' Retrieving Dynamic DNS IP')
|
||||||
dns_IP = get_dynamic_DNS_IP()
|
dns_IP = get_dynamic_DNS_IP()
|
||||||
|
|
||||||
# Check Dynamic DNS IP
|
# Check Dynamic DNS IP
|
||||||
if dns_IP == "" :
|
if dns_IP == "" :
|
||||||
file_print(' Error retrieving Dynamic DNS IP')
|
file_print(' Error retrieving Dynamic DNS IP')
|
||||||
file_print(' Exiting...\n')
|
file_print(' Exiting...')
|
||||||
return False
|
return False
|
||||||
file_print(' ', dns_IP)
|
file_print(' ', dns_IP)
|
||||||
|
|
||||||
# Check DNS Change
|
# Check DNS Change
|
||||||
if dns_IP != internet_IP :
|
if dns_IP != internet_IP :
|
||||||
file_print(' Updating Dynamic DNS IP...')
|
file_print(' Updating Dynamic DNS IP')
|
||||||
message = set_dynamic_DNS_IP ()
|
message = set_dynamic_DNS_IP ()
|
||||||
file_print(' ', message)
|
file_print(' ', message)
|
||||||
reporting = True
|
reporting = True
|
||||||
else :
|
else :
|
||||||
file_print(' No changes to perform')
|
file_print(' No changes to perform')
|
||||||
else :
|
else :
|
||||||
file_print('\n Skipping Dynamic DNS update...')
|
file_print(' Skipping Dynamic DNS update')
|
||||||
|
|
||||||
return reporting
|
return reporting
|
||||||
|
|
||||||
@@ -470,7 +467,7 @@ def get_previous_internet_IP ():
|
|||||||
def save_new_internet_IP (pNewIP):
|
def save_new_internet_IP (pNewIP):
|
||||||
# Log new IP into logfile
|
# Log new IP into logfile
|
||||||
append_line_to_file (logPath + '/IP_changes.log',
|
append_line_to_file (logPath + '/IP_changes.log',
|
||||||
str(startTime) +'\t'+ pNewIP +'\n')
|
'['+str(startTime) +']\t'+ pNewIP +'\n')
|
||||||
|
|
||||||
# Save event
|
# Save event
|
||||||
sql.execute ("""INSERT INTO Events (eve_MAC, eve_IP, eve_DateTime,
|
sql.execute ("""INSERT INTO Events (eve_MAC, eve_IP, eve_DateTime,
|
||||||
@@ -508,22 +505,21 @@ def check_IP_format (pIP):
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
def cleanup_database ():
|
def cleanup_database ():
|
||||||
# Header
|
# Header
|
||||||
file_print('Cleanup Database')
|
file_print('[', startTime, '] Cleanup Database:' )
|
||||||
file_print(' Timestamp:', startTime )
|
|
||||||
|
|
||||||
openDB()
|
openDB()
|
||||||
|
|
||||||
# Cleanup Online History
|
# Cleanup Online History
|
||||||
file_print(' Cleanup Online_History...')
|
file_print(' Cleanup Online_History')
|
||||||
sql.execute ("DELETE FROM Online_History WHERE Scan_Date <= date('now', '-1 day')")
|
sql.execute ("DELETE FROM Online_History WHERE Scan_Date <= date('now', '-1 day')")
|
||||||
file_print(' Optimize Database...')
|
file_print(' Optimize Database')
|
||||||
|
|
||||||
# Cleanup Events
|
# Cleanup Events
|
||||||
file_print(' Cleanup Events, up to the lastest '+str(DAYS_TO_KEEP_EVENTS)+' days...')
|
file_print(' Cleanup Events, up to the lastest '+str(DAYS_TO_KEEP_EVENTS)+' days')
|
||||||
sql.execute ("DELETE FROM Events WHERE eve_DateTime <= date('now', '-"+str(DAYS_TO_KEEP_EVENTS)+" day')")
|
sql.execute ("DELETE FROM Events WHERE eve_DateTime <= date('now', '-"+str(DAYS_TO_KEEP_EVENTS)+" day')")
|
||||||
|
|
||||||
# Shrink DB
|
# Shrink DB
|
||||||
file_print(' Shrink Database...')
|
file_print(' Shrink Database')
|
||||||
sql.execute ("VACUUM;")
|
sql.execute ("VACUUM;")
|
||||||
|
|
||||||
closeDB()
|
closeDB()
|
||||||
@@ -533,11 +529,10 @@ def cleanup_database ():
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
def update_devices_MAC_vendors (pArg = ''):
|
def update_devices_MAC_vendors (pArg = ''):
|
||||||
# Header
|
# Header
|
||||||
file_print('Update HW Vendors')
|
file_print('[', startTime, '] Update HW Vendors:' )
|
||||||
file_print(' Timestamp:', startTime )
|
|
||||||
|
|
||||||
# Update vendors DB (iab oui)
|
# Update vendors DB (iab oui)
|
||||||
file_print('\nUpdating vendors DB (iab & oui)...')
|
file_print('\nUpdating vendors DB (iab & oui)')
|
||||||
# update_args = ['sh', PIALERT_BACK_PATH + '/update_vendors.sh', ' > ', logPath + '/update_vendors.log', '2>&1']
|
# update_args = ['sh', PIALERT_BACK_PATH + '/update_vendors.sh', ' > ', logPath + '/update_vendors.log', '2>&1']
|
||||||
update_args = ['sh', PIALERT_BACK_PATH + '/update_vendors.sh', pArg]
|
update_args = ['sh', PIALERT_BACK_PATH + '/update_vendors.sh', pArg]
|
||||||
|
|
||||||
@@ -654,12 +649,12 @@ def scan_network ():
|
|||||||
# # devtest end
|
# # devtest end
|
||||||
|
|
||||||
# Header
|
# Header
|
||||||
file_print('Scan Devices')
|
file_print('[', startTime, '] Scan Devices:' )
|
||||||
file_print(' ScanCycle:', cycle)
|
file_print(' ScanCycle:', cycle)
|
||||||
file_print(' Timestamp:', startTime )
|
|
||||||
|
|
||||||
# # Query ScanCycle properties
|
# # Query ScanCycle properties
|
||||||
print_log ('Query ScanCycle confinguration...')
|
print_log ('Query ScanCycle confinguration')
|
||||||
scanCycle_data = query_ScanCycle_Data (True)
|
scanCycle_data = query_ScanCycle_Data (True)
|
||||||
if scanCycle_data is None:
|
if scanCycle_data is None:
|
||||||
file_print('\n*************** ERROR ***************')
|
file_print('\n*************** ERROR ***************')
|
||||||
@@ -671,9 +666,7 @@ def scan_network ():
|
|||||||
cycle_interval = scanCycle_data['cic_EveryXmin']
|
cycle_interval = scanCycle_data['cic_EveryXmin']
|
||||||
|
|
||||||
# arp-scan command
|
# arp-scan command
|
||||||
file_print('\nScanning...')
|
file_print(' arp-scan start')
|
||||||
file_print(' arp-scan Method...')
|
|
||||||
print_log ('arp-scan starts...')
|
|
||||||
arpscan_devices = execute_arpscan ()
|
arpscan_devices = execute_arpscan ()
|
||||||
print_log ('arp-scan ends')
|
print_log ('arp-scan ends')
|
||||||
|
|
||||||
@@ -681,18 +674,16 @@ def scan_network ():
|
|||||||
# file_print('aspr-scan result:', len(arpscan_devices))
|
# file_print('aspr-scan result:', len(arpscan_devices))
|
||||||
|
|
||||||
# Pi-hole method
|
# Pi-hole method
|
||||||
file_print(' Pi-hole Method...')
|
file_print(' Pi-hole start')
|
||||||
openDB()
|
openDB()
|
||||||
print_log ('Pi-hole copy starts...')
|
|
||||||
reporting = copy_pihole_network() or reporting
|
reporting = copy_pihole_network() or reporting
|
||||||
|
|
||||||
# DHCP Leases method
|
# DHCP Leases method
|
||||||
file_print(' DHCP Leases Method...')
|
file_print(' DHCP Leases start')
|
||||||
reporting = read_DHCP_leases () or reporting
|
reporting = read_DHCP_leases () or reporting
|
||||||
|
|
||||||
# Load current scan data
|
# Load current scan data
|
||||||
file_print('\nProcessing scan results...')
|
file_print('Processing scan results')
|
||||||
print_log ('Save scanned devices')
|
|
||||||
save_scanned_devices (arpscan_devices, cycle_interval)
|
save_scanned_devices (arpscan_devices, cycle_interval)
|
||||||
|
|
||||||
# Print stats
|
# Print stats
|
||||||
@@ -701,37 +692,37 @@ def scan_network ():
|
|||||||
print_log ('Stats end')
|
print_log ('Stats end')
|
||||||
|
|
||||||
# Create Events
|
# Create Events
|
||||||
file_print('\nUpdating DB Info...')
|
file_print('Updating DB Info')
|
||||||
file_print(' Sessions Events (connect / discconnect) ...')
|
file_print(' Sessions Events (connect / discconnect)')
|
||||||
insert_events()
|
insert_events()
|
||||||
|
|
||||||
# Create New Devices
|
# Create New Devices
|
||||||
# after create events -> avoid 'connection' event
|
# after create events -> avoid 'connection' event
|
||||||
file_print(' Creating new devices...')
|
file_print(' Creating new devices')
|
||||||
create_new_devices ()
|
create_new_devices ()
|
||||||
|
|
||||||
# Update devices info
|
# Update devices info
|
||||||
file_print(' Updating Devices Info...')
|
file_print(' Updating Devices Info')
|
||||||
update_devices_data_from_scan ()
|
update_devices_data_from_scan ()
|
||||||
|
|
||||||
# Resolve devices names
|
# Resolve devices names
|
||||||
print_log (' Resolve devices names...')
|
print_log (' Resolve devices names')
|
||||||
update_devices_names()
|
update_devices_names()
|
||||||
|
|
||||||
# Void false connection - disconnections
|
# Void false connection - disconnections
|
||||||
file_print(' Voiding false (ghost) disconnections...')
|
file_print(' Voiding false (ghost) disconnections')
|
||||||
void_ghost_disconnections ()
|
void_ghost_disconnections ()
|
||||||
|
|
||||||
# Pair session events (Connection / Disconnection)
|
# Pair session events (Connection / Disconnection)
|
||||||
file_print(' Pairing session events (connection / disconnection) ...')
|
file_print(' Pairing session events (connection / disconnection) ')
|
||||||
pair_sessions_events()
|
pair_sessions_events()
|
||||||
|
|
||||||
# Sessions snapshot
|
# Sessions snapshot
|
||||||
file_print(' Creating sessions snapshot...')
|
file_print(' Creating sessions snapshot')
|
||||||
create_sessions_snapshot ()
|
create_sessions_snapshot ()
|
||||||
|
|
||||||
# Skip repeated notifications
|
# Skip repeated notifications
|
||||||
file_print(' Skipping repeated notifications...')
|
file_print(' Skipping repeated notifications')
|
||||||
skip_repeated_notifications ()
|
skip_repeated_notifications ()
|
||||||
|
|
||||||
# Commit changes
|
# Commit changes
|
||||||
@@ -949,13 +940,13 @@ def print_scan_stats ():
|
|||||||
sql.execute ("""SELECT COUNT(*) FROM CurrentScan
|
sql.execute ("""SELECT COUNT(*) FROM CurrentScan
|
||||||
WHERE cur_ScanMethod='arp-scan' AND cur_ScanCycle = ? """,
|
WHERE cur_ScanMethod='arp-scan' AND cur_ScanCycle = ? """,
|
||||||
(cycle,))
|
(cycle,))
|
||||||
file_print(' arp-scan Method....:', str (sql.fetchone()[0]) )
|
file_print(' arp-scan detected....: ', str (sql.fetchone()[0]) )
|
||||||
|
|
||||||
# Devices Pi-hole
|
# Devices Pi-hole
|
||||||
sql.execute ("""SELECT COUNT(*) FROM CurrentScan
|
sql.execute ("""SELECT COUNT(*) FROM CurrentScan
|
||||||
WHERE cur_ScanMethod='PiHole' AND cur_ScanCycle = ? """,
|
WHERE cur_ScanMethod='PiHole' AND cur_ScanCycle = ? """,
|
||||||
(cycle,))
|
(cycle,))
|
||||||
file_print(' Pi-hole Method.....: +' + str (sql.fetchone()[0]) )
|
file_print(' Pi-hole detected.....: +' + str (sql.fetchone()[0]) )
|
||||||
|
|
||||||
# New Devices
|
# New Devices
|
||||||
sql.execute ("""SELECT COUNT(*) FROM CurrentScan
|
sql.execute ("""SELECT COUNT(*) FROM CurrentScan
|
||||||
@@ -1299,7 +1290,7 @@ def update_devices_names ():
|
|||||||
notFound = 0
|
notFound = 0
|
||||||
|
|
||||||
# Devices without name
|
# Devices without name
|
||||||
file_print(' Trying to resolve devices without name...')
|
file_print(' Trying to resolve devices without name')
|
||||||
# BUGFIX #97 - Updating name of Devices w/o IP
|
# BUGFIX #97 - Updating name of Devices w/o IP
|
||||||
for device in sql.execute ("SELECT * FROM Devices WHERE dev_Name IN ('(unknown)','') AND dev_LastIP <> '-'") :
|
for device in sql.execute ("SELECT * FROM Devices WHERE dev_Name IN ('(unknown)','') AND dev_LastIP <> '-'") :
|
||||||
# Resolve device name
|
# Resolve device name
|
||||||
@@ -1313,7 +1304,6 @@ def update_devices_names ():
|
|||||||
recordsToUpdate.append ([newName, device['dev_MAC']])
|
recordsToUpdate.append ([newName, device['dev_MAC']])
|
||||||
|
|
||||||
# Print log
|
# Print log
|
||||||
file_print('')
|
|
||||||
file_print(" Names updated: ", len(recordsToUpdate) )
|
file_print(" Names updated: ", len(recordsToUpdate) )
|
||||||
# DEBUG - print list of record to update
|
# DEBUG - print list of record to update
|
||||||
# file_print(recordsToUpdate)
|
# file_print(recordsToUpdate)
|
||||||
@@ -1523,7 +1513,7 @@ def email_reporting ():
|
|||||||
global mail_text
|
global mail_text
|
||||||
global mail_html
|
global mail_html
|
||||||
# Reporting section
|
# Reporting section
|
||||||
file_print('\nCheck if something to report...')
|
file_print('\nCheck if something to report')
|
||||||
openDB()
|
openDB()
|
||||||
|
|
||||||
# prepare variables for JSON construction
|
# prepare variables for JSON construction
|
||||||
@@ -1708,43 +1698,43 @@ def email_reporting ():
|
|||||||
|
|
||||||
# Send Mail
|
# Send Mail
|
||||||
if json_internet != [] or json_new_devices != [] or json_down_devices != [] or json_events != []:
|
if json_internet != [] or json_new_devices != [] or json_down_devices != [] or json_events != []:
|
||||||
file_print('\nChanges detected, sending reports...')
|
file_print('\nChanges detected, sending reports')
|
||||||
|
|
||||||
if REPORT_MAIL and check_config('email'):
|
if REPORT_MAIL and check_config('email'):
|
||||||
file_print(' Sending report by email...')
|
file_print(' Sending report by email')
|
||||||
send_email (mail_text, mail_html)
|
send_email (mail_text, mail_html)
|
||||||
else :
|
else :
|
||||||
file_print(' Skip mail...')
|
file_print(' Skip mail')
|
||||||
if REPORT_APPRISE and check_config('apprise'):
|
if REPORT_APPRISE and check_config('apprise'):
|
||||||
file_print(' Sending report by Apprise...')
|
file_print(' Sending report by Apprise')
|
||||||
send_apprise (mail_html)
|
send_apprise (mail_html)
|
||||||
else :
|
else :
|
||||||
file_print(' Skip Apprise...')
|
file_print(' Skip Apprise')
|
||||||
if REPORT_WEBHOOK and check_config('webhook'):
|
if REPORT_WEBHOOK and check_config('webhook'):
|
||||||
file_print(' Sending report by webhook...')
|
file_print(' Sending report by webhook')
|
||||||
send_webhook (json_final, mail_text)
|
send_webhook (json_final, mail_text)
|
||||||
else :
|
else :
|
||||||
file_print(' Skip webhook...')
|
file_print(' Skip webhook')
|
||||||
if REPORT_NTFY and check_config('ntfy'):
|
if REPORT_NTFY and check_config('ntfy'):
|
||||||
file_print(' Sending report by NTFY...')
|
file_print(' Sending report by NTFY')
|
||||||
send_ntfy (mail_text)
|
send_ntfy (mail_text)
|
||||||
else :
|
else :
|
||||||
file_print(' Skip NTFY...')
|
file_print(' Skip NTFY')
|
||||||
if REPORT_PUSHSAFER and check_config('pushsafer'):
|
if REPORT_PUSHSAFER and check_config('pushsafer'):
|
||||||
file_print(' Sending report by PUSHSAFER...')
|
file_print(' Sending report by PUSHSAFER')
|
||||||
send_pushsafer (mail_text)
|
send_pushsafer (mail_text)
|
||||||
else :
|
else :
|
||||||
file_print(' Skip PUSHSAFER...')
|
file_print(' Skip PUSHSAFER')
|
||||||
# Update MQTT entities
|
# Update MQTT entities
|
||||||
if REPORT_MQTT and check_config('mqtt'):
|
if REPORT_MQTT and check_config('mqtt'):
|
||||||
file_print(' Establishing MQTT thread...')
|
file_print(' Establishing MQTT thread')
|
||||||
# mqtt_thread_up = True # prevent this code to be run multiple times concurrently
|
# mqtt_thread_up = True # prevent this code to be run multiple times concurrently
|
||||||
# start_mqtt_thread ()
|
# start_mqtt_thread ()
|
||||||
mqtt_start()
|
mqtt_start()
|
||||||
else :
|
else :
|
||||||
file_print(' Skip MQTT...')
|
file_print(' Skip MQTT')
|
||||||
else :
|
else :
|
||||||
file_print(' No changes to report...')
|
file_print(' No changes to report')
|
||||||
|
|
||||||
openDB()
|
openDB()
|
||||||
|
|
||||||
@@ -1757,7 +1747,7 @@ def email_reporting ():
|
|||||||
WHERE eve_PendingAlertEmail = 1""")
|
WHERE eve_PendingAlertEmail = 1""")
|
||||||
|
|
||||||
# DEBUG - print number of rows updated
|
# DEBUG - print number of rows updated
|
||||||
file_print(' Notifications:', sql.rowcount)
|
file_print(' Notifications: ', sql.rowcount)
|
||||||
|
|
||||||
# Commit changes
|
# Commit changes
|
||||||
sql_connection.commit()
|
sql_connection.commit()
|
||||||
@@ -2428,7 +2418,7 @@ def openDB ():
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Log
|
# Log
|
||||||
print_log ('Opening DB...')
|
print_log ('Opening DB')
|
||||||
|
|
||||||
|
|
||||||
# Open DB and Cursor
|
# Open DB and Cursor
|
||||||
@@ -2448,7 +2438,7 @@ def closeDB ():
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Log
|
# Log
|
||||||
print_log ('Closing DB...')
|
print_log ('Closing DB')
|
||||||
|
|
||||||
# Close DB
|
# Close DB
|
||||||
sql_connection.commit()
|
sql_connection.commit()
|
||||||
|
|||||||
@@ -24,6 +24,16 @@
|
|||||||
{
|
{
|
||||||
color:white;
|
color:white;
|
||||||
background-color: black;
|
background-color: black;
|
||||||
|
font-family: 'Courier New', monospace;
|
||||||
|
|
||||||
|
}
|
||||||
|
.logs-small
|
||||||
|
{
|
||||||
|
height: 100px;
|
||||||
|
}
|
||||||
|
.span-padding
|
||||||
|
{
|
||||||
|
padding:10px;
|
||||||
}
|
}
|
||||||
.text-center {
|
.text-center {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|||||||
@@ -67,6 +67,14 @@ function deleteAllCookies() {
|
|||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
function showModalOk (title, message) {
|
||||||
|
// set captions
|
||||||
|
$('#modal-ok-title').html (title);
|
||||||
|
$('#modal-ok-message').html (message);
|
||||||
|
|
||||||
|
// Show modal
|
||||||
|
$('#modal-ok').modal('show');
|
||||||
|
}
|
||||||
function showModalDefault (title, message, btnCancel, btnOK, callbackFunction) {
|
function showModalDefault (title, message, btnCancel, btnOK, callbackFunction) {
|
||||||
// set captions
|
// set captions
|
||||||
$('#modal-default-title').html (title);
|
$('#modal-default-title').html (title);
|
||||||
|
|||||||
@@ -172,16 +172,6 @@ if (submit && isset($_POST['langselector_set'])) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set Tab ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
if ($_REQUEST['tab'] == '1') {
|
|
||||||
$pia_tab_setting = 'active'; $pia_tab_tool = ''; $pia_tab_backup = '';
|
|
||||||
} elseif ($_REQUEST['tab'] == '2') {
|
|
||||||
$pia_tab_setting = ''; $pia_tab_tool = 'active'; $pia_tab_backup = '';
|
|
||||||
} elseif ($_REQUEST['tab'] == '3') {
|
|
||||||
$pia_tab_setting = ''; $pia_tab_tool = ''; $pia_tab_backup = 'active';
|
|
||||||
} else { $pia_tab_setting = 'active'; $pia_tab_tool = ''; $pia_tab_backup = '';}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -230,10 +220,18 @@ if ($_REQUEST['tab'] == '1') {
|
|||||||
|
|
||||||
<div class="nav-tabs-custom">
|
<div class="nav-tabs-custom">
|
||||||
<ul class="nav nav-tabs">
|
<ul class="nav nav-tabs">
|
||||||
<li class="active"><a href="#tab_Settings" data-toggle="tab"><?php echo $pia_lang['Maintenance_Tools_Tab_Settings'];?></a></li>
|
<li class="active">
|
||||||
<li><a href="#tab_DBTools" data-toggle="tab"><?php echo $pia_lang['Maintenance_Tools_Tab_Tools'];?></a></li>
|
<a id="tab_Settings_id" href="#tab_Settings" data-toggle="tab"><?php echo $pia_lang['Maintenance_Tools_Tab_Settings'];?></a>
|
||||||
<li><a href="#tab_BackupRestore" data-toggle="tab"><?php echo $pia_lang['Maintenance_Tools_Tab_BackupRestore'];?></a></li>
|
</li>
|
||||||
<li><a href="#tab_Logging" data-toggle="tab"><?php echo $pia_lang['Maintenance_Tools_Tab_Logging'];?></a></li>
|
<li>
|
||||||
|
<a id="tab_DBTools_id" href="#tab_DBTools" data-toggle="tab"><?php echo $pia_lang['Maintenance_Tools_Tab_Tools'];?></a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a id="tab_BackupRestore_id" href="#tab_BackupRestore" data-toggle="tab"><?php echo $pia_lang['Maintenance_Tools_Tab_BackupRestore'];?></a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a id="tab_Logging_id" href="#tab_Logging" data-toggle="tab"><?php echo $pia_lang['Maintenance_Tools_Tab_Logging'];?></a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<div class="tab-pane active" id="tab_Settings">
|
<div class="tab-pane active" id="tab_Settings">
|
||||||
@@ -378,46 +376,51 @@ if ($_REQUEST['tab'] == '1') {
|
|||||||
<div class="db_info_table">
|
<div class="db_info_table">
|
||||||
<div class="db_info_table_row">
|
<div class="db_info_table_row">
|
||||||
<div class="db_tools_table_cell_a" style="">
|
<div class="db_tools_table_cell_a" style="">
|
||||||
pialert.log
|
<div><label>pialert.log</label><span class="span-padding"><a href="./log/pialert.log"><i class="fa fa-download"></i> </a></span></div>
|
||||||
|
<div><button class="btn btn-primary" onclick="logManage('pialert.log','cleanLog')"><?php echo $pia_lang['Gen_Purge'];?></button></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="db_tools_table_cell_b">
|
<div class="db_tools_table_cell_b">
|
||||||
<textarea id="pialert_log" class="logs" cols="70" rows="10" ><?php echo file_get_contents( "./log/pialert.log" ); ?>
|
<textarea id="pialert_log" class="logs" cols="70" rows="10" readonly ><?php echo file_get_contents( "./log/pialert.log" ); ?>
|
||||||
</textarea>
|
</textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="db_info_table_row">
|
<div class="db_info_table_row">
|
||||||
<div class="db_tools_table_cell_a" style="">
|
<div class="db_tools_table_cell_a" style="">
|
||||||
pialert_front.log
|
<div><label>pialert_front.log</label><span class="span-padding"><a href="./log/pialert_front.log"><i class="fa fa-download"></i> </a></span></div>
|
||||||
|
<div><button class="btn btn-primary" onclick="logManage('pialert_front.log','cleanLog')"><?php echo $pia_lang['Gen_Purge'];?></button></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="db_tools_table_cell_b">
|
<div class="db_tools_table_cell_b">
|
||||||
<textarea id="pialert_log" class="logs" cols="70" rows="10" ><?php echo file_get_contents( "./log/pialert_front.log" ); ?>
|
<textarea id="pialert_log" class="logs" cols="70" rows="10" readonly><?php echo file_get_contents( "./log/pialert_front.log" ); ?>
|
||||||
</textarea>
|
</textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="db_info_table_row">
|
<div class="db_info_table_row">
|
||||||
<div class="db_tools_table_cell_a" style="">
|
<div class="db_tools_table_cell_a" style="">
|
||||||
IP_changes.log
|
<div><label>IP_changes.log</label><span class="span-padding"><a href="./log/IP_changes.log"><i class="fa fa-download"></i> </a></span></div>
|
||||||
|
<div><button class="btn btn-primary" onclick="logManage('IP_changes.log','cleanLog')"><?php echo $pia_lang['Gen_Purge'];?></button></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="db_tools_table_cell_b">
|
<div class="db_tools_table_cell_b">
|
||||||
<textarea id="IP_changes_log" class="logs" cols="70" rows="10" ><?php echo file_get_contents( "./log/IP_changes.log" ); ?>
|
<textarea id="IP_changes_log" class="logs logs-small" cols="70" rows="10" readonly><?php echo file_get_contents( "./log/IP_changes.log" ); ?>
|
||||||
</textarea>
|
</textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="db_info_table_row">
|
<div class="db_info_table_row">
|
||||||
<div class="db_tools_table_cell_a" style="">
|
<div class="db_tools_table_cell_a" style="">
|
||||||
stdout.log
|
<div><label>stdout.log</label><span class="span-padding"><a href="./log/stdout.log"><i class="fa fa-download"></i> </a></span></div>
|
||||||
|
<div><button class="btn btn-primary" onclick="logManage('stdout.log','cleanLog')"><?php echo $pia_lang['Gen_Purge'];?></button></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="db_tools_table_cell_b">
|
<div class="db_tools_table_cell_b">
|
||||||
<textarea id="stdout_log" class="logs" cols="70" rows="10" ><?php echo file_get_contents( "./log/stdout.log" ); ?>
|
<textarea id="stdout_log" class="logs logs-small" cols="70" rows="10" wrap='off' readonly><?php echo file_get_contents( "./log/stdout.log" ); ?>
|
||||||
</textarea>
|
</textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="db_info_table_row">
|
<div class="db_info_table_row">
|
||||||
<div class="db_tools_table_cell_a" style="">
|
<div class="db_tools_table_cell_a" style="">
|
||||||
stderr.log
|
<div><label>stderr.log</label><span class="span-padding"><a href="./log/stderr.log"><i class="fa fa-download"></i> </a></span></div>
|
||||||
|
<div><button class="btn btn-primary" onclick="logManage('stderr.log','cleanLog')"><?php echo $pia_lang['Gen_Purge'];?></button></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="db_tools_table_cell_b">
|
<div class="db_tools_table_cell_b">
|
||||||
<textarea id="stderr_log" class="logs" cols="70" rows="10" ><?php echo file_get_contents( "./log/stderr.log" ); ?>
|
<textarea id="stderr_log" class="logs logs-small" cols="70" rows="10" wrap='off' readonly><?php echo file_get_contents( "./log/stderr.log" ); ?>
|
||||||
</textarea>
|
</textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -463,20 +466,10 @@ if ($_REQUEST['tab'] == '1') {
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
function scrollDown()
|
var emptyArr = ['undefined', "", undefined, null];
|
||||||
{
|
var selectedTab = 'tab_Settings_id';
|
||||||
temp = $('#pialert_log');
|
|
||||||
$temp.scrollTop($text[0].scrollHeight);
|
|
||||||
|
|
||||||
temp = $('#IP_changes_log');
|
initializeTabs();
|
||||||
$temp.scrollTop($text[0].scrollHeight);
|
|
||||||
|
|
||||||
temp = $('#stdout_log');
|
|
||||||
$temp.scrollTop($text[0].scrollHeight);
|
|
||||||
|
|
||||||
temp = $('#stderr_log');
|
|
||||||
$temp.scrollTop($text[0].scrollHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
// delete devices with emty macs
|
// delete devices with emty macs
|
||||||
function askDeleteDevicesWithEmptyMACs () {
|
function askDeleteDevicesWithEmptyMACs () {
|
||||||
@@ -658,12 +651,97 @@ function PiaToggleArpScan()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Clean log file
|
||||||
|
var targetLogFile = "";
|
||||||
|
var logFileAction = "";
|
||||||
|
|
||||||
|
function logManage(callback) {
|
||||||
|
targetLogFile = arguments[0]; // target
|
||||||
|
logFileAction = arguments[1]; // action
|
||||||
|
// Ask
|
||||||
|
showModalWarning('<?php echo $pia_lang['Gen_Purge'];?>' + ' ' + arguments[1], '<?php echo $pia_lang['Gen_AreYouSure'];?>',
|
||||||
|
'<?php echo $pia_lang['Gen_Cancel'];?>', '<?php echo $pia_lang['Gen_Okay'];?>', "performLogManage");
|
||||||
|
}
|
||||||
|
|
||||||
|
function performLogManage() {
|
||||||
|
// Execute
|
||||||
|
console.log("targetLogFile:" + targetLogFile)
|
||||||
|
console.log("logFileAction:" + logFileAction)
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
method: "POST",
|
||||||
|
url: "php/server/util.php",
|
||||||
|
data: { function: logFileAction, settings: targetLogFile },
|
||||||
|
success: function(data, textStatus) {
|
||||||
|
showModalOk ('Result', data );
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function scrollDown()
|
||||||
|
{
|
||||||
|
var tempArea = $('#pialert_log');
|
||||||
|
$(tempArea[0]).scrollTop(tempArea[0].scrollHeight);
|
||||||
|
|
||||||
|
tempArea = $('#IP_changes_log');
|
||||||
|
$(tempArea[0]).scrollTop(tempArea[0].scrollHeight);
|
||||||
|
|
||||||
|
tempArea = $('#stdout_log');
|
||||||
|
$(tempArea[0]).scrollTop(tempArea[0].scrollHeight);
|
||||||
|
|
||||||
|
tempArea = $('#stderr_log');
|
||||||
|
$(tempArea[0]).scrollTop(tempArea[0].scrollHeight);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function initializeTabs () {
|
||||||
|
// Activate panel
|
||||||
|
if(!emptyArr.includes(getCache("activeMaintenanceTab")))
|
||||||
|
{
|
||||||
|
selectedTab = getCache("activeMaintenanceTab");
|
||||||
|
}
|
||||||
|
$('.nav-tabs a[id='+ selectedTab +']').tab('show');
|
||||||
|
|
||||||
|
// When changed save new current tab
|
||||||
|
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
||||||
|
setCache("activeMaintenanceTab", $(e.target).attr('id'))
|
||||||
|
});
|
||||||
|
|
||||||
|
// events on tab change
|
||||||
|
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
||||||
|
var target = $(e.target).attr("href") // activated tab
|
||||||
|
//alert(target);
|
||||||
|
if(target == "#tab_Logging")
|
||||||
|
{
|
||||||
|
scrollDown();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getCache(key)
|
||||||
|
{
|
||||||
|
// check cache
|
||||||
|
if(sessionStorage.getItem(key))
|
||||||
|
{
|
||||||
|
return sessionStorage.getItem(key);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setCache(key, data)
|
||||||
|
{
|
||||||
|
sessionStorage.setItem(key, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// load footer asynchronously not to block the page load/other sections
|
// load footer asynchronously not to block the page load/other sections
|
||||||
window.onload = function asyncFooter()
|
window.onload = function asyncFooter()
|
||||||
{
|
{
|
||||||
|
|
||||||
// scrollDown();
|
|
||||||
|
|
||||||
$("#lastCommit").append('<img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/jokob-sk/pi.alert/main?logo=github">');
|
$("#lastCommit").append('<img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/jokob-sk/pi.alert/main?logo=github">');
|
||||||
|
|
||||||
$("#lastDockerUpdate").append(
|
$("#lastDockerUpdate").append(
|
||||||
@@ -671,8 +749,6 @@ window.onload = function asyncFooter()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -70,8 +70,9 @@ require '/home/pi/pialert/front/php/templates/language/'.$pia_lang_selected.'.ph
|
|||||||
$FUNCTION = [];
|
$FUNCTION = [];
|
||||||
$SETTINGS = [];
|
$SETTINGS = [];
|
||||||
|
|
||||||
|
// init request params
|
||||||
if(array_key_exists('function', $_REQUEST) != FALSE)
|
if(array_key_exists('function', $_REQUEST) != FALSE)
|
||||||
{echo 'here'.$timestamp ;
|
{
|
||||||
$FUNCTION = $_REQUEST['function'];
|
$FUNCTION = $_REQUEST['function'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,9 +81,15 @@ if(array_key_exists('settings', $_REQUEST) != FALSE)
|
|||||||
$SETTINGS = $_REQUEST['settings'];
|
$SETTINGS = $_REQUEST['settings'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($FUNCTION == 'savesettings') {
|
// call functions based on requested params
|
||||||
|
if ($FUNCTION == 'savesettings')
|
||||||
|
{
|
||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
|
elseif ($FUNCTION == 'cleanLog')
|
||||||
|
{
|
||||||
|
cleanLog($SETTINGS);
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Formatting data functions
|
// Formatting data functions
|
||||||
@@ -157,6 +164,7 @@ function checkPermissions($files)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
function displayMessage($message, $logAlert = FALSE, $logConsole = TRUE, $logFile = TRUE, $logEcho = FALSE)
|
function displayMessage($message, $logAlert = FALSE, $logConsole = TRUE, $logFile = TRUE, $logEcho = FALSE)
|
||||||
{
|
{
|
||||||
@@ -205,19 +213,39 @@ function displayMessage($message, $logAlert = FALSE, $logConsole = TRUE, $logFil
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------------
|
||||||
|
function cleanLog($logFile)
|
||||||
|
{
|
||||||
|
global $logFolderPath, $timestamp;
|
||||||
|
|
||||||
|
$path = "";
|
||||||
|
|
||||||
|
$allowedFiles = ['pialert.log', 'pialert_front.log', 'IP_changes.log', 'stdout.log', 'stderr.log'];
|
||||||
|
|
||||||
|
if(in_array($logFile, $allowedFiles))
|
||||||
|
{
|
||||||
|
$path = $logFolderPath.$logFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($path != "")
|
||||||
|
{
|
||||||
|
// purge content
|
||||||
|
$file = fopen($path, "w") or die("Unable to open file!");
|
||||||
|
fwrite($file, "[".$timestamp. "] Log file manually purged" .PHP_EOL."");
|
||||||
|
fclose($file);
|
||||||
|
displayMessage('File <code>'.$logFile.'</code> purged.', FALSE, TRUE, TRUE, TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------------
|
||||||
function saveSettings()
|
function saveSettings()
|
||||||
{
|
{
|
||||||
global $SETTINGS, $FUNCTION, $config_file, $fullConfPath, $configFolderPath, $timestamp;
|
global $SETTINGS, $FUNCTION, $config_file, $fullConfPath, $configFolderPath, $timestamp;
|
||||||
|
|
||||||
echo 'here'.$timestamp ;
|
|
||||||
|
|
||||||
// save in the file
|
// save in the file
|
||||||
$new_name = $config_file.'_'.$timestamp.'.backup';
|
$new_name = $config_file.'_'.$timestamp.'.backup';
|
||||||
$new_location = $configFolderPath.$new_name;
|
$new_location = $configFolderPath.$new_name;
|
||||||
|
|
||||||
// chmod($fullConfPath, 0755);
|
|
||||||
|
|
||||||
if(file_exists( $fullConfPath) != 1)
|
if(file_exists( $fullConfPath) != 1)
|
||||||
{
|
{
|
||||||
displayMessage('File "'.$fullConfPath.'" not found or missing read permissions. Creating a new <code>'.$config_file.'</code> file.', FALSE, TRUE, TRUE, TRUE);
|
displayMessage('File "'.$fullConfPath.'" not found or missing read permissions. Creating a new <code>'.$config_file.'</code> file.', FALSE, TRUE, TRUE, TRUE);
|
||||||
@@ -299,7 +327,7 @@ function saveSettings()
|
|||||||
fclose($newConfig);
|
fclose($newConfig);
|
||||||
|
|
||||||
displayMessage("<br/>Settings saved to the <code>".$config_file."</code> file.
|
displayMessage("<br/>Settings saved to the <code>".$config_file."</code> file.
|
||||||
Backup of ".$config_file." created: <code>".$new_name."</code>.<br/>
|
<br/><br/>Backup of the previous ".$config_file." created here: <br/><br/><code>".$new_name."</code><br/><br/>
|
||||||
<b>Restart the container for the changes to take effect.</b>",
|
<b>Restart the container for the changes to take effect.</b>",
|
||||||
FALSE, TRUE, TRUE, TRUE);
|
FALSE, TRUE, TRUE, TRUE);
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ $pia_lang['Gen_Purge'] = 'Aufräumen';
|
|||||||
$pia_lang['Gen_Backup'] = 'Sichern';
|
$pia_lang['Gen_Backup'] = 'Sichern';
|
||||||
$pia_lang['Gen_Restore'] = 'Wiederherstellen';
|
$pia_lang['Gen_Restore'] = 'Wiederherstellen';
|
||||||
$pia_lang['Gen_Switch'] = 'Umschalten';
|
$pia_lang['Gen_Switch'] = 'Umschalten';
|
||||||
|
$pia_lang['Gen_AreYouSure'] = 'Sind Sie sich sicher?';
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
// Login Page - Update by @TeroRERO 03ago2022
|
// Login Page - Update by @TeroRERO 03ago2022
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ $pia_lang['Gen_Purge'] = 'Purge';
|
|||||||
$pia_lang['Gen_Backup'] = 'Run Backup';
|
$pia_lang['Gen_Backup'] = 'Run Backup';
|
||||||
$pia_lang['Gen_Restore'] = 'Run Restore';
|
$pia_lang['Gen_Restore'] = 'Run Restore';
|
||||||
$pia_lang['Gen_Switch'] = 'Switch';
|
$pia_lang['Gen_Switch'] = 'Switch';
|
||||||
|
$pia_lang['Gen_AreYouSure'] = 'Are you sure?';
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
// Login Page - Update by @TeroRERO 03ago2022
|
// Login Page - Update by @TeroRERO 03ago2022
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ $pia_lang['Gen_Purge'] = 'Purgar';
|
|||||||
$pia_lang['Gen_Backup'] = 'Ejecutar copia de seguridad';
|
$pia_lang['Gen_Backup'] = 'Ejecutar copia de seguridad';
|
||||||
$pia_lang['Gen_Restore'] = 'Ejecutar restauración';
|
$pia_lang['Gen_Restore'] = 'Ejecutar restauración';
|
||||||
$pia_lang['Gen_Switch'] = 'Cambiar';
|
$pia_lang['Gen_Switch'] = 'Cambiar';
|
||||||
|
$pia_lang['Gen_AreYouSure'] = '¿Estás seguro de';
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
// Login Page - Update by @TeroRERO 03ago2022
|
// Login Page - Update by @TeroRERO 03ago2022
|
||||||
|
|||||||
@@ -7,6 +7,26 @@
|
|||||||
# Puche 2021 pi.alert.application@gmail.com GNU GPLv3
|
# Puche 2021 pi.alert.application@gmail.com GNU GPLv3
|
||||||
#--------------------------------------------------------------------------- -->
|
#--------------------------------------------------------------------------- -->
|
||||||
|
|
||||||
|
<!-- Modal Ok -->
|
||||||
|
<div class="modal fade" id="modal-ok" style="display: none;">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
|
||||||
|
<div class="modal-header" >
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||||
|
<h4 id="modal-ok-title" class="modal-title"> Modal Default Title </h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="modal-ok-message" class="modal-body"> Modal Default message </div>
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button id="modal-ok-OK" type="button" class="btn btn-primary" style="min-width: 80px;" data-dismiss="modal"> OK </button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /.modal-content -->
|
||||||
|
</div>
|
||||||
|
<!-- /.modal-dialog -->
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Modal Default -->
|
<!-- Modal Default -->
|
||||||
<div class="modal fade" id="modal-default" style="display: none;">
|
<div class="modal fade" id="modal-default" style="display: none;">
|
||||||
|
|||||||
@@ -108,8 +108,6 @@ $db->close();
|
|||||||
|
|
||||||
$html = $html.getString ($set['Code_Name'].'_description', $set['Description'], $pia_lang);
|
$html = $html.getString ($set['Code_Name'].'_description', $set['Description'], $pia_lang);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$html = $html.
|
$html = $html.
|
||||||
'</div>
|
'</div>
|
||||||
<div class="table_cell setting_input" >';
|
<div class="table_cell setting_input" >';
|
||||||
@@ -254,7 +252,7 @@ $db->close();
|
|||||||
|
|
||||||
if(ipMask == "" || ipInterface == "")
|
if(ipMask == "" || ipInterface == "")
|
||||||
{
|
{
|
||||||
showModalDefault ('Validation error', 'Specify both, the network mask and the interface');
|
modalDefaultOK ('Validation error', 'Specify both, the network mask and the interface');
|
||||||
} else {
|
} else {
|
||||||
$('#SCAN_SUBNETS').append($('<option disabled></option>').attr('value', full).text(full));
|
$('#SCAN_SUBNETS').append($('<option disabled></option>').attr('value', full).text(full));
|
||||||
|
|
||||||
@@ -315,7 +313,7 @@ $db->close();
|
|||||||
success: function(data, textStatus) {
|
success: function(data, textStatus) {
|
||||||
// $("#result").html(data);
|
// $("#result").html(data);
|
||||||
// console.log(data);
|
// console.log(data);
|
||||||
showModalDefault ('Result', data );
|
showModalOk ('Result', data );
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user