*/
public static function getFullSelectorHTML(array $user = null, $show_jotnets = false)
{
+
+ if (empty($user['uid'])) {
+ return '';
+ }
+
$perms = self::getDefaultUserPermissions($user);
$jotnets = '';
return $contact_id;
}
+ // This function will finally cover most of the preparation functionality in mod/item.php
+ public static function prepare(&$item)
+ {
+ $data = BBCode::getAttachmentData($item['body']);
+ if ((preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism", $item['body'], $match, PREG_SET_ORDER) || isset($data["type"]))
+ && ($posttype != Item::PT_PERSONAL_NOTE)) {
+ $posttype = Item::PT_PAGE;
+ $objecttype = ACTIVITY_OBJ_BOOKMARK;
+ }
+ }
+
public static function insert($item, $force_parent = false, $notify = false, $dontcache = false)
{
$a = get_app();
if (!is_object($xrd)) {
$ret = Network::curl($url, false, $redirects, ['timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml']);
- if (!$ret["success"] && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
+ if (!empty($ret["errno"]) && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
logger("Probing timeout for ".$url, LOGGER_DEBUG);
return false;
}
$redirects = 0;
$ret = Network::curl($url, false, $redirects, ['timeout' => $xrd_timeout, 'accept_content' => $type]);
- if (!$ret["success"] && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
+ if (!empty($ret["errno"]) && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
return false;
}
$data = $ret['body'];
private static function pollNoscrape($noscrape_url, $data)
{
$ret = Network::curl($noscrape_url);
- if (!$ret["success"] && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
+ if (!empty($ret["errno"]) && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
return false;
}
$content = $ret['body'];
private static function pollHcard($hcard_url, $data, $dfrn = false)
{
$ret = Network::curl($hcard_url);
- if (!$ret["success"] && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
+ if (!empty($ret["errno"]) && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
return false;
}
$content = $ret['body'];
}
} elseif (normalise_link($pubkey) == 'http://') {
$ret = Network::curl($pubkey);
- if (!$ret["success"] && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
+ if (!empty($ret["errno"]) && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
return false;
}
$pubkey = $ret['body'];
// Fetch all additional data from the feed
$ret = Network::curl($data["poll"]);
- if (!$ret["success"] && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
+ if (!empty($ret["errno"]) && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
return false;
}
$feed = $ret['body'];
private static function feed($url, $probe = true)
{
$ret = Network::curl($url);
- if (!$ret["success"] && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
+ if (!empty($ret["errno"]) && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
return false;
}
$feed = $ret['body'];
$ret = Network::curl($url);
- if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
+ if (!empty($ret["errno"]) && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
Contact::markForArchival($contact);
return -2; // timed out
}
// Quit if there is a timeout.
// But we want to make sure to only quit if we are mostly sure that this server url fits.
if (DBM::is_result($gserver) && ($orig_server_url == $server_url) &&
- (!$serverret["success"] && ($serverret['errno'] == CURLE_OPERATION_TIMEDOUT))) {
+ (!empty($serverret["errno"]) && ($serverret['errno'] == CURLE_OPERATION_TIMEDOUT))) {
logger("Connection to server ".$server_url." timed out.", LOGGER_DEBUG);
DBA::update('gserver', ['last_failure' => DateTimeFormat::utcNow()], ['nurl' => normalise_link($server_url)]);
return false;
$serverret = Network::curl($server_url."/.well-known/host-meta", false, $redirects, ['timeout' => 20]);
// Quit if there is a timeout
- if (!$serverret["success"] && ($serverret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
+ if (!empty($serverret["errno"]) && ($serverret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
logger("Connection to server ".$server_url." timed out.", LOGGER_DEBUG);
DBA::update('gserver', ['last_failure' => DateTimeFormat::utcNow()], ['nurl' => normalise_link($server_url)]);
return false;
$ret = Network::curl($url);
- if (!$ret["success"] && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
+ if (!empty($ret["errno"]) && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
// set the last-update so we don't keep polling
DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
Contact::markForArchival($contact);
$ret = Network::curl($contact['poll'], false, $redirects, ['cookiejar' => $cookiejar]);
unlink($cookiejar);
- if (!$ret["success"] && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
+ if (!empty($ret["errno"]) && ($ret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
// set the last-update so we don't keep polling
DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
Contact::markForArchival($contact);