Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Poduptime
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
diasporg
Poduptime
Commits
21953d9f
Commit
21953d9f
authored
Jul 19, 2018
by
dmorley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Random cleanups
parent
ce06e864
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
3 additions
and
71 deletions
+3
-71
db/add.php
db/add.php
+0
-9
db/backup.php
db/backup.php
+1
-1
db/pull.php
db/pull.php
+1
-1
index.php
index.php
+1
-1
lib/Logging.php
lib/Logging.php
+0
-52
robots.txt
robots.txt
+0
-7
No files found.
db/add.php
View file @
21953d9f
...
...
@@ -6,7 +6,6 @@
declare
(
strict_types
=
1
);
use
Poduptime\Logging
;
use
RedBeanPHP\R
;
require_once
__DIR__
.
'/../vendor/autoload.php'
;
...
...
@@ -21,10 +20,7 @@ if (PHP_SAPI === 'cli' || PHP_SAPI === 'cgi-fcgi') {
R
::
usePartialBeans
(
true
);
}
$log
=
new
Logging
();
$log
->
lfile
(
$log_dir
.
'/add.log'
);
if
(
!
(
$_domain
=
$_GET
[
'domain'
]
??
null
))
{
$log
->
lwrite
(
'no domain given'
);
die
(
'no pod domain given'
);
}
...
...
@@ -50,13 +46,11 @@ try {
foreach
(
$pods
as
$pod
)
{
if
(
$pod
[
'domain'
]
===
$_domain
)
{
if
(
$pod
[
'email'
])
{
$log
->
lwrite
(
'domain already exists and is registered to an owner'
.
$_domain
);
die
(
'domain already exists and is registered to an owner, use the edit function to modify'
);
}
$digtxt
=
exec
(
escapeshellcmd
(
'dig '
.
$_domain
.
' TXT +short'
));
if
(
strpos
(
$digtxt
,
$pod
[
'publickey'
])
===
false
)
{
$log
->
lwrite
(
'domain already exists and can be registered'
.
$_domain
);
die
(
'domain already exists, you can claim the domain by adding a DNS TXT record that states<br><b> '
.
$_domain
.
' IN TXT "'
.
$pod
[
'publickey'
]
.
'"</b>'
);
}
...
...
@@ -107,7 +101,6 @@ $outputssl = curl_exec($chss);
curl_close
(
$chss
);
if
(
$outputssl
&&
stripos
(
$outputssl
,
'openRegistrations'
)
!==
false
)
{
$log
->
lwrite
(
'Your pod has ssl and is valid '
.
$_domain
);
echo
'Your pod has ssl and is valid<br>'
;
$publickey
=
md5
(
uniqid
(
$_domain
,
true
));
...
...
@@ -142,7 +135,5 @@ if ($outputssl && stripos($outputssl, 'openRegistrations') !== false) {
echo
'Data successfully inserted! Your pod will be checked and live on the list in a few hours!'
;
}
else
{
$log
->
lwrite
(
'Could not validate your pod, check your setup! '
.
$_domain
);
echo
'Could not validate your pod, check your setup!<br>Take a look at <a href="'
.
$link
.
'">your /nodeinfo</a>'
;
}
$log
->
lclose
();
db/backup.php
View file @
21953d9f
...
...
@@ -16,7 +16,7 @@ require_once __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 --username=
$pguser
$pgdb
>>
$file_name
"
);
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
);
while
(
$entry
=
$dirh
->
read
())
{
...
...
db/pull.php
View file @
21953d9f
...
...
@@ -356,7 +356,7 @@ foreach ($pods as $pod) {
$to
=
$email
;
$headers
=
[
'From: '
.
$adminemail
,
'Bcc: '
.
$adminemail
];
$subject
=
'Monitoring notice from poduptime'
;
$message
=
'Notice for '
.
$domain
.
'. Your score fell to '
.
$score
.
' and your pod
is now not showing on the site
.'
;
$message
=
'Notice for '
.
$domain
.
'. Your score fell to '
.
$score
.
' and your pod
will fall off the list soon
.'
;
@
mail
(
$to
,
$subject
,
$message
,
implode
(
"
\r\n
"
,
$headers
));
_debug
(
'Mail Notice'
,
'sent to '
.
$email
);
...
...
index.php
View file @
21953d9f
...
...
@@ -68,7 +68,7 @@ $navs = [
[
'text'
=>
'Contact'
,
'href'
=>
'https://dia.so/support'
,
'active'
=>
false
],
[
'text'
=>
'Wiki'
,
'href'
=>
'https://git.feneas.org/diasporg/Poduptime/wikis/home'
,
'active'
=>
false
],
[
'text'
=>
'API'
,
'href'
=>
'https://git.feneas.org/diasporg/Poduptime/wikis/API'
,
'active'
=>
false
],
[
'text'
=>
'How to host a pod'
,
'href'
=>
'https://
diasporafoundation.org
/'
,
'active'
=>
false
],
[
'text'
=>
'How to host a pod'
,
'href'
=>
'https://
fediverse.party
/'
,
'active'
=>
false
],
],
];
?>
...
...
lib/Logging.php
deleted
100644 → 0
View file @
ce06e864
<?php
/**
* Logging class:
* - contains lfile, lwrite and lclose public methods
* - lfile sets path and name of log file
* - lwrite writes message to the log file (and implicitly opens log file)
* - lclose closes log file
* - first call of lwrite method will open log file implicitly
* - message is written with the following format: [d/M/Y:H:i:s] (script name) message
* - http://www.redips.net/php/write-to-log-file/
*/
declare
(
strict_types
=
1
);
namespace
Poduptime
;
class
Logging
{
private
$handle
;
private
$log_file
;
public
function
lfile
(
$path
)
:
void
{
$this
->
log_file
=
$path
;
}
public
function
lwrite
(
$message
)
:
void
{
if
(
!
\is_resource
(
$this
->
handle
))
{
$this
->
lopen
();
}
$script_name
=
pathinfo
(
$_SERVER
[
'PHP_SELF'
],
PATHINFO_FILENAME
);
$time
=
@
date
(
'[d/M/Y:H:i:s]'
);
fwrite
(
$this
->
handle
,
"
$time
(
$script_name
)
$message
"
.
PHP_EOL
);
}
public
function
lclose
()
:
void
{
fclose
(
$this
->
handle
);
}
private
function
lopen
()
:
void
{
$log_file_default
=
'/tmp/logfile.txt'
;
if
(
0
===
stripos
(
PHP_OS
,
'WIN'
))
{
$log_file_default
=
'c:/php/logfile.txt'
;
}
$lfile
=
$this
->
log_file
?:
$log_file_default
;
$this
->
handle
=
fopen
(
$lfile
,
'ab'
)
or
exit
(
"Can't open
{
$lfile
}
!"
);
}
}
robots.txt
View file @
21953d9f
User-agent: *
Allow: /
User-agent: *
Disallow: /podstat.php
User-agent: SemrushBot
Disallow: /podstat.php
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