Revert to stable version 3.5.4

This commit is contained in:
Hypolite Petovan 2018-02-11 19:00:01 -05:00
commit 5360f08f42
355 changed files with 21449 additions and 4957 deletions

1647
appnet/AppDotNet.php Normal file
View file

@ -0,0 +1,1647 @@
<?php
/**
* AppDotNet.php
* App.net PHP library
* https://github.com/jdolitsky/AppDotNetPHP
*
* This class handles a lower level type of access to App.net. It's ideal
* for command line scripts and other places where you want full control
* over what's happening, and you're at least a little familiar with oAuth.
*
* Alternatively you can use the EZAppDotNet class which automatically takes
* care of a lot of the details like logging in, keeping track of tokens,
* etc. EZAppDotNet assumes you're accessing App.net via a browser, whereas
* this class tries to make no assumptions at all.
*/
class AppDotNet {
protected $_baseUrl = 'https://alpha-api.app.net/stream/0/';
protected $_authUrl = 'https://account.app.net/oauth/';
private $_authPostParams=array();
// stores the access token after login
private $_accessToken = null;
// stores the App access token if we have it
private $_appAccessToken = null;
// stores the user ID returned when fetching the auth token
private $_user_id = null;
// stores the username returned when fetching the auth token
private $_username = null;
// The total number of requests you're allowed within the alloted time period
private $_rateLimit = null;
// The number of requests you have remaining within the alloted time period
private $_rateLimitRemaining = null;
// The number of seconds remaining in the alloted time period
private $_rateLimitReset = null;
// The scope the user has
private $_scope = null;
// token scopes
private $_scopes=array();
// debug info
private $_last_request = null;
private $_last_response = null;
// ssl certification
private $_sslCA = null;
// the callback function to be called when an event is received from the stream
private $_streamCallback = null;
// the stream buffer
private $_streamBuffer = '';
// stores the curl handler for the current stream
private $_currentStream = null;
// stores the curl multi handler for the current stream
private $_multiStream = null;
// stores the number of failed connects, so we can back off multiple failures
private $_connectFailCounter = 0;
// stores the most recent stream url, so we can re-connect when needed
private $_streamUrl = null;
// keeps track of the last time we've received a packet from the api, if it's too long we'll reconnect
private $_lastStreamActivity = null;
// stores the headers received when connecting to the stream
private $_streamHeaders = null;
// response meta max_id data
private $_maxid = null;
// response meta min_id data
private $_minid = null;
// response meta more data
private $_more = null;
// response stream marker data
private $_last_marker = null;
// strip envelope response from returned value
private $_stripResponseEnvelope=true;
// if processing stream_markers or any fast stream, decrease $sleepFor
public $streamingSleepFor=20000;
/**
* Constructs an AppDotNet PHP object with the specified client ID and
* client secret.
* @param string $client_id The client ID you received from App.net when
* creating your app.
* @param string $client_secret The client secret you received from
* App.net when creating your app.
*/
public function __construct($client_id,$client_secret) {
$this->_clientId = $client_id;
$this->_clientSecret = $client_secret;
// if the digicert certificate exists in the same folder as this file,
// remember that fact for later
if (file_exists(dirname(__FILE__).'/DigiCertHighAssuranceEVRootCA.pem')) {
$this->_sslCA = dirname(__FILE__).'/DigiCertHighAssuranceEVRootCA.pem';
}
}
/**
* Set whether or not to strip Envelope Response (meta) information
* This option will be deprecated in the future. Is it to allow
* a stepped migration path between code expecting the old behavior
* and new behavior. When not stripped, you still can use the proper
* method to pull the meta information. Please start converting your code ASAP
*/
public function includeResponseEnvelope() {
$this->_stripResponseEnvelope=false;
}
/**
* Construct the proper Auth URL for the user to visit and either grant
* or not access to your app. Usually you would place this as a link for
* the user to client, or a redirect to send them to the auth URL.
* Also can be called after authentication for additional scopes
* @param string $callbackUri Where you want the user to be directed
* after authenticating with App.net. This must be one of the URIs
* allowed by your App.net application settings.
* @param array $scope An array of scopes (permissions) you wish to obtain
* from the user. Currently options are stream, email, write_post, follow,
* messages, and export. If you don't specify anything, you'll only receive
* access to the user's basic profile (the default).
*/
public function getAuthUrl($callback_uri,$scope=null) {
// construct an authorization url based on our client id and other data
$data = array(
'client_id'=>$this->_clientId,
'response_type'=>'code',
'redirect_uri'=>$callback_uri,
);
$url = $this->_authUrl;
if ($this->_accessToken) {
$url .= 'authorize?';
} else {
$url .= 'authenticate?';
}
$url .= $this->buildQueryString($data);
if ($scope) {
$url .= '&scope='.implode('+',$scope);
}
// return the constructed url
return $url;
}
/**
* Call this after they return from the auth page, or anytime you need the
* token. For example, you could store it in a database and use
* setAccessToken() later on to return on behalf of the user.
*/
public function getAccessToken($callback_uri) {
// if there's no access token set, and they're returning from
// the auth page with a code, use the code to get a token
if (!$this->_accessToken && isset($_GET['code']) && $_GET['code']) {
// construct the necessary elements to get a token
$data = array(
'client_id'=>$this->_clientId,
'client_secret'=>$this->_clientSecret,
'grant_type'=>'authorization_code',
'redirect_uri'=>$callback_uri,
'code'=>$_GET['code']
);
// try and fetch the token with the above data
$res = $this->httpReq('post',$this->_authUrl.'access_token', $data);
// store it for later
$this->_accessToken = $res['access_token'];
$this->_username = $res['username'];
$this->_user_id = $res['user_id'];
}
// return what we have (this may be a token, or it may be nothing)
return $this->_accessToken;
}
/**
* Check the scope of current token to see if it has required scopes
* has to be done after a check
*/
public function checkScopes($app_scopes) {
if (!count($this->_scopes)) {
return -1; // _scope is empty
}
$missing=array();
foreach($app_scopes as $scope) {
if (!in_array($scope,$this->_scopes)) {
if ($scope=='public_messages') {
// messages works for public_messages
if (in_array('messages',$this->_scopes)) {
// if we have messages in our scopes
continue;
}
}
$missing[]=$scope;
}
}
// identify the ones missing
if (count($missing)) {
// do something
return $missing;
}
return 0; // 0 missing
}
/**
* Set the access token (eg: after retrieving it from offline storage)
* @param string $token A valid access token you're previously received
* from calling getAccessToken().
*/
public function setAccessToken($token) {
$this->_accessToken = $token;
}
/**
* Deauthorize the current token (delete your authorization from the API)
* Generally this is useful for logging users out from a web app, so they
* don't get automatically logged back in the next time you redirect them
* to the authorization URL.
*/
public function deauthorizeToken() {
return $this->httpReq('delete',$this->_baseUrl.'token');
}
/**
* Retrieve an app access token from the app.net API. This allows you
* to access the API without going through the user access flow if you
* just want to (eg) consume global. App access tokens are required for
* some actions (like streaming global). DO NOT share the return value
* of this function with any user (or save it in a cookie, etc). This
* is considered secret info for your app only.
* @return string The app access token
*/
public function getAppAccessToken() {
// construct the necessary elements to get a token
$data = array(
'client_id'=>$this->_clientId,
'client_secret'=>$this->_clientSecret,
'grant_type'=>'client_credentials',
);
// try and fetch the token with the above data
$res = $this->httpReq('post',$this->_authUrl.'access_token', $data);
// store it for later
$this->_appAccessToken = $res['access_token'];
$this->_accessToken = $res['access_token'];
$this->_username = null;
$this->_user_id = null;
return $this->_accessToken;
}
/**
* Returns the total number of requests you're allowed within the
* alloted time period.
* @see getRateLimitReset()
*/
public function getRateLimit() {
return $this->_rateLimit;
}
/**
* The number of requests you have remaining within the alloted time period
* @see getRateLimitReset()
*/
public function getRateLimitRemaining() {
return $this->_rateLimitRemaining;
}
/**
* The number of seconds remaining in the alloted time period.
* When this time is up you'll have getRateLimit() available again.
*/
public function getRateLimitReset() {
return $this->_rateLimitReset;
}
/**
* The scope the user has
*/
public function getScope() {
return $this->_scope;
}
/**
* Internal function, parses out important information App.net adds
* to the headers.
*/
protected function parseHeaders($response) {
// take out the headers
// set internal variables
// return the body/content
$this->_rateLimit = null;
$this->_rateLimitRemaining = null;
$this->_rateLimitReset = null;
$this->_scope = null;
$response = explode("\r\n\r\n",$response,2);
$headers = $response[0];
if($headers == 'HTTP/1.1 100 Continue') {
$response = explode("\r\n\r\n",$response[1],2);
$headers = $response[0];
}
if (isset($response[1])) {
$content = $response[1];
}
else {
$content = null;
}
// this is not a good way to parse http headers
// it will not (for example) take into account multiline headers
// but what we're looking for is pretty basic, so we can ignore those shortcomings
$headers = explode("\r\n",$headers);
foreach ($headers as $header) {
$header = explode(': ',$header,2);
if (count($header)<2) {
continue;
}
list($k,$v) = $header;
switch ($k) {
case 'X-RateLimit-Remaining':
$this->_rateLimitRemaining = $v;
break;
case 'X-RateLimit-Limit':
$this->_rateLimit = $v;
break;
case 'X-RateLimit-Reset':
$this->_rateLimitReset = $v;
break;
case 'X-OAuth-Scopes':
$this->_scope = $v;
$this->_scopes=explode(',',$v);
break;
}
}
return $content;
}
/**
* Internal function. Used to turn things like TRUE into 1, and then
* calls http_build_query.
*/
protected function buildQueryString($array) {
foreach ($array as $k=>&$v) {
if ($v===true) {
$v = '1';
}
elseif ($v===false) {
$v = '0';
}
unset($v);
}
return http_build_query($array);
}
/**
* Internal function to handle all
* HTTP requests (POST,PUT,GET,DELETE)
*/
protected function httpReq($act, $req, $params=array(),$contentType='application/x-www-form-urlencoded') {
$ch = curl_init($req);
$headers = array();
if($act != 'get') {
curl_setopt($ch, CURLOPT_POST, true);
// if they passed an array, build a list of parameters from it
if (is_array($params) && $act != 'post-raw') {
$params = $this->buildQueryString($params);
}
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
$headers[] = "Content-Type: ".$contentType;
}
if($act != 'post' && $act != 'post-raw') {
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, strtoupper($act));
}
if($act == 'get' && isset($params['access_token'])) {
$headers[] = 'Authorization: Bearer '.$params['access_token'];
}
else if ($this->_accessToken) {
$headers[] = 'Authorization: Bearer '.$this->_accessToken;
}
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_HEADER, true);
if ($this->_sslCA) {
curl_setopt($ch, CURLOPT_CAINFO, $this->_sslCA);
}
$this->_last_response = curl_exec($ch);
$this->_last_request = curl_getinfo($ch,CURLINFO_HEADER_OUT);
$http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($http_status==0) {
throw new AppDotNetException('Unable to connect to '.$req);
}
if ($http_status<200 || $http_status>=300) {
throw new AppDotNetException('HTTP error '.$this->_last_response);
}
if ($this->_last_request===false) {
if (!curl_getinfo($ch,CURLINFO_SSL_VERIFYRESULT)) {
throw new AppDotNetException('SSL verification failed, connection terminated.');
}
}
$response = $this->parseHeaders($this->_last_response);
$response = json_decode($response,true);
if (isset($response['meta'])) {
if (isset($response['meta']['max_id'])) {
$this->_maxid=$response['meta']['max_id'];
$this->_minid=$response['meta']['min_id'];
}
if (isset($response['meta']['more'])) {
$this->_more=$response['meta']['more'];
}
if (isset($response['meta']['marker'])) {
$this->_last_marker=$response['meta']['marker'];
}
}
// look for errors
if (isset($response['error'])) {
if (is_array($response['error'])) {
throw new AppDotNetException($response['error']['message'],
$response['error']['code']);
}
else {
throw new AppDotNetException($response['error']);
}
}
// look for response migration errors
elseif (isset($response['meta']) && isset($response['meta']['error_message'])) {
throw new AppDotNetException($response['meta']['error_message'],$response['meta']['code']);
}
// if we've received a migration response, handle it and return data only
elseif ($this->_stripResponseEnvelope && isset($response['meta']) && isset($response['data'])) {
return $response['data'];
}
// else non response migration response, just return it
else {
return $response;
}
}
/**
* Get max_id from last meta response data envelope
*/
public function getResponseMaxID() {
return $this->_maxid;
}
/**
* Get min_id from last meta response data envelope
*/
public function getResponseMinID() {
return $this->_minid;
}
/**
* Get more from last meta response data envelope
*/
public function getResponseMore() {
return $this->_more;
}
/**
* Get marker from last meta response data envelope
*/
public function getResponseMarker() {
return $this->_last_marker;
}
/**
* Fetch API configuration object
*/
public function getConfig() {
return $this->httpReq('get',$this->_baseUrl.'config');
}
/**
* Return the Filters for the current user.
*/
public function getAllFilters() {
return $this->httpReq('get',$this->_baseUrl.'filters');
}
/**
* Create a Filter for the current user.
* @param string $name The name of the new filter
* @param array $filters An associative array of filters to be applied.
* This may change as the API evolves, as of this writing possible
* values are: user_ids, hashtags, link_domains, and mention_user_ids.
* You will need to provide at least one filter name=>value pair.
*/
public function createFilter($name='New filter', $filters=array()) {
$filters['name'] = $name;
return $this->httpReq('post',$this->_baseUrl.'filters',$filters);
}
/**
* Returns a specific Filter object.
* @param integer $filter_id The ID of the filter you wish to retrieve.
*/
public function getFilter($filter_id=null) {
return $this->httpReq('get',$this->_baseUrl.'filters/'.urlencode($filter_id));
}
/**
* Delete a Filter. The Filter must belong to the current User.
* @return object Returns the deleted Filter on success.
*/
public function deleteFilter($filter_id=null) {
return $this->httpReq('delete',$this->_baseUrl.'filters/'.urlencode($filter_id));
}
/**
* Process user description, message or post text.
* Mentions and hashtags will be parsed out of the
* text, as will bare URLs. To create a link in the text without using a
* bare URL, include the anchor text in the object text and include a link
* entity in the function call.
* @param string $text The text of the description/message/post
* @param array $data An associative array of optional post data. This
* will likely change as the API evolves, as of this writing allowed keys are:
* reply_to, and annotations. "annotations" may be a complex object represented
* by an associative array.
* @param array $params An associative array of optional data to be included
* in the URL (such as 'include_annotations' and 'include_machine')
* @return array An associative array representing the post.
*/
public function processText($text=null, $data = array(), $params = array()) {
$data['text'] = $text;
$json = json_encode($data);
$qs = '';
if (!empty($params)) {
$qs = '?'.$this->buildQueryString($params);
}
return $this->httpReq('post',$this->_baseUrl.'text/process'.$qs, $json, 'application/json');
}
/**
* Create a new Post object. Mentions and hashtags will be parsed out of the
* post text, as will bare URLs. To create a link in a post without using a
* bare URL, include the anchor text in the post's text and include a link
* entity in the post creation call.
* @param string $text The text of the post
* @param array $data An associative array of optional post data. This
* will likely change as the API evolves, as of this writing allowed keys are:
* reply_to, and annotations. "annotations" may be a complex object represented
* by an associative array.
* @param array $params An associative array of optional data to be included
* in the URL (such as 'include_annotations' and 'include_machine')
* @return array An associative array representing the post.
*/
public function createPost($text=null, $data = array(), $params = array()) {
$data['text'] = $text;
$json = json_encode($data);
$qs = '';
if (!empty($params)) {
$qs = '?'.$this->buildQueryString($params);
}
return $this->httpReq('post',$this->_baseUrl.'posts'.$qs, $json, 'application/json');
}
/**
* Returns a specific Post.
* @param integer $post_id The ID of the post to retrieve
* @param array $params An associative array of optional general parameters.
* This will likely change as the API evolves, as of this writing allowed keys
* are: include_annotations.
* @return array An associative array representing the post
*/
public function getPost($post_id=null,$params = array()) {
return $this->httpReq('get',$this->_baseUrl.'posts/'.urlencode($post_id)
.'?'.$this->buildQueryString($params));
}
/**
* Delete a Post. The current user must be the same user who created the Post.
* It returns the deleted Post on success.
* @param integer $post_id The ID of the post to delete
* @param array An associative array representing the post that was deleted
*/
public function deletePost($post_id=null) {
return $this->httpReq('delete',$this->_baseUrl.'posts/'.urlencode($post_id));
}
/**
* Retrieve the Posts that are 'in reply to' a specific Post.
* @param integer $post_id The ID of the post you want to retrieve replies for.
* @param array $params An associative array of optional general parameters.
* This will likely change as the API evolves, as of this writing allowed keys
* are: count, before_id, since_id, include_muted, include_deleted,
* include_directed_posts, and include_annotations.
* @return An array of associative arrays, each representing a single post.
*/
public function getPostReplies($post_id=null,$params = array()) {
return $this->httpReq('get',$this->_baseUrl.'posts/'.urlencode($post_id)
.'/replies?'.$this->buildQueryString($params));
}
/**
* Get the most recent Posts created by a specific User in reverse
* chronological order (most recent first).
* @param mixed $user_id Either the ID of the user you wish to retrieve posts by,
* or the string "me", which will retrieve posts for the user you're authenticated
* as.
* @param array $params An associative array of optional general parameters.
* This will likely change as the API evolves, as of this writing allowed keys
* are: count, before_id, since_id, include_muted, include_deleted,
* include_directed_posts, and include_annotations.
* @return An array of associative arrays, each representing a single post.
*/
public function getUserPosts($user_id='me', $params = array()) {
return $this->httpReq('get',$this->_baseUrl.'users/'.urlencode($user_id)
.'/posts?'.$this->buildQueryString($params));
}
/**
* Get the most recent Posts mentioning by a specific User in reverse
* chronological order (newest first).
* @param mixed $user_id Either the ID of the user who is being mentioned, or
* the string "me", which will retrieve posts for the user you're authenticated
* as.
* @param array $params An associative array of optional general parameters.
* This will likely change as the API evolves, as of this writing allowed keys
* are: count, before_id, since_id, include_muted, include_deleted,
* include_directed_posts, and include_annotations.
* @return An array of associative arrays, each representing a single post.
*/
public function getUserMentions($user_id='me',$params = array()) {
return $this->httpReq('get',$this->_baseUrl.'users/'
.urlencode($user_id).'/mentions?'.$this->buildQueryString($params));
}
/**
* Return the 20 most recent posts from the current User and
* the Users they follow.
* @param array $params An associative array of optional general parameters.
* This will likely change as the API evolves, as of this writing allowed keys
* are: count, before_id, since_id, include_muted, include_deleted,
* include_directed_posts, and include_annotations.
* @return An array of associative arrays, each representing a single post.
*/
public function getUserStream($params = array()) {
return $this->httpReq('get',$this->_baseUrl.'posts/stream?'.$this->buildQueryString($params));
}
/**
* Returns a specific user object.
* @param mixed $user_id The ID of the user you want to retrieve, or the string
* "me" to retrieve data for the users you're currently authenticated as.
* @param array $params An associative array of optional general parameters.
* This will likely change as the API evolves, as of this writing allowed keys
* are: include_annotations|include_user_annotations.
* @return array An associative array representing the user data.
*/
public function getUser($user_id='me', $params = array()) {
return $this->httpReq('get',$this->_baseUrl.'users/'.urlencode($user_id)
.'?'.$this->buildQueryString($params));
}
/**
* Returns multiple users request by an array of user ids
* @param array $params An associative array of optional general parameters.
* This will likely change as the API evolves, as of this writing allowed keys
* are: include_annotations|include_user_annotations.
* @return array An associative array representing the users data.
*/
public function getUsers($user_arr, $params = array()) {
return $this->httpReq('get',$this->_baseUrl.'users?ids='.join(',',$user_arr)
.'&'.$this->buildQueryString($params));
}
/**
* Add the specified user ID to the list of users followed.
* Returns the User object of the user being followed.
* @param integer $user_id The user ID of the user to follow.
* @return array An associative array representing the user you just followed.
*/
public function followUser($user_id=null) {
return $this->httpReq('post',$this->_baseUrl.'users/'.urlencode($user_id).'/follow');
}
/**
* Removes the specified user ID to the list of users followed.
* Returns the User object of the user being unfollowed.
* @param integer $user_id The user ID of the user to unfollow.
* @return array An associative array representing the user you just unfollowed.
*/
public function unfollowUser($user_id=null) {
return $this->httpReq('delete',$this->_baseUrl.'users/'.urlencode($user_id).'/follow');
}
/**
* Returns an array of User objects the specified user is following.
* @param mixed $user_id Either the ID of the user being followed, or
* the string "me", which will retrieve posts for the user you're authenticated
* as.
* @return array An array of associative arrays, each representing a single
* user following $user_id
*/
public function getFollowing($user_id='me') {
return $this->httpReq('get',$this->_baseUrl.'users/'.$user_id.'/following');
}
/**
* Returns an array of User objects for users following the specified user.
* @param mixed $user_id Either the ID of the user being followed, or
* the string "me", which will retrieve posts for the user you're authenticated
* as.
* @return array An array of associative arrays, each representing a single
* user following $user_id
*/
public function getFollowers($user_id='me') {
return $this->httpReq('get',$this->_baseUrl.'users/'.$user_id.'/followers');
}
/**
* Return Posts matching a specific #hashtag.
* @param string $hashtag The hashtag you're looking for.
* @param array $params An associative array of optional general parameters.
* This will likely change as the API evolves, as of this writing allowed keys
* are: count, before_id, since_id, include_muted, include_deleted,
* include_directed_posts, and include_annotations.
* @return An array of associative arrays, each representing a single post.
*/
public function searchHashtags($hashtag=null, $params = array()) {
return $this->httpReq('get',$this->_baseUrl.'posts/tag/'
.urlencode($hashtag).'?'.$this->buildQueryString($params));
}
/**
* Retrieve a list of all public Posts on App.net, often referred to as the
* global stream.
* @param array $params An associative array of optional general parameters.
* This will likely change as the API evolves, as of this writing allowed keys
* are: count, before_id, since_id, include_muted, include_deleted,
* include_directed_posts, and include_annotations.
* @return An array of associative arrays, each representing a single post.
*/
public function getPublicPosts($params = array()) {
return $this->httpReq('get',$this->_baseUrl.'posts/stream/global?'.$this->buildQueryString($params));
}
/**
* List User interactions
*/
public function getMyInteractions($params = array()) {
return $this->httpReq('get',$this->_baseUrl.'users/me/interactions?'.$this->buildQueryString($params));
}
/**
* Retrieve a user's user ID by specifying their username.
* Now supported by the API. We use the API if we have a token
* Otherwise we scrape the alpha.app.net site for the info.
* @param string $username The username of the user you want the ID of, without
* an @ symbol at the beginning.
* @return integer The user's user ID
*/
public function getIdByUsername($username=null) {
if ($this->_accessToken) {
$res=$this->httpReq('get',$this->_baseUrl.'users/@'.$username);
$user_id=$res['data']['id'];
} else {
$ch = curl_init('https://alpha.app.net/'.urlencode(strtolower($username)));
curl_setopt($ch, CURLOPT_POST, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch,CURLOPT_USERAGENT,
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:7.0.1) Gecko/20100101 Firefox/7.0.1');
$response = curl_exec($ch);
curl_close($ch);
$temp = explode('title="User Id ',$response);
$temp2 = explode('"',$temp[1]);
$user_id = $temp2[0];
}
return $user_id;
}
/**
* Mute a user
* @param integer $user_id The user ID to mute
*/
public function muteUser($user_id=null) {
return $this->httpReq('post',$this->_baseUrl.'users/'.urlencode($user_id).'/mute');
}
/**
* Unmute a user
* @param integer $user_id The user ID to unmute
*/
public function unmuteUser($user_id=null) {
return $this->httpReq('delete',$this->_baseUrl.'users/'.urlencode($user_id).'/mute');
}
/**
* List the users muted by the current user
* @return array An array of associative arrays, each representing one muted user.
*/
public function getMuted() {
return $this->httpReq('get',$this->_baseUrl.'users/me/muted');
}
/**
* Star a post
* @param integer $post_id The post ID to star
*/
public function starPost($post_id=null) {
return $this->httpReq('post',$this->_baseUrl.'posts/'.urlencode($post_id).'/star');
}
/**
* Unstar a post
* @param integer $post_id The post ID to unstar
*/
public function unstarPost($post_id=null) {
return $this->httpReq('delete',$this->_baseUrl.'posts/'.urlencode($post_id).'/star');
}
/**
* List the posts starred by the current user
* @param array $params An associative array of optional general parameters.
* This will likely change as the API evolves, as of this writing allowed keys
* are: count, before_id, since_id, include_muted, include_deleted,
* include_directed_posts, and include_annotations.
* See https://github.com/appdotnet/api-spec/blob/master/resources/posts.md#general-parameters
* @return array An array of associative arrays, each representing a single
* user who has starred a post
*/
public function getStarred($user_id='me', $params = array()) {
return $this->httpReq('get',$this->_baseUrl.'users/'.urlencode($user_id).'/stars'
.'?'.$this->buildQueryString($params));
}
/**
* List the users who have starred a post
* @param integer $post_id the post ID to get stars from
* @return array An array of associative arrays, each representing one user.
*/
public function getStars($post_id=null) {
return $this->httpReq('get',$this->_baseUrl.'posts/'.urlencode($post_id).'/stars');
}
/**
* Returns an array of User objects of users who reposted the specified post.
* @param integer $post_id the post ID to
* @return array An array of associative arrays, each representing a single
* user who reposted $post_id
*/
public function getReposters($post_id){
return $this->httpReq('get',$this->_baseUrl.'posts/'.urlencode($post_id).'/reposters');
}
/**
* Repost an existing Post object.
* @param integer $post_id The id of the post
* @return not a clue
*/
public function repost($post_id){
return $this->httpReq('post',$this->_baseUrl.'posts/'.urlencode($post_id).'/repost');
}
/**
* Delete a post that the user has reposted.
* @param integer $post_id The id of the post
* @return not a clue
*/
public function deleteRepost($post_id){
return $this->httpReq('delete',$this->_baseUrl.'posts/'.urlencode($post_id).'/repost');
}
/**
* List the posts who match a specific search term
* @param array $params a list of filter, search query, and general Post parameters
* see: https://developers.app.net/reference/resources/post/search/
* @param string $query The search query. Supports
* normal search terms. Searches post text.
* @return array An array of associative arrays, each representing one post.
* or false on error
*/
public function searchPosts($params = array(), $query='', $order='default') {
if (!is_array($params)) {
return false;
}
if (!empty($query)) {
$params['query']=$query;
}
if ($order=='default') {
if (!empty($query)) {
$params['order']='score';
} else {
$params['order']='id';
}
}
return $this->httpReq('get',$this->_baseUrl.'posts/search?'.$this->buildQueryString($params));
}
/**
* List the users who match a specific search term
* @param string $search The search query. Supports @username or #tag searches as
* well as normal search terms. Searches username, display name, bio information.
* Does not search posts.
* @return array An array of associative arrays, each representing one user.
*/
public function searchUsers($search="") {
return $this->httpReq('get',$this->_baseUrl.'users/search?q='.urlencode($search));
}
/**
* Return the 20 most recent posts for a stream using a valid Token
* @param array $params An associative array of optional general parameters.
* This will likely change as the API evolves, as of this writing allowed keys
* are: count, before_id, since_id, include_muted, include_deleted,
* include_directed_posts, and include_annotations.
* @return An array of associative arrays, each representing a single post.
*/
public function getTokenStream($params = array()) {
if ($params['access_token']) {
return $this->httpReq('get',$this->_baseUrl.'posts/stream?'.$this->buildQueryString($params),$params);
} else {
return $this->httpReq('get',$this->_baseUrl.'posts/stream?'.$this->buildQueryString($params));
}
}
/**
* Get a user object by username
* @param string $name the @name to get
* @return array representing one user
*/
public function getUserByName($name=null) {
return $this->httpReq('get',$this->_baseUrl.'users/@'.$name);
}
/**
* Return the 20 most recent Posts from the current User's personalized stream
* and mentions stream merged into one stream.
* @param array $params An associative array of optional general parameters.
* This will likely change as the API evolves, as of this writing allowed keys
* are: count, before_id, since_id, include_muted, include_deleted,
* include_directed_posts, and include_annotations.
* @return An array of associative arrays, each representing a single post.
*/
public function getUserUnifiedStream($params = array()) {
return $this->httpReq('get',$this->_baseUrl.'posts/stream/unified?'.$this->buildQueryString($params));
}
/**
* Update Profile Data via JSON
* @data array containing user descriptors
*/
public function updateUserData($data = array(), $params = array()) {
$json = json_encode($data);
return $this->httpReq('put',$this->_baseUrl.'users/me'.'?'.
$this->buildQueryString($params), $json, 'application/json');
}
/**
* Update a user image
* @which avatar|cover
* @image path reference to image
*/
protected function updateUserImage($which = 'avatar', $image = null) {
$data = array($which=>"@$image");
return $this->httpReq('post-raw',$this->_baseUrl.'users/me/'.$which, $data, 'multipart/form-data');
}
public function updateUserAvatar($avatar = null) {
if($avatar != null)
return $this->updateUserImage('avatar', $avatar);
}
public function updateUserCover($cover = null) {
if($cover != null)
return $this->updateUserImage('cover', $cover);
}
/**
* update stream marker
*/
public function updateStreamMarker($data = array()) {
$json = json_encode($data);
return $this->httpReq('post',$this->_baseUrl.'posts/marker', $json, 'application/json');
}
/**
* get a page of current user subscribed channels
*/
public function getUserSubscriptions($params = array()) {
return $this->httpReq('get',$this->_baseUrl.'channels?'.$this->buildQueryString($params));
}
/**
* get user channels
*/
public function getMyChannels($params = array()) {
return $this->httpReq('get',$this->_baseUrl.'channels/me?'.$this->buildQueryString($params));
}
/**
* create a channel
* note: you cannot create a channel with type=net.app.core.pm (see createMessage)
*/
public function createChannel($data = array()) {
$json = json_encode($data);
return $this->httpReq('post',$this->_baseUrl.'channels'.($pm?'/pm/messsages':''), $json, 'application/json');
}
/**
* get channelid info
*/
public function getChannel($channelid, $params = array()) {
return $this->httpReq('get',$this->_baseUrl.'channels/'.$channelid.'?'.$this->buildQueryString($params));
}
/**
* get multiple channels' info by an array of channelids
*/
public function getChannels($channels, $params = array()) {
return $this->httpReq('get',$this->_baseUrl.'channels?ids='.join(',',$channels).'&'.$this->buildQueryString($params));
}
/**
* update channelid
*/
public function updateChannel($channelid, $data = array()) {
$json = json_encode($data);
return $this->httpReq('put',$this->_baseUrl.'channels/'.$channelid, $json, 'application/json');
}
/**
* subscribe from channelid
*/
public function channelSubscribe($channelid) {
return $this->httpReq('post',$this->_baseUrl.'channels/'.$channelid.'/subscribe');
}
/**
* unsubscribe from channelid
*/
public function channelUnsubscribe($channelid) {
return $this->httpReq('delete',$this->_baseUrl.'channels/'.$channelid.'/subscribe');
}
/**
* get all user objects subscribed to channelid
*/
public function getChannelSubscriptions($channelid, $params = array()) {
return $this->httpReq('get',$this->_baseUrl.'channel/'.$channelid.'/subscribers?'.$this->buildQueryString($params));
}
/**
* get all user IDs subscribed to channelid
*/
public function getChannelSubscriptionsById($channelid) {
return $this->httpReq('get',$this->_baseUrl.'channel/'.$channelid.'/subscribers/ids');
}
/**
* get a page of messages in channelid
*/
public function getMessages($channelid, $params = array()) {
return $this->httpReq('get',$this->_baseUrl.'channels/'.$channelid.'/messages?'.$this->buildQueryString($params));
}
/**
* create message
* @param $channelid numeric or "pm" for auto-chanenl (type=net.app.core.pm)
* @param $data array('text'=>'YOUR_MESSAGE') If a type=net.app.core.pm, then "destinations" key can be set to address as an array of people to send this PM too
*/
public function createMessage($channelid,$data) {
$json = json_encode($data);
return $this->httpReq('post',$this->_baseUrl.'channels/'.$channelid.'/messages', $json, 'application/json');
}
/**
* get message
*/
public function getMessage($channelid,$messageid) {
return $this->httpReq('get',$this->_baseUrl.'channels/'.$channelid.'/messages/'.$messageid);
}
/**
* delete messsage
*/
public function deleteMessage($channelid,$messageid) {
return $this->httpReq('delete',$this->_baseUrl.'channels/'.$channelid.'/messages/'.$messageid);
}
/**
* Get Application Information
*/
public function getAppTokenInfo() {
// requires appAccessToken
if (!$this->_appAccessToken) {
$this->getAppAccessToken();
}
// ensure request is made with our appAccessToken
$params['access_token']=$this->_appAccessToken;
return $this->httpReq('get',$this->_baseUrl.'token',$params);
}
/**
* Get User Information
*/
public function getUserTokenInfo() {
return $this->httpReq('get',$this->_baseUrl.'token');
}
/**
* Get Application Authorized User IDs
*/
public function getAppUserIDs() {
// requires appAccessToken
if (!$this->_appAccessToken) {
$this->getAppAccessToken();
}
// ensure request is made with our appAccessToken
$params['access_token']=$this->_appAccessToken;
return $this->httpReq('get',$this->_baseUrl.'apps/me/tokens/user_ids',$params);
}
/**
* Get Application Authorized User Tokens
*/
public function getAppUserTokens() {
// requires appAccessToken
if (!$this->_appAccessToken) {
$this->getAppAccessToken();
}
// ensure request is made with our appAccessToken
$params['access_token']=$this->_appAccessToken;
return $this->httpReq('get',$this->_baseUrl.'apps/me/tokens',$params);
}
public function getLastRequest() {
return $this->_last_request;
}
public function getLastResponse() {
return $this->_last_response;
}
/**
* Registers your function (or an array of object and method) to be called
* whenever an event is received via an open app.net stream. Your function
* will receive a single parameter, which is the object wrapper containing
* the meta and data.
* @param mixed A PHP callback (either a string containing the function name,
* or an array where the first element is the class/object and the second
* is the method).
*/
public function registerStreamFunction($function) {
$this->_streamCallback = $function;
}
/**
* Opens a stream that's been created for this user/app and starts sending
* events/objects to your defined callback functions. You must define at
* least one callback function before opening a stream.
* @param mixed $stream Either a stream ID or the endpoint of a stream
* you've already created. This stream must exist and must be valid for
* your current access token. If you pass a stream ID, the library will
* make an API call to get the endpoint.
*
* This function will return immediately, but your callback functions
* will continue to receive events until you call closeStream() or until
* App.net terminates the stream from their end with an error.
*
* If you're disconnected due to a network error, the library will
* automatically attempt to reconnect you to the same stream, no action
* on your part is necessary for this. However if the app.net API returns
* an error, a reconnection attempt will not be made.
*
* Note there is no closeStream, because once you open a stream you
* can't stop it (unless you exit() or die() or throw an uncaught
* exception, or something else that terminates the script).
* @return boolean True
* @see createStream()
*/
public function openStream($stream) {
// if there's already a stream running, don't allow another
if ($this->_currentStream) {
throw new AppDotNetException('There is already a stream being consumed, only one stream can be consumed per AppDotNetStream instance');
}
// must register a callback (or the exercise is pointless)
if (!$this->_streamCallback) {
throw new AppDotNetException('You must define your callback function using registerStreamFunction() before calling openStream');
}
// if the stream is a numeric value, get the stream info from the api
if (is_numeric($stream)) {
$stream = $this->getStream($stream);
$this->_streamUrl = $stream['endpoint'];
}
else {
$this->_streamUrl = $stream;
}
// continue doing this until we get an error back or something...?
$this->httpStream('get',$this->_streamUrl);
return true;
}
/**
* Close the currently open stream.
* @return true;
*/
public function closeStream() {
if (!$this->_lastStreamActivity) {
// never opened
return;
}
if (!$this->_multiStream) {
throw new AppDotNetException('You must open a stream before calling closeStream()');
}
curl_close($this->_currentStream);
curl_multi_remove_handle($this->_multiStream,$this->_currentStream);
curl_multi_close($this->_multiStream);
$this->_currentStream = null;
$this->_multiStream = null;
}
/**
* Retrieve all streams for the current access token.
* @return array An array of stream definitions.
*/
public function getAllStreams() {
return $this->httpReq('get',$this->_baseUrl.'streams');
}
/**
* Returns a single stream specified by a stream ID. The stream must have been
* created with the current access token.
* @return array A stream definition
*/
public function getStream($streamId) {
return $this->httpReq('get',$this->_baseUrl.'streams/'.urlencode($streamId));
}
/**
* Creates a stream for the current app access token.
*
* @param array $objectTypes The objects you want to retrieve data for from the
* stream. At time of writing these can be 'post', 'star', and/or 'user_follow'.
* If you don't specify, all events will be retrieved.
*/
public function createStream($objectTypes=null) {
// default object types to everything
if (is_null($objectTypes)) {
$objectTypes = array('post','star','user_follow');
}
$data = array(
'object_types'=>$objectTypes,
'type'=>'long_poll',
);
$data = json_encode($data);
$response = $this->httpReq('post',$this->_baseUrl.'streams',$data,'application/json');
return $response;
}
/**
* Update stream for the current app access token
*
* @param integer $streamId The stream ID to update. This stream must have been
* created by the current access token.
* @param array $data allows object_types, type, filter_id and key to be updated. filter_id/key can be omitted
*/
public function updateStream($streamId,$data) {
// objectTypes is likely required
if (is_null($data['object_types'])) {
$data['object_types'] = array('post','star','user_follow');
}
// type can still only be long_poll
if (is_null($data['type'])) {
$data['type']='long_poll';
}
$data = json_encode($data);
$response = $this->httpReq('put',$this->_baseUrl.'streams/'.urlencode($streamId),$data,'application/json');
return $response;
}
/**
* Deletes a stream if you no longer need it.
*
* @param integer $streamId The stream ID to delete. This stream must have been
* created by the current access token.
*/
public function deleteStream($streamId) {
return $this->httpReq('delete',$this->_baseUrl.'streams/'.urlencode($streamId));
}
/**
* Deletes all streams created by the current access token.
*/
public function deleteAllStreams() {
return $this->httpReq('delete',$this->_baseUrl.'streams');
}
/**
* Internal function used to process incoming chunks from the stream. This is only
* public because it needs to be accessed by CURL. Do not call or use this function
* in your own code.
* @ignore
*/
public function httpStreamReceive($ch,$data) {
$this->_lastStreamActivity = time();
$this->_streamBuffer .= $data;
if (!$this->_streamHeaders) {
$pos = strpos($this->_streamBuffer,"\r\n\r\n");
if ($pos!==false) {
$this->_streamHeaders = substr($this->_streamBuffer,0,$pos);
$this->_streamBuffer = substr($this->_streamBuffer,$pos+4);
}
}
else {
$pos = strpos($this->_streamBuffer,"\r\n");
while ($pos!==false) {
$command = substr($this->_streamBuffer,0,$pos);
$this->_streamBuffer = substr($this->_streamBuffer,$pos+2);
$command = json_decode($command,true);
if ($command) {
call_user_func($this->_streamCallback,$command);
}
$pos = strpos($this->_streamBuffer,"\r\n");
}
}
return strlen($data);
}
/**
* Opens a long lived HTTP connection to the app.net servers, and sends data
* received to the httpStreamReceive function. As a general rule you should not
* directly call this method, it's used by openStream().
*/
protected function httpStream($act, $req, $params=array(),$contentType='application/x-www-form-urlencoded') {
if ($this->_currentStream) {
throw new AppDotNetException('There is already an open stream, you must close the existing one before opening a new one');
}
$headers = array();
$this->_streamBuffer = '';
if ($this->_accessToken) {
$headers[] = 'Authorization: Bearer '.$this->_accessToken;
}
$this->_currentStream = curl_init($req);
curl_setopt($this->_currentStream, CURLOPT_HTTPHEADER, $headers);
curl_setopt($this->_currentStream, CURLOPT_RETURNTRANSFER, true);
curl_setopt($this->_currentStream, CURLINFO_HEADER_OUT, true);
curl_setopt($this->_currentStream, CURLOPT_HEADER, true);
if ($this->_sslCA) {
curl_setopt($this->_currentStream, CURLOPT_CAINFO, $this->_sslCA);
}
// every time we receive a chunk of data, forward it to httpStreamReceive
curl_setopt($this->_currentStream, CURLOPT_WRITEFUNCTION, array($this, "httpStreamReceive"));
// curl_exec($ch);
// return;
$this->_multiStream = curl_multi_init();
$this->_lastStreamActivity = time();
curl_multi_add_handle($this->_multiStream,$this->_currentStream);
}
public function reconnectStream() {
$this->closeStream();
$this->_connectFailCounter++;
// if we've failed a few times, back off
if ($this->_connectFailCounter>1) {
$sleepTime = pow(2,$this->_connectFailCounter);
// don't sleep more than 60 seconds
if ($sleepTime>60) {
$sleepTime = 60;
}
sleep($sleepTime);
}
$this->httpStream('get',$this->_streamUrl);
}
/**
* Process an open stream for x microseconds, then return. This is useful if you want
* to be doing other things while processing the stream. If you just want to
* consume the stream without other actions, you can call processForever() instead.
* @param float @microseconds The number of microseconds to process for before
* returning. There are 1,000,000 microseconds in a second.
*
* @return void
*/
public function processStream($microseconds=null) {
if (!$this->_multiStream) {
throw new AppDotNetException('You must open a stream before calling processStream()');
}
$start = microtime(true);
$active = null;
$inQueue = null;
$sleepFor = 0;
do {
// if we haven't received anything within 5.5 minutes, reconnect
// keepalives are sent every 5 minutes (measured on 2013-3-12 by @ryantharp)
if (time()-$this->_lastStreamActivity>=330) {
$this->reconnectStream();
}
curl_multi_exec($this->_multiStream, $active);
if (!$active) {
$httpCode = curl_getinfo($this->_currentStream,CURLINFO_HTTP_CODE);
// don't reconnect on 400 errors
if ($httpCode>=400 && $httpCode<=499) {
throw new AppDotNetException('Received HTTP error '.$httpCode.' check your URL and credentials before reconnecting');
}
$this->reconnectStream();
}
// sleep for a max of 2/10 of a second
$timeSoFar = (microtime(true)-$start)*1000000;
$sleepFor = $this->streamingSleepFor;
if ($timeSoFar+$sleepFor>$microseconds) {
$sleepFor = $microseconds - $timeSoFar;
}
if ($sleepFor>0) {
usleep($sleepFor);
}
} while ($timeSoFar+$sleepFor<$microseconds);
}
/**
* Process an open stream forever. This function will never return, if you
* want to perform other actions while consuming the stream, you should use
* processFor() instead.
* @return void This function will never return
* @see processFor();
*/
public function processStreamForever() {
while (true) {
$this->processStream(600);
}
}
/**
* Upload a file to a user's file store
* @param string $file A string containing the path of the file to upload.
* @param array $data Additional data about the file you're uploading. At the
* moment accepted keys are: mime-type, kind, type, name, public and annotations.
* - If you don't specify mime-type, ADNPHP will attempt to guess the mime type
* based on the file, however this isn't always reliable.
* - If you don't specify kind ADNPHP will attempt to determine if the file is
* an image or not.
* - If you don't specify name, ADNPHP will use the filename of the first
* parameter.
* - If you don't specify public, your file will be uploaded as a private file.
* - Type is REQUIRED.
* @param array $params An associative array of optional general parameters.
* This will likely change as the API evolves, as of this writing allowed keys
* are: include_annotations|include_file_annotations.
* @return array An associative array representing the file
*/
public function createFile($file, $data, $params=array()) {
if (!$file) {
throw new AppDotNetException('You must specify a path to a file');
}
if (!file_exists($file)) {
throw new AppDotNetException('File path specified does not exist');
}
if (!is_readable($file)) {
throw new AppDotNetException('File path specified is not readable');
}
if (!$data) {
$data = array();
}
if (!array_key_exists('type',$data) || !$data['type']) {
throw new AppDotNetException('Type is required when creating a file');
}
if (!array_key_exists('name',$data)) {
$data['name'] = basename($file);
}
if (array_key_exists('mime-type',$data)) {
$mimeType = $data['mime-type'];
unset($data['mime-type']);
}
else {
$mimeType = null;
}
if (!array_key_exists('kind',$data)) {
$test = @getimagesize($path);
if ($test && array_key_exists('mime',$test)) {
$data['kind'] = 'image';
if (!$mimeType) {
$mimeType = $test['mime'];
}
}
else {
$data['kind'] = 'other';
}
}
if (!$mimeType) {
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mimeType = finfo_file($finfo, $file);
finfo_close($finfo);
}
if (!$mimeType) {
throw new AppDotNetException('Unable to determine mime type of file, try specifying it explicitly');
}
if (!array_key_exists('public',$data) || !$data['public']) {
$public = false;
}
else {
$public = true;
}
$data['content'] = "@$file;type=$mimeType";
return $this->httpReq('post-raw',$this->_baseUrl.'files', $data, 'multipart/form-data');
}
public function createFilePlaceholder($file = null, $params=array()) {
$name = basename($file);
$data = array('annotations' => $params['annotations'], 'kind' => $params['kind'],
'name' => $name, 'type' => $params['metadata']);
$json = json_encode($data);
return $this->httpReq('post',$this->_baseUrl.'files', $json, 'application/json');
}
public function updateFileContent($fileid, $file) {
$data = file_get_contents($file);
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mime = finfo_file($finfo, $file);
finfo_close($finfo);
return $this->httpReq('put',$this->_baseUrl.'files/' . $fileid
.'/content', $data, $mime);
}
/**
* Allows for file rename and annotation changes.
* @param integer $file_id The ID of the file to update
* @param array $params An associative array of file parameters.
* @return array An associative array representing the updated file
*/
public function updateFile($file_id=null, $params=array()) {
$data = array('annotations' => $params['annotations'] , 'name' => $params['name']);
$json = json_encode($data);
return $this->httpReq('put',$this->_baseUrl.'files/'.urlencode($file_id), $json, 'application/json');
}
/**
* Returns a specific File.
* @param integer $file_id The ID of the file to retrieve
* @param array $params An associative array of optional general parameters.
* This will likely change as the API evolves, as of this writing allowed keys
* are: include_annotations|include_file_annotations.
* @return array An associative array representing the file
*/
public function getFile($file_id=null,$params = array()) {
return $this->httpReq('get',$this->_baseUrl.'files/'.urlencode($file_id)
.'?'.$this->buildQueryString($params));
}
public function getFileContent($file_id=null,$params = array()) {
return $this->httpReq('get',$this->_baseUrl.'files/'.urlencode($file_id)
.'/content?'.$this->buildQueryString($params));
}
/** $file_key : derived_file_key */
public function getDerivedFileContent($file_id=null,$file_key=null,$params = array()) {
return $this->httpReq('get',$this->_baseUrl.'files/'.urlencode($file_id)
.'/content/'.urlencode($file_key)
.'?'.$this->buildQueryString($params));
}
/**
* Returns file objects.
* @param array $file_ids The IDs of the files to retrieve
* @param array $params An associative array of optional general parameters.
* This will likely change as the API evolves, as of this writing allowed keys
* are: include_annotations|include_file_annotations.
* @return array An associative array representing the file data.
*/
public function getFiles($file_ids=array(), $params = array()) {
$ids = '';
foreach($file_ids as $id) {
$ids .= $id . ',';
}
$params['ids'] = substr($ids, 0, -1);
return $this->httpReq('get',$this->_baseUrl.'files'
.'?'.$this->buildQueryString($params));
}
/**
* Returns a user's file objects.
* @param array $params An associative array of optional general parameters.
* This will likely change as the API evolves, as of this writing allowed keys
* are: include_annotations|include_file_annotations|include_user_annotations.
* @return array An associative array representing the file data.
*/
public function getUserFiles($params = array()) {
return $this->httpReq('get',$this->_baseUrl.'users/me/files'
.'?'.$this->buildQueryString($params));
}
/**
* Delete a File. The current user must be the same user who created the File.
* It returns the deleted File on success.
* @param integer $file_id The ID of the file to delete
* @return array An associative array representing the file that was deleted
*/
public function deleteFile($file_id=null) {
return $this->httpReq('delete',$this->_baseUrl.'files/'.urlencode($file_id));
}
}
class AppDotNetException extends Exception {}

View file

@ -0,0 +1,23 @@
-----BEGIN CERTIFICATE-----
MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBs
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
d3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j
ZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAwMFoXDTMxMTExMDAwMDAwMFowbDEL
MAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3
LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFuY2Ug
RVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm
+9S75S0tMqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTW
PNt0OKRKzE0lgvdKpVMSOO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEM
xChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFB
Ik5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQNAQTXKFx01p8VdteZOE3
hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUeh10aUAsg
EsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQF
MAMBAf8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaA
FLE+w2kD+L9HAdSYJhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3Nec
nzyIZgYIVyHbIUf4KmeqvxgydkAQV8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6z
eM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFpmyPInngiK3BD41VHMWEZ71jF
hS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkKmNEVX58Svnw2
Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep
+OkuE6N36B9K
-----END CERTIFICATE-----

15
appnet/README.md Normal file
View file

@ -0,0 +1,15 @@
App.net Plugin
==============
With this addon to friendica you can give your users the possibility to post their *public* messages to App.net and
to import their timeline. The messages will be strapped their rich context and shortened to 256 characters length if
necessary.
Installation
------------
If you have an developer account you can create an Application for all of your users at
[https://account.app.net/developer/apps/](https://account.app.net/developer/apps/). Add the redirect uri
"https://your.server.name/appnet/connect" (Replace "your.server.name" with the hostname of your server)
If you can't create an application (because you only have a free account) this addon still works, but your users have to create individual applications on their own.

29
appnet/appnet.css Normal file
View file

@ -0,0 +1,29 @@
#appnet-import-label, #appnet-disconnect-label, #appnet-token-label,
#appnet-enable-label, #appnet-bydefault-label,
#appnet-clientid-label, #appnet-clientsecret-label {
float: left;
width: 200px;
margin-top: 10px;
}
#appnet-import, #appnet-disconnect, #appnet-token,
#appnet-checkbox, #appnet-bydefault,
#appnet-clientid, #appnet-clientsecret {
float: left;
margin-top: 10px;
}
#appnet-submit {
margin-top: 15px;
}
#appnet-avatar {
float: left;
width: 48px;
height: 48px;
padding: 2px;
}
#appnet-info-block {
height: 52px;
vertical-align: middle;
}

1358
appnet/appnet.php Normal file
View file

@ -0,0 +1,1358 @@
<?php
/**
* Name: App.net Connector
* Description: Bidirectional (posting and reading) connector for app.net.
* Version: 0.2
* Author: Michael Vogel <https://pirati.ca/profile/heluecht>
* Status: Unsupported
*/
/*
To-Do:
- Use embedded pictures for the attachment information (large attachment)
- Sound links must be handled
- https://alpha.app.net/sr_rolando/post/32365203 - double pictures
- https://alpha.app.net/opendev/post/34396399 - location data
*/
require_once('include/enotify.php');
require_once("include/socgraph.php");
define('APPNET_DEFAULT_POLL_INTERVAL', 5); // given in minutes
function appnet_install() {
register_hook('post_local', 'addon/appnet/appnet.php', 'appnet_post_local');
register_hook('notifier_normal', 'addon/appnet/appnet.php', 'appnet_send');
register_hook('jot_networks', 'addon/appnet/appnet.php', 'appnet_jot_nets');
register_hook('cron', 'addon/appnet/appnet.php', 'appnet_cron');
register_hook('connector_settings', 'addon/appnet/appnet.php', 'appnet_settings');
register_hook('connector_settings_post','addon/appnet/appnet.php', 'appnet_settings_post');
register_hook('prepare_body', 'addon/appnet/appnet.php', 'appnet_prepare_body');
register_hook('check_item_notification','addon/appnet/appnet.php', 'appnet_check_item_notification');
}
function appnet_uninstall() {
unregister_hook('post_local', 'addon/appnet/appnet.php', 'appnet_post_local');
unregister_hook('notifier_normal', 'addon/appnet/appnet.php', 'appnet_send');
unregister_hook('jot_networks', 'addon/appnet/appnet.php', 'appnet_jot_nets');
unregister_hook('cron', 'addon/appnet/appnet.php', 'appnet_cron');
unregister_hook('connector_settings', 'addon/appnet/appnet.php', 'appnet_settings');
unregister_hook('connector_settings_post', 'addon/appnet/appnet.php', 'appnet_settings_post');
unregister_hook('prepare_body', 'addon/appnet/appnet.php', 'appnet_prepare_body');
unregister_hook('check_item_notification','addon/appnet/appnet.php', 'appnet_check_item_notification');
}
function appnet_module() {}
function appnet_content(&$a) {
if(! local_user()) {
notice( t('Permission denied.') . EOL);
return '';
}
require_once("mod/settings.php");
settings_init($a);
if (isset($a->argv[1]))
switch ($a->argv[1]) {
case "connect":
$o = appnet_connect($a);
break;
default:
$o = print_r($a->argv, true);
break;
}
else
$o = appnet_connect($a);
return $o;
}
function appnet_check_item_notification($a, &$notification_data) {
$own_id = get_pconfig($notification_data["uid"], 'appnet', 'ownid');
$own_user = q("SELECT `url` FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
intval($notification_data["uid"]),
dbesc("adn::".$own_id)
);
if ($own_user)
$notification_data["profiles"][] = $own_user[0]["url"];
}
function appnet_plugin_admin(&$a, &$o){
$t = get_markup_template( "admin.tpl", "addon/appnet/" );
$o = replace_macros($t, array(
'$submit' => t('Save Settings'),
// name, label, value, help, [extra values]
'$clientid' => array('clientid', t('Client ID'), get_config('appnet', 'clientid' ), ''),
'$clientsecret' => array('clientsecret', t('Client Secret'), get_config('appnet', 'clientsecret' ), ''),
));
}
function appnet_plugin_admin_post(&$a){
$clientid = ((x($_POST,'clientid')) ? notags(trim($_POST['clientid'])) : '');
$clientsecret = ((x($_POST,'clientsecret')) ? notags(trim($_POST['clientsecret'])): '');
set_config('appnet','clientid',$clientid);
set_config('appnet','clientsecret',$clientsecret);
info( t('Settings updated.'). EOL );
}
function appnet_connect(&$a) {
require_once 'addon/appnet/AppDotNet.php';
$clientId = get_config('appnet','clientid');
$clientSecret = get_config('appnet','clientsecret');
if (($clientId == "") || ($clientSecret == "")) {
$clientId = get_pconfig(local_user(),'appnet','clientid');
$clientSecret = get_pconfig(local_user(),'appnet','clientsecret');
}
$app = new AppDotNet($clientId, $clientSecret);
try {
$token = $app->getAccessToken($a->get_baseurl().'/appnet/connect');
logger("appnet_connect: authenticated");
$o .= t("You are now authenticated to app.net. ");
set_pconfig(local_user(),'appnet','token', $token);
}
catch (AppDotNetException $e) {
$o .= t("<p>Error fetching token. Please try again.</p>");
}
$o .= '<br /><a href="'.$a->get_baseurl().'/settings/connectors">'.t("return to the connector page").'</a>';
return($o);
}
function appnet_jot_nets(&$a,&$b) {
if(! local_user())
return;
$post = get_pconfig(local_user(),'appnet','post');
if(intval($post) == 1) {
$defpost = get_pconfig(local_user(),'appnet','post_by_default');
$selected = ((intval($defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="appnet_enable"' . $selected . ' value="1" /> '
. t('Post to app.net') . '</div>';
}
}
function appnet_settings(&$a,&$s) {
require_once 'addon/appnet/AppDotNet.php';
if(! local_user())
return;
$token = get_pconfig(local_user(),'appnet','token');
$app_clientId = get_config('appnet','clientid');
$app_clientSecret = get_config('appnet','clientsecret');
if (($app_clientId == "") || ($app_clientSecret == "")) {
$app_clientId = get_pconfig(local_user(),'appnet','clientid');
$app_clientSecret = get_pconfig(local_user(),'appnet','clientsecret');
}
/* Add our stylesheet to the page so we can make our settings look nice */
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/appnet/appnet.css' . '" media="all" />' . "\r\n";
$enabled = get_pconfig(local_user(),'appnet','post');
$checked = (($enabled) ? ' checked="checked" ' : '');
$css = (($enabled) ? '' : '-disabled');
$def_enabled = get_pconfig(local_user(),'appnet','post_by_default');
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
$importenabled = get_pconfig(local_user(),'appnet','import');
$importchecked = (($importenabled) ? ' checked="checked" ' : '');
$ownid = get_pconfig(local_user(),'appnet','ownid');
$s .= '<span id="settings_appnet_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_appnet_expanded\'); openClose(\'settings_appnet_inflated\');">';
$s .= '<img class="connector'.$css.'" src="images/appnet.png" /><h3 class="connector">'. t('App.net Import/Export').'</h3>';
$s .= '</span>';
$s .= '<div id="settings_appnet_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_appnet_expanded\'); openClose(\'settings_appnet_inflated\');">';
$s .= '<img class="connector'.$css.'" src="images/appnet.png" /><h3 class="connector">'. t('App.net Import/Export').'</h3>';
$s .= '</span>';
if ($token != "") {
$app = new AppDotNet($app_clientId, $app_clientSecret);
$app->setAccessToken($token);
try {
$userdata = $app->getUser();
if ($ownid != $userdata["id"])
set_pconfig(local_user(),'appnet','ownid', $userdata["id"]);
$s .= '<div id="appnet-info" ><img id="appnet-avatar" src="'.$userdata["avatar_image"]["url"].'" /><p id="appnet-info-block">'. t('Currently connected to: ') .'<a href="'.$userdata["canonical_url"].'" target="_appnet">'.$userdata["username"].'</a><br /><em>'.$userdata["description"]["text"].'</em></p></div>';
$s .= '<div id="appnet-enable-wrapper">';
$s .= '<label id="appnet-enable-label" for="appnet-checkbox">' . t('Enable App.net Post Plugin') . '</label>';
$s .= '<input id="appnet-checkbox" type="checkbox" name="appnet" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="appnet-bydefault-wrapper">';
$s .= '<label id="appnet-bydefault-label" for="appnet-bydefault">' . t('Post to App.net by default') . '</label>';
$s .= '<input id="appnet-bydefault" type="checkbox" name="appnet_bydefault" value="1" ' . $def_checked . '/>';
$s .= '</div><div class="clear"></div>';
$s .= '<label id="appnet-import-label" for="appnet-import">'.t('Import the remote timeline').'</label>';
$s .= '<input id="appnet-import" type="checkbox" name="appnet_import" value="1" '. $importchecked . '/>';
$s .= '<div class="clear"></div>';
}
catch (AppDotNetException $e) {
$s .= t("<p>Error fetching user profile. Please clear the configuration and try again.</p>");
}
} elseif (($app_clientId == '') || ($app_clientSecret == '')) {
$s .= t("<p>You have two ways to connect to App.net.</p>");
$s .= "<hr />";
$s .= t('<p>First way: Register an application at <a href="https://account.app.net/developer/apps/">https://account.app.net/developer/apps/</a> and enter Client ID and Client Secret. ');
$s .= sprintf(t("Use '%s' as Redirect URI<p>"), $a->get_baseurl().'/appnet/connect');
$s .= '<div id="appnet-clientid-wrapper">';
$s .= '<label id="appnet-clientid-label" for="appnet-clientid">' . t('Client ID') . '</label>';
$s .= '<input id="appnet-clientid" type="text" name="clientid" value="" />';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="appnet-clientsecret-wrapper">';
$s .= '<label id="appnet-clientsecret-label" for="appnet-clientsecret">' . t('Client Secret') . '</label>';
$s .= '<input id="appnet-clientsecret" type="text" name="clientsecret" value="" />';
$s .= '</div><div class="clear"></div>';
$s .= "<hr />";
$s .= t('<p>Second way: fetch a token at <a href="http://dev-lite.jonathonduerig.com/">http://dev-lite.jonathonduerig.com/</a>. ');
$s .= t("Set these scopes: 'Basic', 'Stream', 'Write Post', 'Public Messages', 'Messages'.</p>");
$s .= '<div id="appnet-token-wrapper">';
$s .= '<label id="appnet-token-label" for="appnet-token">' . t('Token') . '</label>';
$s .= '<input id="appnet-token" type="text" name="token" value="'.$token.'" />';
$s .= '</div><div class="clear"></div>';
} else {
$app = new AppDotNet($app_clientId, $app_clientSecret);
$scope = array('basic', 'stream', 'write_post',
'public_messages', 'messages');
$url = $app->getAuthUrl($a->get_baseurl().'/appnet/connect', $scope);
$s .= '<div class="clear"></div>';
$s .= '<a href="'.$url.'">'.t("Sign in using App.net").'</a>';
}
if (($app_clientId != '') || ($app_clientSecret != '') || ($token !='')) {
$s .= '<div id="appnet-disconnect-wrapper">';
$s .= '<label id="appnet-disconnect-label" for="appnet-disconnect">'. t('Clear OAuth configuration') .'</label>';
$s .= '<input id="appnet-disconnect" type="checkbox" name="appnet-disconnect" value="1" />';
$s .= '</div><div class="clear"></div>';
}
/* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="appnet-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div>';
$s .= '</div>';
}
function appnet_settings_post(&$a,&$b) {
if(x($_POST,'appnet-submit')) {
if (isset($_POST['appnet-disconnect'])) {
del_pconfig(local_user(), 'appnet', 'clientsecret');
del_pconfig(local_user(), 'appnet', 'clientid');
del_pconfig(local_user(), 'appnet', 'token');
del_pconfig(local_user(), 'appnet', 'post');
del_pconfig(local_user(), 'appnet', 'post_by_default');
del_pconfig(local_user(), 'appnet', 'import');
}
if (isset($_POST["clientsecret"]))
set_pconfig(local_user(),'appnet','clientsecret', $_POST['clientsecret']);
if (isset($_POST["clientid"]))
set_pconfig(local_user(),'appnet','clientid', $_POST['clientid']);
if (isset($_POST["token"]) && ($_POST["token"] != ""))
set_pconfig(local_user(),'appnet','token', $_POST['token']);
set_pconfig(local_user(), 'appnet', 'post', intval($_POST['appnet']));
set_pconfig(local_user(), 'appnet', 'post_by_default', intval($_POST['appnet_bydefault']));
set_pconfig(local_user(), 'appnet', 'import', intval($_POST['appnet_import']));
}
}
function appnet_post_local(&$a,&$b) {
if($b['edit'])
return;
if((local_user()) && (local_user() == $b['uid']) && (!$b['private']) && (!$b['parent'])) {
$appnet_post = intval(get_pconfig(local_user(),'appnet','post'));
$appnet_enable = (($appnet_post && x($_REQUEST,'appnet_enable')) ? intval($_REQUEST['appnet_enable']) : 0);
// if API is used, default to the chosen settings
if($b['api_source'] && intval(get_pconfig(local_user(),'appnet','post_by_default')))
$appnet_enable = 1;
if(! $appnet_enable)
return;
if(strlen($b['postopts']))
$b['postopts'] .= ',';
$b['postopts'] .= 'appnet';
}
}
function appnet_create_entities($a, $b, $postdata) {
require_once("include/bbcode.php");
require_once("include/plaintext.php");
$bbcode = $b["body"];
$bbcode = bb_remove_share_information($bbcode, false, true);
// Change pure links in text to bbcode uris
$bbcode = preg_replace("/([^\]\='".'"'."]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1[url=$2]$2[/url]', $bbcode);
$URLSearchString = "^\[\]";
$bbcode = preg_replace("/#\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",'#$2',$bbcode);
$bbcode = preg_replace("/@\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",'@$2',$bbcode);
$bbcode = preg_replace("/\[bookmark\=([$URLSearchString]*)\](.*?)\[\/bookmark\]/ism",'[url=$1]$2[/url]',$bbcode);
$bbcode = preg_replace("/\[video\](.*?)\[\/video\]/ism",'[url=$1]$1[/url]',$bbcode);
$bbcode = preg_replace("/\[youtube\]https?:\/\/(.*?)\[\/youtube\]/ism",'[url=https://$1]https://$1[/url]',$bbcode);
$bbcode = preg_replace("/\[youtube\]([A-Za-z0-9\-_=]+)(.*?)\[\/youtube\]/ism",
'[url=https://www.youtube.com/watch?v=$1]https://www.youtube.com/watch?v=$1[/url]', $bbcode);
$bbcode = preg_replace("/\[vimeo\]https?:\/\/(.*?)\[\/vimeo\]/ism",'[url=https://$1]https://$1[/url]',$bbcode);
$bbcode = preg_replace("/\[vimeo\]([0-9]+)(.*?)\[\/vimeo\]/ism",
'[url=https://vimeo.com/$1]https://vimeo.com/$1[/url]', $bbcode);
//$bbcode = preg_replace("/\[vimeo\](.*?)\[\/vimeo\]/ism",'[url=$1]$1[/url]',$bbcode);
$bbcode = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '[img]$3[/img]', $bbcode);
preg_match_all("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", $bbcode, $urls, PREG_SET_ORDER);
$bbcode = preg_replace("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",'$1',$bbcode);
$b["body"] = $bbcode;
// To-Do:
// Bilder
// https://alpha.app.net/heluecht/post/32424376
// https://alpha.app.net/heluecht/post/32424307
$plaintext = plaintext($a, $b, 0, false, 6);
$text = $plaintext["text"];
$start = 0;
$entities = array();
foreach ($urls AS $url) {
$lenurl = iconv_strlen($url[1], "UTF-8");
$len = iconv_strlen($url[2], "UTF-8");
$pos = iconv_strpos($text, $url[1], $start, "UTF-8");
$pre = iconv_substr($text, 0, $pos, "UTF-8");
$post = iconv_substr($text, $pos + $lenurl, 1000000, "UTF-8");
$mid = $url[2];
$html = bbcode($mid, false, false, 6);
$mid = html2plain($html, 0, true);
$mid = trim(html_entity_decode($mid,ENT_QUOTES,'UTF-8'));
$text = $pre.$mid.$post;
if ($mid != "")
$entities[] = array("pos" => $pos, "len" => $len, "url" => $url[1], "text" => $mid);
$start = $pos + 1;
}
if (isset($postdata["url"]) && isset($postdata["title"]) && ($postdata["type"] != "photo")) {
$postdata["title"] = shortenmsg($postdata["title"], 90);
$max = 256 - strlen($postdata["title"]);
$text = shortenmsg($text, $max);
$text .= "\n[".$postdata["title"]."](".$postdata["url"].")";
} elseif (isset($postdata["url"]) && ($postdata["type"] != "photo")) {
$postdata["url"] = short_link($postdata["url"]);
$max = 240;
$text = shortenmsg($text, $max);
$text .= " [".$postdata["url"]."](".$postdata["url"].")";
} else {
$max = 256;
$text = shortenmsg($text, $max);
}
if (iconv_strlen($text, "UTF-8") < $max)
$max = iconv_strlen($text, "UTF-8");
krsort($entities);
foreach ($entities AS $entity) {
//if (iconv_strlen($text, "UTF-8") >= $entity["pos"] + $entity["len"]) {
if (($entity["pos"] + $entity["len"]) <= $max) {
$pre = iconv_substr($text, 0, $entity["pos"], "UTF-8");
$post = iconv_substr($text, $entity["pos"] + $entity["len"], 1000000, "UTF-8");
$text = $pre."[".$entity["text"]."](".$entity["url"].")".$post;
}
}
return($text);
}
function appnet_send(&$a,&$b) {
logger('appnet_send: invoked for post '.$b['id']." ".$b['app']);
if (!get_pconfig($b["uid"],'appnet','import')) {
if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
return;
}
if($b['parent'] != $b['id']) {
logger("appnet_send: parameter ".print_r($b, true), LOGGER_DATA);
// Looking if its a reply to an app.net post
if ((substr($b["parent-uri"], 0, 5) != "adn::") && (substr($b["extid"], 0, 5) != "adn::") && (substr($b["thr-parent"], 0, 5) != "adn::")) {
logger("appnet_send: no app.net post ".$b["parent"]);
return;
}
$r = q("SELECT * FROM item WHERE item.uri = '%s' AND item.uid = %d LIMIT 1",
dbesc($b["thr-parent"]),
intval($b["uid"]));
if(!count($r)) {
logger("appnet_send: no parent found ".$b["thr-parent"]);
return;
} else {
$iscomment = true;
$orig_post = $r[0];
}
$nicknameplain = preg_replace("=https?://alpha.app.net/(.*)=ism", "$1", $orig_post["author-link"]);
$nickname = "@[url=".$orig_post["author-link"]."]".$nicknameplain."[/url]";
$nicknameplain = "@".$nicknameplain;
logger("appnet_send: comparing ".$nickname." and ".$nicknameplain." with ".$b["body"], LOGGER_DEBUG);
if ((strpos($b["body"], $nickname) === false) && (strpos($b["body"], $nicknameplain) === false))
$b["body"] = $nickname." ".$b["body"];
logger("appnet_send: parent found ".print_r($orig_post, true), LOGGER_DATA);
} else {
$iscomment = false;
if($b['private'] || !strstr($b['postopts'],'appnet'))
return;
}
if (($b['verb'] == ACTIVITY_POST) && $b['deleted'])
appnet_action($a, $b["uid"], substr($orig_post["uri"], 5), "delete");
if($b['verb'] == ACTIVITY_LIKE) {
logger("appnet_send: ".print_r($b, true), LOGGER_DEBUG);
logger("appnet_send: parameter 2 ".substr($b["thr-parent"], 5), LOGGER_DEBUG);
if ($b['deleted'])
appnet_action($a, $b["uid"], substr($b["thr-parent"], 5), "unlike");
else
appnet_action($a, $b["uid"], substr($b["thr-parent"], 5), "like");
return;
}
if($b['deleted'] || ($b['created'] !== $b['edited']))
return;
$token = get_pconfig($b['uid'],'appnet','token');
if($token) {
// If it's a repeated message from app.net then do a native repost and exit
if (appnet_is_repost($a, $b['uid'], $b['body']))
return;
require_once 'addon/appnet/AppDotNet.php';
$clientId = get_pconfig($b["uid"],'appnet','clientid');
$clientSecret = get_pconfig($b["uid"],'appnet','clientsecret');
$app = new AppDotNet($clientId, $clientSecret);
$app->setAccessToken($token);
$data = array();
require_once("include/plaintext.php");
require_once("include/network.php");
$post = plaintext($a, $b, 256, false, 6);
logger("appnet_send: converted message ".$b["id"]." result: ".print_r($post, true), LOGGER_DEBUG);
if (isset($post["image"])) {
$img_str = fetch_url($post['image'],true, $redirects, 10);
$tempfile = tempnam(get_temppath(), "cache");
file_put_contents($tempfile, $img_str);
try {
$photoFile = $app->createFile($tempfile, array(type => "com.github.jdolitsky.appdotnetphp.photo"));
$data["annotations"][] = array(
"type" => "net.app.core.oembed",
"value" => array(
"+net.app.core.file" => array(
"file_id" => $photoFile["id"],
"file_token" => $photoFile["file_token"],
"format" => "oembed")
)
);
}
catch (AppDotNetException $e) {
logger("appnet_send: Error creating file ".appnet_error($e->getMessage()));
}
unlink($tempfile);
}
// Adding a link to the original post, if it is a root post
if($b['parent'] == $b['id'])
$data["annotations"][] = array(
"type" => "net.app.core.crosspost",
"value" => array("canonical_url" => $b["plink"])
);
// Adding the original post
$attached_data = get_attached_data($b["body"]);
$attached_data["post-uri"] = $b["uri"];
$attached_data["post-title"] = $b["title"];
$attached_data["post-body"] = substr($b["body"], 0, 4000); // To-Do: Better shortening
$attached_data["post-tag"] = $b["tag"];
$attached_data["author-name"] = $b["author-name"];
$attached_data["author-link"] = $b["author-link"];
$attached_data["author-avatar"] = $b["author-avatar"];
$data["annotations"][] = array(
"type" => "com.friendica.post",
"value" => $attached_data
);
if (isset($post["url"]) && !isset($post["title"]) && ($post["type"] != "photo")) {
$display_url = str_replace(array("http://www.", "https://www."), array("", ""), $post["url"]);
$display_url = str_replace(array("http://", "https://"), array("", ""), $display_url);
if (strlen($display_url) > 26)
$display_url = substr($display_url, 0, 25)."";
$post["title"] = $display_url;
}
$text = appnet_create_entities($a, $b, $post);
$data["entities"]["parse_markdown_links"] = true;
if ($iscomment)
$data["reply_to"] = substr($orig_post["uri"], 5);
try {
logger("appnet_send: sending message ".$b["id"]." ".$text." ".print_r($data, true), LOGGER_DEBUG);
$ret = $app->createPost($text, $data);
logger("appnet_send: send message ".$b["id"]." result: ".print_r($ret, true), LOGGER_DEBUG);
if ($iscomment) {
logger('appnet_send: Update extid '.$ret["id"]." for post id ".$b['id']);
q("UPDATE `item` SET `extid` = '%s' WHERE `id` = %d",
dbesc("adn::".$ret["id"]),
intval($b['id'])
);
}
}
catch (AppDotNetException $e) {
logger("appnet_send: Error sending message ".$b["id"]." ".appnet_error($e->getMessage()));
}
}
}
function appnet_action($a, $uid, $pid, $action) {
require_once 'addon/appnet/AppDotNet.php';
$token = get_pconfig($uid,'appnet','token');
$clientId = get_pconfig($uid,'appnet','clientid');
$clientSecret = get_pconfig($uid,'appnet','clientsecret');
$app = new AppDotNet($clientId, $clientSecret);
$app->setAccessToken($token);
logger("appnet_action '".$action."' ID: ".$pid, LOGGER_DATA);
try {
switch ($action) {
case "delete":
$result = $app->deletePost($pid);
break;
case "like":
$result = $app->starPost($pid);
break;
case "unlike":
$result = $app->unstarPost($pid);
break;
}
logger("appnet_action '".$action."' send, result: " . print_r($result, true), LOGGER_DEBUG);
}
catch (AppDotNetException $e) {
logger("appnet_action: Error sending action ".$action." pid ".$pid." ".appnet_error($e->getMessage()), LOGGER_DEBUG);
}
}
function appnet_is_repost($a, $uid, $body) {
$body = trim($body);
// Skip if it isn't a pure repeated messages
// Does it start with a share?
if (strpos($body, "[share") > 0)
return(false);
// Does it end with a share?
if (strlen($body) > (strrpos($body, "[/share]") + 8))
return(false);
$attributes = preg_replace("/\[share(.*?)\]\s?(.*?)\s?\[\/share\]\s?/ism","$1",$body);
// Skip if there is no shared message in there
if ($body == $attributes)
return(false);
$link = "";
preg_match("/link='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "")
$link = $matches[1];
preg_match('/link="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "")
$link = $matches[1];
$id = preg_replace("=https?://alpha.app.net/(.*)/post/(.*)=ism", "$2", $link);
if ($id == $link)
return(false);
logger('appnet_is_repost: Reposting id '.$id.' for user '.$uid, LOGGER_DEBUG);
require_once 'addon/appnet/AppDotNet.php';
$token = get_pconfig($uid,'appnet','token');
$clientId = get_pconfig($uid,'appnet','clientid');
$clientSecret = get_pconfig($uid,'appnet','clientsecret');
$app = new AppDotNet($clientId, $clientSecret);
$app->setAccessToken($token);
try {
$result = $app->repost($id);
logger('appnet_is_repost: result '.print_r($result, true), LOGGER_DEBUG);
return true;
}
catch (AppDotNetException $e) {
logger('appnet_is_repost: error doing repost '.appnet_error($e->getMessage()), LOGGER_DEBUG);
return false;
}
}
function appnet_fetchstream($a, $uid) {
require_once("addon/appnet/AppDotNet.php");
require_once('include/items.php');
$token = get_pconfig($uid,'appnet','token');
$clientId = get_pconfig($uid,'appnet','clientid');
$clientSecret = get_pconfig($uid,'appnet','clientsecret');
$app = new AppDotNet($clientId, $clientSecret);
$app->setAccessToken($token);
$r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
intval($uid));
if(count($r))
$me = $r[0];
else {
logger("appnet_fetchstream: Own contact not found for user ".$uid, LOGGER_DEBUG);
return;
}
$user = q("SELECT * FROM `user` WHERE `uid` = %d AND `account_expired` = 0 LIMIT 1",
intval($uid)
);
if(count($user))
$user = $user[0];
else {
logger("appnet_fetchstream: Own user not found for user ".$uid, LOGGER_DEBUG);
return;
}
$ownid = get_pconfig($uid,'appnet','ownid');
// Fetch stream
$param = array("count" => 200, "include_deleted" => false, "include_directed_posts" => true,
"include_html" => false, "include_post_annotations" => true);
$lastid = get_pconfig($uid, 'appnet', 'laststreamid');
if ($lastid <> "")
$param["since_id"] = $lastid;
try {
$stream = $app->getUserStream($param);
}
catch (AppDotNetException $e) {
logger("appnet_fetchstream: Error fetching stream for user ".$uid." ".appnet_error($e->getMessage()));
return;
}
if (!is_array($stream))
$stream = array();
$stream = array_reverse($stream);
foreach ($stream AS $post) {
$postarray = appnet_createpost($a, $uid, $post, $me, $user, $ownid, true);
$item = item_store($postarray);
$postarray["id"] = $item;
logger('appnet_fetchstream: User '.$uid.' posted stream item '.$item);
$lastid = $post["id"];
if (($item != 0) && ($postarray['contact-id'] != $me["id"]) && !function_exists("check_item_notification")) {
$r = q("SELECT `thread`.`iid` AS `parent` FROM `thread`
INNER JOIN `item` ON `thread`.`iid` = `item`.`parent` AND `thread`.`uid` = `item`.`uid`
WHERE `item`.`id` = %d AND `thread`.`mention` LIMIT 1", dbesc($item));
if (count($r)) {
require_once('include/enotify.php');
notification(array(
'type' => NOTIFY_COMMENT,
'notify_flags' => $user['notify-flags'],
'language' => $user['language'],
'to_name' => $user['username'],
'to_email' => $user['email'],
'uid' => $user['uid'],
'item' => $postarray,
'link' => $a->get_baseurl().'/display/'.urlencode(get_item_guid($item)),
'source_name' => $postarray['author-name'],
'source_link' => $postarray['author-link'],
'source_photo' => $postarray['author-avatar'],
'verb' => ACTIVITY_POST,
'otype' => 'item',
'parent' => $r[0]["parent"],
));
}
}
}
set_pconfig($uid, 'appnet', 'laststreamid', $lastid);
// Fetch mentions
$param = array("count" => 200, "include_deleted" => false, "include_directed_posts" => true,
"include_html" => false, "include_post_annotations" => true);
$lastid = get_pconfig($uid, 'appnet', 'lastmentionid');
if ($lastid <> "")
$param["since_id"] = $lastid;
try {
$mentions = $app->getUserMentions("me", $param);
}
catch (AppDotNetException $e) {
logger("appnet_fetchstream: Error fetching mentions for user ".$uid." ".appnet_error($e->getMessage()));
return;
}
if (!is_array($mentions))
$mentions = array();
$mentions = array_reverse($mentions);
foreach ($mentions AS $post) {
$postarray = appnet_createpost($a, $uid, $post, $me, $user, $ownid, false);
if (isset($postarray["id"])) {
$item = $postarray["id"];
$parent_id = $postarray['parent'];
} elseif (isset($postarray["body"])) {
$item = item_store($postarray);
$postarray["id"] = $item;
$parent_id = 0;
logger('appnet_fetchstream: User '.$uid.' posted mention item '.$item);
if ($item && function_exists("check_item_notification"))
check_item_notification($item, $uid, NOTIFY_TAGSELF);
} else {
$item = 0;
$parent_id = 0;
}
// Fetch the parent and id
if (($parent_id == 0) && ($postarray['uri'] != "")) {
$r = q("SELECT `id`, `parent` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($postarray['uri']),
intval($uid)
);
if (count($r)) {
$item = $r[0]['id'];
$parent_id = $r[0]['parent'];
}
}
$lastid = $post["id"];
//if (($item != 0) && ($postarray['contact-id'] != $me["id"])) {
if (($item != 0) && !function_exists("check_item_notification")) {
require_once('include/enotify.php');
notification(array(
'type' => NOTIFY_TAGSELF,
'notify_flags' => $user['notify-flags'],
'language' => $user['language'],
'to_name' => $user['username'],
'to_email' => $user['email'],
'uid' => $user['uid'],
'item' => $postarray,
'link' => $a->get_baseurl().'/display/'.urlencode(get_item_guid($item)),
'source_name' => $postarray['author-name'],
'source_link' => $postarray['author-link'],
'source_photo' => $postarray['author-avatar'],
'verb' => ACTIVITY_TAG,
'otype' => 'item',
'parent' => $parent_id,
));
}
}
set_pconfig($uid, 'appnet', 'lastmentionid', $lastid);
/* To-Do
$param = array("interaction_actions" => "star");
$interactions = $app->getMyInteractions($param);
foreach ($interactions AS $interaction)
appnet_dolike($a, $uid, $interaction);
*/
}
function appnet_createpost($a, $uid, $post, $me, $user, $ownid, $createuser, $threadcompletion = true, $nodupcheck = false) {
require_once('include/items.php');
if ($post["machine_only"])
return;
if ($post["is_deleted"])
return;
$postarray = array();
$postarray['gravity'] = 0;
$postarray['uid'] = $uid;
$postarray['wall'] = 0;
$postarray['verb'] = ACTIVITY_POST;
$postarray['network'] = dbesc(NETWORK_APPNET);
if (is_array($post["repost_of"])) {
// You can't reply to reposts. So use the original id and thread-id
$postarray['uri'] = "adn::".$post["repost_of"]["id"];
$postarray['parent-uri'] = "adn::".$post["repost_of"]["thread_id"];
} else {
$postarray['uri'] = "adn::".$post["id"];
$postarray['parent-uri'] = "adn::".$post["thread_id"];
}
if (!$nodupcheck) {
$r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($postarray['uri']),
intval($uid)
);
if (count($r))
return($r[0]);
$r = q("SELECT * FROM `item` WHERE `extid` = '%s' AND `uid` = %d LIMIT 1",
dbesc($postarray['uri']),
intval($uid)
);
if (count($r))
return($r[0]);
}
if (isset($post["reply_to"]) && ($post["reply_to"] != "")) {
$postarray['thr-parent'] = "adn::".$post["reply_to"];
// Complete the thread (if the parent doesn't exists)
if ($threadcompletion) {
//$r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
// dbesc($postarray['thr-parent']),
// intval($uid)
// );
//if (!count($r)) {
logger("appnet_createpost: completing thread ".$post["thread_id"]." for user ".$uid, LOGGER_DEBUG);
require_once("addon/appnet/AppDotNet.php");
$token = get_pconfig($uid,'appnet','token');
$clientId = get_pconfig($uid,'appnet','clientid');
$clientSecret = get_pconfig($uid,'appnet','clientsecret');
$app = new AppDotNet($clientId, $clientSecret);
$app->setAccessToken($token);
$param = array("count" => 200, "include_deleted" => false, "include_directed_posts" => true,
"include_html" => false, "include_post_annotations" => true);
try {
$thread = $app->getPostReplies($post["thread_id"], $param);
}
catch (AppDotNetException $e) {
logger("appnet_createpost: Error fetching thread for user ".$uid." ".appnet_error($e->getMessage()));
}
$thread = array_reverse($thread);
logger("appnet_createpost: fetched ".count($thread)." items for thread ".$post["thread_id"]." for user ".$uid, LOGGER_DEBUG);
foreach ($thread AS $tpost) {
$threadpost = appnet_createpost($a, $uid, $tpost, $me, $user, $ownid, false, false);
$item = item_store($threadpost);
$threadpost["id"] = $item;
logger("appnet_createpost: stored post ".$post["id"]." thread ".$post["thread_id"]." in item ".$item, LOGGER_DEBUG);
}
//}
}
// Don't create accounts of people who just comment something
$createuser = false;
$postarray['object-type'] = ACTIVITY_OBJ_COMMENT;
} else {
$postarray['thr-parent'] = $postarray['uri'];
$postarray['object-type'] = ACTIVITY_OBJ_NOTE;
}
if (($post["user"]["id"] != $ownid) || ($postarray['thr-parent'] == $postarray['uri'])) {
$postarray['owner-name'] = $post["user"]["name"];
$postarray['owner-link'] = $post["user"]["canonical_url"];
$postarray['owner-avatar'] = $post["user"]["avatar_image"]["url"];
$postarray['contact-id'] = appnet_fetchcontact($a, $uid, $post["user"], $me, $createuser);
} else {
$postarray['owner-name'] = $me["name"];
$postarray['owner-link'] = $me["url"];
$postarray['owner-avatar'] = $me["thumb"];
$postarray['contact-id'] = $me["id"];
}
$links = array();
if (is_array($post["repost_of"])) {
$postarray['author-name'] = $post["repost_of"]["user"]["name"];
$postarray['author-link'] = $post["repost_of"]["user"]["canonical_url"];
$postarray['author-avatar'] = $post["repost_of"]["user"]["avatar_image"]["url"];
$content = $post["repost_of"];
} else {
$postarray['author-name'] = $postarray['owner-name'];
$postarray['author-link'] = $postarray['owner-link'];
$postarray['author-avatar'] = $postarray['owner-avatar'];
$content = $post;
}
$postarray['plink'] = $content["canonical_url"];
if (is_array($content["entities"])) {
$converted = appnet_expand_entities($a, $content["text"], $content["entities"]);
$postarray['body'] = $converted["body"];
$postarray['tag'] = $converted["tags"];
} else
$postarray['body'] = $content["text"];
if (sizeof($content["entities"]["links"]))
foreach($content["entities"]["links"] AS $link) {
$url = normalise_link($link["url"]);
$links[$url] = $link["url"];
}
/* if (sizeof($content["annotations"]))
foreach($content["annotations"] AS $annotation) {
if ($annotation[type] == "net.app.core.oembed") {
if (isset($annotation["value"]["embeddable_url"])) {
$url = normalise_link($annotation["value"]["embeddable_url"]);
if (isset($links[$url]))
unset($links[$url]);
}
} elseif ($annotation[type] == "com.friendica.post") {
//$links = array();
//if (isset($annotation["value"]["post-title"]))
// $postarray['title'] = $annotation["value"]["post-title"];
//if (isset($annotation["value"]["post-body"]))
// $postarray['body'] = $annotation["value"]["post-body"];
//if (isset($annotation["value"]["post-tag"]))
// $postarray['tag'] = $annotation["value"]["post-tag"];
if (isset($annotation["value"]["author-name"]))
$postarray['author-name'] = $annotation["value"]["author-name"];
if (isset($annotation["value"]["author-link"]))
$postarray['author-link'] = $annotation["value"]["author-link"];
if (isset($annotation["value"]["author-avatar"]))
$postarray['author-avatar'] = $annotation["value"]["author-avatar"];
}
} */
$page_info = "";
if (is_array($content["annotations"])) {
$photo = appnet_expand_annotations($a, $content["annotations"]);
if (($photo["large"] != "") && ($photo["url"] != ""))
$page_info = "\n[url=".$photo["url"]."][img]".$photo["large"]."[/img][/url]";
elseif ($photo["url"] != "")
$page_info = "\n[img]".$photo["url"]."[/img]";
if ($photo["url"] != "")
$postarray['object-type'] = ACTIVITY_OBJ_IMAGE;
} else
$photo = array("url" => "", "large" => "");
if (sizeof($links)) {
$link = array_pop($links);
$url = str_replace(array('/', '.'), array('\/', '\.'), $link);
$page_info = add_page_info($link, false, $photo["url"]);
if (trim($page_info) != "") {
$removedlink = preg_replace("/\[url\=".$url."\](.*?)\[\/url\]/ism", '', $postarray['body']);
if (($removedlink == "") || strstr($postarray['body'], $removedlink))
$postarray['body'] = $removedlink;
}
}
$postarray['body'] .= $page_info;
$postarray['created'] = datetime_convert('UTC','UTC',$post["created_at"]);
$postarray['edited'] = datetime_convert('UTC','UTC',$post["created_at"]);
$postarray['app'] = $post["source"]["name"];
return($postarray);
}
function appnet_expand_entities($a, $body, $entities) {
if (!function_exists('substr_unicode')) {
function substr_unicode($str, $s, $l = null) {
return join("", array_slice(
preg_split("//u", $str, -1, PREG_SPLIT_NO_EMPTY), $s, $l));
}
}
$tags_arr = array();
$replace = array();
foreach ($entities["mentions"] AS $mention) {
$url = "@[url=https://alpha.app.net/".rawurlencode($mention["name"])."]".$mention["name"]."[/url]";
$tags_arr["@".$mention["name"]] = $url;
$replace[$mention["pos"]] = array("pos"=> $mention["pos"], "len"=> $mention["len"], "replace"=> $url);
}
foreach ($entities["hashtags"] AS $hashtag) {
$url = "#[url=".$a->get_baseurl()."/search?tag=".rawurlencode($hashtag["name"])."]".$hashtag["name"]."[/url]";
$tags_arr["#".$hashtag["name"]] = $url;
$replace[$hashtag["pos"]] = array("pos"=> $hashtag["pos"], "len"=> $hashtag["len"], "replace"=> $url);
}
foreach ($entities["links"] AS $links) {
$url = "[url=".$links["url"]."]".$links["text"]."[/url]";
if (isset($links["amended_len"]) && ($links["amended_len"] > $links["len"]))
$replace[$links["pos"]] = array("pos"=> $links["pos"], "len"=> $links["amended_len"], "replace"=> $url);
else
$replace[$links["pos"]] = array("pos"=> $links["pos"], "len"=> $links["len"], "replace"=> $url);
}
if (sizeof($replace)) {
krsort($replace);
foreach ($replace AS $entity) {
$pre = substr_unicode($body, 0, $entity["pos"]);
$post = substr_unicode($body, $entity["pos"] + $entity["len"]);
//$pre = iconv_substr($body, 0, $entity["pos"], "UTF-8");
//$post = iconv_substr($body, $entity["pos"] + $entity["len"], "UTF-8");
$body = $pre.$entity["replace"].$post;
}
}
return(array("body" => $body, "tags" => implode($tags_arr, ",")));
}
function appnet_expand_annotations($a, $annotations) {
$photo = array("url" => "", "large" => "");
foreach ($annotations AS $annotation) {
if (($annotation[type] == "net.app.core.oembed") &&
($annotation["value"]["type"] == "photo")) {
if ($annotation["value"]["url"] != "")
$photo["url"] = $annotation["value"]["url"];
if ($annotation["value"]["thumbnail_large_url"] != "")
$photo["large"] = $annotation["value"]["thumbnail_large_url"];
//if (($annotation["value"]["thumbnail_large_url"] != "") && ($annotation["value"]["url"] != ""))
// $embedded = "\n[url=".$annotation["value"]["url"]."][img]".$annotation["value"]["thumbnail_large_url"]."[/img][/url]";
//elseif ($annotation["value"]["url"] != "")
// $embedded = "\n[img]".$annotation["value"]["url"]."[/img]";
}
}
return $photo;
}
function appnet_fetchcontact($a, $uid, $contact, $me, $create_user) {
update_gcontact(array("url" => $contact["canonical_url"], "generation" => 2,
"network" => NETWORK_APPNET, "photo" => $contact["avatar_image"]["url"],
"name" => $contact["name"], "nick" => $contact["username"],
"about" => $contact["description"]["text"], "hide" => true,
"addr" => $contact["username"]."@app.net"));
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
intval($uid), dbesc("adn::".$contact["id"]));
if(!count($r) && !$create_user)
return($me["id"]);
if ($contact["canonical_url"] == "")
return($me["id"]);
if (count($r) && ($r[0]["readonly"] || $r[0]["blocked"])) {
logger("appnet_fetchcontact: Contact '".$r[0]["nick"]."' is blocked or readonly.", LOGGER_DEBUG);
return(-1);
}
if(!count($r)) {
if ($contact["name"] == "")
$contact["name"] = $contact["username"];
if ($contact["username"] == "")
$contact["username"] = $contact["name"];
// create contact record
q("INSERT INTO `contact` (`uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
`name`, `nick`, `photo`, `network`, `rel`, `priority`,
`about`, `writable`, `blocked`, `readonly`, `pending` )
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, 0, 0, 0 ) ",
intval($uid),
dbesc(datetime_convert()),
dbesc($contact["canonical_url"]),
dbesc(normalise_link($contact["canonical_url"])),
dbesc($contact["username"]."@app.net"),
dbesc("adn::".$contact["id"]),
dbesc(''),
dbesc("adn::".$contact["id"]),
dbesc($contact["name"]),
dbesc($contact["username"]),
dbesc($contact["avatar_image"]["url"]),
dbesc(NETWORK_APPNET),
intval(CONTACT_IS_FRIEND),
intval(1),
dbesc($contact["description"]["text"]),
intval(1)
);
$r = q("SELECT * FROM `contact` WHERE `alias` = '%s' AND `uid` = %d LIMIT 1",
dbesc("adn::".$contact["id"]),
intval($uid)
);
if(! count($r))
return(false);
$contact_id = $r[0]['id'];
$g = q("SELECT def_gid FROM user WHERE uid = %d LIMIT 1",
intval($uid)
);
if($g && intval($g[0]['def_gid'])) {
require_once('include/group.php');
group_add_member($uid,'',$contact_id,$g[0]['def_gid']);
}
require_once("Photo.php");
$photos = import_profile_photo($contact["avatar_image"]["url"],$uid,$contact_id);
q("UPDATE `contact` SET `photo` = '%s',
`thumb` = '%s',
`micro` = '%s',
`name-date` = '%s',
`uri-date` = '%s',
`avatar-date` = '%s'
WHERE `id` = %d",
dbesc($photos[0]),
dbesc($photos[1]),
dbesc($photos[2]),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
intval($contact_id)
);
} else {
// update profile photos once every two weeks as we have no notification of when they change.
//$update_photo = (($r[0]['avatar-date'] < datetime_convert('','','now -2 days')) ? true : false);
$update_photo = ($r[0]['avatar-date'] < datetime_convert('','','now -12 hours'));
// check that we have all the photos, this has been known to fail on occasion
if((! $r[0]['photo']) || (! $r[0]['thumb']) || (! $r[0]['micro']) || ($update_photo)) {
logger("appnet_fetchcontact: Updating contact ".$contact["username"], LOGGER_DEBUG);
require_once("Photo.php");
$photos = import_profile_photo($contact["avatar_image"]["url"], $uid, $r[0]['id']);
q("UPDATE `contact` SET `photo` = '%s',
`thumb` = '%s',
`micro` = '%s',
`name-date` = '%s',
`uri-date` = '%s',
`avatar-date` = '%s',
`url` = '%s',
`nurl` = '%s',
`addr` = '%s',
`name` = '%s',
`nick` = '%s',
`about` = '%s'
WHERE `id` = %d",
dbesc($photos[0]),
dbesc($photos[1]),
dbesc($photos[2]),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
dbesc($contact["canonical_url"]),
dbesc(normalise_link($contact["canonical_url"])),
dbesc($contact["username"]."@app.net"),
dbesc($contact["name"]),
dbesc($contact["username"]),
dbesc($contact["description"]["text"]),
intval($r[0]['id'])
);
}
}
return($r[0]["id"]);
}
function appnet_prepare_body(&$a,&$b) {
if ($b["item"]["network"] != NETWORK_APPNET)
return;
if ($b["preview"]) {
$max_char = 256;
require_once("include/plaintext.php");
$item = $b["item"];
$item["plink"] = $a->get_baseurl()."/display/".$a->user["nickname"]."/".$item["parent"];
$r = q("SELECT `author-link` FROM item WHERE item.uri = '%s' AND item.uid = %d LIMIT 1",
dbesc($item["thr-parent"]),
intval(local_user()));
if(count($r)) {
$orig_post = $r[0];
$nicknameplain = preg_replace("=https?://alpha.app.net/(.*)=ism", "$1", $orig_post["author-link"]);
$nickname = "@[url=".$orig_post["author-link"]."]".$nicknameplain."[/url]";
$nicknameplain = "@".$nicknameplain;
if ((strpos($item["body"], $nickname) === false) && (strpos($item["body"], $nicknameplain) === false))
$item["body"] = $nickname." ".$item["body"];
}
$msgarr = plaintext($a, $item, $max_char, true);
$msg = appnet_create_entities($a, $item, $msgarr);
require_once("library/markdown.php");
$msg = Markdown($msg);
$b['html'] = $msg;
}
}
function appnet_cron($a,$b) {
$last = get_config('appnet','last_poll');
$poll_interval = intval(get_config('appnet','poll_interval'));
if(! $poll_interval)
$poll_interval = APPNET_DEFAULT_POLL_INTERVAL;
if($last) {
$next = $last + ($poll_interval * 60);
if($next > time()) {
logger('appnet_cron: poll intervall not reached');
return;
}
}
logger('appnet_cron: cron_start');
$abandon_days = intval(get_config('system','account_abandon_days'));
if ($abandon_days < 1)
$abandon_days = 0;
$abandon_limit = date("Y-m-d H:i:s", time() - $abandon_days * 86400);
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'appnet' AND `k` = 'import' AND `v` = '1' ORDER BY RAND()");
if(count($r)) {
foreach($r as $rr) {
if ($abandon_days != 0) {
$user = q("SELECT `login_date` FROM `user` WHERE uid=%d AND `login_date` >= '%s'", $rr['uid'], $abandon_limit);
if (!count($user)) {
logger('abandoned account: timeline from user '.$rr['uid'].' will not be imported');
continue;
}
}
logger('appnet_cron: importing timeline from user '.$rr['uid']);
appnet_fetchstream($a, $rr["uid"]);
}
}
logger('appnet_cron: cron_end');
set_config('appnet','last_poll', time());
}
function appnet_error($msg) {
$msg = trim($msg);
$pos = strrpos($msg, "\r\n\r\n");
if (!$pos)
return($msg);
$msg = substr($msg, $pos + 4);
$error = json_decode($msg);
if ($error == NULL)
return($msg);
if (isset($error->meta->error_message))
return($error->meta->error_message);
else
return(print_r($error));
}

116
appnet/lang/C/messages.po Normal file
View file

@ -0,0 +1,116 @@
# ADDON appnet
# Copyright (C)
# This file is distributed under the same license as the Friendica appnet addon package.
#
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-06-22 11:47+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: appnet.php:39
msgid "Permission denied."
msgstr ""
#: appnet.php:73
msgid "You are now authenticated to app.net. "
msgstr ""
#: appnet.php:77
msgid "<p>Error fetching token. Please try again.</p>"
msgstr ""
#: appnet.php:80
msgid "return to the connector page"
msgstr ""
#: appnet.php:94
msgid "Post to app.net"
msgstr ""
#: appnet.php:125 appnet.php:129
msgid "App.net Export"
msgstr ""
#: appnet.php:142
msgid "Currently connected to: "
msgstr ""
#: appnet.php:144
msgid "Enable App.net Post Plugin"
msgstr ""
#: appnet.php:149
msgid "Post to App.net by default"
msgstr ""
#: appnet.php:153
msgid "Import the remote timeline"
msgstr ""
#: appnet.php:159
msgid ""
"<p>Error fetching user profile. Please clear the configuration and try again."
"</p>"
msgstr ""
#: appnet.php:164
msgid "<p>You have two ways to connect to App.net.</p>"
msgstr ""
#: appnet.php:166
msgid ""
"<p>First way: Register an application at <a href=\"https://account.app.net/"
"developer/apps/\">https://account.app.net/developer/apps/</a> and enter "
"Client ID and Client Secret. "
msgstr ""
#: appnet.php:167
#, php-format
msgid "Use '%s' as Redirect URI<p>"
msgstr ""
#: appnet.php:169
msgid "Client ID"
msgstr ""
#: appnet.php:173
msgid "Client Secret"
msgstr ""
#: appnet.php:177
msgid ""
"<p>Second way: fetch a token at <a href=\"http://dev-lite.jonathonduerig.com/"
"\">http://dev-lite.jonathonduerig.com/</a>. "
msgstr ""
#: appnet.php:178
msgid ""
"Set these scopes: 'Basic', 'Stream', 'Write Post', 'Public Messages', "
"'Messages'.</p>"
msgstr ""
#: appnet.php:180
msgid "Token"
msgstr ""
#: appnet.php:192
msgid "Sign in using App.net"
msgstr ""
#: appnet.php:197
msgid "Clear OAuth configuration"
msgstr ""
#: appnet.php:204
msgid "Save Settings"
msgstr ""

118
appnet/lang/cs/messages.po Normal file
View file

@ -0,0 +1,118 @@
# ADDON appnet
# Copyright (C)
# This file is distributed under the same license as the Friendica appnet addon package.
#
#
# Translators:
# Michal Šupler <msupler@gmail.com>, 2014
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-06-22 11:47+0200\n"
"PO-Revision-Date: 2014-07-02 15:24+0000\n"
"Last-Translator: Michal Šupler <msupler@gmail.com>\n"
"Language-Team: Czech (http://www.transifex.com/projects/p/friendica/language/cs/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: cs\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
#: appnet.php:39
msgid "Permission denied."
msgstr "Přístup odmítnut."
#: appnet.php:73
msgid "You are now authenticated to app.net. "
msgstr "Nyní jste přihlášen k app.net."
#: appnet.php:77
msgid "<p>Error fetching token. Please try again.</p>"
msgstr "<p>Chyba v přenesení tokenu. Prosím zkuste to znovu.</p>"
#: appnet.php:80
msgid "return to the connector page"
msgstr "návrat ke stránce konektor"
#: appnet.php:94
msgid "Post to app.net"
msgstr "Poslat příspěvek na app.net"
#: appnet.php:125 appnet.php:129
msgid "App.net Export"
msgstr "App.net Export"
#: appnet.php:142
msgid "Currently connected to: "
msgstr "V současné době připojen k:"
#: appnet.php:144
msgid "Enable App.net Post Plugin"
msgstr "Aktivovat App.net Post Plugin"
#: appnet.php:149
msgid "Post to App.net by default"
msgstr "Defaultně poslat na App.net"
#: appnet.php:153
msgid "Import the remote timeline"
msgstr "Importovat vzdálenou časovou osu"
#: appnet.php:159
msgid ""
"<p>Error fetching user profile. Please clear the configuration and try "
"again.</p>"
msgstr "<p>Chyba v přenesení uživatelského profilu. Prosím zkuste smazat konfiguraci a zkusit to znovu.</p>"
#: appnet.php:164
msgid "<p>You have two ways to connect to App.net.</p>"
msgstr "<p>Máte nyní dvě možnosti jak se připojit k App.net.</p>"
#: appnet.php:166
msgid ""
"<p>First way: Register an application at <a "
"href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a>"
" and enter Client ID and Client Secret. "
msgstr "<p>První možnost: Registrovat svou žádost na <a href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a> a zadat Client ID and Client Secret. "
#: appnet.php:167
#, php-format
msgid "Use '%s' as Redirect URI<p>"
msgstr "Použít '%s' jako URI pro přesměrování<p>"
#: appnet.php:169
msgid "Client ID"
msgstr "Client ID"
#: appnet.php:173
msgid "Client Secret"
msgstr "Client Secret"
#: appnet.php:177
msgid ""
"<p>Second way: fetch a token at <a href=\"http://dev-"
"lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a>. "
msgstr "<p>Druhá možnost: vložit token do <a href=\"http://dev-lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a>. "
#: appnet.php:178
msgid ""
"Set these scopes: 'Basic', 'Stream', 'Write Post', 'Public Messages', "
"'Messages'.</p>"
msgstr "Nastavte tyto rámce: 'Základní', 'Stream', 'Psaní příspěvků, 'Veřejné zprávy', 'Zprávy'.</p>"
#: appnet.php:180
msgid "Token"
msgstr "Token"
#: appnet.php:192
msgid "Sign in using App.net"
msgstr "Přihlásit se s použitím App.net"
#: appnet.php:197
msgid "Clear OAuth configuration"
msgstr "Vymazat konfiguraci OAuth"
#: appnet.php:204
msgid "Save Settings"
msgstr "Uložit Nastavení"

View file

@ -0,0 +1,29 @@
<?php
if(! function_exists("string_plural_select_cs")) {
function string_plural_select_cs($n){
return ($n==1) ? 0 : ($n>=2 && $n<=4) ? 1 : 2;;
}}
;
$a->strings["Permission denied."] = "Přístup odmítnut.";
$a->strings["You are now authenticated to app.net. "] = "Nyní jste přihlášen k app.net.";
$a->strings["<p>Error fetching token. Please try again.</p>"] = "<p>Chyba v přenesení tokenu. Prosím zkuste to znovu.</p>";
$a->strings["return to the connector page"] = "návrat ke stránce konektor";
$a->strings["Post to app.net"] = "Poslat příspěvek na app.net";
$a->strings["App.net Export"] = "App.net Export";
$a->strings["Currently connected to: "] = "V současné době připojen k:";
$a->strings["Enable App.net Post Plugin"] = "Aktivovat App.net Post Plugin";
$a->strings["Post to App.net by default"] = "Defaultně poslat na App.net";
$a->strings["Import the remote timeline"] = "Importovat vzdálenou časovou osu";
$a->strings["<p>Error fetching user profile. Please clear the configuration and try again.</p>"] = "<p>Chyba v přenesení uživatelského profilu. Prosím zkuste smazat konfiguraci a zkusit to znovu.</p>";
$a->strings["<p>You have two ways to connect to App.net.</p>"] = "<p>Máte nyní dvě možnosti jak se připojit k App.net.</p>";
$a->strings["<p>First way: Register an application at <a href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a> and enter Client ID and Client Secret. "] = "<p>První možnost: Registrovat svou žádost na <a href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a> a zadat Client ID and Client Secret. ";
$a->strings["Use '%s' as Redirect URI<p>"] = "Použít '%s' jako URI pro přesměrování<p>";
$a->strings["Client ID"] = "Client ID";
$a->strings["Client Secret"] = "Client Secret";
$a->strings["<p>Second way: fetch a token at <a href=\"http://dev-lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a>. "] = "<p>Druhá možnost: vložit token do <a href=\"http://dev-lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a>. ";
$a->strings["Set these scopes: 'Basic', 'Stream', 'Write Post', 'Public Messages', 'Messages'.</p>"] = "Nastavte tyto rámce: 'Základní', 'Stream', 'Psaní příspěvků, 'Veřejné zprávy', 'Zprávy'.</p>";
$a->strings["Token"] = "Token";
$a->strings["Sign in using App.net"] = "Přihlásit se s použitím App.net";
$a->strings["Clear OAuth configuration"] = "Vymazat konfiguraci OAuth";
$a->strings["Save Settings"] = "Uložit Nastavení";

118
appnet/lang/de/messages.po Normal file
View file

@ -0,0 +1,118 @@
# ADDON appnet
# Copyright (C)
# This file is distributed under the same license as the Friendica appnet addon package.
#
#
# Translators:
# bavatar <tobias.diekershoff@gmx.net>, 2014
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-06-22 11:47+0200\n"
"PO-Revision-Date: 2014-06-25 04:31+0000\n"
"Last-Translator: bavatar <tobias.diekershoff@gmx.net>\n"
"Language-Team: German (http://www.transifex.com/projects/p/friendica/language/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: appnet.php:39
msgid "Permission denied."
msgstr "Zugriff verweigert."
#: appnet.php:73
msgid "You are now authenticated to app.net. "
msgstr "Du bist nun auf app.net authentifiziert."
#: appnet.php:77
msgid "<p>Error fetching token. Please try again.</p>"
msgstr "<p>Fehler beim Holen des Tokens, bitte versuche es später noch einmal.</p>"
#: appnet.php:80
msgid "return to the connector page"
msgstr "zurück zur Connector Seite"
#: appnet.php:94
msgid "Post to app.net"
msgstr "Nach app.net senden"
#: appnet.php:125 appnet.php:129
msgid "App.net Export"
msgstr "App.net Export"
#: appnet.php:142
msgid "Currently connected to: "
msgstr "Momentan verbunden mit: "
#: appnet.php:144
msgid "Enable App.net Post Plugin"
msgstr "Veröffentlichungen bei App.net erlauben"
#: appnet.php:149
msgid "Post to App.net by default"
msgstr "Standardmäßig bei App.net veröffentlichen"
#: appnet.php:153
msgid "Import the remote timeline"
msgstr "Importiere die entfernte Zeitleiste"
#: appnet.php:159
msgid ""
"<p>Error fetching user profile. Please clear the configuration and try "
"again.</p>"
msgstr "<p>Beim Laden des Nutzerprofils ist ein Fehler aufgetreten. Bitte versuche es später noch einmal.</p>"
#: appnet.php:164
msgid "<p>You have two ways to connect to App.net.</p>"
msgstr "<p>Du hast zwei Wege deinen friendica Account mit App.net zu verbinden.</p>"
#: appnet.php:166
msgid ""
"<p>First way: Register an application at <a "
"href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a>"
" and enter Client ID and Client Secret. "
msgstr "<p>Erster Weg: Registriere eine Anwendung unter <a href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a> und wähle eine Client ID und ein Client Secret."
#: appnet.php:167
#, php-format
msgid "Use '%s' as Redirect URI<p>"
msgstr "Verwende '%s' als Redirect URI<p>"
#: appnet.php:169
msgid "Client ID"
msgstr "Client ID"
#: appnet.php:173
msgid "Client Secret"
msgstr "Client Secret"
#: appnet.php:177
msgid ""
"<p>Second way: fetch a token at <a href=\"http://dev-"
"lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a>. "
msgstr "<p>Zweiter Weg: Beantrage ein Token unter <a href=\"http://dev-lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a>. "
#: appnet.php:178
msgid ""
"Set these scopes: 'Basic', 'Stream', 'Write Post', 'Public Messages', "
"'Messages'.</p>"
msgstr "Verwende folgende Scopes: 'Basic', 'Stream', 'Write Post', 'Public Messages', 'Messages'.</p>"
#: appnet.php:180
msgid "Token"
msgstr "Token"
#: appnet.php:192
msgid "Sign in using App.net"
msgstr "Per App.net anmelden"
#: appnet.php:197
msgid "Clear OAuth configuration"
msgstr "OAuth Konfiguration löschen"
#: appnet.php:204
msgid "Save Settings"
msgstr "Einstellungen speichern"

View file

@ -0,0 +1,29 @@
<?php
if(! function_exists("string_plural_select_de")) {
function string_plural_select_de($n){
return ($n != 1);;
}}
;
$a->strings["Permission denied."] = "Zugriff verweigert.";
$a->strings["You are now authenticated to app.net. "] = "Du bist nun auf app.net authentifiziert.";
$a->strings["<p>Error fetching token. Please try again.</p>"] = "<p>Fehler beim Holen des Tokens, bitte versuche es später noch einmal.</p>";
$a->strings["return to the connector page"] = "zurück zur Connector Seite";
$a->strings["Post to app.net"] = "Nach app.net senden";
$a->strings["App.net Export"] = "App.net Export";
$a->strings["Currently connected to: "] = "Momentan verbunden mit: ";
$a->strings["Enable App.net Post Plugin"] = "Veröffentlichungen bei App.net erlauben";
$a->strings["Post to App.net by default"] = "Standardmäßig bei App.net veröffentlichen";
$a->strings["Import the remote timeline"] = "Importiere die entfernte Zeitleiste";
$a->strings["<p>Error fetching user profile. Please clear the configuration and try again.</p>"] = "<p>Beim Laden des Nutzerprofils ist ein Fehler aufgetreten. Bitte versuche es später noch einmal.</p>";
$a->strings["<p>You have two ways to connect to App.net.</p>"] = "<p>Du hast zwei Wege deinen friendica Account mit App.net zu verbinden.</p>";
$a->strings["<p>First way: Register an application at <a href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a> and enter Client ID and Client Secret. "] = "<p>Erster Weg: Registriere eine Anwendung unter <a href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a> und wähle eine Client ID und ein Client Secret.";
$a->strings["Use '%s' as Redirect URI<p>"] = "Verwende '%s' als Redirect URI<p>";
$a->strings["Client ID"] = "Client ID";
$a->strings["Client Secret"] = "Client Secret";
$a->strings["<p>Second way: fetch a token at <a href=\"http://dev-lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a>. "] = "<p>Zweiter Weg: Beantrage ein Token unter <a href=\"http://dev-lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a>. ";
$a->strings["Set these scopes: 'Basic', 'Stream', 'Write Post', 'Public Messages', 'Messages'.</p>"] = "Verwende folgende Scopes: 'Basic', 'Stream', 'Write Post', 'Public Messages', 'Messages'.</p>";
$a->strings["Token"] = "Token";
$a->strings["Sign in using App.net"] = "Per App.net anmelden";
$a->strings["Clear OAuth configuration"] = "OAuth Konfiguration löschen";
$a->strings["Save Settings"] = "Einstellungen speichern";

118
appnet/lang/es/messages.po Normal file
View file

@ -0,0 +1,118 @@
# ADDON appnet
# Copyright (C)
# This file is distributed under the same license as the Friendica appnet addon package.
#
#
# Translators:
# Alberto Díaz Tormo <albertodiaztormo@gmail.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-06-22 11:47+0200\n"
"PO-Revision-Date: 2016-10-13 21:25+0000\n"
"Last-Translator: Alberto Díaz Tormo <albertodiaztormo@gmail.com>\n"
"Language-Team: Spanish (http://www.transifex.com/Friendica/friendica/language/es/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: appnet.php:39
msgid "Permission denied."
msgstr "Permiso denegado"
#: appnet.php:73
msgid "You are now authenticated to app.net. "
msgstr "Ahora está autenticado en app.net."
#: appnet.php:77
msgid "<p>Error fetching token. Please try again.</p>"
msgstr "<p>Advertencia de error. Por favor inténtelo de nuevo.</p>"
#: appnet.php:80
msgid "return to the connector page"
msgstr "vuelva a pa página de conexón"
#: appnet.php:94
msgid "Post to app.net"
msgstr "Publique en app.net"
#: appnet.php:125 appnet.php:129
msgid "App.net Export"
msgstr "Exportar a app.net"
#: appnet.php:142
msgid "Currently connected to: "
msgstr "Actualmente conectado a:"
#: appnet.php:144
msgid "Enable App.net Post Plugin"
msgstr "Habilitar el plugin de publicación de App.net"
#: appnet.php:149
msgid "Post to App.net by default"
msgstr "Publicar en App.net por defecto"
#: appnet.php:153
msgid "Import the remote timeline"
msgstr "Importar la línea de tiempo remota"
#: appnet.php:159
msgid ""
"<p>Error fetching user profile. Please clear the configuration and try "
"again.</p>"
msgstr "<p>Advertencia de error de perfil. Por favor borre la configuración e inténtelo de nuevo.</p>"
#: appnet.php:164
msgid "<p>You have two ways to connect to App.net.</p>"
msgstr "<p>Tiene dos formas de conectar a App.net.</p>"
#: appnet.php:166
msgid ""
"<p>First way: Register an application at <a "
"href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a>"
" and enter Client ID and Client Secret. "
msgstr "<p>Primera forma: Registrar una aplicación en <a href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a> y seleccionar Client ID y Client Secret. "
#: appnet.php:167
#, php-format
msgid "Use '%s' as Redirect URI<p>"
msgstr "Use '%s' como Redirigir URI"
#: appnet.php:169
msgid "Client ID"
msgstr "ID de cliente"
#: appnet.php:173
msgid "Client Secret"
msgstr "Secreto de cliente"
#: appnet.php:177
msgid ""
"<p>Second way: fetch a token at <a href=\"http://dev-"
"lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a>. "
msgstr "<p>Segunda manera: traiga un símbolo a <a href=\"http://dev-lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a>"
#: appnet.php:178
msgid ""
"Set these scopes: 'Basic', 'Stream', 'Write Post', 'Public Messages', "
"'Messages'.</p>"
msgstr "Seleccione estas posibilidades: 'Básico', 'Continuo', 'Escribir entrada', 'Mensajes públicos', 'Mensajes'.</p>"
#: appnet.php:180
msgid "Token"
msgstr "Símbolo"
#: appnet.php:192
msgid "Sign in using App.net"
msgstr "Regístrese usando App.net"
#: appnet.php:197
msgid "Clear OAuth configuration"
msgstr "Borre la configuración OAuth"
#: appnet.php:204
msgid "Save Settings"
msgstr "Guardar los ajustes"

View file

@ -0,0 +1,29 @@
<?php
if(! function_exists("string_plural_select_es")) {
function string_plural_select_es($n){
return ($n != 1);;
}}
;
$a->strings["Permission denied."] = "Permiso denegado";
$a->strings["You are now authenticated to app.net. "] = "Ahora está autenticado en app.net.";
$a->strings["<p>Error fetching token. Please try again.</p>"] = "<p>Advertencia de error. Por favor inténtelo de nuevo.</p>";
$a->strings["return to the connector page"] = "vuelva a pa página de conexón";
$a->strings["Post to app.net"] = "Publique en app.net";
$a->strings["App.net Export"] = "Exportar a app.net";
$a->strings["Currently connected to: "] = "Actualmente conectado a:";
$a->strings["Enable App.net Post Plugin"] = "Habilitar el plugin de publicación de App.net";
$a->strings["Post to App.net by default"] = "Publicar en App.net por defecto";
$a->strings["Import the remote timeline"] = "Importar la línea de tiempo remota";
$a->strings["<p>Error fetching user profile. Please clear the configuration and try again.</p>"] = "<p>Advertencia de error de perfil. Por favor borre la configuración e inténtelo de nuevo.</p>";
$a->strings["<p>You have two ways to connect to App.net.</p>"] = "<p>Tiene dos formas de conectar a App.net.</p>";
$a->strings["<p>First way: Register an application at <a href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a> and enter Client ID and Client Secret. "] = "<p>Primera forma: Registrar una aplicación en <a href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a> y seleccionar Client ID y Client Secret. ";
$a->strings["Use '%s' as Redirect URI<p>"] = "Use '%s' como Redirigir URI";
$a->strings["Client ID"] = "ID de cliente";
$a->strings["Client Secret"] = "Secreto de cliente";
$a->strings["<p>Second way: fetch a token at <a href=\"http://dev-lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a>. "] = "<p>Segunda manera: traiga un símbolo a <a href=\"http://dev-lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a>";
$a->strings["Set these scopes: 'Basic', 'Stream', 'Write Post', 'Public Messages', 'Messages'.</p>"] = "Seleccione estas posibilidades: 'Básico', 'Continuo', 'Escribir entrada', 'Mensajes públicos', 'Mensajes'.</p>";
$a->strings["Token"] = "Símbolo";
$a->strings["Sign in using App.net"] = "Regístrese usando App.net";
$a->strings["Clear OAuth configuration"] = "Borre la configuración OAuth";
$a->strings["Save Settings"] = "Guardar los ajustes";

119
appnet/lang/fr/messages.po Normal file
View file

@ -0,0 +1,119 @@
# ADDON appnet
# Copyright (C)
# This file is distributed under the same license as the Friendica appnet addon package.
#
#
# Translators:
# Hypolite Petovan <mrpetovan@gmail.com>, 2016
# Jak <jacques@riseup.net>, 2014
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-06-22 11:47+0200\n"
"PO-Revision-Date: 2016-09-24 02:12+0000\n"
"Last-Translator: Hypolite Petovan <mrpetovan@gmail.com>\n"
"Language-Team: French (http://www.transifex.com/Friendica/friendica/language/fr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: appnet.php:39
msgid "Permission denied."
msgstr "Autorisation refusée"
#: appnet.php:73
msgid "You are now authenticated to app.net. "
msgstr "Vous êtes maintenant authentifié sur app.net"
#: appnet.php:77
msgid "<p>Error fetching token. Please try again.</p>"
msgstr "<p>Impossible d'obtenir le jeton, merci de réessayer.</p>"
#: appnet.php:80
msgid "return to the connector page"
msgstr "revenir à la page du connecteur"
#: appnet.php:94
msgid "Post to app.net"
msgstr "Publier sur app.net"
#: appnet.php:125 appnet.php:129
msgid "App.net Export"
msgstr "Export App.net"
#: appnet.php:142
msgid "Currently connected to: "
msgstr "Actuellement connecté à :"
#: appnet.php:144
msgid "Enable App.net Post Plugin"
msgstr "Activer le plugin de publication app.net"
#: appnet.php:149
msgid "Post to App.net by default"
msgstr "Publier sur App.net par défaut"
#: appnet.php:153
msgid "Import the remote timeline"
msgstr "Importer la timeline distante"
#: appnet.php:159
msgid ""
"<p>Error fetching user profile. Please clear the configuration and try "
"again.</p>"
msgstr "<p>Impossible d'obtenir le profil utilisateur. Merci de réinitialiser la configuration et de réessayer.</p>"
#: appnet.php:164
msgid "<p>You have two ways to connect to App.net.</p>"
msgstr "<p>Vous avez deux possibilités pour vous connecter à App.net.</p>"
#: appnet.php:166
msgid ""
"<p>First way: Register an application at <a "
"href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a>"
" and enter Client ID and Client Secret. "
msgstr "<p>Première méthode: Enregistrer une application sur <a href=\"https://account.app.net/developer/apps/\">App.net [en]</a> et entrez l'ID Client et le Secret Client. "
#: appnet.php:167
#, php-format
msgid "Use '%s' as Redirect URI<p>"
msgstr "Utilisez '%s' pour l'URI de Redirection"
#: appnet.php:169
msgid "Client ID"
msgstr "ID Client"
#: appnet.php:173
msgid "Client Secret"
msgstr "Secret Client"
#: appnet.php:177
msgid ""
"<p>Second way: fetch a token at <a href=\"http://dev-"
"lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a>. "
msgstr "<p>Deuxième méthode: obtenez un jeton ur <a href=\"http://dev-lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/ [en]</a>. "
#: appnet.php:178
msgid ""
"Set these scopes: 'Basic', 'Stream', 'Write Post', 'Public Messages', "
"'Messages'.</p>"
msgstr "Cochez les \"scopes\" suivant: \"Basic\", \"Stream\", \"Write Post\", \"Public Messages\", \"Messages\".</p>"
#: appnet.php:180
msgid "Token"
msgstr "Jeton"
#: appnet.php:192
msgid "Sign in using App.net"
msgstr "Se connecter avec App.net"
#: appnet.php:197
msgid "Clear OAuth configuration"
msgstr "Effacer la configuration OAuth"
#: appnet.php:204
msgid "Save Settings"
msgstr "Sauvegarder les paramètres"

View file

@ -0,0 +1,29 @@
<?php
if(! function_exists("string_plural_select_fr")) {
function string_plural_select_fr($n){
return ($n > 1);;
}}
;
$a->strings["Permission denied."] = "Autorisation refusée";
$a->strings["You are now authenticated to app.net. "] = "Vous êtes maintenant authentifié sur app.net";
$a->strings["<p>Error fetching token. Please try again.</p>"] = "<p>Impossible d'obtenir le jeton, merci de réessayer.</p>";
$a->strings["return to the connector page"] = "revenir à la page du connecteur";
$a->strings["Post to app.net"] = "Publier sur app.net";
$a->strings["App.net Export"] = "Export App.net";
$a->strings["Currently connected to: "] = "Actuellement connecté à :";
$a->strings["Enable App.net Post Plugin"] = "Activer le plugin de publication app.net";
$a->strings["Post to App.net by default"] = "Publier sur App.net par défaut";
$a->strings["Import the remote timeline"] = "Importer la timeline distante";
$a->strings["<p>Error fetching user profile. Please clear the configuration and try again.</p>"] = "<p>Impossible d'obtenir le profil utilisateur. Merci de réinitialiser la configuration et de réessayer.</p>";
$a->strings["<p>You have two ways to connect to App.net.</p>"] = "<p>Vous avez deux possibilités pour vous connecter à App.net.</p>";
$a->strings["<p>First way: Register an application at <a href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a> and enter Client ID and Client Secret. "] = "<p>Première méthode: Enregistrer une application sur <a href=\"https://account.app.net/developer/apps/\">App.net [en]</a> et entrez l'ID Client et le Secret Client. ";
$a->strings["Use '%s' as Redirect URI<p>"] = "Utilisez '%s' pour l'URI de Redirection";
$a->strings["Client ID"] = "ID Client";
$a->strings["Client Secret"] = "Secret Client";
$a->strings["<p>Second way: fetch a token at <a href=\"http://dev-lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a>. "] = "<p>Deuxième méthode: obtenez un jeton ur <a href=\"http://dev-lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/ [en]</a>. ";
$a->strings["Set these scopes: 'Basic', 'Stream', 'Write Post', 'Public Messages', 'Messages'.</p>"] = "Cochez les \"scopes\" suivant: \"Basic\", \"Stream\", \"Write Post\", \"Public Messages\", \"Messages\".</p>";
$a->strings["Token"] = "Jeton";
$a->strings["Sign in using App.net"] = "Se connecter avec App.net";
$a->strings["Clear OAuth configuration"] = "Effacer la configuration OAuth";
$a->strings["Save Settings"] = "Sauvegarder les paramètres";

118
appnet/lang/it/messages.po Normal file
View file

@ -0,0 +1,118 @@
# ADDON appnet
# Copyright (C)
# This file is distributed under the same license as the Friendica appnet addon package.
#
#
# Translators:
# fabrixxm <fabrix.xm@gmail.com>, 2014
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-06-22 11:47+0200\n"
"PO-Revision-Date: 2014-09-10 10:18+0000\n"
"Last-Translator: fabrixxm <fabrix.xm@gmail.com>\n"
"Language-Team: Italian (http://www.transifex.com/Friendica/friendica/language/it/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: it\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: appnet.php:39
msgid "Permission denied."
msgstr "Permesso negato."
#: appnet.php:73
msgid "You are now authenticated to app.net. "
msgstr "Sei autenticato su app.net"
#: appnet.php:77
msgid "<p>Error fetching token. Please try again.</p>"
msgstr "<p>Errore recuperando il token. Prova di nuovo</p>"
#: appnet.php:80
msgid "return to the connector page"
msgstr "ritorna alla pagina del connettore"
#: appnet.php:94
msgid "Post to app.net"
msgstr "Invia ad app.net"
#: appnet.php:125 appnet.php:129
msgid "App.net Export"
msgstr "Esporta App.net"
#: appnet.php:142
msgid "Currently connected to: "
msgstr "Al momento connesso con:"
#: appnet.php:144
msgid "Enable App.net Post Plugin"
msgstr "Abilita il plugin di invio ad App.net"
#: appnet.php:149
msgid "Post to App.net by default"
msgstr "Invia sempre ad App.net"
#: appnet.php:153
msgid "Import the remote timeline"
msgstr "Importa la timeline remota"
#: appnet.php:159
msgid ""
"<p>Error fetching user profile. Please clear the configuration and try "
"again.</p>"
msgstr "<p>Errore recuperando il profilo utente. Svuota la configurazione e prova di nuovo.</p>"
#: appnet.php:164
msgid "<p>You have two ways to connect to App.net.</p>"
msgstr "<p>Puoi collegarti ad App.net in due modi.</p>"
#: appnet.php:166
msgid ""
"<p>First way: Register an application at <a "
"href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a>"
" and enter Client ID and Client Secret. "
msgstr "<p>Registrare un'applicazione su <a href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a> e inserire Client ID e Client Secret."
#: appnet.php:167
#, php-format
msgid "Use '%s' as Redirect URI<p>"
msgstr "Usa '%s' come Redirect URI</p>"
#: appnet.php:169
msgid "Client ID"
msgstr "Client ID"
#: appnet.php:173
msgid "Client Secret"
msgstr "Client Secret"
#: appnet.php:177
msgid ""
"<p>Second way: fetch a token at <a href=\"http://dev-"
"lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a>. "
msgstr "<p>Oppure puoi recuperare un token su <a href=\"http://dev-lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a>."
#: appnet.php:178
msgid ""
"Set these scopes: 'Basic', 'Stream', 'Write Post', 'Public Messages', "
"'Messages'.</p>"
msgstr "Imposta gli ambiti 'Basic', 'Stream', 'Scrivi Post', 'Messaggi Pubblici', 'Messaggi'.</p>"
#: appnet.php:180
msgid "Token"
msgstr "Token"
#: appnet.php:192
msgid "Sign in using App.net"
msgstr "Autenticati con App.net"
#: appnet.php:197
msgid "Clear OAuth configuration"
msgstr "Pulisci configurazione OAuth"
#: appnet.php:204
msgid "Save Settings"
msgstr "Salva Impostazioni"

View file

@ -0,0 +1,29 @@
<?php
if(! function_exists("string_plural_select_it")) {
function string_plural_select_it($n){
return ($n != 1);;
}}
;
$a->strings["Permission denied."] = "Permesso negato.";
$a->strings["You are now authenticated to app.net. "] = "Sei autenticato su app.net";
$a->strings["<p>Error fetching token. Please try again.</p>"] = "<p>Errore recuperando il token. Prova di nuovo</p>";
$a->strings["return to the connector page"] = "ritorna alla pagina del connettore";
$a->strings["Post to app.net"] = "Invia ad app.net";
$a->strings["App.net Export"] = "Esporta App.net";
$a->strings["Currently connected to: "] = "Al momento connesso con:";
$a->strings["Enable App.net Post Plugin"] = "Abilita il plugin di invio ad App.net";
$a->strings["Post to App.net by default"] = "Invia sempre ad App.net";
$a->strings["Import the remote timeline"] = "Importa la timeline remota";
$a->strings["<p>Error fetching user profile. Please clear the configuration and try again.</p>"] = "<p>Errore recuperando il profilo utente. Svuota la configurazione e prova di nuovo.</p>";
$a->strings["<p>You have two ways to connect to App.net.</p>"] = "<p>Puoi collegarti ad App.net in due modi.</p>";
$a->strings["<p>First way: Register an application at <a href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a> and enter Client ID and Client Secret. "] = "<p>Registrare un'applicazione su <a href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a> e inserire Client ID e Client Secret.";
$a->strings["Use '%s' as Redirect URI<p>"] = "Usa '%s' come Redirect URI</p>";
$a->strings["Client ID"] = "Client ID";
$a->strings["Client Secret"] = "Client Secret";
$a->strings["<p>Second way: fetch a token at <a href=\"http://dev-lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a>. "] = "<p>Oppure puoi recuperare un token su <a href=\"http://dev-lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a>.";
$a->strings["Set these scopes: 'Basic', 'Stream', 'Write Post', 'Public Messages', 'Messages'.</p>"] = "Imposta gli ambiti 'Basic', 'Stream', 'Scrivi Post', 'Messaggi Pubblici', 'Messaggi'.</p>";
$a->strings["Token"] = "Token";
$a->strings["Sign in using App.net"] = "Autenticati con App.net";
$a->strings["Clear OAuth configuration"] = "Pulisci configurazione OAuth";
$a->strings["Save Settings"] = "Salva Impostazioni";

118
appnet/lang/nl/messages.po Normal file
View file

@ -0,0 +1,118 @@
# ADDON appnet
# Copyright (C)
# This file is distributed under the same license as the Friendica appnet addon package.
#
#
# Translators:
# Jeroen S <j.soeurt@gmail.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-06-22 11:47+0200\n"
"PO-Revision-Date: 2016-06-23 19:52+0000\n"
"Last-Translator: Jeroen S <j.soeurt@gmail.com>\n"
"Language-Team: Dutch (http://www.transifex.com/Friendica/friendica/language/nl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: nl\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: appnet.php:39
msgid "Permission denied."
msgstr "Toegang geweigerd"
#: appnet.php:73
msgid "You are now authenticated to app.net. "
msgstr "Je bent nu aangemeld bij app.net."
#: appnet.php:77
msgid "<p>Error fetching token. Please try again.</p>"
msgstr "<p>Fout tijdens token fetching. Probeer het nogmaals.</p>"
#: appnet.php:80
msgid "return to the connector page"
msgstr "ga terug naar de connector pagina"
#: appnet.php:94
msgid "Post to app.net"
msgstr "Post naar app.net."
#: appnet.php:125 appnet.php:129
msgid "App.net Export"
msgstr "App.net Export"
#: appnet.php:142
msgid "Currently connected to: "
msgstr "Momenteel verbonden met:"
#: appnet.php:144
msgid "Enable App.net Post Plugin"
msgstr "App.net Post Plugin inschakelen"
#: appnet.php:149
msgid "Post to App.net by default"
msgstr "Naar App.net posten als standaard instellen"
#: appnet.php:153
msgid "Import the remote timeline"
msgstr "The tijdlijn op afstand importeren"
#: appnet.php:159
msgid ""
"<p>Error fetching user profile. Please clear the configuration and try "
"again.</p>"
msgstr "<p>Fout tijdens het ophalen van gebruikersprofiel. Leeg de configuratie en probeer het opnieuw.</p>"
#: appnet.php:164
msgid "<p>You have two ways to connect to App.net.</p>"
msgstr "<p>Er zijn twee manieren om met App.net te verbinden.</p>"
#: appnet.php:166
msgid ""
"<p>First way: Register an application at <a "
"href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a>"
" and enter Client ID and Client Secret. "
msgstr ""
#: appnet.php:167
#, php-format
msgid "Use '%s' as Redirect URI<p>"
msgstr ""
#: appnet.php:169
msgid "Client ID"
msgstr ""
#: appnet.php:173
msgid "Client Secret"
msgstr ""
#: appnet.php:177
msgid ""
"<p>Second way: fetch a token at <a href=\"http://dev-"
"lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a>. "
msgstr ""
#: appnet.php:178
msgid ""
"Set these scopes: 'Basic', 'Stream', 'Write Post', 'Public Messages', "
"'Messages'.</p>"
msgstr ""
#: appnet.php:180
msgid "Token"
msgstr ""
#: appnet.php:192
msgid "Sign in using App.net"
msgstr ""
#: appnet.php:197
msgid "Clear OAuth configuration"
msgstr ""
#: appnet.php:204
msgid "Save Settings"
msgstr ""

View file

@ -0,0 +1,29 @@
<?php
if(! function_exists("string_plural_select_nl")) {
function string_plural_select_nl($n){
return ($n != 1);;
}}
;
$a->strings["Permission denied."] = "Toegang geweigerd";
$a->strings["You are now authenticated to app.net. "] = "Je bent nu aangemeld bij app.net.";
$a->strings["<p>Error fetching token. Please try again.</p>"] = "<p>Fout tijdens token fetching. Probeer het nogmaals.</p>";
$a->strings["return to the connector page"] = "ga terug naar de connector pagina";
$a->strings["Post to app.net"] = "Post naar app.net.";
$a->strings["App.net Export"] = "App.net Export";
$a->strings["Currently connected to: "] = "Momenteel verbonden met:";
$a->strings["Enable App.net Post Plugin"] = "App.net Post Plugin inschakelen";
$a->strings["Post to App.net by default"] = "Naar App.net posten als standaard instellen";
$a->strings["Import the remote timeline"] = "The tijdlijn op afstand importeren";
$a->strings["<p>Error fetching user profile. Please clear the configuration and try again.</p>"] = "<p>Fout tijdens het ophalen van gebruikersprofiel. Leeg de configuratie en probeer het opnieuw.</p>";
$a->strings["<p>You have two ways to connect to App.net.</p>"] = "<p>Er zijn twee manieren om met App.net te verbinden.</p>";
$a->strings["<p>First way: Register an application at <a href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a> and enter Client ID and Client Secret. "] = "";
$a->strings["Use '%s' as Redirect URI<p>"] = "";
$a->strings["Client ID"] = "";
$a->strings["Client Secret"] = "";
$a->strings["<p>Second way: fetch a token at <a href=\"http://dev-lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a>. "] = "";
$a->strings["Set these scopes: 'Basic', 'Stream', 'Write Post', 'Public Messages', 'Messages'.</p>"] = "";
$a->strings["Token"] = "";
$a->strings["Sign in using App.net"] = "";
$a->strings["Clear OAuth configuration"] = "";
$a->strings["Save Settings"] = "";

View file

@ -0,0 +1,119 @@
# ADDON appnet
# Copyright (C)
# This file is distributed under the same license as the Friendica appnet addon package.
#
#
# Translators:
# Beatriz Vital <vitalb@riseup.net>, 2016
# Calango Jr <jcsojr@gmail.com>, 2014
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-06-22 11:47+0200\n"
"PO-Revision-Date: 2016-08-19 20:37+0000\n"
"Last-Translator: Beatriz Vital <vitalb@riseup.net>\n"
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/Friendica/friendica/language/pt_BR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: pt_BR\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: appnet.php:39
msgid "Permission denied."
msgstr "Permissão negada."
#: appnet.php:73
msgid "You are now authenticated to app.net. "
msgstr "Você está autenticado no app.net."
#: appnet.php:77
msgid "<p>Error fetching token. Please try again.</p>"
msgstr "Erro ocorrido na obtenção do token. Tente novamente."
#: appnet.php:80
msgid "return to the connector page"
msgstr "Volte a página de conectores."
#: appnet.php:94
msgid "Post to app.net"
msgstr "Publicar no App.net"
#: appnet.php:125 appnet.php:129
msgid "App.net Export"
msgstr "App.net exportar"
#: appnet.php:142
msgid "Currently connected to: "
msgstr "Atualmente conectado em: "
#: appnet.php:144
msgid "Enable App.net Post Plugin"
msgstr "Habilitar plug-in para publicar no App.net"
#: appnet.php:149
msgid "Post to App.net by default"
msgstr "Publicar em App.net por padrão"
#: appnet.php:153
msgid "Import the remote timeline"
msgstr "Importar a linha do tempo remota"
#: appnet.php:159
msgid ""
"<p>Error fetching user profile. Please clear the configuration and try "
"again.</p>"
msgstr "Erro na obtenção do perfil do usuário. Confira as configurações e tente novamente."
#: appnet.php:164
msgid "<p>You have two ways to connect to App.net.</p>"
msgstr "<p>Você possui duas formas de conectar ao App.net</p>"
#: appnet.php:166
msgid ""
"<p>First way: Register an application at <a "
"href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a>"
" and enter Client ID and Client Secret. "
msgstr "<p>1º Método: Registre uma aplicação em <a href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a> e entre o Client ID e Client Secret"
#: appnet.php:167
#, php-format
msgid "Use '%s' as Redirect URI<p>"
msgstr "Use '%s' como URI redirecionador<p>"
#: appnet.php:169
msgid "Client ID"
msgstr "Client ID"
#: appnet.php:173
msgid "Client Secret"
msgstr "Client Secret"
#: appnet.php:177
msgid ""
"<p>Second way: fetch a token at <a href=\"http://dev-"
"lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a>. "
msgstr "<p>2º Método: obtenha um token em <a href=\"http://dev-lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a>. "
#: appnet.php:178
msgid ""
"Set these scopes: 'Basic', 'Stream', 'Write Post', 'Public Messages', "
"'Messages'.</p>"
msgstr "Adicione valor as estas saídas: 'Basic', 'Stream', 'Write Post', 'Public Messages', 'Messages'.</p>"
#: appnet.php:180
msgid "Token"
msgstr "Token"
#: appnet.php:192
msgid "Sign in using App.net"
msgstr "Entre usando o App.net"
#: appnet.php:197
msgid "Clear OAuth configuration"
msgstr "Limpar configuração OAuth"
#: appnet.php:204
msgid "Save Settings"
msgstr "Salvar Configurações"

View file

@ -0,0 +1,29 @@
<?php
if(! function_exists("string_plural_select_pt_br")) {
function string_plural_select_pt_br($n){
return ($n > 1);;
}}
;
$a->strings["Permission denied."] = "Permissão negada.";
$a->strings["You are now authenticated to app.net. "] = "Você está autenticado no app.net.";
$a->strings["<p>Error fetching token. Please try again.</p>"] = "Erro ocorrido na obtenção do token. Tente novamente.";
$a->strings["return to the connector page"] = "Volte a página de conectores.";
$a->strings["Post to app.net"] = "Publicar no App.net";
$a->strings["App.net Export"] = "App.net exportar";
$a->strings["Currently connected to: "] = "Atualmente conectado em: ";
$a->strings["Enable App.net Post Plugin"] = "Habilitar plug-in para publicar no App.net";
$a->strings["Post to App.net by default"] = "Publicar em App.net por padrão";
$a->strings["Import the remote timeline"] = "Importar a linha do tempo remota";
$a->strings["<p>Error fetching user profile. Please clear the configuration and try again.</p>"] = "Erro na obtenção do perfil do usuário. Confira as configurações e tente novamente.";
$a->strings["<p>You have two ways to connect to App.net.</p>"] = "<p>Você possui duas formas de conectar ao App.net</p>";
$a->strings["<p>First way: Register an application at <a href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a> and enter Client ID and Client Secret. "] = "<p>1º Método: Registre uma aplicação em <a href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a> e entre o Client ID e Client Secret";
$a->strings["Use '%s' as Redirect URI<p>"] = "Use '%s' como URI redirecionador<p>";
$a->strings["Client ID"] = "Client ID";
$a->strings["Client Secret"] = "Client Secret";
$a->strings["<p>Second way: fetch a token at <a href=\"http://dev-lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a>. "] = "<p>2º Método: obtenha um token em <a href=\"http://dev-lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a>. ";
$a->strings["Set these scopes: 'Basic', 'Stream', 'Write Post', 'Public Messages', 'Messages'.</p>"] = "Adicione valor as estas saídas: 'Basic', 'Stream', 'Write Post', 'Public Messages', 'Messages'.</p>";
$a->strings["Token"] = "Token";
$a->strings["Sign in using App.net"] = "Entre usando o App.net";
$a->strings["Clear OAuth configuration"] = "Limpar configuração OAuth";
$a->strings["Save Settings"] = "Salvar Configurações";

117
appnet/lang/ro/messages.po Normal file
View file

@ -0,0 +1,117 @@
# ADDON appnet
# Copyright (C)
# This file is distributed under the same license as the Friendica appnet addon package.
#
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-06-22 11:47+0200\n"
"PO-Revision-Date: 2014-07-08 11:40+0000\n"
"Last-Translator: Arian - Cazare Muncitori <arianserv@gmail.com>\n"
"Language-Team: Romanian (Romania) (http://www.transifex.com/projects/p/friendica/language/ro_RO/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ro_RO\n"
"Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1));\n"
#: appnet.php:39
msgid "Permission denied."
msgstr "Permisiune refuzată."
#: appnet.php:73
msgid "You are now authenticated to app.net. "
msgstr "Acum sunteți autentificat pe App.net."
#: appnet.php:77
msgid "<p>Error fetching token. Please try again.</p>"
msgstr "<p>Eroare la procesarea token-ului. Vă rugăm să reîncercați.</p>"
#: appnet.php:80
msgid "return to the connector page"
msgstr "revenire la pagina de conectare"
#: appnet.php:94
msgid "Post to app.net"
msgstr "Postați pe App.net"
#: appnet.php:125 appnet.php:129
msgid "App.net Export"
msgstr "Exportare pe App.net"
#: appnet.php:142
msgid "Currently connected to: "
msgstr "Conectat curent la:"
#: appnet.php:144
msgid "Enable App.net Post Plugin"
msgstr "Activare Modul Postare pe App.net"
#: appnet.php:149
msgid "Post to App.net by default"
msgstr "Postați implicit pe App.net"
#: appnet.php:153
msgid "Import the remote timeline"
msgstr "Importare cronologie la distanță"
#: appnet.php:159
msgid ""
"<p>Error fetching user profile. Please clear the configuration and try "
"again.</p>"
msgstr "<p>Eroare la procesarea profilului de utilizator. Vă rugăm să ștergeți configurarea şi apoi reîncercați.</p>"
#: appnet.php:164
msgid "<p>You have two ways to connect to App.net.</p>"
msgstr "<p>Aveți două modalități de a vă conecta la App.net.</p>"
#: appnet.php:166
msgid ""
"<p>First way: Register an application at <a "
"href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a>"
" and enter Client ID and Client Secret. "
msgstr "<p>Prima modalitate: Înregistrați o cerere pe <a href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a> şi introduceți ID Client şi Cheia Secretă Client."
#: appnet.php:167
#, php-format
msgid "Use '%s' as Redirect URI<p>"
msgstr "Utilizați '%s' ca URI de Redirecţionare<p>"
#: appnet.php:169
msgid "Client ID"
msgstr "ID Client"
#: appnet.php:173
msgid "Client Secret"
msgstr "Cheia Secretă Client"
#: appnet.php:177
msgid ""
"<p>Second way: fetch a token at <a href=\"http://dev-"
"lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a>. "
msgstr "<p>A doua cale: autorizați un indicativ de acces token de pe <a href=\"http://dev-lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a> ."
#: appnet.php:178
msgid ""
"Set these scopes: 'Basic', 'Stream', 'Write Post', 'Public Messages', "
"'Messages'.</p>"
msgstr "Stabiliți aceste scopuri: 'De Bază', 'Flux', 'Scriere Postare', 'Mesaje Publice', 'Mesaje'.</p>"
#: appnet.php:180
msgid "Token"
msgstr "Token"
#: appnet.php:192
msgid "Sign in using App.net"
msgstr "Autentificați-vă utilizând App.net"
#: appnet.php:197
msgid "Clear OAuth configuration"
msgstr "Ștergeți configurările OAuth"
#: appnet.php:204
msgid "Save Settings"
msgstr "Salvare Configurări"

View file

@ -0,0 +1,29 @@
<?php
if(! function_exists("string_plural_select_ro")) {
function string_plural_select_ro($n){
return ($n==1?0:((($n%100>19)||(($n%100==0)&&($n!=0)))?2:1));;
}}
;
$a->strings["Permission denied."] = "Permisiune refuzată.";
$a->strings["You are now authenticated to app.net. "] = "Acum sunteți autentificat pe App.net.";
$a->strings["<p>Error fetching token. Please try again.</p>"] = "<p>Eroare la procesarea token-ului. Vă rugăm să reîncercați.</p>";
$a->strings["return to the connector page"] = "revenire la pagina de conectare";
$a->strings["Post to app.net"] = "Postați pe App.net";
$a->strings["App.net Export"] = "Exportare pe App.net";
$a->strings["Currently connected to: "] = "Conectat curent la:";
$a->strings["Enable App.net Post Plugin"] = "Activare Modul Postare pe App.net";
$a->strings["Post to App.net by default"] = "Postați implicit pe App.net";
$a->strings["Import the remote timeline"] = "Importare cronologie la distanță";
$a->strings["<p>Error fetching user profile. Please clear the configuration and try again.</p>"] = "<p>Eroare la procesarea profilului de utilizator. Vă rugăm să ștergeți configurarea şi apoi reîncercați.</p>";
$a->strings["<p>You have two ways to connect to App.net.</p>"] = "<p>Aveți două modalități de a vă conecta la App.net.</p>";
$a->strings["<p>First way: Register an application at <a href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a> and enter Client ID and Client Secret. "] = "<p>Prima modalitate: Înregistrați o cerere pe <a href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a> şi introduceți ID Client şi Cheia Secretă Client.";
$a->strings["Use '%s' as Redirect URI<p>"] = "Utilizați '%s' ca URI de Redirecţionare<p>";
$a->strings["Client ID"] = "ID Client";
$a->strings["Client Secret"] = "Cheia Secretă Client";
$a->strings["<p>Second way: fetch a token at <a href=\"http://dev-lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a>. "] = "<p>A doua cale: autorizați un indicativ de acces token de pe <a href=\"http://dev-lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a> .";
$a->strings["Set these scopes: 'Basic', 'Stream', 'Write Post', 'Public Messages', 'Messages'.</p>"] = "Stabiliți aceste scopuri: 'De Bază', 'Flux', 'Scriere Postare', 'Mesaje Publice', 'Mesaje'.</p>";
$a->strings["Token"] = "Token";
$a->strings["Sign in using App.net"] = "Autentificați-vă utilizând App.net";
$a->strings["Clear OAuth configuration"] = "Ștergeți configurările OAuth";
$a->strings["Save Settings"] = "Salvare Configurări";

118
appnet/lang/ru/messages.po Normal file
View file

@ -0,0 +1,118 @@
# ADDON appnet
# Copyright (C)
# This file is distributed under the same license as the Friendica appnet addon package.
#
#
# Translators:
# Stanislav N. <pztrn@pztrn.name>, 2017
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-06-22 11:47+0200\n"
"PO-Revision-Date: 2017-04-08 05:32+0000\n"
"Last-Translator: Stanislav N. <pztrn@pztrn.name>\n"
"Language-Team: Russian (http://www.transifex.com/Friendica/friendica/language/ru/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ru\n"
"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n"
#: appnet.php:39
msgid "Permission denied."
msgstr "Доступ запрещен."
#: appnet.php:73
msgid "You are now authenticated to app.net. "
msgstr "Вы аутентифицированы на app.net"
#: appnet.php:77
msgid "<p>Error fetching token. Please try again.</p>"
msgstr "<p>Ошибка получения токена. Попробуйте еще раз.</p>"
#: appnet.php:80
msgid "return to the connector page"
msgstr "вернуться на страницу коннектора"
#: appnet.php:94
msgid "Post to app.net"
msgstr "Отправить на app.net"
#: appnet.php:125 appnet.php:129
msgid "App.net Export"
msgstr "Экспорт app.net"
#: appnet.php:142
msgid "Currently connected to: "
msgstr "В настоящее время соединены с: "
#: appnet.php:144
msgid "Enable App.net Post Plugin"
msgstr "Включить плагин App.net"
#: appnet.php:149
msgid "Post to App.net by default"
msgstr "Отправлять сообщения на App.net по-умолчанию"
#: appnet.php:153
msgid "Import the remote timeline"
msgstr "Импортировать удаленные сообщения"
#: appnet.php:159
msgid ""
"<p>Error fetching user profile. Please clear the configuration and try "
"again.</p>"
msgstr "<p>Ошибка при получении профиля пользователя. Сбросьте конфигурацию и попробуйте еще раз.</p>"
#: appnet.php:164
msgid "<p>You have two ways to connect to App.net.</p>"
msgstr "<p>У вас есть два способа соединения с App.net.</p>"
#: appnet.php:166
msgid ""
"<p>First way: Register an application at <a "
"href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a>"
" and enter Client ID and Client Secret. "
msgstr "<p>Первый способ: зарегистрируйте приложение на <a href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a> и введите Client ID и Client Secret"
#: appnet.php:167
#, php-format
msgid "Use '%s' as Redirect URI<p>"
msgstr "Используйте '%s' как Redirect URI<p>"
#: appnet.php:169
msgid "Client ID"
msgstr "Client ID"
#: appnet.php:173
msgid "Client Secret"
msgstr "Client Secret"
#: appnet.php:177
msgid ""
"<p>Second way: fetch a token at <a href=\"http://dev-"
"lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a>. "
msgstr "<p>Второй путь: получите токен на <a href=\"http://dev-lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a>. "
#: appnet.php:178
msgid ""
"Set these scopes: 'Basic', 'Stream', 'Write Post', 'Public Messages', "
"'Messages'.</p>"
msgstr "Выберите области: 'Basic', 'Stream', 'Write Post', 'Public Messages', 'Messages'.</p>"
#: appnet.php:180
msgid "Token"
msgstr "Токен"
#: appnet.php:192
msgid "Sign in using App.net"
msgstr "Войти через App.net"
#: appnet.php:197
msgid "Clear OAuth configuration"
msgstr "Удалить конфигурацию OAuth"
#: appnet.php:204
msgid "Save Settings"
msgstr "Сохранить настройки"

View file

@ -0,0 +1,29 @@
<?php
if(! function_exists("string_plural_select_ru")) {
function string_plural_select_ru($n){
return ($n%10==1 && $n%100!=11 ? 0 : $n%10>=2 && $n%10<=4 && ($n%100<12 || $n%100>14) ? 1 : $n%10==0 || ($n%10>=5 && $n%10<=9) || ($n%100>=11 && $n%100<=14)? 2 : 3);;
}}
;
$a->strings["Permission denied."] = "Доступ запрещен.";
$a->strings["You are now authenticated to app.net. "] = "Вы аутентифицированы на app.net";
$a->strings["<p>Error fetching token. Please try again.</p>"] = "<p>Ошибка получения токена. Попробуйте еще раз.</p>";
$a->strings["return to the connector page"] = "вернуться на страницу коннектора";
$a->strings["Post to app.net"] = "Отправить на app.net";
$a->strings["App.net Export"] = "Экспорт app.net";
$a->strings["Currently connected to: "] = "В настоящее время соединены с: ";
$a->strings["Enable App.net Post Plugin"] = "Включить плагин App.net";
$a->strings["Post to App.net by default"] = "Отправлять сообщения на App.net по-умолчанию";
$a->strings["Import the remote timeline"] = "Импортировать удаленные сообщения";
$a->strings["<p>Error fetching user profile. Please clear the configuration and try again.</p>"] = "<p>Ошибка при получении профиля пользователя. Сбросьте конфигурацию и попробуйте еще раз.</p>";
$a->strings["<p>You have two ways to connect to App.net.</p>"] = "<p>У вас есть два способа соединения с App.net.</p>";
$a->strings["<p>First way: Register an application at <a href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a> and enter Client ID and Client Secret. "] = "<p>Первый способ: зарегистрируйте приложение на <a href=\"https://account.app.net/developer/apps/\">https://account.app.net/developer/apps/</a> и введите Client ID и Client Secret";
$a->strings["Use '%s' as Redirect URI<p>"] = "Используйте '%s' как Redirect URI<p>";
$a->strings["Client ID"] = "Client ID";
$a->strings["Client Secret"] = "Client Secret";
$a->strings["<p>Second way: fetch a token at <a href=\"http://dev-lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a>. "] = "<p>Второй путь: получите токен на <a href=\"http://dev-lite.jonathonduerig.com/\">http://dev-lite.jonathonduerig.com/</a>. ";
$a->strings["Set these scopes: 'Basic', 'Stream', 'Write Post', 'Public Messages', 'Messages'.</p>"] = "Выберите области: 'Basic', 'Stream', 'Write Post', 'Public Messages', 'Messages'.</p>";
$a->strings["Token"] = "Токен";
$a->strings["Sign in using App.net"] = "Войти через App.net";
$a->strings["Clear OAuth configuration"] = "Удалить конфигурацию OAuth";
$a->strings["Save Settings"] = "Сохранить настройки";

View file

@ -0,0 +1,3 @@
{{include file="field_input.tpl" field=$clientid}}
{{include file="field_input.tpl" field=$clientsecret}}
<div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>

View file

@ -36,10 +36,10 @@
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -49,7 +49,6 @@
* THE SOFTWARE.
*/
use Friendica\Core\Config;
function blackout_install() {
register_hook('page_header', 'addon/blackout/blackout.php', 'blackout_redirect');
@ -68,9 +67,9 @@ function blackout_redirect ($a, $b) {
return true;
// else...
$mystart = Config::get('blackout','begindate');
$myend = Config::get('blackout','enddate');
$myurl = Config::get('blackout','url');
$mystart = get_config('blackout','begindate');
$myend = get_config('blackout','enddate');
$myurl = get_config('blackout','url');
$now = time();
$date1 = DateTime::createFromFormat('Y-m-d G:i', $mystart);
$date2 = DateTime::createFromFormat('Y-m-d G:i', $myend);
@ -88,21 +87,21 @@ function blackout_redirect ($a, $b) {
}
function blackout_plugin_admin(&$a, &$o) {
$mystart = Config::get('blackout','begindate');
$mystart = get_config('blackout','begindate');
if (! is_string($mystart)) { $mystart = "YYYY-MM-DD:hhmm"; }
$myend = Config::get('blackout','enddate');
$myend = get_config('blackout','enddate');
if (! is_string($myend)) { $myend = "YYYY-MM-DD:hhmm"; }
$myurl = Config::get('blackout','url');
$myurl = get_config('blackout','url');
if (! is_string($myurl)) { $myurl = "http://www.example.com"; }
$t = get_markup_template( "admin.tpl", "addon/blackout/" );
$o = replace_macros($t, [
$o = replace_macros($t, array(
'$submit' => t('Save Settings'),
'$rurl' => ["rurl", "Redirect URL", $myurl, "all your visitors from the web will be redirected to this URL"],
'$startdate' => ["startdate", "Begin of the Blackout<br />(YYYY-MM-DD hh:mm)", $mystart, "format is <em>YYYY</em> year, <em>MM</em> month, <em>DD</em> day, <em>hh</em> hour and <em>mm</em> minute"],
'$enddate' => ["enddate", "End of the Blackout<br />(YYYY-MM-DD hh:mm)", $myend, ""],
'$rurl' => array("rurl", "Redirect URL", $myurl, "all your visitors from the web will be redirected to this URL"),
'$startdate' => array("startdate", "Begin of the Blackout<br />(YYYY-MM-DD hh:mm)", $mystart, "format is <em>YYYY</em> year, <em>MM</em> month, <em>DD</em> day, <em>hh</em> hour and <em>mm</em> minute"),
'$enddate' => array("enddate", "End of the Blackout<br />(YYYY-MM-DD hh:mm)", $myend, ""),
]);
));
$date1 = DateTime::createFromFormat('Y-m-d G:i', $mystart);
$date2 = DateTime::createFromFormat('Y-m-d G:i', $myend);
if ($date2 < $date1) {
@ -115,7 +114,7 @@ function blackout_plugin_admin_post (&$a) {
$begindate = trim($_POST['startdate']);
$enddate = trim($_POST['enddate']);
$url = trim($_POST['rurl']);
Config::set('blackout','begindate',$begindate);
Config::set('blackout','enddate',$enddate);
Config::set('blackout','url',$url);
set_config('blackout','begindate',$begindate);
set_config('blackout','enddate',$enddate);
set_config('blackout','url',$url);
}

View file

@ -6,11 +6,9 @@
* Description: block people
* Version: 1.0
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
*
*
*/
use Friendica\Core\PConfig;
function blockem_install() {
register_hook('prepare_body', 'addon/blockem/blockem.php', 'blockem_prepare_body');
register_hook('display_item', 'addon/blockem/blockem.php', 'blockem_display_item');
@ -47,7 +45,7 @@ function blockem_addon_settings(&$a,&$s) {
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/blockem/blockem.css' . '" media="all" />' . "\r\n";
$words = PConfig::get(local_user(),'blockem','words');
$words = get_pconfig(local_user(),'blockem','words');
if(! $words)
$words = '';
@ -76,7 +74,7 @@ function blockem_addon_settings_post(&$a,&$b) {
return;
if($_POST['blockem-submit']) {
PConfig::set(local_user(),'blockem','words',trim($_POST['blockem-words']));
set_pconfig(local_user(),'blockem','words',trim($_POST['blockem-words']));
info( t('BLOCKEM Settings saved.') . EOL);
}
}
@ -84,7 +82,7 @@ function blockem_addon_settings_post(&$a,&$b) {
function blockem_enotify_store(&$a,&$b) {
$words = PConfig::get($b['uid'],'blockem','words');
$words = get_pconfig($b['uid'],'blockem','words');
if($words) {
$arr = explode(',',$words);
}
@ -117,7 +115,7 @@ function blockem_prepare_body(&$a,&$b) {
$words = null;
if(local_user()) {
$words = PConfig::get(local_user(),'blockem','words');
$words = get_pconfig(local_user(),'blockem','words');
}
if($words) {
$arr = explode(',',$words);
@ -141,7 +139,7 @@ function blockem_prepare_body(&$a,&$b) {
}
if($found) {
$rnd = random_string(8);
$b['html'] = '<div id="blockem-wrap-' . $rnd . '" class="fakelink" onclick=openClose(\'blockem-' . $rnd . '\'); >' . sprintf( t('Blocked %s - Click to open/close'),$word ) . '</div><div id="blockem-' . $rnd . '" style="display: none; " >' . $b['html'] . '</div>';
$b['html'] = '<div id="blockem-wrap-' . $rnd . '" class="fakelink" onclick=openClose(\'blockem-' . $rnd . '\'); >' . sprintf( t('Blocked %s - Click to open/close'),$word ) . '</div><div id="blockem-' . $rnd . '" style="display: none; " >' . $b['html'] . '</div>';
}
}
@ -157,7 +155,7 @@ function blockem_conversation_start(&$a,&$b) {
if(! local_user())
return;
$words = PConfig::get(local_user(),'blockem','words');
$words = get_pconfig(local_user(),'blockem','words');
if($words) {
$a->data['blockem'] = explode(',',$words);
}
@ -209,7 +207,7 @@ function blockem_init(&$a) {
if(! local_user())
return;
$words = PConfig::get(local_user(),'blockem','words');
$words = get_pconfig(local_user(),'blockem','words');
if(array_key_exists('block',$_GET) && $_GET['block']) {
if(strlen($words))
@ -218,7 +216,7 @@ function blockem_init(&$a) {
}
if(array_key_exists('unblock',$_GET) && $_GET['unblock']) {
$arr = explode(',',$words);
$newarr = [];
$newarr = array();
if(count($arr)) {
foreach($arr as $x) {
@ -229,7 +227,7 @@ function blockem_init(&$a) {
$words = implode(',',$newarr);
}
PConfig::set(local_user(),'blockem','words',$words);
set_pconfig(local_user(),'blockem','words',$words);
info( t('blockem settings updated') . EOL );
killme();
}

View file

@ -4,176 +4,174 @@
* Name: Blogger Post Connector
* Description: Post to Blogger (or anything else which uses blogger XMLRPC API)
* Version: 1.0
*
*
*/
use Friendica\Core\PConfig;
function blogger_install() {
register_hook('post_local', 'addon/blogger/blogger.php', 'blogger_post_local');
register_hook('notifier_normal', 'addon/blogger/blogger.php', 'blogger_send');
register_hook('jot_networks', 'addon/blogger/blogger.php', 'blogger_jot_nets');
register_hook('connector_settings', 'addon/blogger/blogger.php', 'blogger_settings');
register_hook('connector_settings_post', 'addon/blogger/blogger.php', 'blogger_settings_post');
}
register_hook('post_local', 'addon/blogger/blogger.php', 'blogger_post_local');
register_hook('notifier_normal', 'addon/blogger/blogger.php', 'blogger_send');
register_hook('jot_networks', 'addon/blogger/blogger.php', 'blogger_jot_nets');
register_hook('connector_settings', 'addon/blogger/blogger.php', 'blogger_settings');
register_hook('connector_settings_post', 'addon/blogger/blogger.php', 'blogger_settings_post');
}
function blogger_uninstall() {
unregister_hook('post_local', 'addon/blogger/blogger.php', 'blogger_post_local');
unregister_hook('notifier_normal', 'addon/blogger/blogger.php', 'blogger_send');
unregister_hook('jot_networks', 'addon/blogger/blogger.php', 'blogger_jot_nets');
unregister_hook('connector_settings', 'addon/blogger/blogger.php', 'blogger_settings');
unregister_hook('connector_settings_post', 'addon/blogger/blogger.php', 'blogger_settings_post');
unregister_hook('post_local', 'addon/blogger/blogger.php', 'blogger_post_local');
unregister_hook('notifier_normal', 'addon/blogger/blogger.php', 'blogger_send');
unregister_hook('jot_networks', 'addon/blogger/blogger.php', 'blogger_jot_nets');
unregister_hook('connector_settings', 'addon/blogger/blogger.php', 'blogger_settings');
unregister_hook('connector_settings_post', 'addon/blogger/blogger.php', 'blogger_settings_post');
// obsolete - remove
unregister_hook('post_local_end', 'addon/blogger/blogger.php', 'blogger_send');
unregister_hook('plugin_settings', 'addon/blogger/blogger.php', 'blogger_settings');
unregister_hook('plugin_settings_post', 'addon/blogger/blogger.php', 'blogger_settings_post');
unregister_hook('post_local_end', 'addon/blogger/blogger.php', 'blogger_send');
unregister_hook('plugin_settings', 'addon/blogger/blogger.php', 'blogger_settings');
unregister_hook('plugin_settings_post', 'addon/blogger/blogger.php', 'blogger_settings_post');
}
function blogger_jot_nets(&$a,&$b) {
if (!local_user()) {
return;
}
if(! local_user())
return;
$bl_post = PConfig::get(local_user(),'blogger','post');
if (intval($bl_post) == 1) {
$bl_defpost = PConfig::get(local_user(),'blogger','post_by_default');
$selected = ((intval($bl_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="blogger_enable" ' . $selected . ' value="1" /> '
. t('Post to blogger') . '</div>';
}
$bl_post = get_pconfig(local_user(),'blogger','post');
if(intval($bl_post) == 1) {
$bl_defpost = get_pconfig(local_user(),'blogger','post_by_default');
$selected = ((intval($bl_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="blogger_enable" ' . $selected . ' value="1" /> '
. t('Post to blogger') . '</div>';
}
}
function blogger_settings(&$a,&$s) {
if (! local_user()) {
return;
}
if(! local_user())
return;
/* Add our stylesheet to the page so we can make our settings look nice */
/* Add our stylesheet to the page so we can make our settings look nice */
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/blogger/blogger.css' . '" media="all" />' . "\r\n";
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/blogger/blogger.css' . '" media="all" />' . "\r\n";
/* Get the current state of our config variables */
/* Get the current state of our config variables */
$enabled = PConfig::get(local_user(),'blogger','post');
$checked = (($enabled) ? ' checked="checked" ' : '');
$css = (($enabled) ? '' : '-disabled');
$enabled = get_pconfig(local_user(),'blogger','post');
$checked = (($enabled) ? ' checked="checked" ' : '');
$css = (($enabled) ? '' : '-disabled');
$def_enabled = PConfig::get(local_user(),'blogger','post_by_default');
$def_enabled = get_pconfig(local_user(),'blogger','post_by_default');
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
$bl_username = PConfig::get(local_user(), 'blogger', 'bl_username');
$bl_password = PConfig::get(local_user(), 'blogger', 'bl_password');
$bl_blog = PConfig::get(local_user(), 'blogger', 'bl_blog');
$bl_username = get_pconfig(local_user(), 'blogger', 'bl_username');
$bl_password = get_pconfig(local_user(), 'blogger', 'bl_password');
$bl_blog = get_pconfig(local_user(), 'blogger', 'bl_blog');
/* Add some HTML to the existing form */
$s .= '<span id="settings_blogger_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_blogger_expanded\'); openClose(\'settings_blogger_inflated\');">';
$s .= '<img class="connector'.$css.'" src="images/blogger.png" /><h3 class="connector">'. t('Blogger Export').'</h3>';
$s .= '</span>';
$s .= '<div id="settings_blogger_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_blogger_expanded\'); openClose(\'settings_blogger_inflated\');">';
$s .= '<img class="connector'.$css.'" src="images/blogger.png" /><h3 class="connector">'. t('Blogger Export').'</h3>';
$s .= '</span>';
$s .= '<div id="blogger-enable-wrapper">';
$s .= '<label id="blogger-enable-label" for="blogger-checkbox">' . t('Enable Blogger Post Plugin') . '</label>';
$s .= '<input id="blogger-checkbox" type="checkbox" name="blogger" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div>';
/* Add some HTML to the existing form */
$s .= '<div id="blogger-username-wrapper">';
$s .= '<label id="blogger-username-label" for="blogger-username">' . t('Blogger username') . '</label>';
$s .= '<input id="blogger-username" type="text" name="bl_username" value="' . $bl_username . '" />';
$s .= '</div><div class="clear"></div>';
$s .= '<span id="settings_blogger_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_blogger_expanded\'); openClose(\'settings_blogger_inflated\');">';
$s .= '<img class="connector'.$css.'" src="images/blogger.png" /><h3 class="connector">'. t('Blogger Export').'</h3>';
$s .= '</span>';
$s .= '<div id="settings_blogger_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_blogger_expanded\'); openClose(\'settings_blogger_inflated\');">';
$s .= '<img class="connector'.$css.'" src="images/blogger.png" /><h3 class="connector">'. t('Blogger Export').'</h3>';
$s .= '</span>';
$s .= '<div id="blogger-password-wrapper">';
$s .= '<label id="blogger-password-label" for="blogger-password">' . t('Blogger password') . '</label>';
$s .= '<input id="blogger-password" type="password" name="bl_password" value="' . $bl_password . '" />';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="blogger-enable-wrapper">';
$s .= '<label id="blogger-enable-label" for="blogger-checkbox">' . t('Enable Blogger Post Plugin') . '</label>';
$s .= '<input id="blogger-checkbox" type="checkbox" name="blogger" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="blogger-blog-wrapper">';
$s .= '<label id="blogger-blog-label" for="blogger-blog">' . t('Blogger API URL') . '</label>';
$s .= '<input id="blogger-blog" type="text" name="bl_blog" value="' . $bl_blog . '" />';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="blogger-username-wrapper">';
$s .= '<label id="blogger-username-label" for="blogger-username">' . t('Blogger username') . '</label>';
$s .= '<input id="blogger-username" type="text" name="bl_username" value="' . $bl_username . '" />';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="blogger-bydefault-wrapper">';
$s .= '<label id="blogger-bydefault-label" for="blogger-bydefault">' . t('Post to Blogger by default') . '</label>';
$s .= '<input id="blogger-bydefault" type="checkbox" name="bl_bydefault" value="1" ' . $def_checked . '/>';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="blogger-password-wrapper">';
$s .= '<label id="blogger-password-label" for="blogger-password">' . t('Blogger password') . '</label>';
$s .= '<input id="blogger-password" type="password" name="bl_password" value="' . $bl_password . '" />';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="blogger-blog-wrapper">';
$s .= '<label id="blogger-blog-label" for="blogger-blog">' . t('Blogger API URL') . '</label>';
$s .= '<input id="blogger-blog" type="text" name="bl_blog" value="' . $bl_blog . '" />';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="blogger-bydefault-wrapper">';
$s .= '<label id="blogger-bydefault-label" for="blogger-bydefault">' . t('Post to Blogger by default') . '</label>';
$s .= '<input id="blogger-bydefault" type="checkbox" name="bl_bydefault" value="1" ' . $def_checked . '/>';
$s .= '</div><div class="clear"></div>';
/* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="blogger-submit" name="blogger-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>';
/* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="blogger-submit" name="blogger-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>';
}
function blogger_settings_post(&$a,&$b) {
if (x($_POST,'blogger-submit')) {
PConfig::set(local_user(),'blogger','post',intval($_POST['blogger']));
PConfig::set(local_user(),'blogger','post_by_default',intval($_POST['bl_bydefault']));
PConfig::set(local_user(),'blogger','bl_username',trim($_POST['bl_username']));
PConfig::set(local_user(),'blogger','bl_password',trim($_POST['bl_password']));
PConfig::set(local_user(),'blogger','bl_blog',trim($_POST['bl_blog']));
if(x($_POST,'blogger-submit')) {
set_pconfig(local_user(),'blogger','post',intval($_POST['blogger']));
set_pconfig(local_user(),'blogger','post_by_default',intval($_POST['bl_bydefault']));
set_pconfig(local_user(),'blogger','bl_username',trim($_POST['bl_username']));
set_pconfig(local_user(),'blogger','bl_password',trim($_POST['bl_password']));
set_pconfig(local_user(),'blogger','bl_blog',trim($_POST['bl_blog']));
}
}
function blogger_post_local(&$a,&$b) {
// This can probably be changed to allow editing by pointing to a different API endpoint
if ($b['edit']) {
if($b['edit'])
return;
}
if (!local_user() || (local_user() != $b['uid'])) {
if((! local_user()) || (local_user() != $b['uid']))
return;
}
if ($b['private'] || $b['parent']) {
if($b['private'] || $b['parent'])
return;
}
$bl_post = intval(PConfig::get(local_user(),'blogger','post'));
$bl_post = intval(get_pconfig(local_user(),'blogger','post'));
$bl_enable = (($bl_post && x($_REQUEST,'blogger_enable')) ? intval($_REQUEST['blogger_enable']) : 0);
if ($b['api_source'] && intval(PConfig::get(local_user(),'blogger','post_by_default'))) {
if($b['api_source'] && intval(get_pconfig(local_user(),'blogger','post_by_default')))
$bl_enable = 1;
}
if (!$bl_enable) {
return;
}
if(! $bl_enable)
return;
if (strlen($b['postopts'])) {
$b['postopts'] .= ',';
}
$b['postopts'] .= 'blogger';
if(strlen($b['postopts']))
$b['postopts'] .= ',';
$b['postopts'] .= 'blogger';
}
function blogger_send(&$a,&$b) {
if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) {
return;
}
if (! strstr($b['postopts'],'blogger')) {
return;
}
if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
return;
if ($b['parent'] != $b['id']) {
return;
}
if(! strstr($b['postopts'],'blogger'))
return;
$bl_username = xmlify(PConfig::get($b['uid'],'blogger','bl_username'));
$bl_password = xmlify(PConfig::get($b['uid'],'blogger','bl_password'));
$bl_blog = PConfig::get($b['uid'],'blogger','bl_blog');
if($b['parent'] != $b['id'])
return;
if ($bl_username && $bl_password && $bl_blog) {
$bl_username = xmlify(get_pconfig($b['uid'],'blogger','bl_username'));
$bl_password = xmlify(get_pconfig($b['uid'],'blogger','bl_password'));
$bl_blog = get_pconfig($b['uid'],'blogger','bl_blog');
if($bl_username && $bl_password && $bl_blog) {
require_once('include/bbcode.php');
@ -199,10 +197,10 @@ EOT;
logger('blogger: data: ' . $xml, LOGGER_DATA);
if ($bl_blog !== 'test') {
if($bl_blog !== 'test')
$x = post_url($bl_blog,$xml);
}
logger('posted to blogger: ' . (($x) ? $x : ''), LOGGER_DEBUG);
}
}
}

View file

@ -5,11 +5,7 @@
* Version: 0.2
* Author: Michael Vogel <http://pirati.ca/profile/heluecht>
*/
require 'addon/buffer/bufferapp.php';
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\PConfig;
require('addon/buffer/bufferapp.php');
function buffer_install() {
register_hook('post_local', 'addon/buffer/buffer.php', 'buffer_post_local');
@ -57,18 +53,18 @@ function buffer_content(&$a) {
function buffer_plugin_admin(&$a, &$o){
$t = get_markup_template( "admin.tpl", "addon/buffer/" );
$o = replace_macros($t, [
$o = replace_macros($t, array(
'$submit' => t('Save Settings'),
// name, label, value, help, [extra values]
'$client_id' => ['client_id', t('Client ID'), Config::get('buffer', 'client_id' ), ''],
'$client_secret' => ['client_secret', t('Client Secret'), Config::get('buffer', 'client_secret' ), ''],
]);
'$client_id' => array('client_id', t('Client ID'), get_config('buffer', 'client_id' ), ''),
'$client_secret' => array('client_secret', t('Client Secret'), get_config('buffer', 'client_secret' ), ''),
));
}
function buffer_plugin_admin_post(&$a){
$client_id = ((x($_POST,'client_id')) ? notags(trim($_POST['client_id'])) : '');
$client_secret = ((x($_POST,'client_secret')) ? notags(trim($_POST['client_secret'])): '');
Config::set('buffer','client_id',$client_id);
Config::set('buffer','client_secret',$client_secret);
set_config('buffer','client_id',$client_id);
set_config('buffer','client_secret',$client_secret);
info( t('Settings updated.'). EOL );
}
@ -82,8 +78,8 @@ function buffer_connect(&$a) {
session_start();
// Define the needed keys
$client_id = Config::get('buffer','client_id');
$client_secret = Config::get('buffer','client_secret');
$client_id = get_config('buffer','client_id');
$client_secret = get_config('buffer','client_secret');
// The callback URL is the script that gets called after the user authenticates with buffer
$callback_url = $a->get_baseurl()."/buffer/connect";
@ -96,7 +92,7 @@ function buffer_connect(&$a) {
logger("buffer_connect: authenticated");
$o .= t("You are now authenticated to buffer. ");
$o .= '<br /><a href="'.$a->get_baseurl().'/settings/connectors">'.t("return to the connector page").'</a>';
PConfig::set(local_user(), 'buffer','access_token', $buffer->access_token);
set_pconfig(local_user(), 'buffer','access_token', $buffer->access_token);
}
return($o);
@ -106,9 +102,9 @@ function buffer_jot_nets(&$a,&$b) {
if(! local_user())
return;
$buffer_post = PConfig::get(local_user(),'buffer','post');
$buffer_post = get_pconfig(local_user(),'buffer','post');
if(intval($buffer_post) == 1) {
$buffer_defpost = PConfig::get(local_user(),'buffer','post_by_default');
$buffer_defpost = get_pconfig(local_user(),'buffer','post_by_default');
$selected = ((intval($buffer_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="buffer_enable"' . $selected . ' value="1" /> '
. t('Post to Buffer') . '</div>';
@ -126,11 +122,11 @@ function buffer_settings(&$a,&$s) {
/* Get the current state of our config variables */
$enabled = PConfig::get(local_user(),'buffer','post');
$enabled = get_pconfig(local_user(),'buffer','post');
$checked = (($enabled) ? ' checked="checked" ' : '');
$css = (($enabled) ? '' : '-disabled');
$def_enabled = PConfig::get(local_user(),'buffer','post_by_default');
$def_enabled = get_pconfig(local_user(),'buffer','post_by_default');
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
/* Add some HTML to the existing form */
@ -143,9 +139,9 @@ function buffer_settings(&$a,&$s) {
$s .= '<img class="connector'.$css.'" src="images/buffer.png" /><h3 class="connector">'. t('Buffer Export').'</h3>';
$s .= '</span>';
$client_id = Config::get("buffer", "client_id");
$client_secret = Config::get("buffer", "client_secret");
$access_token = PConfig::get(local_user(), "buffer", "access_token");
$client_id = get_config("buffer", "client_id");
$client_secret = get_config("buffer", "client_secret");
$access_token = get_pconfig(local_user(), "buffer", "access_token");
$s .= '<div id="buffer-password-wrapper">';
if ($access_token == "") {
@ -202,12 +198,12 @@ function buffer_settings_post(&$a,&$b) {
if(x($_POST,'buffer-submit')) {
if(x($_POST,'buffer_delete')) {
PConfig::set(local_user(),'buffer','access_token','');
PConfig::set(local_user(),'buffer','post',false);
PConfig::set(local_user(),'buffer','post_by_default',false);
set_pconfig(local_user(),'buffer','access_token','');
set_pconfig(local_user(),'buffer','post',false);
set_pconfig(local_user(),'buffer','post_by_default',false);
} else {
PConfig::set(local_user(),'buffer','post',intval($_POST['buffer']));
PConfig::set(local_user(),'buffer','post_by_default',intval($_POST['buffer_bydefault']));
set_pconfig(local_user(),'buffer','post',intval($_POST['buffer']));
set_pconfig(local_user(),'buffer','post_by_default',intval($_POST['buffer_bydefault']));
}
}
}
@ -218,11 +214,11 @@ function buffer_post_local(&$a,&$b) {
return;
}
$buffer_post = intval(PConfig::get(local_user(),'buffer','post'));
$buffer_post = intval(get_pconfig(local_user(),'buffer','post'));
$buffer_enable = (($buffer_post && x($_REQUEST,'buffer_enable')) ? intval($_REQUEST['buffer_enable']) : 0);
if ($b['api_source'] && intval(PConfig::get(local_user(),'buffer','post_by_default'))) {
if ($b['api_source'] && intval(get_pconfig(local_user(),'buffer','post_by_default'))) {
$buffer_enable = 1;
}
@ -237,34 +233,24 @@ function buffer_post_local(&$a,&$b) {
$b['postopts'] .= 'buffer';
}
function buffer_send(App $a, &$b)
{
if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) {
return;
}
function buffer_send(&$a,&$b) {
if(! strstr($b['postopts'],'buffer')) {
if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
return;
}
if($b['parent'] != $b['id']) {
if(! strstr($b['postopts'],'buffer'))
return;
}
// Dont't post if the post doesn't belong to us.
// This is a check for forum postings
$self = dba::selectFirst('contact', ['id'], ['uid' => $b['uid'], 'self' => true]);
if ($b['contact-id'] != $self['id']) {
if($b['parent'] != $b['id'])
return;
}
// if post comes from buffer don't send it back
//if($b['app'] == "Buffer")
// return;
$client_id = Config::get("buffer", "client_id");
$client_secret = Config::get("buffer", "client_secret");
$access_token = PConfig::get($b['uid'], "buffer","access_token");
$client_id = get_config("buffer", "client_id");
$client_secret = get_config("buffer", "client_secret");
$access_token = get_pconfig($b['uid'], "buffer","access_token");
if($access_token) {
$buffer = new BufferApp($client_id, $client_secret, $callback_url, $access_token);
@ -306,7 +292,7 @@ function buffer_send(App $a, &$b)
break;
case 'twitter':
$send = ($b["extid"] != NETWORK_TWITTER);
$limit = 280;
$limit = 140;
$markup = false;
$includedlinks = true;
$htmlmode = 8;
@ -335,7 +321,7 @@ function buffer_send(App $a, &$b)
$item["body"] = preg_replace("(\[s\](.*?)\[\/s\])ism",'-$1-',$item["body"]);
}
$post = plaintext($item, $limit, $includedlinks, $htmlmode);
$post = plaintext($a, $item, $limit, $includedlinks, $htmlmode);
logger("buffer_send: converted message ".$b["id"]." result: ".print_r($post, true), LOGGER_DEBUG);
// The image proxy is used as a sanitizer. Buffer seems to be really picky about pictures
@ -369,7 +355,7 @@ function buffer_send(App $a, &$b)
elseif ($profile->service == "google")
$post["text"] .= html_entity_decode("&#x00A0;", ENT_QUOTES, 'UTF-8'); // Send a special blank to identify the post through the "fromgplus" addon
$message = [];
$message = array();
$message["text"] = $post["text"];
$message["profile_ids[]"] = $profile->id;
$message["shorten"] = false;

View file

@ -12,7 +12,7 @@
public $ok = false;
private $endpoints = [
private $endpoints = array(
'/user' => 'get',
'/profiles' => 'get',
@ -37,9 +37,9 @@
'/info/configuration' => 'get',
];
);
public $errors = [
public $errors = array(
'invalid-endpoint' => 'The endpoint you supplied does not appear to be valid.',
'403' => 'Permission denied.',
@ -77,7 +77,7 @@
'1042' => 'User did not save successfully.',
'1050' => 'Client could not be found.',
'1051' => 'No authorization to access client.',
];
);
function __construct($client_id = '', $client_secret = '', $callback_url = '', $access_token = '') {
if ($client_id) $this->set_client_id($client_id);
@ -110,7 +110,7 @@
if (!$ok) return $this->error('invalid-endpoint');
}
if (!$data || !is_array($data)) $data = [];
if (!$data || !is_array($data)) $data = array();
$data['access_token'] = $this->access_token;
$method = $this->endpoints[$done_endpoint]; //get() or post()
@ -130,17 +130,17 @@
}
function error($error) {
return (object) ['error' => $this->errors[$error]];
return (object) array('error' => $this->errors[$error]);
}
function create_access_token_url() {
$data = [
$data = array(
'code' => $this->code,
'grant_type' => 'authorization_code',
'client_id' => $this->client_id,
'client_secret' => $this->client_secret,
'redirect_uri' => $this->callback_url,
];
);
$obj = $this->post($this->access_token_url, $data);
$this->access_token = $obj->access_token;
@ -150,15 +150,15 @@
function req($url = '', $data = '', $post = true) {
if (!$url) return false;
if (!$data || !is_array($data)) $data = [];
if (!$data || !is_array($data)) $data = array();
$options = [CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => false];
$options = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => false);
if ($post) {
$options += [
$options += array(
CURLOPT_POST => $post,
CURLOPT_POSTFIELDS => $data
];
);
} else {
$url .= '?' . http_build_query($data);
}

19
cal/LICENSE Normal file
View file

@ -0,0 +1,19 @@
Copyright (c) 2013 Tobias Diekershoff
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

29
cal/README.md Normal file
View file

@ -0,0 +1,29 @@
Calendar Export
===============
This addon makes it possible to export the events posted by your users,
so they can be imported into other calendar applications.
Exporting a calendar is an _opt-in_ feature which has to be activated by each
of the users in the _addon settings_. As the admin you can only provide the
service but should not force it upon your users.
The calendars are exported at
http://example.com/cal/username/export/format
currently the following formats are supported
* ical
* csv.
Author
------
This addon is developed by [Tobias Diekershoff](https://f.diekershoff.de/profile/tobias).
License
-------
This addon is licensed under the [MIT](http://opensource.org/licenses/MIT)
license, see also the LICENSE file in the addon directory.

200
cal/cal.php Normal file
View file

@ -0,0 +1,200 @@
<?php
/********************************************************************
* Name: Calendar Export
* Description: This addon exports the public events of your users as calendar files
* Version: 0.1
* Author: Tobias Diekershoff <https://f.diekershoff.de/profile/tobias>
* License: MIT
* Status: Unsupported
* ******************************************************************/
function cal_install()
{
register_hook('plugin_settings', 'addon/cal/cal.php', 'cal_addon_settings');
register_hook('plugin_settings_post', 'addon/cal/cal.php', 'cal_addon_settings_post');
}
function cal_uninstall()
{
unregister_hook('plugin_settings', 'addon/cal/cal.php', 'cal_addon_settings');
unregister_hook('plugin_settings_post', 'addon/cal/cal.php', 'cal_addon_settings_post');
}
function cal_module()
{
}
/* pathes
* /cal/$user/export/$format
* currently supported formats are ical (iCalendar) and CSV
*/
function cal_content()
{
$a = get_app();
$o = "";
if ($a->argc == 1) {
$o .= "<h3>".t('Event Export')."</h3><p>".t('You can download public events from: ').$a->get_baseurl()."/cal/username/export/ical</p>";
} elseif ($a->argc==4) {
// get the parameters from the request we just received
$username = $a->argv[1];
$do = $a->argv[2];
$format = $a->argv[3];
// check that there is a user matching the requested profile
$r = q("SELECT uid FROM user WHERE nickname='".$username."' LIMIT 1;");
if (count($r))
{
$uid = $r[0]['uid'];
} else {
killme();
}
// if we shall do anything other then export, end here
if (! $do == 'export' )
killme();
// check if the user allows us to share the profile
$enable = get_pconfig( $uid, 'cal', 'enable');
if (! $enable == 1) {
info(t('The user does not export the calendar.'));
return;
}
// we are allowed to show events
// get the timezone the user is in
$r = q("SELECT timezone FROM user WHERE uid=".$uid." LIMIT 1;");
if (count($r))
$timezone = $r[0]['timezone'];
// does the user who requests happen to be the owner of the events
// requested? then show all of your events, otherwise only those that
// don't have limitations set in allow_cid and allow_gid
if (local_user() == $uid) {
$r = q("SELECT `start`, `finish`, `adjust`, `summary`, `desc`, `location` FROM `event` WHERE `uid`=".$uid." and `cid`=0;");
} else {
$r = q("SELECT `start`, `finish`, `adjust`, `summary`, `desc`, `location` FROM `event` WHERE `allow_cid`='' and `allow_gid`='' and `uid`='".$uid."' and `cid`='0';");
}
// we have the events that are available for the requestor
// now format the output according to the requested format
$res = cal_format_output($r, $format, $timezone);
if (! $res=='')
info($res);
} else {
// wrong number of parameters
killme();
}
return $o;
}
function cal_format_output ($r, $f, $tz)
{
$res = t('This calendar format is not supported');
switch ($f)
{
// format the exported data as a CSV file
case "csv":
header("Content-type: text/csv");
$o = '"Subject", "Start Date", "Start Time", "Description", "End Date", "End Time", "Location"' . PHP_EOL;
foreach ($r as $rr) {
// TODO the time / date entries don't include any information about the
// timezone the event is scheduled in :-/
$tmp1 = strtotime($rr['start']);
$tmp2 = strtotime($rr['finish']);
$time_format = "%H:%M:%S";
$date_format = "%Y-%m-%d";
$o .= '"'.$rr['summary'].'", "'.strftime($date_format, $tmp1) .
'", "'.strftime($time_format, $tmp1).'", "'.$rr['desc'] .
'", "'.strftime($date_format, $tmp2) .
'", "'.strftime($time_format, $tmp2) .
'", "'.$rr['location'].'"' . PHP_EOL;
}
echo $o;
killme();
case "ical":
header("Content-type: text/ics");
$o = 'BEGIN:VCALENDAR'. PHP_EOL
. 'VERSION:2.0' . PHP_EOL
. 'PRODID:-//friendica calendar export//0.1//EN' . PHP_EOL;
// TODO include timezone informations in cases were the time is not in UTC
// see http://tools.ietf.org/html/rfc2445#section-4.8.3
// . 'BEGIN:VTIMEZONE' . PHP_EOL
// . 'TZID:' . $tz . PHP_EOL
// . 'END:VTIMEZONE' . PHP_EOL;
// TODO instead of PHP_EOL CRLF should be used for long entries
// but test your solution against http://icalvalid.cloudapp.net/
// also long lines SHOULD be split at 75 characters length
foreach ($r as $rr) {
if ($rr['adjust'] == 1) {
$UTC = 'Z';
} else {
$UTC = '';
}
$o .= 'BEGIN:VEVENT' . PHP_EOL;
if ($rr[start]) {
$tmp = strtotime($rr['start']);
$dtformat = "%Y%m%dT%H%M%S".$UTC;
$o .= 'DTSTART:'.strftime($dtformat, $tmp).PHP_EOL;
}
if ($rr['finish']) {
$tmp = strtotime($rr['finish']);
$dtformat = "%Y%m%dT%H%M%S".$UTC;
$o .= 'DTEND:'.strftime($dtformat, $tmp).PHP_EOL;
}
if ($rr['summary'])
$tmp = $rr['summary'];
$tmp = str_replace(PHP_EOL, PHP_EOL.' ',$tmp);
$tmp = addcslashes($tmp, ',;');
$o .= 'SUMMARY:' . $tmp . PHP_EOL;
if ($rr['desc'])
$tmp = $rr['desc'];
$tmp = str_replace(PHP_EOL, PHP_EOL.' ',$tmp);
$tmp = addcslashes($tmp, ',;');
$o .= 'DESCRIPTION:' . $tmp . PHP_EOL;
if ($rr['location']) {
$tmp = $rr['location'];
$tmp = str_replace(PHP_EOL, PHP_EOL.' ',$tmp);
$tmp = addcslashes($tmp, ',;');
$o .= 'LOCATION:' . $tmp . PHP_EOL;
}
$o .= 'END:VEVENT' . PHP_EOL;
}
$o .= 'END:VCALENDAR' . PHP_EOL;
echo $o;
killme();
}
return $res;
}
function cal_addon_settings_post ( &$a, &$b )
{
if (! local_user())
return;
if (!x($_POST,'cal-submit'))
return;
set_pconfig(local_user(),'cal','enable',intval($_POST['cal-enable']));
}
function cal_addon_settings ( &$a, &$s )
{
if (! local_user())
return;
$enabled = get_pconfig(local_user(), 'cal', 'enable');
$checked = (($enabled) ? ' checked="checked" ' : '');
$url = $a->get_baseurl().'/cal/'.$a->user['nickname'].'/export/<em>format</em>';
$s .= '<span id="settings_cal_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_cal_expanded\'); openClose(\'settings_cal_inflated\');">';
$s .= '<h3>'.t('Export Events').'</h3>';
$s .= '</span>';
$s .= '<div id="settings_cal_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_cal_expanded\'); openClose(\'settings_cal_inflated\');">';
$s .= '<h3>'.t('Export Events').'</h3>';
$s .= '</span>';
$s .= '<div id="cal-wrapper">';
$s .= '<p>'.t('If this is enabled, your public events will be available at').' <strong>'.$url.'</strong></p>';
$s .= '<p>'.t('Currently supported formats are ical and csv.').'</p>';
$s .= '<label id="cal-enable-label" for="cal-checkbox">'. t('Enable calendar export') .'</label>';
$s .= '<input id="cal-checkbox" type="checkbox" name="cal-enable" value="1" ' . $checked . '/>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="cal-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div>';
$s .= '<div class="clear"></div>';
$s .= '</div>';
$s .= '</div>';
}
?>

54
cal/lang/C/messages.po Normal file
View file

@ -0,0 +1,54 @@
# ADDON cal
# Copyright (C)
# This file is distributed under the same license as the Friendica cal addon package.
#
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-06-22 13:18+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: cal.php:33
msgid "Event Export"
msgstr ""
#: cal.php:33
msgid "You can download public events from: "
msgstr ""
#: cal.php:53
msgid "The user does not export the calendar."
msgstr ""
#: cal.php:83
msgid "This calendar format is not supported"
msgstr ""
#: cal.php:181 cal.php:185
msgid "Export Events"
msgstr ""
#: cal.php:189
msgid "If this is enabled, your public events will be available at"
msgstr ""
#: cal.php:190
msgid "Currently supported formats are ical and csv."
msgstr ""
#: cal.php:191
msgid "Enable calendar export"
msgstr ""
#: cal.php:193
msgid "Save Settings"
msgstr ""

12
cal/lang/C/strings.php Normal file
View file

@ -0,0 +1,12 @@
<?php
;
$a->strings["Event Export"] = "";
$a->strings["You can download public events from: "] = "";
$a->strings["The user does not export the calendar."] = "";
$a->strings["This calendar format is not supported"] = "";
$a->strings["Export Events"] = "";
$a->strings["If this is enabled, your public events will be available at"] = "";
$a->strings["Currently supported formats are ical and csv."] = "";
$a->strings["Enable calendar export"] = "";
$a->strings["Submit"] = "";

56
cal/lang/cs/messages.po Normal file
View file

@ -0,0 +1,56 @@
# ADDON cal
# Copyright (C)
# This file is distributed under the same license as the Friendica cal addon package.
#
#
# Translators:
# Michal Šupler <msupler@gmail.com>, 2014
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-06-22 13:18+0200\n"
"PO-Revision-Date: 2014-09-07 11:04+0000\n"
"Last-Translator: Michal Šupler <msupler@gmail.com>\n"
"Language-Team: Czech (http://www.transifex.com/projects/p/friendica/language/cs/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: cs\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
#: cal.php:33
msgid "Event Export"
msgstr "Export událostí"
#: cal.php:33
msgid "You can download public events from: "
msgstr "Veřejné události si můžete stánout z:"
#: cal.php:53
msgid "The user does not export the calendar."
msgstr "Uživatel kalenář neexportuje."
#: cal.php:83
msgid "This calendar format is not supported"
msgstr "Tento kalendářový formát není podporován."
#: cal.php:181 cal.php:185
msgid "Export Events"
msgstr "Export událostí"
#: cal.php:189
msgid "If this is enabled, your public events will be available at"
msgstr "Pokud je toto povoleno, vaše veřejné události budou viditelné na"
#: cal.php:190
msgid "Currently supported formats are ical and csv."
msgstr "Aktuálně podporované formáty jsou ical a csv."
#: cal.php:191
msgid "Enable calendar export"
msgstr "Povolit export kalendáře"
#: cal.php:193
msgid "Save Settings"
msgstr "Uložit Nastavení"

16
cal/lang/cs/strings.php Normal file
View file

@ -0,0 +1,16 @@
<?php
if(! function_exists("string_plural_select_cs")) {
function string_plural_select_cs($n){
return ($n==1) ? 0 : ($n>=2 && $n<=4) ? 1 : 2;;
}}
;
$a->strings["Event Export"] = "Export událostí";
$a->strings["You can download public events from: "] = "Veřejné události si můžete stánout z:";
$a->strings["The user does not export the calendar."] = "Uživatel kalenář neexportuje.";
$a->strings["This calendar format is not supported"] = "Tento kalendářový formát není podporován.";
$a->strings["Export Events"] = "Export událostí";
$a->strings["If this is enabled, your public events will be available at"] = "Pokud je toto povoleno, vaše veřejné události budou viditelné na";
$a->strings["Currently supported formats are ical and csv."] = "Aktuálně podporované formáty jsou ical a csv.";
$a->strings["Enable calendar export"] = "Povolit export kalendáře";
$a->strings["Save Settings"] = "Uložit Nastavení";

56
cal/lang/de/messages.po Normal file
View file

@ -0,0 +1,56 @@
# ADDON cal
# Copyright (C)
# This file is distributed under the same license as the Friendica cal addon package.
#
#
# Translators:
# bavatar <tobias.diekershoff@gmx.net>, 2014
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-06-22 13:18+0200\n"
"PO-Revision-Date: 2014-09-28 10:39+0000\n"
"Last-Translator: bavatar <tobias.diekershoff@gmx.net>\n"
"Language-Team: German (http://www.transifex.com/projects/p/friendica/language/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: cal.php:33
msgid "Event Export"
msgstr "Ereignis Export"
#: cal.php:33
msgid "You can download public events from: "
msgstr "Du kannst öffentliche Ereignisse hier herunterladen;"
#: cal.php:53
msgid "The user does not export the calendar."
msgstr "Diese_r Nutzer_in exportiert den Kalender nicht."
#: cal.php:83
msgid "This calendar format is not supported"
msgstr "Dieses Kalenderformat wird nicht unterstützt."
#: cal.php:181 cal.php:185
msgid "Export Events"
msgstr "Exportiere Ereignisse"
#: cal.php:189
msgid "If this is enabled, your public events will be available at"
msgstr "Wenn dies aktiviert ist, werden alle öffentliche Ereignisse unter folgender URL verfügbar sein"
#: cal.php:190
msgid "Currently supported formats are ical and csv."
msgstr "Derzeit werden die Formate ical und csv unterstützt."
#: cal.php:191
msgid "Enable calendar export"
msgstr "Kalenderexport aktivieren"
#: cal.php:193
msgid "Save Settings"
msgstr "Einstellungen speichern"

16
cal/lang/de/strings.php Normal file
View file

@ -0,0 +1,16 @@
<?php
if(! function_exists("string_plural_select_de")) {
function string_plural_select_de($n){
return ($n != 1);;
}}
;
$a->strings["Event Export"] = "Ereignis Export";
$a->strings["You can download public events from: "] = "Du kannst öffentliche Ereignisse hier herunterladen;";
$a->strings["The user does not export the calendar."] = "Diese_r Nutzer_in exportiert den Kalender nicht.";
$a->strings["This calendar format is not supported"] = "Dieses Kalenderformat wird nicht unterstützt.";
$a->strings["Export Events"] = "Exportiere Ereignisse";
$a->strings["If this is enabled, your public events will be available at"] = "Wenn dies aktiviert ist, werden alle öffentliche Ereignisse unter folgender URL verfügbar sein";
$a->strings["Currently supported formats are ical and csv."] = "Derzeit werden die Formate ical und csv unterstützt.";
$a->strings["Enable calendar export"] = "Kalenderexport aktivieren";
$a->strings["Save Settings"] = "Einstellungen speichern";

55
cal/lang/es/messages.po Normal file
View file

@ -0,0 +1,55 @@
# ADDON cal
# Copyright (C)
# This file is distributed under the same license as the Friendica cal addon package.
#
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-06-22 13:18+0200\n"
"PO-Revision-Date: 2016-10-10 20:48+0000\n"
"Last-Translator: Athalbert\n"
"Language-Team: Spanish (http://www.transifex.com/Friendica/friendica/language/es/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: cal.php:33
msgid "Event Export"
msgstr "Exportación de evento"
#: cal.php:33
msgid "You can download public events from: "
msgstr "Puede descargar eventos públicos desde:"
#: cal.php:53
msgid "The user does not export the calendar."
msgstr "El usuario no exporta el calendario."
#: cal.php:83
msgid "This calendar format is not supported"
msgstr "No se soporta este formato de calendario"
#: cal.php:181 cal.php:185
msgid "Export Events"
msgstr "Exportar Eventos"
#: cal.php:189
msgid "If this is enabled, your public events will be available at"
msgstr "Si esto está habilitado, sus eventos públicos estarán permitidos en"
#: cal.php:190
msgid "Currently supported formats are ical and csv."
msgstr "Los formatos soportados actualmente son ical y csv."
#: cal.php:191
msgid "Enable calendar export"
msgstr "Habilitar exportar calendario"
#: cal.php:193
msgid "Save Settings"
msgstr "Guardar Ajustes"

16
cal/lang/es/strings.php Normal file
View file

@ -0,0 +1,16 @@
<?php
if(! function_exists("string_plural_select_es")) {
function string_plural_select_es($n){
return ($n != 1);;
}}
;
$a->strings["Event Export"] = "Exportación de evento";
$a->strings["You can download public events from: "] = "Puede descargar eventos públicos desde:";
$a->strings["The user does not export the calendar."] = "El usuario no exporta el calendario.";
$a->strings["This calendar format is not supported"] = "No se soporta este formato de calendario";
$a->strings["Export Events"] = "Exportar Eventos";
$a->strings["If this is enabled, your public events will be available at"] = "Si esto está habilitado, sus eventos públicos estarán permitidos en";
$a->strings["Currently supported formats are ical and csv."] = "Los formatos soportados actualmente son ical y csv.";
$a->strings["Enable calendar export"] = "Habilitar exportar calendario";
$a->strings["Save Settings"] = "Guardar Ajustes";

56
cal/lang/fr/messages.po Normal file
View file

@ -0,0 +1,56 @@
# ADDON cal
# Copyright (C)
# This file is distributed under the same license as the Friendica cal addon package.
#
#
# Translators:
# Tubuntu <tubuntu@testimonium.be>, 2014
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-06-22 13:18+0200\n"
"PO-Revision-Date: 2014-09-07 09:24+0000\n"
"Last-Translator: Tubuntu <tubuntu@testimonium.be>\n"
"Language-Team: French (http://www.transifex.com/projects/p/friendica/language/fr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: cal.php:33
msgid "Event Export"
msgstr "Exportation d'événement"
#: cal.php:33
msgid "You can download public events from: "
msgstr "Vous pouvez télécharger les événements publiques de :"
#: cal.php:53
msgid "The user does not export the calendar."
msgstr "L'utilisateur n'exporte pas le calendrier."
#: cal.php:83
msgid "This calendar format is not supported"
msgstr "Ce format de calendrier n'est pas pris en charge"
#: cal.php:181 cal.php:185
msgid "Export Events"
msgstr "Exporter les événements"
#: cal.php:189
msgid "If this is enabled, your public events will be available at"
msgstr "Si activé, vos événements publiques seront disponible à"
#: cal.php:190
msgid "Currently supported formats are ical and csv."
msgstr "Les formats actuellement pris en charge sont ical et csv."
#: cal.php:191
msgid "Enable calendar export"
msgstr "Activer l'export de calendrier"
#: cal.php:193
msgid "Save Settings"
msgstr "Sauvegarder les paramètres"

16
cal/lang/fr/strings.php Normal file
View file

@ -0,0 +1,16 @@
<?php
if(! function_exists("string_plural_select_fr")) {
function string_plural_select_fr($n){
return ($n > 1);;
}}
;
$a->strings["Event Export"] = "Exportation d'événement";
$a->strings["You can download public events from: "] = "Vous pouvez télécharger les événements publiques de :";
$a->strings["The user does not export the calendar."] = "L'utilisateur n'exporte pas le calendrier.";
$a->strings["This calendar format is not supported"] = "Ce format de calendrier n'est pas pris en charge";
$a->strings["Export Events"] = "Exporter les événements";
$a->strings["If this is enabled, your public events will be available at"] = "Si activé, vos événements publiques seront disponible à";
$a->strings["Currently supported formats are ical and csv."] = "Les formats actuellement pris en charge sont ical et csv.";
$a->strings["Enable calendar export"] = "Activer l'export de calendrier";
$a->strings["Save Settings"] = "Sauvegarder les paramètres";

56
cal/lang/it/messages.po Normal file
View file

@ -0,0 +1,56 @@
# ADDON cal
# Copyright (C)
# This file is distributed under the same license as the Friendica cal addon package.
#
#
# Translators:
# fabrixxm <fabrix.xm@gmail.com>, 2014
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-06-22 13:18+0200\n"
"PO-Revision-Date: 2014-09-10 10:30+0000\n"
"Last-Translator: fabrixxm <fabrix.xm@gmail.com>\n"
"Language-Team: Italian (http://www.transifex.com/Friendica/friendica/language/it/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: it\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: cal.php:33
msgid "Event Export"
msgstr "Esporta Evento"
#: cal.php:33
msgid "You can download public events from: "
msgstr "Puoi scaricare gli eventi publici da:"
#: cal.php:53
msgid "The user does not export the calendar."
msgstr "L'utente non esporta il calendario."
#: cal.php:83
msgid "This calendar format is not supported"
msgstr "Il formato del calendario non è supportato"
#: cal.php:181 cal.php:185
msgid "Export Events"
msgstr "Esporta Eventi"
#: cal.php:189
msgid "If this is enabled, your public events will be available at"
msgstr "Se abilitato, i tuoi eventi pubblici saranno disponibili a"
#: cal.php:190
msgid "Currently supported formats are ical and csv."
msgstr "I formati supportati sono ical e csv."
#: cal.php:191
msgid "Enable calendar export"
msgstr "Abilita esporazione calendario"
#: cal.php:193
msgid "Save Settings"
msgstr "Salva Impostazioni"

16
cal/lang/it/strings.php Normal file
View file

@ -0,0 +1,16 @@
<?php
if(! function_exists("string_plural_select_it")) {
function string_plural_select_it($n){
return ($n != 1);;
}}
;
$a->strings["Event Export"] = "Esporta Evento";
$a->strings["You can download public events from: "] = "Puoi scaricare gli eventi publici da:";
$a->strings["The user does not export the calendar."] = "L'utente non esporta il calendario.";
$a->strings["This calendar format is not supported"] = "Il formato del calendario non è supportato";
$a->strings["Export Events"] = "Esporta Eventi";
$a->strings["If this is enabled, your public events will be available at"] = "Se abilitato, i tuoi eventi pubblici saranno disponibili a";
$a->strings["Currently supported formats are ical and csv."] = "I formati supportati sono ical e csv.";
$a->strings["Enable calendar export"] = "Abilita esporazione calendario";
$a->strings["Save Settings"] = "Salva Impostazioni";

View file

@ -0,0 +1,57 @@
# ADDON cal
# Copyright (C)
# This file is distributed under the same license as the Friendica cal addon package.
#
#
# Translators:
# John Brazil, 2015
# Sérgio Lima <oigreslima@gmail.com>, 2014
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-06-22 13:18+0200\n"
"PO-Revision-Date: 2015-01-31 01:24+0000\n"
"Last-Translator: John Brazil\n"
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/projects/p/friendica/language/pt_BR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: pt_BR\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: cal.php:33
msgid "Event Export"
msgstr "Exportar Evento"
#: cal.php:33
msgid "You can download public events from: "
msgstr "Você pode baixar eventos públicos de:"
#: cal.php:53
msgid "The user does not export the calendar."
msgstr "O usuário não exportou o calendário."
#: cal.php:83
msgid "This calendar format is not supported"
msgstr "Esse formato de calendário não é suportado."
#: cal.php:181 cal.php:185
msgid "Export Events"
msgstr "Exporta Eventos"
#: cal.php:189
msgid "If this is enabled, your public events will be available at"
msgstr "Se isso estiver habiltiado, seus eventos públicos estarão disponíveis"
#: cal.php:190
msgid "Currently supported formats are ical and csv."
msgstr "Os formatos disponíveis atualmente são ical e csv."
#: cal.php:191
msgid "Enable calendar export"
msgstr "Habilite exportar calendário"
#: cal.php:193
msgid "Save Settings"
msgstr "Salvar as Configurações"

View file

@ -0,0 +1,16 @@
<?php
if(! function_exists("string_plural_select_pt_br")) {
function string_plural_select_pt_br($n){
return ($n > 1);;
}}
;
$a->strings["Event Export"] = "Exportar Evento";
$a->strings["You can download public events from: "] = "Você pode baixar eventos públicos de:";
$a->strings["The user does not export the calendar."] = "O usuário não exportou o calendário.";
$a->strings["This calendar format is not supported"] = "Esse formato de calendário não é suportado.";
$a->strings["Export Events"] = "Exporta Eventos";
$a->strings["If this is enabled, your public events will be available at"] = "Se isso estiver habiltiado, seus eventos públicos estarão disponíveis";
$a->strings["Currently supported formats are ical and csv."] = "Os formatos disponíveis atualmente são ical e csv.";
$a->strings["Enable calendar export"] = "Habilite exportar calendário";
$a->strings["Save Settings"] = "Salvar as Configurações";

56
cal/lang/ro/messages.po Normal file
View file

@ -0,0 +1,56 @@
# ADDON cal
# Copyright (C)
# This file is distributed under the same license as the Friendica cal addon package.
#
#
# Translators:
# Doru DEACONU <dumitrudeaconu@yahoo.com>, 2014
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-06-22 13:18+0200\n"
"PO-Revision-Date: 2014-11-27 14:13+0000\n"
"Last-Translator: Doru DEACONU <dumitrudeaconu@yahoo.com>\n"
"Language-Team: Romanian (Romania) (http://www.transifex.com/projects/p/friendica/language/ro_RO/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ro_RO\n"
"Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1));\n"
#: cal.php:33
msgid "Event Export"
msgstr "Exportare Eveniment"
#: cal.php:33
msgid "You can download public events from: "
msgstr "Puteți descărca evenimente publice de la:"
#: cal.php:53
msgid "The user does not export the calendar."
msgstr "Utilizatorul nu își exportă calendarul."
#: cal.php:83
msgid "This calendar format is not supported"
msgstr "Acest format de calendar nu este acceptat"
#: cal.php:181 cal.php:185
msgid "Export Events"
msgstr "Exportați Evenimente"
#: cal.php:189
msgid "If this is enabled, your public events will be available at"
msgstr "Dacă este activat, evenimente dvs publice vor fi disponibile pe"
#: cal.php:190
msgid "Currently supported formats are ical and csv."
msgstr "Formate acceptate în prezent sunt ical şi csv."
#: cal.php:191
msgid "Enable calendar export"
msgstr "Activați exportarea calendarului"
#: cal.php:193
msgid "Save Settings"
msgstr "Salvare Configurări"

16
cal/lang/ro/strings.php Normal file
View file

@ -0,0 +1,16 @@
<?php
if(! function_exists("string_plural_select_ro")) {
function string_plural_select_ro($n){
return ($n==1?0:((($n%100>19)||(($n%100==0)&&($n!=0)))?2:1));;
}}
;
$a->strings["Event Export"] = "Exportare Eveniment";
$a->strings["You can download public events from: "] = "Puteți descărca evenimente publice de la:";
$a->strings["The user does not export the calendar."] = "Utilizatorul nu își exportă calendarul.";
$a->strings["This calendar format is not supported"] = "Acest format de calendar nu este acceptat";
$a->strings["Export Events"] = "Exportați Evenimente";
$a->strings["If this is enabled, your public events will be available at"] = "Dacă este activat, evenimente dvs publice vor fi disponibile pe";
$a->strings["Currently supported formats are ical and csv."] = "Formate acceptate în prezent sunt ical şi csv.";
$a->strings["Enable calendar export"] = "Activați exportarea calendarului";
$a->strings["Save Settings"] = "Salvare Configurări";

56
cal/lang/ru/messages.po Normal file
View file

@ -0,0 +1,56 @@
# ADDON cal
# Copyright (C)
# This file is distributed under the same license as the Friendica cal addon package.
#
#
# Translators:
# Stanislav N. <pztrn@pztrn.name>, 2017
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-06-22 13:18+0200\n"
"PO-Revision-Date: 2017-04-08 17:06+0000\n"
"Last-Translator: Stanislav N. <pztrn@pztrn.name>\n"
"Language-Team: Russian (http://www.transifex.com/Friendica/friendica/language/ru/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ru\n"
"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n"
#: cal.php:33
msgid "Event Export"
msgstr "Экспорт событий"
#: cal.php:33
msgid "You can download public events from: "
msgstr "Вы можете скачать публичные события из:"
#: cal.php:53
msgid "The user does not export the calendar."
msgstr "Пользователь не экспортировал календарь."
#: cal.php:83
msgid "This calendar format is not supported"
msgstr "Этот формат календарей не поддерживается"
#: cal.php:181 cal.php:185
msgid "Export Events"
msgstr "Экспорт событий"
#: cal.php:189
msgid "If this is enabled, your public events will be available at"
msgstr "Если эта настройка включена, то ваши публичные события будут доступны на:"
#: cal.php:190
msgid "Currently supported formats are ical and csv."
msgstr "Текущие поддерживаемые форматы ical и csv."
#: cal.php:191
msgid "Enable calendar export"
msgstr "Включить экспорт календаря"
#: cal.php:193
msgid "Save Settings"
msgstr "Сохранить настройки"

16
cal/lang/ru/strings.php Normal file
View file

@ -0,0 +1,16 @@
<?php
if(! function_exists("string_plural_select_ru")) {
function string_plural_select_ru($n){
return ($n%10==1 && $n%100!=11 ? 0 : $n%10>=2 && $n%10<=4 && ($n%100<12 || $n%100>14) ? 1 : $n%10==0 || ($n%10>=5 && $n%10<=9) || ($n%100>=11 && $n%100<=14)? 2 : 3);;
}}
;
$a->strings["Event Export"] = "Экспорт событий";
$a->strings["You can download public events from: "] = "Вы можете скачать публичные события из:";
$a->strings["The user does not export the calendar."] = "Пользователь не экспортировал календарь.";
$a->strings["This calendar format is not supported"] = "Этот формат календарей не поддерживается";
$a->strings["Export Events"] = "Экспорт событий";
$a->strings["If this is enabled, your public events will be available at"] = "Если эта настройка включена, то ваши публичные события будут доступны на:";
$a->strings["Currently supported formats are ical and csv."] = "Текущие поддерживаемые форматы ical и csv.";
$a->strings["Enable calendar export"] = "Включить экспорт календаря";
$a->strings["Save Settings"] = "Сохранить настройки";

View file

@ -0,0 +1,56 @@
# ADDON cal
# Copyright (C)
# This file is distributed under the same license as the Friendica cal addon package.
#
#
# Translators:
# mytbk <mytbk920423@gmail.com>, 2017
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-06-22 13:18+0200\n"
"PO-Revision-Date: 2017-10-02 05:52+0000\n"
"Last-Translator: mytbk <mytbk920423@gmail.com>\n"
"Language-Team: Chinese (China) (http://www.transifex.com/Friendica/friendica/language/zh_CN/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: zh_CN\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: cal.php:33
msgid "Event Export"
msgstr "事件导出"
#: cal.php:33
msgid "You can download public events from: "
msgstr "你可以从这里下载公开事件:"
#: cal.php:53
msgid "The user does not export the calendar."
msgstr "这个用户没有导出日历。"
#: cal.php:83
msgid "This calendar format is not supported"
msgstr "不支持这个日历格式"
#: cal.php:181 cal.php:185
msgid "Export Events"
msgstr "导出事件"
#: cal.php:189
msgid "If this is enabled, your public events will be available at"
msgstr "如果这个被启用,你的公开事件会在"
#: cal.php:190
msgid "Currently supported formats are ical and csv."
msgstr "当前支持的格式是 ical 和 csv."
#: cal.php:191
msgid "Enable calendar export"
msgstr "启用日历导出"
#: cal.php:193
msgid "Save Settings"
msgstr "保存设置"

View file

@ -0,0 +1,16 @@
<?php
if(! function_exists("string_plural_select_zh_cn")) {
function string_plural_select_zh_cn($n){
return 0;;
}}
;
$a->strings["Event Export"] = "事件导出";
$a->strings["You can download public events from: "] = "你可以从这里下载公开事件:";
$a->strings["The user does not export the calendar."] = "这个用户没有导出日历。";
$a->strings["This calendar format is not supported"] = "不支持这个日历格式";
$a->strings["Export Events"] = "导出事件";
$a->strings["If this is enabled, your public events will be available at"] = "如果这个被启用,你的公开事件会在";
$a->strings["Currently supported formats are ical and csv."] = "当前支持的格式是 ical 和 csv.";
$a->strings["Enable calendar export"] = "启用日历导出";
$a->strings["Save Settings"] = "保存设置";

View file

@ -6,8 +6,6 @@
* Author: Fabio Comuni <http://kirgroup.com/profile/fabrixxm>
*/
use Friendica\Core\Config;
use Friendica\Module\Login;
require_once('mod/community.php');
@ -22,73 +20,37 @@ function communityhome_uninstall() {
logger("removed communityhome");
}
function communityhome_getopts() {
return [
'hidelogin'=>t('Hide login form'),
'showlastusers'=>t('Show last new users'),
'showactiveusers'=>t('Show last active users'),
'showlastphotos'=>t('Show last photos'),
'showlastlike'=>t('Show last liked items'),
'showcommunitystream'=>t('Show community stream')
];
}
function communityhome_plugin_admin(&$a, &$o) {
$tpl = get_markup_template( 'settings.tpl', 'addon/communityhome/' );
$opts = communityhome_getopts();
$ctx = [
'$submit' => t("Submit"),
'$fields' => [],
];
foreach($opts as $k=>$v) {
$ctx['fields'][] = ['communityhome_'.$k, $v, Config::get('communityhome', $k)];
}
$o = replace_macros($tpl, $ctx);
}
function communityhome_plugin_admin_post(&$a,&$b) {
if(x($_POST,'communityhome-submit')) {
$opts = communityhome_getopts();
foreach($opts as $k=>$v) {
Config::set('communityhome', $k, x($_POST,'communityhome_'.$k));
}
}
}
function communityhome_home(&$a, &$o){
// custom css
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.$a->get_baseurl().'/addon/communityhome/communityhome.css" media="all" />';
if (!Config::get('communityhome','hidelogin')){
$aside = [
if (!get_config('communityhome','hidelogin')){
$aside = array(
'$tab_1' => t('Login'),
'$tab_2' => t('OpenID'),
'$noOid' => Config::get('system','no_openid'),
];
'$noOid' => get_config('system','no_openid'),
);
// login form
$aside['$login_title'] = t('Login');
$aside['$login_form'] = Login::form($a->query_string, $a->config['register_policy'] == REGISTER_CLOSED ? false : true);
} else {
$aside = [
$aside['$login_form'] = login(($a->config['register_policy'] == REGISTER_CLOSED) ? false : true);
} else
$aside = array(
//'$tab_1' => t('Login'),
//'$tab_2' => t('OpenID'),
//'$noOid' => Config::get('system','no_openid'),
];
}
//'$noOid' => get_config('system','no_openid'),
);
// last 12 users
if (Config::get('communityhome','showlastusers')){
if (get_config('communityhome','showlastusers')===true){
$aside['$lastusers_title'] = t('Latest users');
$aside['$lastusers_items'] = [];
$aside['$lastusers_items'] = array();
$sql_extra = "";
$publish = (Config::get('system','publish_all') ? '' : " AND `publish` = 1 " );
$publish = (get_config('system','publish_all') ? '' : " AND `publish` = 1 " );
$order = " ORDER BY `register_date` DESC ";
$r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`
FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra $order LIMIT %d , %d ",
0,
12
@ -99,25 +61,25 @@ function communityhome_home(&$a, &$o){
$photo = 'thumb';
foreach($r as $rr) {
$profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
$entry = replace_macros($tpl,[
$entry = replace_macros($tpl,array(
'$id' => $rr['id'],
'$profile_link' => $profile_link,
'$photo' => $rr[$photo],
'$photo' => $a->get_cached_avatar_image($rr[$photo]),
'$alt_text' => $rr['name'],
]);
));
$aside['$lastusers_items'][] = $entry;
}
}
}
// 12 most active users (by posts and contacts)
// this query don't work on some mysql versions
if (Config::get('communityhome','showactiveusers')){
if (get_config('communityhome','showactiveusers')===true){
$r = q("SELECT `uni`.`contacts`,`uni`.`items`, `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname` FROM
(SELECT COUNT(*) as `contacts`, `uid` FROM `contact` WHERE `self`=0 GROUP BY `uid`) AS `con`,
(SELECT COUNT(*) as `items`, `uid` FROM `item` WHERE `item`.`changed` > DATE(NOW() - INTERVAL 1 MONTH) AND `item`.`wall` = 1 GROUP BY `uid`) AS `ite`,
(
SELECT `contacts`,`items`,`ite`.`uid` FROM `con` RIGHT OUTER JOIN `ite` ON `con`.`uid`=`ite`.`uid`
UNION ALL
SELECT `contacts`,`items`,`ite`.`uid` FROM `con` RIGHT OUTER JOIN `ite` ON `con`.`uid`=`ite`.`uid`
UNION ALL
SELECT `contacts`,`items`,`con`.`uid` FROM `con` LEFT OUTER JOIN `ite` ON `con`.`uid`=`ite`.`uid`
) AS `uni`, `user`, `profile`
WHERE `uni`.`uid`=`user`.`uid`
@ -127,31 +89,31 @@ function communityhome_home(&$a, &$o){
LIMIT 0,10");
if($r && count($r)) {
$aside['$activeusers_title'] = t('Most active users');
$aside['$activeusers_items'] = [];
$aside['$activeusers_items'] = array();
$photo = 'thumb';
foreach($r as $rr) {
$profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
$entry = replace_macros($tpl,[
$entry = replace_macros($tpl,array(
'$id' => $rr['id'],
'$profile_link' => $profile_link,
'$photo' => $rr[$photo],
'$photo_user' => sprintf("%s (%s posts, %s contacts)",$rr['name'], ($rr['items']?$rr['items']:'0'), ($rr['contacts']?$rr['contacts']:'0'))
]);
'$alt_text' => sprintf("%s (%s posts, %s contacts)",$rr['name'], ($rr['items']?$rr['items']:'0'), ($rr['contacts']?$rr['contacts']:'0'))
));
$aside['$activeusers_items'][] = $entry;
}
}
}
// last 12 photos
if (Config::get('communityhome','showlastphotos')){
if (get_config('communityhome','showlastphotos')===true){
$aside['$photos_title'] = t('Latest photos');
$aside['$photos_items'] = [];
$r = q("SELECT `photo`.`id`, `photo`.`resource-id`, `photo`.`scale`, `photo`.`desc`, `user`.`nickname`, `user`.`username` FROM
(SELECT `resource-id`, MAX(`scale`) as maxscale FROM `photo`
$aside['$photos_items'] = array();
$r = q("SELECT `photo`.`id`, `photo`.`resource-id`, `photo`.`scale`, `photo`.`desc`, `user`.`nickname`, `user`.`username` FROM
(SELECT `resource-id`, MAX(`scale`) as maxscale FROM `photo`
WHERE `profile`=0 AND `contact-id`=0 AND `album` NOT IN ('Contact Photos', '%s', 'Profile Photos', '%s')
AND `allow_cid`='' AND `allow_gid`='' AND `deny_cid`='' AND `deny_gid`='' GROUP BY `resource-id`) AS `t1`
INNER JOIN `photo` ON `photo`.`resource-id`=`t1`.`resource-id` AND `photo`.`scale` = `t1`.`maxscale`,
`user`
`user`
WHERE `user`.`uid` = `photo`.`uid`
AND `user`.`blockwall`=0
AND `user`.`hidewall` = 0
@ -169,13 +131,12 @@ function communityhome_home(&$a, &$o){
$photo_page = $a->get_baseurl() . '/photos/' . $rr['nickname'] . '/image/' . $rr['resource-id'];
$photo_url = $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['scale'] .'.jpg';
$entry = replace_macros($tpl,[
$entry = replace_macros($tpl,array(
'$id' => $rr['id'],
'$profile_link' => $photo_page,
'$photo' => $photo_url,
'$photo_user' => $rr['username'],
'$photo_title' => $rr['desc']
]);
'$alt_text' => $rr['username']." : ".$rr['desc'],
));
$aside['$photos_items'][] = $entry;
}
@ -183,13 +144,13 @@ function communityhome_home(&$a, &$o){
}
// last 10 liked items
if (Config::get('communityhome','showlastlike')){
if (get_config('communityhome','showlastlike')===true){
$aside['$like_title'] = t('Latest likes');
$aside['$like_items'] = [];
$r = q("SELECT `T1`.`created`, `T1`.`liker`, `T1`.`liker-link`, `item`.* FROM
(SELECT `parent-uri`, `created`, `author-name` AS `liker`,`author-link` AS `liker-link`
$aside['$like_items'] = array();
$r = q("SELECT `T1`.`created`, `T1`.`liker`, `T1`.`liker-link`, `item`.* FROM
(SELECT `parent-uri`, `created`, `author-name` AS `liker`,`author-link` AS `liker-link`
FROM `item` WHERE `verb`='http://activitystrea.ms/schema/1.0/like' GROUP BY `parent-uri` ORDER BY `created` DESC) AS T1
INNER JOIN `item` ON `item`.`uri`=`T1`.`parent-uri`
INNER JOIN `item` ON `item`.`uri`=`T1`.`parent-uri`
WHERE `T1`.`liker-link` LIKE '%s%%' OR `item`.`author-link` LIKE '%s%%'
GROUP BY `uri`
ORDER BY `T1`.`created` DESC
@ -215,7 +176,7 @@ function communityhome_home(&$a, &$o){
default:
if ($rr['resource-id']){
$post_type = t('photo');
$m=[]; preg_match("/\[url=([^]]*)\]/", $rr['body'], $m);
$m=array(); preg_match("/\[url=([^]]*)\]/", $rr['body'], $m);
$rr['plink'] = $m[1];
} else {
$post_type = t('status');
@ -237,14 +198,14 @@ function communityhome_home(&$a, &$o){
if(file_exists('home.html'))
$o = file_get_contents('home.html');
if (Config::get('communityhome','showcommunitystream')){
$oldset = Config::get('system','community_page_style');
if (get_config('communityhome','showcommunitystream')===true){
$oldset = get_config('system','community_page_style');
if ($oldset == CP_NO_COMMUNITY_PAGE)
Config::set('system','community_page_style', CP_USERS_ON_SERVER);
set_config('system','community_page_style', CP_USERS_ON_SERVER);
$o .= community_content($a,1);
if ($oldset == CP_NO_COMMUNITY_PAGE)
Config::set('system','community_page_style', $oldset);
set_config('system','community_page_style', $oldset);
}
}

View file

@ -2,8 +2,8 @@
<div class="directory-item" id="directory-item-{{$id}}" >
<div class="directory-photo-wrapper" id="directory-photo-wrapper-{{$id}}" >
<div class="directory-photo" id="directory-photo-{{$id}}" >
<a href="{{$profile_link}}" class="directory-profile-link" id="directory-profile-link-{{$id}}" >
<img class="directory-photo-img" src="{{$photo}}" alt="{{$photo_user}} {{if $photo_title}}: {{$photo_title}}{{/if}}" title="{{$alt_text}}" />
<a href="{{$profile}}-link" class="directory-profile-link" id="directory-profile-link-{{$id}}" >
<img class="directory-photo-img" src="{{$photo}}" alt="{{$alt}}-text" title="{{$alt}}-text" />
</a>
</div>
</div>

View file

@ -1,9 +0,0 @@
<div id="communityhome-wrapper">
{{foreach $fields as $field}}
{{include file="field_checkbox.tpl" field=$field}}
{{/foreach}}
</div>
<div class="settings-submit-wrapper" >
<input type="submit" id="communityhome-submit" name="communityhome-submit" class="settings-submit" value="{{$submit}}" />
</div>

View file

@ -15,7 +15,7 @@ function convert_uninstall() {
}
function convert_app_menu($a,&$b) {
$b['app_menu'][] = '<div class="app-title"><a href="convert">Units Conversion</a></div>';
$b['app_menu'][] = '<div class="app-title"><a href="convert">Units Conversion</a></div>';
}
@ -30,7 +30,7 @@ function convert_module() {}
function convert_content($app) {
include("UnitConvertor.php");
class TP_Converter extends UnitConvertor {
function TP_Converter($lang = "en")
{
@ -39,7 +39,7 @@ include("UnitConvertor.php");
} else {
$dec_point = '.'; $thousand_sep = ",";
}
$this->UnitConvertor($dec_point , $thousand_sep );
} // end func UnitConvertor
@ -47,24 +47,24 @@ include("UnitConvertor.php");
function find_base_unit($from,$to) {
while (list($skey,$sval) = each($this->bases)) {
if ($skey == $from || $to == $skey || in_array($to,$sval) || in_array($from,$sval)) {
return $skey;
return $skey;
}
}
return false;
return false;
}
function getTable($value, $from_unit, $to_unit, $precision) {
if ($base_unit = $this->find_base_unit($from_unit,$to_unit)) {
// A baseunit was found now lets convert from -> $base_unit
$cell ['value'] = $this->convert($value, $from_unit, $base_unit, $precision)." ".$base_unit;
// A baseunit was found now lets convert from -> $base_unit
$cell ['value'] = $this->convert($value, $from_unit, $base_unit, $precision)." ".$base_unit;
$cell ['class'] = ($base_unit == $from_unit || $base_unit == $to_unit) ? "framedred": "";
$cells[] = $cell;
// We now have the base unit and value now lets produce the table;
while (list($key,$val) = each($this->bases[$base_unit])) {
$cell ['value'] = $this->convert($value, $from_unit, $val, $precision)." ".$val;
$cell ['value'] = $this->convert($value, $from_unit, $val, $precision)." ".$val;
$cell ['class'] = ($val == $from_unit || $val == $to_unit) ? "framedred": "";
$cells[] = $cell;
}
@ -83,8 +83,8 @@ include("UnitConvertor.php");
}
$string .= "</tr></table>";
return $string;
}
}
}
}
@ -92,16 +92,16 @@ include("UnitConvertor.php");
$conv = new TP_Converter('en');
$conversions = [
'Temperature'=>['base' =>'Celsius',
'conv'=>[
'Fahrenheit'=>['ratio'=>1.8, 'offset'=>32],
'Kelvin'=>['ratio'=>1, 'offset'=>273],
$conversions = array(
'Temperature'=>array('base' =>'Celsius',
'conv'=>array(
'Fahrenheit'=>array('ratio'=>1.8, 'offset'=>32),
'Kelvin'=>array('ratio'=>1, 'offset'=>273),
'Reaumur'=>0.8
]
],
'Weight' => ['base' =>'kg',
'conv'=>[
)
),
'Weight' => array('base' =>'kg',
'conv'=>array(
'g'=>1000,
'mg'=>1000000,
't'=>0.001,
@ -109,13 +109,13 @@ $conversions = [
'oz'=>35.274,
'lb'=>2.2046,
'cwt(UK)' => 0.019684,
'cwt(US)' => 0.022046,
'cwt(US)' => 0.022046,
'ton (US)' => 0.0011023,
'ton (UK)' => 0.0009842
]
],
'Distance' => ['base' =>'km',
'conv'=>[
)
),
'Distance' => array('base' =>'km',
'conv'=>array(
'm'=>1000,
'dm'=>10000,
'cm'=>100000,
@ -127,25 +127,25 @@ $conversions = [
'yd'=>1093.6,
'furlong'=>4.970969537898672,
'fathom'=>546.8066491688539
]
],
'Area' => ['base' =>'km 2',
'conv'=>[
)
),
'Area' => array('base' =>'km 2',
'conv'=>array(
'ha'=>100,
'acre'=>247.105,
'm 2'=>pow(1000,2),
'dm 2'=>pow(10000,2),
'cm 2'=>pow(100000,2),
'mm 2'=>pow(1000000,2),
'mm 2'=>pow(1000000,2),
'mile 2'=>pow(0.62137,2),
'naut.miles 2'=>pow(0.53996,2),
'in 2'=>pow(39370,2),
'ft 2'=>pow(3280.8,2),
'yd 2'=>pow(1093.6,2),
]
],
'Volume' => ['base' =>'m 3',
'conv'=>[
)
),
'Volume' => array('base' =>'m 3',
'conv'=>array(
'in 3'=>61023.6,
'ft 3'=>35.315,
'cm 3'=>pow(10,6),
@ -161,22 +161,22 @@ $conversions = [
'fl oz' => 33814.02,
'tablespoon' => 67628.04,
'teaspoon' => 202884.1,
'pt (UK)'=>1000/0.56826,
'pt (UK)'=>1000/0.56826,
'barrel petroleum'=>1000/158.99,
'Register Tons'=>2.832,
'Register Tons'=>2.832,
'Ocean Tons'=>1.1327
]
],
'Speed' =>['base' =>'kmph',
'conv'=>[
)
),
'Speed' =>array('base' =>'kmph',
'conv'=>array(
'mps'=>0.0001726031,
'milesph'=>0.62137,
'knots'=>0.53996,
'mach STP'=>0.0008380431,
'c (warp)'=>9.265669e-10
]
]
];
)
)
);
while (list($key,$val) = each($conversions)) {
@ -223,6 +223,6 @@ while (list($key,$val) = each($conversions)) {
$o .= '</select>';
$o .= '<input type="submit" name="Submit" value="Submit" /></form>';
return $o;
}

7
convpath/README Normal file
View file

@ -0,0 +1,7 @@
convpath
This addon converts all internal paths according to the current scheme.
That means that if a page is called via https then all internal links are also converted into https.
Same happens when you call your page with http.

102
convpath/convpath.php Normal file
View file

@ -0,0 +1,102 @@
<?php
/**
* Name: Convert Paths
* Description: Converts all internal paths according to the current scheme (http or https)
* Version: 1.0
* Author: Michael Vogel <https://pirati.ca/profile/heluecht>
* Status: Unsupported
*/
function convpath_install() {
register_hook('page_end', 'addon/convpath/convpath.php', 'convpath_page_end');
register_hook('page_header', 'addon/convpath/convpath.php', 'convpath_page_header');
register_hook('ping_xmlize', 'addon/convpath/convpath.php', 'convpath_ping_xmlize_hook');
register_hook('prepare_body', 'addon/convpath/convpath.php', 'convpath_prepare_body_hook');
register_hook('display_item', 'addon/convpath/convpath.php', 'convpath_display_item_hook');
}
function convpath_uninstall() {
unregister_hook('page_end', 'addon/convpath/convpath.php', 'convpath_page_end');
unregister_hook('page_header', 'addon/convpath/convpath.php', 'convpath_page_header');
unregister_hook('ping_xmlize', 'addon/convpath/convpath.php', 'convpath_ping_xmlize_hook');
unregister_hook('prepare_body', 'addon/convpath/convpath.php', 'convpath_prepare_body_hook');
unregister_hook('display_item', 'addon/convpath/convpath.php', 'convpath_display_item_hook');
}
function convpath_ping_xmlize_hook(&$a, &$o) {
$o["photo"] = convpath_url($a, $o["photo"]);
}
function convpath_page_header(&$a, &$o){
$o = convpath_convert($o);
}
function convpath_page_end(&$a, &$o){
$o = convpath_convert($o);
if (isset($a->page['aside']))
$a->page['aside'] = convpath_convert($a->page['aside']);
}
function convpath_prepare_body_hook(&$a, &$o) {
$o["html"] = convpath_convert($o["html"]);
}
function convpath_display_item_hook(&$a, &$o) {
if (isset($o["output"])) {
if (isset($o["output"]["thumb"]))
$o["output"]["thumb"] = convpath_url($a, $o["output"]["thumb"]);
if (isset($o["output"]["author-avatar"]))
$o["output"]["author-avatar"] = convpath_url($a, $o["output"]["author-avatar"]);
if (isset($o["output"]["owner-avatar"]))
$o["output"]["owner-avatar"] = convpath_url($a, $o["output"]["owner-avatar"]);
if (isset($o["output"]["owner_photo"]))
$o["output"]["owner_photo"] = convpath_url($a, $o["output"]["owner_photo"]);
}
}
function convpath_url($a, $path) {
if ($path == "")
return("");
$ssl = (substr($a->get_baseurl(), 0, 8) == "https://");
if ($ssl) {
$search = "http://".$a->get_hostname();
$replace = "https://".$a->get_hostname();
} else {
$search = "https://".$a->get_hostname();
$replace = "http://".$a->get_hostname();
}
$path = str_replace($search, $replace, $path);
return($path);
}
/*
Converts a given path according to the current scheme
*/
function convpath_convert($path) {
global $a;
if ($path == "")
return("");
$ssl = (substr($a->get_baseurl(), 0, 8) == "https://");
if ($ssl) {
$search = "http://".$a->get_hostname();
$replace = "https://".$a->get_hostname();
} else {
$search = "https://".$a->get_hostname();
$replace = "http://".$a->get_hostname();
}
$searcharr = array("src='".$search, 'src="'.$search);
$replacearr = array("src='".$replace, 'src="'.$replace);
$path = str_replace($searcharr, $replacearr, $path);
//$path = str_replace($search, $replace, $path);
return($path);
}

View file

View file

@ -1,6 +1,6 @@
<?php
/**
* Name: Current Weather
* Name: Current Weather
* Description: Shows current weather conditions for user's location on their network page.
* Version: 1.1
* Author: Tony Baldwin <http://friendica.tonybaldwin.info/u/t0ny>
@ -13,17 +13,13 @@ require_once('include/network.php');
require_once("mod/proxy.php");
require_once('include/text.php');
use Friendica\Core\Cache;
use Friendica\Core\Config;
use Friendica\Core\PConfig;
// get the weather data from OpenWeatherMap
function getWeather( $loc, $units='metric', $lang='en', $appid='', $cachetime=0) {
$url = "http://api.openweathermap.org/data/2.5/weather?q=".$loc."&appid=".$appid."&lang=".$lang."&units=".$units."&mode=xml";
$cached = Cache::get('curweather'.md5($url));
$now = new DateTime();
if (!is_null($cached)) {
$cdate = PConfig::get(local_user(), 'curweather', 'last');
$cdate = get_pconfig(local_user(), 'curweather', 'last');
$cached = unserialize($cached);
if ($cdate + $cachetime > $now->getTimestamp()) {
return $cached;
@ -47,7 +43,7 @@ function getWeather( $loc, $units='metric', $lang='en', $appid='', $cachetime=0)
} else {
$desc = (string)$res->weather['value'].', '.(string)$res->clouds['name'];
}
$r = [
$r = array(
'city'=> (string) $res->city['name'][0],
'country' => (string) $res->city->country[0],
'lat' => (string) $res->city->coord['lat'],
@ -59,8 +55,8 @@ function getWeather( $loc, $units='metric', $lang='en', $appid='', $cachetime=0)
'wind' => (string)$res->wind->speed['name'].' ('.(string)$res->wind->speed['value'].$wunit.')',
'update' => (string)$res->lastupdate['value'],
'icon' => (string)$res->weather['icon']
];
PConfig::set(local_user(), 'curweather', 'last', $now->getTimestamp());
);
set_pconfig(local_user(), 'curweather', 'last', $now->getTimestamp());
Cache::set('curweather'.md5($url), serialize($r), CACHE_HOUR);
return $r;
}
@ -79,7 +75,7 @@ function curweather_uninstall() {
function curweather_network_mod_init(&$fk_app,&$b) {
if(! intval(PConfig::get(local_user(),'curweather','curweather_enable')))
if(! intval(get_pconfig(local_user(),'curweather','curweather_enable')))
return;
$fk_app->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $fk_app->get_baseurl() . '/addon/curweather/curweather.css' . '" media="all" />' . "\r\n";
@ -93,14 +89,14 @@ function curweather_network_mod_init(&$fk_app,&$b) {
// those parameters will be used to get: cloud status, temperature, preassure
// and relative humidity for display, also the relevent area of the map is
// linked from lat/log of the reply of OWMp
$rpt = PConfig::get(local_user(), 'curweather', 'curweather_loc');
$rpt = get_pconfig(local_user(), 'curweather', 'curweather_loc');
// set the language to the browsers language and use metric units
$lang = $_SESSION['language'];
$units = PConfig::get( local_user(), 'curweather', 'curweather_units');
$appid = Config::get('curweather','appid');
$cachetime = intval(Config::get('curweather','cachetime'));
$units = get_pconfig( local_user(), 'curweather', 'curweather_units');
$appid = get_config('curweather','appid');
$cachetime = intval(get_config('curweather','cachetime'));
if ($units==="")
$units = 'metric';
$ok = true;
@ -111,7 +107,7 @@ function curweather_network_mod_init(&$fk_app,&$b) {
if ($ok) {
$t = get_markup_template("widget.tpl", "addon/curweather/" );
$curweather = replace_macros ($t, [
$curweather = replace_macros ($t, array(
'$title' => t("Current Weather"),
'$icon' => proxy_url('http://openweathermap.org/img/w/'.$res['icon'].'.png'),
'$city' => $res['city'],
@ -119,20 +115,20 @@ function curweather_network_mod_init(&$fk_app,&$b) {
'$lat' => $res['lat'],
'$description' => $res['descripion'],
'$temp' => $res['temperature'],
'$relhumidity' => ['caption'=>t('Relative Humidity'), 'val'=>$res['humidity']],
'$pressure' => ['caption'=>t('Pressure'), 'val'=>$res['pressure']],
'$wind' => ['caption'=>t('Wind'), 'val'=> $res['wind']],
'$relhumidity' => array('caption'=>t('Relative Humidity'), 'val'=>$res['humidity']),
'$pressure' => array('caption'=>t('Pressure'), 'val'=>$res['pressure']),
'$wind' => array('caption'=>t('Wind'), 'val'=> $res['wind']),
'$lastupdate' => t('Last Updated').': '.$res['update'].'UTC',
'$databy' => t('Data by'),
'$showonmap' => t('Show on map')
]);
));
} else {
$t = get_markup_template('widget-error.tpl', 'addon/curweather/');
$curweather = replace_macros( $t, [
$curweather = replace_macros( $t, array(
'$problem' => t('There was a problem accessing the weather data. But have a look'),
'$rpt' => $rpt,
'$atOWM' => t('at OpenWeatherMap')
]);
));
}
$fk_app->page['aside'] = $curweather.$fk_app->page['aside'];
@ -143,9 +139,9 @@ function curweather_network_mod_init(&$fk_app,&$b) {
function curweather_plugin_settings_post($a,$post) {
if(! local_user() || (! x($_POST,'curweather-settings-submit')))
return;
PConfig::set(local_user(),'curweather','curweather_loc',trim($_POST['curweather_loc']));
PConfig::set(local_user(),'curweather','curweather_enable',intval($_POST['curweather_enable']));
PConfig::set(local_user(),'curweather','curweather_units',trim($_POST['curweather_units']));
set_pconfig(local_user(),'curweather','curweather_loc',trim($_POST['curweather_loc']));
set_pconfig(local_user(),'curweather','curweather_enable',intval($_POST['curweather_enable']));
set_pconfig(local_user(),'curweather','curweather_units',trim($_POST['curweather_units']));
info( t('Current Weather settings updated.') . EOL);
}
@ -158,28 +154,28 @@ function curweather_plugin_settings(&$a,&$s) {
/* Get the current state of our config variable */
$curweather_loc = PConfig::get(local_user(), 'curweather', 'curweather_loc');
$curweather_units = PConfig::get(local_user(), 'curweather', 'curweather_units');
$appid = Config::get('curweather','appid');
if ($appid=="") {
$curweather_loc = get_pconfig(local_user(), 'curweather', 'curweather_loc');
$curweather_units = get_pconfig(local_user(), 'curweather', 'curweather_units');
$appid = get_config('curweather','appid');
if ($appid=="") {
$noappidtext = t('No APPID found, please contact your admin to obtain one.');
} else {
$noappidtext = '';
}
$enable = intval(PConfig::get(local_user(),'curweather','curweather_enable'));
$enable = intval(get_pconfig(local_user(),'curweather','curweather_enable'));
$enable_checked = (($enable) ? ' checked="checked" ' : '');
// load template and replace the macros
$t = get_markup_template("settings.tpl", "addon/curweather/" );
$s = replace_macros ($t, [
'$submit' => t('Save Settings'),
$s = replace_macros ($t, array(
'$submit' => t('Save Settings'),
'$header' => t('Current Weather').' '.t('Settings'),
'$noappidtext' => $noappidtext,
'$info' => t('Enter either the name of your location or the zip code.'),
'$curweather_loc' => [ 'curweather_loc', t('Your Location'), $curweather_loc, t('Identifier of your location (name or zip code), e.g. <em>Berlin,DE</em> or <em>14476,DE</em>.') ],
'$curweather_units' => [ 'curweather_units', t('Units'), $curweather_units, t('select if the temperature should be displayed in &deg;C or &deg;F'), ['metric'=>'°C', 'imperial'=>'°F']],
'$enabled' => [ 'curweather_enable', t('Show weather data'), $enable, '']
]);
'$curweather_loc' => array( 'curweather_loc', t('Your Location'), $curweather_loc, t('Identifier of your location (name or zip code), e.g. <em>Berlin,DE</em> or <em>14476,DE</em>.') ),
'$curweather_units' => array( 'curweather_units', t('Units'), $curweather_units, t('select if the temperature should be displayed in &deg;C or &deg;F'), array('metric'=>'°C', 'imperial'=>'°F')),
'$enabled' => array( 'curweather_enable', t('Show weather data'), $enable, '')
));
return;
}
@ -189,20 +185,20 @@ function curweather_plugin_admin_post (&$a) {
if(! is_site_admin())
return;
if ($_POST['curweather-submit']) {
Config::set('curweather','appid',trim($_POST['appid']));
Config::set('curweather','cachetime',trim($_POST['cachetime']));
set_config('curweather','appid',trim($_POST['appid']));
set_config('curweather','cachetime',trim($_POST['cachetime']));
info( t('Curweather settings saved.'.EOL));
}
}
function curweather_plugin_admin (&$a, &$o) {
if(! is_site_admin())
return;
$appid = Config::get('curweather','appid');
$cachetime = Config::get('curweather','cachetime');
$appid = get_config('curweather','appid');
$cachetime = get_config('curweather','cachetime');
$t = get_markup_template("admin.tpl", "addon/curweather/" );
$o = replace_macros ($t, [
$o = replace_macros ($t, array(
'$submit' => t('Save Settings'),
'$cachetime' => ['cachetime', t('Caching Interval'), $cachetime, t('For how long should the weather data be cached? Choose according your OpenWeatherMap account type.'), ['0'=>t('no cache'), '300'=>'5 '.t('minutes'), '900'=>'15 '.t('minutes'), '1800'=>'30 '.t('minutes'), '3600'=>'60 '.t('minutes')]],
'$appid' => ['appid', t('Your APPID'), $appid, t('Your API key provided by OpenWeatherMap')]
]);
'$cachetime' => array('cachetime', t('Caching Interval'), $cachetime, t('For how long should the weather data be cached? Choose according your OpenWeatherMap account type.'), array('0'=>t('no cache'), '300'=>'5 '.t('minutes'), '900'=>'15 '.t('minutes'), '1800'=>'30 '.t('minutes'), '3600'=>'60 '.t('minutes'))),
'$appid' => array('appid', t('Your APPID'), $appid, t('Your API key provided by OpenWeatherMap'))
));
}

View file

@ -11,7 +11,7 @@
<li>{{$wind['caption']}}: {{$wind['val']}}</li>
</ul></p>
<p class="curweather-footer">
{{$databy}}: <a href="http://openweathermap.org">OpenWeatherMap</a>. <a href="http://openweathermap.org/weathermap?basemap=map&cities=true&layer=temperature&lat={{$lat}}&lon={{$lon}}&zoom=10">{{$showonmap}}</a>
{{$databy}}: <a href="http://openweathermap.org">OpenWeatherMap</a>. <a href="http://openweathermap.org/Maps?zoom=7&lat={{$lat}}&lon={{$lon}}&layers=B0FTTFF">{{$showonmap}}</a>
</p>
</div>
<div class="clear"></div>

View file

@ -1,6 +1,4 @@
# Calendar with CalDAV Support
**THIS ADDON IS UNSUPPORTED**
Calendar with CalDAV Support
This is a rewrite of the calendar system used by the german social network [Animexx](http://www.animexx.de/).
It's still in a very early stage, so expect major bugs. Please feel free to report any of them, by mail (cato@animexx.de) or Friendica: http://friendica.hoessl.eu/profile/cato
@ -18,28 +16,28 @@ At the moment, the calendar system supports the following features:
- The events of a calendar can be exported as ICS file. ICS files can be imported into a calendar
## Internationalization:
Internationalization:
- At the moment, settings for the US and the german systems are selectable (regarding the date format and the first day of the week). More will be added on request.
- The basic design of the system is aware of timezones; however this is not reflected in the UI yet. It currently assumes that the timezone set in the friendica-installation matches the user's local time and matches the local time set in the user's operating system.
## CalDAV device compatibility:
CalDAV device compatibility:
- iOS (iPhone/iPodTouch) works
- Thunderbird Lightning works
- Android:
- aCal (http://andrew.mcmillan.net.nz/projects/aCal) works, available in F-Droid and Google Play
- CalDAV-Sync (http://dmfs.org/caldav/) works, non-free
## Installation
Installation
After activating, serveral tables in the database have to be created. The admin-interface of the plugin will try to do this automatically.
In case of errors, the SQL-statement to create the tables manually are shown in the admin-interface.
## Functuality missing: (a.k.a. "Roadmap")
Functuality missing: (a.k.a. "Roadmap")
- Sharing events; all events are private at the moment, therefore this system is not a complete replacement for the friendica-native events
- Attendees / Collaboration
## Used libraries
Used libraries
SabreDAV
http://code.google.com/p/sabredav/

View file

@ -1,7 +1,5 @@
<?php
use Friendica\Core\PConfig;
abstract class wdcal_local
{
@ -36,7 +34,7 @@ abstract class wdcal_local
* @return wdcal_local
*/
static function getInstanceByUser($uid = 0) {
$dateformat = PConfig::get($uid, "dav", "dateformat");
$dateformat = get_pconfig($uid, "dav", "dateformat");
$format = self::getInstance($dateformat);
if ($format == null) $format = self::getInstance(self::LOCAL_US);
return $format;

View file

@ -4,10 +4,9 @@
* Description: A web-based calendar system with CalDAV-support. Also brings your Friendica-Contacts to your CardDAV-capable mobile phone. Requires PHP >= 5.3.
* Version: 0.3.0
* Author: Tobias Hößl <https://github.com/CatoTH/>
* Status: Unsupported
*/
$_v = explode(".", phpversion());
if ($_v[0] > 5 || ($_v[0] == 5 && $_v[1] >= 3)) {
require(__DIR__ . "/friendica/main.php");
}
}

View file

@ -16,13 +16,13 @@ define("CALDAV_NAMESPACE_PRIVATE", 1);
define("CALDAV_FRIENDICA_MINE", "friendica-mine");
define("CALDAV_FRIENDICA_CONTACTS", "friendica-contacts");
$GLOBALS["CALDAV_PRIVATE_SYSTEM_CALENDARS"] = [CALDAV_FRIENDICA_MINE, CALDAV_FRIENDICA_CONTACTS];
$GLOBALS["CALDAV_PRIVATE_SYSTEM_BACKENDS"] = ["Sabre_CalDAV_Backend_Friendica"];
$GLOBALS["CALDAV_PRIVATE_SYSTEM_CALENDARS"] = array(CALDAV_FRIENDICA_MINE, CALDAV_FRIENDICA_CONTACTS);
$GLOBALS["CALDAV_PRIVATE_SYSTEM_BACKENDS"] = array("Sabre_CalDAV_Backend_Friendica");
define("CARDDAV_NAMESPACE_PRIVATE", 1);
define("CARDDAV_FRIENDICA_CONTACT", "friendica");
$GLOBALS["CARDDAV_PRIVATE_SYSTEM_ADDRESSBOOKS"] = [CARDDAV_FRIENDICA_CONTACT];
$GLOBALS["CARDDAV_PRIVATE_SYSTEM_BACKENDS"] = ["Sabre_CardDAV_Backend_Friendica"];
$GLOBALS["CARDDAV_PRIVATE_SYSTEM_ADDRESSBOOKS"] = array(CARDDAV_FRIENDICA_CONTACT);
$GLOBALS["CARDDAV_PRIVATE_SYSTEM_BACKENDS"] = array("Sabre_CardDAV_Backend_Friendica");
$GLOBALS["CALDAV_ACL_PLUGIN_CLASS"] = "Sabre_DAVACL_Plugin_Friendica";
@ -106,7 +106,7 @@ function dav_compat_principal2namespace($principalUri = "")
if (strpos($principalUri, "principals/users/") !== 0) return null;
$username = substr($principalUri, strlen("principals/users/"));
return ["namespace" => CALDAV_NAMESPACE_PRIVATE, "namespace_id" => dav_compat_username2id($username)];
return array("namespace" => CALDAV_NAMESPACE_PRIVATE, "namespace_id" => dav_compat_username2id($username));
}
@ -200,13 +200,13 @@ function wdcal_calendar_factory_by_id($calendar_id)
*/
function wdcal_create_std_calendars_get_statements($user_id, $withcheck = true)
{
$stms = [];
$stms = array();
$a = get_app();
$uris = [
$uris = array(
'private' => t("Private Calendar"),
CALDAV_FRIENDICA_MINE => t("Friendica Events: Mine"),
CALDAV_FRIENDICA_CONTACTS => t("Friendica Events: Contacts"),
];
);
foreach ($uris as $uri => $name) {
$cals = q("SELECT * FROM %s%scalendars WHERE `namespace` = %d AND `namespace_id` = %d AND `uri` = '%s'",
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, CALDAV_NAMESPACE_PRIVATE, IntVal($user_id), dbesc($uri));
@ -242,12 +242,12 @@ function wdcal_create_std_calendars()
*/
function wdcal_create_std_addressbooks_get_statements($user_id, $withcheck = true)
{
$stms = [];
$stms = array();
$a = get_app();
$uris = [
$uris = array(
'private' => t("Private Addresses"),
CARDDAV_FRIENDICA_CONTACT => t("Friendica Contacts"),
];
);
foreach ($uris as $uri => $name) {
$cals = q("SELECT * FROM %s%saddressbooks WHERE `namespace` = %d AND `namespace_id` = %d AND `uri` = '%s'",
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, CALDAV_NAMESPACE_PRIVATE, IntVal($user_id), dbesc($uri));

View file

@ -7,7 +7,7 @@
*/
function dav_get_update_statements($from_version)
{
$stms = [];
$stms = array();
if ($from_version == 1) {
$stms[] = "ALTER TABLE `dav_calendarobjects`
@ -30,7 +30,7 @@ function dav_get_update_statements($from_version)
`dav_locks` ,
`dav_notifications` ;";
$stms = array_merge($stms, dav_get_create_statements(["dav_calendarobjects"]));
$stms = array_merge($stms, dav_get_create_statements(array("dav_calendarobjects")));
$user_ids = q("SELECT DISTINCT `uid` FROM %s%scalendars", CALDAV_SQL_DB, CALDAV_SQL_PREFIX);
foreach ($user_ids as $user) $stms = array_merge($stms, wdcal_create_std_calendars_get_statements($user["uid"], false));
@ -43,7 +43,7 @@ function dav_get_update_statements($from_version)
}
if (in_array($from_version, [1, 2])) {
if (in_array($from_version, array(1, 2))) {
$stms[] = "CREATE TABLE IF NOT EXISTS `dav_addressbooks` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`namespace` mediumint(9) NOT NULL,
@ -80,9 +80,9 @@ function dav_get_update_statements($from_version)
* @param array $except
* @return array
*/
function dav_get_create_statements($except = [])
function dav_get_create_statements($except = array())
{
$arr = [];
$arr = array();
if (!in_array("dav_caldav_log", $except)) $arr[] = "CREATE TABLE IF NOT EXISTS `dav_caldav_log` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
@ -240,7 +240,7 @@ function dav_check_tables()
function dav_create_tables()
{
$stms = dav_get_create_statements();
$errors = [];
$errors = array();
foreach ($stms as $st) { // @TODO Friendica-dependent
dba::e($st);
@ -258,10 +258,10 @@ function dav_create_tables()
function dav_upgrade_tables()
{
$ver = dav_check_tables();
if (!in_array($ver, [1, 2])) return ["Unknown error"];
if (!in_array($ver, array(1, 2))) return array("Unknown error");
$stms = dav_get_update_statements($ver);
$errors = [];
$errors = array();
foreach ($stms as $st) { // @TODO Friendica-dependent
dba::e($st);

View file

@ -124,7 +124,7 @@ class Sabre_CalDAV_Backend_Friendica extends Sabre_CalDAV_Backend_Virtual
$summary = (($row["summary"]) ? $row["summary"] : substr(preg_replace("/\[[^\]]*\]/", "", $row["desc"]), 0, 100));
return [
return array(
"jq_id" => $row["id"],
"ev_id" => $row["id"],
"summary" => escape_tags($summary),
@ -142,7 +142,7 @@ class Sabre_CalDAV_Backend_Friendica extends Sabre_CalDAV_Backend_Virtual
"url_detail" => $base_path . "/events/event/" . $row["id"],
"url_edit" => "",
"special_type" => ($row["type"] == "birthday" ? "birthday" : ""),
];
);
}
@ -179,7 +179,7 @@ class Sabre_CalDAV_Backend_Friendica extends Sabre_CalDAV_Backend_Virtual
if (is_numeric($date_to)) $sql_where .= " AND `start` <= '" . date("Y-m-d H:i:s", $date_to) . "'";
else $sql_where .= " AND `start` <= '" . dbesc($date_to) . "'";
}
$ret = [];
$ret = array();
$r = q("SELECT * FROM `event` WHERE `uid` = %d " . $sql_where . " ORDER BY `start`", IntVal($calendar["namespace_id"]));
@ -214,21 +214,21 @@ class Sabre_CalDAV_Backend_Friendica extends Sabre_CalDAV_Backend_Virtual
public function getCalendarsForUser($principalUri)
{
$n = dav_compat_principal2namespace($principalUri);
if ($n["namespace"] != $this->getNamespace()) return [];
if ($n["namespace"] != $this->getNamespace()) return array();
$cals = q("SELECT * FROM %s%scalendars WHERE `namespace` = %d AND `namespace_id` = %d", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, $this->getNamespace(), IntVal($n["namespace_id"]));
$ret = [];
$ret = array();
foreach ($cals as $cal) {
if (!in_array($cal["uri"], $GLOBALS["CALDAV_PRIVATE_SYSTEM_CALENDARS"])) continue;
$dat = [
$dat = array(
"id" => $cal["id"],
"uri" => $cal["uri"],
"principaluri" => $principalUri,
'{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}getctag' => $cal['ctag'] ? $cal['ctag'] : '0',
'{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}supported-calendar-component-set' => new Sabre_CalDAV_Property_SupportedCalendarComponentSet(["VEVENT"]),
'{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}supported-calendar-component-set' => new Sabre_CalDAV_Property_SupportedCalendarComponentSet(array("VEVENT")),
"calendar_class" => "Sabre_CalDAV_Calendar_Virtual",
];
);
foreach ($this->propertyMap as $key=> $field) $dat[$key] = $cal[$field];
$ret[] = $dat;

View file

@ -46,13 +46,13 @@ class Sabre_CardDAV_Backend_Friendica extends Sabre_CardDAV_Backend_Virtual
{
$uid = dav_compat_principal2uid($principalUri);
$addressBooks = [];
$addressBooks = array();
$books = q("SELECT id, ctag FROM %s%saddressbooks WHERE `namespace` = %d AND `namespace_id` = %d AND `uri` = '%s'",
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, CARDDAV_NAMESPACE_PRIVATE, IntVal($uid), dbesc(CARDDAV_FRIENDICA_CONTACT));
$ctag = $books[0]["ctag"];
$addressBooks[] = [
$addressBooks[] = array(
'id' => $books[0]["id"],
'uri' => "friendica",
'principaluri' => $principalUri,
@ -61,7 +61,7 @@ class Sabre_CardDAV_Backend_Friendica extends Sabre_CardDAV_Backend_Virtual
'{http://calendarserver.org/ns/}getctag' => $ctag,
'{' . Sabre_CardDAV_Plugin::NS_CARDDAV . '}supported-address-data' =>
new Sabre_CardDAV_Property_SupportedAddressData(),
];
);
return $addressBooks;
@ -76,7 +76,7 @@ class Sabre_CardDAV_Backend_Friendica extends Sabre_CardDAV_Backend_Virtual
{
$name = explode(" ", $contact["name"]);
$first_name = $last_name = "";
$middle_name = [];
$middle_name = array();
$num = count($name);
for ($i = 0; $i < $num && $first_name == ""; $i++) if ($name[$i] != "") {
$first_name = $name[$i];
@ -114,14 +114,14 @@ class Sabre_CardDAV_Backend_Friendica extends Sabre_CardDAV_Backend_Virtual
}
$vcard = vcard_source_compile($vcarddata);
return [
return array(
"id" => $contact["id"],
"carddata" => $vcard,
"uri" => $contact["id"] . ".vcf",
"lastmodified" => wdcal_mySql2PhpTime($vcarddata->last_update),
"etag" => md5($vcard),
"size" => strlen($vcard),
];
);
}

View file

@ -1,41 +1,41 @@
<?php
use Friendica\Model\User;
class Sabre_DAV_Auth_Backend_Std extends Sabre_DAV_Auth_Backend_AbstractBasic {
public function __construct() {
}
class Sabre_DAV_Auth_Backend_Std extends Sabre_DAV_Auth_Backend_AbstractBasic
{
/**
* @var Sabre_DAV_Auth_Backend_Std|null
*/
private static $instance = null;
private static $intstance = null;
/**
* @static
* @return Sabre_DAV_Auth_Backend_Std
*/
public static function getInstance()
{
if (is_null(self::$instance)) {
self::$instance = new Sabre_DAV_Auth_Backend_Std();
public static function &getInstance() {
if (is_null(self::$intstance)) {
self::$intstance = new Sabre_DAV_Auth_Backend_Std();
}
return self::$instance;
return self::$intstance;
}
/**
* @return array
*/
public function getUsers()
{
return [$this->currentUser];
}
public function getUsers() {
return array($this->currentUser);
}
/**
* @return null|string
*/
public function getCurrentUser()
{
return $this->currentUser;
}
public function getCurrentUser() {
return $this->currentUser;
}
/**
* Authenticates the user based on the current request.
@ -48,8 +48,8 @@ class Sabre_DAV_Auth_Backend_Std extends Sabre_DAV_Auth_Backend_AbstractBasic
* @throws Sabre_DAV_Exception_NotAuthenticated
* @return bool
*/
public function authenticate(Sabre_DAV_Server $server, $realm)
{
public function authenticate(Sabre_DAV_Server $server, $realm) {
$a = get_app();
if (isset($a->user["uid"])) {
$this->currentUser = strtolower($a->user["nickname"]);
@ -67,7 +67,7 @@ class Sabre_DAV_Auth_Backend_Std extends Sabre_DAV_Auth_Backend_AbstractBasic
}
// Authenticates the user
if (!$this->validateUserPass($userpass[0], $userpass[1])) {
if (!$this->validateUserPass($userpass[0],$userpass[1])) {
$auth->requireLogin();
throw new Sabre_DAV_Exception_NotAuthenticated('Username or password does not match');
}
@ -75,13 +75,19 @@ class Sabre_DAV_Auth_Backend_Std extends Sabre_DAV_Auth_Backend_AbstractBasic
return true;
}
/**
* @param string $username
* @param string $password
* @return bool
*/
protected function validateUserPass($username, $password)
{
return User::authenticate($username, $password);
}
protected function validateUserPass($username, $password) {
$encrypted = hash('whirlpool',trim($password));
$r = q("SELECT COUNT(*) anz FROM `user` WHERE `nickname` = '%s' AND `password` = '%s' AND `blocked` = 0 AND `account_expired` = 0 AND `verified` = 1 LIMIT 1",
dbesc(trim($username)),
dbesc($encrypted)
);
return ($r[0]["anz"] == 1);
}
}

View file

@ -61,16 +61,16 @@ class Sabre_DAVACL_PrincipalBackend_Std implements Sabre_DAVACL_IPrincipalBacken
{
// This backend only support principals in one collection
if ($prefixPath !== $this->prefix) return [];
if ($prefixPath !== $this->prefix) return array();
$users = [];
$users = array();
$r = q("SELECT `nickname` FROM `user` WHERE `nickname` = '%s'", escape_tags($this->authBackend->getCurrentUser()) );
foreach ($r as $t) {
$users[] = [
$users[] = array(
'uri' => $this->prefix . '/' . strtolower($t['nickname']),
'{DAV:}displayname' => $t['nickname'],
];
);
}
return $users;
@ -94,24 +94,24 @@ class Sabre_DAVACL_PrincipalBackend_Std implements Sabre_DAVACL_IPrincipalBacken
if ($prefixPath !== $this->prefix) return null;
$r = q("SELECT `nickname` FROM `user` WHERE `nickname` = '%s'", escape_tags($userName) );
if (count($r) == 0) return [];
if (count($r) == 0) return array();
return [
return array(
'uri' => $this->prefix . '/' . strtolower($r[0]['nickname']),
'{DAV:}displayname' => $r[0]['nickname'],
];
);
}
function getGroupMemberSet($principal)
{
return [];
return array();
}
function getGroupMembership($principal)
{
return [];
return array();
}

View file

@ -1,7 +1,5 @@
<?php
use Friendica\Core\Config;
use Friendica\Core\PConfig;
/**
*
@ -25,7 +23,7 @@ function wdcal_addRequiredHeaders()
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/dav/wdcal/css/calendar.css' . '" media="all" />' . "\r\n";
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/dav/wdcal/css/main.css' . '" media="all" />' . "\r\n";
switch (Config::get("system", "language")) {
switch (get_config("system", "language")) {
case "de":
$a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/dav/common/wdcal/js/wdCalendar_lang_DE.js"></script>' . "\r\n";
$a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/dav/jqueryui/jquery.ui.datepicker-de.js"></script>' . "\r\n";
@ -80,7 +78,7 @@ function wdcal_import_user_ics($calendar_id) {
$server = dav_create_server(true, true, false);
$calendar = dav_get_current_user_calendar_by_id($server, $calendar_id, DAV_ACL_WRITE);
if (!$calendar) goaway('dav/wdcal/');
if (!$calendar) goaway($a->get_baseurl() . "/dav/wdcal/");
if (isset($_REQUEST["save"])) {
check_form_security_token_redirectOnErr('/dav/settings/', 'icsimport');
@ -91,7 +89,7 @@ function wdcal_import_user_ics($calendar_id) {
/** @var Sabre\VObject\Component\VCalendar $vObject */
$vObject = Sabre\VObject\Reader::read($text);
$comp = $vObject->getComponents();
$imported = [];
$imported = array();
foreach ($comp as $c) try {
/** @var Sabre\VObject\Component\VEvent $c */
$uid = $c->__get("UID")->value;
@ -171,18 +169,18 @@ function wdcal_import_user_ics($calendar_id) {
* @param bool $show_nav
* @return string
*/
function wdcal_printCalendar($calendars, $calendars_selected, $data_feed_url, $view = "week", $theme = 0, $height_diff = 175, $readonly = false, $curr_day = "", $add_params = [], $show_nav = true)
function wdcal_printCalendar($calendars, $calendars_selected, $data_feed_url, $view = "week", $theme = 0, $height_diff = 175, $readonly = false, $curr_day = "", $add_params = array(), $show_nav = true)
{
$a = get_app();
$localization = wdcal_local::getInstanceByUser($a->user["uid"]);
if (count($calendars_selected) == 0) foreach ($calendars as $c) {
$prop = $c->getProperties(["id"]);
$prop = $c->getProperties(array("id"));
$calendars_selected[] = $prop["id"];
}
$opts = [
$opts = array(
"view" => $view,
"theme" => $theme,
"readonly" => $readonly,
@ -194,7 +192,7 @@ function wdcal_printCalendar($calendars, $calendars_selected, $data_feed_url, $v
"date_format_dm3" => $localization->dateformat_js_dm3(),
"date_format_full" => $localization->dateformat_datepicker_js(),
"baseurl" => $a->get_baseurl() . "/dav/wdcal/",
];
);
$x = '
<script>
@ -207,7 +205,7 @@ function wdcal_printCalendar($calendars, $calendars_selected, $data_feed_url, $v
<div class="calselect"><strong>Available Calendars:</strong>';
foreach ($calendars as $cal) {
$cal_id = $cal->getProperties(["id", DAV_DISPLAYNAME]);
$cal_id = $cal->getProperties(array("id", DAV_DISPLAYNAME));
$x .= '<label style="margin-left: 10px; margin-right: 10px;"><input type="checkbox" name="cals[]" value="' . $cal_id["id"] . '"';
$found = false;
foreach ($calendars_selected as $pre) if ($pre["id"] == $cal_id["id"]) $found = true;
@ -308,12 +306,12 @@ function wdcal_getDetailPage($calendar_id, $calendarobject_id)
$calbackend = wdcal_calendar_factory_by_id($calendar_id);
$redirect = $calbackend->getItemDetailRedirect($calendar_id, $calendarobject_id);
if ($redirect !== null) goaway($redirect);
if ($redirect !== null) goaway($a->get_baseurl() . $redirect);
$details = $obj;
} catch (Exception $e) {
info(t("Error") . ": " . $e);
goaway('dav/wdcal/');
goaway($a->get_baseurl() . "/dav/wdcal/");
}
return print_r($details, true);
@ -359,7 +357,7 @@ function wdcal_getSettingsPage(&$a)
if (isset($_REQUEST["save"])) {
check_form_security_token_redirectOnErr('/dav/settings/', 'calprop');
PConfig::set($a->user["uid"], "dav", "dateformat", $_REQUEST["wdcal_date_format"]);
set_pconfig($a->user["uid"], "dav", "dateformat", $_REQUEST["wdcal_date_format"]);
info(t('The new values have been saved.'));
}

View file

@ -1,8 +1,5 @@
<?php
use Friendica\Module\Login;
use Friendica\Util\Emailer;
require_once('include/security.php');
function dav_install()
@ -150,7 +147,7 @@ function dav_content()
{
$a = get_app();
if (!isset($a->user["uid"]) || $a->user["uid"] == 0) {
return Login::form();
return login();
}
$x = "";
@ -166,7 +163,7 @@ function dav_content()
$ret = wdcal_postEditPage("new", "", $a->user["uid"], $a->timezone, $a->get_baseurl() . "/dav/wdcal/");
if ($ret["ok"]) notice($ret["msg"]);
else info($ret["msg"]);
goaway('dav/wdcal/');
goaway($a->get_baseurl() . "/dav/wdcal/");
}
$o .= wdcal_getNewPage();
return $o;
@ -184,7 +181,7 @@ function dav_content()
$ret = wdcal_postEditPage($a->argv[3], $a->user["uid"], $a->timezone, $a->get_baseurl() . "/dav/wdcal/");
if ($ret["ok"]) notice($ret["msg"]);
else info($ret["msg"]);
goaway('dav/wdcal/');
goaway($a->get_baseurl() . "/dav/wdcal/");
}
$o .= wdcal_getEditPage($calendar_id, $a->argv[3]);
return $o;
@ -198,7 +195,7 @@ function dav_content()
} else {
$server = dav_create_server(true, true, false);
$cals = dav_get_current_user_calendars($server, DAV_ACL_READ);
$x = wdcal_printCalendar($cals, [], $a->get_baseurl() . "/dav/wdcal/feed/", "week", 0, 200);
$x = wdcal_printCalendar($cals, array(), $a->get_baseurl() . "/dav/wdcal/feed/", "week", 0, 200);
}
}
} catch (DAVVersionMismatchException $e) {
@ -238,12 +235,12 @@ function dav_event_updated_hook(&$a, &$b)
*/
function dav_profile_tabs_hook(&$a, &$b)
{
$b["tabs"][] = [
$b["tabs"][] = array(
"label" => t('Calendar'),
"url" => $a->get_baseurl() . "/dav/wdcal/",
"sel" => "",
"title" => t('Extended calendar with CalDAV-support'),
];
);
}
@ -261,7 +258,7 @@ function dav_cron(&$a, &$b)
q("UPDATE %s%snotifications SET `notified` = 1 WHERE `id` = %d", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, $not["id"]);
$event = q("SELECT * FROM %s%sjqcalendar WHERE `calendarobject_id` = %d", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, $not["calendarobject_id"]);
$calendar = q("SELECT * FROM %s%scalendars WHERE `id` = %d", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, $not["calendar_id"]);
$users = [];
$users = array();
if (count($calendar) != 1 || count($event) == 0) continue;
switch ($calendar[0]["namespace"]) {
case CALDAV_NAMESPACE_PRIVATE:
@ -274,11 +271,11 @@ function dav_cron(&$a, &$b)
case "email":
case "display": // @TODO implement "Display"
foreach ($users as $user) {
$find = ["%to%", "%event%", "%url%"];
$repl = [$user["username"], $event[0]["Summary"], $a->get_baseurl() . "/dav/wdcal/" . $calendar[0]["id"] . "/" . $not["calendarobject_id"] . "/"];
$find = array("%to%", "%event%", "%url%");
$repl = array($user["username"], $event[0]["Summary"], $a->get_baseurl() . "/dav/wdcal/" . $calendar[0]["id"] . "/" . $not["calendarobject_id"] . "/");
$text_text = str_replace($find, $repl, "Hi %to%!\n\nThe event \"%event%\" is about to begin:\n%url%");
$text_html = str_replace($find, $repl, "Hi %to%!<br>\n<br>\nThe event \"%event%\" is about to begin:<br>\n<a href='" . "%url%" . "'>%url%</a>");
$params = [
$params = array(
'fromName' => FRIENDICA_PLATFORM,
'fromEmail' => t('noreply') . '@' . $a->get_hostname(),
'replyTo' => t('noreply') . '@' . $a->get_hostname(),
@ -287,7 +284,8 @@ function dav_cron(&$a, &$b)
'htmlVersion' => $text_html,
'textVersion' => $text_text,
'additionalMailHeader' => "",
];
);
require_once('include/Emailer.php');
Emailer::send($params);
}
break;

7
defaultfeatures/README Normal file
View file

@ -0,0 +1,7 @@
Default Features Plugin
This plugin allows the site admin to choose which Additional Features
are on by default for newly created users on the site. The defaults
apply to all new users upon registration, but do not impact a user's
ability to turn features on/off once their account has been created.
These default settings do not impact existing users.

View file

@ -0,0 +1,60 @@
<?php
/**
* Name: Default Features
* Description: Choose which Additional Features are on by default for new users on the site.
* Version: 1.0
* Author: Michael Johnston
* Status: Unsupported
*/
function defaultfeatures_install() {
register_hook('register_account', 'addon/defaultfeatures/defaultfeatures.php', 'defaultfeatures_register');
logger("installed defaultfeatures plugin");
}
function defaultfeatures_uninstall() {
unregister_hook('register_account', 'addon/defaultfeatures/defaultfeatures.php', 'defaultfeatures_register');
logger("uninstalled defaultfeatures plugin");
}
function defaultfeatures_register($a, $newuid) {
$arr = array();
$features = get_features();
foreach($features as $fname => $fdata) {
foreach(array_slice($fdata,1) as $f) {
set_pconfig($newuid,'feature',$f[0],((intval(get_config('defaultfeatures',$f[0]))) ? "1" : "0"));
}
}
}
function defaultfeatures_plugin_admin_post (&$a) {
check_form_security_token_redirectOnErr('/admin/plugins/defaultfeatures', 'defaultfeaturessave');
foreach($_POST as $k => $v) {
if(strpos($k,'feature_') === 0) {
set_config('defaultfeatures',substr($k,8),((intval($v)) ? 1 : 0));
}
}
info( t('Features updated') . EOL);
}
function defaultfeatures_plugin_admin (&$a, &$o) {
$t = get_markup_template( "admin.tpl", "addon/defaultfeatures/" );
$token = get_form_security_token("defaultfeaturessave");
$arr = array();
$features = get_features();
foreach($features as $fname => $fdata) {
$arr[$fname] = array();
$arr[$fname][0] = $fdata[0];
foreach(array_slice($fdata,1) as $f) {
$arr[$fname][1][] = array('feature_' .$f[0],$f[1],((intval(get_config('defaultfeatures',$f[0]))) ? "1" : "0"),$f[2],array(t('Off'),t('On')));
}
}
//logger("Features: " . print_r($arr,true));
$o = replace_macros($t, array(
'$submit' => t('Save Settings'),
'$features' => $arr,
'$form_security_token' => $token
));
}

View file

@ -0,0 +1,34 @@
# ADDON defaultfeatures
# Copyright (C)
# This file is distributed under the same license as the Friendica defaultfeatures addon package.
#
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-06-23 14:44+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: defaultfeatures.php:36
msgid "Features updated"
msgstr ""
#: defaultfeatures.php:48
msgid "Off"
msgstr ""
#: defaultfeatures.php:48
msgid "On"
msgstr ""
#: defaultfeatures.php:55
msgid "Save Settings"
msgstr ""

View file

@ -0,0 +1,14 @@
{{*
* AUTOMATICALLY GENERATED TEMPLATE
* DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
*
*}}
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
{{foreach $features as $f}}
<h3 class="settings-heading">{{$f.0}}</h3>
{{foreach $f.1 as $fcat}}
{{include file="field_yesno.tpl" field=$fcat}}
{{/foreach}}
{{/foreach}}
<div class="submit"><input type="submit" name="defaultfeatures-submit" value="{{$submit}}" /></div>

View file

@ -69,7 +69,7 @@ class Diaspora_Connection {
return ($this->tls) ? 'https' : 'http';
}
private function doHttpRequest($url, $data = [], $headers = []) {
private function doHttpRequest($url, $data = array(), $headers = array()) {
if (0 === strpos($url, '/')) {
$url = $this->getScheme() . '://' . $this->host . $url;
}
@ -122,14 +122,14 @@ class Diaspora_Connection {
return $this->last_http_result;
}
private function doHttpDelete($url, $data = [], $headers = []) {
private function doHttpDelete($url, $data = array(), $headers = array()) {
$this->http_method = 'DELETE';
$this->doHttpRequest($url, $data, $headers);
$this->http_method = null; // reset for next request
}
private function parseAuthenticityToken($str) {
$m = [];
$m = array();
preg_match('/<meta (?:name="csrf-token" content="(.*?)"|content="(.*?)" name="csrf-token")/', $str, $m);
if (empty($m[1]) && !empty($m[2])) {
$token = $m[2];
@ -151,11 +151,11 @@ class Diaspora_Connection {
public function logIn() {
$this->doHttpRequest('/users/sign_in');
$params = [
$params = array(
'user[username]' => $this->user,
'user[password]' => $this->password,
'authenticity_token' => $this->csrf_token
];
);
$this->doHttpRequest('/users/sign_in', $params);
$this->doHttpRequest('/stream');
return (200 === $this->last_http_result->info['http_code']) ? true : false;
@ -163,14 +163,14 @@ class Diaspora_Connection {
public function getAspects() {
$this->doHttpRequest('/bookmarklet');
$m = [];
$m = array();
preg_match('/"aspects"\:(\[.+?\])/', $this->last_http_result->response, $m);
return (!empty($m[1])) ? json_decode($m[1]) : false;
}
public function getServices() {
$this->doHttpRequest('/bookmarklet');
$m = [];
$m = array();
preg_match('/"configured_services"\:(\[.+?\])/', $this->last_http_result->response, $m);
return (!empty($m[1])) ? json_decode($m[1]) : false;
}
@ -196,24 +196,24 @@ class Diaspora_Connection {
return $this->readJsonResponse($this->last_http_result->response);
}
public function postStatusMessage($msg, $aspect_ids = 'all_aspects', $additional_data = []) {
$data = [
public function postStatusMessage($msg, $aspect_ids = 'all_aspects', $additional_data = array()) {
$data = array(
'aspect_ids' => $aspect_ids,
'status_message' => [
'status_message' => array(
'text' => $msg,
'provider_display_name' => $this->provider
]
];
)
);
if (!empty($additional_data)) {
$data += $additional_data;
}
$headers = [
$headers = array(
'Content-Type: application/json',
'Accept: application/json',
'X-CSRF-Token: ' . $this->csrf_token
];
);
$this->http_method = 'POST';
$this->doHttpRequest('/status_messages', json_encode($data), $headers);
@ -228,18 +228,18 @@ class Diaspora_Connection {
}
public function postPhoto($file) {
$params = [
$params = array(
'photo[pending]' => 'true',
'qqfile' => basename($file)
];
);
$query_string = '?' . http_build_query($params);
$headers = [
$headers = array(
'Accept: application/json',
'X-Requested-With: XMLHttpRequest',
'X-CSRF-Token: ' . $this->csrf_token,
'X-File-Name: ' . basename($file),
'Content-Type: application/octet-stream',
];
);
if ($size = @filesize($file)) {
$headers[] = "Content-Length: $size";
}
@ -249,14 +249,14 @@ class Diaspora_Connection {
}
public function deletePost($id) {
$headers = ['X-CSRF-Token: ' . $this->csrf_token];
$this->doHttpDelete("/posts/$id", [], $headers);
$headers = array('X-CSRF-Token: ' . $this->csrf_token);
$this->doHttpDelete("/posts/$id", array(), $headers);
return (204 === $this->last_http_result->info['http_code']) ? true : false;
}
public function deleteComment($id) {
$headers = ['X-CSRF-Token: ' . $this->csrf_token];
$this->doHttpDelete("/comments/$id", [], $headers);
$headers = array('X-CSRF-Token: ' . $this->csrf_token);
$this->doHttpDelete("/comments/$id", array(), $headers);
return (204 === $this->last_http_result->info['http_code']) ? true : false;
}

View file

@ -9,9 +9,6 @@
require_once("addon/diaspora/Diaspora_Connection.php");
use Friendica\Core\PConfig;
use Friendica\Database\DBM;
function diaspora_install() {
register_hook('post_local', 'addon/diaspora/diaspora.php', 'diaspora_post_local');
register_hook('notifier_normal', 'addon/diaspora/diaspora.php', 'diaspora_send');
@ -34,9 +31,9 @@ function diaspora_jot_nets(&$a,&$b) {
if(! local_user())
return;
$diaspora_post = PConfig::get(local_user(),'diaspora','post');
$diaspora_post = get_pconfig(local_user(),'diaspora','post');
if(intval($diaspora_post) == 1) {
$diaspora_defpost = PConfig::get(local_user(),'diaspora','post_by_default');
$diaspora_defpost = get_pconfig(local_user(),'diaspora','post_by_default');
$selected = ((intval($diaspora_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="diaspora_enable"' . $selected . ' value="1" /> '
. t('Post to Diaspora') . '</div>';
@ -69,9 +66,9 @@ function diaspora_queue_hook(&$a,&$b) {
$userdata = $r[0];
$handle = PConfig::get($userdata['uid'],'diaspora','handle');
$password = PConfig::get($userdata['uid'],'diaspora','password');
$aspect = PConfig::get($userdata['uid'],'diaspora','aspect');
$handle = get_pconfig($userdata['uid'],'diaspora','handle');
$password = get_pconfig($userdata['uid'],'diaspora','password');
$aspect = get_pconfig($userdata['uid'],'diaspora','aspect');
$success = false;
@ -122,22 +119,22 @@ function diaspora_settings(&$a,&$s) {
/* Get the current state of our config variables */
$enabled = PConfig::get(local_user(),'diaspora','post');
$enabled = get_pconfig(local_user(),'diaspora','post');
$checked = (($enabled) ? ' checked="checked" ' : '');
$css = (($enabled) ? '' : '-disabled');
$def_enabled = PConfig::get(local_user(),'diaspora','post_by_default');
$def_enabled = get_pconfig(local_user(),'diaspora','post_by_default');
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
$handle = PConfig::get(local_user(), 'diaspora', 'handle');
$password = PConfig::get(local_user(), 'diaspora', 'password');
$aspect = PConfig::get(local_user(),'diaspora','aspect');
$handle = get_pconfig(local_user(), 'diaspora', 'handle');
$password = get_pconfig(local_user(), 'diaspora', 'password');
$aspect = get_pconfig(local_user(),'diaspora','aspect');
$status = "";
$r = q("SELECT `addr` FROM `contact` WHERE `self` AND `uid` = %d", intval(local_user()));
if (DBM::is_result($r)) {
if (dbm::is_result($r)) {
$status = sprintf(t("Please remember: You can always be reached from Diaspora with your Friendica handle %s. "), $r[0]['addr']);
$status .= t('This connector is only meant if you still want to use your old Diaspora account for some time. ');
$status .= sprintf(t('However, it is preferred that you tell your Diaspora contacts the new handle %s instead.'), $r[0]['addr']);
@ -225,11 +222,11 @@ function diaspora_settings_post(&$a,&$b) {
if(x($_POST,'diaspora-submit')) {
PConfig::set(local_user(),'diaspora','post',intval($_POST['diaspora']));
PConfig::set(local_user(),'diaspora','post_by_default',intval($_POST['diaspora_bydefault']));
PConfig::set(local_user(),'diaspora','handle',trim($_POST['handle']));
PConfig::set(local_user(),'diaspora','password',trim($_POST['password']));
PConfig::set(local_user(),'diaspora','aspect',trim($_POST['aspect']));
set_pconfig(local_user(),'diaspora','post',intval($_POST['diaspora']));
set_pconfig(local_user(),'diaspora','post_by_default',intval($_POST['diaspora_bydefault']));
set_pconfig(local_user(),'diaspora','handle',trim($_POST['handle']));
set_pconfig(local_user(),'diaspora','password',trim($_POST['password']));
set_pconfig(local_user(),'diaspora','aspect',trim($_POST['aspect']));
}
}
@ -248,11 +245,11 @@ function diaspora_post_local(&$a,&$b) {
return;
}
$diaspora_post = intval(PConfig::get(local_user(),'diaspora','post'));
$diaspora_post = intval(get_pconfig(local_user(),'diaspora','post'));
$diaspora_enable = (($diaspora_post && x($_REQUEST,'diaspora_enable')) ? intval($_REQUEST['diaspora_enable']) : 0);
if ($b['api_source'] && intval(PConfig::get(local_user(),'diaspora','post_by_default'))) {
if ($b['api_source'] && intval(get_pconfig(local_user(),'diaspora','post_by_default'))) {
$diaspora_enable = 1;
}
@ -275,37 +272,27 @@ function diaspora_send(&$a,&$b) {
logger('diaspora_send: invoked');
if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) {
if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
return;
}
if(! strstr($b['postopts'],'diaspora')) {
if(! strstr($b['postopts'],'diaspora'))
return;
}
if($b['parent'] != $b['id']) {
if($b['parent'] != $b['id'])
return;
}
// Dont't post if the post doesn't belong to us.
// This is a check for forum postings
$self = dba::selectFirst('contact', ['id'], ['uid' => $b['uid'], 'self' => true]);
if ($b['contact-id'] != $self['id']) {
return;
}
logger('diaspora_send: prepare posting', LOGGER_DEBUG);
$handle = PConfig::get($b['uid'],'diaspora','handle');
$password = PConfig::get($b['uid'],'diaspora','password');
$aspect = PConfig::get($b['uid'],'diaspora','aspect');
$handle = get_pconfig($b['uid'],'diaspora','handle');
$password = get_pconfig($b['uid'],'diaspora','password');
$aspect = get_pconfig($b['uid'],'diaspora','aspect');
if ($handle && $password) {
logger('diaspora_send: all values seem to be okay', LOGGER_DEBUG);
require_once('include/bb2diaspora.php');
$tag_arr = [];
$tag_arr = array();
$tags = '';
$x = preg_match_all('/\#\[(.*?)\](.*?)\[/',$b['tag'],$matches,PREG_SET_ORDER);
@ -364,7 +351,7 @@ function diaspora_send(&$a,&$b) {
if (count($r))
$a->contact = $r[0]["id"];
$s = serialize(['url' => $url, 'item' => $b['id'], 'post' => $body]);
$s = serialize(array('url' => $url, 'item' => $b['id'], 'post' => $body));
require_once('include/queue_fn.php');
add_to_queue($a->contact,NETWORK_DIASPORA2,$s);
notice(t('Diaspora post failed. Queued for retry.').EOL);

View file

@ -9,8 +9,6 @@
* Author: Cat Gray <https://free-haven.org/profile/catness>
*/
use Friendica\Core\PConfig;
function dwpost_install() {
register_hook('post_local', 'addon/dwpost/dwpost.php', 'dwpost_post_local');
register_hook('notifier_normal', 'addon/dwpost/dwpost.php', 'dwpost_send');
@ -33,9 +31,9 @@ function dwpost_jot_nets(&$a,&$b) {
if(! local_user())
return;
$dw_post = PConfig::get(local_user(),'dwpost','post');
$dw_post = get_pconfig(local_user(),'dwpost','post');
if(intval($dw_post) == 1) {
$dw_defpost = PConfig::get(local_user(),'dwpost','post_by_default');
$dw_defpost = get_pconfig(local_user(),'dwpost','post_by_default');
$selected = ((intval($dw_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="dwpost_enable" ' . $selected . ' value="1" /> '
. t('Post to Dreamwidth') . '</div>';
@ -54,16 +52,16 @@ function dwpost_settings(&$a,&$s) {
/* Get the current state of our config variables */
$enabled = PConfig::get(local_user(),'dwpost','post');
$enabled = get_pconfig(local_user(),'dwpost','post');
$checked = (($enabled) ? ' checked="checked" ' : '');
$def_enabled = PConfig::get(local_user(),'dwpost','post_by_default');
$def_enabled = get_pconfig(local_user(),'dwpost','post_by_default');
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
$dw_username = PConfig::get(local_user(), 'dwpost', 'dw_username');
$dw_password = PConfig::get(local_user(), 'dwpost', 'dw_password');
$dw_username = get_pconfig(local_user(), 'dwpost', 'dw_username');
$dw_password = get_pconfig(local_user(), 'dwpost', 'dw_password');
/* Add some HTML to the existing form */
@ -107,10 +105,10 @@ function dwpost_settings_post(&$a,&$b) {
if(x($_POST,'dwpost-submit')) {
PConfig::set(local_user(),'dwpost','post',intval($_POST['dwpost']));
PConfig::set(local_user(),'dwpost','post_by_default',intval($_POST['dw_bydefault']));
PConfig::set(local_user(),'dwpost','dw_username',trim($_POST['dw_username']));
PConfig::set(local_user(),'dwpost','dw_password',trim($_POST['dw_password']));
set_pconfig(local_user(),'dwpost','post',intval($_POST['dwpost']));
set_pconfig(local_user(),'dwpost','post_by_default',intval($_POST['dw_bydefault']));
set_pconfig(local_user(),'dwpost','dw_username',trim($_POST['dw_username']));
set_pconfig(local_user(),'dwpost','dw_password',trim($_POST['dw_password']));
}
@ -129,11 +127,11 @@ function dwpost_post_local(&$a,&$b) {
if($b['private'] || $b['parent'])
return;
$dw_post = intval(PConfig::get(local_user(),'dwpost','post'));
$dw_post = intval(get_pconfig(local_user(),'dwpost','post'));
$dw_enable = (($dw_post && x($_REQUEST,'dwpost_enable')) ? intval($_REQUEST['dwpost_enable']) : 0);
if($_REQUEST['api_source'] && intval(PConfig::get(local_user(),'dwpost','post_by_default')))
if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'dwpost','post_by_default')))
$dw_enable = 1;
if(! $dw_enable)
@ -158,7 +156,7 @@ function dwpost_send(&$a,&$b) {
if($b['parent'] != $b['id'])
return;
// dreamwidth post in the LJ user's timezone.
// dreamwidth post in the LJ user's timezone.
// Hopefully the person's Friendica account
// will be set to the same thing.
@ -168,10 +166,10 @@ function dwpost_send(&$a,&$b) {
intval($b['uid'])
);
if($x && strlen($x[0]['timezone']))
$tz = $x[0]['timezone'];
$tz = $x[0]['timezone'];
$dw_username = PConfig::get($b['uid'],'dwpost','dw_username');
$dw_password = PConfig::get($b['uid'],'dwpost','dw_password');
$dw_username = get_pconfig($b['uid'],'dwpost','dw_username');
$dw_password = get_pconfig($b['uid'],'dwpost','dw_password');
$dw_blog = 'http://www.dreamwidth.org/interface/xmlrpc';
if($dw_username && $dw_password && $dw_blog) {
@ -221,7 +219,7 @@ EOT;
logger('dwpost: data: ' . $xml, LOGGER_DATA);
if($dw_blog !== 'test')
$x = post_url($dw_blog,$xml,["Content-Type: text/xml"]);
$x = post_url($dw_blog,$xml,array("Content-Type: text/xml"));
logger('posted to dreamwidth: ' . ($x) ? $x : '', LOGGER_DEBUG);
}

14
editplain/editplain.css Normal file
View file

@ -0,0 +1,14 @@
#editplain-enable-label {
float: left;
width: 200px;
margin-bottom: 25px;
}
#editplain-checkbox {
float: left;
}

86
editplain/editplain.php Normal file
View file

@ -0,0 +1,86 @@
<?php
/**
* Name: Editplain
* Description: This addon is deprecated and has been replaced with the "Advanced Features" setting. Admins should remove this addon when their core code is updated to include advanced feature settings.
* Version: 1.0
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
* Status: Unsupported
*
*/
function editplain_install() {
register_hook('plugin_settings', 'addon/editplain/editplain.php', 'editplain_settings');
register_hook('plugin_settings_post', 'addon/editplain/editplain.php', 'editplain_settings_post');
logger("installed editplain");
}
function editplain_uninstall() {
unregister_hook('plugin_settings', 'addon/editplain/editplain.php', 'editplain_settings');
unregister_hook('plugin_settings_post', 'addon/editplain/editplain.php', 'editplain_settings_post');
logger("removed editplain");
}
/**
*
* Callback from the settings post function.
* $post contains the $_POST array.
* We will make sure we've got a valid user account
* and if so set our configuration setting for this person.
*
*/
function editplain_settings_post($a,$post) {
if(! local_user() || (! x($_POST,'editplain-submit')))
return;
set_pconfig(local_user(),'system','plaintext',intval($_POST['editplain']));
info( t('Editplain settings updated.') . EOL);
}
/**
*
* Called from the Plugin Setting form.
* Add our own settings info to the page.
*
*/
function editplain_settings(&$a,&$s) {
if(! local_user())
return;
/* Add our stylesheet to the page so we can make our settings look nice */
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/editplain/editplain.css' . '" media="all" />' . "\r\n";
/* Get the current state of our config variable */
$enabled = get_pconfig(local_user(),'system','plaintext');
$checked = (($enabled) ? ' checked="checked" ' : '');
/* Add some HTML to the existing form */
$s .= '<div class="settings-block">';
$s .= '<h3>' . t('Editplain Settings') . '</h3>';
$s .= '<div id="editplain-enable-wrapper">';
$s .= '<label id="editplain-enable-label" for="editplain-checkbox">' . t('Disable richtext status editor') . '</label>';
$s .= '<input id="editplain-checkbox" type="checkbox" name="editplain" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div>';
/* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="editplain-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>';
}

View file

@ -0,0 +1,34 @@
# ADDON editplain
# Copyright (C)
# This file is distributed under the same license as the Friendica editplain addon package.
#
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-02-27 05:01-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: editplain.php:46
msgid "Editplain settings updated."
msgstr ""
#: editplain.php:76
msgid "Editplain Settings"
msgstr ""
#: editplain.php:78
msgid "Disable richtext status editor"
msgstr ""
#: editplain.php:84
msgid "Submit"
msgstr ""

View file

@ -0,0 +1,6 @@
<?php
$a->strings["Editplain settings updated."] = "Actualitzar la configuració de Editplain.";
$a->strings["Editplain Settings"] = "Configuració de Editplain";
$a->strings["Disable richtext status editor"] = "Deshabilitar l'editor d'estatus de texte enriquit";
$a->strings["Submit"] = "Enviar";

View file

@ -0,0 +1,36 @@
# ADDON editplain
# Copyright (C)
# This file is distributed under the same license as the Friendica editplain addon package.
#
#
# Translators:
# Michal Šupler <msupler@gmail.com>, 2014-2015
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-02-27 05:01-0500\n"
"PO-Revision-Date: 2015-02-11 19:40+0000\n"
"Last-Translator: Michal Šupler <msupler@gmail.com>\n"
"Language-Team: Czech (http://www.transifex.com/projects/p/friendica/language/cs/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: cs\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
#: editplain.php:46
msgid "Editplain settings updated."
msgstr "Editplain nastavení aktualizováno"
#: editplain.php:76
msgid "Editplain Settings"
msgstr "Editplain nastavení"
#: editplain.php:78
msgid "Disable richtext status editor"
msgstr "Zakázat richtext status editor"
#: editplain.php:84
msgid "Submit"
msgstr "Odeslat"

View file

@ -0,0 +1,11 @@
<?php
if(! function_exists("string_plural_select_cs")) {
function string_plural_select_cs($n){
return ($n==1) ? 0 : ($n>=2 && $n<=4) ? 1 : 2;;
}}
;
$a->strings["Editplain settings updated."] = "Editplain nastavení aktualizováno";
$a->strings["Editplain Settings"] = "Editplain nastavení";
$a->strings["Disable richtext status editor"] = "Zakázat richtext status editor";
$a->strings["Submit"] = "Odeslat";

View file

@ -0,0 +1,37 @@
# ADDON editplain
# Copyright (C)
# This file is distributed under the same license as the Friendica editplain addon package.
#
#
# Translators:
# Abrax <webmaster@a-zwenkau.de>, 2014
# bavatar <tobias.diekershoff@gmx.net>, 2014
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-02-27 05:01-0500\n"
"PO-Revision-Date: 2014-10-15 12:19+0000\n"
"Last-Translator: Abrax <webmaster@a-zwenkau.de>\n"
"Language-Team: German (http://www.transifex.com/projects/p/friendica/language/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: editplain.php:46
msgid "Editplain settings updated."
msgstr "Editplain Einstellungen gespeichert."
#: editplain.php:76
msgid "Editplain Settings"
msgstr "Editplain Einstellungen"
#: editplain.php:78
msgid "Disable richtext status editor"
msgstr "Web-Editor für Beiträge deakivieren"
#: editplain.php:84
msgid "Submit"
msgstr "Senden"

View file

@ -0,0 +1,11 @@
<?php
if(! function_exists("string_plural_select_de")) {
function string_plural_select_de($n){
return ($n != 1);;
}}
;
$a->strings["Editplain settings updated."] = "Editplain Einstellungen gespeichert.";
$a->strings["Editplain Settings"] = "Editplain Einstellungen";
$a->strings["Disable richtext status editor"] = "Web-Editor für Beiträge deakivieren";
$a->strings["Submit"] = "Senden";

View file

@ -0,0 +1,6 @@
<?php
$a->strings["Editplain settings updated."] = "Ĝisdatigis la Editplain agordojn.";
$a->strings["Editplain Settings"] = "Agordoj por Editplain";
$a->strings["Disable richtext status editor"] = "Malŝalti la riĉteksto-redaktilon";
$a->strings["Submit"] = "Sendi";

View file

@ -0,0 +1,36 @@
# ADDON editplain
# Copyright (C)
# This file is distributed under the same license as the Friendica editplain addon package.
#
#
# Translators:
# Alberto Díaz Tormo <albertodiaztormo@gmail.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-02-27 05:01-0500\n"
"PO-Revision-Date: 2016-10-23 11:35+0000\n"
"Last-Translator: Alberto Díaz Tormo <albertodiaztormo@gmail.com>\n"
"Language-Team: Spanish (http://www.transifex.com/Friendica/friendica/language/es/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: editplain.php:46
msgid "Editplain settings updated."
msgstr "Ajustes de edición sencillos actualizados."
#: editplain.php:76
msgid "Editplain Settings"
msgstr "Ajustes de edición sencillos"
#: editplain.php:78
msgid "Disable richtext status editor"
msgstr "Desactivar el editor de texto enriquecido del estatus"
#: editplain.php:84
msgid "Submit"
msgstr "Enviar"

View file

@ -0,0 +1,11 @@
<?php
if(! function_exists("string_plural_select_es")) {
function string_plural_select_es($n){
return ($n != 1);;
}}
;
$a->strings["Editplain settings updated."] = "Ajustes de edición sencillos actualizados.";
$a->strings["Editplain Settings"] = "Ajustes de edición sencillos";
$a->strings["Disable richtext status editor"] = "Desactivar el editor de texto enriquecido del estatus";
$a->strings["Submit"] = "Enviar";

View file

@ -0,0 +1,36 @@
# ADDON editplain
# Copyright (C)
# This file is distributed under the same license as the Friendica editplain addon package.
#
#
# Translators:
# Nicola Spanti <translations@nicola-spanti.info>, 2015
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-02-27 05:01-0500\n"
"PO-Revision-Date: 2015-07-27 18:13+0000\n"
"Last-Translator: Nicola Spanti <translations@nicola-spanti.info>\n"
"Language-Team: French (http://www.transifex.com/projects/p/friendica/language/fr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: editplain.php:46
msgid "Editplain settings updated."
msgstr ""
#: editplain.php:76
msgid "Editplain Settings"
msgstr ""
#: editplain.php:78
msgid "Disable richtext status editor"
msgstr "Désactiver l'éditeur avancé de statut"
#: editplain.php:84
msgid "Submit"
msgstr "Soumettre"

View file

@ -0,0 +1,11 @@
<?php
if(! function_exists("string_plural_select_fr")) {
function string_plural_select_fr($n){
return ($n > 1);;
}}
;
$a->strings["Editplain settings updated."] = "";
$a->strings["Editplain Settings"] = "";
$a->strings["Disable richtext status editor"] = "Désactiver l'éditeur avancé de statut";
$a->strings["Submit"] = "Soumettre";

View file

@ -0,0 +1,6 @@
<?php
$a->strings["Editplain settings updated."] = "";
$a->strings["Editplain Settings"] = "";
$a->strings["Disable richtext status editor"] = "";
$a->strings["Submit"] = "Senda inn";

View file

@ -0,0 +1,36 @@
# ADDON editplain
# Copyright (C)
# This file is distributed under the same license as the Friendica editplain addon package.
#
#
# Translators:
# fabrixxm <fabrix.xm@gmail.com>, 2014
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-02-27 05:01-0500\n"
"PO-Revision-Date: 2014-10-22 07:54+0000\n"
"Last-Translator: fabrixxm <fabrix.xm@gmail.com>\n"
"Language-Team: Italian (http://www.transifex.com/Friendica/friendica/language/it/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: it\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: editplain.php:46
msgid "Editplain settings updated."
msgstr "Impostazioni 'Editplain' aggiornate."
#: editplain.php:76
msgid "Editplain Settings"
msgstr "Impostazioni Editplain"
#: editplain.php:78
msgid "Disable richtext status editor"
msgstr "Disabilita l'editor di testo visuale"
#: editplain.php:84
msgid "Submit"
msgstr "Invia"

View file

@ -0,0 +1,11 @@
<?php
if(! function_exists("string_plural_select_it")) {
function string_plural_select_it($n){
return ($n != 1);;
}}
;
$a->strings["Editplain settings updated."] = "Impostazioni 'Editplain' aggiornate.";
$a->strings["Editplain Settings"] = "Impostazioni Editplain";
$a->strings["Disable richtext status editor"] = "Disabilita l'editor di testo visuale";
$a->strings["Submit"] = "Invia";

View file

@ -0,0 +1,6 @@
<?php
$a->strings["Editplain settings updated."] = "";
$a->strings["Editplain Settings"] = "";
$a->strings["Disable richtext status editor"] = "";
$a->strings["Submit"] = "Lagre";

View file

@ -0,0 +1,6 @@
<?php
$a->strings["Editplain settings updated."] = "";
$a->strings["Editplain Settings"] = "";
$a->strings["Disable richtext status editor"] = "";
$a->strings["Submit"] = "Potwierdź";

View file

@ -0,0 +1,6 @@
<?php
$a->strings["Editplain settings updated."] = "Configurações Editplain atualizadas.";
$a->strings["Editplain Settings"] = "Configurações Editplain";
$a->strings["Disable richtext status editor"] = "Disabilite o modo de edição richtext";
$a->strings["Submit"] = "Enviar";

View file

@ -0,0 +1,36 @@
# ADDON editplain
# Copyright (C)
# This file is distributed under the same license as the Friendica editplain addon package.
#
#
# Translators:
# Doru DEACONU <dumitrudeaconu@yahoo.com>, 2014
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-02-27 05:01-0500\n"
"PO-Revision-Date: 2014-11-27 14:13+0000\n"
"Last-Translator: Doru DEACONU <dumitrudeaconu@yahoo.com>\n"
"Language-Team: Romanian (Romania) (http://www.transifex.com/projects/p/friendica/language/ro_RO/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ro_RO\n"
"Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1));\n"
#: editplain.php:46
msgid "Editplain settings updated."
msgstr "Configurările Editplain au fost actualizate."
#: editplain.php:76
msgid "Editplain Settings"
msgstr "Configurări Editplain"
#: editplain.php:78
msgid "Disable richtext status editor"
msgstr "Dezactivare editorul status de text îmbogățit"
#: editplain.php:84
msgid "Submit"
msgstr "Trimite"

View file

@ -0,0 +1,11 @@
<?php
if(! function_exists("string_plural_select_ro")) {
function string_plural_select_ro($n){
return ($n==1?0:((($n%100>19)||(($n%100==0)&&($n!=0)))?2:1));;
}}
;
$a->strings["Editplain settings updated."] = "Configurările Editplain au fost actualizate.";
$a->strings["Editplain Settings"] = "Configurări Editplain";
$a->strings["Disable richtext status editor"] = "Dezactivare editorul status de text îmbogățit";
$a->strings["Submit"] = "Trimite";

View file

@ -0,0 +1,36 @@
# ADDON editplain
# Copyright (C)
# This file is distributed under the same license as the Friendica editplain addon package.
#
#
# Translators:
# Stanislav N. <pztrn@pztrn.name>, 2017
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-02-27 05:01-0500\n"
"PO-Revision-Date: 2017-04-08 17:10+0000\n"
"Last-Translator: Stanislav N. <pztrn@pztrn.name>\n"
"Language-Team: Russian (http://www.transifex.com/Friendica/friendica/language/ru/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ru\n"
"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n"
#: editplain.php:46
msgid "Editplain settings updated."
msgstr "Настройки Editplain обновлены"
#: editplain.php:76
msgid "Editplain Settings"
msgstr "Настройки Editplain"
#: editplain.php:78
msgid "Disable richtext status editor"
msgstr "Отключить richtext status editor"
#: editplain.php:84
msgid "Submit"
msgstr "Добавить"

View file

@ -0,0 +1,11 @@
<?php
if(! function_exists("string_plural_select_ru")) {
function string_plural_select_ru($n){
return ($n%10==1 && $n%100!=11 ? 0 : $n%10>=2 && $n%10<=4 && ($n%100<12 || $n%100>14) ? 1 : $n%10==0 || ($n%10>=5 && $n%10<=9) || ($n%100>=11 && $n%100<=14)? 2 : 3);;
}}
;
$a->strings["Editplain settings updated."] = "Настройки Editplain обновлены";
$a->strings["Editplain Settings"] = "Настройки Editplain";
$a->strings["Disable richtext status editor"] = "Отключить richtext status editor";
$a->strings["Submit"] = "Добавить";

View file

@ -0,0 +1,3 @@
<?php
$a->strings["Submit"] = "Spara";

View file

@ -0,0 +1,6 @@
<?php
$a->strings["Editplain settings updated."] = "Editplain设置更新了";
$a->strings["Editplain Settings"] = "Editplain设置";
$a->strings["Disable richtext status editor"] = "使richtext现状编辑 不能用";
$a->strings["Submit"] = "提交";

29
extcron/extcron.php Normal file
View file

@ -0,0 +1,29 @@
<?php
/**
* Name: external cron
* Description: Use external server or service to run poller regularly
* Version: 1.0
* Author: Mike Macgirvin <https://macgirvin.com/profile/mike>
*
* Notes: External service needs to make a web request to http(s)://yoursite/extcron
* Status: Unsupported
*/
require_once "mod/worker.php";
function extcron_install() {}
function extcron_uninstall() {}
function extcron_module() {}
function extcron_init(&$a) {
worker_init($a);
killme();
// Deactivated
//proc_run('php','include/poller.php');
//killme();
}

View file

19
facebook/README.md Normal file
View file

@ -0,0 +1,19 @@
> # Note
> **Facebook Connector, Facebook Post Connector and Facebook Sync plugins are deprecated.**
> As of the moment you cannot bridge from or to Facebook with Friendica.
Installing the Friendica/Facebook connector
Detailed instructions how to use this plugin can be found at
the [How to: Friendica's Facebook Connector](https://github.com/friendica/friendica/wiki/How-to:-Friendica%E2%80%99s-Facebook-connector) page.
Vidoes and embeds will not be posted if there is no other content. Links
and images will be converted to a format suitable for the Facebook API and
long posts truncated - with a link to view the full post.
Facebook contacts will not be able to view private photos, as they are not able to
authenticate to your site to establish identity. We will address this
in a future release.
Info: please make sure that you understand all aspects due to Friendica's
default licence which is: [MIT License](https://github.com/friendica/friendica/blob/master/LICENSE)

13
facebook/facebook.css Normal file
View file

@ -0,0 +1,13 @@
#facebook-enable-wrapper {
margin-top: 20px;
}
#facebook-disable-wrapper {
margin-top: 20px;
}
#facebook-post-default-form input {
margin-top: 20px;
margin-right: 20px;
}

2140
facebook/facebook.php Normal file
View file

@ -0,0 +1,2140 @@
<?php
/**
* Name: Facebook Connector
* Version: 1.3
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
* Author: Tobias Hößl <https://github.com/CatoTH/>
* Status: Unsupported
*/
/**
* Installing the Friendica/Facebook connector
*
* Detailed instructions how to use this plugin can be found at
* https://github.com/friendica/friendica/wiki/How-to:-Friendica%E2%80%99s-Facebook-connector
*
* Vidoes and embeds will not be posted if there is no other content. Links
* and images will be converted to a format suitable for the Facebook API and
* long posts truncated - with a link to view the full post.
*
* Facebook contacts will not be able to view private photos, as they are not able to
* authenticate to your site to establish identity. We will address this
* in a future release.
*/
/** TODO
* - Implement a method for the administrator to delete all configuration data the plugin has created,
* e.g. the app_access_token
*/
// Size of maximum post length increased
// see http://www.facebook.com/schrep/posts/203969696349811
// define('FACEBOOK_MAXPOSTLEN', 420);
define('FACEBOOK_MAXPOSTLEN', 63206);
define('FACEBOOK_SESSION_ERR_NOTIFICATION_INTERVAL', 259200); // 3 days
define('FACEBOOK_DEFAULT_POLL_INTERVAL', 60); // given in minutes
define('FACEBOOK_MIN_POLL_INTERVAL', 5);
define('FACEBOOK_RTU_ERR_MAIL_AFTER_MINUTES', 180); // 3 hours
require_once('include/security.php');
function facebook_install() {
register_hook('post_local', 'addon/facebook/facebook.php', 'facebook_post_local');
register_hook('notifier_normal', 'addon/facebook/facebook.php', 'facebook_post_hook');
register_hook('jot_networks', 'addon/facebook/facebook.php', 'facebook_jot_nets');
register_hook('connector_settings', 'addon/facebook/facebook.php', 'facebook_plugin_settings');
register_hook('cron', 'addon/facebook/facebook.php', 'facebook_cron');
register_hook('enotify', 'addon/facebook/facebook.php', 'facebook_enotify');
register_hook('queue_predeliver', 'addon/facebook/facebook.php', 'fb_queue_hook');
}
function facebook_uninstall() {
unregister_hook('post_local', 'addon/facebook/facebook.php', 'facebook_post_local');
unregister_hook('notifier_normal', 'addon/facebook/facebook.php', 'facebook_post_hook');
unregister_hook('jot_networks', 'addon/facebook/facebook.php', 'facebook_jot_nets');
unregister_hook('connector_settings', 'addon/facebook/facebook.php', 'facebook_plugin_settings');
unregister_hook('cron', 'addon/facebook/facebook.php', 'facebook_cron');
unregister_hook('enotify', 'addon/facebook/facebook.php', 'facebook_enotify');
unregister_hook('queue_predeliver', 'addon/facebook/facebook.php', 'fb_queue_hook');
// hook moved
unregister_hook('post_local_end', 'addon/facebook/facebook.php', 'facebook_post_hook');
unregister_hook('plugin_settings', 'addon/facebook/facebook.php', 'facebook_plugin_settings');
}
/* declare the facebook_module function so that /facebook url requests will land here */
function facebook_module() {}
// If a->argv[1] is a nickname, this is a callback from Facebook oauth requests.
// If $_REQUEST["realtime_cb"] is set, this is a callback from the Real-Time Updates API
/**
* @param App $a
*/
function facebook_init(&$a) {
if (x($_REQUEST, "realtime_cb") && x($_REQUEST, "realtime_cb")) {
logger("facebook_init: Facebook Real-Time callback called", LOGGER_DEBUG);
if (x($_REQUEST, "hub_verify_token")) {
// this is the verification callback while registering for real time updates
$verify_token = get_config('facebook', 'cb_verify_token');
if ($verify_token != $_REQUEST["hub_verify_token"]) {
logger('facebook_init: Wrong Facebook Callback Verifier - expected ' . $verify_token . ', got ' . $_REQUEST["hub_verify_token"]);
return;
}
if (x($_REQUEST, "hub_challenge")) {
logger('facebook_init: Answering Challenge: ' . $_REQUEST["hub_challenge"], LOGGER_DATA);
echo $_REQUEST["hub_challenge"];
die();
}
}
require_once('include/items.php');
// this is a status update
$content = file_get_contents("php://input");
if (is_numeric($content)) $content = file_get_contents("php://input");
$js = json_decode($content);
logger(print_r($js, true), LOGGER_DATA);
if (!isset($js->object) || $js->object != "user" || !isset($js->entry)) {
logger('facebook_init: Could not parse Real-Time Update data', LOGGER_DEBUG);
return;
}
$affected_users = array("feed" => array(), "friends" => array());
foreach ($js->entry as $entry) {
$fbuser = $entry->uid;
foreach ($entry->changed_fields as $field) {
if (!isset($affected_users[$field])) {
logger('facebook_init: Unknown field "' . $field . '"');
continue;
}
if (in_array($fbuser, $affected_users[$field])) continue;
$r = q("SELECT `uid` FROM `pconfig` WHERE `cat` = 'facebook' AND `k` = 'self_id' AND `v` = '%s' LIMIT 1", dbesc($fbuser));
if(! count($r))
continue;
$uid = $r[0]['uid'];
$access_token = get_pconfig($uid,'facebook','access_token');
if(! $access_token)
return;
switch ($field) {
case "feed":
logger('facebook_init: FB-User ' . $fbuser . ' / feed', LOGGER_DEBUG);
if(! get_pconfig($uid,'facebook','no_wall')) {
$private_wall = intval(get_pconfig($uid,'facebook','private_wall'));
$s = fetch_url('https://graph.facebook.com/me/feed?access_token=' . $access_token);
if($s) {
$j = json_decode($s);
if (isset($j->data)) {
logger('facebook_init: wall: ' . print_r($j,true), LOGGER_DATA);
fb_consume_stream($uid,$j,($private_wall) ? false : true);
} else {
logger('facebook_init: wall: got no data from Facebook: ' . print_r($j,true), LOGGER_NORMAL);
}
}
}
break;
case "friends":
logger('facebook_init: FB-User ' . $fbuser . ' / friends', LOGGER_DEBUG);
fb_get_friends($uid, false);
set_pconfig($uid,'facebook','friend_check',time());
break;
default:
logger('facebook_init: Unknown callback field for ' . $fbuser, LOGGER_NORMAL);
}
$affected_users[$field][] = $fbuser;
}
}
}
if($a->argc != 2)
return;
$nick = $a->argv[1];
if(strlen($nick))
$r = q("SELECT `uid` FROM `user` WHERE `nickname` = '%s' LIMIT 1",
dbesc($nick)
);
if(!(isset($r) && count($r)))
return;
$uid = $r[0]['uid'];
$auth_code = (x($_GET, 'code') ? $_GET['code'] : '');
$error = (x($_GET, 'error_description') ? $_GET['error_description'] : '');
if($error)
logger('facebook_init: Error: ' . $error);
if($auth_code && $uid) {
$appid = get_config('facebook','appid');
$appsecret = get_config('facebook', 'appsecret');
$x = fetch_url('https://graph.facebook.com/oauth/access_token?client_id='
. $appid . '&client_secret=' . $appsecret . '&redirect_uri='
. urlencode($a->get_baseurl() . '/facebook/' . $nick)
. '&code=' . $auth_code);
logger('facebook_init: returned access token: ' . $x, LOGGER_DATA);
if(strpos($x,'access_token=') !== false) {
$token = str_replace('access_token=', '', $x);
if(strpos($token,'&') !== false)
$token = substr($token,0,strpos($token,'&'));
set_pconfig($uid,'facebook','access_token',$token);
set_pconfig($uid,'facebook','post','1');
if(get_pconfig($uid,'facebook','no_linking') === false)
set_pconfig($uid,'facebook','no_linking',1);
fb_get_self($uid);
fb_get_friends($uid, true);
fb_consume_all($uid);
}
}
}
/**
* @param int $uid
*/
function fb_get_self($uid) {
$access_token = get_pconfig($uid,'facebook','access_token');
if(! $access_token)
return;
$s = fetch_url('https://graph.facebook.com/me/?access_token=' . $access_token);
if($s) {
$j = json_decode($s);
set_pconfig($uid,'facebook','self_id',(string) $j->id);
}
}
/**
* @param int $uid
* @param string $access_token
* @param array $persons
*/
function fb_get_friends_sync_new($uid, $access_token, $persons) {
$persons_todo = array();
foreach ($persons as $person) {
$link = 'http://facebook.com/profile.php?id=' . $person->id;
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `url` = '%s' LIMIT 1",
intval($uid),
dbesc($link)
);
if (count($r) == 0) {
logger('fb_get_friends: new contact found: ' . $link, LOGGER_DEBUG);
$persons_todo[] = $person;
}
if (count($persons_todo) > 0) fb_get_friends_sync_full($uid, $access_token, $persons_todo);
}
}
/**
* @param int $uid
* @param object $contact
*/
function fb_get_friends_sync_parsecontact($uid, $contact) {
$contact->link = 'http://facebook.com/profile.php?id=' . $contact->id;
// If its a page then set the first name from the username
if (!$contact->first_name && $contact->username)
$contact->first_name = $contact->username;
// check if we already have a contact
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `url` = '%s' LIMIT 1",
intval($uid),
dbesc($contact->link)
);
if(count($r)) {
// update profile photos once every two weeks as we have no notification of when they change.
$update_photo = (($r[0]['avatar-date'] < datetime_convert('','','now -14 days')) ? true : false);
// check that we have all the photos, this has been known to fail on occasion
if((! $r[0]['photo']) || (! $r[0]['thumb']) || (! $r[0]['micro']) || ($update_photo)) {
require_once("Photo.php");
$photos = import_profile_photo('https://graph.facebook.com/' . $contact->id . '/picture', $uid, $r[0]['id']);
q("UPDATE `contact` SET `photo` = '%s',
`thumb` = '%s',
`micro` = '%s',
`name-date` = '%s',
`uri-date` = '%s',
`avatar-date` = '%s'
WHERE `id` = %d
",
dbesc($photos[0]),
dbesc($photos[1]),
dbesc($photos[2]),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
intval($r[0]['id'])
);
}
return;
}
else {
// create contact record
q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
`name`, `nick`, `photo`, `network`, `rel`, `priority`,
`writable`, `blocked`, `readonly`, `pending` )
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, 0, 0, 0 ) ",
intval($uid),
dbesc(datetime_convert()),
dbesc($contact->link),
dbesc(normalise_link($contact->link)),
dbesc(''),
dbesc(''),
dbesc($contact->id),
dbesc('facebook ' . $contact->id),
dbesc($contact->name),
dbesc(($contact->nickname) ? $contact->nickname : mb_convert_case($contact->first_name, MB_CASE_LOWER, "UTF-8")),
dbesc('https://graph.facebook.com/' . $contact->id . '/picture'),
dbesc(NETWORK_FACEBOOK),
intval(CONTACT_IS_FRIEND),
intval(1),
intval(1)
);
}
$r = q("SELECT * FROM `contact` WHERE `url` = '%s' AND `uid` = %d LIMIT 1",
dbesc($contact->link),
intval($uid)
);
if(! count($r)) {
return;
}
$contact_id = $r[0]['id'];
$g = q("select def_gid from user where uid = %d limit 1",
intval($uid)
);
if($g && intval($g[0]['def_gid'])) {
require_once('include/group.php');
group_add_member($uid,'',$contact_id,$g[0]['def_gid']);
}
require_once("Photo.php");
$photos = import_profile_photo($r[0]['photo'],$uid,$contact_id);
q("UPDATE `contact` SET `photo` = '%s',
`thumb` = '%s',
`micro` = '%s',
`name-date` = '%s',
`uri-date` = '%s',
`avatar-date` = '%s'
WHERE `id` = %d
",
dbesc($photos[0]),
dbesc($photos[1]),
dbesc($photos[2]),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
intval($contact_id)
);
}
/**
* @param int $uid
* @param string $access_token
* @param array $persons
*/
function fb_get_friends_sync_full($uid, $access_token, $persons) {
if (count($persons) == 0) return;
$nums = Ceil(count($persons) / 50);
for ($i = 0; $i < $nums; $i++) {
$batch_request = array();
for ($j = $i * 50; $j < ($i+1) * 50 && $j < count($persons); $j++) $batch_request[] = array('method'=>'GET', 'relative_url'=>$persons[$j]->id);
$s = post_url('https://graph.facebook.com/', array('access_token' => $access_token, 'batch' => json_encode($batch_request)));
if($s) {
$results = json_decode($s);
logger('fb_get_friends: info: ' . print_r($results,true), LOGGER_DATA);
if(count($results)) {
foreach ($results as $contact) {
if ($contact->code != 200) logger('fb_get_friends: not found: ' . print_r($contact,true), LOGGER_DEBUG);
else fb_get_friends_sync_parsecontact($uid, json_decode($contact->body));
}
}
}
}
}
// if $fullsync is true, only new contacts are searched for
/**
* @param int $uid
* @param bool $fullsync
*/
function fb_get_friends($uid, $fullsync = true) {
$r = q("SELECT `uid` FROM `user` WHERE `uid` = %d AND `account_expired` = 0 LIMIT 1",
intval($uid)
);
if(! count($r))
return;
$access_token = get_pconfig($uid,'facebook','access_token');
$no_linking = get_pconfig($uid,'facebook','no_linking');
if($no_linking)
return;
if(! $access_token)
return;
$s = fetch_url('https://graph.facebook.com/me/friends?access_token=' . $access_token);
if($s) {
logger('facebook: fb_gwet_friends: ' . $s, LOGGER_DATA);
$j = json_decode($s);
logger('facebook: fb_get_friends: json: ' . print_r($j,true), LOGGER_DATA);
if(! $j->data)
return;
$persons_todo = array();
foreach($j->data as $person) $persons_todo[] = $person;
if ($fullsync)
fb_get_friends_sync_full($uid, $access_token, $persons_todo);
else
fb_get_friends_sync_new($uid, $access_token, $persons_todo);
}
}
// This is the POST method to the facebook settings page
// Content is posted to Facebook in the function facebook_post_hook()
/**
* @param App $a
*/
function facebook_post(&$a) {
$uid = local_user();
if($uid){
$fb_limited = get_config('facebook','crestrict');
$value = ((x($_POST,'post_by_default')) ? intval($_POST['post_by_default']) : 0);
set_pconfig($uid,'facebook','post_by_default', $value);
$no_linking = get_pconfig($uid,'facebook','no_linking');
$no_wall = ((x($_POST,'facebook_no_wall')) ? intval($_POST['facebook_no_wall']) : 0);
set_pconfig($uid,'facebook','no_wall',$no_wall);
$private_wall = ((x($_POST,'facebook_private_wall')) ? intval($_POST['facebook_private_wall']) : 0);
set_pconfig($uid,'facebook','private_wall',$private_wall);
set_pconfig($uid,'facebook','blocked_apps',escape_tags(trim($_POST['blocked_apps'])));
$linkvalue = ((x($_POST,'facebook_linking')) ? intval($_POST['facebook_linking']) : 0);
if($fb_limited) {
if($linkvalue == 0)
set_pconfig($uid,'facebook','no_linking', 1);
}
else
set_pconfig($uid,'facebook','no_linking', (($linkvalue) ? 0 : 1));
// FB linkage was allowed but has just been turned off - remove all FB contacts and posts
if((! intval($no_linking)) && (! intval($linkvalue))) {
$r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `network` = '%s' ",
intval($uid),
dbesc(NETWORK_FACEBOOK)
);
if(count($r)) {
require_once('include/Contact.php');
foreach($r as $rr)
contact_remove($rr['id']);
}
}
elseif(intval($no_linking) && intval($linkvalue)) {
// FB linkage is now allowed - import stuff.
fb_get_self($uid);
fb_get_friends($uid, true);
fb_consume_all($uid);
}
info( t('Settings updated.') . EOL);
}
return;
}
// Facebook settings form
/**
* @param App $a
* @return string
*/
function facebook_content(&$a) {
if(! local_user()) {
notice( t('Permission denied.') . EOL);
return '';
}
if(! service_class_allows(local_user(),'facebook_connect')) {
notice( t('Permission denied.') . EOL);
return upgrade_bool_message();
}
if($a->argc > 1 && $a->argv[1] === 'remove') {
del_pconfig(local_user(),'facebook','post');
info( t('Facebook disabled') . EOL);
}
if($a->argc > 1 && $a->argv[1] === 'friends') {
fb_get_friends(local_user(), true);
info( t('Updating contacts') . EOL);
}
$fb_limited = get_config('facebook','restrict');
$o = '';
$fb_installed = false;
if (get_pconfig(local_user(),'facebook','post')) {
$access_token = get_pconfig(local_user(),'facebook','access_token');
if ($access_token) {
$s = fetch_url('https://graph.facebook.com/me/feed?access_token=' . $access_token);
if($s) {
$j = json_decode($s);
if (isset($j->data)) $fb_installed = true;
}
}
}
$appid = get_config('facebook','appid');
if(! $appid) {
notice( t('Facebook API key is missing.') . EOL);
return '';
}
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'
. $a->get_baseurl() . '/addon/facebook/facebook.css' . '" media="all" />' . "\r\n";
$o .= '<h3>' . t('Facebook Connect') . '</h3>';
if(! $fb_installed) {
$o .= '<div id="facebook-enable-wrapper">';
$o .= '<a href="https://www.facebook.com/dialog/oauth?client_id=' . $appid . '&redirect_uri='
. $a->get_baseurl() . '/facebook/' . $a->user['nickname'] . '&scope=publish_stream,read_stream,offline_access">' . t('Install Facebook connector for this account.') . '</a>';
$o .= '</div>';
}
if($fb_installed) {
$o .= '<div id="facebook-disable-wrapper">';
$o .= '<a href="' . $a->get_baseurl() . '/facebook/remove' . '">' . t('Remove Facebook connector') . '</a></div>';
$o .= '<div id="facebook-enable-wrapper">';
$o .= '<a href="https://www.facebook.com/dialog/oauth?client_id=' . $appid . '&redirect_uri='
. $a->get_baseurl() . '/facebook/' . $a->user['nickname'] . '&scope=publish_stream,read_stream,offline_access">' . t('Re-authenticate [This is necessary whenever your Facebook password is changed.]') . '</a>';
$o .= '</div>';
$o .= '<div id="facebook-post-default-form">';
$o .= '<form action="facebook" method="post" >';
$post_by_default = get_pconfig(local_user(),'facebook','post_by_default');
$checked = (($post_by_default) ? ' checked="checked" ' : '');
$o .= '<input type="checkbox" name="post_by_default" value="1"' . $checked . '/>' . ' ' . t('Post to Facebook by default') . EOL;
$no_linking = get_pconfig(local_user(),'facebook','no_linking');
$checked = (($no_linking) ? '' : ' checked="checked" ');
if($fb_limited) {
if($no_linking) {
$o .= EOL . '<strong>' . t('Facebook friend linking has been disabled on this site. The following settings will have no effect.') . '</strong>' . EOL;
$checked .= " disabled ";
}
else {
$o .= EOL . '<strong>' . t('Facebook friend linking has been disabled on this site. If you disable it, you will be unable to re-enable it.') . '</strong>' . EOL;
}
}
$o .= '<input type="checkbox" name="facebook_linking" value="1"' . $checked . '/>' . ' ' . t('Link all your Facebook friends and conversations on this website') . EOL ;
$o .= '<p>' . t('Facebook conversations consist of your <em>profile wall</em> and your friend <em>stream</em>.');
$o .= ' ' . t('On this website, your Facebook friend stream is only visible to you.');
$o .= ' ' . t('The following settings determine the privacy of your Facebook profile wall on this website.') . '</p>';
$private_wall = get_pconfig(local_user(),'facebook','private_wall');
$checked = (($private_wall) ? ' checked="checked" ' : '');
$o .= '<input type="checkbox" name="facebook_private_wall" value="1"' . $checked . '/>' . ' ' . t('On this website your Facebook profile wall conversations will only be visible to you') . EOL ;
$no_wall = get_pconfig(local_user(),'facebook','no_wall');
$checked = (($no_wall) ? ' checked="checked" ' : '');
$o .= '<input type="checkbox" name="facebook_no_wall" value="1"' . $checked . '/>' . ' ' . t('Do not import your Facebook profile wall conversations') . EOL ;
$o .= '<p>' . t('If you choose to link conversations and leave both of these boxes unchecked, your Facebook profile wall will be merged with your profile wall on this website and your privacy settings on this website will be used to determine who may see the conversations.') . '</p>';
$blocked_apps = get_pconfig(local_user(),'facebook','blocked_apps');
$o .= '<div><label id="blocked-apps-label" for="blocked-apps">' . t('Comma separated applications to ignore') . ' </label></div>';
$o .= '<div><textarea id="blocked-apps" name="blocked_apps" >' . htmlspecialchars($blocked_apps) . '</textarea></div>';
$o .= '<input type="submit" name="submit" value="' . t('Save Settings') . '" /></form></div>';
}
return $o;
}
/**
* @param App $a
* @param null|object $b
* @return mixed
*/
function facebook_cron($a,$b) {
$last = get_config('facebook','last_poll');
$poll_interval = intval(get_config('facebook','poll_interval'));
if(! $poll_interval)
$poll_interval = FACEBOOK_DEFAULT_POLL_INTERVAL;
if($last) {
$next = $last + ($poll_interval * 60);
if($next > time())
return;
}
logger('facebook_cron');
// Find the FB users on this site and randomize in case one of them
// uses an obscene amount of memory. It may kill this queue run
// but hopefully we'll get a few others through on each run.
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'facebook' AND `k` = 'post' AND `v` = '1' ORDER BY RAND() ");
if(count($r)) {
foreach($r as $rr) {
if(get_pconfig($rr['uid'],'facebook','no_linking'))
continue;
$ab = intval(get_config('system','account_abandon_days'));
if($ab > 0) {
$z = q("SELECT `uid` FROM `user` WHERE `uid` = %d AND `login_date` > UTC_TIMESTAMP() - INTERVAL %d DAY LIMIT 1",
intval($rr['uid']),
intval($ab)
);
if(! count($z))
continue;
}
// check for new friends once a day
$last_friend_check = get_pconfig($rr['uid'],'facebook','friend_check');
if($last_friend_check)
$next_friend_check = $last_friend_check + 86400;
else
$next_friend_check = 0;
if($next_friend_check <= time()) {
fb_get_friends($rr['uid'], true);
set_pconfig($rr['uid'],'facebook','friend_check',time());
}
fb_consume_all($rr['uid']);
}
}
if (get_config('facebook', 'realtime_active') == 1) {
if (!facebook_check_realtime_active()) {
logger('facebook_cron: Facebook is not sending Real-Time Updates any more, although it is supposed to. Trying to fix it...', LOGGER_NORMAL);
facebook_subscription_add_users();
if (facebook_check_realtime_active())
logger('facebook_cron: Successful', LOGGER_NORMAL);
else {
logger('facebook_cron: Failed', LOGGER_NORMAL);
$first_err = get_config('facebook', 'realtime_first_err');
if (!$first_err) {
$first_err = time();
set_config('facebook', 'realtime_first_err', $first_err);
}
$first_err_ago = (time() - $first_err);
if(strlen($a->config['admin_email']) && !get_config('facebook', 'realtime_err_mailsent') && $first_err_ago > (FACEBOOK_RTU_ERR_MAIL_AFTER_MINUTES * 60)) {
mail($a->config['admin_email'], t('Problems with Facebook Real-Time Updates'),
"Hi!\n\nThere's a problem with the Facebook Real-Time Updates that cannot be solved automatically. Maybe a permission issue?\n\nPlease try to re-activate it on " . $a->config["system"]["url"] . "/admin/plugins/facebook\n\nThis e-mail will only be sent once.",
'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
. 'Content-type: text/plain; charset=UTF-8' . "\n"
. 'Content-transfer-encoding: 8bit'
);
set_config('facebook', 'realtime_err_mailsent', 1);
}
}
} else { // !facebook_check_realtime_active()
del_config('facebook', 'realtime_err_mailsent');
del_config('facebook', 'realtime_first_err');
}
}
set_config('facebook','last_poll', time());
}
/**
* @param App $a
* @param null|object $b
*/
function facebook_plugin_settings(&$a,&$b) {
$b .= '<div class="settings-block">';
$b .= '<h3>' . t('Facebook') . '</h3>';
$b .= '<a href="facebook">' . t('Facebook Connector Settings') . '</a><br />';
$b .= '</div>';
}
/**
* @param App $a
* @param null|object $o
*/
function facebook_plugin_admin(&$a, &$o){
$o = '<input type="hidden" name="form_security_token" value="' . get_form_security_token("fbsave") . '">';
$o .= '<h4>' . t('Facebook API Key') . '</h4>';
$appid = get_config('facebook', 'appid' );
$appsecret = get_config('facebook', 'appsecret' );
$poll_interval = get_config('facebook', 'poll_interval' );
$sync_comments = get_config('facebook', 'sync_comments' );
if (!$poll_interval) $poll_interval = FACEBOOK_DEFAULT_POLL_INTERVAL;
$ret1 = q("SELECT `v` FROM `config` WHERE `cat` = 'facebook' AND `k` = 'appid' LIMIT 1");
$ret2 = q("SELECT `v` FROM `config` WHERE `cat` = 'facebook' AND `k` = 'appsecret' LIMIT 1");
if ((count($ret1) > 0 && $ret1[0]['v'] != $appid) || (count($ret2) > 0 && $ret2[0]['v'] != $appsecret)) $o .= t('Error: it appears that you have specified the App-ID and -Secret in your .htconfig.php file. As long as they are specified there, they cannot be set using this form.<br><br>');
$working_connection = false;
if ($appid && $appsecret) {
$subs = facebook_subscriptions_get();
if ($subs === null) $o .= t('Error: the given API Key seems to be incorrect (the application access token could not be retrieved).') . '<br>';
elseif (is_array($subs)) {
$o .= t('The given API Key seems to work correctly.') . '<br>';
$working_connection = true;
} else $o .= t('The correctness of the API Key could not be detected. Something strange\'s going on.') . '<br>';
}
$o .= '<label for="fb_appid">' . t('App-ID / API-Key') . '</label><input id="fb_appid" name="appid" type="text" value="' . escape_tags($appid ? $appid : "") . '"><br style="clear: both;">';
$o .= '<label for="fb_appsecret">' . t('Application secret') . '</label><input id="fb_appsecret" name="appsecret" type="text" value="' . escape_tags($appsecret ? $appsecret : "") . '"><br style="clear: both;">';
$o .= '<label for="fb_poll_interval">' . sprintf(t('Polling Interval in minutes (minimum %1$s minutes)'), FACEBOOK_MIN_POLL_INTERVAL) . '</label><input name="poll_interval" id="fb_poll_interval" type="number" min="' . FACEBOOK_MIN_POLL_INTERVAL . '" value="' . $poll_interval . '"><br style="clear: both;">';
$o .= '<label for="fb_sync_comments">' . t('Synchronize comments (no comments on Facebook are missed, at the cost of increased system load)') . '</label><input name="sync_comments" id="fb_sync_comments" type="checkbox" ' . ($sync_comments ? 'checked' : '') . '><br style="clear: both;">';
$o .= '<input type="submit" name="fb_save_keys" value="' . t('Save') . '">';
if ($working_connection) {
$o .= '<h4>' . t('Real-Time Updates') . '</h4>';
$activated = facebook_check_realtime_active();
if ($activated) {
$o .= t('Real-Time Updates are activated.') . '<br><br>';
$o .= '<input type="submit" name="real_time_deactivate" value="' . t('Deactivate Real-Time Updates') . '">';
} else {
$o .= t('Real-Time Updates not activated.') . '<br><input type="submit" name="real_time_activate" value="' . t('Activate Real-Time Updates') . '">';
}
}
}
/**
* @param App $a
*/
function facebook_plugin_admin_post(&$a){
check_form_security_token_redirectOnErr('/admin/plugins/facebook', 'fbsave');
if (x($_REQUEST,'fb_save_keys')) {
set_config('facebook', 'appid', $_REQUEST['appid']);
set_config('facebook', 'appsecret', $_REQUEST['appsecret']);
$poll_interval = IntVal($_REQUEST['poll_interval']);
if ($poll_interval >= FACEBOOK_MIN_POLL_INTERVAL) set_config('facebook', 'poll_interval', $poll_interval);
set_config('facebook', 'sync_comments', (x($_REQUEST, 'sync_comments') ? 1 : 0));
del_config('facebook', 'app_access_token');
info(t('The new values have been saved.'));
}
if (x($_REQUEST,'real_time_activate')) {
facebook_subscription_add_users();
}
if (x($_REQUEST,'real_time_deactivate')) {
facebook_subscription_del_users();
}
}
/**
* @param App $a
* @param object $b
* @return mixed
*/
function facebook_jot_nets(&$a,&$b) {
if(! local_user())
return;
$fb_post = get_pconfig(local_user(),'facebook','post');
if(intval($fb_post) == 1) {
$fb_defpost = get_pconfig(local_user(),'facebook','post_by_default');
$selected = ((intval($fb_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="facebook_enable"' . $selected . ' value="1" /> '
. t('Post to Facebook') . '</div>';
}
}
/**
* @param App $a
* @param object $b
* @return mixed
*/
function facebook_post_hook(&$a,&$b) {
if($b['deleted'] || ($b['created'] !== $b['edited']))
return;
/**
* Post to Facebook stream
*/
require_once('include/group.php');
require_once('include/html2plain.php');
logger('Facebook post');
$reply = false;
$likes = false;
$deny_arr = array();
$allow_arr = array();
$toplevel = (($b['id'] == $b['parent']) ? true : false);
$linking = ((get_pconfig($b['uid'],'facebook','no_linking')) ? 0 : 1);
if((! $toplevel) && ($linking)) {
$r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($b['parent']),
intval($b['uid'])
);
if(count($r) && substr($r[0]['uri'],0,4) === 'fb::')
$reply = substr($r[0]['uri'],4);
elseif(count($r) && substr($r[0]['extid'],0,4) === 'fb::')
$reply = substr($r[0]['extid'],4);
else
return;
$u = q("SELECT * FROM user where uid = %d limit 1",
intval($b['uid'])
);
if(! count($u))
return;
// only accept comments from the item owner. Other contacts are unknown to FB.
if(! link_compare($b['author-link'], $a->get_baseurl() . '/profile/' . $u[0]['nickname']))
return;
logger('facebook reply id=' . $reply);
}
if(strstr($b['postopts'],'facebook') || ($b['private']) || ($reply)) {
if($b['private'] && $reply === false) {
$allow_people = expand_acl($b['allow_cid']);
$allow_groups = expand_groups(expand_acl($b['allow_gid']));
$deny_people = expand_acl($b['deny_cid']);
$deny_groups = expand_groups(expand_acl($b['deny_gid']));
$recipients = array_unique(array_merge($allow_people,$allow_groups));
$deny = array_unique(array_merge($deny_people,$deny_groups));
$allow_str = dbesc(implode(', ',$recipients));
if($allow_str) {
$r = q("SELECT `notify` FROM `contact` WHERE `id` IN ( $allow_str ) AND `network` = 'face'");
if(count($r))
foreach($r as $rr)
$allow_arr[] = $rr['notify'];
}
$deny_str = dbesc(implode(', ',$deny));
if($deny_str) {
$r = q("SELECT `notify` FROM `contact` WHERE `id` IN ( $deny_str ) AND `network` = 'face'");
if(count($r))
foreach($r as $rr)
$deny_arr[] = $rr['notify'];
}
if(count($deny_arr) && (! count($allow_arr))) {
// One or more FB folks were denied access but nobody on FB was specifically allowed access.
// This might cause the post to be open to public on Facebook, but only to selected members
// on another network. Since this could potentially leak a post to somebody who was denied,
// we will skip posting it to Facebook with a slightly vague but relevant message that will
// hopefully lead somebody to this code comment for a better explanation of what went wrong.
notice( t('Post to Facebook cancelled because of multi-network access permission conflict.') . EOL);
return;
}
// if it's a private message but no Facebook members are allowed or denied, skip Facebook post
if((! count($allow_arr)) && (! count($deny_arr)))
return;
}
if($b['verb'] == ACTIVITY_LIKE)
$likes = true;
$appid = get_config('facebook', 'appid' );
$secret = get_config('facebook', 'appsecret' );
if($appid && $secret) {
logger('facebook: have appid+secret');
$fb_token = get_pconfig($b['uid'],'facebook','access_token');
// post to facebook if it's a public post and we've ticked the 'post to Facebook' box,
// or it's a private message with facebook participants
// or it's a reply or likes action to an existing facebook post
if($fb_token && ($toplevel || $b['private'] || $reply)) {
logger('facebook: able to post');
require_once('library/facebook.php');
require_once('include/bbcode.php');
$msg = $b['body'];
logger('Facebook post: original msg=' . $msg, LOGGER_DATA);
// make links readable before we strip the code
// unless it's a dislike - just send the text as a comment
// if($b['verb'] == ACTIVITY_DISLIKE)
// $msg = trim(strip_tags(bbcode($msg)));
// Old code
/*$search_str = $a->get_baseurl() . '/search';
if(preg_match("/\[url=(.*?)\](.*?)\[\/url\]/is",$msg,$matches)) {
// don't use hashtags for message link
if(strpos($matches[2],$search_str) === false) {
$link = $matches[1];
if(substr($matches[2],0,5) != '[img]')
$linkname = $matches[2];
}
}
// strip tag links to avoid link clutter, this really should be
// configurable because we're losing information
$msg = preg_replace("/\#\[url=(.*?)\](.*?)\[\/url\]/is",'#$2',$msg);
// provide the link separately for normal links
$msg = preg_replace("/\[url=(.*?)\](.*?)\[\/url\]/is",'$2 $1',$msg);
if(preg_match("/\[img\](.*?)\[\/img\]/is",$msg,$matches))
$image = $matches[1];
$msg = preg_replace("/\[img\](.*?)\[\/img\]/is", t('Image: ') . '$1', $msg);
if((strpos($link,z_root()) !== false) && (! $image))
$image = $a->get_baseurl() . '/images/friendica-64.jpg';
$msg = trim(strip_tags(bbcode($msg)));*/
// New code
// Looking for the first image
$image = '';
if(preg_match("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/is",$b['body'],$matches))
$image = $matches[3];
if ($image == '')
if(preg_match("/\[img\](.*?)\[\/img\]/is",$b['body'],$matches))
$image = $matches[1];
// When saved into the database the content is sent through htmlspecialchars
// That means that we have to decode all image-urls
$image = htmlspecialchars_decode($image);
// Checking for a bookmark element
$body = $b['body'];
if (strpos($body, "[bookmark") !== false) {
// splitting the text in two parts:
// before and after the bookmark
$pos = strpos($body, "[bookmark");
$body1 = substr($body, 0, $pos);
$body2 = substr($body, $pos);
// Removing the bookmark and all quotes after the bookmark
// they are mostly only the content after the bookmark.
$body2 = preg_replace("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism",'',$body2);
$body2 = preg_replace("/\[quote\=([^\]]*)\](.*?)\[\/quote\]/ism",'',$body2);
$body2 = preg_replace("/\[quote\](.*?)\[\/quote\]/ism",'',$body2);
$body = $body1.$body2;
}
// At first convert the text to html
$html = bbcode($body, false, false);
// Then convert it to plain text
$msg = trim($b['title']." \n\n".html2plain($html, 0, true));
$msg = html_entity_decode($msg,ENT_QUOTES,'UTF-8');
// Removing multiple newlines
while (strpos($msg, "\n\n\n") !== false)
$msg = str_replace("\n\n\n", "\n\n", $msg);
// add any attachments as text urls
$arr = explode(',',$b['attach']);
if(count($arr)) {
$msg .= "\n";
foreach($arr as $r) {
$matches = false;
$cnt = preg_match('|\[attach\]href=\"(.*?)\" size=\"(.*?)\" type=\"(.*?)\" title=\"(.*?)\"\[\/attach\]|',$r,$matches);
if($cnt) {
$msg .= "\n".$matches[1];
}
}
}
$link = '';
$linkname = '';
// look for bookmark-bbcode and handle it with priority
if(preg_match("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/is",$b['body'],$matches)) {
$link = $matches[1];
$linkname = $matches[2];
}
// If there is no bookmark element then take the first link
if ($link == '') {
$links = collecturls($html);
if (sizeof($links) > 0) {
reset($links);
$link = current($links);
}
}
// Remove trailing and leading spaces
$msg = trim($msg);
// Since facebook increased the maxpostlen massively this never should happen again :)
if (strlen($msg) > FACEBOOK_MAXPOSTLEN) {
require_once('library/slinky.php');
$display_url = $b['plink'];
$slinky = new Slinky( $display_url );
// setup a cascade of shortening services
// try to get a short link from these services
// in the order ur1.ca, trim, id.gd, tinyurl
$slinky->set_cascade( array( new Slinky_UR1ca(), new Slinky_Trim(), new Slinky_IsGd(), new Slinky_TinyURL() ) );
$shortlink = $slinky->short();
// the new message will be shortened such that "... $shortlink"
// will fit into the character limit
$msg = substr($msg, 0, FACEBOOK_MAXPOSTLEN - strlen($shortlink) - 4);
$msg .= '... ' . $shortlink;
}
// Fallback - if message is empty
if(!strlen($msg))
$msg = $linkname;
if(!strlen($msg))
$msg = $link;
if(!strlen($msg))
$msg = $image;
// If there is nothing to post then exit
if(!strlen($msg))
return;
logger('Facebook post: msg=' . $msg, LOGGER_DATA);
if($likes) {
$postvars = array('access_token' => $fb_token);
}
else {
// message, picture, link, name, caption, description, source, place, tags
$postvars = array(
'access_token' => $fb_token,
'message' => $msg
);
if(trim($image) != "") {
$postvars['picture'] = $image;
}
if(trim($link) != "") {
$postvars['link'] = $link;
// The following doesn't work - why?
if ((stristr($link,'youtube')) || (stristr($link,'youtu.be')) || (stristr($link,'vimeo'))) {
$postvars['source'] = $link;
}
}
if(trim($linkname) != "")
$postvars['name'] = $linkname;
}
if(($b['private']) && ($toplevel)) {
$postvars['privacy'] = '{"value": "CUSTOM", "friends": "SOME_FRIENDS"';
if(count($allow_arr))
$postvars['privacy'] .= ',"allow": "' . implode(',',$allow_arr) . '"';
if(count($deny_arr))
$postvars['privacy'] .= ',"deny": "' . implode(',',$deny_arr) . '"';
$postvars['privacy'] .= '}';
}
if($reply) {
$url = 'https://graph.facebook.com/' . $reply . '/' . (($likes) ? 'likes' : 'comments');
} else if (($link != "") || ($image != "") || ($b['title'] == '') || (strlen($msg) < 500)) {
$url = 'https://graph.facebook.com/me/feed';
if($b['plink'])
$postvars['actions'] = '{"name": "' . t('View on Friendica') . '", "link": "' . $b['plink'] . '"}';
} else {
// if its only a message and a subject and the message is larger than 500 characters then post it as note
$postvars = array(
'access_token' => $fb_token,
'message' => bbcode($b['body'], false, false),
'subject' => $b['title'],
);
$url = 'https://graph.facebook.com/me/notes';
}
logger('facebook: post to ' . $url);
logger('facebook: postvars: ' . print_r($postvars,true));
// "test_mode" prevents anything from actually being posted.
// Otherwise, let's do it.
if(! get_config('facebook','test_mode')) {
$x = post_url($url, $postvars);
logger('Facebook post returns: ' . $x, LOGGER_DEBUG);
$retj = json_decode($x);
if($retj->id) {
q("UPDATE `item` SET `extid` = '%s' WHERE `id` = %d",
dbesc('fb::' . $retj->id),
intval($b['id'])
);
}
else {
if(! $likes) {
$s = serialize(array('url' => $url, 'item' => $b['id'], 'post' => $postvars));
require_once('include/queue_fn.php');
add_to_queue($a->contact,NETWORK_FACEBOOK,$s);
notice( t('Facebook post failed. Queued for retry.') . EOL);
}
if (isset($retj->error) && $retj->error->type == "OAuthException" && $retj->error->code == 190) {
logger('Facebook session has expired due to changed password.', LOGGER_DEBUG);
$last_notification = get_pconfig($b['uid'], 'facebook', 'session_expired_mailsent');
if (!$last_notification || $last_notification < (time() - FACEBOOK_SESSION_ERR_NOTIFICATION_INTERVAL)) {
require_once('include/enotify.php');
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", intval($b['uid']) );
notification(array(
'uid' => $b['uid'],
'type' => NOTIFY_SYSTEM,
'system_type' => 'facebook_connection_invalid',
'language' => $r[0]['language'],
'to_name' => $r[0]['username'],
'to_email' => $r[0]['email'],
'source_name' => t('Administrator'),
'source_link' => $a->config["system"]["url"],
'source_photo' => $a->config["system"]["url"] . '/images/person-80.jpg',
));
set_pconfig($b['uid'], 'facebook', 'session_expired_mailsent', time());
} else logger('Facebook: No notification, as the last one was sent on ' . $last_notification, LOGGER_DEBUG);
}
}
}
}
}
}
}
/**
* @param App $app
* @param object $data
*/
function facebook_enotify(&$app, &$data) {
if (x($data, 'params') && $data['params']['type'] == NOTIFY_SYSTEM && x($data['params'], 'system_type') && $data['params']['system_type'] == 'facebook_connection_invalid') {
$data['itemlink'] = '/facebook';
$data['epreamble'] = $data['preamble'] = t('Your Facebook connection became invalid. Please Re-authenticate.');
$data['subject'] = t('Facebook connection became invalid');
$data['body'] = sprintf( t("Hi %1\$s,\n\nThe connection between your accounts on %2\$s and Facebook became invalid. This usually happens after you change your Facebook-password. To enable the connection again, you have to %3\$sre-authenticate the Facebook-connector%4\$s."), $data['params']['to_name'], "[url=" . $app->config["system"]["url"] . "]" . $app->config["sitename"] . "[/url]", "[url=" . $app->config["system"]["url"] . "/facebook]", "[/url]");
}
}
/**
* @param App $a
* @param object $b
*/
function facebook_post_local(&$a,&$b) {
// Figure out if Facebook posting is enabled for this post and file it in 'postopts'
// where we will discover it during background delivery.
// This can only be triggered by a local user posting to their own wall.
if((local_user()) && (local_user() == $b['uid'])) {
$fb_post = intval(get_pconfig(local_user(),'facebook','post'));
$fb_enable = (($fb_post && x($_REQUEST,'facebook_enable')) ? intval($_REQUEST['facebook_enable']) : 0);
// if API is used, default to the chosen settings
// but allow a specific override
if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'facebook','post_by_default'))) {
if(! x($_REQUEST,'facebook_enable'))
$fb_enable = 1;
}
if(! $fb_enable)
return;
if(strlen($b['postopts']))
$b['postopts'] .= ',';
$b['postopts'] .= 'facebook';
}
}
/**
* @param App $a
* @param object $b
*/
function fb_queue_hook(&$a,&$b) {
$qi = q("SELECT * FROM `queue` WHERE `network` = '%s'",
dbesc(NETWORK_FACEBOOK)
);
if(! count($qi))
return;
require_once('include/queue_fn.php');
foreach($qi as $x) {
if($x['network'] !== NETWORK_FACEBOOK)
continue;
logger('facebook_queue: run');
$r = q("SELECT `user`.* FROM `user` LEFT JOIN `contact` on `contact`.`uid` = `user`.`uid`
WHERE `contact`.`self` = 1 AND `contact`.`id` = %d LIMIT 1",
intval($x['cid'])
);
if(! count($r))
continue;
$user = $r[0];
$appid = get_config('facebook', 'appid' );
$secret = get_config('facebook', 'appsecret' );
if($appid && $secret) {
$fb_post = intval(get_pconfig($user['uid'],'facebook','post'));
$fb_token = get_pconfig($user['uid'],'facebook','access_token');
if($fb_post && $fb_token) {
logger('facebook_queue: able to post');
require_once('library/facebook.php');
$z = unserialize($x['content']);
$item = $z['item'];
$j = post_url($z['url'],$z['post']);
$retj = json_decode($j);
if($retj->id) {
q("UPDATE `item` SET `extid` = '%s' WHERE `id` = %d",
dbesc('fb::' . $retj->id),
intval($item)
);
logger('facebook_queue: success: ' . $j);
remove_queue_item($x['id']);
}
else {
logger('facebook_queue: failed: ' . $j);
update_queue_time($x['id']);
}
}
}
}
}
/**
* @param string $access_token
* @param int $since
* @return object
*/
function fb_get_timeline($access_token, &$since) {
$entries = new stdClass();
$entries->data = array();
$newest = 0;
$url = 'https://graph.facebook.com/me/home?access_token='.$access_token;
if ($since != 0)
$url .= "&since=".$since;
do {
$s = fetch_url($url);
$j = json_decode($s);
$oldestdate = time();
if (isset($j->data))
foreach ($j->data as $entry) {
$created = strtotime($entry->created_time);
if ($newest < $created)
$newest = $created;
if ($created >= $since)
$entries->data[] = $entry;
if ($created <= $oldestdate)
$oldestdate = $created;
}
else
break;
$url = (isset($j->paging) && isset($j->paging->next) ? $j->paging->next : '');
} while (($oldestdate > $since) and ($since != 0) and ($url != ''));
if ($newest > $since)
$since = $newest;
return($entries);
}
/**
* @param int $uid
*/
function fb_consume_all($uid) {
require_once('include/items.php');
$access_token = get_pconfig($uid,'facebook','access_token');
if(! $access_token)
return;
if(! get_pconfig($uid,'facebook','no_wall')) {
$private_wall = intval(get_pconfig($uid,'facebook','private_wall'));
$s = fetch_url('https://graph.facebook.com/me/feed?access_token=' . $access_token);
if($s) {
$j = json_decode($s);
if (isset($j->data)) {
logger('fb_consume_stream: wall: ' . print_r($j,true), LOGGER_DATA);
fb_consume_stream($uid,$j,($private_wall) ? false : true);
} else {
logger('fb_consume_stream: wall: got no data from Facebook: ' . print_r($j,true), LOGGER_NORMAL);
}
}
}
// Get the last date
$lastdate = get_pconfig($uid,'facebook','lastdate');
// fetch all items since the last date
$j = fb_get_timeline($access_token, $lastdate);
if (isset($j->data)) {
logger('fb_consume_stream: feed: ' . print_r($j,true), LOGGER_DATA);
fb_consume_stream($uid,$j,false);
// Write back the last date
set_pconfig($uid,'facebook','lastdate', $lastdate);
} else
logger('fb_consume_stream: feed: got no data from Facebook: ' . print_r($j,true), LOGGER_NORMAL);
}
/**
* @param int $uid
* @param string $link
* @return string
*/
function fb_get_photo($uid,$link) {
$access_token = get_pconfig($uid,'facebook','access_token');
if(! $access_token || (! stristr($link,'facebook.com/photo.php')))
return "";
//return "\n" . '[url=' . $link . ']' . t('link') . '[/url]';
$ret = preg_match('/fbid=([0-9]*)/',$link,$match);
if($ret)
$photo_id = $match[1];
else
return "";
$x = fetch_url('https://graph.facebook.com/' . $photo_id . '?access_token=' . $access_token);
$j = json_decode($x);
if($j->picture)
return "\n\n" . '[url=' . $link . '][img]' . $j->picture . '[/img][/url]';
//else
// return "\n" . '[url=' . $link . ']' . t('link') . '[/url]';
return "";
}
/**
* @param App $a
* @param array $user
* @param array $self
* @param string $fb_id
* @param bool $wall
* @param array $orig_post
* @param object $cmnt
*/
function fb_consume_comment(&$a, &$user, &$self, $fb_id, $wall, &$orig_post, &$cmnt) {
if(! $orig_post)
return;
$top_item = $orig_post['id'];
$uid = IntVal($user[0]['uid']);
$r = q("SELECT * FROM `item` WHERE `uid` = %d AND ( `uri` = '%s' OR `extid` = '%s' ) LIMIT 1",
intval($uid),
dbesc('fb::' . $cmnt->id),
dbesc('fb::' . $cmnt->id)
);
if(count($r))
return;
$cmntdata = array();
$cmntdata['parent'] = $top_item;
$cmntdata['verb'] = ACTIVITY_POST;
$cmntdata['gravity'] = 6;
$cmntdata['uid'] = $uid;
$cmntdata['wall'] = (($wall) ? 1 : 0);
$cmntdata['uri'] = 'fb::' . $cmnt->id;
$cmntdata['parent-uri'] = $orig_post['uri'];
if($cmnt->from->id == $fb_id) {
$cmntdata['contact-id'] = $self[0]['id'];
}
else {
$r = q("SELECT * FROM `contact` WHERE `notify` = '%s' AND `uid` = %d LIMIT 1",
dbesc($cmnt->from->id),
intval($uid)
);
if(count($r)) {
$cmntdata['contact-id'] = $r[0]['id'];
if($r[0]['blocked'] || $r[0]['readonly'])
return;
}
}
if(! x($cmntdata,'contact-id'))
$cmntdata['contact-id'] = $orig_post['contact-id'];
$cmntdata['app'] = 'facebook';
$cmntdata['created'] = datetime_convert('UTC','UTC',$cmnt->created_time);
$cmntdata['edited'] = datetime_convert('UTC','UTC',$cmnt->created_time);
$cmntdata['verb'] = ACTIVITY_POST;
$cmntdata['author-name'] = $cmnt->from->name;
$cmntdata['author-link'] = 'http://facebook.com/profile.php?id=' . $cmnt->from->id;
$cmntdata['author-avatar'] = 'https://graph.facebook.com/' . $cmnt->from->id . '/picture';
$cmntdata['body'] = $cmnt->message;
$item = item_store($cmntdata);
$myconv = q("SELECT `author-link`, `author-avatar`, `parent` FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d AND `parent` != 0 AND `deleted` = 0",
dbesc($orig_post['uri']),
intval($uid)
);
if(count($myconv)) {
$importer_url = $a->get_baseurl() . '/profile/' . $user[0]['nickname'];
foreach($myconv as $conv) {
// now if we find a match, it means we're in this conversation
if(! link_compare($conv['author-link'],$importer_url))
continue;
require_once('include/enotify.php');
$conv_parent = $conv['parent'];
notification(array(
'type' => NOTIFY_COMMENT,
'notify_flags' => $user[0]['notify-flags'],
'language' => $user[0]['language'],
'to_name' => $user[0]['username'],
'to_email' => $user[0]['email'],
'uid' => $user[0]['uid'],
'item' => $cmntdata,
'link' => $a->get_baseurl() . '/display/' . $user[0]['nickname'] . '/' . $item,
'source_name' => $cmntdata['author-name'],
'source_link' => $cmntdata['author-link'],
'source_photo' => $cmntdata['author-avatar'],
'verb' => ACTIVITY_POST,
'otype' => 'item',
'parent' => $conv_parent,
));
// only send one notification
break;
}
}
}
/**
* @param App $a
* @param array $user
* @param array $self
* @param string $fb_id
* @param bool $wall
* @param array $orig_post
* @param object $likes
*/
function fb_consume_like(&$a, &$user, &$self, $fb_id, $wall, &$orig_post, &$likes) {
$top_item = $orig_post['id'];
$uid = IntVal($user[0]['uid']);
if(! $orig_post)
return;
// If we posted the like locally, it will be found with our url, not the FB url.
$second_url = (($likes->id == $fb_id) ? $self[0]['url'] : 'http://facebook.com/profile.php?id=' . $likes->id);
$r = q("SELECT * FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d AND `verb` = '%s'
AND ( `author-link` = '%s' OR `author-link` = '%s' ) LIMIT 1",
dbesc($orig_post['uri']),
intval($uid),
dbesc(ACTIVITY_LIKE),
dbesc('http://facebook.com/profile.php?id=' . $likes->id),
dbesc($second_url)
);
if(count($r))
return;
$likedata = array();
$likedata['parent'] = $top_item;
$likedata['verb'] = ACTIVITY_LIKE;
$likedata['gravity'] = 3;
$likedata['uid'] = $uid;
$likedata['wall'] = (($wall) ? 1 : 0);
$likedata['uri'] = item_new_uri($a->get_baseurl(), $uid);
$likedata['parent-uri'] = $orig_post['uri'];
if($likes->id == $fb_id)
$likedata['contact-id'] = $self[0]['id'];
else {
$r = q("SELECT * FROM `contact` WHERE `notify` = '%s' AND `uid` = %d AND `blocked` = 0 AND `readonly` = 0 LIMIT 1",
dbesc($likes->id),
intval($uid)
);
if(count($r))
$likedata['contact-id'] = $r[0]['id'];
}
if(! x($likedata,'contact-id'))
$likedata['contact-id'] = $orig_post['contact-id'];
$likedata['app'] = 'facebook';
$likedata['verb'] = ACTIVITY_LIKE;
$likedata['author-name'] = $likes->name;
$likedata['author-link'] = 'http://facebook.com/profile.php?id=' . $likes->id;
$likedata['author-avatar'] = 'https://graph.facebook.com/' . $likes->id . '/picture';
$author = '[url=' . $likedata['author-link'] . ']' . $likedata['author-name'] . '[/url]';
$objauthor = '[url=' . $orig_post['author-link'] . ']' . $orig_post['author-name'] . '[/url]';
$post_type = t('status');
$plink = '[url=' . $orig_post['plink'] . ']' . $post_type . '[/url]';
$likedata['object-type'] = ACTIVITY_OBJ_NOTE;
$likedata['body'] = sprintf( t('%1$s likes %2$s\'s %3$s'), $author, $objauthor, $plink);
$likedata['object'] = '<object><type>' . ACTIVITY_OBJ_NOTE . '</type><local>1</local>' .
'<id>' . $orig_post['uri'] . '</id><link>' . xmlify('<link rel="alternate" type="text/html" href="' . xmlify($orig_post['plink']) . '" />') . '</link><title>' . $orig_post['title'] . '</title><content>' . $orig_post['body'] . '</content></object>';
item_store($likedata);
}
/**
* @param App $a
* @param array $user
* @param object $entry
* @param array $self
* @param string $fb_id
* @param bool $wall
* @param array $orig_post
*/
function fb_consume_status(&$a, &$user, &$entry, &$self, $fb_id, $wall, &$orig_post) {
$uid = IntVal($user[0]['uid']);
$access_token = get_pconfig($uid, 'facebook', 'access_token');
$s = fetch_url('https://graph.facebook.com/' . $entry->id . '?access_token=' . $access_token);
if($s) {
$j = json_decode($s);
if (isset($j->comments) && isset($j->comments->data))
foreach ($j->comments->data as $cmnt)
fb_consume_comment($a, $user, $self, $fb_id, $wall, $orig_post, $cmnt);
if (isset($j->likes) && isset($j->likes->data) && isset($j->likes->count)) {
if (count($j->likes->data) == $j->likes->count) {
foreach ($j->likes->data as $likers) fb_consume_like($a, $user, $self, $fb_id, $wall, $orig_post, $likers);
} else {
$t = fetch_url('https://graph.facebook.com/' . $entry->id . '/likes?access_token=' . $access_token);
if ($t) {
$k = json_decode($t);
if (isset($k->data))
foreach ($k->data as $likers)
fb_consume_like($a, $user, $self, $fb_id, $wall, $orig_post, $likers);
}
}
}
}
}
/**
* @param int $uid
* @param object $j
* @param bool $wall
*/
function fb_consume_stream($uid,$j,$wall = false) {
$a = get_app();
$user = q("SELECT * FROM `user` WHERE `uid` = %d AND `account_expired` = 0 LIMIT 1",
intval($uid)
);
if(! count($user))
return;
// $my_local_url = $a->get_baseurl() . '/profile/' . $user[0]['nickname'];
$no_linking = get_pconfig($uid,'facebook','no_linking');
if($no_linking)
return;
$self = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
intval($uid)
);
$blocked_apps = get_pconfig($uid,'facebook','blocked_apps');
$blocked_apps_arr = explode(',',$blocked_apps);
$sync_comments = get_config('facebook', 'sync_comments');
/** @var string $self_id */
$self_id = get_pconfig($uid,'facebook','self_id');
if(! count($j->data) || (! strlen($self_id)))
return;
$top_item = 0;
foreach($j->data as $entry) {
logger('fb_consume: entry: ' . print_r($entry,true), LOGGER_DATA);
$datarray = array();
$r = q("SELECT * FROM `item` WHERE ( `uri` = '%s' OR `extid` = '%s') AND `uid` = %d LIMIT 1",
dbesc('fb::' . $entry->id),
dbesc('fb::' . $entry->id),
intval($uid)
);
if(count($r)) {
$orig_post = $r[0];
$top_item = $r[0]['id'];
}
else {
$orig_post = null;
}
if(! $orig_post) {
$datarray['gravity'] = 0;
$datarray['uid'] = $uid;
$datarray['wall'] = (($wall) ? 1 : 0);
$datarray['uri'] = $datarray['parent-uri'] = 'fb::' . $entry->id;
$from = $entry->from;
if($from->id == $self_id)
$datarray['contact-id'] = $self[0]['id'];
else {
// Looking if user is known - if not he is added
$access_token = get_pconfig($uid, 'facebook', 'access_token');
fb_get_friends_sync_new($uid, $access_token, array($from));
$r = q("SELECT * FROM `contact` WHERE `notify` = '%s' AND `uid` = %d AND `blocked` = 0 AND `readonly` = 0 LIMIT 1",
dbesc($from->id),
intval($uid)
);
if(count($r))
$datarray['contact-id'] = $r[0]['id'];
}
// don't store post if we don't have a contact
if(! x($datarray,'contact-id')) {
logger('facebook: no contact '.$from->name.' '.$from->id.'. post ignored');
continue;
}
$datarray['verb'] = ACTIVITY_POST;
if($wall) {
$datarray['owner-name'] = $self[0]['name'];
$datarray['owner-link'] = $self[0]['url'];
$datarray['owner-avatar'] = $self[0]['thumb'];
}
if(isset($entry->application) && isset($entry->application->name) && strlen($entry->application->name))
$datarray['app'] = strip_tags($entry->application->name);
else
$datarray['app'] = 'facebook';
$found_blocked = false;
if(count($blocked_apps_arr)) {
foreach($blocked_apps_arr as $bad_appl) {
if(strlen(trim($bad_appl)) && (stristr($datarray['app'],trim($bad_appl)))) {
$found_blocked = true;
}
}
}
if($found_blocked) {
logger('facebook: blocking application: ' . $datarray['app']);
continue;
}
$datarray['author-name'] = $from->name;
$datarray['author-link'] = 'http://facebook.com/profile.php?id=' . $from->id;
$datarray['author-avatar'] = 'https://graph.facebook.com/' . $from->id . '/picture';
$datarray['plink'] = $datarray['author-link'] . '&v=wall&story_fbid=' . substr($entry->id,strpos($entry->id,'_') + 1);
logger('facebook: post '.$entry->id.' from '.$from->name);
$datarray['body'] = (isset($entry->message) ? escape_tags($entry->message) : '');
if(isset($entry->name) && isset($entry->link))
$datarray['body'] .= "\n\n[bookmark=".$entry->link."]".$entry->name."[/bookmark]";
elseif (isset($entry->name))
$datarray['body'] .= "\n\n[b]" . $entry->name."[/b]";
if(isset($entry->caption)) {
if(!isset($entry->name) && isset($entry->link))
$datarray['body'] .= "\n\n[bookmark=".$entry->link."]".$entry->caption."[/bookmark]";
else
$datarray['body'] .= "[i]" . $entry->caption."[/i]\n";
}
if(!isset($entry->caption) && !isset($entry->name)) {
if (isset($entry->link))
$datarray['body'] .= "\n[url]".$entry->link."[/url]\n";
else
$datarray['body'] .= "\n";
}
$quote = "";
if(isset($entry->description))
$quote = $entry->description;
if (isset($entry->properties))
foreach ($entry->properties as $property)
$quote .= "\n".$property->name.": [url=".$property->href."]".$property->text."[/url]";
if ($quote)
$datarray['body'] .= "\n[quote]".$quote."[/quote]";
// Only import the picture when the message is no video
// oembed display a picture of the video as well
if ($entry->type != "video") {
if(isset($entry->picture) && isset($entry->link)) {
$datarray['body'] .= "\n" . '[url=' . $entry->link . '][img]'.$entry->picture.'[/img][/url]';
}
else {
if(isset($entry->picture))
$datarray['body'] .= "\n" . '[img]' . $entry->picture . '[/img]';
// if just a link, it may be a wall photo - check
if(isset($entry->link))
$datarray['body'] .= fb_get_photo($uid,$entry->link);
}
}
if (($datarray['app'] == "Events") && isset($entry->actions))
foreach ($entry->actions as $action)
if ($action->name == "View")
$datarray['body'] .= " [url=".$action->link."]".$entry->story."[/url]";
// Just as a test - to see if these are the missing entries
//if(trim($datarray['body']) == '')
// $datarray['body'] = $entry->story;
// Adding the "story" text to see if there are useful data in it (testing)
//if (($datarray['app'] != "Events") && $entry->story)
// $datarray['body'] .= "\n".$entry->story;
if(trim($datarray['body']) == '') {
logger('facebook: empty body '.$entry->id.' '.print_r($entry, true));
continue;
}
$datarray['body'] .= "\n";
if (isset($entry->icon))
$datarray['body'] .= "[img]".$entry->icon."[/img] &nbsp; ";
if (isset($entry->actions))
foreach ($entry->actions as $action)
if (($action->name != "Comment") && ($action->name != "Like"))
$datarray['body'] .= "[url=".$action->link."]".$action->name."[/url] &nbsp; ";
$datarray['body'] = trim($datarray['body']);
//if(($datarray['body'] != '') && ($uid == 1))
// $datarray['body'] .= "[noparse]".print_r($entry, true)."[/noparse]";
if (isset($entry->place)) {
if ($entry->place->name || $entry->place->location->street ||
$entry->place->location->city || $entry->place->location->Denmark) {
$datarray['coord'] = '';
if ($entry->place->name)
$datarray['coord'] .= $entry->place->name;
if ($entry->place->location->street)
$datarray['coord'] .= $entry->place->location->street;
if ($entry->place->location->city)
$datarray['coord'] .= " ".$entry->place->location->city;
if ($entry->place->location->country)
$datarray['coord'] .= " ".$entry->place->location->country;
} else if ($entry->place->location->latitude && $entry->place->location->longitude)
$datarray['coord'] = substr($entry->place->location->latitude, 0, 8)
.' '.substr($entry->place->location->longitude, 0, 8);
}
$datarray['created'] = datetime_convert('UTC','UTC',$entry->created_time);
$datarray['edited'] = datetime_convert('UTC','UTC',$entry->updated_time);
// If the entry has a privacy policy, we cannot assume who can or cannot see it,
// as the identities are from a foreign system. Mark it as private to the owner.
if(isset($entry->privacy) && $entry->privacy->value !== 'EVERYONE') {
$datarray['private'] = 1;
$datarray['allow_cid'] = '<' . $self[0]['id'] . '>';
}
$top_item = item_store($datarray);
$r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($top_item),
intval($uid)
);
if(count($r)) {
$orig_post = $r[0];
logger('fb: new top level item posted');
}
}
/** @var array $orig_post */
$likers_num = (isset($entry->likes) && isset($entry->likes->count) ? IntVal($entry->likes->count) : 0 );
if(isset($entry->likes) && isset($entry->likes->data))
$likers = $entry->likes->data;
else
$likers = null;
$comments_num = (isset($entry->comments) && isset($entry->comments->count) ? IntVal($entry->comments->count) : 0 );
if(isset($entry->comments) && isset($entry->comments->data))
$comments = $entry->comments->data;
else
$comments = null;
$needs_sync = false;
if(is_array($likers)) {
foreach($likers as $likes) fb_consume_like($a, $user, $self, $self_id, $wall, $orig_post, $likes);
if ($sync_comments) {
$r = q("SELECT COUNT(*) likes FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d AND `verb` = '%s' AND `parent-uri` != `uri`",
dbesc($orig_post['uri']),
intval($uid),
dbesc(ACTIVITY_LIKE)
);
if ($r[0]['likes'] < $likers_num) {
logger('fb_consume_stream: missing likes found for ' . $orig_post['uri'] . ' (we have ' . $r[0]['likes'] . ' of ' . $likers_num . '). Synchronizing...', LOGGER_DEBUG);
$needs_sync = true;
}
}
}
if(is_array($comments)) {
foreach($comments as $cmnt) fb_consume_comment($a, $user, $self, $self_id, $wall, $orig_post, $cmnt);
if ($sync_comments) {
$r = q("SELECT COUNT(*) comments FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d AND `verb` = '%s' AND `parent-uri` != `uri`",
dbesc($orig_post['uri']),
intval($uid),
ACTIVITY_POST
);
if ($r[0]['comments'] < $comments_num) {
logger('fb_consume_stream: missing comments found for ' . $orig_post['uri'] . ' (we have ' . $r[0]['comments'] . ' of ' . $comments_num . '). Synchronizing...', LOGGER_DEBUG);
$needs_sync = true;
}
}
}
if ($needs_sync) fb_consume_status($a, $user, $entry, $self, $self_id, $wall, $orig_post);
}
}
/**
* @return bool|string
*/
function fb_get_app_access_token() {
$acc_token = get_config('facebook','app_access_token');
if ($acc_token !== false) return $acc_token;
$appid = get_config('facebook','appid');
$appsecret = get_config('facebook', 'appsecret');
if ($appid === false || $appsecret === false) {
logger('fb_get_app_access_token: appid and/or appsecret not set', LOGGER_DEBUG);
return false;
}
logger('https://graph.facebook.com/oauth/access_token?client_id=' . $appid . '&client_secret=' . $appsecret . '&grant_type=client_credentials', LOGGER_DATA);
$x = fetch_url('https://graph.facebook.com/oauth/access_token?client_id=' . $appid . '&client_secret=' . $appsecret . '&grant_type=client_credentials');
if(strpos($x,'access_token=') !== false) {
logger('fb_get_app_access_token: returned access token: ' . $x, LOGGER_DATA);
$token = str_replace('access_token=', '', $x);
if(strpos($token,'&') !== false)
$token = substr($token,0,strpos($token,'&'));
if ($token == "") {
logger('fb_get_app_access_token: empty token: ' . $x, LOGGER_DEBUG);
return false;
}
set_config('facebook','app_access_token',$token);
return $token;
} else {
logger('fb_get_app_access_token: response did not contain an access_token: ' . $x, LOGGER_DATA);
return false;
}
}
function facebook_subscription_del_users() {
$a = get_app();
$access_token = fb_get_app_access_token();
$url = "https://graph.facebook.com/" . get_config('facebook', 'appid' ) . "/subscriptions?access_token=" . $access_token;
facebook_delete_url($url);
if (!facebook_check_realtime_active()) del_config('facebook', 'realtime_active');
}
/**
* @param bool $second_try
*/
function facebook_subscription_add_users($second_try = false) {
$a = get_app();
$access_token = fb_get_app_access_token();
$url = "https://graph.facebook.com/" . get_config('facebook', 'appid' ) . "/subscriptions?access_token=" . $access_token;
list($usec, $sec) = explode(" ", microtime());
$verify_token = sha1($usec . $sec . rand(0, 999999999));
set_config('facebook', 'cb_verify_token', $verify_token);
$cb = $a->get_baseurl() . '/facebook/?realtime_cb=1';
$j = post_url($url,array(
"object" => "user",
"fields" => "feed,friends",
"callback_url" => $cb,
"verify_token" => $verify_token,
));
del_config('facebook', 'cb_verify_token');
if ($j) {
$x = json_decode($j);
logger("Facebook reponse: " . $j, LOGGER_DATA);
if (isset($x->error)) {
logger('facebook_subscription_add_users: got an error: ' . $j);
if ($x->error->type == "OAuthException" && $x->error->code == 190) {
del_config('facebook', 'app_access_token');
if ($second_try === false) facebook_subscription_add_users(true);
}
} else {
logger('facebook_subscription_add_users: sucessful');
if (facebook_check_realtime_active()) set_config('facebook', 'realtime_active', 1);
}
};
}
/**
* @return null|array
*/
function facebook_subscriptions_get() {
$access_token = fb_get_app_access_token();
if (!$access_token) return null;
$url = "https://graph.facebook.com/" . get_config('facebook', 'appid' ) . "/subscriptions?access_token=" . $access_token;
$j = fetch_url($url);
$ret = null;
if ($j) {
$x = json_decode($j);
if (isset($x->data)) $ret = $x->data;
}
return $ret;
}
/**
* @return bool
*/
function facebook_check_realtime_active() {
$ret = facebook_subscriptions_get();
if (is_null($ret)) return false;
if (is_array($ret)) foreach ($ret as $re) if (is_object($re) && $re->object == "user") return true;
return false;
}
// DELETE-request to $url
if(! function_exists('facebook_delete_url')) {
/**
* @param string $url
* @param null|array $headers
* @param int $redirects
* @param int $timeout
* @return bool|string
*/
function facebook_delete_url($url,$headers = null, &$redirects = 0, $timeout = 0) {
$a = get_app();
$ch = curl_init($url);
if(($redirects > 8) || (! $ch))
return false;
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_USERAGENT, "Friendica");
if(intval($timeout)) {
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
}
else {
$curl_time = intval(get_config('system','curl_timeout'));
curl_setopt($ch, CURLOPT_TIMEOUT, (($curl_time !== false) ? $curl_time : 60));
}
if(defined('LIGHTTPD')) {
if(!is_array($headers)) {
$headers = array('Expect:');
} else {
if(!in_array('Expect:', $headers)) {
array_push($headers, 'Expect:');
}
}
}
if($headers)
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$check_cert = get_config('system','verifyssl');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, (($check_cert) ? true : false));
$prx = get_config('system','proxy');
if(strlen($prx)) {
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($ch, CURLOPT_PROXY, $prx);
$prxusr = get_config('system','proxyuser');
if(strlen($prxusr))
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $prxusr);
}
$a->set_curl_code(0);
// don't let curl abort the entire application
// if it throws any errors.
$s = @curl_exec($ch);
$base = $s;
$curl_info = curl_getinfo($ch);
$http_code = $curl_info['http_code'];
$header = '';
// Pull out multiple headers, e.g. proxy and continuation headers
// allow for HTTP/2.x without fixing code
while(preg_match('/^HTTP\/[1-2].+? [1-5][0-9][0-9]/',$base)) {
$chunk = substr($base,0,strpos($base,"\r\n\r\n")+4);
$header .= $chunk;
$base = substr($base,strlen($chunk));
}
if($http_code == 301 || $http_code == 302 || $http_code == 303) {
$matches = array();
preg_match('/(Location:|URI:)(.*?)\n/', $header, $matches);
$url = trim(array_pop($matches));
$url_parsed = @parse_url($url);
if (isset($url_parsed)) {
$redirects++;
return facebook_delete_url($url,$headers,$redirects,$timeout);
}
}
$a->set_curl_code($http_code);
$body = substr($s,strlen($header));
$a->set_curl_headers($header);
curl_close($ch);
return($body);
}}

253
facebook/lang/C/messages.po Normal file
View file

@ -0,0 +1,253 @@
# ADDON facebook
# Copyright (C)
# This file is distributed under the same license as the Friendica facebook addon package.
#
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-02-27 05:01-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: facebook.php:497
msgid "Settings updated."
msgstr ""
#: facebook.php:512 facebook.php:518
msgid "Permission denied."
msgstr ""
#: facebook.php:525
msgid "Facebook disabled"
msgstr ""
#: facebook.php:530
msgid "Updating contacts"
msgstr ""
#: facebook.php:553
msgid "Facebook API key is missing."
msgstr ""
#: facebook.php:560
msgid "Facebook Connect"
msgstr ""
#: facebook.php:566
msgid "Install Facebook connector for this account."
msgstr ""
#: facebook.php:573
msgid "Remove Facebook connector"
msgstr ""
#: facebook.php:578
msgid ""
"Re-authenticate [This is necessary whenever your Facebook password is "
"changed.]"
msgstr ""
#: facebook.php:585
msgid "Post to Facebook by default"
msgstr ""
#: facebook.php:591
msgid ""
"Facebook friend linking has been disabled on this site. The following "
"settings will have no effect."
msgstr ""
#: facebook.php:595
msgid ""
"Facebook friend linking has been disabled on this site. If you disable it, "
"you will be unable to re-enable it."
msgstr ""
#: facebook.php:598
msgid "Link all your Facebook friends and conversations on this website"
msgstr ""
#: facebook.php:600
msgid ""
"Facebook conversations consist of your <em>profile wall</em> and your friend "
"<em>stream</em>."
msgstr ""
#: facebook.php:601
msgid "On this website, your Facebook friend stream is only visible to you."
msgstr ""
#: facebook.php:602
msgid ""
"The following settings determine the privacy of your Facebook profile wall "
"on this website."
msgstr ""
#: facebook.php:606
msgid ""
"On this website your Facebook profile wall conversations will only be "
"visible to you"
msgstr ""
#: facebook.php:611
msgid "Do not import your Facebook profile wall conversations"
msgstr ""
#: facebook.php:613
msgid ""
"If you choose to link conversations and leave both of these boxes unchecked, "
"your Facebook profile wall will be merged with your profile wall on this "
"website and your privacy settings on this website will be used to determine "
"who may see the conversations."
msgstr ""
#: facebook.php:618
msgid "Comma separated applications to ignore"
msgstr ""
#: facebook.php:621
msgid "Submit"
msgstr ""
#: facebook.php:702
msgid "Problems with Facebook Real-Time Updates"
msgstr ""
#: facebook.php:704 facebook.php:1202
msgid "Administrator"
msgstr ""
#: facebook.php:730
msgid "Facebook"
msgstr ""
#: facebook.php:731
msgid "Facebook Connector Settings"
msgstr ""
#: facebook.php:746
msgid "Facebook API Key"
msgstr ""
#: facebook.php:756
msgid ""
"Error: it appears that you have specified the App-ID and -Secret in your ."
"htconfig.php file. As long as they are specified there, they cannot be set "
"using this form.<br><br>"
msgstr ""
#: facebook.php:761
msgid ""
"Error: the given API Key seems to be incorrect (the application access token "
"could not be retrieved)."
msgstr ""
#: facebook.php:763
msgid "The given API Key seems to work correctly."
msgstr ""
#: facebook.php:765
msgid ""
"The correctness of the API Key could not be detected. Something strange's "
"going on."
msgstr ""
#: facebook.php:768
msgid "App-ID / API-Key"
msgstr ""
#: facebook.php:769
msgid "Application secret"
msgstr ""
#: facebook.php:770
#, php-format
msgid "Polling Interval in minutes (minimum %1$s minutes)"
msgstr ""
#: facebook.php:771
msgid ""
"Synchronize comments (no comments on Facebook are missed, at the cost of "
"increased system load)"
msgstr ""
#: facebook.php:772
msgid "Save"
msgstr ""
#: facebook.php:775
msgid "Real-Time Updates"
msgstr ""
#: facebook.php:779
msgid "Real-Time Updates are activated."
msgstr ""
#: facebook.php:780
msgid "Deactivate Real-Time Updates"
msgstr ""
#: facebook.php:782
msgid "Real-Time Updates not activated."
msgstr ""
#: facebook.php:782
msgid "Activate Real-Time Updates"
msgstr ""
#: facebook.php:801
msgid "The new values have been saved."
msgstr ""
#: facebook.php:825
msgid "Post to Facebook"
msgstr ""
#: facebook.php:923
msgid ""
"Post to Facebook cancelled because of multi-network access permission "
"conflict."
msgstr ""
#: facebook.php:1151
msgid "View on Friendica"
msgstr ""
#: facebook.php:1184
msgid "Facebook post failed. Queued for retry."
msgstr ""
#: facebook.php:1224
msgid "Your Facebook connection became invalid. Please Re-authenticate."
msgstr ""
#: facebook.php:1225
msgid "Facebook connection became invalid"
msgstr ""
#: facebook.php:1226
#, php-format
msgid ""
"Hi %1$s,\n"
"\n"
"The connection between your accounts on %2$s and Facebook became invalid. "
"This usually happens after you change your Facebook-password. To enable the "
"connection again, you have to %3$sre-authenticate the Facebook-connector%4$s."
msgstr ""
#: facebook.php:1600
msgid "status"
msgstr ""
#: facebook.php:1604
#, php-format
msgid "%1$s likes %2$s's %3$s"
msgstr ""

View file

@ -0,0 +1,49 @@
<?php
$a->strings["Settings updated."] = "Ajustos actualitzats.";
$a->strings["Permission denied."] = "Permís denegat.";
$a->strings["Facebook disabled"] = "Facebook deshabilitat";
$a->strings["Updating contacts"] = "Actualitzant contactes";
$a->strings["Facebook API key is missing."] = "La clau del API de Facebook s'ha perdut.";
$a->strings["Facebook Connect"] = "Facebook Connectat";
$a->strings["Install Facebook connector for this account."] = "Instal·lar el connector de Facebook per aquest compte.";
$a->strings["Remove Facebook connector"] = "Eliminar el connector de Faceboook";
$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "Re-autentificar [Això és necessari cada vegada que la contrasenya de Facebook canvia.]";
$a->strings["Post to Facebook by default"] = "Enviar a Facebook per defecte";
$a->strings["Facebook friend linking has been disabled on this site. The following settings will have no effect."] = "La vinculació amb amics de Facebook s'ha deshabilitat en aquest lloc. Els ajustos que facis no faran efecte.";
$a->strings["Facebook friend linking has been disabled on this site. If you disable it, you will be unable to re-enable it."] = "La vinculació amb amics de Facebook s'ha deshabilitat en aquest lloc. Si esta deshabilitat, no es pot utilitzar.";
$a->strings["Link all your Facebook friends and conversations on this website"] = "Enllaça tots els teus amics i les converses de Facebook en aquest lloc web";
$a->strings["Facebook conversations consist of your <em>profile wall</em> and your friend <em>stream</em>."] = "Les converses de Facebook consisteixen en el <em>perfil del mur</em> i en el<em> flux </em> del seu amic.";
$a->strings["On this website, your Facebook friend stream is only visible to you."] = "En aquesta pàgina web, el flux del seu amic a Facebook només és visible per a vostè.";
$a->strings["The following settings determine the privacy of your Facebook profile wall on this website."] = "Les següents opcions determinen la privacitat del mur del seu perfil de Facebook en aquest lloc web.";
$a->strings["On this website your Facebook profile wall conversations will only be visible to you"] = "En aquesta pàgina web les seves converses al mur del perfil de Facebook només seran visible per a vostè";
$a->strings["Do not import your Facebook profile wall conversations"] = "No importi les seves converses del mur del perfil de Facebook";
$a->strings["If you choose to link conversations and leave both of these boxes unchecked, your Facebook profile wall will be merged with your profile wall on this website and your privacy settings on this website will be used to determine who may see the conversations."] = "Si opta per vincular les converses i deixar ambdues caselles sense marcar, el mur del seu perfil de Facebook es fusionarà amb el mur del seu perfil en aquest lloc web i la seva configuració de privacitat en aquest website serà utilitzada per determinar qui pot veure les converses.";
$a->strings["Comma separated applications to ignore"] = "Separats per comes les aplicacions a ignorar";
$a->strings["Submit"] = "Enviar";
$a->strings["Problems with Facebook Real-Time Updates"] = "Problemes amb Actualitzacions en Temps Real a Facebook";
$a->strings["Administrator"] = "Administrador";
$a->strings["Facebook"] = "Facebook";
$a->strings["Facebook Connector Settings"] = "Ajustos del Connector de Facebook";
$a->strings["Facebook API Key"] = "Facebook API Key";
$a->strings["Error: it appears that you have specified the App-ID and -Secret in your .htconfig.php file. As long as they are specified there, they cannot be set using this form.<br><br>"] = "Error: Apareix que has especificat el App-ID i el Secret en el arxiu .htconfig.php. Per estar especificat allà, no pot ser canviat utilitzant aquest formulari.<br><br>";
$a->strings["Error: the given API Key seems to be incorrect (the application access token could not be retrieved)."] = "Error: la API Key facilitada sembla incorrecta (no es va poder recuperar el token d'accés de l'aplicatiu).";
$a->strings["The given API Key seems to work correctly."] = "La API Key facilitada sembla treballar correctament.";
$a->strings["The correctness of the API Key could not be detected. Something strange's going on."] = "La correcció de la API key no pot ser detectada. Quelcom estrany ha succeït.";
$a->strings["App-ID / API-Key"] = "App-ID / API-Key";
$a->strings["Application secret"] = "Application secret";
$a->strings["Synchronize comments (no comments on Facebook are missed, at the cost of increased system load)"] = "Sincronitzar els comentaris (els comentaris a Facebook es perden, a costa de la major càrrega del sistema)";
$a->strings["Save"] = "Guardar";
$a->strings["Real-Time Updates"] = "Actualitzacions en Temps Real";
$a->strings["Real-Time Updates are activated."] = "Actualitzacions en Temps Real està activat.";
$a->strings["Deactivate Real-Time Updates"] = "Actualitzacions en Temps Real Desactivat";
$a->strings["Real-Time Updates not activated."] = "Actualitzacions en Temps Real no activat.";
$a->strings["Activate Real-Time Updates"] = "Actualitzacions en Temps Real Activat";
$a->strings["The new values have been saved."] = "Els nous valors s'han guardat.";
$a->strings["Post to Facebook"] = "Enviament a Facebook";
$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "Enviament a Facebook cancel·lat perque hi ha un conflicte de permisos d'accés multi-xarxa.";
$a->strings["View on Friendica"] = "Vist en Friendica";
$a->strings["Facebook post failed. Queued for retry."] = "Enviament a Facebook fracassat. En cua per a reintent.";
$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "La seva connexió a Facebook es va convertir en no vàlida. Per favor, torni a autenticar-se";
$a->strings["Facebook connection became invalid"] = "La seva connexió a Facebook es va convertir en no vàlida";
$a->strings["status"] = "estatus";

View file

@ -0,0 +1,49 @@
<?php
$a->strings["Settings updated."] = "Nastavení aktualizováno.";
$a->strings["Permission denied."] = "Přístup odmítnut.";
$a->strings["Facebook disabled"] = "Facebook zakázán";
$a->strings["Updating contacts"] = "Aktualizace kontaktů";
$a->strings["Facebook API key is missing."] = "Chybí Facebook API klíč.";
$a->strings["Facebook Connect"] = "Facebook připojen";
$a->strings["Install Facebook connector for this account."] = "Nainstalovat pro tento účet Facebook konektor.";
$a->strings["Remove Facebook connector"] = "Odstranit konektor na Facebook";
$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "Opětovná autentikace [Toto je nezbytné kdykoliv se změní Vaše heslo na Facebooku.]";
$a->strings["Post to Facebook by default"] = "Standardně posílat příspěvky na Facebook";
$a->strings["Facebook friend linking has been disabled on this site. The following settings will have no effect."] = "Propojování facebookových přátel bylo na tomto webu zablokováno. Následující odkazy nebudou mít žádný efekt.";
$a->strings["Facebook friend linking has been disabled on this site. If you disable it, you will be unable to re-enable it."] = "Propojování facebookových přátel bylo na tomto webu zablokováno. Když to zakážete nebudete schopni toto znovu povolit.";
$a->strings["Link all your Facebook friends and conversations on this website"] = "Připojit na tomto webu všechny Vaše přátelé a konverzace z Facebooku";
$a->strings["Facebook conversations consist of your <em>profile wall</em> and your friend <em>stream</em>."] = "Facebookové konverzace se skládají z Vaší <em>profilové zdi</em> a příspěvků Vašich přátel <em>(stream)</em>.";
$a->strings["On this website, your Facebook friend stream is only visible to you."] = "Na tomto webu můžete vidět pouze příspěvky Vašich přátel Facebook (Stream).";
$a->strings["The following settings determine the privacy of your Facebook profile wall on this website."] = "Následující nastavení určuje Vaše soukromí na Facebookovém profilu na tomto webu.";
$a->strings["On this website your Facebook profile wall conversations will only be visible to you"] = "Na tomto webu bude konverzace z Facebookové profilové zdi viditelná pouze pro Vás.";
$a->strings["Do not import your Facebook profile wall conversations"] = "Neimportovat konverzace z Facebookové zdi";
$a->strings["If you choose to link conversations and leave both of these boxes unchecked, your Facebook profile wall will be merged with your profile wall on this website and your privacy settings on this website will be used to determine who may see the conversations."] = "Pokud budete chtít propojit konverzace a ponecháte obě z těchto dvou polí nezaškrtnuté, bude Vaše profilová zeď na Facebooku sloučená s profilovou zdí na tomto webu a nastavení soukromí na tomto webu bude určovat kdo bude mít možnost vidět konverzace.";
$a->strings["Comma separated applications to ignore"] = "čárkou oddělené aplikace k ignorování";
$a->strings["Submit"] = "Odeslat";
$a->strings["Problems with Facebook Real-Time Updates"] = "Problémy s Facebook Real-Time aktualizacemi";
$a->strings["Administrator"] = "Administrátor";
$a->strings["Facebook"] = "Facebook";
$a->strings["Facebook Connector Settings"] = "Nastavení Facebook konektoru ";
$a->strings["Facebook API Key"] = "Facebook API Key";
$a->strings["Error: it appears that you have specified the App-ID and -Secret in your .htconfig.php file. As long as they are specified there, they cannot be set using this form.<br><br>"] = "Chyba: zdá se, že jste specifikoval App-ID a -Secret ve Vašem .htconfig.php souboru. Dokud jsou na tomto místě specifikované, nemohou být nastaveny s pomocí tohoto formuláře.<br><br>";
$a->strings["Error: the given API Key seems to be incorrect (the application access token could not be retrieved)."] = "Chyba: zadané API Key se zdá být chybné (není možné získat aplikační přístupový token).";
$a->strings["The given API Key seems to work correctly."] = "Zadané API Key se zdá funguje v pořádku.";
$a->strings["The correctness of the API Key could not be detected. Something strange's going on."] = "Správnost klíče API nemohla být detekovaná. Děje se něco podivného.";
$a->strings["App-ID / API-Key"] = "App-ID / API-Key";
$a->strings["Application secret"] = "Application secret";
$a->strings["Synchronize comments (no comments on Facebook are missed, at the cost of increased system load)"] = "Syncronizovat komentáře (nedojde k vynechání žádného komentáže na Facebooku za cenu vyšší zátěže systému)";
$a->strings["Save"] = "Uložit";
$a->strings["Real-Time Updates"] = "Real-Time Aktualizace";
$a->strings["Real-Time Updates are activated."] = "Real-Time aktualizace aktivovány.";
$a->strings["Deactivate Real-Time Updates"] = "Deaktivovat Real-Time aktualizace";
$a->strings["Real-Time Updates not activated."] = "Real-Time aktualizace nejsou aktivovány.";
$a->strings["Activate Real-Time Updates"] = "Aktivovat Real-Time aktualizace";
$a->strings["The new values have been saved."] = "Nové hodnoty byly uloženy";
$a->strings["Post to Facebook"] = "Přidat příspěvek na Facebook";
$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "Příspěvek na Facebook zrušen kvůli konfliktu přístupových práv mezi sítěmi.";
$a->strings["View on Friendica"] = "Zobrazení na Friendica";
$a->strings["Facebook post failed. Queued for retry."] = "Zaslání příspěvku na Facebook selhalo. Příspěvek byl zařazen do fronty pro opakované odeslání.";
$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "Vaše připojení na Facebook přestalo být platné. Prosím znovu se přihlaste.";
$a->strings["Facebook connection became invalid"] = "Připojení na Facebook bylo zneplatněno.";
$a->strings["status"] = "Stav";

View file

@ -0,0 +1,49 @@
<?php
$a->strings["Settings updated."] = "Einstellungen aktualisiert.";
$a->strings["Permission denied."] = "Zugriff verweigert.";
$a->strings["Facebook disabled"] = "Facebook deaktiviert";
$a->strings["Updating contacts"] = "Aktualisiere Kontakte";
$a->strings["Facebook API key is missing."] = "Facebook-API-Schlüssel nicht gefunden";
$a->strings["Facebook Connect"] = "Mit Facebook verbinden";
$a->strings["Install Facebook connector for this account."] = "Facebook-Connector für dieses Konto installieren.";
$a->strings["Remove Facebook connector"] = "Facebook-Connector entfernen";
$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "Neu authentifizieren [Das ist immer dann nötig, wenn du dein Facebook-Passwort geändert hast.]";
$a->strings["Post to Facebook by default"] = "Veröffentliche standardmäßig bei Facebook";
$a->strings["Facebook friend linking has been disabled on this site. The following settings will have no effect."] = "Das Verlinken von Facebookkontakten wurde auf dieser Seite deaktiviert. Die folgenden Einstellungen haben keinen Effekt.";
$a->strings["Facebook friend linking has been disabled on this site. If you disable it, you will be unable to re-enable it."] = "Das Verlinken von Facebookkontakten wurde auf dieser Seite deaktiviert. Wenn du es ausgeschaltet hast, kannst du es nicht wieder aktivieren.";
$a->strings["Link all your Facebook friends and conversations on this website"] = "All meine Facebook-Kontakte und -Konversationen hier auf diese Website importieren";
$a->strings["Facebook conversations consist of your <em>profile wall</em> and your friend <em>stream</em>."] = "Facebook-Konversationen bestehen aus deinen Beiträgen auf deiner<em>Pinnwand</em>, sowie den Beiträgen deiner Freunde <em>Stream</em>.";
$a->strings["On this website, your Facebook friend stream is only visible to you."] = "Hier auf dieser Webseite kannst nur du die Beiträge Deiner Facebook-Freunde (Stream) sehen.";
$a->strings["The following settings determine the privacy of your Facebook profile wall on this website."] = "Mit den folgenden Einstellungen kannst du die Privatsphäre der Kopie Deiner Facebook-Pinnwand hier auf dieser Seite einstellen.";
$a->strings["On this website your Facebook profile wall conversations will only be visible to you"] = "Meine Facebook-Pinnwand hier auf dieser Webseite nur für mich sichtbar machen";
$a->strings["Do not import your Facebook profile wall conversations"] = "Facebook-Pinnwand nicht importieren";
$a->strings["If you choose to link conversations and leave both of these boxes unchecked, your Facebook profile wall will be merged with your profile wall on this website and your privacy settings on this website will be used to determine who may see the conversations."] = "Wenn du Facebook-Konversationen importierst und diese beiden Häkchen nicht setzt, wird deine Facebook-Pinnwand mit der Pinnwand hier auf dieser Webseite vereinigt. Die Privatsphäre-Einstellungen für deine Pinnwand auf dieser Webseite geben dann an, wer die Konversationen sehen kann.";
$a->strings["Comma separated applications to ignore"] = "Kommaseparierte Anwendungen, die ignoriert werden sollen";
$a->strings["Submit"] = "Senden";
$a->strings["Problems with Facebook Real-Time Updates"] = "Probleme mit Facebook Echtzeit-Updates";
$a->strings["Administrator"] = "Administrator";
$a->strings["Facebook"] = "Facebook";
$a->strings["Facebook Connector Settings"] = "Facebook-Verbindungseinstellungen";
$a->strings["Facebook API Key"] = "Facebook API Schlüssel";
$a->strings["Error: it appears that you have specified the App-ID and -Secret in your .htconfig.php file. As long as they are specified there, they cannot be set using this form.<br><br>"] = "Fehler: du scheinst die App-ID und das App-Geheimnis in deiner .htconfig.php Datei angegeben zu haben. Solange sie dort festgelegt werden kannst du dieses Formular hier nicht verwenden.<br><br>";
$a->strings["Error: the given API Key seems to be incorrect (the application access token could not be retrieved)."] = "Fehler: der angegebene API Schlüssel scheint nicht korrekt zu sein (Zugriffstoken konnte nicht empfangen werden).";
$a->strings["The given API Key seems to work correctly."] = "Der angegebene API Schlüssel scheint korrekt zu funktionieren.";
$a->strings["The correctness of the API Key could not be detected. Something strange's going on."] = "Die Richtigkeit des API Schlüssels konnte nicht gefunden werden. Irgendwas stimmt nicht.";
$a->strings["App-ID / API-Key"] = "App-ID / API-Key";
$a->strings["Application secret"] = "Anwendungs-Geheimnis";
$a->strings["Synchronize comments (no comments on Facebook are missed, at the cost of increased system load)"] = "Kommentare synchronisieren (Kein Kommentar von Facebook geht verloren, verursacht höhere Last auf dem Server)";
$a->strings["Save"] = "Speichern";
$a->strings["Real-Time Updates"] = "Echtzeit Aktualisierungen";
$a->strings["Real-Time Updates are activated."] = "Echtzeit-Updates sind aktiviert.";
$a->strings["Deactivate Real-Time Updates"] = "Echtzeit-Updates deaktivieren";
$a->strings["Real-Time Updates not activated."] = "Echtzeit-Updates nicht aktiviert.";
$a->strings["Activate Real-Time Updates"] = "Echtzeit-Updates aktivieren";
$a->strings["The new values have been saved."] = "Die neuen Einstellungen wurden gespeichert.";
$a->strings["Post to Facebook"] = "Bei Facebook veröffentlichen";
$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "Beitrag wurde nicht bei Facebook veröffentlicht, da Konflikte bei den Multi-Netzwerk-Zugriffsrechten vorliegen.";
$a->strings["View on Friendica"] = "In Friendica betrachten";
$a->strings["Facebook post failed. Queued for retry."] = "Veröffentlichung bei Facebook gescheitert. Wir versuchen es später erneut.";
$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "Deine Facebook Anmeldedaten sind ungültig geworden. Bitte re-authentifiziere dich.";
$a->strings["Facebook connection became invalid"] = "Facebook Anmeldedaten sind ungültig geworden";
$a->strings["status"] = "Status";

View file

@ -0,0 +1,49 @@
<?php
$a->strings["Settings updated."] = "Agordoj ĝisdatigita.";
$a->strings["Permission denied."] = "Malpermesita.";
$a->strings["Facebook disabled"] = "Facebook malŝaltita";
$a->strings["Updating contacts"] = "Mi ĝisdatigas la kontaktojn.";
$a->strings["Facebook API key is missing."] = "La API ŝlosilo de Facebook ne estas konata ĉi tie.";
$a->strings["Facebook Connect"] = "Kontekto al Facebook";
$a->strings["Install Facebook connector for this account."] = "Instali la Facebook konektilo por ĉi tiu konto.";
$a->strings["Remove Facebook connector"] = "Forigi la Facebook konektilon.";
$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "Reaŭtentiĝi [Tio estas bezonata ĉiam kiam vi ŝanĝis vian pasvorton ĉe Facebook.]";
$a->strings["Post to Facebook by default"] = "Ĉiam afiŝi al Facebook.";
$a->strings["Facebook friend linking has been disabled on this site. The following settings will have no effect."] = "Ligado kun Facebook amikoj estas malaktivita ĉe tiu retejo. La sekvantaj agordoj do ne havas validecon.";
$a->strings["Facebook friend linking has been disabled on this site. If you disable it, you will be unable to re-enable it."] = "Ligado kun Facebook amikoj estas malaktivita ĉe tiu retejo. Se vi malŝaltas ĝin, vi ne eblos ree ŝalti ĝin.";
$a->strings["Link all your Facebook friends and conversations on this website"] = "Alligu ĉiujn viajn Facebook amikojn kaj konversaciojn je ĉi-tiu retejo.";
$a->strings["Facebook conversations consist of your <em>profile wall</em> and your friend <em>stream</em>."] = "Facebok konversacioj konsistas el via <em>profilmuro</em> kaj la <em>fluo</em> de viaj amikoj.";
$a->strings["On this website, your Facebook friend stream is only visible to you."] = "Je ĉi-tiu retejo, la fluo de viaj amikoj ĉe Facebook nur videblas al vi.";
$a->strings["The following settings determine the privacy of your Facebook profile wall on this website."] = "La sekvontaj agordoj difinas la privatecon de via Facebook profilmuro je ĉi-tiu retejo.";
$a->strings["On this website your Facebook profile wall conversations will only be visible to you"] = "Je ĉi-tiu retejo, la conversacioj sur via Facebook profilmuro nur videblas al vi.";
$a->strings["Do not import your Facebook profile wall conversations"] = "Ne importi konversaciojn de via Facebook profilmuro";
$a->strings["If you choose to link conversations and leave both of these boxes unchecked, your Facebook profile wall will be merged with your profile wall on this website and your privacy settings on this website will be used to determine who may see the conversations."] = "Se vi elektas alligi conversaciojn kaj ne elektas tiujn butonojn, via Facebook profilmuro estas kunigota kun via profilmuro ĉi tie. Viaj privatecaj agordoj ĉi tie difinos kiu povas vidi la coversaciojn.";
$a->strings["Comma separated applications to ignore"] = "Ignorotaj programoj, disigita per komo";
$a->strings["Submit"] = "Sendi";
$a->strings["Problems with Facebook Real-Time Updates"] = "Problemoj kun Facebook Realtempaj Ĝisdatigoj";
$a->strings["Administrator"] = "Administranto";
$a->strings["Facebook"] = "Facebook";
$a->strings["Facebook Connector Settings"] = "Agordoj por la Facebook konektilo";
$a->strings["Facebook API Key"] = "Facebook API ŝlosilo";
$a->strings["Error: it appears that you have specified the App-ID and -Secret in your .htconfig.php file. As long as they are specified there, they cannot be set using this form.<br><br>"] = "Eraro: Ŝajnas kvazaŭ vi agordis la App-ID kaj la sekreton en via .htconfig.php dosiero. Kiam ili estas agordita tie, vi ne povas agordi ĝin en tiu ĉi formo.<br><br>";
$a->strings["Error: the given API Key seems to be incorrect (the application access token could not be retrieved)."] = "Eraro: La API ŝlosilo aspektas malĝusta (ne eblas ricevi la programa atingoĵetono).";
$a->strings["The given API Key seems to work correctly."] = "La API ŝlosilo ŝajne ĝuste funkcias.";
$a->strings["The correctness of the API Key could not be detected. Something strange's going on."] = "Ne povis kontroli la ĝusteco de la API ŝlosilo. Stranga afero okazas.";
$a->strings["App-ID / API-Key"] = "Programo ID / API Ŝlosilo";
$a->strings["Application secret"] = "Programo sekreto";
$a->strings["Synchronize comments (no comments on Facebook are missed, at the cost of increased system load)"] = "Sinkronigi komentojn (vi ricevas ĉiujn komentojn de Facebook, sed la ŝargo de la sistemo iom kreskas)";
$a->strings["Save"] = "Konservi";
$a->strings["Real-Time Updates"] = "Realtempaj Ĝisdatigoj";
$a->strings["Real-Time Updates are activated."] = "Realtempaj Ĝisdatigoj estas ŝaltita";
$a->strings["Deactivate Real-Time Updates"] = "Malŝalti Realtempaj Ĝisdatigoj";
$a->strings["Real-Time Updates not activated."] = "Realtempaj Ĝisdatigoj estas malŝaltita";
$a->strings["Activate Real-Time Updates"] = "Ŝalti Realtempaj Ĝisdatigoj";
$a->strings["The new values have been saved."] = "Konservis novajn valorojn.";
$a->strings["Post to Facebook"] = "Afiŝi al Facebook";
$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "Afiŝado al Facebook nuligita ĉar okazis konflikto en la multretpermesoj.";
$a->strings["View on Friendica"] = "Vidi ĉe Friendica";
$a->strings["Facebook post failed. Queued for retry."] = "Malsukcesis afiŝi ĉe Facebook. Enigita en vico.";
$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "Via Facbook konekto iĝis nevalida. Bonvolu reaŭtentiĝi.";
$a->strings["Facebook connection became invalid"] = "Facebook konekto iĝis nevalida.";
$a->strings["status"] = "staton";

View file

@ -0,0 +1,49 @@
<?php
$a->strings["Settings updated."] = "Configuración actualizada.";
$a->strings["Permission denied."] = "Permiso denegado.";
$a->strings["Facebook disabled"] = "Facebook deshabilitado";
$a->strings["Updating contacts"] = "Actualizando contactos";
$a->strings["Facebook API key is missing."] = "Falta la clave API de Facebook.";
$a->strings["Facebook Connect"] = "Conexión con Facebook";
$a->strings["Install Facebook connector for this account."] = "Instalar el conector de Facebook para esta cuenta.";
$a->strings["Remove Facebook connector"] = "Eliminar el conector de Facebook";
$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "Volver a identificarse [Esto es necesario cada vez que tu contraseña de Facebook cambie.]";
$a->strings["Post to Facebook by default"] = "Publicar en Facebook de forma predeterminada";
$a->strings["Facebook friend linking has been disabled on this site. The following settings will have no effect."] = "El enlace con los contactos de Facebook ha sido desactivado en este servidor. La configuración no tendrá efecto alguno.";
$a->strings["Facebook friend linking has been disabled on this site. If you disable it, you will be unable to re-enable it."] = "El enlace con los contactos de Facebook ha sido desactivado en este servidor. Si se desactiva no podrá volver a reactivarse.";
$a->strings["Link all your Facebook friends and conversations on this website"] = "Vincula a todos tus amigos de Facebook y las conversaciones con este sitio";
$a->strings["Facebook conversations consist of your <em>profile wall</em> and your friend <em>stream</em>."] = "Las conversaciones de Facebook consisten en tu <em>muro</em>, tu <em>perfil</em> y las <em>publicaciones</em> de tus amigos.";
$a->strings["On this website, your Facebook friend stream is only visible to you."] = "En esta página las publicaciones de tus amigos de Facebook solo son visibles para ti.";
$a->strings["The following settings determine the privacy of your Facebook profile wall on this website."] = "La siguiente configuración determina la privacidad del muro de tu perfil de Facebook en este sitio.";
$a->strings["On this website your Facebook profile wall conversations will only be visible to you"] = "En este sitio las publicaciones del muro de Facebook solo son visibles para ti";
$a->strings["Do not import your Facebook profile wall conversations"] = "No importar las conversaciones de tu muro de Facebook";
$a->strings["If you choose to link conversations and leave both of these boxes unchecked, your Facebook profile wall will be merged with your profile wall on this website and your privacy settings on this website will be used to determine who may see the conversations."] = "Si decides conectar las conversaciones y dejar ambas casillas sin marcar, el muro de tu perfil de Facebook se fusionará con el muro de tu perfil en este sitio y la configuración de privacidad en este sitio será utilizada para determinar quién puede ver las conversaciones.";
$a->strings["Comma separated applications to ignore"] = "Aplicaciones a ignorar separadas por comas";
$a->strings["Submit"] = "Envíar";
$a->strings["Problems with Facebook Real-Time Updates"] = "Hay problemas con las actualizaciones en tiempo real de Facebook";
$a->strings["Administrator"] = "Administrador";
$a->strings["Facebook"] = "Facebook";
$a->strings["Facebook Connector Settings"] = "Configuración de conexión a Facebook";
$a->strings["Facebook API Key"] = "Llave API de Facebook";
$a->strings["Error: it appears that you have specified the App-ID and -Secret in your .htconfig.php file. As long as they are specified there, they cannot be set using this form.<br><br>"] = "Error: parece que la App-ID y el -Secret ya están configurados en tu archivo .htconfig.php. Al estar configurados allí, no se usará este formulario.<br><br>";
$a->strings["Error: the given API Key seems to be incorrect (the application access token could not be retrieved)."] = "Error: la llave API proporcionada parece incorrecta (no se pudo recuperar la ficha de acceso a la aplicación).";
$a->strings["The given API Key seems to work correctly."] = "La Llave API proporcionada parece funcionar correctamente.";
$a->strings["The correctness of the API Key could not be detected. Something strange's going on."] = "No se ha podido detectar una llave API correcta. Algo raro está pasando.";
$a->strings["App-ID / API-Key"] = "Añadir ID / Llave API";
$a->strings["Application secret"] = "Secreto de la aplicación";
$a->strings["Synchronize comments (no comments on Facebook are missed, at the cost of increased system load)"] = "Sincronizar comentarios (no se perderán comentarios de Facebook, pero se incrementará la carga del sistema)";
$a->strings["Save"] = "Guardar";
$a->strings["Real-Time Updates"] = "Actualizaciones en tiempo real";
$a->strings["Real-Time Updates are activated."] = "Actualizaciones en tiempo real activada.";
$a->strings["Deactivate Real-Time Updates"] = "Desactivar actualizaciones en tiempo real";
$a->strings["Real-Time Updates not activated."] = "Actualizaciones en tiempo real desactivada.";
$a->strings["Activate Real-Time Updates"] = "Activar actualizaciones en tiempo real";
$a->strings["The new values have been saved."] = "Los nuevos valores se han guardado.";
$a->strings["Post to Facebook"] = "Publicar en Facebook";
$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "Publicación en Facebook cancelada debido a un conflicto con los permisos de acceso a la multi-red.";
$a->strings["View on Friendica"] = "Ver en Friendica";
$a->strings["Facebook post failed. Queued for retry."] = "Publicación en Facebook errónea. Reintentando...";
$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "Tu conexión con Facebook ha sido invalidada. Por favor vuelve a identificarte.";
$a->strings["Facebook connection became invalid"] = "La conexión con Facebook ha sido invalidada";
$a->strings["status"] = "estado";

View file

@ -0,0 +1,49 @@
<?php
$a->strings["Settings updated."] = "Réglages mis à jour.";
$a->strings["Permission denied."] = "Permission refusée.";
$a->strings["Facebook disabled"] = "Connecteur Facebook désactivé";
$a->strings["Updating contacts"] = "Mise-à-jour des contacts";
$a->strings["Facebook API key is missing."] = "Clé d'API Facebook manquante.";
$a->strings["Facebook Connect"] = "Connecteur Facebook";
$a->strings["Install Facebook connector for this account."] = "Installer le connecteur Facebook sur ce compte.";
$a->strings["Remove Facebook connector"] = "Désinstaller le connecteur Facebook";
$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "Se ré-authentifier [nécessaire chaque fois que vous changez votre mot de passe Facebook.]";
$a->strings["Post to Facebook by default"] = "Poster sur Facebook par défaut";
$a->strings["Facebook friend linking has been disabled on this site. The following settings will have no effect."] = "L'ajout d'amis Facebook a été désactivé sur ce site. Les réglages suivants seront sans effet.";
$a->strings["Facebook friend linking has been disabled on this site. If you disable it, you will be unable to re-enable it."] = "L'ajout d'amis Facebook a été désactivé sur ce site. Si vous désactivez ce réglage, vous ne pourrez le ré-activer.";
$a->strings["Link all your Facebook friends and conversations on this website"] = "Lier tous vos amis et conversations Facebook sur ce site";
$a->strings["Facebook conversations consist of your <em>profile wall</em> and your friend <em>stream</em>."] = "Les conversations Facebook se composent du <em>mur du profil</em> et des <em>flux</em> de vos amis.";
$a->strings["On this website, your Facebook friend stream is only visible to you."] = "Sur ce site, les flux de vos amis Facebook ne sont visibles que par vous.";
$a->strings["The following settings determine the privacy of your Facebook profile wall on this website."] = "Les réglages suivants déterminent le niveau de vie privée de votre mur Facebook depuis ce site.";
$a->strings["On this website your Facebook profile wall conversations will only be visible to you"] = "Sur ce site, les conversations de votre mur Facebook ne sont visibles que par vous.";
$a->strings["Do not import your Facebook profile wall conversations"] = "Ne pas importer les conversations de votre mur Facebook.";
$a->strings["If you choose to link conversations and leave both of these boxes unchecked, your Facebook profile wall will be merged with your profile wall on this website and your privacy settings on this website will be used to determine who may see the conversations."] = "Si vous choisissez de lier les conversations et de laisser ces deux cases non-cochées, votre mur Facebook sera fusionné avec votre mur de profil (sur ce site). Vos réglages (locaux) de vie privée serviront à en déterminer la visibilité.";
$a->strings["Comma separated applications to ignore"] = "Liste (séparée par des virgules) des applications à ignorer";
$a->strings["Submit"] = "Envoyer";
$a->strings["Problems with Facebook Real-Time Updates"] = "Problème avec les mises-à-jour en temps réel de Facebook";
$a->strings["Administrator"] = "Administrateur";
$a->strings["Facebook"] = "Facebook";
$a->strings["Facebook Connector Settings"] = "Réglages du connecteur Facebook";
$a->strings["Facebook API Key"] = "Clé d'API Facebook";
$a->strings["Error: it appears that you have specified the App-ID and -Secret in your .htconfig.php file. As long as they are specified there, they cannot be set using this form.<br><br>"] = "Erreur: il semble que vous ayez spécifié un App-ID et un Secret dans votre fichier .htconfig.php. Tant qu'ils y seront, vous ne pourrez les configurer avec ce formulaire.<br /><br />";
$a->strings["Error: the given API Key seems to be incorrect (the application access token could not be retrieved)."] = "Erreur: la clé d'API semble incorrecte (le jeton d'accès d'application n'a pu être recupéré)";
$a->strings["The given API Key seems to work correctly."] = "La clé d'API semble fonctionner correctement.";
$a->strings["The correctness of the API Key could not be detected. Something strange's going on."] = "La validité de la clé d'API ne peut être vérifiée. Quelque-chose d'étrange se passe.";
$a->strings["App-ID / API-Key"] = "App-ID / Clé d'API";
$a->strings["Application secret"] = "Secret de l'application";
$a->strings["Synchronize comments (no comments on Facebook are missed, at the cost of increased system load)"] = "Synchroniser les commentaires (aucun commentaire de Facebook ne devrait être oublié, au prix d'une charge système accrue)";
$a->strings["Save"] = "Sauver";
$a->strings["Real-Time Updates"] = "Mises-à-jour en temps réel";
$a->strings["Real-Time Updates are activated."] = "Mises-à-jour en temps réel activées.";
$a->strings["Deactivate Real-Time Updates"] = "Désactiver les mises-à-jour en temps réel";
$a->strings["Real-Time Updates not activated."] = "Mises-à-jour en temps réel désactivées.";
$a->strings["Activate Real-Time Updates"] = "Activer les mises-à-jour en temps réel";
$a->strings["The new values have been saved."] = "Les nouvelles valeurs ont été sauvées.";
$a->strings["Post to Facebook"] = "Poster sur Facebook";
$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "Publication sur Facebook annulée pour cause de conflit de permissions inter-réseaux.";
$a->strings["View on Friendica"] = "Voir sur Friendica";
$a->strings["Facebook post failed. Queued for retry."] = "Publication sur Facebook échouée. En attente pour re-tentative.";
$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "Votre connexion à Facebook est devenue invalide. Merci de vous ré-authentifier.";
$a->strings["Facebook connection became invalid"] = "La connexion Facebook est devenue invalide";
$a->strings["status"] = "le statut";

View file

@ -0,0 +1,49 @@
<?php
$a->strings["Settings updated."] = "Stillingar uppfærðar";
$a->strings["Permission denied."] = "Heimild ekki veitt.";
$a->strings["Facebook disabled"] = "Ekki er kveikt á Facebook ";
$a->strings["Updating contacts"] = "Uppfæra tengiliði";
$a->strings["Facebook API key is missing."] = "Facebook API lykill er ekki til staðar.";
$a->strings["Facebook Connect"] = "Facebook tenging";
$a->strings["Install Facebook connector for this account."] = "Setja þarf upp Facebook tengil fyrir þennan notanda";
$a->strings["Remove Facebook connector"] = "Fjarlæga Facebook tengil";
$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "Þörf er á endurauðkenningu [Þetta þarf að gera í hvert skipti sem Facebook aðgangsorði er breytt.]";
$a->strings["Post to Facebook by default"] = "Senda sjálfgefið færslur á Facebook ";
$a->strings["Facebook friend linking has been disabled on this site. The following settings will have no effect."] = "";
$a->strings["Facebook friend linking has been disabled on this site. If you disable it, you will be unable to re-enable it."] = "";
$a->strings["Link all your Facebook friends and conversations on this website"] = "Tengjast öllum vinum og samtölum á Facebook af þessum vef";
$a->strings["Facebook conversations consist of your <em>profile wall</em> and your friend <em>stream</em>."] = "Facebook samtöl saman standa af færslum af <em>forsíðuvegg</em> og <em>vinastraum</em> þínum.";
$a->strings["On this website, your Facebook friend stream is only visible to you."] = "Aðeins Facebook vinastraumurinn þinn er sjáanlegur á þessum þessum vef.";
$a->strings["The following settings determine the privacy of your Facebook profile wall on this website."] = "Eftirfarandi stillingar stjórna friðhelgi Facebook forsíðu vegg á þessum vef. ";
$a->strings["On this website your Facebook profile wall conversations will only be visible to you"] = "Samtöl á Facebook forsíðu vegg verða einungis sýnileg þér";
$a->strings["Do not import your Facebook profile wall conversations"] = "Ekki sækja samtöl af Facebook forsíðu vegg";
$a->strings["If you choose to link conversations and leave both of these boxes unchecked, your Facebook profile wall will be merged with your profile wall on this website and your privacy settings on this website will be used to determine who may see the conversations."] = "Ef þú ákveður að hlekkja samtöl saman og hefur bæði þessi hök slökkt, þá mun Facebook forsíðan sameinast forsíðunni á þessum vef þannig að friðhelgisstillingar hér munu stjórna hvernig mega sjá hvað.";
$a->strings["Comma separated applications to ignore"] = "Forrit sem á að hunsa (komma á milli)";
$a->strings["Submit"] = "Senda inn";
$a->strings["Problems with Facebook Real-Time Updates"] = "";
$a->strings["Administrator"] = "Kerfisstjóri";
$a->strings["Facebook"] = "Facebook";
$a->strings["Facebook Connector Settings"] = "Facebook tengils stillingar";
$a->strings["Facebook API Key"] = "";
$a->strings["Error: it appears that you have specified the App-ID and -Secret in your .htconfig.php file. As long as they are specified there, they cannot be set using this form.<br><br>"] = "";
$a->strings["Error: the given API Key seems to be incorrect (the application access token could not be retrieved)."] = "";
$a->strings["The given API Key seems to work correctly."] = "";
$a->strings["The correctness of the API Key could not be detected. Something strange's going on."] = "";
$a->strings["App-ID / API-Key"] = "";
$a->strings["Application secret"] = "";
$a->strings["Synchronize comments (no comments on Facebook are missed, at the cost of increased system load)"] = "";
$a->strings["Save"] = "Vista";
$a->strings["Real-Time Updates"] = "";
$a->strings["Real-Time Updates are activated."] = "";
$a->strings["Deactivate Real-Time Updates"] = "";
$a->strings["Real-Time Updates not activated."] = "";
$a->strings["Activate Real-Time Updates"] = "";
$a->strings["The new values have been saved."] = "";
$a->strings["Post to Facebook"] = "Senda á Facebook";
$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "Hætt við færslu á Facebook vegna marg nets aðgangs átaka.";
$a->strings["View on Friendica"] = "Skoða á Friendica";
$a->strings["Facebook post failed. Queued for retry."] = "Færsla sem átti að flæða yfir á Facebook mistókst. Sett í biðröð til endurtekningar.";
$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "";
$a->strings["Facebook connection became invalid"] = "";
$a->strings["status"] = "staða";

View file

@ -0,0 +1,49 @@
<?php
$a->strings["Settings updated."] = "Impostazioni aggiornate.";
$a->strings["Permission denied."] = "Permesso negato.";
$a->strings["Facebook disabled"] = "Facebook disabilitato";
$a->strings["Updating contacts"] = "Aggiornamento contatti";
$a->strings["Facebook API key is missing."] = "Chiave API Facebook mancante.";
$a->strings["Facebook Connect"] = "Facebook Connect";
$a->strings["Install Facebook connector for this account."] = "Installa Facebook connector per questo account";
$a->strings["Remove Facebook connector"] = "Rimuovi Facebook connector";
$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "Ri-autentica [Questo è necessario ogni volta che cambia la password di Facebook.]";
$a->strings["Post to Facebook by default"] = "Invia sempre a Facebook";
$a->strings["Facebook friend linking has been disabled on this site. The following settings will have no effect."] = "";
$a->strings["Facebook friend linking has been disabled on this site. If you disable it, you will be unable to re-enable it."] = "";
$a->strings["Link all your Facebook friends and conversations on this website"] = "Collega tutti i tuoi amici di Facebook e le conversazioni su questo sito";
$a->strings["Facebook conversations consist of your <em>profile wall</em> and your friend <em>stream</em>."] = "Le conversazione su Facebook sono composte dai i tuoi messsaggi in bacheca e dai messaggi dei tuoi amici";
$a->strings["On this website, your Facebook friend stream is only visible to you."] = "Su questo sito, i messaggi dai vostri amici su Facebook è visibile solo a te.";
$a->strings["The following settings determine the privacy of your Facebook profile wall on this website."] = "Le seguenti impostazioni determinano la privacy della vostra bacheca di Facebook su questo sito.";
$a->strings["On this website your Facebook profile wall conversations will only be visible to you"] = "Su questo sito, le conversazioni sulla tua bacheca di Facebook saranno visibili solo a te";
$a->strings["Do not import your Facebook profile wall conversations"] = "Non importare le conversazione sulla tua bacheca di Facebook";
$a->strings["If you choose to link conversations and leave both of these boxes unchecked, your Facebook profile wall will be merged with your profile wall on this website and your privacy settings on this website will be used to determine who may see the conversations."] = "Se scegli di collegare le conversazioni e lasci entrambi questi box non segnati, la tua bacheca di Facebook sarà fusa con la tua bacheca su questao sito, e le impostazioni di privacy su questo sito saranno usate per decidere chi potrà vedere le conversazioni.";
$a->strings["Comma separated applications to ignore"] = "Elenco separato da virgola di applicazioni da ignorare";
$a->strings["Submit"] = "Invia";
$a->strings["Problems with Facebook Real-Time Updates"] = "Problemi con gli aggiornamenti in tempo reale con Facebook";
$a->strings["Administrator"] = "Amministratore";
$a->strings["Facebook"] = "Facebook";
$a->strings["Facebook Connector Settings"] = "Impostazioni del connettore Facebook";
$a->strings["Facebook API Key"] = "Facebook API Key";
$a->strings["Error: it appears that you have specified the App-ID and -Secret in your .htconfig.php file. As long as they are specified there, they cannot be set using this form.<br><br>"] = "Error: it appears that you have specified the App-ID and -Secret in your .htconfig.php file. As long as they are specified there, they cannot be set using this form.<br><br>";
$a->strings["Error: the given API Key seems to be incorrect (the application access token could not be retrieved)."] = "Error: the given API Key seems to be incorrect (the application access token could not be retrieved).";
$a->strings["The given API Key seems to work correctly."] = "L' API Key fornita sembra funzionare correttamente.";
$a->strings["The correctness of the API Key could not be detected. Something strange's going on."] = "L' API Key non puo' essere verificata. Sta succedendo qualcosa di strano.";
$a->strings["App-ID / API-Key"] = "App-ID / API-Key";
$a->strings["Application secret"] = "Application secret";
$a->strings["Synchronize comments (no comments on Facebook are missed, at the cost of increased system load)"] = "Sincronizza i commenti (non vengono persi commenti su Facebook, al prezzo di un maggior carico di sistema)";
$a->strings["Save"] = "Salva";
$a->strings["Real-Time Updates"] = "Aggiornamenti Real-Time";
$a->strings["Real-Time Updates are activated."] = "Gli aggiornamenti in tempo reale sono attivi";
$a->strings["Deactivate Real-Time Updates"] = "Disattiva gli aggiornamenti in tempo reale";
$a->strings["Real-Time Updates not activated."] = "Gli aggiornamenti in tempo reale non sono attivi";
$a->strings["Activate Real-Time Updates"] = "Attiva gli aggiornamenti in tempo reale";
$a->strings["The new values have been saved."] = "I nuovi valori sono stati salvati.";
$a->strings["Post to Facebook"] = "Invia a Facebook";
$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "Invio su Facebook annullato per un conflitto nei permessi di accesso.";
$a->strings["View on Friendica"] = "Vedi su Friendica";
$a->strings["Facebook post failed. Queued for retry."] = "Invio a Facebook fallito. In attesa di riprovare.";
$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "La tua connessione con Facebook è diventata invalida. Per favore ri-autenticati.";
$a->strings["Facebook connection became invalid"] = "La connessione Facebook è diventata invalida.";
$a->strings["status"] = "stato";

View file

@ -0,0 +1,49 @@
<?php
$a->strings["Settings updated."] = "Innstillinger oppdatert.";
$a->strings["Permission denied."] = "Ingen tilgang.";
$a->strings["Facebook disabled"] = "Facebook avskrudd";
$a->strings["Updating contacts"] = "Oppdaterer kontakter";
$a->strings["Facebook API key is missing."] = "Facebook API-nøkkel mangler.";
$a->strings["Facebook Connect"] = "Facebook-kobling";
$a->strings["Install Facebook connector for this account."] = "Legg til Facebook-kobling for denne kontoen.";
$a->strings["Remove Facebook connector"] = "Fjern Facebook-kobling";
$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "";
$a->strings["Post to Facebook by default"] = "Post til Facebook som standard";
$a->strings["Facebook friend linking has been disabled on this site. The following settings will have no effect."] = "";
$a->strings["Facebook friend linking has been disabled on this site. If you disable it, you will be unable to re-enable it."] = "";
$a->strings["Link all your Facebook friends and conversations on this website"] = "";
$a->strings["Facebook conversations consist of your <em>profile wall</em> and your friend <em>stream</em>."] = "";
$a->strings["On this website, your Facebook friend stream is only visible to you."] = "";
$a->strings["The following settings determine the privacy of your Facebook profile wall on this website."] = "";
$a->strings["On this website your Facebook profile wall conversations will only be visible to you"] = "";
$a->strings["Do not import your Facebook profile wall conversations"] = "";
$a->strings["If you choose to link conversations and leave both of these boxes unchecked, your Facebook profile wall will be merged with your profile wall on this website and your privacy settings on this website will be used to determine who may see the conversations."] = "";
$a->strings["Comma separated applications to ignore"] = "";
$a->strings["Submit"] = "Lagre";
$a->strings["Problems with Facebook Real-Time Updates"] = "";
$a->strings["Administrator"] = "Administrator";
$a->strings["Facebook"] = "Facebook";
$a->strings["Facebook Connector Settings"] = "Innstillinger for Facebook-kobling";
$a->strings["Facebook API Key"] = "";
$a->strings["Error: it appears that you have specified the App-ID and -Secret in your .htconfig.php file. As long as they are specified there, they cannot be set using this form.<br><br>"] = "";
$a->strings["Error: the given API Key seems to be incorrect (the application access token could not be retrieved)."] = "";
$a->strings["The given API Key seems to work correctly."] = "";
$a->strings["The correctness of the API Key could not be detected. Something strange's going on."] = "";
$a->strings["App-ID / API-Key"] = "";
$a->strings["Application secret"] = "";
$a->strings["Synchronize comments (no comments on Facebook are missed, at the cost of increased system load)"] = "";
$a->strings["Save"] = "Lagre";
$a->strings["Real-Time Updates"] = "";
$a->strings["Real-Time Updates are activated."] = "";
$a->strings["Deactivate Real-Time Updates"] = "";
$a->strings["Real-Time Updates not activated."] = "";
$a->strings["Activate Real-Time Updates"] = "";
$a->strings["The new values have been saved."] = "";
$a->strings["Post to Facebook"] = "Post til Facebook";
$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "Posting til Facebook avbrutt på grunn av konflikt med tilgangsrettigheter i multi-nettverk.";
$a->strings["View on Friendica"] = "";
$a->strings["Facebook post failed. Queued for retry."] = "Facebook-innlegg mislyktes. Innlegget er lagt i kø for å prøve igjen.";
$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "";
$a->strings["Facebook connection became invalid"] = "";
$a->strings["status"] = "status";

View file

@ -0,0 +1,49 @@
<?php
$a->strings["Settings updated."] = "Zaktualizowano ustawienia.";
$a->strings["Permission denied."] = "Brak uprawnień.";
$a->strings["Facebook disabled"] = "Facebook wyłączony";
$a->strings["Updating contacts"] = "Aktualizacja kontaktów";
$a->strings["Facebook API key is missing."] = "Brakuje klucza API z facebooka.";
$a->strings["Facebook Connect"] = "Połącz konto z kontem Facebook";
$a->strings["Install Facebook connector for this account."] = "Zainstaluj wtyczkę Facebook ";
$a->strings["Remove Facebook connector"] = "Usuń wtyczkę Facebook";
$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "Ponowna autoryzacja [Jest wymagana jeśli twoje hasło do Facebooka jest zmienione]";
$a->strings["Post to Facebook by default"] = "Domyślnie opublikuj na stronie Facebook";
$a->strings["Facebook friend linking has been disabled on this site. The following settings will have no effect."] = "";
$a->strings["Facebook friend linking has been disabled on this site. If you disable it, you will be unable to re-enable it."] = "";
$a->strings["Link all your Facebook friends and conversations on this website"] = "Połącz wszystkie twoje kontakty i konwersacje na tej stronie z serwisem Facebook";
$a->strings["Facebook conversations consist of your <em>profile wall</em> and your friend <em>stream</em>."] = "";
$a->strings["On this website, your Facebook friend stream is only visible to you."] = "";
$a->strings["The following settings determine the privacy of your Facebook profile wall on this website."] = "";
$a->strings["On this website your Facebook profile wall conversations will only be visible to you"] = "";
$a->strings["Do not import your Facebook profile wall conversations"] = "";
$a->strings["If you choose to link conversations and leave both of these boxes unchecked, your Facebook profile wall will be merged with your profile wall on this website and your privacy settings on this website will be used to determine who may see the conversations."] = "";
$a->strings["Comma separated applications to ignore"] = "";
$a->strings["Submit"] = "Potwierdź";
$a->strings["Problems with Facebook Real-Time Updates"] = "Problemy z aktualizacjami w czasie rzeczywistym Facebook'a";
$a->strings["Administrator"] = "Administrator";
$a->strings["Facebook"] = "Facebook";
$a->strings["Facebook Connector Settings"] = "Ustawienia połączenia z Facebook";
$a->strings["Facebook API Key"] = "Facebook API Key";
$a->strings["Error: it appears that you have specified the App-ID and -Secret in your .htconfig.php file. As long as they are specified there, they cannot be set using this form.<br><br>"] = "";
$a->strings["Error: the given API Key seems to be incorrect (the application access token could not be retrieved)."] = "";
$a->strings["The given API Key seems to work correctly."] = "";
$a->strings["The correctness of the API Key could not be detected. Something strange's going on."] = "";
$a->strings["App-ID / API-Key"] = "App-ID / API-Key";
$a->strings["Application secret"] = "";
$a->strings["Synchronize comments (no comments on Facebook are missed, at the cost of increased system load)"] = "";
$a->strings["Save"] = "Zapisz";
$a->strings["Real-Time Updates"] = "Aktualizacje w czasie rzeczywistym";
$a->strings["Real-Time Updates are activated."] = "Aktualizacje w czasie rzeczywistym zostały aktywowane.";
$a->strings["Deactivate Real-Time Updates"] = "Zdezaktywuj aktualizacje w czasie rzeczywistym";
$a->strings["Real-Time Updates not activated."] = "Aktualizacje w czasie rzeczywistym nie zostały aktywowane.";
$a->strings["Activate Real-Time Updates"] = "Aktywuj aktualizacje w czasie rzeczywistym";
$a->strings["The new values have been saved."] = "";
$a->strings["Post to Facebook"] = "Post na Facebook";
$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "Publikacja na stronie Facebook nie powiodła się z powodu braku dostępu do sieci";
$a->strings["View on Friendica"] = "Zobacz na Friendice";
$a->strings["Facebook post failed. Queued for retry."] = "";
$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "";
$a->strings["Facebook connection became invalid"] = "Błędne połączenie z Facebookiem";
$a->strings["status"] = "status";

View file

@ -0,0 +1,49 @@
<?php
$a->strings["Settings updated."] = "As configurações foram atualizadas.";
$a->strings["Permission denied."] = "Permissão negada.";
$a->strings["Facebook disabled"] = "O Facebook está desabilitado";
$a->strings["Updating contacts"] = "Atualizando os contatos";
$a->strings["Facebook API key is missing."] = "A chave de API do Facebook não foi encontrada.";
$a->strings["Facebook Connect"] = "Conexão com o Facebook";
$a->strings["Install Facebook connector for this account."] = "Instalar o conector do Facebook nesta conta.";
$a->strings["Remove Facebook connector"] = "Remover o conector do Facebook";
$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "Reautenticar [Isso é necessário sempre que sua senha do Facebook é modificada.]";
$a->strings["Post to Facebook by default"] = "Publicar no Facebook por padrão";
$a->strings["Facebook friend linking has been disabled on this site. The following settings will have no effect."] = "";
$a->strings["Facebook friend linking has been disabled on this site. If you disable it, you will be unable to re-enable it."] = "";
$a->strings["Link all your Facebook friends and conversations on this website"] = "Ligar todos os seus amigos e conversas do Facebook neste site";
$a->strings["Facebook conversations consist of your <em>profile wall</em> and your friend <em>stream</em>."] = "As conversas do Facebook consistem do seu <em>perfil/mural</em> e da <em>linha do tempo</em> dos seus amigos.";
$a->strings["On this website, your Facebook friend stream is only visible to you."] = "Neste site, a linha do tempo dos seus amigos do Facebook está visível somente para você.";
$a->strings["The following settings determine the privacy of your Facebook profile wall on this website."] = "As seguintes configurações determinam a privacidade do mural do seu perfil do Facebook neste site.";
$a->strings["On this website your Facebook profile wall conversations will only be visible to you"] = "Nesse site as conversas do mural do seu perfil do Facebook estão visíveis somente para você";
$a->strings["Do not import your Facebook profile wall conversations"] = "Não importar as conversas do seu perfil/mural do Facebook";
$a->strings["If you choose to link conversations and leave both of these boxes unchecked, your Facebook profile wall will be merged with your profile wall on this website and your privacy settings on this website will be used to determine who may see the conversations."] = "Se você escolher ligar as conversas e deixar ambas opções desmarcadas, seu perfil/mural do Facebook será mesclado com seu perfil/mural nesse website e suas configurações de privacidade nesse website serão usadas para determinar quem pode ver as conversas.";
$a->strings["Comma separated applications to ignore"] = "Ignorar aplicações separadas por vírgula";
$a->strings["Submit"] = "Enviar";
$a->strings["Problems with Facebook Real-Time Updates"] = "Problemas com as atualizações em tempo real do Facebook";
$a->strings["Administrator"] = "Administrador";
$a->strings["Facebook"] = "Facebook";
$a->strings["Facebook Connector Settings"] = "Configurações do conector do Facebook";
$a->strings["Facebook API Key"] = "Chave da API do Facebook";
$a->strings["Error: it appears that you have specified the App-ID and -Secret in your .htconfig.php file. As long as they are specified there, they cannot be set using this form.<br><br>"] = "Erro: parece que você especificou o App-ID e o -Secret no arquivo .htconfig.php. Uma vez estão especificado lá, eles não podem ser definidos neste formulário.<br><br>";
$a->strings["Error: the given API Key seems to be incorrect (the application access token could not be retrieved)."] = "Erro: a chave de API fornecida parece estar incorreta (não foi possível recuperar o token de acesso à aplicação).";
$a->strings["The given API Key seems to work correctly."] = "A chave de API fornecida aparentemente está funcionando corretamente.";
$a->strings["The correctness of the API Key could not be detected. Something strange's going on."] = "";
$a->strings["App-ID / API-Key"] = "App-ID / API-Key";
$a->strings["Application secret"] = "Segredo da aplicação";
$a->strings["Synchronize comments (no comments on Facebook are missed, at the cost of increased system load)"] = "";
$a->strings["Save"] = "Salvar";
$a->strings["Real-Time Updates"] = "Atualizações em tempo real";
$a->strings["Real-Time Updates are activated."] = "As atualizações em tempo real estão ativadas.";
$a->strings["Deactivate Real-Time Updates"] = "Desativar as atualizações em tempo real.";
$a->strings["Real-Time Updates not activated."] = "As atualizações em tempo real não estão ativadas.";
$a->strings["Activate Real-Time Updates"] = "Ativar atualizações em tempo real";
$a->strings["The new values have been saved."] = "Os novos valores foram salvos.";
$a->strings["Post to Facebook"] = "Publicar no Facebook";
$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "A publicação no Facebook foi cancelada devido a um conflito de permissão de acesso multi-rede.";
$a->strings["View on Friendica"] = "Ver no Friendica";
$a->strings["Facebook post failed. Queued for retry."] = "Não foi possível publicar no Facebook. Armazenado na fila para nova tentativa.";
$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "A sua conexão com o Facebook tornou-se invalida. Por favor autentique-se novamente.";
$a->strings["Facebook connection became invalid"] = "A conexão com o Facebook tornou-se inválida";
$a->strings["status"] = "status";

View file

@ -0,0 +1,49 @@
<?php
$a->strings["Settings updated."] = "Настройки обновлены.";
$a->strings["Permission denied."] = "Нет разрешения.";
$a->strings["Facebook disabled"] = "Facebook отключен";
$a->strings["Updating contacts"] = "Обновление контактов";
$a->strings["Facebook API key is missing."] = "Отсутствует ключ Facebook API.";
$a->strings["Facebook Connect"] = "Facebook подключение";
$a->strings["Install Facebook connector for this account."] = "Установить Facebook Connector для этого аккаунта.";
$a->strings["Remove Facebook connector"] = "Удалить Facebook Connector";
$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "Переаутентификация [Это необходимо, если вы изменили пароль на Facebook.]";
$a->strings["Post to Facebook by default"] = "Отправлять на Facebook по умолчанию";
$a->strings["Facebook friend linking has been disabled on this site. The following settings will have no effect."] = "";
$a->strings["Facebook friend linking has been disabled on this site. If you disable it, you will be unable to re-enable it."] = "";
$a->strings["Link all your Facebook friends and conversations on this website"] = "Прикрепите своих друзей и общение с Facebook на этот сайт";
$a->strings["Facebook conversations consist of your <em>profile wall</em> and your friend <em>stream</em>."] = "";
$a->strings["On this website, your Facebook friend stream is only visible to you."] = "Facebook-лента друзей видна только вам.";
$a->strings["The following settings determine the privacy of your Facebook profile wall on this website."] = "Следующие настройки определяют параметры приватности вашей стены с Facebook на этом сайте.";
$a->strings["On this website your Facebook profile wall conversations will only be visible to you"] = "Ваша лента профиля Facebook будет видна только вам";
$a->strings["Do not import your Facebook profile wall conversations"] = "Не импортировать Facebook разговоров с Вашей страницы";
$a->strings["If you choose to link conversations and leave both of these boxes unchecked, your Facebook profile wall will be merged with your profile wall on this website and your privacy settings on this website will be used to determine who may see the conversations."] = "";
$a->strings["Comma separated applications to ignore"] = "Игнорировать приложения (список через запятую)";
$a->strings["Submit"] = "Подтвердить";
$a->strings["Problems with Facebook Real-Time Updates"] = "";
$a->strings["Administrator"] = "Администратор";
$a->strings["Facebook"] = "Facebook";
$a->strings["Facebook Connector Settings"] = "Настройки подключения Facebook";
$a->strings["Facebook API Key"] = "Facebook API Key";
$a->strings["Error: it appears that you have specified the App-ID and -Secret in your .htconfig.php file. As long as they are specified there, they cannot be set using this form.<br><br>"] = "";
$a->strings["Error: the given API Key seems to be incorrect (the application access token could not be retrieved)."] = "";
$a->strings["The given API Key seems to work correctly."] = "";
$a->strings["The correctness of the API Key could not be detected. Something strange's going on."] = "";
$a->strings["App-ID / API-Key"] = "App-ID / API-Key";
$a->strings["Application secret"] = "Секрет приложения";
$a->strings["Synchronize comments (no comments on Facebook are missed, at the cost of increased system load)"] = "";
$a->strings["Save"] = "Сохранить";
$a->strings["Real-Time Updates"] = "";
$a->strings["Real-Time Updates are activated."] = "";
$a->strings["Deactivate Real-Time Updates"] = "Отключить Real-Time обновления";
$a->strings["Real-Time Updates not activated."] = "";
$a->strings["Activate Real-Time Updates"] = "Активировать Real-Time обновления";
$a->strings["The new values have been saved."] = "";
$a->strings["Post to Facebook"] = "Отправить на Facebook";
$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "Отправка на Facebook отменена из-за конфликта разрешений доступа разных сетей.";
$a->strings["View on Friendica"] = "";
$a->strings["Facebook post failed. Queued for retry."] = "Ошибка отправки сообщения на Facebook. В очереди на еще одну попытку.";
$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "";
$a->strings["Facebook connection became invalid"] = "Facebook подключение не удалось";
$a->strings["status"] = "статус";

View file

@ -0,0 +1,14 @@
<?php
$a->strings["Settings updated."] = "Inst&auml;llningarna har uppdaterats.";
$a->strings["Permission denied."] = "&Aring;tkomst nekad.";
$a->strings["Facebook disabled"] = "Facebook inaktiverat";
$a->strings["Facebook API key is missing."] = "Facebook API key is missing.";
$a->strings["Facebook Connect"] = "Facebook Connect";
$a->strings["Post to Facebook by default"] = "L&auml;gg alltid in inl&auml;ggen p&aring; Facebook";
$a->strings["Submit"] = "Spara";
$a->strings["Administrator"] = "Admin";
$a->strings["Facebook"] = "Facebook";
$a->strings["Facebook Connector Settings"] = "Facebook Connector Settings";
$a->strings["Post to Facebook"] = "L&auml;gg in p&aring; Facebook";
$a->strings["status"] = "status";

View file

@ -0,0 +1,49 @@
<?php
$a->strings["Settings updated."] = "设置跟新了";
$a->strings["Permission denied."] = "权限不够。";
$a->strings["Facebook disabled"] = "Facebook废";
$a->strings["Updating contacts"] = "正才更新熟人";
$a->strings["Facebook API key is missing."] = "Facebook API钥匙失踪的。";
$a->strings["Facebook Connect"] = "Facebook联络";
$a->strings["Install Facebook connector for this account."] = "安装Facebook连接器为这个账户。";
$a->strings["Remove Facebook connector"] = "删除Facebook连接器";
$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "复认证[这是必要的每当您Facebook密码变化了]";
$a->strings["Post to Facebook by default"] = "默认地放在Facebook";
$a->strings["Facebook friend linking has been disabled on this site. The following settings will have no effect."] = "这个网站使Facebook朋友环节不能用。这下的设置没有印象。";
$a->strings["Facebook friend linking has been disabled on this site. If you disable it, you will be unable to re-enable it."] = "这个网站使Facebook朋友环节不能用。假如那样的话您不会再使可用的。";
$a->strings["Link all your Facebook friends and conversations on this website"] = "连接您所有的Facebook朋友们和交流在这个网站";
$a->strings["Facebook conversations consist of your <em>profile wall</em> and your friend <em>stream</em>."] = "Facebook交流由您的<em>简介墙</em>和您朋友的<em>溪流</em>组成。 ";
$a->strings["On this website, your Facebook friend stream is only visible to you."] = "在这个网站您Facebook朋友溪流是只您可见的。";
$a->strings["The following settings determine the privacy of your Facebook profile wall on this website."] = "下面的设置决定您在这个网站Facebook简介墙的隐私。";
$a->strings["On this website your Facebook profile wall conversations will only be visible to you"] = "在这个网站您Facebook简介墙交流是只您可见的。";
$a->strings["Do not import your Facebook profile wall conversations"] = "别进口您Facebook简介墙交流";
$a->strings["If you choose to link conversations and leave both of these boxes unchecked, your Facebook profile wall will be merged with your profile wall on this website and your privacy settings on this website will be used to determine who may see the conversations."] = "如果您选择连接交流和留这两个复选框空则您Facebook简介墙被在您这网站的简介墙融合和您的这网站隐私设置决定谁能看那些交流。";
$a->strings["Comma separated applications to ignore"] = "逗号分开的应用要不理";
$a->strings["Submit"] = "提交";
$a->strings["Problems with Facebook Real-Time Updates"] = "Facebook实时更新有问题";
$a->strings["Administrator"] = "管理员";
$a->strings["Facebook"] = "Facebook";
$a->strings["Facebook Connector Settings"] = "Facebook连接器设置";
$a->strings["Facebook API Key"] = "Facebook API密码";
$a->strings["Error: it appears that you have specified the App-ID and -Secret in your .htconfig.php file. As long as they are specified there, they cannot be set using this form.<br><br>"] = "错误看上去您输入App-ID和-Secret在您的.htconfig.php文件。它们那里输入的时候您不能把他们在这个表格输入。<br><br>";
$a->strings["Error: the given API Key seems to be incorrect (the application access token could not be retrieved)."] = "错误输入的API密码显得不对取回不了应用代金券";
$a->strings["The given API Key seems to work correctly."] = "输入的API密码显得对地运行。";
$a->strings["The correctness of the API Key could not be detected. Something strange's going on."] = "API钥匙的正确性发现不了。什么奇怪的进行";
$a->strings["App-ID / API-Key"] = "App-ID / API-Key";
$a->strings["Application secret"] = "应用密码";
$a->strings["Synchronize comments (no comments on Facebook are missed, at the cost of increased system load)"] = "同步评论无Facebook评论错过了代价增添系统工作量";
$a->strings["Save"] = "保存";
$a->strings["Real-Time Updates"] = "实时更新";
$a->strings["Real-Time Updates are activated."] = "实时更新使活动";
$a->strings["Deactivate Real-Time Updates"] = "使实时更新不活动";
$a->strings["Real-Time Updates not activated."] = "实时更新使不活动";
$a->strings["Activate Real-Time Updates"] = "使实时更新活动";
$a->strings["The new values have been saved."] = "新的设置保存了。";
$a->strings["Post to Facebook"] = "放在Facebook";
$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "发送到Facebook取消由于多网络准许矛盾。";
$a->strings["View on Friendica"] = "看在Friendica";
$a->strings["Facebook post failed. Queued for retry."] = "Facebook发送失败了。排队着待再试。";
$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "您Facebook联系成无效的。请再认证。";
$a->strings["Facebook connection became invalid"] = "Facebook联系成无效的";
$a->strings["status"] = "现状";

View file

@ -0,0 +1,19 @@
<?php
/**
* Name: Facebook Restrict
* Description: Install this addon and Facebook users will not be able to link friends. Existing users that are linking friends will not be affected.
* Version: 1.0
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
* Status: Unsupported
*/
function facebook_restrict_install() {
set_config('facebook','restrict',1);
}
function facebook_restrict_uninstall() {
set_config('facebook','restrict',0);
}

View file

14
fbpost/README.md Normal file
View file

@ -0,0 +1,14 @@
> # Note
> **Facebook Connector, Facebook Post Connector and Facebook Sync plugins are deprecated.**
> As of the moment you cannot bridge from or to Facebook with Friendica.
#### Installing the Friendica/Facebook connector
Please register a Facebook application at [developers.facebook.com](https://developers.facebook.com/apps/async/create/platform-setup/dialog/)
Chose "Website" as platform. Next you have to let your application be reviewed. You need these permissions for that:
publish_actions, publish_pages, user_posts, user_photos, user_status, user_videos, manage_pages
After your application was reviewed, your users can post to Facebook.

13
fbpost/fbpost.css Normal file
View file

@ -0,0 +1,13 @@
#fbpost-enable-wrapper {
margin-top: 20px;
}
#fbpost-disable-wrapper {
margin-top: 20px;
}
#fbpost-post-default-form input {
margin-top: 20px;
margin-right: 20px;
}

1240
fbpost/fbpost.php Normal file
View file

@ -0,0 +1,1240 @@
<?php
/**
* Name: Facebook Post Connector
* Version: 1.3
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
* Author: Tobias Hößl <https://github.com/CatoTH/>
* Status: Unsupported
*
*/
/**
* Installing the Friendica/Facebook connector
*
* Detailed instructions how to use this plugin can be found at
* https://github.com/friendica/friendica/wiki/How-to:-Friendica%E2%80%99s-Facebook-connector
*
* Vidoes and embeds will not be posted if there is no other content. Links
* and images will be converted to a format suitable for the Facebook API and
* long posts truncated - with a link to view the full post.
*
* Facebook contacts will not be able to view private photos, as they are not able to
* authenticate to your site to establish identity. We will address this
* in a future release.
*/
define('FACEBOOK_DEFAULT_POLL_INTERVAL', 5); // given in minutes
require_once('include/security.php');
function fbpost_install() {
register_hook('post_local', 'addon/fbpost/fbpost.php', 'fbpost_post_local');
register_hook('notifier_normal', 'addon/fbpost/fbpost.php', 'fbpost_post_hook');
register_hook('jot_networks', 'addon/fbpost/fbpost.php', 'fbpost_jot_nets');
register_hook('connector_settings', 'addon/fbpost/fbpost.php', 'fbpost_plugin_settings');
register_hook('enotify', 'addon/fbpost/fbpost.php', 'fbpost_enotify');
register_hook('queue_predeliver', 'addon/fbpost/fbpost.php', 'fbpost_queue_hook');
register_hook('cron', 'addon/fbpost/fbpost.php', 'fbpost_cron');
register_hook('prepare_body', 'addon/fbpost/fbpost.php', 'fbpost_prepare_body');
}
function fbpost_uninstall() {
unregister_hook('post_local', 'addon/fbpost/fbpost.php', 'fbpost_post_local');
unregister_hook('notifier_normal', 'addon/fbpost/fbpost.php', 'fbpost_post_hook');
unregister_hook('jot_networks', 'addon/fbpost/fbpost.php', 'fbpost_jot_nets');
unregister_hook('connector_settings', 'addon/fbpost/fbpost.php', 'fbpost_plugin_settings');
unregister_hook('enotify', 'addon/fbpost/fbpost.php', 'fbpost_enotify');
unregister_hook('queue_predeliver', 'addon/fbpost/fbpost.php', 'fbpost_queue_hook');
unregister_hook('cron', 'addon/fbpost/fbpost.php', 'fbpost_cron');
unregister_hook('prepare_body', 'addon/fbpost/fbpost.php', 'fbpost_prepare_body');
}
/* declare the fbpost_module function so that /fbpost url requests will land here */
function fbpost_module() {}
// If a->argv[1] is a nickname, this is a callback from Facebook oauth requests.
// If $_REQUEST["realtime_cb"] is set, this is a callback from the Real-Time Updates API
/**
* @param App $a
*/
function fbpost_init(&$a) {
if($a->argc != 2)
return;
$nick = $a->argv[1];
if(strlen($nick))
$r = q("SELECT `uid` FROM `user` WHERE `nickname` = '%s' LIMIT 1",
dbesc($nick)
);
if(!(isset($r) && count($r)))
return;
$uid = $r[0]['uid'];
$auth_code = (x($_GET, 'code') ? $_GET['code'] : '');
$error = (x($_GET, 'error_description') ? $_GET['error_description'] : '');
if($error)
logger('fbpost_init: Error: ' . $error);
if($auth_code && $uid) {
$appid = get_config('facebook','appid');
$appsecret = get_config('facebook', 'appsecret');
$x = fetch_url('https://graph.facebook.com/oauth/access_token?client_id='
. $appid . '&client_secret=' . $appsecret . '&redirect_uri='
. urlencode($a->get_baseurl() . '/fbpost/' . $nick)
. '&code=' . $auth_code);
logger('fbpost_init: returned access token: ' . $x, LOGGER_DATA);
if(strpos($x,'access_token=') !== false) {
$token = str_replace('access_token=', '', $x);
if(strpos($token,'&') !== false)
$token = substr($token,0,strpos($token,'&'));
set_pconfig($uid,'facebook','access_token',$token);
set_pconfig($uid,'facebook','post','1');
fbpost_get_self($uid);
}
}
}
/**
* @param int $uid
*/
function fbpost_get_self($uid) {
$access_token = get_pconfig($uid,'facebook','access_token');
if(! $access_token)
return;
$s = fetch_url('https://graph.facebook.com/me/?access_token=' . $access_token);
if($s) {
$j = json_decode($s);
set_pconfig($uid,'facebook','self_id',(string) $j->id);
}
}
// This is the POST method to the facebook settings page
// Content is posted to Facebook in the function facebook_post_hook()
/**
* @param App $a
*/
function fbpost_post(&$a) {
$uid = local_user();
if($uid){
$value = ((x($_POST,'post_by_default')) ? intval($_POST['post_by_default']) : 0);
set_pconfig($uid,'facebook','post_by_default', $value);
$value = ((x($_POST,'mirror_posts')) ? intval($_POST['mirror_posts']) : 0);
set_pconfig($uid,'facebook','mirror_posts', $value);
if (!$value)
del_pconfig($uid,'facebook','last_created');
$value = ((x($_POST,'suppress_view_on_friendica')) ? intval($_POST['suppress_view_on_friendica']) : 0);
set_pconfig($uid,'facebook','suppress_view_on_friendica', $value);
$value = ((x($_POST,'post_to_page')) ? $_POST['post_to_page'] : "0-0");
$values = explode("-", $value);
set_pconfig($uid,'facebook','post_to_page', $values[0]);
set_pconfig($uid,'facebook','page_access_token', $values[1]);
$result = q("SELECT `installed` FROM `addon` WHERE `name` = 'fbsync' AND `installed`");
if (count($result) > 0) {
set_pconfig(local_user(),'fbsync','sync',intval($_POST['fbsync']));
set_pconfig(local_user(),'fbsync','create_user',intval($_POST['create_user']));
}
info( t('Settings updated.') . EOL);
}
return;
}
// Facebook settings form
/**
* @param App $a
* @return string
*/
function fbpost_content(&$a) {
if(! local_user()) {
notice( t('Permission denied.') . EOL);
return '';
}
if(! service_class_allows(local_user(),'facebook_connect')) {
notice( t('Permission denied.') . EOL);
return upgrade_bool_message();
}
if($a->argc > 1 && $a->argv[1] === 'remove') {
del_pconfig(local_user(),'facebook','post');
info( t('Facebook Post disabled') . EOL);
}
require_once("mod/settings.php");
settings_init($a);
$o = '';
$accounts = array();
$fb_installed = false;
if (get_pconfig(local_user(),'facebook','post')) {
$access_token = get_pconfig(local_user(),'facebook','access_token');
if ($access_token) {
// fetching the list of accounts to check, if facebook is working
// The value is needed several lines below.
$url = 'https://graph.facebook.com/me/accounts';
$s = fetch_url($url."?access_token=".$access_token, false, $redirects, 10);
if($s) {
$accounts = json_decode($s);
if (isset($accounts->data))
$fb_installed = true;
}
// I'm not totally sure, if this above will work in every situation,
// So this old code will be called as well.
if (!$fb_installed) {
$url ="https://graph.facebook.com/me/feed";
$s = fetch_url($url."?access_token=".$access_token."&limit=1", false, $redirects, 10);
if($s) {
$j = json_decode($s);
if (isset($j->data))
$fb_installed = true;
}
}
}
}
$appid = get_config('facebook','appid');
if(! $appid) {
notice( t('Facebook API key is missing.') . EOL);
return '';
}
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'
. $a->get_baseurl() . '/addon/fbpost/fbpost.css' . '" media="all" />' . "\r\n";
$result = q("SELECT `installed` FROM `addon` WHERE `name` = 'fbsync' AND `installed`");
$fbsync = (count($result) > 0);
if($fbsync)
$title = t('Facebook Import/Export/Mirror');
else
$title = t('Facebook Export/Mirror');
$o .= '<img class="connector" src="images/facebook.png" /><h3 class="connector">'.$title.'</h3>';
if(! $fb_installed) {
$o .= '<div id="fbpost-enable-wrapper">';
//read_stream,publish_stream,manage_pages,photo_upload,user_groups,offline_access
//export_stream,read_stream,publish_stream,manage_pages,photo_upload,user_groups,publish_actions,user_friends,share_item,video_upload,status_update
$o .= '<a href="https://www.facebook.com/dialog/oauth?client_id=' . $appid . '&redirect_uri='
. $a->get_baseurl() . '/fbpost/' . $a->user['nickname'] . '&scope=publish_actions,publish_pages,user_posts,user_photos,user_status,user_videos,manage_pages,user_managed_groups">' . t('Install Facebook Post connector for this account.') . '</a>';
$o .= '</div>';
}
if($fb_installed) {
$o .= '<div id="fbpost-disable-wrapper">';
$o .= '<a href="' . $a->get_baseurl() . '/fbpost/remove' . '">' . t('Remove Facebook Post connector') . '</a></div>';
$o .= '<div id="fbpost-enable-wrapper">';
//export_stream,read_stream,publish_stream,manage_pages,photo_upload,user_groups,publish_actions,user_friends,share_item,video_upload,status_update
$o .= '<a href="https://www.facebook.com/dialog/oauth?client_id=' . $appid . '&redirect_uri='
. $a->get_baseurl() . '/fbpost/' . $a->user['nickname'] . '&scope=publish_actions,publish_pages,user_posts,user_photos,user_status,user_videos,manage_pages,user_managed_groups">' . t('Re-authenticate [This is necessary whenever your Facebook password is changed.]') . '</a>';
$o .= '</div>';
$o .= '<div id="fbpost-post-default-form">';
$o .= '<form action="fbpost" method="post" >';
$post_by_default = get_pconfig(local_user(),'facebook','post_by_default');
$checked = (($post_by_default) ? ' checked="checked" ' : '');
$o .= '<input type="checkbox" name="post_by_default" value="1"' . $checked . '/>' . ' ' . t('Post to Facebook by default') . EOL;
$suppress_view_on_friendica = get_pconfig(local_user(),'facebook','suppress_view_on_friendica');
$checked = (($suppress_view_on_friendica) ? ' checked="checked" ' : '');
$o .= '<input type="checkbox" name="suppress_view_on_friendica" value="1"' . $checked . '/>' . ' ' . t('Suppress "View on friendica"') . EOL;
$mirror_posts = get_pconfig(local_user(),'facebook','mirror_posts');
$checked = (($mirror_posts) ? ' checked="checked" ' : '');
$o .= '<input type="checkbox" name="mirror_posts" value="1"' . $checked . '/>' . ' ' . t('Mirror wall posts from facebook to friendica.') . EOL;
// List all pages
$post_to_page = get_pconfig(local_user(),'facebook','post_to_page');
$page_access_token = get_pconfig(local_user(),'facebook','page_access_token');
$fb_token = get_pconfig($a->user['uid'],'facebook','access_token');
//$url = 'https://graph.facebook.com/me/accounts';
//$x = fetch_url($url."?access_token=".$fb_token, false, $redirects, 10);
//$accounts = json_decode($x);
$o .= t("Post to page/group:")."<select name='post_to_page'>";
if (intval($post_to_page) == 0)
$o .= "<option value='0-0' selected>".t('None')."</option>";
else
$o .= "<option value='0-0'>".t('None')."</option>";
foreach($accounts->data as $account) {
if (is_array($account->perms))
if ($post_to_page == $account->id)
$o .= "<option value='".$account->id."-".$account->access_token."' selected>".$account->name."</option>";
else
$o .= "<option value='".$account->id."-".$account->access_token."'>".$account->name."</option>";
}
$url = 'https://graph.facebook.com/me/groups';
$x = fetch_url($url."?access_token=".$fb_token, false, $redirects, 10);
$groups = json_decode($x);
foreach($groups->data as $group) {
if ($post_to_page == $group->id)
$o .= "<option value='".$group->id."-0' selected>".$group->name."</option>";
else
$o .= "<option value='".$group->id."-0'>".$group->name."</option>";
}
$o .= "</select>";
if ($fbsync) {
$o .= '<div class="clear"></div>';
$sync_enabled = get_pconfig(local_user(),'fbsync','sync');
$checked = (($sync_enabled) ? ' checked="checked" ' : '');
$o .= '<input type="checkbox" name="fbsync" value="1"' . $checked . '/>' . ' ' . t('Import Facebook newsfeed.') . EOL;
$create_user = get_pconfig(local_user(),'fbsync','create_user');
$checked = (($create_user) ? ' checked="checked" ' : '');
$o .= '<input type="checkbox" name="create_user" value="1"' . $checked . '/>' . ' ' . t('Automatically create contacts.') . EOL;
}
$o .= '<p><input type="submit" name="submit" value="' . t('Save Settings') . '" /></form></div>';
}
return $o;
}
/**
* @param App $a
* @param null|object $b
*/
function fbpost_plugin_settings(&$a,&$b) {
$enabled = get_pconfig(local_user(),'facebook','post');
$css = (($enabled) ? '' : '-disabled');
$result = q("SELECT `installed` FROM `addon` WHERE `name` = 'fbsync' AND `installed`");
if(count($result) > 0)
$title = t('Facebook Import/Export/Mirror');
else
$title = t('Facebook Export/Mirror');
$b .= '<div class="settings-block">';
$b .= '<a href="fbpost"><img class="connector'.$css.'" src="images/facebook.png" /><h3 class="connector">'.$title.'</h3></a>';
$b .= '</div>';
}
/**
* @param App $a
* @param null|object $o
*/
function fbpost_plugin_admin(&$a, &$o){
$o = '<input type="hidden" name="form_security_token" value="' . get_form_security_token("fbsave") . '">';
$o .= '<h4>' . t('Facebook API Key') . '</h4>';
$appid = get_config('facebook', 'appid' );
$appsecret = get_config('facebook', 'appsecret' );
$ret1 = q("SELECT `v` FROM `config` WHERE `cat` = 'facebook' AND `k` = 'appid' LIMIT 1");
$ret2 = q("SELECT `v` FROM `config` WHERE `cat` = 'facebook' AND `k` = 'appsecret' LIMIT 1");
if ((count($ret1) > 0 && $ret1[0]['v'] != $appid) || (count($ret2) > 0 && $ret2[0]['v'] != $appsecret)) $o .= t('Error: it appears that you have specified the App-ID and -Secret in your .htconfig.php file. As long as they are specified there, they cannot be set using this form.<br><br>');
$o .= '<label for="fb_appid">' . t('App-ID / API-Key') . '</label><input id="fb_appid" name="appid" type="text" value="' . escape_tags($appid ? $appid : "") . '"><br style="clear: both;">';
$o .= '<label for="fb_appsecret">' . t('Application secret') . '</label><input id="fb_appsecret" name="appsecret" type="text" value="' . escape_tags($appsecret ? $appsecret : "") . '"><br style="clear: both;">';
$o .= '<input type="submit" name="fb_save_keys" value="' . t('Save') . '">';
}
/**
* @param App $a
*/
function fbpost_plugin_admin_post(&$a){
check_form_security_token_redirectOnErr('/admin/plugins/fbpost', 'fbsave');
if (x($_REQUEST,'fb_save_keys')) {
set_config('facebook', 'appid', $_REQUEST['appid']);
set_config('facebook', 'appsecret', $_REQUEST['appsecret']);
info(t('The new values have been saved.'));
}
}
/**
* @param App $a
* @param object $b
* @return mixed
*/
function fbpost_jot_nets(&$a,&$b) {
if(! local_user())
return;
$fb_post = get_pconfig(local_user(),'facebook','post');
if(intval($fb_post) == 1) {
$fb_defpost = get_pconfig(local_user(),'facebook','post_by_default');
$selected = ((intval($fb_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="facebook_enable"' . $selected . ' value="1" /> '
. t('Post to Facebook') . '</div>';
}
}
/**
* @param App $a
* @param object $b
* @return mixed
*/
function fbpost_post_hook(&$a,&$b) {
logger('fbpost_post_hook: Facebook post invoked', LOGGER_DEBUG);
if($b['deleted'] || ($b['created'] !== $b['edited']))
return;
logger('fbpost_post_hook: Facebook post first check successful', LOGGER_DEBUG);
// if post comes from facebook don't send it back
if($b['extid'] == NETWORK_FACEBOOK)
return;
if(($b['app'] == "Facebook") && ($b['verb'] != ACTIVITY_LIKE))
return;
logger('fbpost_post_hook: Facebook post accepted', LOGGER_DEBUG);
/**
* Post to Facebook stream
*/
require_once('include/group.php');
require_once('include/html2plain.php');
$reply = false;
$likes = false;
$deny_arr = array();
$allow_arr = array();
$toplevel = (($b['id'] == $b['parent']) ? true : false);
$linking = ((get_pconfig($b['uid'],'facebook','no_linking')) ? 0 : 1);
if((!$toplevel) && ($linking)) {
$r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($b['parent']),
intval($b['uid'])
);
//$r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
// dbesc($b['parent-uri']),
// intval($b['uid'])
//);
// is it a reply to a facebook post?
// A reply to a toplevel post is only allowed for "real" facebook posts
if(count($r) && substr($r[0]['uri'],0,4) === 'fb::')
$reply = substr($r[0]['uri'],4);
elseif(count($r) && (substr($r[0]['extid'],0,4) === 'fb::') && ($r[0]['id'] != $r[0]['parent']))
$reply = substr($r[0]['extid'],4);
else
return;
$u = q("SELECT * FROM user where uid = %d limit 1",
intval($b['uid'])
);
if(! count($u))
return;
// only accept comments from the item owner. Other contacts are unknown to FB.
if(! link_compare($b['author-link'], $a->get_baseurl() . '/profile/' . $u[0]['nickname']))
return;
logger('fbpost_post_hook: facebook reply id=' . $reply);
}
if(strstr($b['postopts'],'facebook') || ($b['private']) || ($reply)) {
if($b['private'] && $reply === false) {
$allow_people = expand_acl($b['allow_cid']);
$allow_groups = expand_groups(expand_acl($b['allow_gid']));
$deny_people = expand_acl($b['deny_cid']);
$deny_groups = expand_groups(expand_acl($b['deny_gid']));
$recipients = array_unique(array_merge($allow_people,$allow_groups));
$deny = array_unique(array_merge($deny_people,$deny_groups));
$allow_str = dbesc(implode(', ',$recipients));
if($allow_str) {
logger("fbpost_post_hook: private post to: ".$allow_str, LOGGER_DEBUG);
$r = q("SELECT `notify` FROM `contact` WHERE `id` IN ( $allow_str ) AND `network` = 'face'");
if(count($r))
foreach($r as $rr)
$allow_arr[] = $rr['notify'];
}
$deny_str = dbesc(implode(', ',$deny));
if($deny_str) {
$r = q("SELECT `notify` FROM `contact` WHERE `id` IN ( $deny_str ) AND `network` = 'face'");
if(count($r))
foreach($r as $rr)
$deny_arr[] = $rr['notify'];
}
if(count($deny_arr) && (! count($allow_arr))) {
// One or more FB folks were denied access but nobody on FB was specifically allowed access.
// This might cause the post to be open to public on Facebook, but only to selected members
// on another network. Since this could potentially leak a post to somebody who was denied,
// we will skip posting it to Facebook with a slightly vague but relevant message that will
// hopefully lead somebody to this code comment for a better explanation of what went wrong.
notice( t('Post to Facebook cancelled because of multi-network access permission conflict.') . EOL);
return;
}
// if it's a private message but no Facebook members are allowed or denied, skip Facebook post
if((! count($allow_arr)) && (! count($deny_arr)))
return;
}
if($b['verb'] == ACTIVITY_LIKE) {
$likes = true;
logger('fbpost_post_hook: liking '.print_r($b, true), LOGGER_DEBUG);
}
$appid = get_config('facebook', 'appid' );
$secret = get_config('facebook', 'appsecret' );
if($appid && $secret) {
logger('fbpost_post_hook: have appid+secret');
$fb_token = get_pconfig($b['uid'],'facebook','access_token');
// post to facebook if it's a public post and we've ticked the 'post to Facebook' box,
// or it's a private message with facebook participants
// or it's a reply or likes action to an existing facebook post
if($fb_token && ($toplevel || $b['private'] || $reply)) {
logger('fbpost_post_hook: able to post');
require_once('library/facebook.php');
require_once('include/bbcode.php');
$msg = $b['body'];
logger('fbpost_post_hook: original msg=' . $msg, LOGGER_DATA);
if ($toplevel) {
require_once("include/plaintext.php");
$msgarr = plaintext($a, $b, 0, false, 9);
$msg = $msgarr["text"];
$link = $msgarr["url"];
$linkname = $msgarr["title"];
if ($msgarr["type"] != "video")
$image = $msgarr["image"];
// Fallback - if message is empty
if(!strlen($msg))
$msg = $linkname;
if(!strlen($msg))
$msg = $link;
if(!strlen($msg))
$msg = $image;
} else {
require_once("include/bbcode.php");
require_once("include/html2plain.php");
$msg = bb_CleanPictureLinks($msg);
$msg = bbcode($msg, false, false, 2, true);
$msg = trim(html2plain($msg, 0));
$link = "";
$image = "";
$linkname = "";
}
// If there is nothing to post then exit
if(!strlen($msg))
return;
logger('fbpost_post_hook: msg=' . $msg, LOGGER_DATA);
$video = "";
if($likes) {
$postvars = array('access_token' => $fb_token);
} else {
// message, picture, link, name, caption, description, source, place, tags
//if(trim($link) != "")
// if (@exif_imagetype($link) != 0) {
// $image = $link;
// $link = "";
// }
$postvars = array(
'access_token' => $fb_token,
'message' => $msg
);
if(trim($image) != "")
$postvars['picture'] = $image;
if(trim($link) != "") {
$postvars['link'] = $link;
if ((stristr($link,'youtube')) || (stristr($link,'youtu.be')) || (stristr($link,'vimeo'))) {
$video = $link;
}
}
if(trim($linkname) != "")
$postvars['name'] = $linkname;
}
if(($b['private']) && ($toplevel)) {
$postvars['privacy'] = '{"value": "CUSTOM", "friends": "SOME_FRIENDS"';
if(count($allow_arr))
$postvars['privacy'] .= ',"allow": "' . implode(',',$allow_arr) . '"';
if(count($deny_arr))
$postvars['privacy'] .= ',"deny": "' . implode(',',$deny_arr) . '"';
$postvars['privacy'] .= '}';
}
$post_to_page = get_pconfig($b['uid'],'facebook','post_to_page');
$page_access_token = get_pconfig($b['uid'],'facebook','page_access_token');
if ((intval($post_to_page) != 0) && ($page_access_token != ""))
$target = $post_to_page;
else
$target = "me";
if($reply) {
$url = 'https://graph.facebook.com/' . $reply . '/' . (($likes) ? 'likes' : 'comments');
} else if (($video != "") || (($image == "") && ($link != ""))) {
// If it is a link to a video or a link without a preview picture then post it as a link
if ($video != "")
$link = $video;
$postvars = array(
'access_token' => $fb_token,
'link' => $link,
);
if ($msg != $video)
$postvars['message'] = $msg;
$url = 'https://graph.facebook.com/'.$target.'/links';
} else if (($link == "") && ($image != "")) {
// If it is only an image without a page link then post this image as a photo
$postvars = array(
'access_token' => $fb_token,
'url' => $image,
);
if ($msg != $image)
$postvars['message'] = $msg;
$url = 'https://graph.facebook.com/'.$target.'/photos';
//} else if (($link != "") || ($image != "") || ($b['title'] == '') || (strlen($msg) < 500)) {
} else {
$url = 'https://graph.facebook.com/'.$target.'/feed';
if (!get_pconfig($b['uid'],'facebook','suppress_view_on_friendica') && $b['plink'])
$postvars['actions'] = '{"name": "' . t('View on Friendica') . '", "link": "' . $b['plink'] . '"}';
}
/* } else {
// if its only a message and a subject and the message is larger than 500 characters then post it as note
$postvars = array(
'access_token' => $fb_token,
'message' => bbcode($b['body'], false, false),
'subject' => $b['title'],
);
$url = 'https://graph.facebook.com/'.$target.'/notes';
} */
// Post to page?
if (!$reply && ($target != "me") && $page_access_token)
$postvars['access_token'] = $page_access_token;
logger('fbpost_post_hook: post to ' . $url);
logger('fbpost_post_hook: postvars: ' . print_r($postvars,true));
// "test_mode" prevents anything from actually being posted.
// Otherwise, let's do it.
if(!get_config('facebook','test_mode')) {
$x = post_url($url, $postvars);
logger('fbpost_post_hook: post returns: ' . $x, LOGGER_DEBUG);
$retj = json_decode($x);
if($retj->id) {
// Only set the extid when it isn't the toplevel post
q("UPDATE `item` SET `extid` = '%s' WHERE `id` = %d AND `parent` != %d",
dbesc('fb::' . $retj->id),
intval($b['id']),
intval($b['id'])
);
} else {
// Sometimes posts are accepted from facebook although it telling an error
// This leads to endless comment flooding.
// If it is a special kind of failure the post was receiced
// Although facebook said it wasn't received ...
if (!$likes && (($retj->error->type != "OAuthException") || ($retj->error->code != 2)) && ($x <> "")) {
$r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self`", intval($b['uid']));
if (count($r))
$a->contact = $r[0]["id"];
$s = serialize(array('url' => $url, 'item' => $b['id'], 'post' => $postvars));
require_once('include/queue_fn.php');
add_to_queue($a->contact,NETWORK_FACEBOOK,$s);
logger('fbpost_post_hook: Post failed, requeued.', LOGGER_DEBUG);
notice( t('Facebook post failed. Queued for retry.') . EOL);
}
if (isset($retj->error) && $retj->error->type == "OAuthException" && $retj->error->code == 190) {
logger('fbpost_post_hook: Facebook session has expired due to changed password.', LOGGER_DEBUG);
$last_notification = get_pconfig($b['uid'], 'facebook', 'session_expired_mailsent');
if (!$last_notification || $last_notification < (time() - FACEBOOK_SESSION_ERR_NOTIFICATION_INTERVAL)) {
require_once('include/enotify.php');
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", intval($b['uid']));
notification(array(
'uid' => $b['uid'],
'type' => NOTIFY_SYSTEM,
'system_type' => 'facebook_connection_invalid',
'language' => $r[0]['language'],
'to_name' => $r[0]['username'],
'to_email' => $r[0]['email'],
'source_name' => t('Administrator'),
'source_link' => $a->config["system"]["url"],
'source_photo' => $a->config["system"]["url"] . '/images/person-80.jpg',
));
set_pconfig($b['uid'], 'facebook', 'session_expired_mailsent', time());
} else logger('fbpost_post_hook: No notification, as the last one was sent on ' . $last_notification, LOGGER_DEBUG);
}
}
}
}
}
}
}
/**
* @param App $app
* @param object $data
*/
function fbpost_enotify(&$app, &$data) {
if (x($data, 'params') && $data['params']['type'] == NOTIFY_SYSTEM && x($data['params'], 'system_type') && $data['params']['system_type'] == 'facebook_connection_invalid') {
$data['itemlink'] = '/fbpost';
$data['epreamble'] = $data['preamble'] = t('Your Facebook connection became invalid. Please Re-authenticate.');
$data['subject'] = t('Facebook connection became invalid');
$data['body'] = sprintf( t("Hi %1\$s,\n\nThe connection between your accounts on %2\$s and Facebook became invalid. This usually happens after you change your Facebook-password. To enable the connection again, you have to %3\$sre-authenticate the Facebook-connector%4\$s."), $data['params']['to_name'], "[url=" . $app->config["system"]["url"] . "]" . $app->config["sitename"] . "[/url]", "[url=" . $app->config["system"]["url"] . "/fbpost]", "[/url]");
}
}
/**
* @param App $a
* @param object $b
*/
function fbpost_post_local(&$a,&$b) {
// Figure out if Facebook posting is enabled for this post and file it in 'postopts'
// where we will discover it during background delivery.
// This can only be triggered by a local user posting to their own wall.
if((local_user()) && (local_user() == $b['uid'])) {
$fb_post = intval(get_pconfig(local_user(),'facebook','post'));
$fb_enable = (($fb_post && x($_REQUEST,'facebook_enable')) ? intval($_REQUEST['facebook_enable']) : 0);
// if API is used, default to the chosen settings
// but allow a specific override
if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'facebook','post_by_default'))) {
if(! x($_REQUEST,'facebook_enable'))
$fb_enable = 1;
}
if(! $fb_enable)
return;
if(strlen($b['postopts']))
$b['postopts'] .= ',';
$b['postopts'] .= 'facebook';
}
}
/**
* @param App $a
* @param object $b
*/
function fbpost_queue_hook(&$a,&$b) {
$qi = q("SELECT * FROM `queue` WHERE `network` = '%s'",
dbesc(NETWORK_FACEBOOK)
);
if(! count($qi))
return;
require_once('include/queue_fn.php');
foreach($qi as $x) {
if($x['network'] !== NETWORK_FACEBOOK)
continue;
logger('fbpost_queue_hook: run');
$r = q("SELECT `user`.* FROM `user` LEFT JOIN `contact` on `contact`.`uid` = `user`.`uid`
WHERE `contact`.`self` = 1 AND `contact`.`id` = %d LIMIT 1",
intval($x['cid'])
);
if(! count($r)) {
logger('fbpost_queue_hook: no user found for entry '.print_r($x, true));
update_queue_time($x['id']);
continue;
}
$user = $r[0];
$appid = get_config('facebook', 'appid' );
$secret = get_config('facebook', 'appsecret' );
if($appid && $secret) {
$fb_post = intval(get_pconfig($user['uid'],'facebook','post'));
$fb_token = get_pconfig($user['uid'],'facebook','access_token');
if($fb_post && $fb_token) {
logger('fbpost_queue_hook: able to post');
require_once('library/facebook.php');
$z = unserialize($x['content']);
$item = $z['item'];
$j = post_url($z['url'],$z['post']);
$retj = json_decode($j);
if($retj->id) {
// Only set the extid when it isn't the toplevel post
q("UPDATE `item` SET `extid` = '%s' WHERE `id` = %d AND `parent` != %d",
dbesc('fb::' . $retj->id),
intval($item),
intval($item)
);
logger('fbpost_queue_hook: success: ' . $j);
remove_queue_item($x['id']);
} else {
logger('fbpost_queue_hook: failed: ' . $j);
// If it is a special kind of failure the post was receiced
// Although facebook said it wasn't received ...
$ret = json_decode($j);
if (($ret->error->type != "OAuthException") || ($ret->error->code != 2) && ($j <> ""))
update_queue_time($x['id']);
else
logger('fbpost_queue_hook: Not requeued, since it seems to be received');
}
} else {
logger('fbpost_queue_hook: No fb_post or fb_token.');
update_queue_time($x['id']);
}
} else {
logger('fbpost_queue_hook: No appid or secret.');
update_queue_time($x['id']);
}
}
}
/**
* @return bool|string
*/
function fbpost_get_app_access_token() {
$acc_token = get_config('facebook','app_access_token');
if ($acc_token !== false) return $acc_token;
$appid = get_config('facebook','appid');
$appsecret = get_config('facebook', 'appsecret');
if ($appid === false || $appsecret === false) {
logger('fb_get_app_access_token: appid and/or appsecret not set', LOGGER_DEBUG);
return false;
}
logger('https://graph.facebook.com/oauth/access_token?client_id=' . $appid . '&client_secret=' . $appsecret . '&grant_type=client_credentials', LOGGER_DATA);
$x = fetch_url('https://graph.facebook.com/oauth/access_token?client_id=' . $appid . '&client_secret=' . $appsecret . '&grant_type=client_credentials');
if(strpos($x,'access_token=') !== false) {
logger('fb_get_app_access_token: returned access token: ' . $x, LOGGER_DATA);
$token = str_replace('access_token=', '', $x);
if(strpos($token,'&') !== false)
$token = substr($token,0,strpos($token,'&'));
if ($token == "") {
logger('fb_get_app_access_token: empty token: ' . $x, LOGGER_DEBUG);
return false;
}
set_config('facebook','app_access_token',$token);
return $token;
} else {
logger('fb_get_app_access_token: response did not contain an access_token: ' . $x, LOGGER_DATA);
return false;
}
}
function fbpost_prepare_body(&$a,&$b) {
if ($b["item"]["network"] != NETWORK_FACEBOOK)
return;
if ($b["preview"]) {
$msg = $b["item"]["body"];
require_once("include/bbcode.php");
require_once("include/html2plain.php");
$msg = bb_CleanPictureLinks($msg);
$msg = bbcode($msg, false, false, 2, true);
$msg = trim(html2plain($msg, 0));
$b['html'] = nl2br(htmlspecialchars($msg));
}
}
function fbpost_cron($a,$b) {
$last = get_config('facebook','last_poll');
$poll_interval = intval(get_config('facebook','poll_interval'));
if(! $poll_interval)
$poll_interval = FACEBOOK_DEFAULT_POLL_INTERVAL;
if($last) {
$next = $last + ($poll_interval * 60);
if($next > time()) {
logger('facebook: poll intervall not reached');
return;
}
}
logger('facebook: cron_start');
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'facebook' AND `k` = 'mirror_posts' AND `v` = '1' ORDER BY RAND() ");
if(count($r)) {
foreach($r as $rr) {
logger('facebook: fetching for user '.$rr['uid']);
fbpost_fetchwall($a, $rr['uid']);
}
}
logger('facebook: cron_end');
set_config('facebook','last_poll', time());
}
function fbpost_cleanpicture($url) {
require_once("include/Photo.php");
$urldata = parse_url($url);
if (isset($urldata["query"])) {
parse_str($urldata["query"], $querydata);
if (isset($querydata["url"]) && (get_photo_info($querydata["url"])))
return($querydata["url"]);
}
return($url);
}
function fbpost_fetchwall($a, $uid) {
require_once("include/oembed.php");
require_once("include/network.php");
require_once("include/items.php");
require_once("mod/item.php");
require_once("include/bbcode.php");
$access_token = get_pconfig($uid,'facebook','access_token');
$post_to_page = get_pconfig($uid,'facebook','post_to_page');
$mirror_page = get_pconfig($uid,'facebook','mirror_page');
$lastcreated = get_pconfig($uid,'facebook','last_created');
if ((int)$post_to_page == 0)
$post_to_page = "me";
if ((int)$mirror_page != 0)
$post_to_page = $mirror_page;
$url = "https://graph.facebook.com/".$post_to_page."/feed?access_token=".$access_token;
$first_time = ($lastcreated == "");
if ($lastcreated != "")
$url .= "&since=".urlencode($lastcreated);
$feed = fetch_url($url);
$data = json_decode($feed);
if (!is_array($data->data))
return;
$items = array_reverse($data->data);
foreach ($items as $item) {
if ($item->created_time > $lastcreated)
$lastcreated = $item->created_time;
if ($first_time)
continue;
if ($item->application->id == get_config('facebook','appid'))
continue;
if(isset($item->privacy) && ($item->privacy->value !== 'EVERYONE') && ((int)$mirror_page == 0))
continue;
elseif(isset($item->privacy) && ($item->privacy->value !== 'EVERYONE') && ($item->privacy->value !== ''))
continue;
elseif(!isset($item->privacy))
continue;
if (($post_to_page != $item->from->id) && ((int)$post_to_page != 0))
continue;
if (!strstr($item->id, $item->from->id."_") && isset($item->to) && ((int)$post_to_page == 0))
continue;
$_SESSION["authenticated"] = true;
$_SESSION["uid"] = $uid;
unset($_REQUEST);
$_REQUEST["type"] = "wall";
$_REQUEST["api_source"] = true;
$_REQUEST["profile_uid"] = $uid;
//$_REQUEST["source"] = "Facebook";
$_REQUEST["source"] = $item->application->name;
$_REQUEST["extid"] = NETWORK_FACEBOOK;
$_REQUEST["title"] = "";
$_REQUEST["body"] = (isset($item->message) ? escape_tags($item->message) : '');
$pagedata = array();
$content = "";
$pagedata["type"] = "";
if(isset($item->name) && isset($item->link)) {
$item->link = original_url($item->link);
$oembed_data = oembed_fetch_url($item->link);
$pagedata["type"] = $oembed_data->type;
$pagedata["url"] = $item->link;
$pagedata["title"] = $item->name;
$content = "[bookmark=".$item->link."]".$item->name."[/bookmark]";
// If a link is not only attached but also added in the body, look if it can be removed in the body.
$removedlink = trim(str_replace($item->link, "", $_REQUEST["body"]));
if (($removedlink == "") || strstr($_REQUEST["body"], $removedlink))
$_REQUEST["body"] = $removedlink;
} elseif (isset($item->name))
$content .= "[b]".$item->name."[/b]";
$pagedata["text"] = "";
if(isset($item->description) && ($item->type != "photo"))
$pagedata["text"] = $item->description;
if(isset($item->caption) && ($item->type == "photo"))
$pagedata["text"] = $item->caption;
// Only import the picture when the message is no video
// oembed display a picture of the video as well
//if ($item->type != "video") {
//if (($item->type != "video") && ($item->type != "photo")) {
if (($pagedata["type"] == "") || ($pagedata["type"] == "link")) {
$pagedata["type"] = $item->type;
if (isset($item->picture))
$pagedata["images"][0]["src"] = $item->picture;
if (($pagedata["type"] == "photo") && isset($item->object_id)) {
logger('fbpost_fetchwall: fetching fbid '.$item->object_id, LOGGER_DEBUG);
$url = "https://graph.facebook.com/".$item->object_id."?access_token=".$access_token;
$feed = fetch_url($url);
$data = json_decode($feed);
if (isset($data->images)) {
$pagedata["images"][0]["src"] = $data->images[0]->source;
logger('got fbid image from images for '.$item->object_id, LOGGER_DEBUG);
} elseif (isset($data->source)) {
$pagedata["images"][0]["src"] = $data->source;
logger('got fbid image from source for '.$item->object_id, LOGGER_DEBUG);
} elseif (isset($data->picture)) {
$pagedata["images"][0]["src"] = $data->picture;
logger('got fbid image from picture for '.$item->object_id, LOGGER_DEBUG);
}
}
if(trim($_REQUEST["body"].$content.$pagedata["text"]) == '') {
logger('facebook: empty body 1 '.$item->id.' '.print_r($item, true));
continue;
}
$pagedata["images"][0]["src"] = fbpost_cleanpicture($pagedata["images"][0]["src"]);
if(($pagedata["images"][0]["src"] != "") && isset($item->link)) {
$item->link = original_url($item->link);
$pagedata["url"] = $item->link;
$content .= "\n".'[url='.$item->link.'][img]'.$pagedata["images"][0]["src"].'[/img][/url]';
} else {
if ($pagedata["images"][0]["src"] != "")
$content .= "\n".'[img]'.$pagedata["images"][0]["src"].'[/img]';
// if just a link, it may be a wall photo - check
if(isset($item->link))
$content .= fbpost_get_photo($uid,$item->link);
}
}
if(trim($_REQUEST["body"].$content.$pagedata["text"]) == '') {
logger('facebook: empty body 2 '.$item->id.' '.print_r($item, true));
continue;
}
if ($pagedata["type"] != "")
$_REQUEST["body"] .= add_page_info_data($pagedata);
else {
if ($content)
$_REQUEST["body"] .= "\n".trim($content);
if ($pagedata["text"])
$_REQUEST["body"] .= "\n[quote]".$pagedata["text"]."[/quote]";
$_REQUEST["body"] = trim($_REQUEST["body"]);
}
if (isset($item->place)) {
if ($item->place->name || $item->place->location->street ||
$item->place->location->city || $item->place->location->country) {
$_REQUEST["location"] = '';
if ($item->place->name)
$_REQUEST["location"] .= $item->place->name;
if ($item->place->location->street)
$_REQUEST["location"] .= " ".$item->place->location->street;
if ($item->place->location->city)
$_REQUEST["location"] .= " ".$item->place->location->city;
if ($item->place->location->country)
$_REQUEST["location"] .= " ".$item->place->location->country;
$_REQUEST["location"] = trim($_REQUEST["location"]);
}
if ($item->place->location->latitude && $item->place->location->longitude)
$_REQUEST["coord"] = substr($item->place->location->latitude, 0, 8)
.' '.substr($item->place->location->longitude, 0, 8);
}
if(trim($_REQUEST["body"]) == '') {
logger('facebook: empty body 3 '.$item->id.' '.print_r($item, true));
continue;
}
if(trim(strip_tags(bbcode($_REQUEST["body"], false, false))) == '') {
logger('facebook: empty body 4 '.$item->id.' '.print_r($item, true));
continue;
}
//print_r($_REQUEST);
logger('facebook: posting for user '.$uid);
item_post($a);
}
set_pconfig($uid,'facebook','last_created', $lastcreated);
}
function fbpost_get_photo($uid,$link) {
$access_token = get_pconfig($uid,'facebook','access_token');
if(! $access_token || (! stristr($link,'facebook.com/photo.php')))
return "";
$ret = preg_match('/fbid=([0-9]*)/',$link,$match);
if($ret)
$photo_id = $match[1];
else
return "";
$x = fetch_url('https://graph.facebook.com/'.$photo_id.'?access_token='.$access_token);
$j = json_decode($x);
if($j->picture)
return "\n\n".'[url='.$link.'][img]'.$j->picture.'[/img][/url]';
return "";
}
function fpost_cleanpicture($image) {
if ((strpos($image, ".fbcdn.net/") || strpos($image, "/fbcdn-photos-")) && (substr($image, -6) == "_s.jpg"))
$image = substr($image, 0, -6)."_n.jpg";
$queryvar = fbpost_parse_query($image);
if ($queryvar['url'] != "")
$image = urldecode($queryvar['url']);
return $image;
}
function fbpost_parse_query($var) {
/**
* Use this function to parse out the query array element from
* the output of parse_url().
*/
$var = parse_url($var, PHP_URL_QUERY);
$var = html_entity_decode($var);
$var = explode('&', $var);
$arr = array();
foreach($var as $val) {
$x = explode('=', $val);
$arr[$x[0]] = $x[1];
}
unset($val, $x, $var);
return $arr;
}

156
fbpost/lang/C/messages.po Normal file
View file

@ -0,0 +1,156 @@
# ADDON fbpost
# Copyright (C)
# This file is distributed under the same license as the Friendica fbpost addon package.
#
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-02-27 05:01-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: fbpost.php:155
msgid "Settings updated."
msgstr ""
#: fbpost.php:170 fbpost.php:176
msgid "Permission denied."
msgstr ""
#: fbpost.php:183
msgid "Facebook Post disabled"
msgstr ""
#: fbpost.php:203
msgid "Facebook API key is missing."
msgstr ""
#: fbpost.php:210
msgid "Facebook Post"
msgstr ""
#: fbpost.php:216
msgid "Install Facebook Post connector for this account."
msgstr ""
#: fbpost.php:223
msgid "Remove Facebook Post connector"
msgstr ""
#: fbpost.php:228
msgid ""
"Re-authenticate [This is necessary whenever your Facebook password is "
"changed.]"
msgstr ""
#: fbpost.php:235
msgid "Post to Facebook by default"
msgstr ""
#: fbpost.php:239
msgid "Suppress \"View on friendica\""
msgstr ""
#: fbpost.php:243
msgid "Mirror wall posts from facebook to friendica."
msgstr ""
#: fbpost.php:253
msgid "Post to page/group:"
msgstr ""
#: fbpost.php:255 fbpost.php:257
msgid "None"
msgstr ""
#: fbpost.php:280
msgid "Submit"
msgstr ""
#: fbpost.php:294
msgid "Facebook"
msgstr ""
#: fbpost.php:295
msgid "Facebook Post Settings"
msgstr ""
#: fbpost.php:310
msgid "Facebook API Key"
msgstr ""
#: fbpost.php:317
msgid ""
"Error: it appears that you have specified the App-ID and -Secret in your ."
"htconfig.php file. As long as they are specified there, they cannot be set "
"using this form.<br><br>"
msgstr ""
#: fbpost.php:319
msgid "App-ID / API-Key"
msgstr ""
#: fbpost.php:320
msgid "Application secret"
msgstr ""
#: fbpost.php:322
msgid "Save"
msgstr ""
#: fbpost.php:337
msgid "The new values have been saved."
msgstr ""
#: fbpost.php:356
msgid "Post to Facebook"
msgstr ""
#: fbpost.php:375
#, php-format
msgid "%s:"
msgstr ""
#: fbpost.php:487
msgid ""
"Post to Facebook cancelled because of multi-network access permission "
"conflict."
msgstr ""
#: fbpost.php:766
msgid "View on Friendica"
msgstr ""
#: fbpost.php:803
msgid "Facebook post failed. Queued for retry."
msgstr ""
#: fbpost.php:821
msgid "Administrator"
msgstr ""
#: fbpost.php:843
msgid "Your Facebook connection became invalid. Please Re-authenticate."
msgstr ""
#: fbpost.php:844
msgid "Facebook connection became invalid"
msgstr ""
#: fbpost.php:845
#, php-format
msgid ""
"Hi %1$s,\n"
"\n"
"The connection between your accounts on %2$s and Facebook became invalid. "
"This usually happens after you change your Facebook-password. To enable the "
"connection again, you have to %3$sre-authenticate the Facebook-connector%4$s."
msgstr ""

View file

@ -0,0 +1,32 @@
<?php
$a->strings["Settings updated."] = "Ajustos actualitzats.";
$a->strings["Permission denied."] = "Permís denegat.";
$a->strings["Facebook Post disabled"] = "";
$a->strings["Facebook API key is missing."] = "La clau del API de Facebook s'ha perdut.";
$a->strings["Facebook Post"] = "";
$a->strings["Install Facebook Post connector for this account."] = "";
$a->strings["Remove Facebook Post connector"] = "";
$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "Re-autentificar [Això és necessari cada vegada que la contrasenya de Facebook canvia.]";
$a->strings["Post to Facebook by default"] = "Enviar a Facebook per defecte";
$a->strings["Suppress \"View on friendica\""] = "";
$a->strings["Mirror wall posts from facebook to friendica."] = "";
$a->strings["Post to page/group:"] = "";
$a->strings["None"] = "Cap";
$a->strings["Submit"] = "Enviar";
$a->strings["Facebook"] = "Facebook";
$a->strings["Facebook Post Settings"] = "";
$a->strings["Facebook API Key"] = "Facebook API Key";
$a->strings["Error: it appears that you have specified the App-ID and -Secret in your .htconfig.php file. As long as they are specified there, they cannot be set using this form.<br><br>"] = "Error: Apareix que has especificat el App-ID i el Secret en el arxiu .htconfig.php. Per estar especificat allà, no pot ser canviat utilitzant aquest formulari.<br><br>";
$a->strings["App-ID / API-Key"] = "App-ID / API-Key";
$a->strings["Application secret"] = "Application secret";
$a->strings["Save"] = "Guardar";
$a->strings["The new values have been saved."] = "Els nous valors s'han guardat.";
$a->strings["Post to Facebook"] = "Enviament a Facebook";
$a->strings["%s:"] = "";
$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "Enviament a Facebook cancel·lat perque hi ha un conflicte de permisos d'accés multi-xarxa.";
$a->strings["View on Friendica"] = "Vist en Friendica";
$a->strings["Facebook post failed. Queued for retry."] = "Enviament a Facebook fracassat. En cua per a reintent.";
$a->strings["Administrator"] = "Administrador";
$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "La seva connexió a Facebook es va convertir en no vàlida. Per favor, torni a autenticar-se";
$a->strings["Facebook connection became invalid"] = "La seva connexió a Facebook es va convertir en no vàlida";

View file

@ -0,0 +1,31 @@
<?php
$a->strings["Settings updated."] = "Nastavení aktualizováno.";
$a->strings["Permission denied."] = "Přístup odmítnut.";
$a->strings["Facebook Post disabled"] = "Příspěvky na Facebook zakázán.";
$a->strings["Facebook API key is missing."] = "Chybí Facebook API klíč.";
$a->strings["Facebook Post"] = "Facebook příspěvek";
$a->strings["Install Facebook Post connector for this account."] = "Instalovat pro tento účet konektor pro příspěvky na Facebook.";
$a->strings["Remove Facebook Post connector"] = "Odstranit konektor pro příspěvky na Facebook";
$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "Opětovná autentikace [Toto je nezbytné kdykoliv se změní Vaše heslo na Facebooku.]";
$a->strings["Post to Facebook by default"] = "Standardně posílat příspěvky na Facebook";
$a->strings["Suppress \"View on friendica\""] = "Potlačit \"Zobrazit na friendica\"";
$a->strings["Post to page/group:"] = "Příspěvek na stránku/skupinu";
$a->strings["None"] = "Žádný";
$a->strings["Submit"] = "Odeslat";
$a->strings["Facebook"] = "Facebook";
$a->strings["Facebook Post Settings"] = "Nastavení konektoru pro příspěvky na Facebook";
$a->strings["Facebook API Key"] = "Facebook API Key";
$a->strings["Error: it appears that you have specified the App-ID and -Secret in your .htconfig.php file. As long as they are specified there, they cannot be set using this form.<br><br>"] = "Chyba: zdá se, že jste specifikoval App-ID a -Secret ve Vašem .htconfig.php souboru. Dokud jsou na tomto místě specifikované, nemohou být nastaveny s pomocí tohoto formuláře.<br><br>";
$a->strings["App-ID / API-Key"] = "App-ID / API-Key";
$a->strings["Application secret"] = "Application secret";
$a->strings["Save"] = "Uložit";
$a->strings["The new values have been saved."] = "Nové hodnoty byly uloženy";
$a->strings["Post to Facebook"] = "Přidat příspěvek na Facebook";
$a->strings["%s:"] = "%s:";
$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "Příspěvek na Facebook zrušen kvůli konfliktu přístupových práv mezi sítěmi.";
$a->strings["View on Friendica"] = "Zobrazení na Friendica";
$a->strings["Facebook post failed. Queued for retry."] = "Zaslání příspěvku na Facebook selhalo. Příspěvek byl zařazen do fronty pro opakované odeslání.";
$a->strings["Administrator"] = "Administrátor";
$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "Vaše připojení na Facebook přestalo být platné. Prosím znovu se přihlaste.";
$a->strings["Facebook connection became invalid"] = "Připojení na Facebook bylo zneplatněno.";

View file

@ -0,0 +1,32 @@
<?php
$a->strings["Settings updated."] = "Einstellungen aktualisiert.";
$a->strings["Permission denied."] = "Zugriff verweigert.";
$a->strings["Facebook Post disabled"] = "Nach Facebook senden deaktiviert";
$a->strings["Facebook API key is missing."] = "Facebook-API-Schlüssel nicht gefunden";
$a->strings["Facebook Post"] = "Facebook Relai";
$a->strings["Install Facebook Post connector for this account."] = "Facebook-Connector für dieses Konto installieren.";
$a->strings["Remove Facebook Post connector"] = "Facebook-Connector entfernen";
$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "Neu authentifizieren [Das ist immer dann nötig, wenn du dein Facebook-Passwort geändert hast.]";
$a->strings["Post to Facebook by default"] = "Veröffentliche standardmäßig bei Facebook";
$a->strings["Suppress \"View on friendica\""] = "Unterdrücke \"Auf Friendica Ansehen\"";
$a->strings["Mirror wall posts from facebook to friendica."] = "Spiegle Pinnwandeinträge von Facebook auf friendica";
$a->strings["Post to page/group:"] = "Auf FB Seite/Gruppe veröffentlichen";
$a->strings["None"] = "Keine";
$a->strings["Submit"] = "Senden";
$a->strings["Facebook"] = "Facebook";
$a->strings["Facebook Post Settings"] = "Facebook-Beitragseinstellungen";
$a->strings["Facebook API Key"] = "Facebook API Schlüssel";
$a->strings["Error: it appears that you have specified the App-ID and -Secret in your .htconfig.php file. As long as they are specified there, they cannot be set using this form.<br><br>"] = "Fehler: du scheinst die App-ID und das App-Geheimnis in deiner .htconfig.php Datei angegeben zu haben. Solange sie dort festgelegt werden kannst du dieses Formular hier nicht verwenden.<br><br>";
$a->strings["App-ID / API-Key"] = "App-ID / API-Key";
$a->strings["Application secret"] = "Anwendungs-Geheimnis";
$a->strings["Save"] = "Speichern";
$a->strings["The new values have been saved."] = "Die neuen Einstellungen wurden gespeichert.";
$a->strings["Post to Facebook"] = "Bei Facebook veröffentlichen";
$a->strings["%s:"] = "%s:";
$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "Beitrag wurde nicht bei Facebook veröffentlicht, da Konflikte bei den Multi-Netzwerk-Zugriffsrechten vorliegen.";
$a->strings["View on Friendica"] = "In Friendica betrachten";
$a->strings["Facebook post failed. Queued for retry."] = "Veröffentlichung bei Facebook gescheitert. Wir versuchen es später erneut.";
$a->strings["Administrator"] = "Administrator";
$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "Deine Facebook Anmeldedaten sind ungültig geworden. Bitte re-authentifiziere dich.";
$a->strings["Facebook connection became invalid"] = "Facebook Anmeldedaten sind ungültig geworden";

View file

@ -0,0 +1,28 @@
<?php
$a->strings["Settings updated."] = "Agordoj ĝisdatigita.";
$a->strings["Permission denied."] = "Malpermesita.";
$a->strings["Facebook Post disabled"] = "";
$a->strings["Facebook API key is missing."] = "La API ŝlosilo de Facebook ne estas konata ĉi tie.";
$a->strings["Facebook Post"] = "";
$a->strings["Install Facebook Post connector for this account."] = "";
$a->strings["Remove Facebook Post connector"] = "";
$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "Reaŭtentiĝi [Tio estas bezonata ĉiam kiam vi ŝanĝis vian pasvorton ĉe Facebook.]";
$a->strings["Post to Facebook by default"] = "Ĉiam afiŝi al Facebook.";
$a->strings["None"] = "Nenio";
$a->strings["Submit"] = "Sendi";
$a->strings["Facebook"] = "Facebook";
$a->strings["Facebook Post Settings"] = "";
$a->strings["Facebook API Key"] = "Facebook API ŝlosilo";
$a->strings["Error: it appears that you have specified the App-ID and -Secret in your .htconfig.php file. As long as they are specified there, they cannot be set using this form.<br><br>"] = "Eraro: Ŝajnas kvazaŭ vi agordis la App-ID kaj la sekreton en via .htconfig.php dosiero. Kiam ili estas agordita tie, vi ne povas agordi ĝin en tiu ĉi formo.<br><br>";
$a->strings["App-ID / API-Key"] = "Programo ID / API Ŝlosilo";
$a->strings["Application secret"] = "Programo sekreto";
$a->strings["Save"] = "Konservi";
$a->strings["The new values have been saved."] = "Konservis novajn valorojn.";
$a->strings["Post to Facebook"] = "Afiŝi al Facebook";
$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "Afiŝado al Facebook nuligita ĉar okazis konflikto en la multretpermesoj.";
$a->strings["View on Friendica"] = "Vidi ĉe Friendica";
$a->strings["Facebook post failed. Queued for retry."] = "Malsukcesis afiŝi ĉe Facebook. Enigita en vico.";
$a->strings["Administrator"] = "Administranto";
$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "Via Facbook konekto iĝis nevalida. Bonvolu reaŭtentiĝi.";
$a->strings["Facebook connection became invalid"] = "Facebook konekto iĝis nevalida.";

View file

@ -0,0 +1,28 @@
<?php
$a->strings["Settings updated."] = "Configuración actualizada.";
$a->strings["Permission denied."] = "Permiso denegado.";
$a->strings["Facebook Post disabled"] = "Facebook deshabilitado";
$a->strings["Facebook API key is missing."] = "Falta la clave API de Facebook.";
$a->strings["Facebook Post"] = "Facebook";
$a->strings["Install Facebook Post connector for this account."] = "Instalar el conector de Facebook para esta cuenta.";
$a->strings["Remove Facebook Post connector"] = "Eliminar el conector de Facebook";
$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "Volver a identificarse [Esto es necesario cada vez que tu contraseña de Facebook cambie.]";
$a->strings["Post to Facebook by default"] = "Publicar en Facebook de forma predeterminada";
$a->strings["None"] = "Ninguna";
$a->strings["Submit"] = "Envíar";
$a->strings["Facebook"] = "Facebook";
$a->strings["Facebook Post Settings"] = "Configuración de conexión a Facebook";
$a->strings["Facebook API Key"] = "Llave API de Facebook";
$a->strings["Error: it appears that you have specified the App-ID and -Secret in your .htconfig.php file. As long as they are specified there, they cannot be set using this form.<br><br>"] = "Error: parece que la App-ID y el -Secret ya están configurados en tu archivo .htconfig.php. Al estar configurados allí, no se usará este formulario.<br><br>";
$a->strings["App-ID / API-Key"] = "Añadir ID / Llave API";
$a->strings["Application secret"] = "Secreto de la aplicación";
$a->strings["Save"] = "Guardar";
$a->strings["The new values have been saved."] = "Los nuevos valores se han guardado.";
$a->strings["Post to Facebook"] = "Publicar en Facebook";
$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "Publicación en Facebook cancelada debido a un conflicto con los permisos de acceso a la multi-red.";
$a->strings["View on Friendica"] = "Ver en Friendica";
$a->strings["Facebook post failed. Queued for retry."] = "Publicación en Facebook errónea. Reintentando...";
$a->strings["Administrator"] = "Administrador";
$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "Tu conexión con Facebook ha sido invalidada. Por favor vuelve a identificarte.";
$a->strings["Facebook connection became invalid"] = "La conexión con Facebook ha sido invalidada";

View file

@ -0,0 +1,28 @@
<?php
$a->strings["Settings updated."] = "Réglages mis à jour.";
$a->strings["Permission denied."] = "Permission refusée.";
$a->strings["Facebook Post disabled"] = "Publications Facebook désactivées";
$a->strings["Facebook API key is missing."] = "Clé d'API Facebook manquante.";
$a->strings["Facebook Post"] = "Publications Facebook";
$a->strings["Install Facebook Post connector for this account."] = "Installer le connecteur Facebook pour ce compte.";
$a->strings["Remove Facebook Post connector"] = "Retirer le connecteur Facebook";
$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "Se ré-authentifier [nécessaire chaque fois que vous changez votre mot de passe Facebook.]";
$a->strings["Post to Facebook by default"] = "Poster sur Facebook par défaut";
$a->strings["None"] = "Aucun(e)";
$a->strings["Submit"] = "Envoyer";
$a->strings["Facebook"] = "Facebook";
$a->strings["Facebook Post Settings"] = "Réglages Facebook";
$a->strings["Facebook API Key"] = "Clé d'API Facebook";
$a->strings["Error: it appears that you have specified the App-ID and -Secret in your .htconfig.php file. As long as they are specified there, they cannot be set using this form.<br><br>"] = "Erreur: il semble que vous ayez spécifié un App-ID et un Secret dans votre fichier .htconfig.php. Tant qu'ils y seront, vous ne pourrez les configurer avec ce formulaire.<br /><br />";
$a->strings["App-ID / API-Key"] = "App-ID / Clé d'API";
$a->strings["Application secret"] = "Secret de l'application";
$a->strings["Save"] = "Sauver";
$a->strings["The new values have been saved."] = "Les nouvelles valeurs ont été sauvées.";
$a->strings["Post to Facebook"] = "Poster sur Facebook";
$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "Publication sur Facebook annulée pour cause de conflit de permissions inter-réseaux.";
$a->strings["View on Friendica"] = "Voir sur Friendica";
$a->strings["Facebook post failed. Queued for retry."] = "Publication sur Facebook échouée. En attente pour re-tentative.";
$a->strings["Administrator"] = "Administrateur";
$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "Votre connexion à Facebook est devenue invalide. Merci de vous ré-authentifier.";
$a->strings["Facebook connection became invalid"] = "La connexion Facebook est devenue invalide";

View file

@ -0,0 +1,28 @@
<?php
$a->strings["Settings updated."] = "Stillingar uppfærðar";
$a->strings["Permission denied."] = "Heimild ekki veitt.";
$a->strings["Facebook Post disabled"] = "";
$a->strings["Facebook API key is missing."] = "Facebook API lykill er ekki til staðar.";
$a->strings["Facebook Post"] = "";
$a->strings["Install Facebook Post connector for this account."] = "";
$a->strings["Remove Facebook Post connector"] = "";
$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "Þörf er á endurauðkenningu [Þetta þarf að gera í hvert skipti sem Facebook aðgangsorði er breytt.]";
$a->strings["Post to Facebook by default"] = "Senda sjálfgefið færslur á Facebook ";
$a->strings["None"] = "Ekkert";
$a->strings["Submit"] = "Senda inn";
$a->strings["Facebook"] = "Facebook";
$a->strings["Facebook Post Settings"] = "";
$a->strings["Facebook API Key"] = "";
$a->strings["Error: it appears that you have specified the App-ID and -Secret in your .htconfig.php file. As long as they are specified there, they cannot be set using this form.<br><br>"] = "";
$a->strings["App-ID / API-Key"] = "";
$a->strings["Application secret"] = "";
$a->strings["Save"] = "Vista";
$a->strings["The new values have been saved."] = "";
$a->strings["Post to Facebook"] = "Senda á Facebook";
$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "Hætt við færslu á Facebook vegna marg nets aðgangs átaka.";
$a->strings["View on Friendica"] = "Skoða á Friendica";
$a->strings["Facebook post failed. Queued for retry."] = "Færsla sem átti að flæða yfir á Facebook mistókst. Sett í biðröð til endurtekningar.";
$a->strings["Administrator"] = "Kerfisstjóri";
$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "";
$a->strings["Facebook connection became invalid"] = "";

View file

@ -0,0 +1,32 @@
<?php
$a->strings["Settings updated."] = "Impostazioni aggiornate.";
$a->strings["Permission denied."] = "Permesso negato.";
$a->strings["Facebook Post disabled"] = "";
$a->strings["Facebook API key is missing."] = "Chiave API Facebook mancante.";
$a->strings["Facebook Post"] = "";
$a->strings["Install Facebook Post connector for this account."] = "";
$a->strings["Remove Facebook Post connector"] = "";
$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "Ri-autentica [Questo è necessario ogni volta che cambia la password di Facebook.]";
$a->strings["Post to Facebook by default"] = "Invia sempre a Facebook";
$a->strings["Suppress \"View on friendica\""] = "";
$a->strings["Mirror wall posts from facebook to friendica."] = "";
$a->strings["Post to page/group:"] = "";
$a->strings["None"] = "Nessuna";
$a->strings["Submit"] = "Invia";
$a->strings["Facebook"] = "Facebook";
$a->strings["Facebook Post Settings"] = "";
$a->strings["Facebook API Key"] = "Facebook API Key";
$a->strings["Error: it appears that you have specified the App-ID and -Secret in your .htconfig.php file. As long as they are specified there, they cannot be set using this form.<br><br>"] = "Error: it appears that you have specified the App-ID and -Secret in your .htconfig.php file. As long as they are specified there, they cannot be set using this form.<br><br>";
$a->strings["App-ID / API-Key"] = "App-ID / API-Key";
$a->strings["Application secret"] = "Application secret";
$a->strings["Save"] = "Salva";
$a->strings["The new values have been saved."] = "I nuovi valori sono stati salvati.";
$a->strings["Post to Facebook"] = "Invia a Facebook";
$a->strings["%s:"] = "";
$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "Invio su Facebook annullato per un conflitto nei permessi di accesso.";
$a->strings["View on Friendica"] = "Vedi su Friendica";
$a->strings["Facebook post failed. Queued for retry."] = "Invio a Facebook fallito. In attesa di riprovare.";
$a->strings["Administrator"] = "Amministratore";
$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "La tua connessione con Facebook è diventata invalida. Per favore ri-autenticati.";
$a->strings["Facebook connection became invalid"] = "La connessione Facebook è diventata invalida.";

View file

@ -0,0 +1,28 @@
<?php
$a->strings["Settings updated."] = "Innstillinger oppdatert.";
$a->strings["Permission denied."] = "Ingen tilgang.";
$a->strings["Facebook Post disabled"] = "";
$a->strings["Facebook API key is missing."] = "Facebook API-nøkkel mangler.";
$a->strings["Facebook Post"] = "";
$a->strings["Install Facebook Post connector for this account."] = "";
$a->strings["Remove Facebook Post connector"] = "";
$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "";
$a->strings["Post to Facebook by default"] = "Post til Facebook som standard";
$a->strings["None"] = "Ingen";
$a->strings["Submit"] = "Lagre";
$a->strings["Facebook"] = "Facebook";
$a->strings["Facebook Post Settings"] = "";
$a->strings["Facebook API Key"] = "";
$a->strings["Error: it appears that you have specified the App-ID and -Secret in your .htconfig.php file. As long as they are specified there, they cannot be set using this form.<br><br>"] = "";
$a->strings["App-ID / API-Key"] = "";
$a->strings["Application secret"] = "";
$a->strings["Save"] = "Lagre";
$a->strings["The new values have been saved."] = "";
$a->strings["Post to Facebook"] = "Post til Facebook";
$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "Posting til Facebook avbrutt på grunn av konflikt med tilgangsrettigheter i multi-nettverk.";
$a->strings["View on Friendica"] = "";
$a->strings["Facebook post failed. Queued for retry."] = "Facebook-innlegg mislyktes. Innlegget er lagt i kø for å prøve igjen.";
$a->strings["Administrator"] = "Administrator";
$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "";
$a->strings["Facebook connection became invalid"] = "";

View file

@ -0,0 +1,32 @@
<?php
$a->strings["Settings updated."] = "Zaktualizowano ustawienia.";
$a->strings["Permission denied."] = "Brak uprawnień.";
$a->strings["Facebook Post disabled"] = "";
$a->strings["Facebook API key is missing."] = "Brakuje klucza API z facebooka.";
$a->strings["Facebook Post"] = "Wpis z Facebooka";
$a->strings["Install Facebook Post connector for this account."] = "";
$a->strings["Remove Facebook Post connector"] = "";
$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "Ponowna autoryzacja [Jest wymagana jeśli twoje hasło do Facebooka jest zmienione]";
$a->strings["Post to Facebook by default"] = "Domyślnie opublikuj na stronie Facebook";
$a->strings["Suppress \"View on friendica\""] = "";
$a->strings["Mirror wall posts from facebook to friendica."] = "";
$a->strings["Post to page/group:"] = "Napisz na stronę/grupę:";
$a->strings["None"] = "Brak";
$a->strings["Submit"] = "Potwierdź";
$a->strings["Facebook"] = "Facebook";
$a->strings["Facebook Post Settings"] = "Ustawienia wpisu z Facebooka";
$a->strings["Facebook API Key"] = "Facebook API Key";
$a->strings["Error: it appears that you have specified the App-ID and -Secret in your .htconfig.php file. As long as they are specified there, they cannot be set using this form.<br><br>"] = "";
$a->strings["App-ID / API-Key"] = "App-ID / API-Key";
$a->strings["Application secret"] = "";
$a->strings["Save"] = "Zapisz";
$a->strings["The new values have been saved."] = "";
$a->strings["Post to Facebook"] = "Post na Facebook";
$a->strings["%s:"] = "";
$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "Publikacja na stronie Facebook nie powiodła się z powodu braku dostępu do sieci";
$a->strings["View on Friendica"] = "Zobacz na Friendice";
$a->strings["Facebook post failed. Queued for retry."] = "";
$a->strings["Administrator"] = "Administrator";
$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "";
$a->strings["Facebook connection became invalid"] = "Błędne połączenie z Facebookiem";

View file

@ -0,0 +1,28 @@
<?php
$a->strings["Settings updated."] = "As configurações foram atualizadas.";
$a->strings["Permission denied."] = "Permissão negada.";
$a->strings["Facebook Post disabled"] = "A publicação no Facebook foi desabilitada";
$a->strings["Facebook API key is missing."] = "A chave de API do Facebook não foi encontrada.";
$a->strings["Facebook Post"] = "Publicação no Facebook";
$a->strings["Install Facebook Post connector for this account."] = "Instalar o conector de publicação no Facebook para esta conta.";
$a->strings["Remove Facebook Post connector"] = "Remover o conector de publicação no Facebook";
$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "Reautenticar [Isso é necessário sempre que sua senha do Facebook é modificada.]";
$a->strings["Post to Facebook by default"] = "Publicar no Facebook por padrão";
$a->strings["None"] = "Nenhuma";
$a->strings["Submit"] = "Enviar";
$a->strings["Facebook"] = "Facebook";
$a->strings["Facebook Post Settings"] = "Configurações de publicação no Facebook";
$a->strings["Facebook API Key"] = "Chave da API do Facebook";
$a->strings["Error: it appears that you have specified the App-ID and -Secret in your .htconfig.php file. As long as they are specified there, they cannot be set using this form.<br><br>"] = "Erro: parece que você especificou o App-ID e o -Secret no arquivo .htconfig.php. Uma vez estão especificado lá, eles não podem ser definidos neste formulário.<br><br>";
$a->strings["App-ID / API-Key"] = "App-ID / API-Key";
$a->strings["Application secret"] = "Segredo da aplicação";
$a->strings["Save"] = "Salvar";
$a->strings["The new values have been saved."] = "Os novos valores foram salvos.";
$a->strings["Post to Facebook"] = "Publicar no Facebook";
$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "A publicação no Facebook foi cancelada devido a um conflito de permissão de acesso multi-rede.";
$a->strings["View on Friendica"] = "Ver no Friendica";
$a->strings["Facebook post failed. Queued for retry."] = "Não foi possível publicar no Facebook. Armazenado na fila para nova tentativa.";
$a->strings["Administrator"] = "Administrador";
$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "A sua conexão com o Facebook tornou-se invalida. Por favor autentique-se novamente.";
$a->strings["Facebook connection became invalid"] = "A conexão com o Facebook tornou-se inválida";

View file

@ -0,0 +1,28 @@
<?php
$a->strings["Settings updated."] = "Настройки обновлены.";
$a->strings["Permission denied."] = "Нет разрешения.";
$a->strings["Facebook Post disabled"] = "";
$a->strings["Facebook API key is missing."] = "Отсутствует ключ Facebook API.";
$a->strings["Facebook Post"] = "";
$a->strings["Install Facebook Post connector for this account."] = "";
$a->strings["Remove Facebook Post connector"] = "";
$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "Переаутентификация [Это необходимо, если вы изменили пароль на Facebook.]";
$a->strings["Post to Facebook by default"] = "Отправлять на Facebook по умолчанию";
$a->strings["None"] = "Ничего";
$a->strings["Submit"] = "Подтвердить";
$a->strings["Facebook"] = "Facebook";
$a->strings["Facebook Post Settings"] = "";
$a->strings["Facebook API Key"] = "Facebook API Key";
$a->strings["Error: it appears that you have specified the App-ID and -Secret in your .htconfig.php file. As long as they are specified there, they cannot be set using this form.<br><br>"] = "";
$a->strings["App-ID / API-Key"] = "App-ID / API-Key";
$a->strings["Application secret"] = "Секрет приложения";
$a->strings["Save"] = "Сохранить";
$a->strings["The new values have been saved."] = "";
$a->strings["Post to Facebook"] = "Отправить на Facebook";
$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "Отправка на Facebook отменена из-за конфликта разрешений доступа разных сетей.";
$a->strings["View on Friendica"] = "";
$a->strings["Facebook post failed. Queued for retry."] = "Ошибка отправки сообщения на Facebook. В очереди на еще одну попытку.";
$a->strings["Administrator"] = "Администратор";
$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "";
$a->strings["Facebook connection became invalid"] = "Facebook подключение не удалось";

View file

@ -0,0 +1,10 @@
<?php
$a->strings["Settings updated."] = "Inst&auml;llningarna har uppdaterats.";
$a->strings["Permission denied."] = "&Aring;tkomst nekad.";
$a->strings["Facebook API key is missing."] = "Facebook API key is missing.";
$a->strings["Post to Facebook by default"] = "L&auml;gg alltid in inl&auml;ggen p&aring; Facebook";
$a->strings["Submit"] = "Spara";
$a->strings["Facebook"] = "Facebook";
$a->strings["Post to Facebook"] = "L&auml;gg in p&aring; Facebook";
$a->strings["Administrator"] = "Admin";

View file

@ -0,0 +1,32 @@
<?php
$a->strings["Settings updated."] = "设置跟新了";
$a->strings["Permission denied."] = "权限不够。";
$a->strings["Facebook Post disabled"] = "使Facebook文章不可用的";
$a->strings["Facebook API key is missing."] = "Facebook API钥匙失踪的。";
$a->strings["Facebook Post"] = "Facebook文章";
$a->strings["Install Facebook Post connector for this account."] = "安装Facebook文章连接器为这个账户";
$a->strings["Remove Facebook Post connector"] = "把Facebook文章连接器删除";
$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "复认证[这是必要的每当您Facebook密码变化了]";
$a->strings["Post to Facebook by default"] = "默认地放在Facebook";
$a->strings["Suppress \"View on friendica\""] = "禁止「看在Friendica」";
$a->strings["Mirror wall posts from facebook to friendica."] = "复制墙文章从facebook到friendica。";
$a->strings["Post to page/group:"] = "放在页/组:";
$a->strings["None"] = "没有";
$a->strings["Submit"] = "提交";
$a->strings["Facebook"] = "Facebook";
$a->strings["Facebook Post Settings"] = "Facebook文章设置";
$a->strings["Facebook API Key"] = "Facebook API密码";
$a->strings["Error: it appears that you have specified the App-ID and -Secret in your .htconfig.php file. As long as they are specified there, they cannot be set using this form.<br><br>"] = "错误看上去您输入App-ID和-Secret在您的.htconfig.php文件。它们那里输入的时候您不能把他们在这个表格输入。<br><br>";
$a->strings["App-ID / API-Key"] = "App-ID / API-Key";
$a->strings["Application secret"] = "应用密码";
$a->strings["Save"] = "保存";
$a->strings["The new values have been saved."] = "新的设置保存了。";
$a->strings["Post to Facebook"] = "放在Facebook";
$a->strings["%s:"] = "%s";
$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "发送到Facebook取消由于多网络准许矛盾。";
$a->strings["View on Friendica"] = "看在Friendica";
$a->strings["Facebook post failed. Queued for retry."] = "Facebook发送失败了。排队着待再试。";
$a->strings["Administrator"] = "管理员";
$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "您Facebook联系成无效的。请再认证。";
$a->strings["Facebook connection became invalid"] = "Facebook联系成无效的";

5
fbsync/README.md Normal file
View file

@ -0,0 +1,5 @@
> # Note
> **Facebook Connector, Facebook Post Connector and Facebook Sync plugins are deprecated.**
> As of the moment you cannot bridge from or to Facebook with Friendica.

15
fbsync/fbsync.css Normal file
View file

@ -0,0 +1,15 @@
#fbsync-enable-label, #fbsync-create_user-label {
float: left;
width: 200px;
margin-top: 10px;
}
#fbsync-checkbox, #fbsync-create_user {
float: left;
margin-top: 10px;
}
#fbsync-submit {
margin-top: 15px;
}

1146
fbsync/fbsync.php Normal file
View file

@ -0,0 +1,1146 @@
<?php
/**
* Name: Facebook Sync
* Description: Synchronizes the Facebook Newsfeed
* Version: 1.0
* Author: Michael Vogel <https://pirati.ca/profile/heluecht>
* Status: Unsupported
*/
/* To-Do
FBSync:
- B: Threading for incoming comments
- C: Receiving likes for comments
FBPost:
- A: Posts to pages currently have the page as sender - not the user
- B: Sending likes for comments
- C: Threading for sent comments
*/
require_once("addon/fbpost/fbpost.php");
define('FBSYNC_DEFAULT_POLL_INTERVAL', 5); // given in minutes
function fbsync_install() {
register_hook('connector_settings', 'addon/fbsync/fbsync.php', 'fbsync_settings');
register_hook('connector_settings_post', 'addon/fbsync/fbsync.php', 'fbsync_settings_post');
register_hook('cron', 'addon/fbsync/fbsync.php', 'fbsync_cron');
register_hook('follow', 'addon/fbsync/fbsync.php', 'fbsync_follow');
register_hook('expire', 'addon/fbsync/fbsync.php', 'fbsync_expire');
}
function fbsync_uninstall() {
unregister_hook('connector_settings', 'addon/fbsync/fbsync.php', 'fbsync_settings');
unregister_hook('connector_settings_post', 'addon/fbsync/fbsync.php', 'fbsync_settings_post');
unregister_hook('cron', 'addon/fbsync/fbsync.php', 'fbsync_cron');
unregister_hook('follow', 'addon/fbsync/fbsync.php', 'fbsync_follow');
unregister_hook('expire', 'addon/fbsync/fbsync.php', 'fbsync_expire');
}
function fbsync_follow($a, &$contact) {
logger("fbsync_follow: Check if contact is facebook contact. ".$contact["url"], LOGGER_DEBUG);
if (!strstr($contact["url"], "://www.facebook.com") && !strstr($contact["url"], "://facebook.com") && !strstr($contact["url"], "@facebook.com"))
return;
// contact seems to be a facebook contact, so continue
$nickname = preg_replace("=https?://.*facebook.com/([\w.]*).*=ism", "$1", $contact["url"]);
$nickname = str_replace("@facebook.com", "", $nickname);
$uid = $a->user["uid"];
$access_token = get_pconfig($uid,'facebook','access_token');
$fql = array(
"profile" => "SELECT id, pic_square, url, username, name FROM profile WHERE username = '$nickname'",
"avatar" => "SELECT url FROM square_profile_pic WHERE id IN (SELECT id FROM #profile) AND size = 256");
$url = "https://graph.facebook.com/fql?q=".urlencode(json_encode($fql))."&access_token=".$access_token;
$feed = fetch_url($url);
$data = json_decode($feed);
$id = 0;
logger("fbsync_follow: Query id for nickname ".$nickname, LOGGER_DEBUG);
if (!is_array($data->data))
return;
$contactdata = new stdClass;
foreach($data->data AS $query) {
switch ($query->name) {
case "profile":
$contactdata->id = number_format($query->fql_result_set[0]->id, 0, '', '');
$contactdata->pic_square = $query->fql_result_set[0]->pic_square;
$contactdata->url = $query->fql_result_set[0]->url;
$contactdata->username = $query->fql_result_set[0]->username;
$contactdata->name = $query->fql_result_set[0]->name;
break;
case "avatar":
$contactdata->pic_square = $query->fql_result_set[0]->url;
break;
}
}
logger("fbsync_follow: Got contact for nickname ".$nickname." ".print_r($contactdata, true), LOGGER_DEBUG);
// Create contact
fbsync_fetch_contact($uid, $contactdata, true);
$r = q("SELECT name,nick,url,addr,batch,notify,poll,request,confirm,poco,photo,priority,network,alias,pubkey
FROM `contact` WHERE `uid` = %d AND `alias` = '%s'",
intval($uid),
dbesc("facebook::".$contactdata->id));
if (count($r))
$contact["contact"] = $r[0];
}
function fbsync_settings(&$a,&$s) {
// Settings are done inside the fbpost addon
return;
if(! local_user())
return;
/* Add our stylesheet to the page so we can make our settings look nice */
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/fbsync/fbsync.css' . '" media="all" />' . "\r\n";
/* Get the current state of our config variables */
$enabled = get_pconfig(local_user(),'fbsync','sync');
$checked = (($enabled) ? ' checked="checked" ' : '');
$def_enabled = get_pconfig(local_user(),'fbsync','create_user');
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
/* Add some HTML to the existing form */
$s .= '<span id="settings_fbsync_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_fbsync_expanded\'); openClose(\'settings_fbsync_inflated\');">';
$s .= '<img class="connector" src="images/facebook.png" /><h3 class="connector">'. t('Facebook Import').'</h3>';
$s .= '</span>';
$s .= '<div id="settings_fbsync_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_fbsync_expanded\'); openClose(\'settings_fbsync_inflated\');">';
$s .= '<img class="connector" src="images/facebook.png" /><h3 class="connector">'. t('Facebook Import').'</h3>';
$s .= '</span>';
$s .= '<div id="fbsync-enable-wrapper">';
$s .= '<label id="fbsync-enable-label" for="fbsync-checkbox">' . t('Import Facebook newsfeed') . '</label>';
$s .= '<input id="fbsync-checkbox" type="checkbox" name="fbsync" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="fbsync-create_user-wrapper">';
$s .= '<label id="fbsync-create_user-label" for="fbsync-create_user">' . t('Automatically create contacts') . '</label>';
$s .= '<input id="fbsync-create_user" type="checkbox" name="create_user" value="1" ' . $def_checked . '/>';
$s .= '</div><div class="clear"></div>';
/* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="fbsync-submit" name="fbsync-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>';
}
function fbsync_settings_post(&$a,&$b) {
if(x($_POST,'fbsync-submit')) {
set_pconfig(local_user(),'fbsync','sync',intval($_POST['fbsync']));
set_pconfig(local_user(),'fbsync','create_user',intval($_POST['create_user']));
}
}
function fbsync_cron($a,$b) {
$last = get_config('fbsync','last_poll');
$poll_interval = intval(get_config('fbsync','poll_interval'));
if(! $poll_interval)
$poll_interval = FBSYNC_DEFAULT_POLL_INTERVAL;
if($last) {
$next = $last + ($poll_interval * 60);
if($next > time()) {
logger('fbsync_cron: poll intervall not reached');
return;
}
}
logger('fbsync_cron: cron_start');
$abandon_days = intval(get_config('system','account_abandon_days'));
if ($abandon_days < 1)
$abandon_days = 0;
$abandon_limit = date("Y-m-d H:i:s", time() - $abandon_days * 86400);
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'fbsync' AND `k` = 'sync' AND `v` = '1' ORDER BY RAND()");
if(count($r)) {
foreach($r as $rr) {
if ($abandon_days != 0) {
$user = q("SELECT `login_date` FROM `user` WHERE uid=%d AND `login_date` >= '%s'", $rr['uid'], $abandon_limit);
if (!count($user)) {
logger('abandoned account: timeline from user '.$rr['uid'].' will not be imported');
continue;
}
}
fbsync_get_self($rr['uid']);
logger('fbsync_cron: importing timeline from user '.$rr['uid']);
fbsync_fetchfeed($a, $rr['uid']);
}
}
logger('fbsync_cron: cron_end');
set_config('fbsync','last_poll', time());
}
function fbsync_expire($a,$b) {
$days = get_config('fbsync', 'expire');
if ($days == 0)
return;
$r = q("DELETE FROM `item` WHERE `deleted` AND `network` = '%s'", dbesc(NETWORK_FACEBOOK));
require_once("include/items.php");
logger('fbsync_expire: expire_start');
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'fbsync' AND `k` = 'sync' AND `v` = '1' ORDER BY RAND()");
if(count($r)) {
foreach($r as $rr) {
logger('fbsync_expire: user '.$rr['uid']);
item_expire($rr['uid'], $days, NETWORK_FACEBOOK, true);
}
}
logger('fbsync_expire: expire_end');
}
function fbsync_createpost($a, $uid, $self, $contacts, $applications, $post, $create_user) {
$access_token = get_pconfig($uid,'facebook','access_token');
require_once("include/oembed.php");
require_once("include/network.php");
require_once("include/items.php");
// check if it was already imported
$r = q("SELECT * FROM `item` WHERE `uid` = %d AND `uri` = '%s' LIMIT 1",
intval($uid),
dbesc('fb::'.$post->post_id)
);
if(count($r))
return;
$postarray = array();
$postarray['gravity'] = 0;
$postarray['uid'] = $uid;
$postarray['wall'] = 0;
$postarray['verb'] = ACTIVITY_POST;
$postarray['object-type'] = ACTIVITY_OBJ_NOTE; // default value - is maybe changed later when media is attached
$postarray['network'] = dbesc(NETWORK_FACEBOOK);
$postarray['uri'] = "fb::".$post->post_id;
$postarray['thr-parent'] = $postarray['uri'];
$postarray['parent-uri'] = $postarray['uri'];
$postarray['plink'] = $post->permalink;
$postarray['author-name'] = $contacts[$post->actor_id]->name;
$postarray['author-link'] = $contacts[$post->actor_id]->url;
$postarray['author-avatar'] = $contacts[$post->actor_id]->pic_square;
$postarray['owner-name'] = $contacts[$post->source_id]->name;
$postarray['owner-link'] = $contacts[$post->source_id]->url;
$postarray['owner-avatar'] = $contacts[$post->source_id]->pic_square;
$contact_id = 0;
if (($post->parent_post_id != "") && ($post->actor_id == $post->source_id)) {
$pos = strpos($post->parent_post_id, "_");
if ($pos != 0) {
$user_id = substr($post->parent_post_id, 0, $pos);
$userdata = fbsync_fetchuser($a, $uid, $user_id);
$contact_id = $userdata["contact-id"];
$postarray['contact-id'] = $contact_id;
if (array_key_exists("name", $userdata) && ($userdata["name"] != "") && !link_compare($userdata["link"], $postarray['author-link'])) {
$postarray['owner-name'] = $userdata["name"];
$postarray['owner-link'] = $userdata["link"];
$postarray['owner-avatar'] = $userdata["avatar"];
if (!intval(get_config('system','wall-to-wall_share'))) {
$prebody = "[share author='".$postarray['author-name'].
"' profile='".$postarray['author-link'].
"' avatar='".$postarray['author-avatar']."']";
$postarray['author-name'] = $postarray['owner-name'];
$postarray['author-link'] = $postarray['owner-link'];
$postarray['author-avatar'] = $postarray['owner-avatar'];
}
}
}
}
if ($contact_id <= 0) {
if ($post->actor_id != $post->source_id) {
// Testing if we know the source or the actor
$contact_id = fbsync_fetch_contact($uid, $contacts[$post->source_id], false);
if (($contact_id == 0) && array_key_exists($post->actor_id, $contacts))
$contact_id = fbsync_fetch_contact($uid, $contacts[$post->actor_id], false);
// If we don't know anyone, we guess we should know the source. Could be the wrong decision
if ($contact_id == 0)
$contact_id = fbsync_fetch_contact($uid, $contacts[$post->source_id], $create_user);
} else
$contact_id = fbsync_fetch_contact($uid, $contacts[$post->source_id], $create_user);
if ($contact_id == -1) {
logger('fbsync_createpost: Contact is blocked. Post not imported '.print_r($post, true), LOGGER_DEBUG);
return;
} elseif (($contact_id <= 0) && !$create_user) {
logger('fbsync_createpost: No matching contact found. Post not imported '.print_r($post, true), LOGGER_DEBUG);
return;
} elseif ($contact_id == 0) {
// This case should never happen
logger('fbsync_createpost: No matching contact found. Using own id. (Should never happen) '.print_r($post, true), LOGGER_DEBUG);
$contact_id = $self[0]["id"];
}
$postarray['contact-id'] = $contact_id;
}
$postarray["body"] = (isset($post->message) ? escape_tags($post->message) : '');
$msgdata = fbsync_convertmsg($a, $postarray["body"]);
$postarray["body"] = $msgdata["body"];
$postarray["tag"] = $msgdata["tags"];
// Change the object type when an attachment is present
if (isset($post->attachment->fb_object_type))
logger('fb_object_type: '.$post->attachment->fb_object_type." ".print_r($post->attachment, true), LOGGER_DEBUG);
switch ($post->attachment->fb_object_type) {
case 'photo':
$postarray['object-type'] = ACTIVITY_OBJ_IMAGE; // photo is deprecated: http://activitystrea.ms/head/activity-schema.html#image
break;
case 'video':
$postarray['object-type'] = ACTIVITY_OBJ_VIDEO;
break;
case '':
//$postarray['object-type'] = ACTIVITY_OBJ_BOOKMARK;
break;
default:
logger('Unknown object type '.$post->attachment->fb_object_type, LOGGER_DEBUG);
break;
}
$pagedata = array();
$content = "";
$pagedata["type"] = "";
if (isset($post->attachment->name) && isset($post->attachment->href)) {
$post->attachment->href = original_url($post->attachment->href);
$oembed_data = oembed_fetch_url($post->attachment->href);
$pagedata["type"] = $oembed_data->type;
if ($pagedata["type"] == "rich")
$pagedata["type"] = "link";
$pagedata["url"] = $post->attachment->href;
$pagedata["title"] = $post->attachment->name;
$content = "[bookmark=".$post->attachment->href."]".$post->attachment->name."[/bookmark]";
// If a link is not only attached but also added in the body, look if it can be removed in the body.
$removedlink = trim(str_replace($post->attachment->href, "", $postarray["body"]));
if (($removedlink == "") || strstr($postarray["body"], $removedlink))
$postarray["body"] = $removedlink;
} elseif (isset($post->attachment->name) && ($post->attachment->name != ""))
$content = "[b]" . $post->attachment->name."[/b]";
$pagedata["text"] = "";
if (isset($post->attachment->description) && ($post->attachment->fb_object_type != "photo"))
$pagedata["text"] = $post->attachment->description;
if (isset($post->attachment->caption) && ($post->attachment->fb_object_type == "photo"))
$pagedata["text"] = $post->attachment->caption;
if ($pagedata["text"].$post->attachment->href.$content.$postarray["body"] == "")
return;
if (isset($post->attachment->media) && (($pagedata["type"] == "") || ($pagedata["type"] == "link"))) {
foreach ($post->attachment->media AS $media) {
if (isset($media->type))
$pagedata["type"] = $media->type;
if (isset($media->src))
$pagedata["images"][0]["src"] = $media->src;
if (isset($media->photo)) {
if (isset($media->photo->images) && (count($media->photo->images) > 1))
$pagedata["images"][0]["src"] = $media->photo->images[1]->src;
if (isset($media->photo->fbid)) {
logger('fbsync_createpost: fetching fbid '.$media->photo->fbid, LOGGER_DEBUG);
$url = "https://graph.facebook.com/".$media->photo->fbid."?access_token=".$access_token;
$feed = fetch_url($url);
$data = json_decode($feed);
if (isset($data->images)) {
$pagedata["images"][0]["src"] = $data->images[0]->source;
logger('fbsync_createpost: got fbid '.$media->photo->fbid.' image '.$pagedata["images"][0]["src"], LOGGER_DEBUG);
} else
logger('fbsync_createpost: error fetching fbid '.$media->photo->fbid.' '.print_r($data, true), LOGGER_DEBUG);
}
}
$pagedata["images"][0]["src"] = fbpost_cleanpicture($pagedata["images"][0]["src"]);
if (isset($media->href) && ($pagedata["images"][0]["src"] != "") && ($media->href != "")) {
$media->href = original_url($media->href);
$pagedata["url"] = $media->href;
$content .= "\n".'[url='.$media->href.'][img]'.$pagedata["images"][0]["src"].'[/img][/url]';
} else {
if ($pagedata["images"][0]["src"] != "")
$content .= "\n".'[img]'.$pagedata["images"][0]["src"].'[/img]';
// if just a link, it may be a wall photo - check
if (isset($post->link))
$content .= fbpost_get_photo($media->href);
}
}
}
if ($pagedata["type"] != "") {
if ($pagedata["type"] == "link")
$postarray["object-type"] = ACTIVITY_OBJ_BOOKMARK;
$postarray["body"] .= add_page_info_data($pagedata);
} else {
if ($content)
$postarray["body"] .= "\n".trim($content);
if ($pagedata["text"])
$postarray["body"] .= "\n[quote]".trim($pagedata["text"])."[/quote]";
$postarray["body"] = trim($postarray["body"]);
}
if (trim($postarray["body"]) == "")
return;
if ($prebody != "")
$postarray["body"] = $prebody.$postarray["body"]."[/share]";
$postarray['created'] = datetime_convert('UTC','UTC',date("c", $post->created_time));
$postarray['edited'] = datetime_convert('UTC','UTC',date("c", $post->updated_time));
$postarray['app'] = $applications[$post->app_id]->display_name;
if ($postarray['app'] == "")
$postarray['app'] = "Facebook";
if(isset($post->privacy) && $post->privacy->value !== '') {
$postarray['private'] = 1;
$postarray['allow_cid'] = '<' . $self[0]['id'] . '>';
}
/*
$postarray["location"] = $post->place->name;
postarray["coord"] = $post->geo->coordinates[0]." ".$post->geo->coordinates[1];
*/
//$types = array(46, 80, 237, 247, 308);
//if (!in_array($post->type, $types))
// $postarray["body"] = "Type: ".$post->type."\n".$postarray["body"];
//print_r($post);
//print_r($postarray);
$item = item_store($postarray);
logger('fbsync_createpost: User '.$self[0]["nick"].' posted feed item '.$item, LOGGER_DEBUG);
}
function fbsync_createcomment($a, $uid, $self_id, $self, $user, $contacts, $applications, $comment) {
// check if it was already imported
$r = q("SELECT `uri` FROM `item` WHERE `uid` = %d AND `uri` = '%s' LIMIT 1",
intval($uid),
dbesc('fb::'.$comment->id)
);
if(count($r))
return;
// check if it was an own post (separate posting for performance reasons)
$r = q("SELECT `uri` FROM `item` WHERE `uid` = %d AND `extid` = '%s' LIMIT 1",
intval($uid),
dbesc('fb::'.$comment->id)
);
if(count($r))
return;
$parent_uri = "";
$parent_contact = 0;
$parent_nick = "";
// Fetch the parent uri (Checking if the parent exists)
$r = q("SELECT `uri`, `contact-id` FROM `item` WHERE `uid` = %d AND `uri` = '%s' LIMIT 1",
intval($uid),
dbesc('fb::'.$comment->post_id)
);
if(count($r)) {
$parent_uri = $r[0]["uri"];
$parent_contact = $r[0]["contact-id"];
}
// check if it is a reply to an own post (separate posting for performance reasons)
$r = q("SELECT `uri`, `contact-id` FROM `item` WHERE `uid` = %d AND `extid` = '%s' LIMIT 1",
intval($uid),
dbesc('fb::'.$comment->post_id)
);
if(count($r)) {
$parent_uri = $r[0]["uri"];
$parent_contact = $r[0]["contact-id"];
}
// No parent? Then quit
if ($parent_uri == "")
return;
//logger("fbsync_createcomment: Checking if parent contact is blocked: ".$parent_contact." - ".$parent_uri, LOGGER_DEBUG);
// Check if the contact id was blocked
if ($parent_contact > 0) {
$r = q("SELECT `blocked`, `readonly`, `nick` FROM `contact` WHERE `uid` = %d AND `id` = %d LIMIT 1",
intval($uid), intval($parent_contact));
// Should only happen if someone deleted the contact manually
if(!count($r)) {
logger("fbsync_createcomment: UID ".$uid." - Contact ".$parent_contact." doesn't seem to exist.", LOGGER_DEBUG);
return;
}
// Is blocked? Then return
if ($r[0]["readonly"] || $r[0]["blocked"]) {
logger("fbsync_createcomment: UID ".$uid." - Contact '".$r[0]["nick"]."' is blocked or readonly.", LOGGER_DEBUG);
return;
}
$parent_nick = $r[0]["nick"];
logger("fbsync_createcomment: UID ".$uid." - Contact '".$r[0]["nick"]."' isn't blocked. ".print_r($r, true), LOGGER_DEBUG);
}
$postarray = array();
$postarray['gravity'] = 0;
$postarray['uid'] = $uid;
$postarray['wall'] = 0;
$postarray['verb'] = ACTIVITY_POST;
$postarray['object-type'] = ACTIVITY_OBJ_COMMENT;
$postarray['network'] = dbesc(NETWORK_FACEBOOK);
$postarray['uri'] = "fb::".$comment->id;
$postarray['thr-parent'] = $parent_uri;
$postarray['parent-uri'] = $parent_uri;
//$postarray['plink'] = $comment->permalink;
$contact_id = fbsync_fetch_contact($uid, $contacts[$comment->fromid], array(), false);
$contact_nick = $contacts[$comment->fromid]->name;
if ($contact_id == -1) {
logger('fbsync_createcomment: Contact was blocked. Comment not imported '.print_r($comment, true), LOGGER_DEBUG);
return;
}
// If no contact was found, take it from the thread owner
if ($contact_id <= 0) {
$contact_id = $parent_contact;
$contact_nick = $parent_nick;
}
// This case here should never happen
if ($contact_id <= 0) {
$contact_id = $self[0]["id"];
$contact_nick = $self[0]["nick"];
}
if ($comment->fromid != $self_id) {
$postarray['contact-id'] = $contact_id;
$postarray['owner-name'] = $contacts[$comment->fromid]->name;
$postarray['owner-link'] = $contacts[$comment->fromid]->url;
$postarray['owner-avatar'] = $contacts[$comment->fromid]->pic_square;
} else {
$postarray['contact-id'] = $self[0]["id"];
$postarray['owner-name'] = $self[0]["name"];
$postarray['owner-link'] = $self[0]["url"];
$postarray['owner-avatar'] = $self[0]["photo"];
$contact_nick = $self[0]["nick"];
}
$postarray['author-name'] = $postarray['owner-name'];
$postarray['author-link'] = $postarray['owner-link'];
$postarray['author-avatar'] = $postarray['owner-avatar'];
$msgdata = fbsync_convertmsg($a, $comment->text);
$postarray["body"] = $msgdata["body"];
$postarray["tag"] = $msgdata["tags"];
$postarray['created'] = datetime_convert('UTC','UTC',date("c", $comment->time));
$postarray['edited'] = datetime_convert('UTC','UTC',date("c", $comment->time));
$postarray['app'] = $applications[$comment->app_id]->display_name;
if ($postarray['app'] == "")
$postarray['app'] = "Facebook";
if (trim($postarray["body"]) == "")
return;
$item = item_store($postarray);
$postarray["id"] = $item;
logger('fbsync_createcomment: UID '.$uid.' - CID '.$postarray['contact-id'].' - Nick '.$contact_nick.' posted comment '.$item, LOGGER_DEBUG);
if ($item == 0)
return;
$myconv = q("SELECT `author-link`, `author-avatar`, `parent` FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d AND `parent` != 0 AND `deleted` = 0",
dbesc($postarray['parent-uri']),
intval($uid)
);
if(count($myconv)) {
$importer_url = $a->get_baseurl() . '/profile/' . $user[0]['nickname'];
$own_contact = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
intval($uid), dbesc("facebook::".$self_id));
if (!count($own_contact))
return;
foreach($myconv as $conv) {
// now if we find a match, it means we're in this conversation
if(!link_compare($conv['author-link'],$importer_url) && !link_compare($conv['author-link'],$own_contact[0]["url"]))
continue;
require_once('include/enotify.php');
$conv_parent = $conv['parent'];
$notifyarr = array(
'type' => NOTIFY_COMMENT,
'notify_flags' => $user[0]['notify-flags'],
'language' => $user[0]['language'],
'to_name' => $user[0]['username'],
'to_email' => $user[0]['email'],
'uid' => $user[0]['uid'],
'item' => $postarray,
'link' => $a->get_baseurl().'/display/'.urlencode(get_item_guid($item)),
'source_name' => $postarray['author-name'],
'source_link' => $postarray['author-link'],
'source_photo' => $postarray['author-avatar'],
'verb' => ACTIVITY_POST,
'otype' => 'item',
'parent' => $conv_parent,
);
notification($notifyarr);
// only send one notification
break;
}
}
}
function fbsync_createlike($a, $uid, $self_id, $self, $contacts, $like) {
$r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc("fb::".$like->post_id),
intval($uid)
);
if (count($r))
$orig_post = $r[0];
else
return;
// If we posted the like locally, it will be found with our url, not the FB url.
$second_url = (($like->user_id == $self_id) ? $self[0]["url"] : $contacts[$like->user_id]->url);
$r = q("SELECT * FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d AND `verb` = '%s'
AND (`author-link` = '%s' OR `author-link` = '%s') LIMIT 1",
dbesc($orig_post["uri"]),
intval($uid),
dbesc(ACTIVITY_LIKE),
dbesc($contacts[$like->user_id]->url),
dbesc($second_url)
);
if (count($r))
return;
$contact_id = fbsync_fetch_contact($uid, $contacts[$like->user_id], array(), false);
if ($contact_id <= 0)
$contact_id = $self[0]["id"];
$likedata = array();
$likedata['parent'] = $orig_post['id'];
$likedata['verb'] = ACTIVITY_LIKE;
$likedata['object-type'] = ACTIVITY_OBJ_NOTE;
$likedate['network'] = dbesc(NETWORK_FACEBOOK);
$likedata['gravity'] = 3;
$likedata['uid'] = $uid;
$likedata['wall'] = 0;
$likedata['uri'] = item_new_uri($a->get_baseurl(), $uid);
$likedata['parent-uri'] = $orig_post["uri"];
$likedata['app'] = "Facebook";
if ($like->user_id != $self_id) {
$likedata['contact-id'] = $contact_id;
$likedata['author-name'] = $contacts[$like->user_id]->name;
$likedata['author-link'] = $contacts[$like->user_id]->url;
$likedata['author-avatar'] = $contacts[$like->user_id]->pic_square;
} else {
$likedata['contact-id'] = $self[0]["id"];
$likedata['author-name'] = $self[0]["name"];
$likedata['author-link'] = $self[0]["url"];
$likedata['author-avatar'] = $self[0]["photo"];
}
$author = '[url=' . $likedata['author-link'] . ']' . $likedata['author-name'] . '[/url]';
$objauthor = '[url=' . $orig_post['author-link'] . ']' . $orig_post['author-name'] . '[/url]';
$post_type = t('status');
$plink = '[url=' . $orig_post['plink'] . ']' . $post_type . '[/url]';
$likedata['object-type'] = ACTIVITY_OBJ_NOTE;
$likedata['body'] = sprintf( t('%1$s likes %2$s\'s %3$s'), $author, $objauthor, $plink);
$likedata['object'] = '<object><type>' . ACTIVITY_OBJ_NOTE . '</type><local>1</local>' .
'<id>' . $orig_post['uri'] . '</id><link>' . xmlify('<link rel="alternate" type="text/html" href="' . xmlify($orig_post['plink']) . '" />') . '</link><title>' . $orig_post['title'] . '</title><content>' . $orig_post['body'] . '</content></object>';
$r = q("SELECT * FROM `item` WHERE `parent-uri` = '%s' AND `author-link` = '%s' AND `verb` = '%s' AND `uid` = %d LIMIT 1",
dbesc($likedata['parent-uri']),
dbesc($likedata['author-link']),
dbesc(ACTIVITY_LIKE),
intval($uid)
);
if (count($r))
return;
$item = item_store($likedata);
logger('fbsync_createlike: liked item '.$item.'. User '.$self[0]["nick"], LOGGER_DEBUG);
}
function fbsync_fetch_contact($uid, $contact, $create_user) {
if($contact->url == "")
return(0);
// Check if the unique contact is existing
// To-Do: only update once a while
$r = q("SELECT id FROM unique_contacts WHERE url='%s' LIMIT 1",
dbesc(normalise_link($contact->url)));
if (count($r) == 0)
q("INSERT INTO unique_contacts (url, name, nick, avatar) VALUES ('%s', '%s', '%s', '%s')",
dbesc(normalise_link($contact->url)),
dbesc($contact->name),
dbesc($contact->username),
dbesc($contact->pic_square));
else
q("UPDATE unique_contacts SET name = '%s', nick = '%s', avatar = '%s' WHERE url = '%s'",
dbesc($contact->name),
dbesc($contact->username),
dbesc($contact->pic_square),
dbesc(normalise_link($contact->url)));
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
intval($uid), dbesc("facebook::".$contact->id));
if(!count($r) && !$create_user)
return(0);
if (count($r) && ($r[0]["readonly"] || $r[0]["blocked"])) {
logger("fbsync_fetch_contact: Contact '".$r[0]["nick"]."' is blocked or readonly.", LOGGER_DEBUG);
return(-1);
}
$avatarpicture = $contact->pic_square;
if(!count($r)) {
// create contact record
q("INSERT INTO `contact` (`uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
`name`, `nick`, `photo`, `network`, `rel`, `priority`,
`writable`, `blocked`, `readonly`, `pending`)
VALUES (%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, 0, 0, 0)",
intval($uid),
dbesc(datetime_convert()),
dbesc($contact->url),
dbesc(normalise_link($contact->url)),
dbesc($contact->username."@facebook.com"),
dbesc("facebook::".$contact->id),
dbesc($contact->id),
dbesc("facebook::".$contact->id),
dbesc($contact->name),
dbesc($contact->username),
dbesc($avatarpicture),
dbesc(NETWORK_FACEBOOK),
intval(CONTACT_IS_FRIEND),
intval(1),
intval(1)
);
$r = q("SELECT * FROM `contact` WHERE `alias` = '%s' AND `uid` = %d LIMIT 1",
dbesc("facebook::".$contact->id),
intval($uid)
);
if(! count($r))
return(false);
$contact_id = $r[0]['id'];
$g = q("SELECT def_gid FROM user WHERE uid = %d LIMIT 1",
intval($uid)
);
if($g && intval($g[0]['def_gid'])) {
require_once('include/group.php');
group_add_member($uid,'',$contact_id,$g[0]['def_gid']);
}
require_once("Photo.php");
$photos = import_profile_photo($avatarpicture,$uid,$contact_id);
q("UPDATE `contact` SET `photo` = '%s',
`thumb` = '%s',
`micro` = '%s',
`name-date` = '%s',
`uri-date` = '%s',
`avatar-date` = '%s'
WHERE `id` = %d",
dbesc($photos[0]),
dbesc($photos[1]),
dbesc($photos[2]),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
intval($contact_id)
);
} else {
// update profile photos once every 12 hours as we have no notification of when they change.
$update_photo = ($r[0]['avatar-date'] < datetime_convert('','','now -12 hours'));
// check that we have all the photos, this has been known to fail on occasion
if((! $r[0]['photo']) || (! $r[0]['thumb']) || (! $r[0]['micro']) || ($update_photo)) {
logger("fbsync_fetch_contact: Updating contact ".$contact->username, LOGGER_DEBUG);
require_once("Photo.php");
$photos = import_profile_photo($avatarpicture, $uid, $r[0]['id']);
q("UPDATE `contact` SET `photo` = '%s',
`thumb` = '%s',
`micro` = '%s',
`name-date` = '%s',
`uri-date` = '%s',
`avatar-date` = '%s',
`url` = '%s',
`nurl` = '%s',
`addr` = '%s',
`name` = '%s',
`nick` = '%s',
`notify` = '%s'
WHERE `id` = %d",
dbesc($photos[0]),
dbesc($photos[1]),
dbesc($photos[2]),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
dbesc($contact->url),
dbesc(normalise_link($contact->url)),
dbesc($contact->username."@facebook.com"),
dbesc($contact->name),
dbesc($contact->username),
dbesc($contact->id),
intval($r[0]['id'])
);
}
}
return($r[0]["id"]);
}
function fbsync_get_self($uid) {
$access_token = get_pconfig($uid,'facebook','access_token');
if(! $access_token)
return;
$s = fetch_url('https://graph.facebook.com/me/?access_token=' . $access_token);
if($s) {
$j = json_decode($s);
set_pconfig($uid,'fbsync','self_id',(string) $j->id);
}
}
function fbsync_convertmsg($a, $body) {
$str_tags = '';
$tags = get_tags($body);
if(count($tags)) {
foreach($tags as $tag) {
if (strstr(trim($tag), " "))
continue;
if(strpos($tag,'#') === 0) {
if(strpos($tag,'[url='))
continue;
// don't link tags that are already embedded in links
if(preg_match('/\[(.*?)' . preg_quote($tag,'/') . '(.*?)\]/',$body))
continue;
if(preg_match('/\[(.*?)\]\((.*?)' . preg_quote($tag,'/') . '(.*?)\)/',$body))
continue;
$basetag = str_replace('_',' ',substr($tag,1));
$body = str_replace($tag,'#[url=' . $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag) . ']' . $basetag . '[/url]',$body);
if(strlen($str_tags))
$str_tags .= ',';
$str_tags .= '#[url=' . $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag) . ']' . $basetag . '[/url]';
continue;
} elseif(strpos($tag,'@') === 0) {
$basetag = substr($tag,1);
$body = str_replace($tag,'@[url=https://twitter.com/' . rawurlencode($basetag) . ']' . $basetag . '[/url]',$body);
}
}
}
$cnt = preg_match_all('/@\[url=(.*?)\[\/url\]/ism',$body,$matches,PREG_SET_ORDER);
if($cnt) {
foreach($matches as $mtch) {
if(strlen($str_tags))
$str_tags .= ',';
$str_tags .= '@[url=' . $mtch[1] . '[/url]';
}
}
return(array("body"=>$body, "tags"=>$str_tags));
}
function fbsync_fetchuser($a, $uid, $id) {
$access_token = get_pconfig($uid,'facebook','access_token');
$self_id = get_pconfig($uid,'fbsync','self_id');
$user = array();
$contact = q("SELECT `id`, `name`, `url`, `photo` FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
intval($uid), dbesc("facebook::".$id));
if (count($contact)) {
if (($contact[0]["readonly"] || $contact[0]["blocked"])) {
logger("fbsync_fetchuser: Contact '".$contact[0]["nick"]."' is blocked or readonly.", LOGGER_DEBUG);
$user["contact-id"] = -1;
} else
$user["contact-id"] = $contact[0]["id"];
$user["name"] = $contact[0]["name"];
$user["link"] = $contact[0]["url"];
$user["avatar"] = $contact[0]["photo"];
return($user);
}
$own_contact = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
intval($uid), dbesc("facebook::".$self_id));
if (!count($own_contact))
return($user);
$fql = "SELECT name, url, pic_square FROM profile WHERE id = ".$id;
$url = "https://graph.facebook.com/fql?q=".urlencode($fql)."&access_token=".$access_token;
$feed = fetch_url($url);
$data = json_decode($feed);
if (is_array($data->data)) {
$user["contact-id"] = $own_contact[0]["id"];
$user["name"] = $data->data[0]->name;
$user["link"] = $data->data[0]->url;
$user["avatar"] = $data->data[0]->pic_square;
}
return($user);
}
function fbsync_fetchfeed($a, $uid) {
$access_token = get_pconfig($uid,'facebook','access_token');
$last_updated = get_pconfig($uid,'fbsync','last_updated');
$self_id = get_pconfig($uid,'fbsync','self_id');
$create_user = get_pconfig($uid, 'fbsync', 'create_user');
$do_likes = get_config('fbsync', 'do_likes');
$self = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
intval($uid)
);
$user = q("SELECT * FROM `user` WHERE `uid` = %d AND `account_expired` = 0 LIMIT 1",
intval($uid)
);
if(! count($user))
return;
require_once('include/items.php');
if ($last_updated == "")
$last_updated = 0;
logger("fbsync_fetchfeed: fetching content for user ".$self_id);
$fql = array(
"posts" => "SELECT action_links, actor_id, app_data, app_id, attachment, attribution, comment_info, created_time, filter_key, like_info, message, message_tags, parent_post_id, permalink, place, post_id, privacy, share_count, share_info, source_id, subscribed, tagged_ids, type, updated_time, with_tags FROM stream where filter_key in (SELECT filter_key FROM stream_filter WHERE uid=me() AND type='newsfeed') AND updated_time > $last_updated ORDER BY updated_time DESC LIMIT 500",
"comments" => "SELECT app_id, attachment, post_id, id, likes, fromid, time, text, text_tags, user_likes, likes FROM comment WHERE post_id IN (SELECT post_id FROM #posts) ORDER BY time DESC LIMIT 500",
"profiles" => "SELECT id, name, username, url, pic_square FROM profile WHERE id IN (SELECT actor_id FROM #posts) OR id IN (SELECT fromid FROM #comments) OR id IN (SELECT source_id FROM #posts) LIMIT 500",
"applications" => "SELECT app_id, display_name FROM application WHERE app_id IN (SELECT app_id FROM #posts) OR app_id IN (SELECT app_id FROM #comments) LIMIT 500",
"avatars" => "SELECT id, real_size, size, url FROM square_profile_pic WHERE id IN (SELECT id FROM #profiles) AND size = 256 LIMIT 500");
if ($do_likes) {
$fql["likes"] = "SELECT post_id, user_id FROM like WHERE post_id IN (SELECT post_id FROM #posts)";
$fql["profiles"] .= " OR id IN (SELECT user_id FROM #likes)";
}
$url = "https://graph.facebook.com/fql?q=".urlencode(json_encode($fql))."&access_token=".$access_token;
$feed = fetch_url($url);
$data = json_decode($feed);
if (!is_array($data->data)) {
logger("fbsync_fetchfeed: Error fetching data for user ".$uid.": ".print_r($data, true));
return;
}
$posts = array();
$comments = array();
$likes = array();
$profiles = array();
$applications = array();
$avatars = array();
foreach($data->data AS $query) {
switch ($query->name) {
case "posts":
$posts = array_reverse($query->fql_result_set);
break;
case "comments":
$comments = $query->fql_result_set;
break;
case "likes":
$likes = $query->fql_result_set;
break;
case "profiles":
$profiles = $query->fql_result_set;
break;
case "applications":
$applications = $query->fql_result_set;
break;
case "avatars":
$avatars = $query->fql_result_set;
break;
}
}
$square_avatars = array();
$contacts = array();
$application_data = array();
$post_data = array();
$comment_data = array();
foreach ($avatars AS $avatar) {
$avatar->id = number_format($avatar->id, 0, '', '');
$square_avatars[$avatar->id] = $avatar;
}
unset($avatars);
foreach ($profiles AS $profile) {
$profile->id = number_format($profile->id, 0, '', '');
if ($square_avatars[$profile->id]->url != "")
$profile->pic_square = $square_avatars[$profile->id]->url;
$contacts[$profile->id] = $profile;
}
unset($profiles);
unset($square_avatars);
foreach ($applications AS $application) {
$application->app_id = number_format($application->app_id, 0, '', '');
$application_data[$application->app_id] = $application;
}
unset($applications);
foreach ($posts AS $post) {
$post->actor_id = number_format($post->actor_id, 0, '', '');
$post->source_id = number_format($post->source_id, 0, '', '');
$post->app_id = number_format($post->app_id, 0, '', '');
$post_data[$post->post_id] = $post;
}
unset($posts);
foreach($comments AS $comment) {
$comment->fromid = number_format($comment->fromid, 0, '', '');
$comment_data[$comment->id] = $comment;
}
unset($comments);
foreach ($post_data AS $post) {
if ($post->updated_time > $last_updated)
$last_updated = $post->updated_time;
fbsync_createpost($a, $uid, $self, $contacts, $application_data, $post, $create_user);
}
foreach ($comment_data AS $comment) {
fbsync_createcomment($a, $uid, $self_id, $self, $user, $contacts, $application_data, $comment);
}
foreach($likes AS $like) {
$like->user_id = number_format($like->user_id, 0, '', '');
fbsync_createlike($a, $uid, $self_id, $self, $contacts, $like);
}
set_pconfig($uid,'fbsync','last_updated', $last_updated);
}
?>

43
fbsync/lang/C/messages.po Normal file
View file

@ -0,0 +1,43 @@
# ADDON fbsync
# Copyright (C)
# This file is distributed under the same license as the Friendica fbsync addon package.
#
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-06-23 14:44+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: fbsync.php:128 fbsync.php:132
msgid "Facebook Import"
msgstr ""
#: fbsync.php:136
msgid "Import Facebook newsfeed"
msgstr ""
#: fbsync.php:141
msgid "Automatically create contacts"
msgstr ""
#: fbsync.php:147
msgid "Save Settings"
msgstr ""
#: fbsync.php:656
msgid "status"
msgstr ""
#: fbsync.php:661
#, php-format
msgid "%1$s likes %2$s's %3$s"
msgstr ""

View file

@ -23,7 +23,7 @@ else
$adult = 0;
$length = (($_GET['length']) ? intval($_GET['length']) : 0);
$numlines = ((intval($_GET['numlines'])) ? intval($_GET['numlines']) : 0);
$numlines = ((intval($_GET['numlines'])) ? intval($_GET['numlines']) : 0);
$cat = (($_GET['cat'] == '1') ? 1 : 0);
$equal = (($_GET['equal'] == '1') ? 1 : 0);
$stats = (($_GET['stats'] == '1') ? 1 : 0);
@ -50,7 +50,7 @@ if($numlines < 0)
function do_query($table,$length,$numlines,$adult,$cat,$limit,$lang,$pattern,$regex,$equal) {
global $db;
$rnd = mt_rand();
$r = [];
$r = array();
$typesql = (($table) ? " WHERE `category` = '$table' " : " WHERE 1 ");
$lengthsql = (($length) ? " AND LENGTH(`text`) < $length " : "" );
@ -80,24 +80,24 @@ function do_query($table,$length,$numlines,$adult,$cat,$limit,$lang,$pattern,$re
$eqsql = '';
if($equal) {
$catsavail = [];
$res = @$db->query("SELECT DISTINCT ( `category` ) FROM `fortune`
$catsavail = array();
$res = @$db->query("SELECT DISTINCT ( `category` ) FROM `fortune`
$typesql
$adultsql
$lengthsql
$langsql
$patsql
$patsql
$regexsql ");
if($res->num_rows) {
while($x = $res->fetch_array(MYSQL_ASSOC))
$catsavail[] = $x['category'];
$eqsql = " AND `category` = '"
. $catsavail[mt_rand(0,$res->num_rows - 1)] . "' ";
}
}
$result = @$db->query("SELECT `text`, `category` FROM `fortune`
$result = @$db->query("SELECT `text`, `category` FROM `fortune`
$typesql
$adultsql
$lengthsql
@ -105,7 +105,7 @@ function do_query($table,$length,$numlines,$adult,$cat,$limit,$lang,$pattern,$re
$patsql
$regexsql
$eqsql
ORDER BY RAND($rnd)
ORDER BY RAND($rnd)
LIMIT $limit");
if($result->num_rows) {
@ -120,7 +120,7 @@ function do_query($table,$length,$numlines,$adult,$cat,$limit,$lang,$pattern,$re
function do_stats($table,$length,$numlines,$adult,$cat,$limit,$lang,$pattern,$regex,$equal) {
global $db;
$rnd = mt_rand();
$r = [];
$r = array();
$typesql = (($table) ? " WHERE `category` = '$table' " : " WHERE 1 ");
$lengthsql = (($length) ? " AND LENGTH(`text`) < $length " : "" );
@ -149,7 +149,7 @@ function do_stats($table,$length,$numlines,$adult,$cat,$limit,$lang,$pattern,$re
$eqsql = '';
$result = @$db->query("SELECT `text`, `category` FROM `fortune`
$result = @$db->query("SELECT `text`, `category` FROM `fortune`
$typesql
$adultsql
$lengthsql
@ -162,22 +162,22 @@ function do_stats($table,$length,$numlines,$adult,$cat,$limit,$lang,$pattern,$re
echo '<br />' . $result->num_rows . ' matching quotations.<br />';
$res = @$db->query("SELECT DISTINCT ( `category` ) FROM `fortune`
$res = @$db->query("SELECT DISTINCT ( `category` ) FROM `fortune`
$typesql
$adultsql
$lengthsql
$langsql
$patsql
$patsql
$regexsql ");
if($res->num_rows) {
echo '<br />Matching Databases:<br />';
while($x = $res->fetch_array(MYSQL_ASSOC))
echo $x['category'].'<br />';
}
else
echo '<br />No matching databases using those search parameters - please refine your options.<br />';
}
@ -195,23 +195,23 @@ function fortune_to_html($s) {
// So for now, just remove them.
$s = str_replace(
["&",
array("&",
"<",
">",
'"',
"\007",
"\t",
"\r",
"\n"],
"\n"),
["&amp;",
array("&amp;",
"&lt;",
"&gt;",
"&quot;",
"",
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;",
"",
"<br />"],
"<br />"),
$s);
// Replace pseudo diacritics
// These were used to produce accented characters. For instance an accented

View file

@ -6,8 +6,6 @@
* Author: Thomas Willingham <https://beardyunixer.com/profile/beardyunixer>
*/
use Friendica\Core\Config;
function forumdirectory_install() {
register_hook('app_menu', 'addon/forumdirectory/forumdirectory.php', 'forumdirectory_app_menu');
}
@ -51,7 +49,7 @@ function forumdirectory_post(&$a) {
function forumdirectory_content(&$a) {
if((Config::get('system','block_public')) && (! local_user()) && (! remote_user())) {
if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
notice( t('Public access denied.') . EOL);
return;
}
@ -67,7 +65,7 @@ function forumdirectory_content(&$a) {
$tpl = get_markup_template('directory_header.tpl');
$globaldir = '';
$gdirpath = Config::get('system','directory');
$gdirpath = get_config('system','directory');
if(strlen($gdirpath)) {
$globaldir = '<ul><li><div id="global-directory-link"><a href="'
. zrl($gdirpath,true) . '">' . t('Global Directory') . '</a></div></li></ul>';
@ -75,7 +73,7 @@ function forumdirectory_content(&$a) {
$admin = '';
$o .= replace_macros($tpl, [
$o .= replace_macros($tpl, array(
'$search' => $search,
'$globaldir' => $globaldir,
'$desc' => t('Find on this site'),
@ -83,20 +81,20 @@ function forumdirectory_content(&$a) {
'$finding' => (strlen($search) ? '<h4>' . t('Finding: ') . "'" . $search . "'" . '</h4>' : ""),
'$sitedir' => t('Site Directory'),
'$submit' => t('Find')
]);
));
if($search)
$search = dbesc($search);
$sql_extra = ((strlen($search)) ? " AND MATCH (`profile`.`name`, `user`.`nickname`, `pdesc`, `locality`,`region`,`country-name`,`gender`,`marital`,`sexual`,`about`,`romance`,`work`,`education`,`pub_keywords`,`prv_keywords` ) AGAINST ('$search' IN BOOLEAN MODE) " : "");
$publish = ((Config::get('system','publish_all')) ? '' : " AND `publish` = 1 " );
$publish = ((get_config('system','publish_all')) ? '' : " AND `publish` = 1 " );
$r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 AND `page-flags` = 2 $sql_extra ");
if(count($r))
$a->set_pager_total($r[0]['total']);
$order = " ORDER BY `name` ASC ";
$order = " ORDER BY `name` ASC ";
$r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`, `user`.`timezone` , `user`.`page-flags` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 AND `page-flags` = 2 $sql_extra $order LIMIT %d , %d ",
@ -114,7 +112,7 @@ function forumdirectory_content(&$a) {
$profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
$pdesc = (($rr['pdesc']) ? $rr['pdesc'] . '<br />' : '');
$details = '';
@ -132,7 +130,7 @@ function forumdirectory_content(&$a) {
}
if(strlen($rr['dob'])) {
if(($years = age($rr['dob'],$rr['timezone'],'')) != 0)
$details .= '<br />' . t('Age: ') . $years ;
$details .= '<br />' . t('Age: ') . $years ;
}
if(strlen($rr['gender']))
$details .= '<br />' . t('Gender: ') . $rr['gender'];
@ -164,29 +162,29 @@ function forumdirectory_content(&$a) {
$homepage = ((x($profile,'homepage') == 1) ? t('Homepage:') : False);
$about = ((x($profile,'about') == 1) ? t('About:') : False);
# $tpl = file_get_contents( dirname(__file__).'/forumdirectory_item.tpl');
$tpl = get_markup_template( 'forumdirectory_item.tpl', 'addon/forumdirectory/' );
$entry = replace_macros($tpl,[
$entry = replace_macros($tpl,array(
'$id' => $rr['id'],
'$profile_link' => $profile_link,
'$photo' => $rr[$photo],
'$photo' => $a->get_cached_avatar_image($rr[$photo]),
'$alt_text' => $rr['name'],
'$name' => $rr['name'],
'$details' => $pdesc . $details,
'$page_type' => $page_type,
'$profile' => $profile,
'$location' => $location,
'$location' => template_escape($location),
'$gender' => $gender,
'$pdesc' => $pdesc,
'$marital' => $marital,
'$homepage' => $homepage,
'$about' => $about,
]);
));
$arr = ['contact' => $rr, 'entry' => $entry];
$arr = array('contact' => $rr, 'entry' => $entry);
unset($profile);
unset($location);

22
forumlist/forumlist.css Normal file
View file

@ -0,0 +1,22 @@
#hide-forum-list {
opacity: 0.3;
filter:alpha(opacity=30);
}
#hide-forum-list:hover {
opacity: 1.0;
filter:alpha(opacity=100);
}
#forumlist-settings-label, #forumlist-random-label, #forumlist-profile-label, #forumlist-network-label {
float: left;
width: 200px;
margin-bottom: 25px;
}
#forumlist-max-forumlists, #forumlist-random, #forumlist-profile, #forumlist-network {
float: left;
}

188
forumlist/forumlist.php Normal file
View file

@ -0,0 +1,188 @@
<?php
/**
* Name: ForumList
* Description: Shows list of subscribed community forums on network sidebar
* Version: 1.1
* Author: Mike Macgirvin <mike@macgirvin.com>
* based on pages plugin by
* Author: Michael Vogel <ike@piratenpartei.de>
* Status: Unsupported
*
*/
function forumlist_install() {
register_hook('network_mod_init', 'addon/forumlist/forumlist.php', 'forumlist_network_mod_init');
register_hook('plugin_settings', 'addon/forumlist/forumlist.php', 'forumlist_plugin_settings');
register_hook('plugin_settings_post', 'addon/forumlist/forumlist.php', 'forumlist_plugin_settings_post');
register_hook('profile_advanced', 'addon/forumlist/forumlist.php', 'forumlist_profile_advanced');
}
function forumlist_uninstall() {
unregister_hook('network_mod_init', 'addon/forumlist/forumlist.php', 'forumlist_network_mod_init');
unregister_hook('plugin_settings', 'addon/forumlist/forumlist.php', 'forumlist_plugin_settings');
unregister_hook('plugin_settings_post', 'addon/forumlist/forumlist.php', 'forumlist_plugin_settings_post');
unregister_hook('profile_advanced', 'addon/forumlist/forumlist.php', 'forumlist_profile_advanced');
}
function forumlist_getpage($uid,$showhidden = true,$randomise = false, $showprivate = false) {
$forumlist = array();
$order = (($showhidden) ? '' : " and hidden = 0 ");
$order .= (($randomise) ? ' order by rand() ' : ' order by name asc ');
$select = "`forum` = 1";
if ($showprivate) {
$select = "( `forum` = 1 OR `prv` = 1 )";
}
$contacts = q("SELECT `contact`.`id`, `contact`.`url`, `contact`.`name`, `contact`.`micro` from contact
WHERE `network`= 'dfrn' AND $select AND `uid` = %d
and blocked = 0 and hidden = 0 and pending = 0 and archive = 0
$order ",
intval($uid)
);
// Look if the profile is a community page
foreach($contacts as $contact) {
$forumlist[] = array("url"=>$contact["url"], "name"=>$contact["name"], "id"=>$contact["id"], "micro"=>$contact['micro']);
}
return($forumlist);
}
function forumlist_network_mod_init($a,$b) {
if(! intval(get_pconfig(local_user(),'forumlist','show_on_network')))
return;
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/forumlist/forumlist.css' . '" media="all" />' . "\r\n";
$forumlist = '<div id="forumlist-sidebar" class="widget">
<div class="title tool">
<h3>'.t("Forums").'</h3></div>';
$forumlist .= '<div id="hide-forum-list" class="fakelink" onclick="openClose(\'forum-list\');" >'
. t('show/hide') . '</div>'
. '<div role="menu" id="forum-list" style="display: none;">';
$randomise = intval(get_pconfig(local_user(),'forumlist','randomise'));
$contacts = forumlist_getpage($a->user['uid'],true,$randomise, true);
if(count($contacts)) {
foreach($contacts as $contact) {
$forumlist .= '<div role="menuitem"><a href="' . $a->get_baseurl() . '/redir/' . $contact["id"] . '" title="'.t('External link to forum').'" class="label sparkle" target="_blank"><img class="forumlist-img" height="20" width="20" src="' . $contact['micro'] .'" alt="'.t('External link to forum').'" /></a> <a href="' . $a->get_baseurl() . '/network?f=&cid=' . $contact['id'] . '" >' . $contact["name"]."</a></div>";
}
}
else {
$forumlist .= t('No forum subscriptions');
}
$forumlist .= "</div></div>";
if (sizeof($contacts) > 0)
$a->page['aside'] = $forumlist . $a->page['aside'];
}
function forumlist_profile_advanced($a,&$b) {
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/forumlist/forumlist.css' . '" media="all" />' . "\r\n";
$profile = intval(get_pconfig($a->profile['profile_uid'],'forumlist','show_on_profile'));
if(! $profile)
return;
$forumlist = '<div id="forumlist-profile">
<div class="title">'.t("Forums:").'</div>
<div id="profile-forumlist-list">';
// place holder in case somebody wants configurability
$show_total = 9999;
$randomise = true;
$contacts = forumlist_getpage($a->user['uid'],false,$randomise,false);
$total_shown = 0;
$more = false;
foreach($contacts as $contact) {
$forumlist .= micropro($contact,false,'forumlist-profile-advanced');
$total_shown ++;
if($total_shown == $show_total)
break;
}
$forumlist .= '</div></div><div class="clear"></div>';
if(count($contacts) > 0)
$b .= $forumlist;
}
function forumlist_plugin_settings_post($a,$post) {
if(! local_user() || (! x($_POST,'forumlist-settings-submit')))
return;
// set_pconfig(local_user(),'forumlist','max_forumlists',intval($_POST['forumlist_max_forumlists']));
set_pconfig(local_user(),'forumlist','randomise',intval($_POST['forumlist_random']));
set_pconfig(local_user(),'forumlist','show_on_profile',intval($_POST['forumlist_profile']));
set_pconfig(local_user(),'forumlist','show_on_network',intval($_POST['forumlist_network']));
info( t('Forumlist settings updated.') . EOL);
}
function forumlist_plugin_settings(&$a,&$s) {
if(! local_user())
return;
/* Add our stylesheet to the forumlist so we can make our settings look nice */
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/forumlist/forumlist.css' . '" media="all" />' . "\r\n";
/* Get the current state of our config variable */
$randomise = intval(get_pconfig(local_user(),'forumlist','randomise'));
$randomise_checked = (($randomise) ? ' checked="checked" ' : '');
$profile = intval(get_pconfig(local_user(),'forumlist','show_on_profile'));
$profile_checked = (($profile) ? ' checked="checked" ' : '');
$network = intval(get_pconfig(local_user(),'forumlist','show_on_network'));
$network_checked = (($network) ? ' checked="checked" ' : '');
/* Add some HTML to the existing form */
$s .= '<span id="settings_forumlist_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_forumlist_expanded\'); openClose(\'settings_forumlist_inflated\');">';
$s .= '<h3>' . t('Forumlist') . '</h3>';
$s .= '</span>';
$s .= '<div id="settings_forumlist_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_forumlist_expanded\'); openClose(\'settings_forumlist_inflated\');">';
$s .= '<h3>' . t('Forumlist') . '</h3>';
$s .= '</span>';
$s .= '<div id="forumlist-settings-wrapper">';
$s .= '<label id="forumlist-random-label" for="forumlist-random">' . t('Randomise forum list') . '</label>';
$s .= '<input id="forumlist-random" type="checkbox" name="forumlist_random" value="1" ' . $randomise_checked . '/>';
$s .= '<div class="clear"></div>';
$s .= '<label id="forumlist-profile-label" for="forumlist-profile">' . t('Show forums on profile page') . '</label>';
$s .= '<input id="forumlist-profile" type="checkbox" name="forumlist_profile" value="1" ' . $profile_checked . '/>';
$s .= '<div class="clear"></div>';
$s .= '<label id="forumlist-network-label" for="forumlist-network">' . t('Show forums on network page') . '</label>';
$s .= '<input id="forumlist-network" type="checkbox" name="forumlist_network" value="1" ' . $network_checked . '/>';
$s .= '<div class="clear"></div>';
$s .= '</div>';
/* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="forumlist-settings-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>';
}

View file

@ -0,0 +1,58 @@
# ADDON forumlist
# Copyright (C)
# This file is distributed under the same license as the Friendica forumlist addon package.
#
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-02-27 05:01-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: forumlist.php:64
msgid "Forums"
msgstr ""
#: forumlist.php:67
msgid "show/hide"
msgstr ""
#: forumlist.php:81
msgid "No forum subscriptions"
msgstr ""
#: forumlist.php:98
msgid "Forums:"
msgstr ""
#: forumlist.php:134
msgid "Forumlist settings updated."
msgstr ""
#: forumlist.php:162
msgid "Forumlist Settings"
msgstr ""
#: forumlist.php:164
msgid "Randomise forum list"
msgstr ""
#: forumlist.php:167
msgid "Show forums on profile page"
msgstr ""
#: forumlist.php:170
msgid "Show forums on network page"
msgstr ""
#: forumlist.php:178
msgid "Submit"
msgstr ""

View file

@ -0,0 +1,12 @@
<?php
$a->strings["Forums"] = "Forums";
$a->strings["show/hide"] = "mostra/amaga";
$a->strings["No forum subscriptions"] = "No hi ha subscripcions al fòrum";
$a->strings["Forums:"] = "Fòrums:";
$a->strings["Forumlist settings updated."] = "Ajustos de Forumlist actualitzats.";
$a->strings["Forumlist Settings"] = "Ajustos de Forumlist";
$a->strings["Randomise forum list"] = "";
$a->strings["Show forums on profile page"] = "";
$a->strings["Show forums on network page"] = "";
$a->strings["Submit"] = "Enviar";

View file

@ -0,0 +1,60 @@
# ADDON forumlist
# Copyright (C)
# This file is distributed under the same license as the Friendica forumlist addon package.
#
#
# Translators:
# Michal Šupler <msupler@gmail.com>, 2014-2015
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-02-27 05:01-0500\n"
"PO-Revision-Date: 2015-02-11 19:40+0000\n"
"Last-Translator: Michal Šupler <msupler@gmail.com>\n"
"Language-Team: Czech (http://www.transifex.com/projects/p/friendica/language/cs/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: cs\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
#: forumlist.php:64
msgid "Forums"
msgstr "Fóra"
#: forumlist.php:67
msgid "show/hide"
msgstr "zobrazit/skrýt"
#: forumlist.php:81
msgid "No forum subscriptions"
msgstr "Žádné registrace k fórům"
#: forumlist.php:98
msgid "Forums:"
msgstr "Fóra:"
#: forumlist.php:134
msgid "Forumlist settings updated."
msgstr "Nastavení Forumlist aktualizováno."
#: forumlist.php:162
msgid "Forumlist Settings"
msgstr "Nastavení Forumlist"
#: forumlist.php:164
msgid "Randomise forum list"
msgstr "Zamíchat lis fór"
#: forumlist.php:167
msgid "Show forums on profile page"
msgstr "Zobrazit fóra na profilové stránce"
#: forumlist.php:170
msgid "Show forums on network page"
msgstr "Zobrazit fóra na stránce Síť"
#: forumlist.php:178
msgid "Submit"
msgstr "Odeslat"

View file

@ -0,0 +1,17 @@
<?php
if(! function_exists("string_plural_select_cs")) {
function string_plural_select_cs($n){
return ($n==1) ? 0 : ($n>=2 && $n<=4) ? 1 : 2;;
}}
;
$a->strings["Forums"] = "Fóra";
$a->strings["show/hide"] = "zobrazit/skrýt";
$a->strings["No forum subscriptions"] = "Žádné registrace k fórům";
$a->strings["Forums:"] = "Fóra:";
$a->strings["Forumlist settings updated."] = "Nastavení Forumlist aktualizováno.";
$a->strings["Forumlist Settings"] = "Nastavení Forumlist";
$a->strings["Randomise forum list"] = "Zamíchat lis fór";
$a->strings["Show forums on profile page"] = "Zobrazit fóra na profilové stránce";
$a->strings["Show forums on network page"] = "Zobrazit fóra na stránce Síť";
$a->strings["Submit"] = "Odeslat";

View file

@ -0,0 +1,61 @@
# ADDON forumlist
# Copyright (C)
# This file is distributed under the same license as the Friendica forumlist addon package.
#
#
# Translators:
# Abrax <webmaster@a-zwenkau.de>, 2014
# bavatar <tobias.diekershoff@gmx.net>, 2014
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-02-27 05:01-0500\n"
"PO-Revision-Date: 2014-10-15 12:28+0000\n"
"Last-Translator: Abrax <webmaster@a-zwenkau.de>\n"
"Language-Team: German (http://www.transifex.com/projects/p/friendica/language/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: forumlist.php:64
msgid "Forums"
msgstr "Foren"
#: forumlist.php:67
msgid "show/hide"
msgstr "anzeigen/verbergen"
#: forumlist.php:81
msgid "No forum subscriptions"
msgstr "Keine Foren-Mitgliedschaften."
#: forumlist.php:98
msgid "Forums:"
msgstr "Foren:"
#: forumlist.php:134
msgid "Forumlist settings updated."
msgstr "Einstellungen zur Foren-Liste aktualisiert."
#: forumlist.php:162
msgid "Forumlist Settings"
msgstr "Foren-Liste Einstellungen"
#: forumlist.php:164
msgid "Randomise forum list"
msgstr "Zufällige Zusammenstellung der Foren-Liste"
#: forumlist.php:167
msgid "Show forums on profile page"
msgstr "Zeige die Liste der Foren auf der Profilseite"
#: forumlist.php:170
msgid "Show forums on network page"
msgstr "Zeige Foren auf der Netzwerk-Seite"
#: forumlist.php:178
msgid "Submit"
msgstr "Senden"

View file

@ -0,0 +1,17 @@
<?php
if(! function_exists("string_plural_select_de")) {
function string_plural_select_de($n){
return ($n != 1);;
}}
;
$a->strings["Forums"] = "Foren";
$a->strings["show/hide"] = "anzeigen/verbergen";
$a->strings["No forum subscriptions"] = "Keine Foren-Mitgliedschaften.";
$a->strings["Forums:"] = "Foren:";
$a->strings["Forumlist settings updated."] = "Einstellungen zur Foren-Liste aktualisiert.";
$a->strings["Forumlist Settings"] = "Foren-Liste Einstellungen";
$a->strings["Randomise forum list"] = "Zufällige Zusammenstellung der Foren-Liste";
$a->strings["Show forums on profile page"] = "Zeige die Liste der Foren auf der Profilseite";
$a->strings["Show forums on network page"] = "Zeige Foren auf der Netzwerk-Seite";
$a->strings["Submit"] = "Senden";

View file

@ -0,0 +1,9 @@
<?php
$a->strings["Forums"] = "Forumoj";
$a->strings["show/hide"] = "";
$a->strings["No forum subscriptions"] = "";
$a->strings["Forums:"] = "Forumoj:";
$a->strings["Forumlist settings updated."] = "";
$a->strings["Forumlist Settings"] = "";
$a->strings["Submit"] = "Sendi";

View file

@ -0,0 +1,60 @@
# ADDON forumlist
# Copyright (C)
# This file is distributed under the same license as the Friendica forumlist addon package.
#
#
# Translators:
# Alberto Díaz Tormo <albertodiaztormo@gmail.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-02-27 05:01-0500\n"
"PO-Revision-Date: 2016-10-23 11:41+0000\n"
"Last-Translator: Alberto Díaz Tormo <albertodiaztormo@gmail.com>\n"
"Language-Team: Spanish (http://www.transifex.com/Friendica/friendica/language/es/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: forumlist.php:64
msgid "Forums"
msgstr "Foros"
#: forumlist.php:67
msgid "show/hide"
msgstr "mostrar/ocultar"
#: forumlist.php:81
msgid "No forum subscriptions"
msgstr "Sin subscripciones de foro"
#: forumlist.php:98
msgid "Forums:"
msgstr "Foros:"
#: forumlist.php:134
msgid "Forumlist settings updated."
msgstr "Ajustes de la lista de foros actualizados."
#: forumlist.php:162
msgid "Forumlist Settings"
msgstr "Ajustes de la lista de foros"
#: forumlist.php:164
msgid "Randomise forum list"
msgstr "Aleatorizar la lista de foros"
#: forumlist.php:167
msgid "Show forums on profile page"
msgstr "Mostrar foros en la página de perfil"
#: forumlist.php:170
msgid "Show forums on network page"
msgstr "Mostrar foros en la página de red"
#: forumlist.php:178
msgid "Submit"
msgstr "Enviar"

View file

@ -0,0 +1,17 @@
<?php
if(! function_exists("string_plural_select_es")) {
function string_plural_select_es($n){
return ($n != 1);;
}}
;
$a->strings["Forums"] = "Foros";
$a->strings["show/hide"] = "mostrar/ocultar";
$a->strings["No forum subscriptions"] = "Sin subscripciones de foro";
$a->strings["Forums:"] = "Foros:";
$a->strings["Forumlist settings updated."] = "Ajustes de la lista de foros actualizados.";
$a->strings["Forumlist Settings"] = "Ajustes de la lista de foros";
$a->strings["Randomise forum list"] = "Aleatorizar la lista de foros";
$a->strings["Show forums on profile page"] = "Mostrar foros en la página de perfil";
$a->strings["Show forums on network page"] = "Mostrar foros en la página de red";
$a->strings["Submit"] = "Enviar";

View file

@ -0,0 +1,12 @@
<?php
$a->strings["Forums"] = "Forums";
$a->strings["show/hide"] = "Montrer/cacher";
$a->strings["No forum subscriptions"] = "Pas d'abonnement au forum";
$a->strings["Forums:"] = "Forums:";
$a->strings["Forumlist settings updated."] = "Paramètres de la liste des forums mis à jour.";
$a->strings["Forumlist Settings"] = "Paramètres de la liste des forums";
$a->strings["Randomise forum list"] = "Mélanger la liste de forums";
$a->strings["Show forums on profile page"] = "Montrer les forums sur le profil";
$a->strings["Show forums on network page"] = "";
$a->strings["Submit"] = "Envoyer";

View file

@ -0,0 +1,9 @@
<?php
$a->strings["Forums"] = "";
$a->strings["show/hide"] = "";
$a->strings["No forum subscriptions"] = "";
$a->strings["Forums:"] = "";
$a->strings["Forumlist settings updated."] = "";
$a->strings["Forumlist Settings"] = "";
$a->strings["Submit"] = "Senda inn";

View file

@ -0,0 +1,60 @@
# ADDON forumlist
# Copyright (C)
# This file is distributed under the same license as the Friendica forumlist addon package.
#
#
# Translators:
# fabrixxm <fabrix.xm@gmail.com>, 2014
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-02-27 05:01-0500\n"
"PO-Revision-Date: 2015-12-14 11:14+0000\n"
"Last-Translator: fabrixxm <fabrix.xm@gmail.com>\n"
"Language-Team: Italian (http://www.transifex.com/Friendica/friendica/language/it/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: it\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: forumlist.php:64
msgid "Forums"
msgstr "Forum"
#: forumlist.php:67
msgid "show/hide"
msgstr "mostra/nascondi"
#: forumlist.php:81
msgid "No forum subscriptions"
msgstr "Nessun forum collegato"
#: forumlist.php:98
msgid "Forums:"
msgstr "Forum:"
#: forumlist.php:134
msgid "Forumlist settings updated."
msgstr "Impostazioni Elenco Forum aggiornate."
#: forumlist.php:162
msgid "Forumlist Settings"
msgstr "Impostazioni Elenco Forum"
#: forumlist.php:164
msgid "Randomise forum list"
msgstr "Ordina casualmente l'elenco"
#: forumlist.php:167
msgid "Show forums on profile page"
msgstr "Mostra i forum sulla pagina profilo"
#: forumlist.php:170
msgid "Show forums on network page"
msgstr "Mostra i forum sulla pagina Rete"
#: forumlist.php:178
msgid "Submit"
msgstr "Invia"

View file

@ -0,0 +1,17 @@
<?php
if(! function_exists("string_plural_select_it")) {
function string_plural_select_it($n){
return ($n != 1);;
}}
;
$a->strings["Forums"] = "Forum";
$a->strings["show/hide"] = "mostra/nascondi";
$a->strings["No forum subscriptions"] = "Nessun forum collegato";
$a->strings["Forums:"] = "Forum:";
$a->strings["Forumlist settings updated."] = "Impostazioni Elenco Forum aggiornate.";
$a->strings["Forumlist Settings"] = "Impostazioni Elenco Forum";
$a->strings["Randomise forum list"] = "Ordina casualmente l'elenco";
$a->strings["Show forums on profile page"] = "Mostra i forum sulla pagina profilo";
$a->strings["Show forums on network page"] = "Mostra i forum sulla pagina Rete";
$a->strings["Submit"] = "Invia";

View file

@ -0,0 +1,12 @@
<?php
$a->strings["Forums"] = "";
$a->strings["show/hide"] = "";
$a->strings["No forum subscriptions"] = "";
$a->strings["Forums:"] = "";
$a->strings["Forumlist settings updated."] = "";
$a->strings["Forumlist Settings"] = "";
$a->strings["Randomise forum list"] = "";
$a->strings["Show forums on profile page"] = "";
$a->strings["Show forums on network page"] = "";
$a->strings["Submit"] = "Lagre";

View file

@ -0,0 +1,12 @@
<?php
$a->strings["Forums"] = "Fora";
$a->strings["show/hide"] = "pokaż/ukryj";
$a->strings["No forum subscriptions"] = "";
$a->strings["Forums:"] = "";
$a->strings["Forumlist settings updated."] = "";
$a->strings["Forumlist Settings"] = "";
$a->strings["Randomise forum list"] = "";
$a->strings["Show forums on profile page"] = "";
$a->strings["Show forums on network page"] = "";
$a->strings["Submit"] = "Potwierdź";

View file

@ -0,0 +1,12 @@
<?php
$a->strings["Forums"] = "Fóruns";
$a->strings["show/hide"] = "";
$a->strings["No forum subscriptions"] = "";
$a->strings["Forums:"] = "Fóruns:";
$a->strings["Forumlist settings updated."] = "";
$a->strings["Forumlist Settings"] = "";
$a->strings["Randomise forum list"] = "";
$a->strings["Show forums on profile page"] = "";
$a->strings["Show forums on network page"] = "";
$a->strings["Submit"] = "Enviar";

View file

@ -0,0 +1,60 @@
# ADDON forumlist
# Copyright (C)
# This file is distributed under the same license as the Friendica forumlist addon package.
#
#
# Translators:
# Doru DEACONU <dumitrudeaconu@yahoo.com>, 2014
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-02-27 05:01-0500\n"
"PO-Revision-Date: 2014-11-27 14:19+0000\n"
"Last-Translator: Doru DEACONU <dumitrudeaconu@yahoo.com>\n"
"Language-Team: Romanian (Romania) (http://www.transifex.com/projects/p/friendica/language/ro_RO/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ro_RO\n"
"Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1));\n"
#: forumlist.php:64
msgid "Forums"
msgstr "Forumuri"
#: forumlist.php:67
msgid "show/hide"
msgstr "afișare/ascundere"
#: forumlist.php:81
msgid "No forum subscriptions"
msgstr "Nu există subscrieri pe forum"
#: forumlist.php:98
msgid "Forums:"
msgstr "Forumuri:"
#: forumlist.php:134
msgid "Forumlist settings updated."
msgstr "Configurările Forumlist au fost actualizate."
#: forumlist.php:162
msgid "Forumlist Settings"
msgstr "Configurări Forumlist "
#: forumlist.php:164
msgid "Randomise forum list"
msgstr "Randomizare listă forum"
#: forumlist.php:167
msgid "Show forums on profile page"
msgstr "Afișare forumuri pe pagina de profil"
#: forumlist.php:170
msgid "Show forums on network page"
msgstr "Afișare forumuri pe pagina de rețea"
#: forumlist.php:178
msgid "Submit"
msgstr "Trimite"

View file

@ -0,0 +1,17 @@
<?php
if(! function_exists("string_plural_select_ro")) {
function string_plural_select_ro($n){
return ($n==1?0:((($n%100>19)||(($n%100==0)&&($n!=0)))?2:1));;
}}
;
$a->strings["Forums"] = "Forumuri";
$a->strings["show/hide"] = "afișare/ascundere";
$a->strings["No forum subscriptions"] = "Nu există subscrieri pe forum";
$a->strings["Forums:"] = "Forumuri:";
$a->strings["Forumlist settings updated."] = "Configurările Forumlist au fost actualizate.";
$a->strings["Forumlist Settings"] = "Configurări Forumlist ";
$a->strings["Randomise forum list"] = "Randomizare listă forum";
$a->strings["Show forums on profile page"] = "Afișare forumuri pe pagina de profil";
$a->strings["Show forums on network page"] = "Afișare forumuri pe pagina de rețea";
$a->strings["Submit"] = "Trimite";

View file

@ -0,0 +1,60 @@
# ADDON forumlist
# Copyright (C)
# This file is distributed under the same license as the Friendica forumlist addon package.
#
#
# Translators:
# Stanislav N. <pztrn@pztrn.name>, 2017
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-02-27 05:01-0500\n"
"PO-Revision-Date: 2017-04-08 17:11+0000\n"
"Last-Translator: Stanislav N. <pztrn@pztrn.name>\n"
"Language-Team: Russian (http://www.transifex.com/Friendica/friendica/language/ru/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ru\n"
"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n"
#: forumlist.php:64
msgid "Forums"
msgstr "Форумы"
#: forumlist.php:67
msgid "show/hide"
msgstr "показать/скрыть"
#: forumlist.php:81
msgid "No forum subscriptions"
msgstr "Нет подписок на форумы"
#: forumlist.php:98
msgid "Forums:"
msgstr "Форумы:"
#: forumlist.php:134
msgid "Forumlist settings updated."
msgstr "Настройки Forumlist обновлены."
#: forumlist.php:162
msgid "Forumlist Settings"
msgstr "Настройки Forumlist"
#: forumlist.php:164
msgid "Randomise forum list"
msgstr "Случайный список форумов"
#: forumlist.php:167
msgid "Show forums on profile page"
msgstr "Показывать форумы на странице профиля"
#: forumlist.php:170
msgid "Show forums on network page"
msgstr "Показывать форумы на странице сети"
#: forumlist.php:178
msgid "Submit"
msgstr "Добавить"

View file

@ -0,0 +1,17 @@
<?php
if(! function_exists("string_plural_select_ru")) {
function string_plural_select_ru($n){
return ($n%10==1 && $n%100!=11 ? 0 : $n%10>=2 && $n%10<=4 && ($n%100<12 || $n%100>14) ? 1 : $n%10==0 || ($n%10>=5 && $n%10<=9) || ($n%100>=11 && $n%100<=14)? 2 : 3);;
}}
;
$a->strings["Forums"] = "Форумы";
$a->strings["show/hide"] = "показать/скрыть";
$a->strings["No forum subscriptions"] = "Нет подписок на форумы";
$a->strings["Forums:"] = "Форумы:";
$a->strings["Forumlist settings updated."] = "Настройки Forumlist обновлены.";
$a->strings["Forumlist Settings"] = "Настройки Forumlist";
$a->strings["Randomise forum list"] = "Случайный список форумов";
$a->strings["Show forums on profile page"] = "Показывать форумы на странице профиля";
$a->strings["Show forums on network page"] = "Показывать форумы на странице сети";
$a->strings["Submit"] = "Добавить";

View file

@ -0,0 +1,60 @@
# ADDON forumlist
# Copyright (C)
# This file is distributed under the same license as the Friendica forumlist addon package.
#
#
# Translators:
# Jonatan Nyberg <jonatan@autistici.org>, 2017
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-02-27 05:01-0500\n"
"PO-Revision-Date: 2017-02-13 20:15+0000\n"
"Last-Translator: Jonatan Nyberg <jonatan@autistici.org>\n"
"Language-Team: Swedish (http://www.transifex.com/Friendica/friendica/language/sv/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: sv\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: forumlist.php:64
msgid "Forums"
msgstr "Forum"
#: forumlist.php:67
msgid "show/hide"
msgstr ""
#: forumlist.php:81
msgid "No forum subscriptions"
msgstr ""
#: forumlist.php:98
msgid "Forums:"
msgstr ""
#: forumlist.php:134
msgid "Forumlist settings updated."
msgstr ""
#: forumlist.php:162
msgid "Forumlist Settings"
msgstr ""
#: forumlist.php:164
msgid "Randomise forum list"
msgstr ""
#: forumlist.php:167
msgid "Show forums on profile page"
msgstr ""
#: forumlist.php:170
msgid "Show forums on network page"
msgstr ""
#: forumlist.php:178
msgid "Submit"
msgstr "Spara"

View file

@ -0,0 +1,17 @@
<?php
if(! function_exists("string_plural_select_sv")) {
function string_plural_select_sv($n){
return ($n != 1);;
}}
;
$a->strings["Forums"] = "Forum";
$a->strings["show/hide"] = "";
$a->strings["No forum subscriptions"] = "";
$a->strings["Forums:"] = "";
$a->strings["Forumlist settings updated."] = "";
$a->strings["Forumlist Settings"] = "";
$a->strings["Randomise forum list"] = "";
$a->strings["Show forums on profile page"] = "";
$a->strings["Show forums on network page"] = "";
$a->strings["Submit"] = "Spara";

View file

@ -0,0 +1,12 @@
<?php
$a->strings["Forums"] = "论坛";
$a->strings["show/hide"] = "表示/隐藏";
$a->strings["No forum subscriptions"] = "没有评坛订阅";
$a->strings["Forums:"] = "评坛:";
$a->strings["Forumlist settings updated."] = "评坛单设置更新了。";
$a->strings["Forumlist Settings"] = "评坛单设置";
$a->strings["Randomise forum list"] = "洗牌评坛单";
$a->strings["Show forums on profile page"] = "表示评坛在简介页";
$a->strings["Show forums on network page"] = "表示评坛在网络页";
$a->strings["Submit"] = "提交";

View file

@ -7,7 +7,6 @@
*
*/
use Friendica\Core\PConfig;
function fromapp_install() {
@ -33,8 +32,8 @@ function fromapp_settings_post($a,$post) {
if(! local_user() || (! x($_POST,'fromapp-submit')))
return;
PConfig::set(local_user(),'fromapp','app',$_POST['fromapp-input']);
PConfig::set(local_user(),'fromapp','force',intval($_POST['fromapp-force']));
set_pconfig(local_user(),'fromapp','app',$_POST['fromapp-input']);
set_pconfig(local_user(),'fromapp','force',intval($_POST['fromapp-force']));
info( t('Fromapp settings updated.') . EOL);
}
@ -50,9 +49,11 @@ function fromapp_settings(&$a,&$s) {
/* Get the current state of our config variable */
$fromapp = PConfig::get(local_user(),'fromapp', 'app', '');
$fromapp = get_pconfig(local_user(),'fromapp','app');
if($fromapp === false)
$fromapp = '';
$force = intval(PConfig::get(local_user(),'fromapp','force'));
$force = intval(get_pconfig(local_user(),'fromapp','force'));
$force_enabled = (($force) ? ' checked="checked" ' : '');
@ -82,29 +83,24 @@ function fromapp_settings(&$a,&$s) {
}
function fromapp_post_hook(&$a, &$item)
{
if (! local_user()) {
function fromapp_post_hook(&$a,&$item) {
if(! local_user())
return;
if(local_user() != $item['uid'])
return;
$app = get_pconfig(local_user(), 'fromapp', 'app');
$force = intval(get_pconfig(local_user(), 'fromapp','force'));
if(($app === false) || (! strlen($app)))
return;
if(strlen(trim($item['app'])) && (! $force))
return;
}
if (local_user() != $item['uid']) {
return;
}
$app = PConfig::get(local_user(), 'fromapp', 'app');
$force = intval(PConfig::get(local_user(), 'fromapp', 'force'));
if (is_null($app) || (! strlen($app))) {
return;
}
if (strlen(trim($item['app'])) && (! $force)) {
return;
}
$apps = explode(',', $app);
$item['app'] = trim($apps[mt_rand(0, count($apps)-1)]);
$apps = explode(',',$app);
$item['app'] = trim($apps[mt_rand(0,count($apps)-1)]);
return;
}

View file

@ -9,13 +9,9 @@
define('FROMGPLUS_DEFAULT_POLL_INTERVAL', 30); // given in minutes
use Friendica\Core\Config;
use Friendica\Core\PConfig;
use Friendica\Object\Image;
require_once 'mod/share.php';
require_once 'mod/parse_url.php';
require_once 'include/text.php';
require_once('mod/share.php');
require_once('mod/parse_url.php');
require_once('include/text.php');
function fromgplus_install() {
register_hook('connector_settings', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings');
@ -43,9 +39,9 @@ function fromgplus_addon_settings(&$a,&$s) {
if (count($result) > 0)
return;
$enable_checked = (intval(PConfig::get(local_user(),'fromgplus','enable')) ? ' checked="checked"' : '');
$keywords_checked = (intval(PConfig::get(local_user(), 'fromgplus', 'keywords')) ? ' checked="checked"' : '');
$account = PConfig::get(local_user(),'fromgplus','account');
$enable_checked = (intval(get_pconfig(local_user(),'fromgplus','enable')) ? ' checked="checked"' : '');
$keywords_checked = (intval(get_pconfig(local_user(), 'fromgplus', 'keywords')) ? ' checked="checked"' : '');
$account = get_pconfig(local_user(),'fromgplus','account');
$s .= '<span id="settings_fromgplus_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_fromgplus_expanded\'); openClose(\'settings_fromgplus_inflated\');">';
$s .= '<img class="connector" src="images/googleplus.png" /><h3 class="connector">'. t('Google+ Mirror').'</h3>';
@ -80,14 +76,14 @@ function fromgplus_addon_settings_post(&$a,&$b) {
return;
if($_POST['fromgplus-submit']) {
PConfig::set(local_user(),'fromgplus','account',trim($_POST['fromgplus-account']));
set_pconfig(local_user(),'fromgplus','account',trim($_POST['fromgplus-account']));
$enable = ((x($_POST,'fromgplus-enable')) ? intval($_POST['fromgplus-enable']) : 0);
PConfig::set(local_user(),'fromgplus','enable', $enable);
set_pconfig(local_user(),'fromgplus','enable', $enable);
$keywords = ((x($_POST, 'fromgplus-keywords')) ? intval($_POST['fromgplus-keywords']) : 0);
PConfig::set(local_user(),'fromgplus', 'keywords', $keywords);
set_pconfig(local_user(),'fromgplus', 'keywords', $keywords);
if (!$enable)
PConfig::delete(local_user(),'fromgplus','lastdate');
del_pconfig(local_user(),'fromgplus','lastdate');
info( t('Google+ Import Settings saved.') . EOL);
}
@ -96,22 +92,22 @@ function fromgplus_addon_settings_post(&$a,&$b) {
function fromgplus_plugin_admin(&$a, &$o){
$t = get_markup_template("admin.tpl", "addon/fromgplus/");
$o = replace_macros($t, [
$o = replace_macros($t, array(
'$submit' => t('Save Settings'),
'$key' => ['key', t('Key'), trim(Config::get('fromgplus', 'key')), t('')],
]);
'$key' => array('key', t('Key'), trim(get_config('fromgplus', 'key')), t('')),
));
}
function fromgplus_plugin_admin_post(&$a){
$key = ((x($_POST,'key')) ? trim($_POST['key']) : '');
Config::set('fromgplus','key',$key);
set_config('fromgplus','key',$key);
info( t('Settings updated.'). EOL );
}
function fromgplus_cron($a,$b) {
$last = Config::get('fromgplus','last_poll');
$last = get_config('fromgplus','last_poll');
$poll_interval = intval(Config::get('fromgplus','poll_interval'));
$poll_interval = intval(get_config('fromgplus','poll_interval'));
if(! $poll_interval)
$poll_interval = FROMGPLUS_DEFAULT_POLL_INTERVAL;
@ -128,7 +124,7 @@ function fromgplus_cron($a,$b) {
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'fromgplus' AND `k` = 'enable' AND `v` = '1' ORDER BY RAND() ");
if(count($r)) {
foreach($r as $rr) {
$account = PConfig::get($rr['uid'],'fromgplus','account');
$account = get_pconfig($rr['uid'],'fromgplus','account');
if ($account) {
logger('fromgplus: fetching for user '.$rr['uid']);
fromgplus_fetch($a, $rr['uid']);
@ -138,7 +134,7 @@ function fromgplus_cron($a,$b) {
logger('fromgplus: cron_end');
Config::set('fromgplus','last_poll', time());
set_config('fromgplus','last_poll', time());
}
function fromgplus_post($a, $uid, $source, $body, $location, $coord, $id) {
@ -198,13 +194,13 @@ function fromgplus_html2bbcode($html) {
$bbcode = html_entity_decode($html, ENT_QUOTES, 'UTF-8');
$bbcode = str_ireplace(["\n"], [""], $bbcode);
$bbcode = str_ireplace(["<b>", "</b>"], ["[b]", "[/b]"], $bbcode);
$bbcode = str_ireplace(["<i>", "</i>"], ["[i]", "[/i]"], $bbcode);
$bbcode = str_ireplace(["<s>", "</s>"], ["[s]", "[/s]"], $bbcode);
$bbcode = str_ireplace(["<br />"], ["\n"], $bbcode);
$bbcode = str_ireplace(["<br/>"], ["\n"], $bbcode);
$bbcode = str_ireplace(["<br>"], ["\n"], $bbcode);
$bbcode = str_ireplace(array("\n"), array(""), $bbcode);
$bbcode = str_ireplace(array("<b>", "</b>"), array("[b]", "[/b]"), $bbcode);
$bbcode = str_ireplace(array("<i>", "</i>"), array("[i]", "[/i]"), $bbcode);
$bbcode = str_ireplace(array("<s>", "</s>"), array("[s]", "[/s]"), $bbcode);
$bbcode = str_ireplace(array("<br />"), array("\n"), $bbcode);
$bbcode = str_ireplace(array("<br/>"), array("\n"), $bbcode);
$bbcode = str_ireplace(array("<br>"), array("\n"), $bbcode);
$bbcode = trim(strip_tags($bbcode));
return($bbcode);
@ -219,7 +215,7 @@ function fromgplus_parse_query($var)
$var = parse_url($var, PHP_URL_QUERY);
$var = html_entity_decode($var);
$var = explode('&', $var);
$arr = [];
$arr = array();
foreach($var as $val) {
$x = explode('=', $val);
@ -240,7 +236,7 @@ function fromgplus_cleanupgoogleproxy($fullImage, $image) {
//$image = str_replace(array($preview, $preview2), array("/", "/"), $image->url);
$image = $image->url;
$cleaned = [];
$cleaned = array();
$queryvar = fromgplus_parse_query($fullImage);
if ($queryvar['url'] != "")
@ -264,14 +260,14 @@ function fromgplus_cleanupgoogleproxy($fullImage, $image) {
}
if ($cleaned["full"] != "")
$infoFull = Image::getInfoFromURL($cleaned["full"]);
$infoFull = get_photo_info($cleaned["full"]);
else
$infoFull = ["0" => 0, "1" => 0];
$infoFull = array("0" => 0, "1" => 0);
if ($cleaned["preview"] != "")
$infoPreview = Image::getInfoFromURL($cleaned["preview"]);
$infoPreview = get_photo_info($cleaned["preview"]);
else
$infoFull = ["0" => 0, "1" => 0];
$infoFull = array("0" => 0, "1" => 0);
if (($infoPreview[0] >= $infoFull[0]) && ($infoPreview[1] >= $infoFull[1])) {
$temp = $cleaned["full"];
@ -304,17 +300,18 @@ function fromgplus_cleantext($text) {
$text = strip_tags($text);
$text = html_entity_decode($text, ENT_QUOTES);
$text = trim($text);
$text = str_replace(["\n", "\r", " ", $trash], ["", "", "", ""], $text);
$text = str_replace(array("\n", "\r", " ", $trash), array("", "", "", ""), $text);
return($text);
}
function fromgplus_handleattachments($a, $uid, $item, $displaytext, $shared) {
require_once("include/Photo.php");
require_once("include/items.php");
require_once("include/network.php");
$post = "";
$quote = "";
$pagedata = [];
$pagedata = array();
$pagedata["type"] = "";
foreach ($item->object->attachments as $attachment) {
@ -341,21 +338,20 @@ function fromgplus_handleattachments($a, $uid, $item, $displaytext, $shared) {
// Add Keywords to page link
$data = parseurl_getsiteinfo_cached($pagedata["url"], true);
if (isset($data["keywords"]) && PConfig::get($uid, 'fromgplus', 'keywords')) {
if (isset($data["keywords"]) && get_pconfig($uid, 'fromgplus', 'keywords')) {
$pagedata["keywords"] = $data["keywords"];
}
break;
case "photo":
// Don't store shared pictures in your wall photos (to prevent a possible violating of licenses)
if ($shared) {
if ($shared)
$images = fromgplus_cleanupgoogleproxy($attachment->fullImage, $attachment->image);
} else {
if ($attachment->fullImage->url != "") {
$images = Image::storePhoto($a, $uid, "", $attachment->fullImage->url);
} elseif ($attachment->image->url != "") {
$images = Image::storePhoto($a, $uid, "", $attachment->image->url);
}
else {
if ($attachment->fullImage->url != "")
$images = store_photo($a, $uid, "", $attachment->fullImage->url);
elseif ($attachment->image->url != "")
$images = store_photo($a, $uid, "", $attachment->image->url);
}
if ($images["preview"] != "") {
@ -366,9 +362,8 @@ function fromgplus_handleattachments($a, $uid, $item, $displaytext, $shared) {
$post .= "\n[img]".$images["full"]."[/img]\n";
$pagedata["images"][0]["src"] = $images["full"];
if ($images["preview"] != "") {
if ($images["preview"] != "")
$pagedata["images"][1]["src"] = $images["preview"];
}
}
if (($attachment->displayName != "") && (fromgplus_cleantext($attachment->displayName) != fromgplus_cleantext($displaytext))) {
@ -434,8 +429,8 @@ function fromgplus_fetch($a, $uid) {
// Special blank to identify postings from the googleplus connector
$blank = html_entity_decode("&#x00A0;", ENT_QUOTES, 'UTF-8');
$account = PConfig::get($uid,'fromgplus','account');
$key = Config::get('fromgplus','key');
$account = get_pconfig($uid,'fromgplus','account');
$key = get_config('fromgplus','key');
$result = fetch_url("https://www.googleapis.com/plus/v1/people/".$account."/activities/public?alt=json&pp=1&key=".$key."&maxResults=".$maxfetch);
//$result = file_get_contents("google.txt");
@ -443,7 +438,7 @@ function fromgplus_fetch($a, $uid) {
$activities = json_decode($result);
$initiallastdate = PConfig::get($uid,'fromgplus','lastdate');
$initiallastdate = get_pconfig($uid,'fromgplus','lastdate');
$first_time = ($initiallastdate == "");
@ -468,7 +463,7 @@ function fromgplus_fetch($a, $uid) {
if ($lastdate < strtotime($item->published))
$lastdate = strtotime($item->published);
PConfig::set($uid,'fromgplus','lastdate', $lastdate);
set_pconfig($uid,'fromgplus','lastdate', $lastdate);
if ($first_time)
continue;
@ -510,7 +505,7 @@ function fromgplus_fetch($a, $uid) {
case "activity":
$post = fromgplus_html2bbcode($item->annotation)."\n";
if (!intval(Config::get('system','old_share'))) {
if (!intval(get_config('system','old_share'))) {
if (function_exists("share_header"))
$post .= share_header($item->object->actor->displayName, $item->object->actor->url,
@ -560,5 +555,5 @@ function fromgplus_fetch($a, $uid) {
}
}
if ($lastdate != 0)
PConfig::set($uid,'fromgplus','lastdate', $lastdate);
set_pconfig($uid,'fromgplus','lastdate', $lastdate);
}

View file

@ -6,32 +6,26 @@
* Author: Michael Vogel <https://pirati.ca/profile/heluecht>
*/
use Friendica\Core\Cache;
use Friendica\Core\Config;
function geocoordinates_install()
{
function geocoordinates_install() {
register_hook('post_local', 'addon/geocoordinates/geocoordinates.php', 'geocoordinates_post_hook');
register_hook('post_remote', 'addon/geocoordinates/geocoordinates.php', 'geocoordinates_post_hook');
}
function geocoordinates_uninstall()
{
function geocoordinates_uninstall() {
unregister_hook('post_local', 'addon/geocoordinates/geocoordinates.php', 'geocoordinates_post_hook');
unregister_hook('post_remote', 'addon/geocoordinates/geocoordinates.php', 'geocoordinates_post_hook');
}
function geocoordinates_resolve_item(&$item)
{
function geocoordinates_resolve_item(&$item) {
if((!$item["coord"]) || ($item["location"]))
return;
$key = Config::get("geocoordinates", "api_key");
$key = get_config("geocoordinates", "api_key");
if ($key == "")
return;
$language = Config::get("geocoordinates", "language");
$language = get_config("geocoordinates", "language");
if ($language == "")
$language = "de";
@ -76,29 +70,26 @@ function geocoordinates_resolve_item(&$item)
Cache::set("geocoordinates:".$language.":".$coords[0]."-".$coords[1], $item["location"]);
}
function geocoordinates_post_hook($a, &$item)
{
function geocoordinates_post_hook($a, &$item) {
geocoordinates_resolve_item($item);
}
function geocoordinates_plugin_admin(&$a, &$o)
{
function geocoordinates_plugin_admin(&$a,&$o) {
$t = get_markup_template("admin.tpl", "addon/geocoordinates/");
$o = replace_macros($t, [
$o = replace_macros($t, array(
'$submit' => t('Save Settings'),
'$api_key' => ['api_key', t('API Key'), Config::get('geocoordinates', 'api_key' ), ''],
'$language' => ['language', t('Language code (IETF format)'), Config::get('geocoordinates', 'language' ), ''],
]);
'$api_key' => array('api_key', t('API Key'), get_config('geocoordinates', 'api_key' ), ''),
'$language' => array('language', t('Language code (IETF format)'), get_config('geocoordinates', 'language' ), ''),
));
}
function geocoordinates_plugin_admin_post(&$a)
{
function geocoordinates_plugin_admin_post(&$a) {
$api_key = ((x($_POST,'api_key')) ? notags(trim($_POST['api_key'])) : '');
Config::set('geocoordinates','api_key',$api_key);
set_config('geocoordinates','api_key',$api_key);
$language = ((x($_POST,'language')) ? notags(trim($_POST['language'])) : '');
Config::set('geocoordinates','language',$language);
set_config('geocoordinates','language',$language);
info(t('Settings updated.'). EOL);
}

View file

@ -20,8 +20,6 @@
*
*/
use Friendica\Core\Config;
use Friendica\Core\PConfig;
function geonames_install() {
@ -93,8 +91,8 @@ function geonames_post_hook($a, &$item) {
/* Retrieve our personal config setting */
$geo_account = Config::get('geonames', 'username');
$active = PConfig::get(local_user(), 'geonames', 'enable');
$geo_account = get_config('geonames', 'username');
$active = get_pconfig(local_user(), 'geonames', 'enable');
if((! $geo_account) || (! $active))
return;
@ -140,7 +138,7 @@ function geonames_post_hook($a, &$item) {
function geonames_plugin_admin_post($a,$post) {
if(! local_user() || (! x($_POST,'geonames-submit')))
return;
PConfig::set(local_user(),'geonames','enable',intval($_POST['geonames']));
set_pconfig(local_user(),'geonames','enable',intval($_POST['geonames']));
info( t('Geonames settings updated.') . EOL);
}
@ -160,7 +158,7 @@ function geonames_plugin_admin(&$a,&$s) {
if(! local_user())
return;
$geo_account = Config::get('geonames', 'username');
$geo_account = get_config('geonames', 'username');
if(! $geo_account)
return;
@ -171,7 +169,7 @@ function geonames_plugin_admin(&$a,&$s) {
/* Get the current state of our config variable */
$enabled = PConfig::get(local_user(),'geonames','enable');
$enabled = get_pconfig(local_user(),'geonames','enable');
$checked = (($enabled) ? ' checked="checked" ' : '');

View file

@ -8,7 +8,6 @@
*
*/
use Friendica\Core\PConfig;
function gnot_install() {
@ -45,7 +44,7 @@ function gnot_settings_post($a,$post) {
if(! local_user() || (! x($_POST,'gnot-submit')))
return;
PConfig::set(local_user(),'gnot','enable',intval($_POST['gnot']));
set_pconfig(local_user(),'gnot','enable',intval($_POST['gnot']));
info( t('Gnot settings updated.') . EOL);
}
@ -70,7 +69,7 @@ function gnot_settings(&$a,&$s) {
/* Get the current state of our config variable */
$gnot = intval(PConfig::get(local_user(),'gnot','enable'));
$gnot = intval(get_pconfig(local_user(),'gnot','enable'));
$gnot_checked = (($gnot) ? ' checked="checked" ' : '' );
@ -92,7 +91,7 @@ function gnot_settings(&$a,&$s) {
function gnot_enotify_mail(&$a,&$b) {
if((! $b['uid']) || (! intval(PConfig::get($b['uid'], 'gnot','enable'))))
if((! $b['uid']) || (! intval(get_pconfig($b['uid'], 'gnot','enable'))))
return;
if($b['type'] == NOTIFY_COMMENT)
$b['subject'] = sprintf( t('[Friendica:Notify] Comment to conversation #%d'), $b['parent']);

View file

@ -7,40 +7,35 @@
*
*/
use Friendica\Core\Cache;
require_once('include/cache.php');
function googlemaps_install()
{
function googlemaps_install() {
register_hook('render_location', 'addon/googlemaps/googlemaps.php', 'googlemaps_location');
logger("installed googlemaps");
}
function googlemaps_uninstall()
{
function googlemaps_uninstall() {
unregister_hook('render_location', 'addon/googlemaps/googlemaps.php', 'googlemaps_location');
logger("removed googlemaps");
}
function googlemaps_location($a, &$item)
{
function googlemaps_location($a, &$item) {
if(! (strlen($item['location']) || strlen($item['coord']))) {
if(! (strlen($item['location']) || strlen($item['coord'])))
return;
}
if ($item['coord'] != ""){
if ($item['coord'] != "")
$target = "http://maps.google.com/?q=".urlencode($item['coord']);
} else {
else
$target = "http://maps.google.com/?q=".urlencode($item['location']);
}
if ($item['location'] != "") {
if ($item['location'] != "")
$title = $item['location'];
} else {
else
$title = $item['coord'];
}
$item['html'] = '<a target="map" title="'.$title.'" href= "'.$target.'">'.$title.'</a>';
}

2
gpluspost/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
postToGooglePlus.php
nxs-http.php

19
gpluspost/gpluspost.css Normal file
View file

@ -0,0 +1,19 @@
#gpluspost-enable-label, #gpluspost-bydefault-label, #gpluspost-noloopprevention-label,
#gpluspost-skipwithoutlink-label, #gpluspost-mirror-label, #gpluspost-account-label,
#gpluspost-username-label, #gpluspost-password-label, #gpluspost-page-label {
float: left;
width: 200px;
margin-top: 10px;
}
#gpluspost-checkbox, #gpluspost-bydefault, #gpluspost-noloopprevention,
#gpluspost-skipwithoutlink, #gpluspost-mirror, #gpluspost-account,
#gpluspost-username, #gpluspost-password, #gpluspost-page {
float: left;
margin-top: 10px;
}
#gpluspost-submit {
margin-top: 15px;
}

576
gpluspost/gpluspost.php Normal file
View file

@ -0,0 +1,576 @@
<?php
/**
* Name: G+ Post
* Description: Posts to a Google+ page with the help of Hootsuite
* Version: 0.1
* Author: Michael Vogel <https://pirati.ca/profile/heluecht>
* Status: Unsupported
*/
function gpluspost_install() {
register_hook('post_local', 'addon/gpluspost/gpluspost.php', 'gpluspost_post_local');
register_hook('notifier_normal', 'addon/gpluspost/gpluspost.php', 'gpluspost_send');
register_hook('jot_networks', 'addon/gpluspost/gpluspost.php', 'gpluspost_jot_nets');
register_hook('connector_settings', 'addon/gpluspost/gpluspost.php', 'gpluspost_settings');
register_hook('connector_settings_post', 'addon/gpluspost/gpluspost.php', 'gpluspost_settings_post');
register_hook('queue_predeliver', 'addon/gpluspost/gpluspost.php', 'gpluspost_queue_hook');
}
function gpluspost_uninstall() {
unregister_hook('post_local', 'addon/gpluspost/gpluspost.php', 'gpluspost_post_local');
unregister_hook('notifier_normal', 'addon/gpluspost/gpluspost.php', 'gpluspost_send');
unregister_hook('jot_networks', 'addon/gpluspost/gpluspost.php', 'gpluspost_jot_nets');
unregister_hook('connector_settings', 'addon/gpluspost/gpluspost.php', 'gpluspost_settings');
unregister_hook('connector_settings_post', 'addon/gpluspost/gpluspost.php', 'gpluspost_settings_post');
unregister_hook('queue_predeliver', 'addon/gpluspost/gpluspost.php', 'gpluspost_queue_hook');
}
function gpluspost_jot_nets(&$a,&$b) {
if(! local_user())
return;
$post = get_pconfig(local_user(),'gpluspost','post');
if(intval($post) == 1) {
$defpost = get_pconfig(local_user(),'gpluspost','post_by_default');
$selected = ((intval($defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="gpluspost_enable"' . $selected . ' value="1" /> '
. t('Post to Google+') . '</div>';
}
}
function gpluspost_nextscripts() {
$a = get_app();
return file_exists($a->get_basepath()."/addon/gpluspost/postToGooglePlus.php");
}
function gpluspost_settings(&$a,&$s) {
if(! local_user())
return;
$result = q("SELECT `installed` FROM `addon` WHERE `name` = 'fromgplus' AND `installed`");
$fromgplus_enabled = count($result) > 0;
/* Add our stylesheet to the page so we can make our settings look nice */
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/gpluspost/gpluspost.css' . '" media="all" />' . "\r\n";
$enabled = get_pconfig(local_user(),'gpluspost','post');
$checked = (($enabled) ? ' checked="checked" ' : '');
$css = (($enabled) ? '' : '-disabled');
$def_enabled = get_pconfig(local_user(),'gpluspost','post_by_default');
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
$noloop_enabled = get_pconfig(local_user(),'gpluspost','no_loop_prevention');
$noloop_checked = (($noloop_enabled) ? ' checked="checked" ' : '');
$skip_enabled = get_pconfig(local_user(),'gpluspost','skip_without_link');
$skip_checked = (($skip_enabled) ? ' checked="checked" ' : '');
$mirror_enable_checked = (intval(get_pconfig(local_user(),'fromgplus','enable')) ? ' checked="checked"' : '');
$mirror_account = get_pconfig(local_user(),'fromgplus','account');
$username = get_pconfig(local_user(), 'gpluspost', 'username');
$password = get_pconfig(local_user(), 'gpluspost', 'password');
$page = get_pconfig(local_user(), 'gpluspost', 'page');
if ($fromgplus_enabled)
$title = "Google+ Export/Mirror";
else
$title = "Google+ Export";
$s .= '<span id="settings_gpluspost_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_gpluspost_expanded\'); openClose(\'settings_gpluspost_inflated\');">';
$s .= '<img class="connector'.$css.'" src="images/googleplus.png" /><h3 class="connector">'. t($title).'</h3>';
$s .= '</span>';
$s .= '<div id="settings_gpluspost_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_gpluspost_expanded\'); openClose(\'settings_gpluspost_inflated\');">';
$s .= '<img class="connector'.$css.'" src="images/googleplus.png" /><h3 class="connector">'. t($title).'</h3>';
$s .= '</span>';
$s .= '<div id="gpluspost-enable-wrapper">';
$s .= '<label id="gpluspost-enable-label" for="gpluspost-checkbox">' . t('Enable Google+ Post Plugin') . '</label>';
$s .= '<input id="gpluspost-checkbox" type="checkbox" name="gpluspost" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div>';
if (gpluspost_nextscripts()) {
/*
// To-Do: Option to check the credentials if requested
if (($username != "") && ($password != "")) {
require_once("addon/gpluspost/postToGooglePlus.php");
$loginError = doConnectToGooglePlus2($username, $password);
if ($loginError)
$s .= '<p>Login Error. Please enter the correct credentials.</p>';
}*/
$s .= '<div id="gpluspost-username-wrapper">';
$s .= '<label id="gpluspost-username-label" for="gpluspost-username">' . t('Google+ username') . '</label>';
$s .= '<input id="gpluspost-username" type="text" name="username" value="' . $username . '" />';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="gpluspost-password-wrapper">';
$s .= '<label id="gpluspost-password-label" for="gpluspost-password">' . t('Google+ password') . '</label>';
$s .= '<input id="gpluspost-password" type="password" name="password" value="' . $password . '" />';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="gpluspost-page-wrapper">';
$s .= '<label id="gpluspost-page-label" for="gpluspost-page">' . t('Google+ page number') . '</label>';
$s .= '<input id="gpluspost-page" type="text" name="page" value="' . $page . '" />';
$s .= '</div><div class="clear"></div>';
}
$s .= '<div id="gpluspost-bydefault-wrapper">';
$s .= '<label id="gpluspost-bydefault-label" for="gpluspost-bydefault">' . t('Post to Google+ by default') . '</label>';
$s .= '<input id="gpluspost-bydefault" type="checkbox" name="gpluspost_bydefault" value="1" ' . $def_checked . '/>';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="gpluspost-noloopprevention-wrapper">';
$s .= '<label id="gpluspost-noloopprevention-label" for="gpluspost-noloopprevention">' . t('Do not prevent posting loops') . '</label>';
$s .= '<input id="gpluspost-noloopprevention" type="checkbox" name="gpluspost_noloopprevention" value="1" ' . $noloop_checked . '/>';
$s .= '</div><div class="clear"></div>';
if (!gpluspost_nextscripts()) {
$s .= '<div id="gpluspost-skipwithoutlink-wrapper">';
$s .= '<label id="gpluspost-skipwithoutlink-label" for="gpluspost-skipwithoutlink">' . t('Skip messages without links') . '</label>';
$s .= '<input id="gpluspost-skipwithoutlink" type="checkbox" name="gpluspost_skipwithoutlink" value="1" ' . $skip_checked . '/>';
$s .= '</div><div class="clear"></div>';
}
if ($fromgplus_enabled) {
$s .= '<div id="gpluspost-mirror-wrapper">';
$s .= '<label id="gpluspost-mirror-label" for="gpluspost-mirror">'.t('Mirror all public posts').'</label>';
$s .= '<input id="gpluspost-mirror" type="checkbox" name="fromgplus-enable" value="1"'.$mirror_enable_checked.' />';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="gpluspost-mirroraccount-wrapper">';
$s .= '<label id="gpluspost-account-label" for="gpluspost-account">'.t('Mirror Google Account ID').' </label>';
$s .= '<input id="gpluspost-account" type="text" name="fromgplus-account" value="'.$mirror_account.'" />';
$s .= '</div><div class="clear"></div>';
}
/* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="gpluspost-submit" name="gpluspost-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div>';
if (gpluspost_nextscripts()) {
$s .= "<p>If the plugin doesn't work or if it stopped, please login to Google+, then unlock your account by following this <a href='https://www.google.com/accounts/UnlockCaptcha'>link</a>. ";
$s .= 'At this page please click on "Continue". Then your posts should arrive in several minutes.</p>';
} else {
$s .= '<p>Register an account at <a href="https://hootsuite.com">Hootsuite</a>, add your G+ page and add the feed-url there.<br />';
$s .= 'Feed-url: '.$a->get_baseurl().'/gpluspost/'.urlencode($a->user["nickname"]).'</p>';
}
$s .= '</div>';
}
function gpluspost_settings_post(&$a,&$b) {
if(x($_POST,'gpluspost-submit')) {
set_pconfig(local_user(),'gpluspost','post',intval($_POST['gpluspost']));
set_pconfig(local_user(),'gpluspost','post_by_default',intval($_POST['gpluspost_bydefault']));
set_pconfig(local_user(),'gpluspost','no_loop_prevention',intval($_POST['gpluspost_noloopprevention']));
if (!gpluspost_nextscripts()) {
set_pconfig(local_user(),'gpluspost','skip_without_link',intval($_POST['gpluspost_skipwithoutlink']));
} else {
set_pconfig(local_user(),'gpluspost','username',trim($_POST['username']));
set_pconfig(local_user(),'gpluspost','password',trim($_POST['password']));
set_pconfig(local_user(),'gpluspost','page',trim($_POST['page']));
}
$result = q("SELECT `installed` FROM `addon` WHERE `name` = 'fromgplus' AND `installed`");
if (count($result) > 0) {
set_pconfig(local_user(),'fromgplus','account',trim($_POST['fromgplus-account']));
$enable = ((x($_POST,'fromgplus-enable')) ? intval($_POST['fromgplus-enable']) : 0);
set_pconfig(local_user(),'fromgplus','enable', $enable);
if (!$enable)
del_pconfig(local_user(),'fromgplus','lastdate');
}
}
}
function gpluspost_post_local(&$a,&$b) {
if($b['edit'])
return;
if((! local_user()) || (local_user() != $b['uid']))
return;
if($b['private'] || $b['parent'])
return;
$post = intval(get_pconfig(local_user(),'gpluspost','post'));
$enable = (($post && x($_REQUEST,'gpluspost_enable')) ? intval($_REQUEST['gpluspost_enable']) : 0);
if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'gpluspost','post_by_default')))
$enable = 1;
if(!$enable)
return;
if(strlen($b['postopts']))
$b['postopts'] .= ',';
$b['postopts'] .= 'gplus';
}
function gpluspost_send(&$a,&$b) {
logger('gpluspost_send: invoked for post '.$b['id']." ".$b['app']);
if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
return;
if(! strstr($b['postopts'],'gplus'))
return;
if($b['parent'] != $b['id'])
return;
// if post comes from Google+ don't send it back
if (!get_pconfig($b["uid"],'gpluspost','no_loop_prevention') && (($b['app'] == "Google+") || ($b["extid"] == NETWORK_GPLUS)))
return;
if (!gpluspost_nextscripts()) {
// Posting via RSS-Feed and Hootsuite
$itemlist = get_pconfig($b["uid"],'gpluspost','itemlist');
$items = explode(",", $itemlist);
$i = 0;
$newitems = array($b['id']);
foreach ($items AS $item)
if ($i++ < 9)
$newitems[] = $item;
$itemlist = implode(",", $newitems);
logger('gpluspost_send: new itemlist: '.$itemlist." for uid ".$b["uid"]);
set_pconfig($b["uid"],'gpluspost','itemlist', $itemlist);
} else {
// Posting via NextScripts
$username = get_pconfig($b['uid'],'gpluspost','username');
$password = get_pconfig($b['uid'],'gpluspost','password');
$page = get_pconfig($b['uid'],'gpluspost','page');
$success = false;
if($username && $password) {
require_once("addon/gpluspost/postToGooglePlus.php");
require_once("include/plaintext.php");
$item = $b;
// Markup for Google+
if ($item["title"] != "")
$item["title"] = "*".$item["title"]."*";
$item["body"] = preg_replace("(\[b\](.*?)\[\/b\])ism",'*$1*',$item["body"]);
$item["body"] = preg_replace("(\[i\](.*?)\[\/i\])ism",'_$1_',$item["body"]);
$item["body"] = preg_replace("(\[s\](.*?)\[\/s\])ism",'-$1-',$item["body"]);
$data = plaintext($a, $item, 0, false, 9);
logger('gpluspost_send: data: '.print_r($data, true), LOGGER_DEBUG);
$loginError = doConnectToGooglePlus2($username, $password);
if (!$loginError) {
if ($data["url"] != "")
$lnk = doGetGoogleUrlInfo2($data["url"]);
elseif ($data["image"] != "")
$lnk = array('img'=>$data["image"]);
else
$lnk = "";
// Send a special blank to identify the post through the "fromgplus" addon
$blank = html_entity_decode("&#x00A0;", ENT_QUOTES, 'UTF-8');
doPostToGooglePlus2($data["text"].$blank, $lnk, $page);
$success = true;
logger('gpluspost_send: '.$b['uid'].' success', LOGGER_DEBUG);
} else
logger('gpluspost_send: '.$b['uid'].' failed '.$loginError, LOGGER_DEBUG);
if (!$success) {
logger('gpluspost_send: requeueing '.$b['uid'], LOGGER_DEBUG);
$r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self`", $b['uid']);
if (count($r))
$a->contact = $r[0]["id"];
$s = serialize(array('url' => $url, 'item' => $b['id'], 'post' => $data));
require_once('include/queue_fn.php');
add_to_queue($a->contact,NETWORK_GPLUS,$s);
notice(t('Google+ post failed. Queued for retry.').EOL);
}
} else
logger('gpluspost_send: '.$b['uid'].' missing username or password', LOGGER_DEBUG);
}
}
function gpluspost_queue_hook(&$a,&$b) {
$qi = q("SELECT * FROM `queue` WHERE `network` = '%s'",
dbesc(NETWORK_GPLUS)
);
if(! count($qi))
return;
require_once('include/queue_fn.php');
foreach($qi as $x) {
if($x['network'] !== NETWORK_GPLUS)
continue;
logger('gpluspost_queue: run');
$r = q("SELECT `user`.* FROM `user` LEFT JOIN `contact` on `contact`.`uid` = `user`.`uid`
WHERE `contact`.`self` = 1 AND `contact`.`id` = %d LIMIT 1",
intval($x['cid'])
);
if(! count($r))
continue;
$userdata = $r[0];
//logger('gpluspost_queue: fetching userdata '.print_r($userdata, true));
$username = get_pconfig($userdata['uid'],'gpluspost','username');
$password = get_pconfig($userdata['uid'],'gpluspost','password');
$page = get_pconfig($userdata['uid'],'gpluspost','page');
$success = false;
if($username && $password) {
require_once("addon/gpluspost/postToGooglePlus.php");
logger('gpluspost_queue: able to post for user '.$username);
$z = unserialize($x['content']);
$data = $z['post'];
// $z['url']
logger('gpluspost_send: data: '.print_r($data, true), LOGGER_DATA);
$loginError = doConnectToGooglePlus2($username, $password);
if (!$loginError) {
if ($data["url"] != "")
$lnk = doGetGoogleUrlInfo2($data["url"]);
elseif ($data["image"] != "")
$lnk = array('img'=>$data["image"]);
else
$lnk = "";
// Send a special blank to identify the post through the "fromgplus" addon
$blank = html_entity_decode("&#x00A0;", ENT_QUOTES, 'UTF-8');
doPostToGooglePlus2($data["text"].$blank, $lnk, $page);
logger('gpluspost_queue: send '.$userdata['uid'].' success', LOGGER_DEBUG);
$success = true;
remove_queue_item($x['id']);
} else
logger('gpluspost_queue: send '.$userdata['uid'].' failed '.$loginError, LOGGER_DEBUG);
} else
logger('gpluspost_queue: send '.$userdata['uid'].' missing username or password', LOGGER_DEBUG);
if (!$success) {
logger('gpluspost_queue: delayed');
update_queue_time($x['id']);
}
}
}
function gpluspost_module() {}
function gpluspost_init() {
global $a, $_SERVER;
$uid = 0;
if (isset($a->argv[1])) {
$uid = (int)$a->argv[1];
if ($uid == 0) {
$contacts = q("SELECT `username`, `uid` FROM `user` WHERE `nickname` = '%s' LIMIT 1", dbesc($a->argv[1]));
if ($contacts) {
$uid = $contacts[0]["uid"];
$nick = $a->argv[1];
}
} else {
$contacts = q("SELECT `username` FROM `user` WHERE `uid`=%d LIMIT 1", intval($uid));
$nick = $uid;
}
}
header("content-type: application/atom+xml");
echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
echo '<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">'."\n";
echo "\t".'<title type="html"><![CDATA['.$a->config['sitename'].']]></title>'."\n";
if ($uid != 0) {
echo "\t".'<subtitle type="html"><![CDATA['.$contacts[0]["username"]."]]></subtitle>\n";
echo "\t".'<link rel="self" href="'.$a->get_baseurl().'/gpluspost/'.$nick.'"/>'."\n";
} else
echo "\t".'<link rel="self" href="'.$a->get_baseurl().'/gpluspost"/>'."\n";
echo "\t<id>".$a->get_baseurl()."/</id>\n";
echo "\t".'<link rel="alternate" type="text/html" href="'.$a->get_baseurl().'"/>'."\n";
echo "\t<updated>".date("c")."</updated>\n"; // To-Do
// <rights>Copyright ... </rights>
echo "\t".'<generator uri="'.$a->get_baseurl().'">'.$a->config['sitename'].'</generator>'."\n";
if ($uid != 0) {
$itemlist = get_pconfig($uid,'gpluspost','itemlist');
$items = explode(",", $itemlist);
foreach ($items AS $item)
gpluspost_feeditem($item, $uid);
} else {
$items = q("SELECT `id` FROM `item` WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0 AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `item`.`private` = 0 AND `item`.`wall` = 1 AND `item`.`id` = `item`.`parent` ORDER BY `received` DESC LIMIT 10");
foreach ($items AS $item)
gpluspost_feeditem($item["id"], $uid);
}
echo "</feed>\n";
killme();
}
function gpluspost_feeditem($pid, $uid) {
global $a;
require_once('include/api.php');
require_once('include/bbcode.php');
require_once("include/html2plain.php");
require_once("include/network.php");
$skipwithoutlink = get_pconfig($uid,'gpluspost','skip_without_link');
$items = q("SELECT `uri`, `plink`, `author-link`, `author-name`, `created`, `edited`, `id`, `title`, `body` from `item` WHERE id=%d", intval($pid));
foreach ($items AS $item) {
$item['body'] = bb_CleanPictureLinks($item['body']);
$item['body'] = bb_remove_share_information($item['body'], true);
if ($item["title"] != "")
$item['body'] = "*".$item["title"]."*\n\n".$item['body'];
// Looking for the first image
$image = '';
if(preg_match("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/is",$item['body'],$matches))
$image = $matches[3];
if ($image == '')
if(preg_match("/\[img\](.*?)\[\/img\]/is",$item['body'],$matches))
$image = $matches[1];
$multipleimages = (strpos($item['body'], "[img") != strrpos($item['body'], "[img"));
// When saved into the database the content is sent through htmlspecialchars
// That means that we have to decode all image-urls
$image = htmlspecialchars_decode($image);
$link = '';
// look for bookmark-bbcode and handle it with priority
if(preg_match("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/is",$item['body'],$matches))
$link = $matches[1];
$multiplelinks = (strpos($item['body'], "[bookmark") != strrpos($item['body'], "[bookmark"));
$body = $item['body'];
$body = preg_replace("(\[b\](.*?)\[\/b\])ism",'*$1*',$body);
$body = preg_replace("(\[i\](.*?)\[\/i\])ism",'_$1_',$body);
$body = preg_replace("(\[s\](.*?)\[\/s\])ism",'-$1-',$body);
// At first convert the text to html
$html = bbcode(api_clean_plain_items($body), false, false, 2);
// Then convert it to plain text
$msg = trim(html2plain($html, 0, true));
$msg = html_entity_decode($msg,ENT_QUOTES,'UTF-8');
// If there is no bookmark element then take the first link
if ($link == '') {
$links = collecturls($html);
if (sizeof($links) > 0) {
reset($links);
$link = current($links);
}
$multiplelinks = (sizeof($links) > 1);
if ($multiplelinks) {
$html2 = bbcode($msg, false, false);
$links2 = collecturls($html2);
if (sizeof($links2) > 0) {
reset($links2);
$link = current($links2);
$multiplelinks = (sizeof($links2) > 1);
}
}
}
$msglink = "";
if ($multiplelinks)
$msglink = $item["plink"];
else if ($link != "")
$msglink = $link;
else if ($multipleimages)
$msglink = $item["plink"];
else if ($image != "")
$msglink = $image;
if (($msglink == "") && $skipwithoutlink)
continue;
else if ($msglink == "")
$msglink = $item["plink"];
// Fetching the title - or the first line
if ($item["title"] != "")
$title = $item["title"];
else {
$lines = explode("\n", $msg);
$title = $lines[0];
}
//if ($image != $msglink)
// $html = trim(str_replace($msglink, "", $html));
$title = trim(str_replace($msglink, "", $title));
$msglink = original_url($msglink);
if ($uid == 0)
$title = $item["author-name"].": ".$title;
$msglink = htmlspecialchars(html_entity_decode($msglink));
if (strpos($msg, $msglink) == 0)
$msg .= "\n".$msglink;
$msg = nl2br($msg);
$title = str_replace("&", "&amp;", $title);
//$html = str_replace("&", "&amp;", $html);
echo "\t".'<entry xmlns="http://www.w3.org/2005/Atom">'."\n";
echo "\t\t".'<title type="html" xml:space="preserve"><![CDATA['.$title."]]></title>\n";
echo "\t\t".'<link rel="alternate" type="text/html" href="'.$msglink.'" />'."\n";
// <link rel="enclosure" type="audio/mpeg" length="1337" href="http://example.org/audio/ph34r_my_podcast.mp3"/>
echo "\t\t<id>".$item["uri"]."</id>\n";
echo "\t\t<updated>".date("c", strtotime($item["edited"]))."</updated>\n";
echo "\t\t<published>".date("c", strtotime($item["created"]))."</published>\n";
echo "\t\t<author>\n\t\t\t<name><![CDATA[".$item["author-name"]."]]></name>\n";
echo "\t\t\t<uri>".$item["author-link"]."</uri>\n\t\t</author>\n";
//echo '<content type="image/png" src="http://media.example.org/the_beach.png"/>';
echo "\t\t".'<content type="html" xml:space="preserve" xml:base="'.$item["plink"].'"><![CDATA['.$msg."]]></content>\n";
echo "\t</entry>\n";
}
}

View file

@ -0,0 +1,66 @@
# ADDON gpluspost
# Copyright (C)
# This file is distributed under the same license as the Friendica gpluspost addon package.
#
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-11-12 16:50+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: gpluspost.php:39
msgid "Post to Google+"
msgstr ""
#: gpluspost.php:94
msgid "Enable Google+ Post Plugin"
msgstr ""
#: gpluspost.php:109
msgid "Google+ username"
msgstr ""
#: gpluspost.php:114
msgid "Google+ password"
msgstr ""
#: gpluspost.php:119
msgid "Google+ page number"
msgstr ""
#: gpluspost.php:125
msgid "Post to Google+ by default"
msgstr ""
#: gpluspost.php:130
msgid "Do not prevent posting loops"
msgstr ""
#: gpluspost.php:136
msgid "Skip messages without links"
msgstr ""
#: gpluspost.php:143
msgid "Mirror all public posts"
msgstr ""
#: gpluspost.php:147
msgid "Mirror Google Account ID"
msgstr ""
#: gpluspost.php:154
msgid "Save Settings"
msgstr ""
#: gpluspost.php:310
msgid "Google+ post failed. Queued for retry."
msgstr ""

View file

@ -0,0 +1,68 @@
# ADDON gpluspost
# Copyright (C)
# This file is distributed under the same license as the Friendica gpluspost addon package.
#
#
# Translators:
# Michal Šupler <msupler@gmail.com>, 2014
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-06-23 14:44+0200\n"
"PO-Revision-Date: 2014-07-07 19:09+0000\n"
"Last-Translator: Michal Šupler <msupler@gmail.com>\n"
"Language-Team: Czech (http://www.transifex.com/projects/p/friendica/language/cs/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: cs\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
#: gpluspost.php:38
msgid "Post to Google+"
msgstr "Příspěvek na Google+"
#: gpluspost.php:93
msgid "Enable Google+ Post Plugin"
msgstr "Povolit Google+ Plugin"
#: gpluspost.php:108
msgid "Google+ username"
msgstr "Google+ uživatelské jméno"
#: gpluspost.php:113
msgid "Google+ password"
msgstr "Google+ heslo"
#: gpluspost.php:118
msgid "Google+ page number"
msgstr "Google+ číslo stránky"
#: gpluspost.php:124
msgid "Post to Google+ by default"
msgstr "Defaultně zaslat na Google+"
#: gpluspost.php:129
msgid "Do not prevent posting loops"
msgstr "Nezabraňovat cyklení příspěvků "
#: gpluspost.php:135
msgid "Skip messages without links"
msgstr "Přeskakovat zprávy bez odkazů"
#: gpluspost.php:142
msgid "Mirror all public posts"
msgstr "Zrcadlit všechny veřejné příspěvky"
#: gpluspost.php:146
msgid "Mirror Google Account ID"
msgstr "ID účtu Google pro zrcadlení"
#: gpluspost.php:153
msgid "Save Settings"
msgstr "Uložit Nastavení"
#: gpluspost.php:308
msgid "Google+ post failed. Queued for retry."
msgstr "Zaslání příspěvku na Google+ selhalo. Příspěvek byl zařazen do fronty pro opakované odeslání."

View file

@ -0,0 +1,19 @@
<?php
if(! function_exists("string_plural_select_cs")) {
function string_plural_select_cs($n){
return ($n==1) ? 0 : ($n>=2 && $n<=4) ? 1 : 2;;
}}
;
$a->strings["Post to Google+"] = "Příspěvek na Google+";
$a->strings["Enable Google+ Post Plugin"] = "Povolit Google+ Plugin";
$a->strings["Google+ username"] = "Google+ uživatelské jméno";
$a->strings["Google+ password"] = "Google+ heslo";
$a->strings["Google+ page number"] = "Google+ číslo stránky";
$a->strings["Post to Google+ by default"] = "Defaultně zaslat na Google+";
$a->strings["Do not prevent posting loops"] = "Nezabraňovat cyklení příspěvků ";
$a->strings["Skip messages without links"] = "Přeskakovat zprávy bez odkazů";
$a->strings["Mirror all public posts"] = "Zrcadlit všechny veřejné příspěvky";
$a->strings["Mirror Google Account ID"] = "ID účtu Google pro zrcadlení";
$a->strings["Save Settings"] = "Uložit Nastavení";
$a->strings["Google+ post failed. Queued for retry."] = "Zaslání příspěvku na Google+ selhalo. Příspěvek byl zařazen do fronty pro opakované odeslání.";

View file

@ -0,0 +1,68 @@
# ADDON gpluspost
# Copyright (C)
# This file is distributed under the same license as the Friendica gpluspost addon package.
#
#
# Translators:
# Abrax <webmaster@a-zwenkau.de>, 2014
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-06-23 14:44+0200\n"
"PO-Revision-Date: 2014-10-14 09:17+0000\n"
"Last-Translator: Abrax <webmaster@a-zwenkau.de>\n"
"Language-Team: German (http://www.transifex.com/projects/p/friendica/language/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: gpluspost.php:38
msgid "Post to Google+"
msgstr "An Google+ senden"
#: gpluspost.php:93
msgid "Enable Google+ Post Plugin"
msgstr "Google+ Plugin aktivieren"
#: gpluspost.php:108
msgid "Google+ username"
msgstr "Google+ Benutzername"
#: gpluspost.php:113
msgid "Google+ password"
msgstr "Google+ Passwort"
#: gpluspost.php:118
msgid "Google+ page number"
msgstr "Google+ Seitennummer"
#: gpluspost.php:124
msgid "Post to Google+ by default"
msgstr "Sende standardmäßig an Google+"
#: gpluspost.php:129
msgid "Do not prevent posting loops"
msgstr "Posten von Schleifen nicht verhindern"
#: gpluspost.php:135
msgid "Skip messages without links"
msgstr "Überspringe Nachrichten ohne Links"
#: gpluspost.php:142
msgid "Mirror all public posts"
msgstr "Spiegle alle öffentlichen Nachrichten"
#: gpluspost.php:146
msgid "Mirror Google Account ID"
msgstr "Spiegle Google Account ID"
#: gpluspost.php:153
msgid "Save Settings"
msgstr "Einstellungen speichern"
#: gpluspost.php:308
msgid "Google+ post failed. Queued for retry."
msgstr "Veröffentlichung bei Google+ gescheitert. Wir versuchen es später erneut."

View file

@ -0,0 +1,19 @@
<?php
if(! function_exists("string_plural_select_de")) {
function string_plural_select_de($n){
return ($n != 1);;
}}
;
$a->strings["Post to Google+"] = "An Google+ senden";
$a->strings["Enable Google+ Post Plugin"] = "Google+ Plugin aktivieren";
$a->strings["Google+ username"] = "Google+ Benutzername";
$a->strings["Google+ password"] = "Google+ Passwort";
$a->strings["Google+ page number"] = "Google+ Seitennummer";
$a->strings["Post to Google+ by default"] = "Sende standardmäßig an Google+";
$a->strings["Do not prevent posting loops"] = "Posten von Schleifen nicht verhindern";
$a->strings["Skip messages without links"] = "Überspringe Nachrichten ohne Links";
$a->strings["Mirror all public posts"] = "Spiegle alle öffentlichen Nachrichten";
$a->strings["Mirror Google Account ID"] = "Spiegle Google Account ID";
$a->strings["Save Settings"] = "Einstellungen speichern";
$a->strings["Google+ post failed. Queued for retry."] = "Veröffentlichung bei Google+ gescheitert. Wir versuchen es später erneut.";

View file

@ -0,0 +1,68 @@
# ADDON gpluspost
# Copyright (C)
# This file is distributed under the same license as the Friendica gpluspost addon package.
#
#
# Translators:
# Albert, 2016
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-11-12 16:50+0000\n"
"PO-Revision-Date: 2016-11-16 16:43+0000\n"
"Last-Translator: Albert\n"
"Language-Team: Spanish (http://www.transifex.com/Friendica/friendica/language/es/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: gpluspost.php:39
msgid "Post to Google+"
msgstr "Publicar en Google+"
#: gpluspost.php:94
msgid "Enable Google+ Post Plugin"
msgstr "Habilitar el plugin de publicación de Google+"
#: gpluspost.php:109
msgid "Google+ username"
msgstr "Nombre de usuario de Google+"
#: gpluspost.php:114
msgid "Google+ password"
msgstr "Contraseña de Google+"
#: gpluspost.php:119
msgid "Google+ page number"
msgstr "Número de página de Google+"
#: gpluspost.php:125
msgid "Post to Google+ by default"
msgstr "Publicar en Google+ por defecto"
#: gpluspost.php:130
msgid "Do not prevent posting loops"
msgstr "No impedir los bucles de publicación"
#: gpluspost.php:136
msgid "Skip messages without links"
msgstr "Saltar los mensajes sin enlaces"
#: gpluspost.php:143
msgid "Mirror all public posts"
msgstr "Reflejar todas las entradas públicas"
#: gpluspost.php:147
msgid "Mirror Google Account ID"
msgstr "Reflecar la ID de Cuenta de Google"
#: gpluspost.php:154
msgid "Save Settings"
msgstr "Guardar ajustes"
#: gpluspost.php:310
msgid "Google+ post failed. Queued for retry."
msgstr "La publicación en Google+ falló. En cola para reintentarlo."

View file

@ -0,0 +1,19 @@
<?php
if(! function_exists("string_plural_select_es")) {
function string_plural_select_es($n){
return ($n != 1);;
}}
;
$a->strings["Post to Google+"] = "Publicar en Google+";
$a->strings["Enable Google+ Post Plugin"] = "Habilitar el plugin de publicación de Google+";
$a->strings["Google+ username"] = "Nombre de usuario de Google+";
$a->strings["Google+ password"] = "Contraseña de Google+";
$a->strings["Google+ page number"] = "Número de página de Google+";
$a->strings["Post to Google+ by default"] = "Publicar en Google+ por defecto";
$a->strings["Do not prevent posting loops"] = "No impedir los bucles de publicación";
$a->strings["Skip messages without links"] = "Saltar los mensajes sin enlaces";
$a->strings["Mirror all public posts"] = "Reflejar todas las entradas públicas";
$a->strings["Mirror Google Account ID"] = "Reflecar la ID de Cuenta de Google";
$a->strings["Save Settings"] = "Guardar ajustes";
$a->strings["Google+ post failed. Queued for retry."] = "La publicación en Google+ falló. En cola para reintentarlo.";

View file

@ -0,0 +1,68 @@
# ADDON gpluspost
# Copyright (C)
# This file is distributed under the same license as the Friendica gpluspost addon package.
#
#
# Translators:
# fabrixxm <fabrix.xm@gmail.com>, 2014
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-11-12 16:50+0000\n"
"PO-Revision-Date: 2014-09-10 12:14+0000\n"
"Last-Translator: fabrixxm <fabrix.xm@gmail.com>\n"
"Language-Team: Italian (http://www.transifex.com/Friendica/friendica/language/it/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: it\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: gpluspost.php:39
msgid "Post to Google+"
msgstr "Invia a Google+"
#: gpluspost.php:94
msgid "Enable Google+ Post Plugin"
msgstr "Abilita il plugin di invio a Google+"
#: gpluspost.php:109
msgid "Google+ username"
msgstr "Nome utente Google+"
#: gpluspost.php:114
msgid "Google+ password"
msgstr "Password Google+"
#: gpluspost.php:119
msgid "Google+ page number"
msgstr "Numero pagina Google+"
#: gpluspost.php:125
msgid "Post to Google+ by default"
msgstr "Invia sempre a Google+"
#: gpluspost.php:130
msgid "Do not prevent posting loops"
msgstr "Non prevenire i loop di invio"
#: gpluspost.php:136
msgid "Skip messages without links"
msgstr "Salta i messaggi senza collegamenti"
#: gpluspost.php:143
msgid "Mirror all public posts"
msgstr "Ricopia tutti i post pubblici"
#: gpluspost.php:147
msgid "Mirror Google Account ID"
msgstr "Ricopia l'ID Google Account"
#: gpluspost.php:154
msgid "Save Settings"
msgstr "Salva Impostazioni"
#: gpluspost.php:310
msgid "Google+ post failed. Queued for retry."
msgstr "Invio a Google+ fallito. In attesa di riprovare."

View file

@ -0,0 +1,19 @@
<?php
if(! function_exists("string_plural_select_it")) {
function string_plural_select_it($n){
return ($n != 1);;
}}
;
$a->strings["Post to Google+"] = "Invia a Google+";
$a->strings["Enable Google+ Post Plugin"] = "Abilita il plugin di invio a Google+";
$a->strings["Google+ username"] = "Nome utente Google+";
$a->strings["Google+ password"] = "Password Google+";
$a->strings["Google+ page number"] = "Numero pagina Google+";
$a->strings["Post to Google+ by default"] = "Invia sempre a Google+";
$a->strings["Do not prevent posting loops"] = "Non prevenire i loop di invio";
$a->strings["Skip messages without links"] = "Salta i messaggi senza collegamenti";
$a->strings["Mirror all public posts"] = "Ricopia tutti i post pubblici";
$a->strings["Mirror Google Account ID"] = "Ricopia l'ID Google Account";
$a->strings["Save Settings"] = "Salva Impostazioni";
$a->strings["Google+ post failed. Queued for retry."] = "Invio a Google+ fallito. In attesa di riprovare.";

View file

@ -0,0 +1,68 @@
# ADDON gpluspost
# Copyright (C)
# This file is distributed under the same license as the Friendica gpluspost addon package.
#
#
# Translators:
# Beatriz Vital <vitalb@riseup.net>, 2016
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-06-23 14:44+0200\n"
"PO-Revision-Date: 2016-08-19 20:36+0000\n"
"Last-Translator: Beatriz Vital <vitalb@riseup.net>\n"
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/Friendica/friendica/language/pt_BR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: pt_BR\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: gpluspost.php:38
msgid "Post to Google+"
msgstr "Publicar no Google+"
#: gpluspost.php:93
msgid "Enable Google+ Post Plugin"
msgstr "Habilitar plug-in para publicar no Google+"
#: gpluspost.php:108
msgid "Google+ username"
msgstr ""
#: gpluspost.php:113
msgid "Google+ password"
msgstr "Senha do Google+"
#: gpluspost.php:118
msgid "Google+ page number"
msgstr ""
#: gpluspost.php:124
msgid "Post to Google+ by default"
msgstr "Publicar no Google+ por padrão"
#: gpluspost.php:129
msgid "Do not prevent posting loops"
msgstr ""
#: gpluspost.php:135
msgid "Skip messages without links"
msgstr ""
#: gpluspost.php:142
msgid "Mirror all public posts"
msgstr ""
#: gpluspost.php:146
msgid "Mirror Google Account ID"
msgstr ""
#: gpluspost.php:153
msgid "Save Settings"
msgstr "Salvar Configurações"
#: gpluspost.php:308
msgid "Google+ post failed. Queued for retry."
msgstr "Falha ao publicar no Google+. Na fila para tentar novamente."

View file

@ -0,0 +1,19 @@
<?php
if(! function_exists("string_plural_select_pt_br")) {
function string_plural_select_pt_br($n){
return ($n > 1);;
}}
;
$a->strings["Post to Google+"] = "Publicar no Google+";
$a->strings["Enable Google+ Post Plugin"] = "Habilitar plug-in para publicar no Google+";
$a->strings["Google+ username"] = "";
$a->strings["Google+ password"] = "Senha do Google+";
$a->strings["Google+ page number"] = "";
$a->strings["Post to Google+ by default"] = "Publicar no Google+ por padrão";
$a->strings["Do not prevent posting loops"] = "";
$a->strings["Skip messages without links"] = "";
$a->strings["Mirror all public posts"] = "";
$a->strings["Mirror Google Account ID"] = "";
$a->strings["Save Settings"] = "Salvar Configurações";
$a->strings["Google+ post failed. Queued for retry."] = "Falha ao publicar no Google+. Na fila para tentar novamente.";

View file

@ -0,0 +1,67 @@
# ADDON gpluspost
# Copyright (C)
# This file is distributed under the same license as the Friendica gpluspost addon package.
#
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-06-23 14:44+0200\n"
"PO-Revision-Date: 2014-07-08 11:52+0000\n"
"Last-Translator: Arian - Cazare Muncitori <arianserv@gmail.com>\n"
"Language-Team: Romanian (Romania) (http://www.transifex.com/projects/p/friendica/language/ro_RO/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ro_RO\n"
"Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1));\n"
#: gpluspost.php:38
msgid "Post to Google+"
msgstr "Postați pe Google+"
#: gpluspost.php:93
msgid "Enable Google+ Post Plugin"
msgstr "Activare Modul Postare Google+"
#: gpluspost.php:108
msgid "Google+ username"
msgstr "Utilizator Google+ "
#: gpluspost.php:113
msgid "Google+ password"
msgstr "Parola Google+"
#: gpluspost.php:118
msgid "Google+ page number"
msgstr "Numărul paginii Google+ "
#: gpluspost.php:124
msgid "Post to Google+ by default"
msgstr "Postați implicit pe Google+"
#: gpluspost.php:129
msgid "Do not prevent posting loops"
msgstr "Nu se previn înlănțuirile postării"
#: gpluspost.php:135
msgid "Skip messages without links"
msgstr "Se omit mesajele fără legături"
#: gpluspost.php:142
msgid "Mirror all public posts"
msgstr "Reproducere pentru toate postările publice"
#: gpluspost.php:146
msgid "Mirror Google Account ID"
msgstr "Reproducere ID Cont Google"
#: gpluspost.php:153
msgid "Save Settings"
msgstr "Salvare Configurări"
#: gpluspost.php:308
msgid "Google+ post failed. Queued for retry."
msgstr "Postarea pe Google+ a eșuat. S-a pus în așteptare pentru reîncercare."

View file

@ -0,0 +1,19 @@
<?php
if(! function_exists("string_plural_select_ro")) {
function string_plural_select_ro($n){
return ($n==1?0:((($n%100>19)||(($n%100==0)&&($n!=0)))?2:1));;
}}
;
$a->strings["Post to Google+"] = "Postați pe Google+";
$a->strings["Enable Google+ Post Plugin"] = "Activare Modul Postare Google+";
$a->strings["Google+ username"] = "Utilizator Google+ ";
$a->strings["Google+ password"] = "Parola Google+";
$a->strings["Google+ page number"] = "Numărul paginii Google+ ";
$a->strings["Post to Google+ by default"] = "Postați implicit pe Google+";
$a->strings["Do not prevent posting loops"] = "Nu se previn înlănțuirile postării";
$a->strings["Skip messages without links"] = "Se omit mesajele fără legături";
$a->strings["Mirror all public posts"] = "Reproducere pentru toate postările publice";
$a->strings["Mirror Google Account ID"] = "Reproducere ID Cont Google";
$a->strings["Save Settings"] = "Salvare Configurări";
$a->strings["Google+ post failed. Queued for retry."] = "Postarea pe Google+ a eșuat. S-a pus în așteptare pentru reîncercare.";

View file

@ -0,0 +1,68 @@
# ADDON gpluspost
# Copyright (C)
# This file is distributed under the same license as the Friendica gpluspost addon package.
#
#
# Translators:
# Stanislav N. <pztrn@pztrn.name>, 2017
msgid ""
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-11-12 16:50+0000\n"
"PO-Revision-Date: 2017-04-08 17:19+0000\n"
"Last-Translator: Stanislav N. <pztrn@pztrn.name>\n"
"Language-Team: Russian (http://www.transifex.com/Friendica/friendica/language/ru/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ru\n"
"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n"
#: gpluspost.php:39
msgid "Post to Google+"
msgstr "Написать в Google+"
#: gpluspost.php:94
msgid "Enable Google+ Post Plugin"
msgstr "Включить плагин Google+ Post"
#: gpluspost.php:109
msgid "Google+ username"
msgstr "Имя пользователя Google+"
#: gpluspost.php:114
msgid "Google+ password"
msgstr "Пароль Google+"
#: gpluspost.php:119
msgid "Google+ page number"
msgstr "Номер страницы Google+"
#: gpluspost.php:125
msgid "Post to Google+ by default"
msgstr "Отправлять в Google+ по умолчанию"
#: gpluspost.php:130
msgid "Do not prevent posting loops"
msgstr "Не предотвращать петли отправки"
#: gpluspost.php:136
msgid "Skip messages without links"
msgstr "Пропускать сообщения без ссылок"
#: gpluspost.php:143
msgid "Mirror all public posts"
msgstr "Зеркалировать все публичные сообщения"
#: gpluspost.php:147
msgid "Mirror Google Account ID"
msgstr "Зеркалировать Google Account ID"
#: gpluspost.php:154
msgid "Save Settings"
msgstr "Сохранить настройки"
#: gpluspost.php:310
msgid "Google+ post failed. Queued for retry."
msgstr "Ошибка отправки сообщения в Google+. В очереди на еще одну попытку."

View file

@ -0,0 +1,19 @@
<?php
if(! function_exists("string_plural_select_ru")) {
function string_plural_select_ru($n){
return ($n%10==1 && $n%100!=11 ? 0 : $n%10>=2 && $n%10<=4 && ($n%100<12 || $n%100>14) ? 1 : $n%10==0 || ($n%10>=5 && $n%10<=9) || ($n%100>=11 && $n%100<=14)? 2 : 3);;
}}
;
$a->strings["Post to Google+"] = "Написать в Google+";
$a->strings["Enable Google+ Post Plugin"] = "Включить плагин Google+ Post";
$a->strings["Google+ username"] = "Имя пользователя Google+";
$a->strings["Google+ password"] = "Пароль Google+";
$a->strings["Google+ page number"] = "Номер страницы Google+";
$a->strings["Post to Google+ by default"] = "Отправлять в Google+ по умолчанию";
$a->strings["Do not prevent posting loops"] = "Не предотвращать петли отправки";
$a->strings["Skip messages without links"] = "Пропускать сообщения без ссылок";
$a->strings["Mirror all public posts"] = "Зеркалировать все публичные сообщения";
$a->strings["Mirror Google Account ID"] = "Зеркалировать Google Account ID";
$a->strings["Save Settings"] = "Сохранить настройки";
$a->strings["Google+ post failed. Queued for retry."] = "Ошибка отправки сообщения в Google+. В очереди на еще одну попытку.";

Some files were not shown because too many files have changed in this diff Show more