OStatus usage of static Validate::* calls fixed
This commit is contained in:
parent
f29daa22b6
commit
65184782aa
@ -246,11 +246,13 @@ class OStatusPlugin extends Plugin
|
|||||||
$profile->whereAdd('uri LIKE "%' . $profile->escape($q) . '%"');
|
$profile->whereAdd('uri LIKE "%' . $profile->escape($q) . '%"');
|
||||||
$profile->query();
|
$profile->query();
|
||||||
|
|
||||||
|
$validate = new Validate();
|
||||||
|
|
||||||
if ($profile->N == 0) {
|
if ($profile->N == 0) {
|
||||||
try {
|
try {
|
||||||
if (Validate::email($q)) {
|
if ($validate->email($q)) {
|
||||||
$oprofile = Ostatus_profile::ensureWebfinger($q);
|
$oprofile = Ostatus_profile::ensureWebfinger($q);
|
||||||
} else if (Validate::uri($q)) {
|
} else if ($validate->uri($q)) {
|
||||||
$oprofile = Ostatus_profile::ensureProfileURL($q);
|
$oprofile = Ostatus_profile::ensureProfileURL($q);
|
||||||
} else {
|
} else {
|
||||||
// TRANS: Exception in OStatus when invalid URI was entered.
|
// TRANS: Exception in OStatus when invalid URI was entered.
|
||||||
|
@ -153,8 +153,9 @@ class OStatusInitAction extends Action
|
|||||||
|
|
||||||
function ostatusConnect()
|
function ostatusConnect()
|
||||||
{
|
{
|
||||||
|
$validate = new Validate();
|
||||||
$opts = array('allowed_schemes' => array('http', 'https', 'acct'));
|
$opts = array('allowed_schemes' => array('http', 'https', 'acct'));
|
||||||
if (Validate::uri($this->profile, $opts)) {
|
if ($validate->uri($this->profile, $opts)) {
|
||||||
$bits = parse_url($this->profile);
|
$bits = parse_url($this->profile);
|
||||||
if ($bits['scheme'] == 'acct') {
|
if ($bits['scheme'] == 'acct') {
|
||||||
$this->connectWebfinger($bits['path']);
|
$this->connectWebfinger($bits['path']);
|
||||||
|
@ -241,11 +241,12 @@ class OStatusSubAction extends Action
|
|||||||
*/
|
*/
|
||||||
function pullRemoteProfile()
|
function pullRemoteProfile()
|
||||||
{
|
{
|
||||||
|
$validate = new Validate();
|
||||||
$this->profile_uri = $this->trimmed('profile');
|
$this->profile_uri = $this->trimmed('profile');
|
||||||
try {
|
try {
|
||||||
if (Validate::email($this->profile_uri)) {
|
if ($validate->email($this->profile_uri)) {
|
||||||
$this->oprofile = Ostatus_profile::ensureWebfinger($this->profile_uri);
|
$this->oprofile = Ostatus_profile::ensureWebfinger($this->profile_uri);
|
||||||
} else if (Validate::uri($this->profile_uri)) {
|
} else if ($validate->uri($url, $params)) {
|
||||||
$this->oprofile = Ostatus_profile::ensureProfileURL($this->profile_uri);
|
$this->oprofile = Ostatus_profile::ensureProfileURL($this->profile_uri);
|
||||||
} else {
|
} else {
|
||||||
// TRANS: Error message in OStatus plugin. Do not translate the domain names example.com
|
// TRANS: Error message in OStatus plugin. Do not translate the domain names example.com
|
||||||
|
@ -200,7 +200,7 @@ class PushHubAction extends Action
|
|||||||
$url = $this->arg($arg);
|
$url = $this->arg($arg);
|
||||||
$params = array('domain_check' => false, // otherwise breaks my local tests :P
|
$params = array('domain_check' => false, // otherwise breaks my local tests :P
|
||||||
'allowed_schemes' => array('http', 'https'));
|
'allowed_schemes' => array('http', 'https'));
|
||||||
$validate = new Validate;
|
$validate = new Validate();
|
||||||
if ($validate->uri($url, $params)) {
|
if ($validate->uri($url, $params)) {
|
||||||
return $url;
|
return $url;
|
||||||
} else {
|
} else {
|
||||||
|
@ -36,7 +36,9 @@ END_OF_HELP;
|
|||||||
|
|
||||||
require_once INSTALLDIR.'/scripts/commandline.inc';
|
require_once INSTALLDIR.'/scripts/commandline.inc';
|
||||||
|
|
||||||
if (empty($args[0]) || !Validate::uri($args[0])) {
|
$validate = new Validate();
|
||||||
|
|
||||||
|
if (empty($args[0]) || !$validate->uri($args[0])) {
|
||||||
print "$helptext";
|
print "$helptext";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,9 @@ END_OF_HELP;
|
|||||||
|
|
||||||
require_once INSTALLDIR.'/scripts/commandline.inc';
|
require_once INSTALLDIR.'/scripts/commandline.inc';
|
||||||
|
|
||||||
if (empty($args[0]) || !Validate::uri($args[0])) {
|
$validate = new Validate();
|
||||||
|
|
||||||
|
if (empty($args[0]) || !$validate->uri($args[0])) {
|
||||||
print "$helptext";
|
print "$helptext";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -99,6 +99,7 @@ function fixProfile($uri) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$ok = true;
|
$ok = true;
|
||||||
|
$validate = new Validate();
|
||||||
if (have_option('all')) {
|
if (have_option('all')) {
|
||||||
$oprofile = new Ostatus_profile();
|
$oprofile = new Ostatus_profile();
|
||||||
$oprofile->find();
|
$oprofile->find();
|
||||||
@ -115,7 +116,7 @@ if (have_option('all')) {
|
|||||||
while ($oprofile->fetch()) {
|
while ($oprofile->fetch()) {
|
||||||
$ok = fixProfile($oprofile->uri) && $ok;
|
$ok = fixProfile($oprofile->uri) && $ok;
|
||||||
}
|
}
|
||||||
} else if (!empty($args[0]) && Validate::uri($args[0])) {
|
} else if (!empty($args[0]) && $validate->uri($args[0])) {
|
||||||
$uri = $args[0];
|
$uri = $args[0];
|
||||||
$ok = fixProfile($uri);
|
$ok = fixProfile($uri);
|
||||||
} else {
|
} else {
|
||||||
|
@ -32,7 +32,9 @@ END_OF_HELP;
|
|||||||
|
|
||||||
require_once INSTALLDIR.'/scripts/commandline.inc';
|
require_once INSTALLDIR.'/scripts/commandline.inc';
|
||||||
|
|
||||||
if (empty($args[0]) || !Validate::uri($args[0])) {
|
$validate = new Validate();
|
||||||
|
|
||||||
|
if (empty($args[0]) || !$validate->uri($args[0])) {
|
||||||
print "$helptext";
|
print "$helptext";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -207,10 +207,11 @@ class LooseOstatusProfile extends Ostatus_profile
|
|||||||
function pullOstatusProfile($uri) {
|
function pullOstatusProfile($uri) {
|
||||||
|
|
||||||
$oprofile = null;
|
$oprofile = null;
|
||||||
|
$validate = new Validate();
|
||||||
|
|
||||||
if (Validate::email($uri)) {
|
if ($validate->email($uri)) {
|
||||||
$oprofile = LooseOstatusProfile::updateWebfinger($uri);
|
$oprofile = LooseOstatusProfile::updateWebfinger($uri);
|
||||||
} else if (Validate::uri($uri)) {
|
} else if ($validate->uri($uri)) {
|
||||||
$oprofile = LooseOstatusProfile::updateProfileURL($uri);
|
$oprofile = LooseOstatusProfile::updateProfileURL($uri);
|
||||||
} else {
|
} else {
|
||||||
print "Sorry, we could not reach the address: $uri\n";
|
print "Sorry, we could not reach the address: $uri\n";
|
||||||
|
Loading…
Reference in New Issue
Block a user