*/
private static function iframe($src, $width, $height)
{
- $a = \get_app();
-
if (!$height || strstr($height, '%')) {
$height = '200';
}
// Replace non graphical smilies for external posts
if ($simple_html) {
- $text = Smilies::replace($text, false, true);
+ $text = Smilies::replace($text);
}
// Unhide all [noparse] contained bbtags unspacefying them
public function set($cat, $k, $value)
{
- $a = self::getApp();
-
// We store our setting values in a string variable.
// So we have to do the conversion here so that the compare below works.
// The exception are array values.
$this->out('Options: ' . var_export($this->options, true));
}
- $showHelp = false;
$subHelp = false;
$command = null;
return 0;
} elseif ((count($this->options) === 0 || $this->getOption($this->customHelpOptions) === true || $this->getOption($this->customHelpOptions) === 1) && count($this->args) === 0
) {
- $showHelp = true;
} elseif (count($this->args) >= 2 && $this->getArgument(0) == 'help') {
$command = $this->getArgument(1);
$subHelp = true;
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
}
- $a = \get_app();
-
$pofile = realpath($this->getArgument(0));
if (!file_exists($pofile)) {
}
if ($inv) {
- $inv = false;
$out .= '"' . $v . '"';
}
}
if ($inv) {
- $inv = false;
$out .= '"' . $v . '"';
}
protected function doExecute()
{
- $a = \Friendica\BaseObject::getApp();
-
if ($this->getOption('v')) {
$this->out('Executable: ' . $this->executable);
$this->out('Class: ' . __CLASS__);
*/
public function checkPHP($phppath = null, $required = false)
{
- $passed = false;
- $passed2 = false;
$passed3 = false;
if (!isset($phppath)) {
$help = '';
$status = true;
try {
- $xml = new DOMDocument();
+ new DOMDocument();
} catch (Exception $e) {
$help = L10n::t('Error, XML PHP module required but not installed.');
$status = false;
*/
private function formatNotifs(array $notifs, $ident = "")
{
- $notif = [];
$arr = [];
if (DBA::isResult($notifs)) {
if ($a->getConfigValue('system', 'config_adapter') == 'preload') {
self::$adapter = new Config\PreloadPConfigAdapter($uid);
} else {
- self::$adapter = new Config\JITPConfigAdapter($uid);
+ self::$adapter = new Config\JITPConfigAdapter();
}
}
array_shift($trace);
$callstack = [];
- $counter = 0;
$previous = ['class' => '', 'function' => ''];
// The ignore list contains all functions that are only wrapper functions
if ((count($conditions) == 1) && ($field == array_keys($conditions)[0])) {
foreach ($rel_def AS $rel_table => $rel_fields) {
foreach ($rel_fields AS $rel_field) {
- $retval = self::delete($rel_table, [$rel_field => array_values($conditions)[0]], $options, $callstack);
+ self::delete($rel_table, [$rel_field => array_values($conditions)[0]], $options, $callstack);
}
}
// We quit when this key already exists in the callstack.
$ret = self::p("SHOW PROCESSLIST");
$data = self::toArray($ret);
- $s = [];
-
$processes = 0;
$states = [];
foreach ($data as $process) {
*/
public static function getDetailsByAddr($addr, $uid = -1)
{
- static $cache = [];
-
if ($addr == '') {
return [];
}
*/
public static function photoMenu(array $contact, $uid = 0)
{
- // @todo Unused, to be removed
- $a = \get_app();
-
- $contact_url = '';
$pm_url = '';
$status_link = '';
$photos_link = '';
- $posts_link = '';
$contact_drop_link = '';
$poke_link = '';
$contact_id = self::getIdForURL($data["alias"], $uid, true, $default, true);
}
- $url = $data["url"];
if (!$contact_id) {
$fields = [
'uid' => $uid,
*/
public static function store($arr)
{
- $a = self::getApp();
-
$event = [];
$event['id'] = intval(defaults($arr, 'id' , 0));
$event['uid'] = intval(defaults($arr, 'uid' , 0));
"February" => L10n::t("February"),
"March" => L10n::t("March"),
"April" => L10n::t("April"),
- "May" => L10n::t("May"),
"June" => L10n::t("June"),
"July" => L10n::t("July"),
"August" => L10n::t("August"),
*
* @todo Implement timezone support
*/
- private static function formatListForExport(array $events, $format, $timezone)
+ private static function formatListForExport(array $events, $format)
{
if (!count($events)) {
return '';
{
$process = false;
- $user = DBA::selectFirst('user', ['timezone'], ['uid' => $uid]);
- if (DBA::isResult($user)) {
- $timezone = $user['timezone'];
- }
-
// Get all events which are owned by a uid (respects permissions).
$events = self::getListByUserId($uid);
// We have the events that are available for the requestor.
// Now format the output according to the requested format.
- $res = self::formatListForExport($events, $format, $timezone);
+ $res = self::formatListForExport($events, $format);
- // If there are results the precess was successfull.
+ // If there are results the precess was successful.
if (!empty($res)) {
$process = true;
}
*/
public static function updateSuggestions()
{
- $a = \get_app();
-
$done = [];
/// @TODO Check if it is really neccessary to poll the own server
*/
public static function displayGroupSelection($uid, $gid = 0, $label = '')
{
- $o = '';
-
$stmt = DBA::select('group', [], ['deleted' => 0, 'uid' => $uid], ['order' => ['name']]);
$display_groups = [
// This function will finally cover most of the preparation functionality in mod/item.php
public static function prepare(&$item)
{
+ /*
+ * @TODO: Unused code triggering inspection errors
+ *
$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)
// Contact-id is the uid-dependant author contact
if (local_user() == $uid) {
$item_contact_id = $owner_self_contact['id'];
- $item_contact = $owner_self_contact;
} else {
$item_contact_id = Contact::getIdForURL($author_contact['url'], $uid, true);
$item_contact = DBA::selectFirst('contact', [], ['id' => $item_contact_id]);
$item["mention"] = 1;
}
- $sql = "";
-
$fields = [];
foreach ($item as $field => $data) {
*/
public static function getImageForPhoto(array $photo)
{
- $data = "";
if ($photo["backend-class"] == "") {
// legacy data storage in "data" column
$i = self::selectFirst(["data"], ["id" => $photo["id"]]);
// if is an existing photo, reuse same backend
$data = "";
$backend_ref = "";
- $backend_class = "";
if (DBA::isResult($existing_photo)) {
$backend_ref = (string)$existing_photo["backend-ref"];
} else {
$backend_class = StorageManager::getBackend();
}
+
if ($backend_class === "") {
$data = $Image->asString();
} else {
public static function getAdvanced(App $a)
{
- $o = '';
$uid = $a->profile['uid'];
- $o .= Renderer::replaceMacros(
- Renderer::getMarkupTemplate('section_title.tpl'),
- ['$title' => L10n::t('Profile')]
- );
-
if ($a->profile['name']) {
$tpl = Renderer::getMarkupTemplate('profile_advanced.tpl');
if (!mkdir($path, 0770, true)) {
Logger::log('Failed to create dirs ' . $path);
throw new StorageException(L10n::t('Filesystem storage failed to create "%s". Check you write permissions.', $path));
- killme();
}
}
if ($r === FALSE) {
Logger::log('Failed to write data to ' . $file);
throw new StorageException(L10n::t('Filesystem storage failed to save data to "%s". Check your write permissions', $file));
- killme();
}
return $ref;
}
$return = ['user' => null, 'password' => ''];
$using_invites = Config::get('system', 'invitation_only');
- $num_invites = Config::get('system', 'number_invites');
$invite_id = !empty($data['invite_id']) ? Strings::escapeTags(trim($data['invite_id'])) : '';
$username = !empty($data['username']) ? Strings::escapeTags(trim($data['username'])) : '';
$openid_url = '';
}
- $err = '';
-
// collapse multiple spaces in name
$username = preg_replace('/ +/', ' ', $username);
return false;
}
- $a = \get_app();
-
Logger::log('Removing user: ' . $uid);
$user = DBA::selectFirst('user', [], ['uid' => $uid]);
return;
}
- $r = DBA::update('contact', $fields, ['id' => $contact_id, 'uid' => local_user()]);
+ DBA::update('contact', $fields, ['id' => $contact_id, 'uid' => local_user()]);
// Update the entry in the contact table
Model\Contact::updateAvatar($data['photo'], local_user(), $contact_id, true);
$_SESSION['return_path'] = $a->query_string;
if (!empty($a->data['contact']) && is_array($a->data['contact'])) {
- $contact_id = $a->data['contact']['id'];
$contact = $a->data['contact'];
$a->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('contact_head.tpl'), [
'$hidden' => ['hidden', L10n::t('Hide this contact from others'), ($contact['hidden'] == 1), L10n::t('Replies/likes to your public posts <strong>may</strong> still be visible')],
'$notify' => ['notify', L10n::t('Notification for new posts'), ($contact['notify_new_posts'] == 1), L10n::t('Send a notification of every new post of this contact')],
'$fetch_further_information' => $fetch_further_information,
- '$ffi_keyword_blacklist' => $contact['ffi_keyword_blacklist'],
'$ffi_keyword_blacklist' => ['ffi_keyword_blacklist', L10n::t('Blacklisted keywords'), $contact['ffi_keyword_blacklist'], L10n::t('Comma separated list of keywords that should not be converted to hashtags, when "Fetch information and keywords" is selected')],
'$photo' => $contact['photo'],
'$name' => $contact['name'],
// If there is an error then return a blank image
if ((substr($fetchResult->getReturnCode(), 0, 1) == '4') || (!$img_str)) {
- self::responseError($request);
+ self::responseError();
// stop.
}
$image = new Image($img_str, $mime);
if (!$image->isValid()) {
- self::responseError($request);
+ self::responseError();
// stop.
}
private static function getRequestInfo()
{
$a = self::getApp();
- $url = '';
$size = 1024;
$sizetype = '';
$data["addr"] = str_replace('acct:', '', $webfinger["subject"]);
}
- $pubkey = "";
if (is_array($webfinger["links"])) {
// The array is reversed to take into account the order of preference for same-rel links
// See: https://tools.ietf.org/html/rfc7033#section-4.4.4
$width = $this->getWidth();
$height = $this->getHeight();
- $dest_width = $dest_height = 0;
-
if ((! $width)|| (! $height)) {
return false;
}
$width = $this->getWidth();
$height = $this->getHeight();
- $dest_width = $dest_height = 0;
-
if ((!$width)|| (!$height)) {
return false;
}
return $string;
}
- $quality = false;
-
ob_start();
// Enable interlacing
Logger::log('Image: guessType: '.$filename . ($fromcurl?' from curl headers':''), Logger::DEBUG);
$type = null;
if ($fromcurl) {
- $a = \get_app();
$headers=[];
$h = explode("\n", $header);
foreach ($h as $l) {
*/
public static function getScalingDimensions($width, $height, $max)
{
- $dest_width = $dest_height = 0;
-
if ((!$width) || (!$height)) {
return false;
}
$hash = Photo::newResource();
- $smallest = 0;
-
// Pictures are always public by now
//$defperm = '<'.$default_cid.'>';
$defperm = "";
}
if ($conv->isWritable() && $this->isWritable()) {
- $qc = $qcomment = null;
+ $qcomment = null;
/*
* Hmmm, code depending on the presence of a particular addon?
*/
public function getTemplateData($conv_responses)
{
- $a = self::getApp();
$result = [];
- $i = 0;
foreach ($this->parents as $item) {
if ($item->getDataValue('network') === Protocol::MAIL && local_user() != $item->getDataValue('uid')) {
return;
}
- $owner = User::getOwnerDataById($uid);
-
$cid = Contact::getIdForURL($activity['actor'], $uid);
if (empty($cid)) {
Logger::log('No contact found for ' . $activity['actor'], Logger::DEBUG);
return;
}
- $owner = User::getOwnerDataById($uid);
-
$cid = Contact::getIdForURL($activity['actor'], $uid);
if (empty($cid)) {
Logger::log('No contact found for ' . $activity['actor'], Logger::DEBUG);
if (in_array($object_data['object_type'], self::CONTENT_TYPES)) {
ActivityPub\Processor::updateItem($object_data);
} elseif (in_array($object_data['object_type'], self::ACCOUNT_TYPES)) {
- ActivityPub\Processor::updatePerson($object_data, $body);
+ ActivityPub\Processor::updatePerson($object_data);
}
break;
case 'as:Delete':
if ($object_data['object_type'] == 'as:Tombstone') {
- ActivityPub\Processor::deleteItem($object_data, $body);
+ ActivityPub\Processor::deleteItem($object_data);
} elseif (in_array($object_data['object_type'], self::ACCOUNT_TYPES)) {
- ActivityPub\Processor::deletePerson($object_data, $body);
+ ActivityPub\Processor::deletePerson($object_data);
}
break;
} else {
$receiver_list = Item::enumeratePermissions($item);
- $mentioned = [];
-
foreach ($terms as $term) {
$cid = Contact::getIdForURL($term['url'], $item['uid']);
if (!empty($cid) && in_array($cid, $receiver_list)) {
$owner = $r[0];
$owner_id = $owner['uid'];
- $owner_nick = $owner['nickname'];
$sql_post_table = "";
if (! $public_feed) {
- $sql_extra = '';
switch ($direction) {
case (-1):
$sql_extra = sprintf(" AND `issued-id` = '%s' ", DBA::escape($dfrn_id));
- $my_id = $dfrn_id;
break;
case 0:
$sql_extra = sprintf(" AND `issued-id` = '%s' AND `duplex` = 1 ", DBA::escape($dfrn_id));
- $my_id = '1:' . $dfrn_id;
break;
case 1:
$sql_extra = sprintf(" AND `dfrn-id` = '%s' AND `duplex` = 1 ", DBA::escape($dfrn_id));
- $my_id = '0:' . $dfrn_id;
break;
default:
return false;
intval(TERM_CATEGORY),
intval($owner_id)
);
- //$sql_extra .= FileTag::fileQuery('item',$category,'category');
}
if ($public_feed && ! $converse) {
*/
public static function deliver($owner, $contact, $atom, $dissolve = false, $legacy_transport = false)
{
- $a = \get_app();
-
// At first try the Diaspora transport layer
if (!$dissolve && !$legacy_transport) {
$curlResult = self::transmit($owner, $contact, $atom);
Logger::log("Local rino version: ". $rino, Logger::DEBUG);
$ssl_val = intval(Config::get('system', 'ssl_policy'));
- $ssl_policy = '';
switch ($ssl_val) {
case SSL_POLICY_FULL:
*/
public static function transmit($owner, $contact, $atom, $public_batch = false)
{
- $a = \get_app();
-
if (!$public_batch) {
if (empty($contact['addr'])) {
Logger::log('Empty contact handle for ' . $contact['id'] . ' - ' . $contact['url'] . ' - trying to update it.');
if (strtotime($value) < time()) {
$value = str_replace($bdyear, $bdyear + 1, $value);
- $bdyear = $bdyear + 1;
}
$poco["bd"] = $value;
*/
private static function processSuggestion($xpath, $suggestion, $importer)
{
- $a = \get_app();
-
Logger::log("Processing suggestions");
/// @TODO Rewrite this to one statement
$hash = Strings::getRandomHex();
- $r = q(
+ q(
"INSERT INTO `intro` (`uid`, `fid`, `contact-id`, `note`, `hash`, `datetime`, `blocked`)
VALUES(%d, %d, %d, '%s', '%s', '%s', %d)",
intval($suggest["uid"]),
$item["plink"] = $href;
break;
case "enclosure":
- $enclosure = $href;
-
if (!empty($item["attach"])) {
$item["attach"] .= ",";
} else {
}
}
- $enclosure = "";
-
$links = $xpath->query("atom:link", $entry);
if ($links) {
self::parseLinks($links, $item);
if (in_array($entrytype, [DFRN::REPLY, DFRN::REPLY_RC])) {
$posted_id = Item::insert($item);
- $parent = 0;
-
if ($posted_id) {
Logger::log("Reply from contact ".$item["contact-id"]." was stored with id ".$posted_id, Logger::DEBUG);
Logger::log("Unknown message type ".$type);
return false;
}
-
- return true;
}
/**
*/
private static function receiveRequestMakeFriend(array $importer, array $contact)
{
- $a = \get_app();
-
if ($contact["rel"] == Contact::SHARING) {
DBA::update(
'contact',
$user = DBA::selectFirst('user', [], ['uid' => $importer["uid"]]);
if (DBA::isResult($user)) {
Logger::log("Sending share message to author ".$author." - Contact: ".$contact["id"]." - User: ".$importer["uid"], Logger::DEBUG);
- $ret = self::sendShare($user, $contact);
+ self::sendShare($user, $contact);
}
}
return true;
$batch = (($ret["batch"]) ? $ret["batch"] : implode("/", array_slice(explode("/", $ret["url"]), 0, 3))."/receive/public");
- $r = q(
+ q(
"INSERT INTO `contact` (`uid`, `network`,`addr`,`created`,`url`,`nurl`,`batch`,`name`,`nick`,`photo`,`pubkey`,`notify`,`poll`,`blocked`,`priority`)
VALUES (%d, '%s', '%s', '%s', '%s','%s','%s','%s','%s','%s','%s','%s','%s',%d,%d)",
intval($importer["uid"]),
$hash = Strings::getRandomHex().(string)time(); // Generate a confirm_key
- $ret = q(
+ q(
"INSERT INTO `intro` (`uid`, `contact-id`, `blocked`, `knowyou`, `note`, `hash`, `datetime`)
VALUES (%d, %d, %d, %d, '%s', '%s', '%s')",
intval($importer["uid"]),
$new_relation = Contact::FOLLOWER;
}
- $r = q(
+ q(
"UPDATE `contact` SET `rel` = %d,
`name-date` = '%s',
`uri-date` = '%s',
$user = DBA::selectFirst('user', [], ['uid' => $importer["uid"]]);
if (DBA::isResult($user)) {
Logger::log("Sending share message (Relation: ".$new_relation.") to author ".$author." - Contact: ".$contact_record["id"]." - User: ".$importer["uid"], Logger::DEBUG);
- $ret = self::sendShare($user, $contact_record);
+ self::sendShare($user, $contact_record);
// Send the profile data, maybe it weren't transmitted before
self::sendProfile($importer["uid"], [$contact_record]);
*/
public static function transmit(array $owner, array $contact, $envelope, $public_batch, $queue_run = false, $guid = "", $no_queue = false)
{
- $a = \get_app();
-
$enabled = intval(Config::get("system", "diaspora_enabled"));
if (!$enabled) {
return 200;
// Remove the handle
$handle = array_pop($signed_parts);
- // Glue the parts together
- $text = implode(";", $signed_parts);
-
- $message = ["author" => $handle,
- "guid" => $guid,
- "parent_guid" => $parent_guid,
- "text" => implode(";", $signed_parts),
- "author_signature" => $item['signature'],
- "parent_author_signature" => ""];
+ $message = [
+ "author" => $handle,
+ "guid" => $guid,
+ "parent_guid" => $parent_guid,
+ "text" => implode(";", $signed_parts),
+ "author_signature" => $item['signature'],
+ "parent_author_signature" => ""
+ ];
}
return $message;
}
return;
}
- $conv = [
- "author" => $cnv["creator"],
- "guid" => $cnv["guid"],
- "subject" => $cnv["subject"],
- "created_at" => DateTimeFormat::utc($cnv['created'], DateTimeFormat::ATOM),
- "participants" => $cnv["recips"]
- ];
-
$body = BBCode::toMarkdown($item["body"]);
$created = DateTimeFormat::utc($item["created"], DateTimeFormat::ATOM);
$type = "message";
} else {
$message = [
- "author" => $cnv["creator"],
- "guid" => $cnv["guid"],
- "subject" => $cnv["subject"],
- "created_at" => DateTimeFormat::utc($cnv['created'], DateTimeFormat::ATOM),
- "participants" => $cnv["recips"],
- "message" => $msg];
+ "author" => $cnv["creator"],
+ "guid" => $cnv["guid"],
+ "subject" => $cnv["subject"],
+ "created_at" => DateTimeFormat::utc($cnv['created'], DateTimeFormat::ATOM),
+ "participants" => $cnv["recips"],
+ "message" => $msg
+ ];
$type = "conversation";
}
// $partno = '1', '2', '2.1', '2.1.3', etc for multipart, 0 if simple
global $htmlmsg,$plainmsg,$charset,$attachments;
- //echo $partno."\n";
-
// DECODE DATA
$data = ($partno)
? @imap_fetchbody($mbox, $uid, $partno, FT_UID|FT_PEEK)
$x = "";
foreach ($p->parts as $partno0 => $p2) {
$x .= self::messageGetPart($mbox, $uid, $p2, $partno . '.' . ($partno0+1), $subtype); // 1.2, 1.2.1, etc.
- //if ($x) {
- // return $x;
- //}
}
return $x;
}
$nextline = ltrim(substr($nextline, 1));
}
- $firstword = strpos($nextline.' ', ' ');
-
- $specialchars = ((substr(trim($nextline), 0, 1) == '-') ||
- (substr(trim($nextline), 0, 1) == '=') ||
- (substr(trim($nextline), 0, 1) == '*') ||
- (substr(trim($nextline), 0, 1) == '·') ||
- (substr(trim($nextline), 0, 4) == '[url') ||
- (substr(trim($nextline), 0, 5) == '[size') ||
- (substr(trim($nextline), 0, 7) == 'http://') ||
- (substr(trim($nextline), 0, 8) == 'https://'));
-
- if (!$specialchars) {
- $specialchars = ((substr(rtrim($line), -1) == '-') ||
- (substr(rtrim($line), -1) == '=') ||
- (substr(rtrim($line), -1) == '*') ||
- (substr(rtrim($line), -1) == '·') ||
- (substr(rtrim($line), -6) == '[/url]') ||
- (substr(rtrim($line), -7) == '[/size]'));
- }
-
if (!empty($lines[$lineno])) {
if (substr($lines[$lineno], -1) != ' ') {
$lines[$lineno] .= ' ';
}
$quotelevel = 0;
- $previousquote = 0;
$arrbodyquoted = [];
for ($i = 0; $i < count($arrbody); $i++) {
$previousquote = $quotelevel;
$quotelevel = $arrlevel[$i];
- $currline = $arrbody[$i];
while ($previousquote < $quotelevel) {
$quote = "[quote]";
$href = "";
$length = "";
$type = "";
- $title = "";
foreach ($enclosure->attributes AS $attribute) {
if (in_array($attribute->name, ["url", "href"])) {
$authordata = $xpath->query('//author')->item(0);
$author = self::fetchAuthor($xpath, $authordata, $importer, $contact, $stored);
- $entry = $xpath->query('/atom:entry');
-
// Reverse the order of the entries
$entrylist = [];
if ($valid) {
$default_contact = 0;
- $key = count(self::$itemlist);
for ($key = count(self::$itemlist) - 1; $key >= 0; $key--) {
if (empty(self::$itemlist[$key]['contact-id'])) {
self::$itemlist[$key]['contact-id'] = $default_contact;
} else {
return "http://".$server[0]."/notice/".$conversation[1];
}
- return $href;
}
/**
*/
private static function addHeader(DOMDocument $doc, array $owner, $filter, $feed_mode = false)
{
- $a = \get_app();
-
$root = $doc->createElementNS(NAMESPACE_ATOM1, 'feed');
$doc->appendChild($root);
Logger::log("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", Logger::DEBUG);
}
- $title = self::entryHeader($doc, $entry, $owner, $item, $toplevel);
+ self::entryHeader($doc, $entry, $owner, $item, $toplevel);
$condition = ['uid' => $owner["uid"], 'guid' => $repeated_guid, 'private' => false,
'network' => [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS]];
Logger::log("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", Logger::DEBUG);
}
- $title = self::entryHeader($doc, $entry, $owner, $item, $toplevel);
+ self::entryHeader($doc, $entry, $owner, $item, $toplevel);
$verb = NAMESPACE_ACTIVITY_SCHEMA."favorite";
self::entryContent($doc, $entry, $item, $owner, "Favorite", $verb, false);
*/
public static function load($cid, $uid, $zcid, $url)
{
- $a = \get_app();
-
if ($cid) {
if (!$url || !$uid) {
$contact = DBA::selectFirst('contact', ['poco', 'uid'], ['id' => $cid]);
$friendica = preg_replace("=(https?://)(.*)/profile/(.*)=ism", "$1$2", $profile);
if ($friendica != $profile) {
$server_url = $friendica;
- $network = Protocol::DFRN;
}
}
$diaspora = preg_replace("=(https?://)(.*)/u/(.*)=ism", "$1$2", $profile);
if ($diaspora != $profile) {
$server_url = $diaspora;
- $network = Protocol::DIASPORA;
}
}
$red = preg_replace("=(https?://)(.*)/channel/(.*)=ism", "$1$2", $profile);
if ($red != $profile) {
$server_url = $red;
- $network = Protocol::DIASPORA;
}
}
$mastodon = preg_replace("=(https?://)(.*)/users/(.*)=ism", "$1$2", $profile);
if ($mastodon != $profile) {
$server_url = $mastodon;
- $network = Protocol::OSTATUS;
}
}
$ostatus = preg_replace("=(https?://)(.*)/user/(.*)=ism", "$1$2", $profile);
if ($ostatus != $profile) {
$server_url = $ostatus;
- $network = Protocol::OSTATUS;
}
}
$base = preg_replace("=(https?://)(.*?)/(.*)=ism", "$1$2", $profile);
if ($base != $profile) {
$server_url = $base;
- $network = Protocol::PHANTOM;
}
}
*/
private static function detectPocoData(array $data)
{
- $server = false;
-
if (!isset($data['entry'])) {
return false;
}
*/
public static function curl($url, $binary = false, &$redirects = 0, $opts = [])
{
- $ret = ['return_code' => 0, 'success' => false, 'header' => '', 'info' => '', 'body' => ''];
-
$stamp1 = microtime(true);
$a = \get_app();
$s = @curl_exec($ch);
- $base = $s;
$curl_info = curl_getinfo($ch);
$curlResponse = new CurlResult($url, $s, $curl_info, curl_errno($ch), curl_error($ch));
*/
public static function getSiteinfo($url, $no_guessing = false, $do_oembed = true, $count = 1)
{
- $a = \get_app();
-
$siteinfo = [];
// Check if the URL does contain a scheme
//Initializations
$xml_array = [];
- $parents = [];
- $opened_tags = [];
- $arr = [];
$current = &$xml_array; // Reference
$manual_id = 0;
$generation = 0;
$force = false;
- $restart = false;
if ($parameter == 'force') {
$force = true;
}
if ($parameter == 'restart') {
- $restart = true;
$generation = intval($generation);
if (!$generation) {
exit();
Addon::reload();
- $d = DateTimeFormat::utcNow();
-
// Only poll from those with suitable relationships,
// and which have a polling address and ignore Diaspora since
// we are unable to match those posts with a Diaspora GUID and prevent duplicates.
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function removeOrphans($stage) {
- $count = 0;
-
// We split the deletion in many small tasks
$limit = Config::get('system', 'dbclean-expire-limit', 1000);
Logger::log('Start for contact ' . $contact_id);
- $manual_id = 0;
- $generation = 0;
- $hub_update = false;
$force = false;
- $restart = false;
if ($command == "force") {
$force = true;
return;
}
- $d = DateTimeFormat::utcNow();
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id]);
if (!DBA::isResult($contact)) {
$datarray['allow_cid'] = '<' . $contact['id'] . '>';
}
- $stored_item = Item::insert($datarray);
+ Item::insert($datarray);
switch ($mailconf['action']) {
case 0:
private static function publish($id)
{
- $a = BaseObject::getApp();
-
$subscriber = DBA::selectFirst('push_subscriber', [], ['id' => $id]);
if (!DBA::isResult($subscriber)) {
return;
$postResult = Network::post($subscriber['callback_url'], $params, $headers);
$ret = $postResult->getReturnCode();
- $condition = ['id' => $subscriber['id']];
-
if ($ret >= 200 && $ret <= 299) {
Logger::log('Successfully pushed to ' . $subscriber['callback_url']);