Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in / Register
Toggle navigation
Poduptime
Project
Project
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
11
Issues
11
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
diasporg
Poduptime
Commits
667696f2
Verified
Commit
667696f2
authored
Aug 05, 2018
by
noplanman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better config and application boot script.
parent
94899783
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
110 additions
and
218 deletions
+110
-218
api.php
api.php
+1
-9
boot.php
boot.php
+30
-0
config.php.example
config.php.example
+29
-24
db/add.php
db/add.php
+3
-13
db/api-more.php
db/api-more.php
+1
-9
db/backup.php
db/backup.php
+8
-8
db/edit.php
db/edit.php
+2
-8
db/gettoken.php
db/gettoken.php
+4
-11
db/monthly_stats.php
db/monthly_stats.php
+2
-10
db/podcrawler.php
db/podcrawler.php
+1
-9
db/pull-masterversions.php
db/pull-masterversions.php
+9
-18
db/pull.php
db/pull.php
+6
-13
db/pull.sh
db/pull.sh
+2
-2
db/saverating.php
db/saverating.php
+1
-9
db/status.php
db/status.php
+1
-1
go.php
go.php
+1
-9
index.php
index.php
+1
-2
podstat-counts.php
podstat-counts.php
+1
-9
podstat-uptime.php
podstat-uptime.php
+1
-9
rate.php
rate.php
+1
-8
showmap.php
showmap.php
+2
-10
statsviewjs.php
statsviewjs.php
+1
-9
tabledata.php
tabledata.php
+1
-9
wizard.php
wizard.php
+1
-9
No files found.
api.php
View file @
667696f2
...
...
@@ -15,15 +15,7 @@ $_format = $_GET['format'] ?? '';
$_method
=
$_GET
[
'method'
]
??
''
;
$_callback
=
$_GET
[
'callback'
]
??
''
;
require_once
__DIR__
.
'/vendor/autoload.php'
;
require_once
__DIR__
.
'/config.php'
;
define
(
'PODUPTIME'
,
microtime
(
true
));
// Set up global DB connection.
R
::
setup
(
"pgsql:host=
{
$pghost
}
;dbname=
{
$pgdb
}
"
,
$pguser
,
$pgpass
,
true
);
R
::
testConnection
()
||
die
(
'Error in DB connection'
);
R
::
usePartialBeans
(
true
);
require_once
__DIR__
.
'/boot.php'
;
if
(
$_format
===
'georss'
)
{
echo
<<<EOF
...
...
boot.php
0 → 100644
View file @
667696f2
<?php
use
RedBeanPHP\R
;
require_once
__DIR__
.
'/vendor/autoload.php'
;
function
c
(
$param
=
null
,
$default
=
null
)
{
static
$config
;
if
(
$config
===
null
)
{
$config
=
require
__DIR__
.
'/config.php'
;
}
if
(
$param
===
null
)
{
return
$config
;
}
if
(
array_key_exists
(
$param
,
$config
))
{
return
$config
[
$param
];
}
return
$default
;
}
define
(
'PODUPTIME'
,
microtime
(
true
));
// Set up global DB connection.
R
::
setup
(
'pgsql:host='
.
c
(
'pghost'
)
.
';dbname='
.
c
(
'pgdb'
),
c
(
'pguser'
),
c
(
'pgpass'
),
true
);
R
::
testConnection
()
||
die
(
'Error in DB connection'
);
R
::
usePartialBeans
(
true
);
config.php.example
View file @
667696f2
...
...
@@ -4,38 +4,43 @@
* Config for Poduptime.
*/
//backup directory - full dir path
$backup_dir
=
__DIR__
.
'/backup'
;
return
[
//backup directory - full dir path
'backup_dir'
=>
__DIR__
.
'/backup'
,
//log directory - full dir path
$log_dir
=
__DIR__
.
'/log'
;
//log directory - full dir path
'log_dir'
=>
__DIR__
.
'/log'
,
//location of pg dump - full dir path
$pg_dump_dir
=
'/usr/bin'
;
//location of pg dump - full dir path
'pg_dump_dir'
=>
'/usr/bin'
,
//db host
$pghost
=
'localhost'
;
//db host
'pghost'
=>
'localhost'
,
//db username
$pguser
=
''
;
//db port
'pgport'
=>
5432
,
//db password
$pgpass
=
''
;
//db username
'pguser'
=>
''
,
//db name
$pgdb
=
''
;
//db password
'pgpass'
=>
''
,
//admin email for forms
$adminemail
=
''
;
//db name
'pgdb'
=>
''
,
//DNS server for dnssec testing. 1.1.1.1 tests the best
$dnsserver
=
''
;
//admin email for forms
'adminemail'
=>
''
,
//CA for curl to use - full file path (pull.sh will update this monthly)
$cafullpath
=
''
;
//DNS server for dnssec testing. 1.1.1.1 tests the best
'dnsserver'
=>
''
,
//Mapbox.com API key. https://www.mapbox.com/help/how-access-tokens-work/
$mapboxkey
=
''
;
//CA for curl to use - full file path (pull.sh will update this monthly)
'cafullpath'
=>
''
,
//Geolite2-city database file in mmdb format - full file path (pull.sh will update this monthly)
$geoip2db
=
''
;
//Mapbox.com API key. https://www.mapbox.com/help/how-access-tokens-work/
'mapboxkey'
=>
''
,
//Geolite2-city database file in mmdb format - full file path (pull.sh will update this monthly)
'geoip2db'
=>
''
,
];
db/add.php
View file @
667696f2
...
...
@@ -8,17 +8,7 @@ declare(strict_types=1);
use
RedBeanPHP\R
;
require_once
__DIR__
.
'/../vendor/autoload.php'
;
require_once
__DIR__
.
'/../config.php'
;
define
(
'PODUPTIME'
,
microtime
(
true
));
// Set up global DB connection.
R
::
setup
(
"pgsql:host=
{
$pghost
}
;dbname=
{
$pgdb
}
"
,
$pguser
,
$pgpass
,
true
);
R
::
testConnection
()
||
die
(
'Error in DB connection'
);
R
::
usePartialBeans
(
true
);
require_once
__DIR__
.
'/../boot.php'
;
if
(
!
(
$_domain
=
$_GET
[
'domain'
]
??
null
))
{
die
(
'no pod domain given'
);
...
...
@@ -126,7 +116,7 @@ if (!$stop) {
}
if
(
$_email
)
{
$to
=
$adminemail
;
$to
=
c
(
'adminemail'
)
;
$subject
=
'New pod added to '
.
$_SERVER
[
'HTTP_HOST'
];
$headers
=
[
'From: '
.
$_email
,
'Reply-To: '
.
$_email
,
'Cc: '
.
$_email
];
...
...
@@ -144,4 +134,4 @@ if (!$stop) {
}
else
{
echo
'Could not validate your pod, check your setup!<br>Take a look at <a href="'
.
$link
.
'">your /nodeinfo</a>'
;
}
}
\ No newline at end of file
}
db/api-more.php
View file @
667696f2
...
...
@@ -15,15 +15,7 @@ use RedBeanPHP\R;
// Other parameters.
$_format
=
$_GET
[
'format'
]
??
''
;
require_once
__DIR__
.
'/../vendor/autoload.php'
;
require_once
__DIR__
.
'/../config.php'
;
define
(
'PODUPTIME'
,
microtime
(
true
));
// Set up global DB connection.
R
::
setup
(
"pgsql:host=
{
$pghost
}
;dbname=
{
$pgdb
}
"
,
$pguser
,
$pgpass
,
true
);
R
::
testConnection
()
||
die
(
'Error in DB connection'
);
R
::
usePartialBeans
(
true
);
require_once
__DIR__
.
'/../boot.php'
;
try
{
$pod
=
R
::
getRow
(
'
...
...
db/backup.php
View file @
667696f2
...
...
@@ -11,19 +11,19 @@ if (PHP_SAPI !== 'cli') {
exit
;
}
require_onc
e
__DIR__
.
'/../config.php'
;
$c
=
requir
e
__DIR__
.
'/../config.php'
;
$keep
=
(
60
*
60
*
6
)
*
1
;
$dump_date
=
date
(
'Ymd_Hs'
);
$file_name
=
$backup_dir
.
'/dump_'
.
$dump_date
.
'.sql'
;
system
(
"export PGPASSWORD=
$pgpass
&&
$pg_dump_dir
/pg_dump --clean --format=tar --username=
$pguser
$pgdb
>>
$file_name
"
);
echo
"pg backup of
$pgdb
made"
;
$dirh
=
dir
(
$
backup_dir
);
$file_name
=
"
{
$c
[
'backup_dir'
]
}
/dump_
{
$dump_date
}
.sql"
;
system
(
"export PGPASSWORD=
{
$c
[
'pgpass'
]
}
&&
{
$c
[
'pg_dump_dir'
]
}
/pg_dump --clean --format=tar --username=
{
$c
[
'pguser'
]
}
{
$c
[
'pgdb'
]
}
>>
{
$file_name
}
"
);
echo
"pg backup of
{
$c
[
'pgdb'
]
}
made"
;
$dirh
=
dir
(
$
c
[
'backup_dir'
]
);
while
(
$entry
=
$dirh
->
read
())
{
$old_file_time
=
(
date
(
'U'
)
-
$keep
)
;
$file_created
=
filectime
(
"
$backup_dir
/
$entry
"
);
$old_file_time
=
date
(
'U'
)
-
$keep
;
$file_created
=
filectime
(
"
{
$c
[
'backup_dir'
]
}
/
{
$entry
}
"
);
if
(
$file_created
<
$old_file_time
&&
!
is_dir
(
$entry
))
{
if
(
unlink
(
"
$backup_dir
/
$entry
"
))
{
if
(
unlink
(
"
{
$c
[
'backup_dir'
]
}
/
{
$entry
}
"
))
{
echo
'Cleaned up old backups'
;
}
}
...
...
db/edit.php
View file @
667696f2
...
...
@@ -22,13 +22,7 @@ $_email = $_GET['email'] ?? '';
$_podmin_statement
=
$_GET
[
'podmin_statement'
]
??
''
;
$_podmin_notify
=
$_GET
[
'podmin_notify'
]
??
0
;
require_once
__DIR__
.
'/../vendor/autoload.php'
;
require_once
__DIR__
.
'/../config.php'
;
// Set up global DB connection.
R
::
setup
(
"pgsql:host=
{
$pghost
}
;dbname=
{
$pgdb
}
"
,
$pguser
,
$pgpass
,
true
);
R
::
testConnection
()
||
die
(
'Error in DB connection'
);
R
::
usePartialBeans
(
true
);
require_once
__DIR__
.
'/../boot.php'
;
try
{
$pod
=
R
::
findOne
(
'pods'
,
'domain = ?'
,
[
$_domain
]);
...
...
@@ -89,7 +83,7 @@ if ('save' === $_action) {
}
$to
=
$_email
;
$headers
=
[
'From: '
.
$adminemail
,
'Cc: '
.
$pod
[
'email'
],
'Bcc: '
.
$adminemail
];
$headers
=
[
'From: '
.
c
(
'adminemail'
),
'Cc: '
.
$pod
[
'email'
],
'Bcc: '
.
c
(
'adminemail'
)
];
$subject
=
'Edit notice from poduptime'
;
$message
=
'Data for '
.
$_domain
.
' updated. If it was not you reply and let me know!'
;
@
mail
(
$to
,
$subject
,
$message
,
implode
(
"
\r\n
"
,
$headers
));
...
...
db/gettoken.php
View file @
667696f2
...
...
@@ -14,14 +14,7 @@ use RedBeanPHP\R;
// Other parameters.
$_email
=
$_GET
[
'email'
]
??
''
;
require_once
__DIR__
.
'/../vendor/autoload.php'
;
require_once
__DIR__
.
'/../config.php'
;
// Set up global DB connection.
R
::
setup
(
"pgsql:host=
{
$pghost
}
;dbname=
{
$pgdb
}
"
,
$pguser
,
$pgpass
,
true
);
R
::
testConnection
()
||
die
(
'Error in DB connection'
);
R
::
usePartialBeans
(
true
);
require_once
__DIR__
.
'/../boot.php'
;
try
{
$pod
=
R
::
findOne
(
'pods'
,
'domain = ?'
,
[
$_domain
]);
...
...
@@ -33,7 +26,7 @@ try {
// Set up common variables.
$uuid
=
md5
(
uniqid
(
$_domain
,
true
));
$link
=
sprintf
(
'https://%1$s/?edit&domain=%2$s&token=%3$s'
,
$_SERVER
[
'HTTP_HOST'
],
$_domain
,
$uuid
);
$headers
=
[
'From: '
.
$adminemail
];
$headers
=
[
'From: '
.
c
(
'adminemail'
)
];
$message_lines
=
[];
if
(
$_email
)
{
...
...
@@ -41,7 +34,7 @@ if ($_email) {
$to
=
$_email
;
$subject
=
'Temporary edit key for '
.
$_SERVER
[
'HTTP_HOST'
];
$headers
[]
=
'Bcc: '
.
$adminemail
;
$headers
[]
=
'Bcc: '
.
c
(
'adminemail'
)
;
$expire
=
time
()
+
8700
;
$output
=
'Link sent to your email.'
;
}
elseif
(
!
$pod
[
'email'
])
{
...
...
@@ -49,7 +42,7 @@ if ($_email) {
}
else
{
$to
=
$pod
[
'email'
];
$subject
=
'Temporary edit key for '
.
$_SERVER
[
'HTTP_HOST'
];
$headers
[]
=
'Bcc: '
.
$adminemail
;
$headers
[]
=
'Bcc: '
.
c
(
'adminemail'
)
;
$message_lines
[]
=
'Looks like you did not enter your email address, be sure to update it if you forgot the one we have for you.'
;
$message_lines
[]
=
'Email found: '
.
$pod
[
'email'
];
$expire
=
time
()
+
8700
;
...
...
db/monthly_stats.php
View file @
667696f2
...
...
@@ -13,15 +13,7 @@ if (PHP_SAPI !== 'cli') {
use
RedBeanPHP\R
;
require_once
__DIR__
.
'/../vendor/autoload.php'
;
require_once
__DIR__
.
'/../config.php'
;
define
(
'PODUPTIME'
,
microtime
(
true
));
// Set up global DB connection.
R
::
setup
(
"pgsql:host=
{
$pghost
}
;dbname=
{
$pgdb
}
"
,
$pguser
,
$pgpass
,
true
);
R
::
testConnection
()
||
die
(
'Error in DB connection'
);
R
::
usePartialBeans
(
true
);
require_once
__DIR__
.
'/../boot.php'
;
try
{
$monthly_totals
=
R
::
getAll
(
"
...
...
@@ -39,8 +31,8 @@ try {
}
catch
(
\RedBeanPHP\RedException
$e
)
{
die
(
'Error in SQL query: '
.
$e
->
getMessage
());
}
foreach
(
$monthly_totals
as
$monthly
)
{
foreach
(
$monthly_totals
as
$monthly
)
{
// Format date to timestamp.
$timestamp
=
$monthly
[
'yymm'
]
.
'-01 01:01:01-01'
;
...
...
db/podcrawler.php
View file @
667696f2
...
...
@@ -13,15 +13,7 @@ if (PHP_SAPI !== 'cli') {
use
RedBeanPHP\R
;
require_once
__DIR__
.
'/../vendor/autoload.php'
;
require_once
__DIR__
.
'/../config.php'
;
define
(
'PODUPTIME'
,
microtime
(
true
));
// Set up global DB connection.
R
::
setup
(
"pgsql:host=
{
$pghost
}
;dbname=
{
$pgdb
}
"
,
$pguser
,
$pgpass
,
true
);
R
::
testConnection
()
||
die
(
'Error in DB connection'
);
R
::
usePartialBeans
(
true
);
require_once
__DIR__
.
'/../boot.php'
;
try
{
$sql
=
'
...
...
db/pull-masterversions.php
View file @
667696f2
...
...
@@ -13,15 +13,7 @@ if (PHP_SAPI !== 'cli') {
use
RedBeanPHP\R
;
require_once
__DIR__
.
'/../vendor/autoload.php'
;
require_once
__DIR__
.
'/../config.php'
;
define
(
'PODUPTIME'
,
microtime
(
true
));
// Set up global DB connection.
R
::
setup
(
"pgsql:host=
{
$pghost
}
;dbname=
{
$pgdb
}
"
,
$pguser
,
$pgpass
,
true
);
R
::
testConnection
()
||
die
(
'Error in DB connection'
);
R
::
usePartialBeans
(
true
);
require_once
__DIR__
.
'/../boot.php'
;
$softwares
=
[
'diaspora'
=>
[
'repo'
=>
'diaspora/diaspora'
,
'gitsite'
=>
'api.github.com'
,
'gittype'
=>
'github'
,
'devbranch'
=>
'develop'
],
...
...
@@ -39,11 +31,11 @@ $opts = [
];
foreach
(
$softwares
as
$software
=>
$details
)
{
if
(
$details
[
'gittype'
]
==
'github'
)
{
if
(
$details
[
'gittype'
]
==
=
'github'
)
{
$context
=
stream_context_create
(
$opts
);
$releasejson
=
json_decode
(
file_get_contents
(
'https://'
.
$details
[
"gitsite"
]
.
'/repos/'
.
$details
[
"repo"
]
.
'/releases/latest'
,
false
,
$context
));
if
(
$details
[
"devbranch"
])
{
$commitjson
=
json_decode
(
file_get_contents
(
'https://'
.
$details
[
"gitsite"
]
.
'/repos/'
.
$details
[
"repo"
]
.
'/commits/'
.
$details
[
"devbranch"
],
false
,
$context
));
$releasejson
=
json_decode
(
file_get_contents
(
'https://'
.
$details
[
'gitsite'
]
.
'/repos/'
.
$details
[
'repo'
]
.
'/releases/latest'
,
false
,
$context
));
if
(
$details
[
'devbranch'
])
{
$commitjson
=
json_decode
(
file_get_contents
(
'https://'
.
$details
[
'gitsite'
]
.
'/repos/'
.
$details
[
'repo'
]
.
'/commits/'
.
$details
[
'devbranch'
],
false
,
$context
));
}
else
{
$commitjson
=
''
;
}
...
...
@@ -63,11 +55,11 @@ foreach ($softwares as $software => $details) {
die
(
'Error in SQL query: '
.
$e
->
getMessage
());
}
}
}
elseif
(
$details
[
'gittype'
]
==
'gitlab'
)
{
}
elseif
(
$details
[
'gittype'
]
==
=
'gitlab'
)
{
$context
=
stream_context_create
(
$opts
);
$releasejson
=
json_decode
(
file_get_contents
(
'https://'
.
$details
[
"gitsite"
]
.
'/api/v4/projects/'
.
$details
[
"repo"
]
.
'/repository/tags'
,
false
,
$context
));
if
(
$details
[
"devbranch"
])
{
$commitjson
=
json_decode
(
file_get_contents
(
'https://'
.
$details
[
"gitsite"
]
.
'/api/v4/projects/'
.
$details
[
"repo"
]
.
'/repository/commits/'
.
$details
[
"devbranch"
],
false
,
$context
));
$releasejson
=
json_decode
(
file_get_contents
(
'https://'
.
$details
[
'gitsite'
]
.
'/api/v4/projects/'
.
$details
[
'repo'
]
.
'/repository/tags'
,
false
,
$context
));
if
(
$details
[
'devbranch'
])
{
$commitjson
=
json_decode
(
file_get_contents
(
'https://'
.
$details
[
'gitsite'
]
.
'/api/v4/projects/'
.
$details
[
'repo'
]
.
'/repository/commits/'
.
$details
[
'devbranch'
],
false
,
$context
));
}
else
{
$commitjson
=
''
;
}
...
...
@@ -89,6 +81,5 @@ foreach ($softwares as $software => $details) {
}
}
printf
(
'%s:%s:%s '
,
$software
,
$masterversion
,
$devlastcommit
?:
'n/a'
);
}
db/pull.php
View file @
667696f2
...
...
@@ -30,20 +30,13 @@ $_domain = $_GET['domain'] ?? null;
// Must have a domain, except if called from CLI.
$_domain
||
PHP_SAPI
===
'cli'
||
die
(
'No valid input'
);
require_once
__DIR__
.
'/../vendor/autoload.php'
;
require_once
__DIR__
.
'/../config.php'
;
require_once
__DIR__
.
'/../boot.php'
;
define
(
'PODUPTIME'
,
microtime
(
true
));
// Set up global DB connection.
R
::
setup
(
"pgsql:host=
{
$pghost
}
;dbname=
{
$pgdb
}
"
,
$pguser
,
$pgpass
,
true
);
$sqldebug
&&
R
::
debug
(
true
);
R
::
testConnection
()
||
die
(
'Error in DB connection'
);
R
::
usePartialBeans
(
true
);
$sqldebug
&&
R
::
fancyDebug
(
true
);
try
{
// Setup GeoIP Database
$reader
=
new
Reader
(
$geoip2db
);
$reader
=
new
Reader
(
c
(
'geoip2db'
)
);
$sql
=
'
SELECT domain, score, date_created, weight, podmin_notify, email, masterversion, shortversion, status
...
...
@@ -114,7 +107,7 @@ foreach ($pods as $pod) {
curl_setopt
(
$chss
,
CURLOPT_TIMEOUT
,
30
);
curl_setopt
(
$chss
,
CURLOPT_RETURNTRANSFER
,
1
);
curl_setopt
(
$chss
,
CURLOPT_CERTINFO
,
1
);
curl_setopt
(
$chss
,
CURLOPT_CAINFO
,
$cafullpath
);
curl_setopt
(
$chss
,
CURLOPT_CAINFO
,
c
(
'cafullpath'
)
);
$outputssl
=
curl_exec
(
$chss
);
$outputsslerror
=
curl_error
(
$chss
);
$info
=
curl_getinfo
(
$chss
,
CURLINFO_CERTINFO
);
...
...
@@ -297,7 +290,7 @@ foreach ($pods as $pod) {
_debug
(
'Signup Open'
,
$signup
);
$dnsserver
=
!
empty
(
$dnsserver
)
?
$dnsserver
:
'1.1.1.1'
;
$dnsserver
=
c
(
'dnsserver'
)
?
:
'1.1.1.1'
;
$delv
=
new
NPM\Xec\Command
(
"delv @
{
$dnsserver
}
{
$domain
}
"
);
$delv
->
throwExceptionOnError
(
false
);
...
...
@@ -355,7 +348,7 @@ foreach ($pods as $pod) {
if
(
$score
==
49
&&
$notify
&&
!
$develop
&&
$dbscore
==
50
)
{
$to
=
$email
;
$headers
=
[
'From: '
.
$adminemail
,
'Bcc: '
.
$adminemail
];
$headers
=
[
'From: '
.
c
(
'adminemail'
),
'Bcc: '
.
c
(
'adminemail'
)
];
$subject
=
'Monitoring notice from poduptime'
;
$message
=
'Notice for '
.
$domain
.
'. Your score is '
.
$score
.
' and your pod will fall off the list soon.'
;
@
mail
(
$to
,
$subject
,
$message
,
implode
(
"
\r\n
"
,
$headers
));
...
...
db/pull.sh
View file @
667696f2
...
...
@@ -46,14 +46,14 @@ if [ "$HOUR" = 23 ] || [ "$1" = 'init' ]; then
fi
if
[
"
$DAY
"
=
23
]
||
[
"
$1
"
=
'init'
]
;
then
printf
"%s"
"Updating CA..."
CACERT_FILE
=
"
$(
php
-r
"
include __DIR__ . '/../config.php'; echo
\$
cafullpath
;"
)
"
CACERT_FILE
=
"
$(
php
-r
"
echo (require __DIR__ . '/../config.php')['cafullpath']
;"
)
"
if
curl
-Lss
https://curl.haxx.se/ca/cacert.pem
-o
"
$CACERT_FILE
"
;
then
echo
"
$HAPPY
"
else
echo
"
$SAD
"
fi
printf
"%s"
"Updating GeoIP2 DB..."
GEODB_FILE
=
"
$(
php
-r
"
include __DIR__ . '/../config.php'; echo
\$
geoip2db
;"
)
"
GEODB_FILE
=
"
$(
php
-r
"
echo (require __DIR__ . '/../config.php')['geoip2db']
;"
)
"
if
funzip <
(
curl
-Lss
http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz
)
>
"
$GEODB_FILE
"
;
then
echo
"
$HAPPY
"
else
...
...
db/saverating.php
View file @
667696f2
...
...
@@ -15,15 +15,7 @@ use RedBeanPHP\R;
(
$_comment
=
$_POST
[
'comment'
]
??
null
)
||
die
(
'A comment is required'
);
(
$_rating
=
$_POST
[
'rating'
]
??
null
)
||
die
(
'A rating is required'
);
require_once
__DIR__
.
'/../vendor/autoload.php'
;
require_once
__DIR__
.
'/../config.php'
;
define
(
'PODUPTIME'
,
microtime
(
true
));
// Set up global DB connection.
R
::
setup
(
"pgsql:host=
{
$pghost
}
;dbname=
{
$pgdb
}
"
,
$pguser
,
$pgpass
,
true
);
R
::
testConnection
()
||
die
(
'Error in DB connection'
);
R
::
usePartialBeans
(
true
);
require_once
__DIR__
.
'/../boot.php'
;
try
{
$r
=
R
::
dispense
(
'ratingcomments'
);
...
...
db/status.php
View file @
667696f2
...
...
@@ -6,7 +6,7 @@
declare
(
strict_types
=
1
);
$dur
=
(
time
()
-
filemtime
(
'last.data'
)
);
$dur
=
time
()
-
filemtime
(
'last.data'
);
echo
$dur
;
if
(
$dur
>
4500
)
{
http_response_code
(
500
);
...
...
go.php
View file @
667696f2
...
...
@@ -13,15 +13,7 @@ use RedBeanPHP\R;
// Other parameters.
$_domain
=
$_GET
[
'domain'
]
??
''
;
require_once
__DIR__
.
'/vendor/autoload.php'
;
require_once
__DIR__
.
'/config.php'
;
define
(
'PODUPTIME'
,
microtime
(
true
));
// Set up global DB connection.
R
::
setup
(
"pgsql:host=
{
$pghost
}
;dbname=
{
$pgdb
}
"
,
$pguser
,
$pgpass
,
true
);
R
::
testConnection
()
||
die
(
'Error in DB connection'
);
R
::
usePartialBeans
(
true
);
require_once
__DIR__
.
'/boot.php'
;
try
{
if
(
$_domain
)
{
...
...
index.php
View file @
667696f2
...
...
@@ -7,8 +7,7 @@
declare
(
strict_types
=
1
);
use
Carbon\Carbon
;
require_once
__DIR__
.
'/vendor/autoload.php'
;
require_once
__DIR__
.
'/config.php'
;
require_once
__DIR__
.
'/boot.php'
;
$lastfile
=
'db/last.data'
;
$input
=
isset
(
$_GET
[
'input'
])
?
substr
(
$_GET
[
'input'
],
1
)
:
null
;
...
...
podstat-counts.php
View file @
667696f2
...
...
@@ -11,15 +11,7 @@ use RedBeanPHP\R;
// Required parameters.
(
$_domain
=
$_GET
[
'domain'
]
??
null
)
||
die
(
'no domain given'
);
require_once
__DIR__
.
'/vendor/autoload.php'
;
require_once
__DIR__
.
'/config.php'
;
define
(
'PODUPTIME'
,
microtime
(
true
));
// Set up global DB connection.
R
::
setup
(
"pgsql:host=
{
$pghost
}
;dbname=
{
$pgdb
}
"
,
$pguser
,
$pgpass
,
true
);
R
::
testConnection
()
||
die
(
'Error in DB connection'
);
R
::
usePartialBeans
(
true
);
require_once
__DIR__
.
'/boot.php'
;
$sql
=
"
SELECT
...
...
podstat-uptime.php
View file @
667696f2
...
...
@@ -11,15 +11,7 @@ use RedBeanPHP\R;
// Required parameters.
(
$_domain
=
$_GET
[
'domain'
]
??
null
)
||
die
(
'no domain given'
);
require_once
__DIR__
.
'/vendor/autoload.php'
;
require_once
__DIR__
.
'/config.php'
;
define
(
'PODUPTIME'
,
microtime
(
true
));
// Set up global DB connection.
R
::
setup
(
"pgsql:host=
{
$pghost
}
;dbname=
{
$pgdb
}
"
,
$pguser
,
$pgpass
,
true
);
R
::
testConnection
()
||
die
(
'Error in DB connection'
);
R
::
usePartialBeans
(
true
);
require_once
__DIR__
.
'/boot.php'
;
$sql
=
"
SELECT
...
...
rate.php
View file @
667696f2
...
...
@@ -10,15 +10,8 @@ use RedBeanPHP\R;
(
$_domain
=
$_GET
[
'domain'
]
??
null
)
||
die
(
'domain not specified'
);
require_once
__DIR__
.
'/vendor/autoload.php'
;
require_once
__DIR__
.
'/config.php'
;
require_once
__DIR__
.
'/boot.php'
;
define
(
'PODUPTIME'
,
microtime
(
true
));
// Set up global DB connection.
R
::
setup
(
"pgsql:host=
{
$pghost
}
;dbname=
{
$pgdb
}
"
,
$pguser
,
$pgpass
,
true
);
R
::
testConnection
()
||
die
(
'Error in DB connection'
);
R
::
usePartialBeans
(
true
);
?>
<html>
<head>
...
...
showmap.php
View file @
667696f2
...
...
@@ -9,15 +9,7 @@ declare(strict_types=1);
use
Poduptime\PodStatus
;
use
RedBeanPHP\R
;
require_once
__DIR__
.
'/vendor/autoload.php'
;
require_once
__DIR__
.
'/config.php'
;
define
(
'PODUPTIME'
,
microtime
(
true
));
// Set up global DB connection.
R
::
setup
(
"pgsql:host=
{
$pghost
}
;dbname=
{
$pgdb
}
"
,
$pguser
,
$pgpass
,
true
);
R
::
testConnection
()
||
die
(
'Error in DB connection'
);
R
::
usePartialBeans
(
true
);
require_once
__DIR__
.
'/boot.php'
;
// CloudFlare country code pull.
$country_code
=
$_SERVER
[
'HTTP_CF_IPCOUNTRY'
]
??
''
;
...
...
@@ -84,7 +76,7 @@ EOF;
?>
]
};
var
tiles
=
L
.
tileLayer
(
'
https://{s}.tiles.mapbox.com/v4/mapbox.streets/{z}/{x}/{y}.jpg70?access_token=
<?php
echo
$mapboxkey
;
?>
'
,
{
var
tiles
=
L
.
tileLayer
(
'
https://{s}.tiles.mapbox.com/v4/mapbox.streets/{z}/{x}/{y}.jpg70?access_token=
<?php
echo
c
(
'mapboxkey'
)
;
?>
'
,
{
maxZoom
:
18
,
attribution
:
'
<a href="https://www.mapbox.com/about/maps/" target="_blank">© Mapbox © OpenStreetMap</a> <a class="mapbox-improve-map" href="https://www.mapbox.com/map-feedback/" target="_blank">Improve this map</a>
'
});
...
...
statsviewjs.php
View file @
667696f2
...
...
@@ -9,15 +9,7 @@ declare(strict_types=1);
use
Poduptime\PodStatus
;
use
RedBeanPHP\R
;
require_once
__DIR__
.
'/vendor/autoload.php'
;
require_once
__DIR__
.
'/config.php'
;
define
(
'PODUPTIME'
,
microtime
(
true
));
// Set up global DB connection.
R
::
setup
(
"pgsql:host=
{
$pghost
}
;dbname=
{
$pgdb
}
"
,
$pguser
,
$pgpass
,
true
);
R
::
testConnection
()
||
die
(
'Error in DB connection'
);
R
::
usePartialBeans
(
true
);
require_once
__DIR__
.
'/boot.php'
;
try
{
$totals
=
R
::
getAll
(
'
...
...
tabledata.php
View file @
667696f2
...
...
@@ -10,15 +10,7 @@ use Carbon\Carbon;
use
Poduptime\PodStatus
;
use
RedBeanPHP\R
;
require_once
__DIR__
.
'/vendor/autoload.php'
;
require_once
__DIR__
.
'/config.php'
;
define
(
'PODUPTIME'
,
microtime
(
true
));
// Set up global DB connection.
R
::
setup
(
"pgsql:host=
{
$pghost
}
;dbname=
{
$pgdb
}
"
,
$pguser
,
$pgpass
,
true
);
R
::
testConnection
()
||
die
(
'Error in DB connection'
);
R
::
usePartialBeans
(
true
);
require_once
__DIR__
.
'/boot.php'
;
try
{
$pods
=
R
::
getAll
(
'
...
...
wizard.php
View file @
667696f2
...
...
@@ -9,15 +9,7 @@ declare(strict_types=1);
use
Poduptime\PodStatus
;
use
RedBeanPHP\R
;
define
(
'PODUPTIME'
,
microtime
(
true
));
require_once
__DIR__
.
'/vendor/autoload.php'
;
require_once
__DIR__
.
'/config.php'
;
// Set up global DB connection.
R
::
setup
(
"pgsql:host=
{
$pghost
}
;dbname=
{
$pgdb
}
"
,
$pguser
,
$pgpass
,
true
);
R
::
testConnection
()
||
die
(
'Error in DB connection'
);
R
::
usePartialBeans
(
true
);
require_once
__DIR__
.
'/boot.php'
;
$page
=
(
int
)
(
$_GET
[
'page'
]
??
1
);
$softwarename
=
$_GET
[
'softwarename'
]
??
null
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment