require_once('include/features.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica');
- define ( 'FRIENDICA_VERSION', '3.2.1745' );
+ define ( 'FRIENDICA_VERSION', '3.2.1747' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
-define ( 'DB_UPDATE_VERSION', 1167 );
+define ( 'DB_UPDATE_VERSION', 1169 );
define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
define ( 'NOTIFY_TAGSELF', 0x0080 );
define ( 'NOTIFY_TAGSHARE', 0x0100 );
define ( 'NOTIFY_POKE', 0x0200 );
+define ( 'NOTIFY_SHARE', 0x0400 );
define ( 'NOTIFY_SYSTEM', 0x8000 );
// array of instanced template engines ('name'=>'instance')
public $template_engine_instance = array();
+ // Used for reducing load to the ostatus completion
+ public $last_ostatus_conversation_url;
+
private $ldelim = array(
'internal' => '',
'smarty3' => '{{'
<?php
/* To-Do:
- Automatically detect if incoming data is HTML or BBCode
- - search for usernames should first search friendica, then the other open networks, then the closed ones
*/
require_once("include/bbcode.php");
require_once("include/datetime.php");
logger('API_login: ' . print_r($_SERVER,true), LOGGER_DEBUG);
header('WWW-Authenticate: Basic realm="Friendica"');
header('HTTP/1.0 401 Unauthorized');
- die((api_error(&$a, 'json', "This api requires login")));
+ die((api_error($a, 'json', "This api requires login")));
//die('This api requires login');
}
}
header("HTTP/1.1 404 Not Found");
logger('API call not implemented: '.$a->query_string." - ".print_r($_REQUEST,true));
- return(api_error(&$a, $type, "not implemented"));
+ return(api_error($a, $type, "not implemented"));
}
$url = "";
$nick = "";
+ logger("api_get_user: Fetching user data for user ".$contact_id, LOGGER_DEBUG);
+
// Searching for contact URL
if(!is_null($contact_id) AND (intval($contact_id) == 0)){
$user = dbesc(normalise_link($contact_id));
$user
);
+ // Selecting the id by priority, friendica first
+ api_best_nickname($uinfo);
+
// if the contact wasn't found, fetch it from the unique contacts
if (count($uinfo)==0) {
$r = array();
'uid' => 0,
'cid' => 0,
'self' => 0,
+ 'network' => '',
);
return $ret;
);
// count public wall messages
- $r = q("SELECT COUNT(`id`) as `count` FROM `item`
+ $r = q("SELECT COUNT(`id`) as `count` FROM `item` USE INDEX (uid, type)
WHERE `uid` = %d
AND `type`='wall'
AND `allow_cid`='' AND `allow_gid`='' AND `deny_cid`='' AND `deny_gid`=''",
'uid' => intval($uinfo[0]['uid']),
'cid' => intval($uinfo[0]['cid']),
'self' => $uinfo[0]['self'],
+ 'network' => $uinfo[0]['network'],
);
return $ret;
unset($_REQUEST["user_id"]);
unset($_GET["user_id"]);
+ unset($_REQUEST["screen_name"]);
+ unset($_GET["screen_name"]);
+
+ $skip_status = (x($_REQUEST,'skip_status')?$_REQUEST['skip_status']:false);
+
$user_info = api_get_user($a);
// "verified" isn't used here in the standard
unset($user_info["verified"]);
// - Adding last status
- $user_info["status"] = api_status_show($a,"raw");
- if (!count($user_info["status"]))
- unset($user_info["status"]);
- else
- unset($user_info["status"]["user"]);
+ if (!$skip_status) {
+ $user_info["status"] = api_status_show($a,"raw");
+ if (!count($user_info["status"]))
+ unset($user_info["status"]);
+ else
+ unset($user_info["status"]["user"]);
+ }
// "cid", "uid" and "self" are only needed for some internal stuff, so remove it from here
unset($user_info["cid"]);
return api_status_show($a,$type);
}
api_register_func('api/statuses/update','api_statuses_update', true);
+ api_register_func('api/statuses/update_with_media','api_statuses_update', true);
function api_status_show(&$a, $type){
unset($_REQUEST["user_id"]);
unset($_GET["user_id"]);
+ unset($_REQUEST["screen_name"]);
+ unset($_GET["screen_name"]);
+
$user_info = api_get_user($a);
// get last newtork messages
unset($_REQUEST["user_id"]);
unset($_GET["user_id"]);
+ unset($_REQUEST["screen_name"]);
+ unset($_GET["screen_name"]);
+
$user_info = api_get_user($a);
// get last newtork messages
if ($user_info['self']==0) {
$ret = array();
} else {
+ $sql_extra = "";
// params
+ $since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0);
+ $max_id = (x($_REQUEST,'max_id')?$_REQUEST['max_id']:0);
$count = (x($_GET,'count')?$_GET['count']:20);
$page = (x($_REQUEST,'page')?$_REQUEST['page']-1:0);
if ($page<0) $page=0;
$start = $page*$count;
+ if ($max_id > 0)
+ $sql_extra .= ' AND `item`.`id` <= '.intval($max_id);
+
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
`contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
AND `contact`.`id` = `item`.`contact-id`
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
$sql_extra
+ AND `item`.`id`>%d
ORDER BY `item`.`received` DESC LIMIT %d ,%d ",
//intval($user_info['uid']),
intval(api_user()),
+ intval($since_id),
intval($start), intval($count)
);
if (api_user()===false) return false;
$user_info = api_get_user($a);
-
- // friends and followers only for self
- if ($user_info['self']==0){
- return false;
- }
-
if (x($_GET,'cursor') && $_GET['cursor']=='undefined'){
/* this is to stop Hotot to load friends multiple times
* I'm not sure if I'm missing return something or
if($qtype == 'followers')
$sql_extra = sprintf(" AND ( `rel` = %d OR `rel` = %d ) ", intval(CONTACT_IS_FOLLOWER), intval(CONTACT_IS_FRIEND));
- $r = q("SELECT id FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 $sql_extra",
+ // friends and followers only for self
+ if ($user_info['self'] == 0)
+ $sql_extra = " AND false ";
+
+ $r = q("SELECT `nurl` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 $sql_extra",
intval(api_user())
);
$ret = array();
foreach($r as $cid){
- $user = api_get_user($a, $cid['id']);
+ $user = api_get_user($a, $cid['nurl']);
// "cid", "uid" and "self" are only needed for some internal stuff, so remove it from here
unset($user["cid"]);
unset($user["uid"]);
$ret[] = $user;
}
-
return array('$users' => $ret);
}
if(! api_user())
return false;
+ $user_info = api_get_user($a);
+
if($qtype == 'friends')
$sql_extra = sprintf(" AND ( `rel` = %d OR `rel` = %d ) ", intval(CONTACT_IS_SHARING), intval(CONTACT_IS_FRIEND));
if($qtype == 'followers')
$sql_extra = sprintf(" AND ( `rel` = %d OR `rel` = %d ) ", intval(CONTACT_IS_FOLLOWER), intval(CONTACT_IS_FRIEND));
+ if (!$user_info["self"])
+ $sql_extra = " AND false ";
+
+ $stringify_ids = (x($_REQUEST,'stringify_ids')?$_REQUEST['stringify_ids']:false);
$r = q("SELECT unique_contacts.id FROM contact, unique_contacts WHERE contact.nurl = unique_contacts.url AND `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 $sql_extra",
intval(api_user())
elseif($type === 'json') {
$ret = array();
header("Content-type: application/json");
- foreach($r as $rr) $ret[] = $rr['id'];
+ foreach($r as $rr)
+ if ($stringify_ids)
+ $ret[] = $rr['id'];
+ else
+ $ret[] = intval($rr['id']);
+
echo json_encode($ret);
killme();
}
require_once("include/message.php");
if ($_POST['screen_name']) {
- $r = q("SELECT `id`, `nurl` FROM `contact` WHERE `uid`=%d AND `nick`='%s'",
+ $r = q("SELECT `id`, `nurl`, `network` FROM `contact` WHERE `uid`=%d AND `nick`='%s'",
intval(api_user()),
dbesc($_POST['screen_name']));
+ // Selecting the id by priority, friendica first
+ api_best_nickname($r);
+
$recipient = api_get_user($a, $r[0]['nurl']);
} else
$recipient = api_get_user($a, $_POST['user_id']);
unset($_REQUEST["user_id"]);
unset($_GET["user_id"]);
+ unset($_REQUEST["screen_name"]);
+ unset($_GET["screen_name"]);
+
$user_info = api_get_user($a);
// params
if ($page<0) $page=0;
$since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0);
+ $max_id = (x($_REQUEST,'max_id')?$_REQUEST['max_id']:0);
$start = $page*$count;
$sql_extra = "`mail`.`from-url`!='".dbesc( $profile_url )."'";
}
+ if ($max_id > 0)
+ $sql_extra .= ' AND `mail`.`id` <= '.intval($max_id);
+
$r = q("SELECT `mail`.*, `contact`.`nurl` AS `contact-url` FROM `mail`,`contact` WHERE `mail`.`contact-id` = `contact`.`id` AND `mail`.`uid`=%d AND $sql_extra AND `mail`.`id` > %d ORDER BY `mail`.`created` DESC LIMIT %d,%d",
intval(api_user()),
intval($since_id),
function api_get_nick($profile) {
/* To-Do:
- remove trailing jung from profile url
- - pump.io check has to check the websitr
+ - pump.io check has to check the website
*/
$nick = "";
return(trim($text));
}
+function api_best_nickname(&$contacts) {
+ $best_contact = array();
+
+ foreach ($contacts AS $contact)
+ if ($contact["network"] == "") {
+ $contact["network"] = "dfrn";
+ $best_contact = array($contact);
+ }
+
+ if (sizeof($best_contact) == 0)
+ foreach ($contacts AS $contact)
+ if ($contact["network"] == "dfrn")
+ $best_contact = array($contact);
+
+ if (sizeof($best_contact) == 0)
+ foreach ($contacts AS $contact)
+ if ($contact["network"] == "dspr")
+ $best_contact = array($contact);
+
+ if (sizeof($best_contact) == 0)
+ foreach ($contacts AS $contact)
+ if ($contact["network"] == "stat")
+ $best_contact = array($contact);
+
+ if (sizeof($best_contact) == 0)
+ foreach ($contacts AS $contact)
+ if ($contact["network"] == "pump")
+ $best_contact = array($contact);
+
+ if (sizeof($best_contact) == 0)
+ foreach ($contacts AS $contact)
+ if ($contact["network"] == "twit")
+ $best_contact = array($contact);
+
+ if (sizeof($best_contact) == 1)
+ $contacts = $best_contact;
+ else
+ $contacts = array($contacts[0]);
+}
+
/*
Not implemented by now:
favorites
$tpl = 'search_item.tpl';
foreach($items as $item) {
++
if($arr_blocked) {
$blocked = false;
foreach($arr_blocked as $b) {
$tmp_item = array(
'template' => $tpl,
'id' => (($preview) ? 'P0' : $item['item_id']),
++ 'network' => $item['item_network'],
'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])),
'profile_url' => $profile_link,
'item_photo_menu' => item_photo_menu($item),
call_hooks('display_item', $arr);
$threads[$threadsid]['id'] = $item['item_id'];
++ $threads[$threadsid]['network'] = $item['item_network'];
$threads[$threadsid]['items'] = array($arr['output']);
}
function complete_conversation($itemid, $conversation_url, $only_add_conversation = false) {
global $a;
++ if ($a->last_ostatus_conversation_url == $conversation_url)
++ return;
++
++ $a->last_ostatus_conversation_url = $conversation_url;
++
//logger('complete_conversation: completing conversation url '.$conversation_url.' for id '.$itemid);
$messages = q("SELECT `uid`, `parent`, `created` FROM `item` WHERE `id` = %d LIMIT 1", intval($itemid));
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0 ); // Don't stress about SSL validity
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); // Return the response, don't output it
curl_setopt( $ch, CURLOPT_TIMEOUT, SLINKY_TIMEOUT ); // Limit how long we'll wait for a response
-- curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 ); // Allow following of redirections
++ //curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 ); // Allow following of redirections
$r = curl_exec( $ch );
if ( curl_errno( $ch ) ) {
return false;
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0 ); // Don't stress about SSL validity
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); // Return the response, don't output it
curl_setopt( $ch, CURLOPT_TIMEOUT, SLINKY_TIMEOUT ); // Limit how long we'll wait for a response
-- curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 ); // Allow following of redirections
++ //curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 ); // Allow following of redirections
$r = curl_exec( $ch );
if ( curl_errno( $ch ) ) {
return false;
}
+ function contacts_batch_actions(&$a){
+ $contacts_id = $_POST['contact_batch'];
+ if (!is_array($contacts_id)) return;
+
+ $orig_records = q("SELECT * FROM `contact` WHERE `id` IN (%s) AND `uid` = %d AND `self` = 0",
+ implode(",", $contacts_id),
+ intval(local_user())
+ );
+
+ $count_actions=0;
+ foreach($orig_records as $orig_record) {
+ $contact_id = $orig_record['id'];
+ if (x($_POST, 'contacts_batch_update')) {
+ _contact_update($contact_id);
+ $count_actions++;
+ }
+ if (x($_POST, 'contacts_batch_block')) {
+ $r = _contact_block($contact_id, $orig_record);
+ if ($r) $count_actions++;
+ }
+ if (x($_POST, 'contacts_batch_ignore')) {
+ $r = _contact_ignore($contact_id, $orig_record);
+ if ($r) $count_actions++;
+ }
+ if (x($_POST, 'contacts_batch_archive')) {
+ $r = _contact_archive($contact_id, $orig_record);
+ if ($r) $count_actions++;
+ }
+ if (x($_POST, 'contacts_batch_drop')) {
+ _contact_drop($contact_id, $orig_record);
+ $count_actions++;
+ }
+ }
+ if ($count_actions>0) {
+ info ( sprintf( tt("%d contact edited.", "%d contacts edited", $count_actions), $count_actions) );
+ }
+
+ if(x($_SESSION,'return_url'))
+ goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']);
+ else
+ goaway($a->get_baseurl(true) . '/contacts');
+
+ }
+
+
function contacts_post(&$a) {
-
+
if(! local_user())
return;
+ if ($a->argv[1]==="batch") {
+ contacts_batch_actions($a);
+ return;
+ }
+
$contact_id = intval($a->argv[1]);
if(! $contact_id)
return;
$hidden = intval($_POST['hidden']);
+ $notify = intval($_POST['notify']);
+
+ $fetch_further_information = intval($_POST['fetch_further_information']);
+
$priority = intval($_POST['poll']);
if($priority > 5 || $priority < 0)
$priority = 0;
$info = fix_mce_lf(escape_tags(trim($_POST['info'])));
$r = q("UPDATE `contact` SET `profile-id` = %d, `priority` = %d , `info` = '%s',
- `hidden` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ `hidden` = %d, `notify_new_posts` = %d, `fetch_further_information` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($profile_id),
intval($priority),
dbesc($info),
intval($hidden),
+ intval($notify),
+ intval($fetch_further_information),
intval($contact_id),
intval(local_user())
);
}
+ /*contact actions*/
+ function _contact_update($contact_id) {
+ // pull feed and consume it, which should subscribe to the hub.
+ proc_run('php',"include/poller.php","$contact_id");
+ }
+ function _contact_block($contact_id, $orig_record) {
+ $blocked = (($orig_record['blocked']) ? 0 : 1);
+ $r = q("UPDATE `contact` SET `blocked` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ intval($blocked),
+ intval($contact_id),
+ intval(local_user())
+ );
+ return $r;
+
+ }
+ function _contact_ignore($contact_id, $orig_record) {
+ $readonly = (($orig_record['readonly']) ? 0 : 1);
+ $r = q("UPDATE `contact` SET `readonly` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ intval($readonly),
+ intval($contact_id),
+ intval(local_user())
+ );
+ return $r;
+ }
+ function _contact_archive($contact_id, $orig_record) {
+ $archived = (($orig_record['archive']) ? 0 : 1);
+ $r = q("UPDATE `contact` SET `archive` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ intval($archived),
+ intval($contact_id),
+ intval(local_user())
+ );
+ if ($archived) {
+ q("UPDATE `item` SET `private` = 2 WHERE `contact-id` = %d AND `uid` = %d", intval($contact_id), intval(local_user()));
+ }
+ return $r;
+ }
+ function _contact_drop($contact_id, $orig_record) {
+ require_once('include/Contact.php');
+ $a = get_app();
+
+ terminate_friendship($a->user,$a->contact,$orig_record);
+ contact_remove($orig_record['id']);
+ }
function contacts_content(&$a) {
}
if($cmd === 'update') {
-
- // pull feed and consume it, which should subscribe to the hub.
- proc_run('php',"include/poller.php","$contact_id");
+ _contact_update($contact_id);
goaway($a->get_baseurl(true) . '/contacts/' . $contact_id);
// NOTREACHED
}
if($cmd === 'block') {
- $blocked = (($orig_record[0]['blocked']) ? 0 : 1);
- $r = q("UPDATE `contact` SET `blocked` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1",
- intval($blocked),
- intval($contact_id),
- intval(local_user())
- );
+ $r = _contact_block($contact_id, $orig_record[0]);
if($r) {
- //notice( t('Contact has been ') . (($blocked) ? t('blocked') : t('unblocked')) . EOL );
info( (($blocked) ? t('Contact has been blocked') : t('Contact has been unblocked')) . EOL );
}
+
goaway($a->get_baseurl(true) . '/contacts/' . $contact_id);
return; // NOTREACHED
}
if($cmd === 'ignore') {
- $readonly = (($orig_record[0]['readonly']) ? 0 : 1);
- $r = q("UPDATE `contact` SET `readonly` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1",
- intval($readonly),
- intval($contact_id),
- intval(local_user())
- );
+ $r = _contact_ignore($contact_id, $orig_record[0]);
if($r) {
info( (($readonly) ? t('Contact has been ignored') : t('Contact has been unignored')) . EOL );
}
+
goaway($a->get_baseurl(true) . '/contacts/' . $contact_id);
return; // NOTREACHED
}
if($cmd === 'archive') {
- $archived = (($orig_record[0]['archive']) ? 0 : 1);
- $r = q("UPDATE `contact` SET `archive` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1",
- intval($archived),
- intval($contact_id),
- intval(local_user())
- );
- if ($archived) {
- q("UPDATE `item` SET `private` = 2 WHERE `contact-id` = %d AND `uid` = %d", intval($contact_id), intval(local_user()));
- }
+ $r = _contact_archive($contact_id, $orig_record[0]);
if($r) {
- //notice( t('Contact has been ') . (($archived) ? t('archived') : t('unarchived')) . EOL );
info( (($archived) ? t('Contact has been archived') : t('Contact has been unarchived')) . EOL );
- }
+ }
+
goaway($a->get_baseurl(true) . '/contacts/' . $contact_id);
return; // NOTREACHED
}
}
// Now check how the user responded to the confirmation query
if($_REQUEST['canceled']) {
- goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']);
-
+ if(x($_SESSION,'return_url'))
+ goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']);
+ else
+ goaway($a->get_baseurl(true) . '/contacts');
}
- require_once('include/Contact.php');
-
- terminate_friendship($a->user,$a->contact,$orig_record[0]);
-
- contact_remove($orig_record[0]['id']);
+ _contact_drop($contact_id, $orig_record[0]);
info( t('Contact has been removed.') . EOL );
if(x($_SESSION,'return_url'))
goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']);
'$ignored' => (($contact['readonly']) ? t('Currently ignored') : ''),
'$archived' => (($contact['archive']) ? t('Currently archived') : ''),
'$hidden' => array('hidden', t('Hide this contact from others'), ($contact['hidden'] == 1), t('Replies/likes to your public posts <strong>may</strong> still be visible')),
+ '$notify' => array('notify', t('Notification for new posts'), ($contact['notify_new_posts'] == 1), t('Send a notification of every new post of this contact')),
+ '$fetch_further_information' => array('fetch_further_information', t('Fetch further information for feeds'), ($contact['fetch_further_information'] == 1), t('Fetch further information for feeds')),
'$photo' => $contact['photo'],
'$name' => $contact['name'],
'$dir_icon' => $dir_icon,
$search_txt = dbesc(protect_sprintf(preg_quote($search)));
$searching = true;
}
- $sql_extra .= (($searching) ? " AND `name` REGEXP '$search_txt' " : "");
+ $sql_extra .= (($searching) ? " AND (name REGEXP '$search_txt' OR url REGEXP '$search_txt' OR nick REGEXP '$search_txt') " : "");
if($nets)
$sql_extra .= sprintf(" AND network = '%s' ", dbesc($nets));
$tpl = get_markup_template("contacts-template.tpl");
$o .= replace_macros($tpl, array(
+ '$baseurl' => $a->get_baseurl(),
'$header' => t('Contacts') . (($nets) ? ' - ' . network_to_name($nets) : ''),
'$tabs' => $t,
'$total' => $total,
'$submit' => t('Find'),
'$cmd' => $a->cmd,
'$contacts' => $contacts,
+ '$contact_drop_confirm' => t('Do you really want to delete this contact?'),
+ '$batch_actions' => array(
+ 'contacts_batch_update' => t('Update'),
+ 'contacts_batch_block' => t('Block')."/".t("Unblock"),
+ "contacts_batch_ignore" => t('Ignore')."/".t("Unignore"),
+ "contacts_batch_archive" => t('Archive')."/".t("Unarchive"),
+ "contacts_batch_drop" => t('Delete'),
+ ),
'$paginate' => paginate($a),
));
$o .= '</div>';
$a->page['aside'] .= $o;
- }
+ }
}
$poll = ((x($_POST,'poll')) ? $_POST['poll'] : '');
$attag = ((x($_POST,'attag')) ? $_POST['attag'] : '');
$photo = ((x($_POST,'photo')) ? $_POST['photo'] : '');
- $remote_self = ((x($_POST,'remote_self')) ? intval($_POST['remote_self']) : 0);
+ $remote_self = ((x($_POST,'remote_self')) ? $_POST['remote_self'] : false);
- $r = q("UPDATE `contact` SET `name` = '%s', `nick` = '%s', `url` = '%s', `request` = '%s', `confirm` = '%s', `notify` = '%s', `poll` = '%s', `attag` = '%s', `remote_self` = '%d'
+ $r = q("UPDATE `contact` SET `name` = '%s', `nick` = '%s', `url` = '%s', `request` = '%s', `confirm` = '%s', `notify` = '%s', `poll` = '%s', `attag` = '%s' , `remote_self` = %d
WHERE `id` = %d AND `uid` = %d LIMIT 1",
dbesc($name),
dbesc($nick),
dbesc($notify),
dbesc($poll),
dbesc($attag),
- $remote_self,
+ intval($remote_self),
intval($contact['id']),
local_user()
);
'$label_notify' => t('Notification Endpoint URL'),
'$label_poll' => t('Poll/Feed URL'),
'$label_photo' => t('New photo from this URL'),
- '$label_self' => t('Mirror all posts to the wall?'),
+ '$label_remote_self' => t('Remote Self'),
+ '$allow_remote_self' => get_config('system','allow_users_remote_self'),
+ '$remote_self' => array('remote_self', t('Mirror postings from this contact'), $contact['remote_self'], t('Mark this contact as remote_self, this will cause friendica to repost new entries from this contact.')),
'$contact_name' => $contact['name'],
'$contact_nick' => $contact['nick'],
'$contact_id' => $contact['id'],
'$notify' => $contact['notify'],
'$poll' => $contact['poll'],
'$contact_attag' => $contact['attag'],
+ '$contact_self' => array('remote_self', t('Mirror all posts to the wall?'), $contact['remote_self'],
+ t('Shall all posts from this contact posted like your own posts?')),
'$lbl_submit' => t('Submit')
- ));
+ ));
return $o;
logger('parse_url: ' . $url);
if($textmode)
-- $template = $br . '[bookmark=%s]%s[/bookmark]%s' . $br;
++ $template = '[bookmark=%s]%s[/bookmark]%s' . $br;
else
-- $template = "<br /><a class=\"bookmark\" href=\"%s\" >%s</a>%s<br />";
++ $template = "<a class=\"bookmark\" href=\"%s\" >%s</a>%s<br />";
$arr = array('url' => $url, 'text' => '');
if($url && $title && $text) {
if($textmode)
-- $text = $br . '[quote]' . trim($text) . '[/quote]' . $br;
++ $text = '[quote]' . trim($text) . '[/quote]' . $br;
else
-- $text = '<br /><blockquote>' . trim($text) . '</blockquote><br />';
++ $text = '<blockquote>' . trim($text) . '</blockquote><br />';
$title = str_replace(array("\r","\n"),array('',''),$title);
$siteinfo = parseurl_getsiteinfo($url);
++ $sitedata = "";
++
if($siteinfo["title"] == "") {
-- echo sprintf($template,$url,$url,'') . $str_tags;
++ $sitedata .= sprintf($template,$url,$url,'') . $str_tags;
killme();
} else {
$text = $siteinfo["text"];
if(strlen($text)) {
if($textmode)
-- $text = $br.'[quote]'.trim($text).'[/quote]'.$br ;
++ $text = '[quote]'.trim($text).'[/quote]';
else
-- $text = '<br /><blockquote>'.trim($text).'</blockquote><br />';
++ $text = '<blockquote>'.trim($text).'</blockquote>';
}
if($image) {
$text = $br.$br.$image.$text;
}
++
$title = str_replace(array("\r","\n"),array('',''),$title);
$result = sprintf($template,$url,($title) ? $title : $url,$text) . $str_tags;
logger('parse_url: returns: ' . $result);
-- echo trim($result);
++ $sitedata .= trim($result);
++
++ echo "[class=type-link]".$sitedata."[/class]";
++
killme();
}
--Site speed can be improved when the following indexes are set. They cannot be set through the update script because on large sites they will block the site for several minutes.
++Site speed can be improved when the following indexes are set. They
++cannot be set through the update script because on large sites they will
++block the site for several minutes.
CREATE INDEX `uid_commented` ON `item` (`uid`, `commented`);
CREATE INDEX `uid_created` ON `item` (`uid`, `created`);
CREATE INDEX `uid_unseen` ON `item` (`uid`, `unseen`);
CREATE INDEX `resource-id` ON `item` (`resource-id`);
++CREATE INDEX `uri_received` ON item(`uri`, `received`);
++CREATE INDEX `received_uri` ON item(`received`, `uri`);
++CREATE INDEX `contact-id_created` ON item(`contact-id`, created);
++CREATE INDEX `uid_network_received` ON item(`uid`, `network`, `received`);
++CREATE INDEX `uid_parent` ON item(`uid`, `parent`);
++CREATE INDEX `uid_received` ON item(`uid`, `received`);
++CREATE INDEX `uid_network_commented` ON item(`uid`, `network`, `commented`);
++CREATE INDEX `uid_commented` ON item(`uid`, `commented`);
++CREATE INDEX `uid_title` ON item(uid, `title`);
++CREATE INDEX `created_contact-id` ON item(`created`, `contact-id`);
- {{*
- * AUTOMATICALLY GENERATED TEMPLATE
- * DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
- *
- *}}
-
<form id="crepair-form" action="crepair/{{$contact_id}}" method="post" >
<h4>{{$contact_name}}</h4>
<label id="crepair-photo-label" class="crepair-label" for="crepair-photo">{{$label_photo}}</label>
<input type="text" id="crepair-photo" class="crepair-input" name="photo" value="" />
<div class="clear"></div>
+ {{if $allow_remote_self eq 1}}
+ <h4>{{$label_remote_self}}</h4>
+ {{include file="field_checkbox.tpl" field=$remote_self}}
+ {{/if}}
+{{include file="field_checkbox.tpl" field=$contact_self}}
+
<input type="submit" name="submit" value="{{$lbl_submit}}" />
</form>
body {
font-family: 'Lato', "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
-- background-color: #ffffff;
++ /* background-color: #ffffff; */
++ background-color: #FAFAFA;
++ /* background-color: rgb(252, 252, 252); */
color: #2d2d2d;
margin: 0px 0px 0px 0px;
display: table;
width: 766px;
max-width: 766px;
padding: 10px 10px 10px 10px;
-- background-color: white;
++ /* background-color: white; */
++ /* background-color: rgb(252, 252, 252); */
++ background-color: #FAFAFA;
border-bottom: 1px solid lightgray;
border-right: 1px solid lightgray;
border-left: 1px solid lightgray;
padding-right: 12px; */
}
++.twit {
++ background-color: #FFFAFA;
++}
++.pump {
++ background-color: #FAFFFA;
++}
++.face {
++ background-color: #FAFAFF;
++}
++.feed {
++ background-color: #FFFFFA;
++}
++.dspr {
++ background-color: #FFFAFF;
++}
++.dfrn {
++ background-color: #FAFFFF;
++}
++.stat {
++ background-color: #FAFAFA;
++}
++.mail {
++ background-color: #FFFFF9;
++}
++
#profile-jot-form #profile-jot-text {
height: 2.0em;
/* width: 99%; */
{{foreach $threads as $thread}}
--<div id="tread-wrapper-{{$thread.id}}" class="tread-wrapper {{if $thread.threaded}}threaded{{/if}} {{$thread.toplevel}}">
++<div id="tread-wrapper-{{$thread.id}}" class="tread-wrapper {{if $thread.threaded}}threaded{{/if}} {{$thread.toplevel}} {{$thread.network}}">
{{if $thread.type == tag}}
<img id="like-rotator-{{$item.id}}" class="like-rotator" src="images/rotator.gif" alt="{{$item.wait}}" title="{{$item.wait}}" style="display: none;" />
</div>
--<div class="wall-item-container {{$item.indent}} {{$item.shiny}} " id="item-{{$item.id}}">
++<div class="wall-item-container {{$item.indent}} {{$item.shiny}} {{$item.network}}" id="item-{{$item.id}}">
<div class="wall-item-item">
<div class="wall-item-info">
<div class="contact-photo-wrapper mframe{{if $item.owner_url}} wwfrom{{/if}}"