Merge branch '3.6-rc'
authorTobias Diekershoff <tobias.diekershoff@gmx.net>
Fri, 23 Mar 2018 07:00:37 +0000 (08:00 +0100)
committerTobias Diekershoff <tobias.diekershoff@gmx.net>
Fri, 23 Mar 2018 07:00:37 +0000 (08:00 +0100)
350 files changed:
appnet/AppDotNet.php [new file with mode: 0644]
appnet/DigiCertHighAssuranceEVRootCA.pem [new file with mode: 0644]
appnet/README.md [new file with mode: 0644]
appnet/appnet.css [new file with mode: 0644]
appnet/appnet.php [new file with mode: 0644]
appnet/lang/C/messages.po [new file with mode: 0644]
appnet/lang/cs/messages.po [new file with mode: 0644]
appnet/lang/cs/strings.php [new file with mode: 0644]
appnet/lang/de/messages.po [new file with mode: 0644]
appnet/lang/de/strings.php [new file with mode: 0644]
appnet/lang/es/messages.po [new file with mode: 0644]
appnet/lang/es/strings.php [new file with mode: 0644]
appnet/lang/fr/messages.po [new file with mode: 0644]
appnet/lang/fr/strings.php [new file with mode: 0644]
appnet/lang/it/messages.po [new file with mode: 0644]
appnet/lang/it/strings.php [new file with mode: 0644]
appnet/lang/nl/messages.po [new file with mode: 0644]
appnet/lang/nl/strings.php [new file with mode: 0644]
appnet/lang/pt-br/messages.po [new file with mode: 0644]
appnet/lang/pt-br/strings.php [new file with mode: 0644]
appnet/lang/ro/messages.po [new file with mode: 0644]
appnet/lang/ro/strings.php [new file with mode: 0644]
appnet/lang/ru/messages.po [new file with mode: 0644]
appnet/lang/ru/strings.php [new file with mode: 0644]
appnet/templates/admin.tpl [new file with mode: 0644]
blackout/blackout.php
blockem/blockem.php
blogger/blogger.php
buffer/buffer.php
buffer/bufferapp.php
cal/LICENSE [new file with mode: 0644]
cal/README.md [new file with mode: 0644]
cal/cal.php [new file with mode: 0644]
cal/lang/C/messages.po [new file with mode: 0644]
cal/lang/C/strings.php [new file with mode: 0644]
cal/lang/cs/messages.po [new file with mode: 0644]
cal/lang/cs/strings.php [new file with mode: 0644]
cal/lang/de/messages.po [new file with mode: 0644]
cal/lang/de/strings.php [new file with mode: 0644]
cal/lang/es/messages.po [new file with mode: 0644]
cal/lang/es/strings.php [new file with mode: 0644]
cal/lang/fr/messages.po [new file with mode: 0644]
cal/lang/fr/strings.php [new file with mode: 0644]
cal/lang/it/messages.po [new file with mode: 0644]
cal/lang/it/strings.php [new file with mode: 0644]
cal/lang/pt-br/messages.po [new file with mode: 0644]
cal/lang/pt-br/strings.php [new file with mode: 0644]
cal/lang/ro/messages.po [new file with mode: 0644]
cal/lang/ro/strings.php [new file with mode: 0644]
cal/lang/ru/messages.po [new file with mode: 0644]
cal/lang/ru/strings.php [new file with mode: 0644]
cal/lang/zh-cn/messages.po [new file with mode: 0644]
cal/lang/zh-cn/strings.php [new file with mode: 0644]
communityhome/communityhome.php
communityhome/templates/directory_item.tpl
communityhome/templates/settings.tpl [deleted file]
convert/convert.php
convpath/README [new file with mode: 0644]
convpath/convpath.php [new file with mode: 0644]
convpath/lang/C/messages.po [new file with mode: 0644]
curweather/curweather.php
curweather/templates/widget.tpl
dav/README.md
dav/common/wdcal_configuration.php
dav/dav.php
dav/friendica/calendar.friendica.fnk.php
dav/friendica/database-init.inc.php
dav/friendica/dav_caldav_backend_virtual_friendica.inc.php
dav/friendica/dav_carddav_backend_virtual_friendica.inc.php
dav/friendica/dav_friendica_auth.inc.php
dav/friendica/dav_friendica_principal.inc.php
dav/friendica/layout.fnk.php
dav/friendica/main.php
defaultfeatures/README [new file with mode: 0644]
defaultfeatures/defaultfeatures.php [new file with mode: 0644]
defaultfeatures/lang/C/messages.po [new file with mode: 0644]
defaultfeatures/templates/admin.tpl [new file with mode: 0644]
diaspora/Diaspora_Connection.php
diaspora/diaspora.php
dwpost/dwpost.php
editplain/editplain.css [new file with mode: 0644]
editplain/editplain.php [new file with mode: 0644]
editplain/lang/C/messages.po [new file with mode: 0644]
editplain/lang/ca/strings.php [new file with mode: 0644]
editplain/lang/cs/messages.po [new file with mode: 0644]
editplain/lang/cs/strings.php [new file with mode: 0644]
editplain/lang/de/messages.po [new file with mode: 0644]
editplain/lang/de/strings.php [new file with mode: 0644]
editplain/lang/eo/strings.php [new file with mode: 0644]
editplain/lang/es/messages.po [new file with mode: 0644]
editplain/lang/es/strings.php [new file with mode: 0644]
editplain/lang/fr/messages.po [new file with mode: 0644]
editplain/lang/fr/strings.php [new file with mode: 0644]
editplain/lang/is/strings.php [new file with mode: 0644]
editplain/lang/it/messages.po [new file with mode: 0644]
editplain/lang/it/strings.php [new file with mode: 0644]
editplain/lang/nb-no/strings.php [new file with mode: 0644]
editplain/lang/pl/strings.php [new file with mode: 0644]
editplain/lang/pt-br/strings.php [new file with mode: 0644]
editplain/lang/ro/messages.po [new file with mode: 0644]
editplain/lang/ro/strings.php [new file with mode: 0644]
editplain/lang/ru/messages.po [new file with mode: 0644]
editplain/lang/ru/strings.php [new file with mode: 0644]
editplain/lang/sv/strings.php [new file with mode: 0644]
editplain/lang/zh-cn/strings.php [new file with mode: 0644]
extcron/extcron.php [new file with mode: 0644]
extcron/lang/C/messages.po [new file with mode: 0644]
facebook/README.md [new file with mode: 0644]
facebook/facebook.css [new file with mode: 0644]
facebook/facebook.php [new file with mode: 0644]
facebook/lang/C/messages.po [new file with mode: 0644]
facebook/lang/ca/strings.php [new file with mode: 0644]
facebook/lang/cs/strings.php [new file with mode: 0644]
facebook/lang/de/strings.php [new file with mode: 0644]
facebook/lang/eo/strings.php [new file with mode: 0644]
facebook/lang/es/strings.php [new file with mode: 0644]
facebook/lang/fr/strings.php [new file with mode: 0644]
facebook/lang/is/strings.php [new file with mode: 0644]
facebook/lang/it/strings.php [new file with mode: 0644]
facebook/lang/nb-no/strings.php [new file with mode: 0644]
facebook/lang/pl/strings.php [new file with mode: 0644]
facebook/lang/pt-br/strings.php [new file with mode: 0644]
facebook/lang/ru/strings.php [new file with mode: 0644]
facebook/lang/sv/strings.php [new file with mode: 0644]
facebook/lang/zh-cn/strings.php [new file with mode: 0644]
facebook_restrict/facebook_restrict.php [new file with mode: 0644]
facebook_restrict/lang/C/messages.po [new file with mode: 0644]
fbpost/README.md [new file with mode: 0644]
fbpost/fbpost.css [new file with mode: 0644]
fbpost/fbpost.php [new file with mode: 0644]
fbpost/lang/C/messages.po [new file with mode: 0644]
fbpost/lang/ca/strings.php [new file with mode: 0644]
fbpost/lang/cs/strings.php [new file with mode: 0644]
fbpost/lang/de/strings.php [new file with mode: 0644]
fbpost/lang/eo/strings.php [new file with mode: 0644]
fbpost/lang/es/strings.php [new file with mode: 0644]
fbpost/lang/fr/strings.php [new file with mode: 0644]
fbpost/lang/is/strings.php [new file with mode: 0644]
fbpost/lang/it/strings.php [new file with mode: 0644]
fbpost/lang/nb-no/strings.php [new file with mode: 0644]
fbpost/lang/pl/strings.php [new file with mode: 0644]
fbpost/lang/pt-br/strings.php [new file with mode: 0644]
fbpost/lang/ru/strings.php [new file with mode: 0644]
fbpost/lang/sv/strings.php [new file with mode: 0644]
fbpost/lang/zh-cn/strings.php [new file with mode: 0644]
fbsync/README.md [new file with mode: 0644]
fbsync/fbsync.css [new file with mode: 0644]
fbsync/fbsync.php [new file with mode: 0644]
fbsync/lang/C/messages.po [new file with mode: 0644]
fortunate/cookie.php
forumdirectory/forumdirectory.php
forumlist/forumlist.css [new file with mode: 0644]
forumlist/forumlist.php [new file with mode: 0644]
forumlist/lang/C/messages.po [new file with mode: 0644]
forumlist/lang/ca/strings.php [new file with mode: 0644]
forumlist/lang/cs/messages.po [new file with mode: 0644]
forumlist/lang/cs/strings.php [new file with mode: 0644]
forumlist/lang/de/messages.po [new file with mode: 0644]
forumlist/lang/de/strings.php [new file with mode: 0644]
forumlist/lang/eo/strings.php [new file with mode: 0644]
forumlist/lang/es/messages.po [new file with mode: 0644]
forumlist/lang/es/strings.php [new file with mode: 0644]
forumlist/lang/fr/strings.php [new file with mode: 0644]
forumlist/lang/is/strings.php [new file with mode: 0644]
forumlist/lang/it/messages.po [new file with mode: 0644]
forumlist/lang/it/strings.php [new file with mode: 0644]
forumlist/lang/nb-no/strings.php [new file with mode: 0644]
forumlist/lang/pl/strings.php [new file with mode: 0644]
forumlist/lang/pt-br/strings.php [new file with mode: 0644]
forumlist/lang/ro/messages.po [new file with mode: 0644]
forumlist/lang/ro/strings.php [new file with mode: 0644]
forumlist/lang/ru/messages.po [new file with mode: 0644]
forumlist/lang/ru/strings.php [new file with mode: 0644]
forumlist/lang/sv/messages.po [new file with mode: 0644]
forumlist/lang/sv/strings.php [new file with mode: 0644]
forumlist/lang/zh-cn/strings.php [new file with mode: 0644]
fromapp/fromapp.php
fromgplus/fromgplus.php
geocoordinates/geocoordinates.php
geonames/geonames.php
gnot/gnot.php
googlemaps/googlemaps.php
gpluspost/.gitignore [new file with mode: 0644]
gpluspost/gpluspost.css [new file with mode: 0644]
gpluspost/gpluspost.php [new file with mode: 0644]
gpluspost/lang/C/messages.po [new file with mode: 0644]
gpluspost/lang/cs/messages.po [new file with mode: 0644]
gpluspost/lang/cs/strings.php [new file with mode: 0644]
gpluspost/lang/de/messages.po [new file with mode: 0644]
gpluspost/lang/de/strings.php [new file with mode: 0644]
gpluspost/lang/es/messages.po [new file with mode: 0644]
gpluspost/lang/es/strings.php [new file with mode: 0644]
gpluspost/lang/it/messages.po [new file with mode: 0644]
gpluspost/lang/it/strings.php [new file with mode: 0644]
gpluspost/lang/pt-br/messages.po [new file with mode: 0644]
gpluspost/lang/pt-br/strings.php [new file with mode: 0644]
gpluspost/lang/ro/messages.po [new file with mode: 0644]
gpluspost/lang/ro/strings.php [new file with mode: 0644]
gpluspost/lang/ru/messages.po [new file with mode: 0644]
gpluspost/lang/ru/strings.php [new file with mode: 0644]
gravatar/gravatar.php
group_text/group_text.php
ifttt/ifttt.php
ifttt/lang/C/messages.po [deleted file]
ifttt/lang/de/messages.po [deleted file]
ifttt/lang/de/strings.php [deleted file]
ijpost/ijpost.php
impressum/impressum.php
irc/irc.php
jappixmini.tgz [new file with mode: 0644]
jappixmini/jappixmini.php
jappixmini/proxy.php
js_upload/js_upload.php
krynn/krynn.php
langfilter/langfilter.php
ldapauth/ldapauth.php
leistungsschutzrecht/leistungsschutzrecht.php
libertree/libertree.php
libravatar/libravatar.php
ljpost/ljpost.php
mailstream/mailstream.php
mathjax/mathjax.php
notifyall/lang/fr/messages.po [deleted file]
notifyall/lang/fr/strings.php [deleted file]
notifyall/notifyall.php
notimeline/notimeline.php
nsfw/nsfw.php
numfriends/lang/fr/messages.po [deleted file]
numfriends/lang/fr/strings.php
numfriends/numfriends.php
openstreetmap/openstreetmap.php
pageheader/pageheader.css
pageheader/pageheader.php
piwik/piwik.php
planets/planets.php
pledgie/pledgie.css
pledgie/pledgie.php
poormancron/lang/C/messages.po [new file with mode: 0644]
poormancron/poormancron.php [new file with mode: 0644]
posterous/lang/C/messages.po [new file with mode: 0644]
posterous/lang/ca/strings.php [new file with mode: 0644]
posterous/lang/cs/strings.php [new file with mode: 0644]
posterous/lang/de/strings.php [new file with mode: 0644]
posterous/lang/eo/strings.php [new file with mode: 0644]
posterous/lang/es/strings.php [new file with mode: 0644]
posterous/lang/fr/strings.php [new file with mode: 0644]
posterous/lang/is/strings.php [new file with mode: 0644]
posterous/lang/it/strings.php [new file with mode: 0644]
posterous/lang/nb-no/strings.php [new file with mode: 0644]
posterous/lang/pl/strings.php [new file with mode: 0644]
posterous/lang/pt-br/strings.php [new file with mode: 0644]
posterous/lang/ru/strings.php [new file with mode: 0644]
posterous/lang/sv/strings.php [new file with mode: 0644]
posterous/lang/zh-cn/strings.php [new file with mode: 0644]
posterous/posterous.css [new file with mode: 0644]
posterous/posterous.php [new file with mode: 0644]
procrunner/lang/C/messages.po [new file with mode: 0644]
procrunner/procrunner.php [new file with mode: 0644]
public_server/public_server.php
pumpio/pumpio.php
qcomment/qcomment.php
randplace/randplace.php
remote_permissions/remote_permissions.php
rendertime/lang/fr/messages.po [deleted file]
rendertime/lang/fr/strings.php
rendertime/rendertime.php
retriever/README [new file with mode: 0644]
retriever/database.sql [new file with mode: 0644]
retriever/lang/C/messages.po [new file with mode: 0644]
retriever/retriever.php [new file with mode: 0644]
retriever/templates/extract.tpl [new file with mode: 0644]
retriever/templates/fix-urls.tpl [new file with mode: 0644]
retriever/templates/help.tpl [new file with mode: 0644]
retriever/templates/rule-config.tpl [new file with mode: 0644]
retriever/templates/settings.tpl [new file with mode: 0644]
securemail/securemail.php
showmore/showmore.php
smileybutton/smileybutton.php
snautofollow/lang/C/messages.po [new file with mode: 0644]
snautofollow/lang/ca/strings.php [new file with mode: 0644]
snautofollow/lang/cs/messages.po [new file with mode: 0644]
snautofollow/lang/cs/strings.php [new file with mode: 0644]
snautofollow/lang/de/messages.po [new file with mode: 0644]
snautofollow/lang/de/strings.php [new file with mode: 0644]
snautofollow/lang/eo/strings.php [new file with mode: 0644]
snautofollow/lang/es/messages.po [new file with mode: 0644]
snautofollow/lang/es/strings.php [new file with mode: 0644]
snautofollow/lang/fr/strings.php [new file with mode: 0644]
snautofollow/lang/is/strings.php [new file with mode: 0644]
snautofollow/lang/it/messages.po [new file with mode: 0644]
snautofollow/lang/it/strings.php [new file with mode: 0644]
snautofollow/lang/nb-no/strings.php [new file with mode: 0644]
snautofollow/lang/pl/strings.php [new file with mode: 0644]
snautofollow/lang/pt-br/strings.php [new file with mode: 0644]
snautofollow/lang/ro/messages.po [new file with mode: 0644]
snautofollow/lang/ro/strings.php [new file with mode: 0644]
snautofollow/lang/ru/strings.php [new file with mode: 0644]
snautofollow/lang/sv/strings.php [new file with mode: 0644]
snautofollow/lang/zh-cn/strings.php [new file with mode: 0644]
snautofollow/snautofollow.css [new file with mode: 0644]
snautofollow/snautofollow.php [new file with mode: 0644]
startpage/startpage.php
statistics_json/README.md [new file with mode: 0644]
statistics_json/lang/C/messages.po [new file with mode: 0644]
statistics_json/statistics_json.php [new file with mode: 0644]
statusnet/statusnet.php
superblock/lang/es/messages.po
superblock/lang/es/strings.php
superblock/superblock.php
testdrive/testdrive.php
tictac/tictac.php
tumblr/tumblr.php
twitter/twitter.php
uhremotestorage/lang/C/messages.po [new file with mode: 0644]
uhremotestorage/lang/ca/strings.php [new file with mode: 0644]
uhremotestorage/lang/cs/messages.po [new file with mode: 0644]
uhremotestorage/lang/cs/strings.php [new file with mode: 0644]
uhremotestorage/lang/de/messages.po [new file with mode: 0644]
uhremotestorage/lang/de/strings.php [new file with mode: 0644]
uhremotestorage/lang/eo/strings.php [new file with mode: 0644]
uhremotestorage/lang/es/messages.po [new file with mode: 0644]
uhremotestorage/lang/es/strings.php [new file with mode: 0644]
uhremotestorage/lang/fr/strings.php [new file with mode: 0644]
uhremotestorage/lang/is/strings.php [new file with mode: 0644]
uhremotestorage/lang/it/messages.po [new file with mode: 0644]
uhremotestorage/lang/it/strings.php [new file with mode: 0644]
uhremotestorage/lang/nb-no/strings.php [new file with mode: 0644]
uhremotestorage/lang/pl/strings.php [new file with mode: 0644]
uhremotestorage/lang/pt-br/strings.php [new file with mode: 0644]
uhremotestorage/lang/ro/messages.po [new file with mode: 0644]
uhremotestorage/lang/ro/strings.php [new file with mode: 0644]
uhremotestorage/lang/ru/strings.php [new file with mode: 0644]
uhremotestorage/lang/sv/strings.php [new file with mode: 0644]
uhremotestorage/lang/zh-cn/strings.php [new file with mode: 0644]
uhremotestorage/templates/settings.tpl [new file with mode: 0644]
uhremotestorage/uhremotestorage.php [new file with mode: 0644]
viewsrc/viewsrc.php
webrtc/webrtc.php
widgets/widget_friendheader.php
widgets/widget_friends.php
widgets/widget_like.php
widgets/widgets.php
windowsphonepush/windowsphonepush.php
wppost/wppost.php
xmpp/lang/C/messages.po [deleted file]
xmpp/lang/de/messages.po [deleted file]
xmpp/lang/de/strings.php [deleted file]
xmpp/xmpp.php
yourls/yourls.css
yourls/yourls.php

diff --git a/appnet/AppDotNet.php b/appnet/AppDotNet.php
new file mode 100644 (file)
index 0000000..3236131
--- /dev/null
@@ -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 {}
diff --git a/appnet/DigiCertHighAssuranceEVRootCA.pem b/appnet/DigiCertHighAssuranceEVRootCA.pem
new file mode 100644 (file)
index 0000000..9e6810a
--- /dev/null
@@ -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-----
diff --git a/appnet/README.md b/appnet/README.md
new file mode 100644 (file)
index 0000000..ec24753
--- /dev/null
@@ -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.
diff --git a/appnet/appnet.css b/appnet/appnet.css
new file mode 100644 (file)
index 0000000..b1d8d27
--- /dev/null
@@ -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;
+}
diff --git a/appnet/appnet.php b/appnet/appnet.php
new file mode 100644 (file)
index 0000000..151a81e
--- /dev/null
@@ -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));
+}
diff --git a/appnet/lang/C/messages.po b/appnet/lang/C/messages.po
new file mode 100644 (file)
index 0000000..a6617de
--- /dev/null
@@ -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 ""
diff --git a/appnet/lang/cs/messages.po b/appnet/lang/cs/messages.po
new file mode 100644 (file)
index 0000000..b652745
--- /dev/null
@@ -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í"
diff --git a/appnet/lang/cs/strings.php b/appnet/lang/cs/strings.php
new file mode 100644 (file)
index 0000000..4bc4542
--- /dev/null
@@ -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í";
diff --git a/appnet/lang/de/messages.po b/appnet/lang/de/messages.po
new file mode 100644 (file)
index 0000000..6e8f7c8
--- /dev/null
@@ -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"
diff --git a/appnet/lang/de/strings.php b/appnet/lang/de/strings.php
new file mode 100644 (file)
index 0000000..da80cf7
--- /dev/null
@@ -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";
diff --git a/appnet/lang/es/messages.po b/appnet/lang/es/messages.po
new file mode 100644 (file)
index 0000000..a44089d
--- /dev/null
@@ -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"
diff --git a/appnet/lang/es/strings.php b/appnet/lang/es/strings.php
new file mode 100644 (file)
index 0000000..020c6f3
--- /dev/null
@@ -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";
diff --git a/appnet/lang/fr/messages.po b/appnet/lang/fr/messages.po
new file mode 100644 (file)
index 0000000..6f5f299
--- /dev/null
@@ -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"
diff --git a/appnet/lang/fr/strings.php b/appnet/lang/fr/strings.php
new file mode 100644 (file)
index 0000000..ef9fc9e
--- /dev/null
@@ -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";
diff --git a/appnet/lang/it/messages.po b/appnet/lang/it/messages.po
new file mode 100644 (file)
index 0000000..17b933f
--- /dev/null
@@ -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"
diff --git a/appnet/lang/it/strings.php b/appnet/lang/it/strings.php
new file mode 100644 (file)
index 0000000..01c5652
--- /dev/null
@@ -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";
diff --git a/appnet/lang/nl/messages.po b/appnet/lang/nl/messages.po
new file mode 100644 (file)
index 0000000..74653c7
--- /dev/null
@@ -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 ""
diff --git a/appnet/lang/nl/strings.php b/appnet/lang/nl/strings.php
new file mode 100644 (file)
index 0000000..ba72e36
--- /dev/null
@@ -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"] = "";
diff --git a/appnet/lang/pt-br/messages.po b/appnet/lang/pt-br/messages.po
new file mode 100644 (file)
index 0000000..c279c7d
--- /dev/null
@@ -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"
diff --git a/appnet/lang/pt-br/strings.php b/appnet/lang/pt-br/strings.php
new file mode 100644 (file)
index 0000000..b8e1112
--- /dev/null
@@ -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";
diff --git a/appnet/lang/ro/messages.po b/appnet/lang/ro/messages.po
new file mode 100644 (file)
index 0000000..a9c5242
--- /dev/null
@@ -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"
diff --git a/appnet/lang/ro/strings.php b/appnet/lang/ro/strings.php
new file mode 100644 (file)
index 0000000..fa8d139
--- /dev/null
@@ -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";
diff --git a/appnet/lang/ru/messages.po b/appnet/lang/ru/messages.po
new file mode 100644 (file)
index 0000000..a5755ca
--- /dev/null
@@ -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 "Сохранить настройки"
diff --git a/appnet/lang/ru/strings.php b/appnet/lang/ru/strings.php
new file mode 100644 (file)
index 0000000..c2d9b44
--- /dev/null
@@ -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"] = "Сохранить настройки";
diff --git a/appnet/templates/admin.tpl b/appnet/templates/admin.tpl
new file mode 100644 (file)
index 0000000..a933f3d
--- /dev/null
@@ -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>
index 28e5567f75243f1fa509b283fd3be4b8d4809010..ec7215ab22dce5ed5810923c17a2eac8a6ac5818 100644 (file)
  * 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
@@ -70,9 +70,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);
@@ -92,9 +92,9 @@ function blackout_redirect ($a, $b) {
 function blackout_addon_admin(&$a, &$o) {
     $mystart = Config::get('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/" );
 
@@ -104,7 +104,7 @@ function blackout_addon_admin(&$a, &$o) {
         '$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, ""],
 
-    ]);
+    ));
     $date1 = DateTime::createFromFormat('Y-m-d G:i', $mystart);
     $date2 = DateTime::createFromFormat('Y-m-d G:i', $myend);
     if ($date2 < $date1) {
@@ -117,7 +117,7 @@ function blackout_addon_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);
 }
index 45272e00628d5dfa6bee3107ddb83a54ed41ebc1..6f2b6d89e0929840e1785fe53c0fa276671faf1f 100644 (file)
@@ -4,7 +4,7 @@
  * Description: Allows users to hide content by collapsing posts and replies.
  * Version: 1.0
  * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
- *
+ * 
  */
 use Friendica\Core\Addon;
 use Friendica\Core\L10n;
@@ -80,7 +80,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);
        }
@@ -113,7 +113,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);
@@ -151,7 +151,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);
        }
@@ -203,7 +203,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))
@@ -212,7 +212,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) {
index 30c450bda9f6e5c180c597fdb70fee59c381750c..97d488bc2012acb88768c6a5cea5b84a12d762a0 100644 (file)
@@ -3,7 +3,7 @@
  * Name: Blogger Post Connector
  * Description: Post to Blogger (or anything else which uses blogger XMLRPC API)
  * Version: 1.0
- *
+ * 
  */
 
 use Friendica\Content\Text\BBCode;
@@ -58,11 +58,11 @@ function blogger_settings(&$a, &$s)
                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" ' : '');
@@ -70,11 +70,11 @@ function blogger_settings(&$a, &$s)
 
        $def_enabled = PConfig::get(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\');">';
@@ -124,23 +124,21 @@ function blogger_settings_post(&$a, &$b)
                PConfig::set(local_user(), 'blogger', 'bl_password', trim($_POST['bl_password']));
                PConfig::set(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'));
 
@@ -148,17 +146,13 @@ function blogger_post_local(&$a, &$b)
 
        if ($b['api_source'] && intval(PConfig::get(local_user(), 'blogger', 'post_by_default'))) {
                $bl_enable = 1;
-       }
-
-       if (!$bl_enable) {
-               return;
-       }
 
-       if (strlen($b['postopts'])) {
-               $b['postopts'] .= ',';
-       }
+    if(! $bl_enable)
+       return;
 
-        $b['postopts'] .= 'blogger';
+    if(strlen($b['postopts']))
+       $b['postopts'] .= ',';
+     $b['postopts'] .= 'blogger';
 }
 
 
@@ -174,9 +168,6 @@ function blogger_send(&$a, &$b)
                return;
        }
 
-       if ($b['parent'] != $b['id']) {
-               return;
-       }
 
        $bl_username = xmlify(PConfig::get($b['uid'], 'blogger', 'bl_username'));
        $bl_password = xmlify(PConfig::get($b['uid'], 'blogger', 'bl_password'));
@@ -210,5 +201,6 @@ EOT;
                }
 
                logger('posted to blogger: ' . (($x) ? $x : ''), LOGGER_DEBUG);
+
        }
 }
index bb1d8482e5405d23a3b642bba7f74e8d3277a3f7..9b0979ee7b4e5bd0effe15f32c42c795271c7e4a 100644 (file)
@@ -88,8 +88,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";
@@ -112,9 +112,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" /> '
                    . L10n::t('Post to Buffer') . '</div>';
@@ -132,11 +132,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 */
@@ -149,9 +149,9 @@ function buffer_settings(&$a,&$s) {
        $s .= '<img class="connector'.$css.'" src="images/buffer.png" /><h3 class="connector">'. L10n::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 == "") {
@@ -208,12 +208,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']));
                }
        }
 }
@@ -224,11 +224,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;
        }
 
@@ -243,34 +243,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);
@@ -309,7 +299,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;
@@ -372,7 +362,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;
index a222b23ec893766c4e857cead9fbf859650901c9..7215175dc77cc4753d6790b13843153df752dd29 100644 (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);
                                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()
                }
 
                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;
 
                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);
                        }
diff --git a/cal/LICENSE b/cal/LICENSE
new file mode 100644 (file)
index 0000000..2c696e9
--- /dev/null
@@ -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.
diff --git a/cal/README.md b/cal/README.md
new file mode 100644 (file)
index 0000000..cb7501c
--- /dev/null
@@ -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.
diff --git a/cal/cal.php b/cal/cal.php
new file mode 100644 (file)
index 0000000..5c2f102
--- /dev/null
@@ -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>';
+}
+
+?>
diff --git a/cal/lang/C/messages.po b/cal/lang/C/messages.po
new file mode 100644 (file)
index 0000000..9188329
--- /dev/null
@@ -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 ""
diff --git a/cal/lang/C/strings.php b/cal/lang/C/strings.php
new file mode 100644 (file)
index 0000000..a72dc11
--- /dev/null
@@ -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"] = "";
diff --git a/cal/lang/cs/messages.po b/cal/lang/cs/messages.po
new file mode 100644 (file)
index 0000000..28fcb4f
--- /dev/null
@@ -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í"
diff --git a/cal/lang/cs/strings.php b/cal/lang/cs/strings.php
new file mode 100644 (file)
index 0000000..9a99079
--- /dev/null
@@ -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í";
diff --git a/cal/lang/de/messages.po b/cal/lang/de/messages.po
new file mode 100644 (file)
index 0000000..29f6b60
--- /dev/null
@@ -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"
diff --git a/cal/lang/de/strings.php b/cal/lang/de/strings.php
new file mode 100644 (file)
index 0000000..3935927
--- /dev/null
@@ -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";
diff --git a/cal/lang/es/messages.po b/cal/lang/es/messages.po
new file mode 100644 (file)
index 0000000..65b2a32
--- /dev/null
@@ -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"
diff --git a/cal/lang/es/strings.php b/cal/lang/es/strings.php
new file mode 100644 (file)
index 0000000..29c9cc9
--- /dev/null
@@ -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";
diff --git a/cal/lang/fr/messages.po b/cal/lang/fr/messages.po
new file mode 100644 (file)
index 0000000..1b33c11
--- /dev/null
@@ -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"
diff --git a/cal/lang/fr/strings.php b/cal/lang/fr/strings.php
new file mode 100644 (file)
index 0000000..b351706
--- /dev/null
@@ -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";
diff --git a/cal/lang/it/messages.po b/cal/lang/it/messages.po
new file mode 100644 (file)
index 0000000..f2aa1cb
--- /dev/null
@@ -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"
diff --git a/cal/lang/it/strings.php b/cal/lang/it/strings.php
new file mode 100644 (file)
index 0000000..c7f228b
--- /dev/null
@@ -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";
diff --git a/cal/lang/pt-br/messages.po b/cal/lang/pt-br/messages.po
new file mode 100644 (file)
index 0000000..7defc7d
--- /dev/null
@@ -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"
diff --git a/cal/lang/pt-br/strings.php b/cal/lang/pt-br/strings.php
new file mode 100644 (file)
index 0000000..69e35ea
--- /dev/null
@@ -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";
diff --git a/cal/lang/ro/messages.po b/cal/lang/ro/messages.po
new file mode 100644 (file)
index 0000000..c0cd3f8
--- /dev/null
@@ -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"
diff --git a/cal/lang/ro/strings.php b/cal/lang/ro/strings.php
new file mode 100644 (file)
index 0000000..8e328e9
--- /dev/null
@@ -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";
diff --git a/cal/lang/ru/messages.po b/cal/lang/ru/messages.po
new file mode 100644 (file)
index 0000000..155cba8
--- /dev/null
@@ -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 "Сохранить настройки"
diff --git a/cal/lang/ru/strings.php b/cal/lang/ru/strings.php
new file mode 100644 (file)
index 0000000..d2ab141
--- /dev/null
@@ -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"] = "Сохранить настройки";
diff --git a/cal/lang/zh-cn/messages.po b/cal/lang/zh-cn/messages.po
new file mode 100644 (file)
index 0000000..15f34a4
--- /dev/null
@@ -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 "保存设置"
diff --git a/cal/lang/zh-cn/strings.php b/cal/lang/zh-cn/strings.php
new file mode 100644 (file)
index 0000000..e94fa51
--- /dev/null
@@ -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"] = "保存设置";
index dc0a6bafaca64b0d7dec64cefc5e2c395dd71e63..f2908ab0e38d6cad4fdc7a0da6ce6df6b49eff06 100644 (file)
@@ -111,9 +111,9 @@ function communityhome_home(App $a, &$o)
                                $entry = replace_macros($tpl, [
                                        '$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;
                        }
                }
@@ -128,7 +128,7 @@ function communityhome_home(App $a, &$o)
                                                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
@@ -150,9 +150,8 @@ function communityhome_home(App $a, &$o)
                                        '$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;
                        }
@@ -166,7 +165,7 @@ function communityhome_home(App $a, &$o)
                $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
index 30512f4e931ee802c50c886eb4e852596e90f085..5fb119861a81758ba5b10760fdeaec66b3db1d15 100644 (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>
diff --git a/communityhome/templates/settings.tpl b/communityhome/templates/settings.tpl
deleted file mode 100644 (file)
index d73ed74..0000000
+++ /dev/null
@@ -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>
-
index 1ddd29781e8864232429d433552ae375ab623d76..5064d3804fba15bcece6414d12ea12167bf088c0 100644 (file)
@@ -16,7 +16,7 @@ function convert_uninstall() {
 }\r
 \r
 function convert_app_menu($a,&$b) {\r
-       $b['app_menu'][] = '<div class="app-title"><a href="convert">Units Conversion</a></div>';\r
+       $b['app_menu'][] = '<div class="app-title"><a href="convert">Units Conversion</a></div>'; \r
 }\r
 \r
 \r
@@ -31,7 +31,7 @@ function convert_module() {}
 function convert_content($app) {\r
 \r
 include("UnitConvertor.php");\r
-\r
\r
  class TP_Converter extends UnitConvertor {\r
        function TP_Converter($lang = "en")\r
        {\r
@@ -40,7 +40,7 @@ include("UnitConvertor.php");
                } else {\r
                        $dec_point = '.'; $thousand_sep = ",";\r
                }\r
-\r
+               \r
                $this->UnitConvertor($dec_point , $thousand_sep );\r
 \r
        } // end func UnitConvertor\r
@@ -48,24 +48,24 @@ include("UnitConvertor.php");
        function find_base_unit($from,$to) {\r
                while (list($skey,$sval) = each($this->bases)) {\r
                                if ($skey == $from || $to == $skey || in_array($to,$sval) || in_array($from,$sval)) {\r
-                                       return $skey;\r
+                                       return $skey;                           \r
                                }\r
                }\r
-               return false;\r
+               return false;           \r
        }\r
 \r
        function getTable($value, $from_unit, $to_unit, $precision) {\r
-\r
+       \r
                if ($base_unit = $this->find_base_unit($from_unit,$to_unit)) {\r
-\r
-                       // A baseunit was found now lets convert from -> $base_unit\r
-\r
-                               $cell ['value'] = $this->convert($value, $from_unit, $base_unit, $precision)." ".$base_unit;\r
+               \r
+                       // A baseunit was found now lets convert from -> $base_unit \r
+                       \r
+                               $cell ['value'] = $this->convert($value, $from_unit, $base_unit, $precision)." ".$base_unit;    \r
                                $cell ['class'] = ($base_unit == $from_unit || $base_unit == $to_unit) ? "framedred": "";\r
                                $cells[] = $cell;\r
                        // We now have the base unit and value now lets produce the table;\r
                        while (list($key,$val) = each($this->bases[$base_unit])) {\r
-                               $cell ['value'] = $this->convert($value, $from_unit, $val, $precision)." ".$val;\r
+                               $cell ['value'] = $this->convert($value, $from_unit, $val, $precision)." ".$val;        \r
                                $cell ['class'] = ($val == $from_unit || $val == $to_unit) ? "framedred": "";\r
                                $cells[] = $cell;\r
                        }\r
@@ -84,8 +84,8 @@ include("UnitConvertor.php");
                        }\r
                        $string .= "</tr></table>";\r
                        return $string;\r
-               }\r
-\r
+               }               \r
+               \r
        }\r
 }\r
 \r
@@ -93,16 +93,16 @@ include("UnitConvertor.php");
 $conv = new TP_Converter('en');\r
 \r
 \r
-$conversions = [\r
-       'Temperature'=>['base' =>'Celsius',\r
-               'conv'=>[\r
-                       'Fahrenheit'=>['ratio'=>1.8, 'offset'=>32],\r
-                       'Kelvin'=>['ratio'=>1, 'offset'=>273],\r
+$conversions = array(\r
+       'Temperature'=>array('base' =>'Celsius',\r
+               'conv'=>array(\r
+                       'Fahrenheit'=>array('ratio'=>1.8, 'offset'=>32),\r
+                       'Kelvin'=>array('ratio'=>1, 'offset'=>273),\r
                        'Reaumur'=>0.8\r
-               ]\r
-       ],\r
-       'Weight' => ['base' =>'kg',\r
-               'conv'=>[\r
+               )\r
+       ),\r
+       'Weight' => array('base' =>'kg',\r
+               'conv'=>array(\r
                        'g'=>1000,\r
                        'mg'=>1000000,\r
                        't'=>0.001,\r
@@ -110,13 +110,13 @@ $conversions = [
                        'oz'=>35.274,\r
                        'lb'=>2.2046,\r
                        'cwt(UK)'       => 0.019684,\r
-                       'cwt(US)'       => 0.022046,\r
+                       'cwt(US)'       => 0.022046, \r
                        'ton (US)'      => 0.0011023,\r
                        'ton (UK)'      => 0.0009842\r
-               ]\r
-       ],\r
-       'Distance' => ['base' =>'km',\r
-               'conv'=>[\r
+               )\r
+       ),\r
+       'Distance' => array('base' =>'km',\r
+               'conv'=>array(\r
                        'm'=>1000,\r
                        'dm'=>10000,\r
                        'cm'=>100000,\r
@@ -128,25 +128,25 @@ $conversions = [
                        'yd'=>1093.6,\r
                        'furlong'=>4.970969537898672,\r
                        'fathom'=>546.8066491688539\r
-               ]\r
-       ],\r
-       'Area' => ['base' =>'km 2',\r
-               'conv'=>[\r
+               )\r
+       ),\r
+       'Area' => array('base' =>'km 2',\r
+               'conv'=>array(  \r
                        'ha'=>100,\r
                        'acre'=>247.105,\r
                        'm 2'=>pow(1000,2),\r
                        'dm 2'=>pow(10000,2),\r
                        'cm 2'=>pow(100000,2),\r
-                       'mm 2'=>pow(1000000,2),\r
+                       'mm 2'=>pow(1000000,2), \r
                        'mile 2'=>pow(0.62137,2),\r
                        'naut.miles 2'=>pow(0.53996,2),\r
                        'in 2'=>pow(39370,2),\r
                        'ft 2'=>pow(3280.8,2),\r
                        'yd 2'=>pow(1093.6,2),\r
-               ]\r
-       ],\r
-       'Volume' => ['base' =>'m 3',\r
-               'conv'=>[\r
+               )\r
+       ),\r
+       'Volume' => array('base' =>'m 3',\r
+               'conv'=>array(\r
                        'in 3'=>61023.6,\r
                        'ft 3'=>35.315,\r
                        'cm 3'=>pow(10,6),\r
@@ -162,22 +162,22 @@ $conversions = [
                        'fl oz' => 33814.02,\r
                        'tablespoon' => 67628.04,\r
                        'teaspoon' => 202884.1,\r
-                       'pt (UK)'=>1000/0.56826,\r
+                       'pt (UK)'=>1000/0.56826, \r
                        'barrel petroleum'=>1000/158.99,\r
-                       'Register Tons'=>2.832,\r
+                       'Register Tons'=>2.832, \r
                        'Ocean Tons'=>1.1327\r
-               ]\r
-       ],\r
-       'Speed' =>['base' =>'kmph',\r
-               'conv'=>[\r
+               )\r
+       ),\r
+       'Speed' =>array('base' =>'kmph',\r
+               'conv'=>array(\r
                        'mps'=>0.0001726031,\r
                        'milesph'=>0.62137,\r
                        'knots'=>0.53996,\r
                        'mach STP'=>0.0008380431,\r
                        'c (warp)'=>9.265669e-10\r
-               ]\r
-       ]\r
-];\r
+               )\r
+       )\r
+);\r
 \r
 \r
 while (list($key,$val) = each($conversions)) {\r
@@ -224,6 +224,6 @@ while (list($key,$val) = each($conversions)) {
        $o .= '</select>';\r
 \r
     $o .= '<input type="submit" name="Submit" value="Submit" /></form>';\r
-\r
+  \r
        return $o;\r
 }\r
diff --git a/convpath/README b/convpath/README
new file mode 100644 (file)
index 0000000..9d1c307
--- /dev/null
@@ -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.
diff --git a/convpath/convpath.php b/convpath/convpath.php
new file mode 100644 (file)
index 0000000..0aaeb5f
--- /dev/null
@@ -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);
+}
diff --git a/convpath/lang/C/messages.po b/convpath/lang/C/messages.po
new file mode 100644 (file)
index 0000000..e69de29
index edf96c3eb517947b21368406f016f99657c9bc5e..82ea2915ffc90e876d42e5705660e8665f7bb438 100644 (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>
@@ -25,7 +25,7 @@ function getWeather( $loc, $units='metric', $lang='en', $appid='', $cachetime=0)
     $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;
@@ -49,7 +49,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'],
@@ -61,8 +61,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;
 }
@@ -82,7 +82,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";
@@ -96,14 +96,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;
@@ -146,9 +146,9 @@ function curweather_network_mod_init(&$fk_app,&$b) {
 function curweather_addon_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(L10n::t('Current Weather settings updated.') . EOL);
 }
@@ -169,9 +169,9 @@ function curweather_addon_settings(&$a,&$s) {
        } 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, [
@@ -200,8 +200,8 @@ function curweather_addon_admin_post (&$a) {
 function curweather_addon_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, [
        '$submit' => L10n::t('Save Settings'),
index db3b7a8f3fcde708f78801edeb1766f14ebf61c5..b893eef666a42f04fe4add6687066d897757c2f9 100644 (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>
index b86d47fc8e2b44532c74b08b3597086f9fe3f574..e70f60907e1b1f883bd079d87fefc7005089b000 100644 (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,11 +16,11 @@ 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:
@@ -34,12 +32,12 @@ After activating, serveral tables in the database have to be created. The admin-
 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/
index dc8a951d6a5e2f034f53476c1e7995524a0ed7c1..001d4528e9cd9b529b4b21f2cdf783aa0d313cb0 100644 (file)
@@ -37,7 +37,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;
index f9125f9e49bb74bd89e45062d1ab8fc5e066583d..f4d08f0282dc699597bba79a17883bf70a409e9d 100644 (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");
-}
+}
\ No newline at end of file
index c9007bf3bee598c5e93123b1b1429c8299bf756d..98e552e6f6952261744391250cd53a523b308f84 100644 (file)
@@ -18,13 +18,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";
 
@@ -108,7 +108,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));
 }
 
 
@@ -202,7 +202,7 @@ 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 = [
                'private'                 => L10n::t("Private Calendar"),
@@ -244,7 +244,7 @@ function wdcal_create_std_calendars()
  */
 function wdcal_create_std_addressbooks_get_statements($user_id, $withcheck = true)
 {
-       $stms = [];
+       $stms = array();
        $a = get_app();
        $uris = [
                'private'                 => L10n::t("Private Addresses"),
index d8ef96ebff3173950d5d3fec365f2f144c2cbbcf..e172b44dc810c0c017d1262816193b3a1a2fbc23 100644 (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);
index b02b9150a6a754e8856d9d6a67d5169648acbb5d..c108d8dcfec73bc7952c087be55a917d3805c228 100644 (file)
@@ -127,7 +127,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),
@@ -145,7 +145,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" : ""),
-               ];
+               );
        }
 
 
@@ -182,7 +182,7 @@ class Sabre_CalDAV_Backend_Friendica extends Sabre_CalDAV_Backend_Virtual
                        if (is_numeric($date_to)) $sql_where .= " AND `start` <= '" . date(DateTimeFormat::MYSQL, $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"]));
 
@@ -217,21 +217,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;
index f396897341bf2c007533d00e5f872fafe6724304..0240241fb53f338e7b8810212c2cd76f6350e37b 100644 (file)
@@ -48,13 +48,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,
@@ -63,7 +63,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;
 
@@ -78,7 +78,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];
@@ -116,14 +116,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),
-               ];
+               );
 
        }
 
index 88b8cf01a44405302a21c1a8636ffb49d4f0d226..acc33fa1e8fed132eb993acbbd42e73a5a60df44 100644 (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);
+    }
+    
 }
index d23619ec1c7daeb5666023c677442b1220a5742a..780bcd24bade8caf76a83b1ee258ed66f63d6fef 100644 (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();
        }
 
 
index 58721ac62c9c935c2a60aa6a2f82b6b9b726e0ac..17196e2211df9f2e3197d5a83422939d11aca86c 100644 (file)
@@ -26,7 +26,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";
@@ -81,7 +81,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');
@@ -92,7 +92,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;
@@ -172,18 +172,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,
@@ -195,7 +195,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>
@@ -208,7 +208,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;
@@ -309,7 +309,7 @@ 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) {
index 2534ce9c104cc4451f9c069cf3b2c6b9ac8e9745..0974696c502d8828e0333f70a6c70eb4f2c9f6c3 100644 (file)
@@ -152,7 +152,7 @@ function dav_content()
 {
        $a = get_app();
        if (!isset($a->user["uid"]) || $a->user["uid"] == 0) {
-               return Login::form();
+               return login();
        }
 
        $x = "";
@@ -168,7 +168,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;
@@ -186,7 +186,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;
@@ -200,7 +200,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) {
@@ -263,7 +263,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:
@@ -276,11 +276,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'            => L10n::t('noreply') . '@' . $a->get_hostname(),
                                                'replyTo'              => L10n::t('noreply') . '@' . $a->get_hostname(),
@@ -289,7 +289,8 @@ function dav_cron(&$a, &$b)
                                                'htmlVersion'          => $text_html,
                                                'textVersion'          => $text_text,
                                                'additionalMailHeader' => "",
-                                       ];
+                                       );
+                                       require_once('include/Emailer.php');
                                        Emailer::send($params);
                                }
                                break;
diff --git a/defaultfeatures/README b/defaultfeatures/README
new file mode 100644 (file)
index 0000000..cc45cbf
--- /dev/null
@@ -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.
diff --git a/defaultfeatures/defaultfeatures.php b/defaultfeatures/defaultfeatures.php
new file mode 100644 (file)
index 0000000..c92547d
--- /dev/null
@@ -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
+    ));
+}
diff --git a/defaultfeatures/lang/C/messages.po b/defaultfeatures/lang/C/messages.po
new file mode 100644 (file)
index 0000000..70c34f6
--- /dev/null
@@ -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 ""
diff --git a/defaultfeatures/templates/admin.tpl b/defaultfeatures/templates/admin.tpl
new file mode 100644 (file)
index 0000000..3fbda38
--- /dev/null
@@ -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>
index 675f15003a1eadbe53ec7a1cf09961b348b4cdd5..fae6432e2636e6d88ead7cdde778e4e7edce04ad 100644 (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;
        }
 
index 49a9cfc471bca2e57bbd5e9366958fd1b855f8ab..8c7a5762069b9e70443d5033ee3404d382f0d033 100644 (file)
@@ -37,9 +37,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" /> '
             . L10n::t('Post to Diaspora') . '</div>';
@@ -70,9 +70,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;
 
@@ -124,17 +124,17 @@ 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 = "";
 
@@ -227,11 +227,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']));
        }
 
 }
@@ -250,11 +250,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;
        }
 
@@ -277,37 +277,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')) {
-               return;
-       }
 
-       if($b['parent'] != $b['id']) {
+       if(! strstr($b['postopts'],'diaspora'))
                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;
-       }
 
        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);
 
index a46f55b2a3d30c817ce6134349aef882af5c70a8..1cdd87a99a2306080621e0db53c3815e96d1362b 100644 (file)
@@ -37,9 +37,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" /> '
             . L10n::t('Post to Dreamwidth') . '</div>';
@@ -58,16 +58,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 */
@@ -111,10 +111,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']));
 
        }
 
@@ -133,11 +133,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)
@@ -162,7 +162,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.
 
@@ -172,10 +172,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) {
diff --git a/editplain/editplain.css b/editplain/editplain.css
new file mode 100644 (file)
index 0000000..697f653
--- /dev/null
@@ -0,0 +1,14 @@
+
+
+
+#editplain-enable-label {
+       float: left;
+       width: 200px;
+       margin-bottom: 25px;
+}
+
+#editplain-checkbox {
+       float: left;
+}
+
+
diff --git a/editplain/editplain.php b/editplain/editplain.php
new file mode 100644 (file)
index 0000000..3aa2149
--- /dev/null
@@ -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>';
+
+}
diff --git a/editplain/lang/C/messages.po b/editplain/lang/C/messages.po
new file mode 100644 (file)
index 0000000..16831de
--- /dev/null
@@ -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 ""
diff --git a/editplain/lang/ca/strings.php b/editplain/lang/ca/strings.php
new file mode 100644 (file)
index 0000000..8296c49
--- /dev/null
@@ -0,0 +1,6 @@
+<?php\r
+\r
+$a->strings["Editplain settings updated."] = "Actualitzar la configuració de Editplain.";\r
+$a->strings["Editplain Settings"] = "Configuració de Editplain";\r
+$a->strings["Disable richtext status editor"] = "Deshabilitar l'editor d'estatus de texte enriquit";\r
+$a->strings["Submit"] = "Enviar";\r
diff --git a/editplain/lang/cs/messages.po b/editplain/lang/cs/messages.po
new file mode 100644 (file)
index 0000000..5a5da77
--- /dev/null
@@ -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"
diff --git a/editplain/lang/cs/strings.php b/editplain/lang/cs/strings.php
new file mode 100644 (file)
index 0000000..96e5f5a
--- /dev/null
@@ -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";
diff --git a/editplain/lang/de/messages.po b/editplain/lang/de/messages.po
new file mode 100644 (file)
index 0000000..35f216c
--- /dev/null
@@ -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"
diff --git a/editplain/lang/de/strings.php b/editplain/lang/de/strings.php
new file mode 100644 (file)
index 0000000..89647e3
--- /dev/null
@@ -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";
diff --git a/editplain/lang/eo/strings.php b/editplain/lang/eo/strings.php
new file mode 100644 (file)
index 0000000..cd2b8a1
--- /dev/null
@@ -0,0 +1,6 @@
+<?php\r
+\r
+$a->strings["Editplain settings updated."] = "Ĝisdatigis la Editplain agordojn.";\r
+$a->strings["Editplain Settings"] = "Agordoj por Editplain";\r
+$a->strings["Disable richtext status editor"] = "Malŝalti la riĉteksto-redaktilon";\r
+$a->strings["Submit"] = "Sendi";\r
diff --git a/editplain/lang/es/messages.po b/editplain/lang/es/messages.po
new file mode 100644 (file)
index 0000000..97fd2c0
--- /dev/null
@@ -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"
diff --git a/editplain/lang/es/strings.php b/editplain/lang/es/strings.php
new file mode 100644 (file)
index 0000000..40caa5b
--- /dev/null
@@ -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";
diff --git a/editplain/lang/fr/messages.po b/editplain/lang/fr/messages.po
new file mode 100644 (file)
index 0000000..0041578
--- /dev/null
@@ -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"
diff --git a/editplain/lang/fr/strings.php b/editplain/lang/fr/strings.php
new file mode 100644 (file)
index 0000000..fcbca58
--- /dev/null
@@ -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";
diff --git a/editplain/lang/is/strings.php b/editplain/lang/is/strings.php
new file mode 100644 (file)
index 0000000..40d0166
--- /dev/null
@@ -0,0 +1,6 @@
+<?php\r
+\r
+$a->strings["Editplain settings updated."] = "";\r
+$a->strings["Editplain Settings"] = "";\r
+$a->strings["Disable richtext status editor"] = "";\r
+$a->strings["Submit"] = "Senda inn";\r
diff --git a/editplain/lang/it/messages.po b/editplain/lang/it/messages.po
new file mode 100644 (file)
index 0000000..6b93117
--- /dev/null
@@ -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"
diff --git a/editplain/lang/it/strings.php b/editplain/lang/it/strings.php
new file mode 100644 (file)
index 0000000..623400f
--- /dev/null
@@ -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";
diff --git a/editplain/lang/nb-no/strings.php b/editplain/lang/nb-no/strings.php
new file mode 100644 (file)
index 0000000..9ecd755
--- /dev/null
@@ -0,0 +1,6 @@
+<?php\r
+\r
+$a->strings["Editplain settings updated."] = "";\r
+$a->strings["Editplain Settings"] = "";\r
+$a->strings["Disable richtext status editor"] = "";\r
+$a->strings["Submit"] = "Lagre";\r
diff --git a/editplain/lang/pl/strings.php b/editplain/lang/pl/strings.php
new file mode 100644 (file)
index 0000000..2f00d53
--- /dev/null
@@ -0,0 +1,6 @@
+<?php\r
+\r
+$a->strings["Editplain settings updated."] = "";\r
+$a->strings["Editplain Settings"] = "";\r
+$a->strings["Disable richtext status editor"] = "";\r
+$a->strings["Submit"] = "Potwierdź";\r
diff --git a/editplain/lang/pt-br/strings.php b/editplain/lang/pt-br/strings.php
new file mode 100644 (file)
index 0000000..542f1e1
--- /dev/null
@@ -0,0 +1,6 @@
+<?php\r
+\r
+$a->strings["Editplain settings updated."] = "Configurações Editplain atualizadas.";\r
+$a->strings["Editplain Settings"] = "Configurações Editplain";\r
+$a->strings["Disable richtext status editor"] = "Disabilite o modo de edição richtext";\r
+$a->strings["Submit"] = "Enviar";\r
diff --git a/editplain/lang/ro/messages.po b/editplain/lang/ro/messages.po
new file mode 100644 (file)
index 0000000..b21dff5
--- /dev/null
@@ -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"
diff --git a/editplain/lang/ro/strings.php b/editplain/lang/ro/strings.php
new file mode 100644 (file)
index 0000000..df97d6c
--- /dev/null
@@ -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";
diff --git a/editplain/lang/ru/messages.po b/editplain/lang/ru/messages.po
new file mode 100644 (file)
index 0000000..591146d
--- /dev/null
@@ -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 "Добавить"
diff --git a/editplain/lang/ru/strings.php b/editplain/lang/ru/strings.php
new file mode 100644 (file)
index 0000000..0b397d8
--- /dev/null
@@ -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"] = "Добавить";
diff --git a/editplain/lang/sv/strings.php b/editplain/lang/sv/strings.php
new file mode 100644 (file)
index 0000000..3ec569a
--- /dev/null
@@ -0,0 +1,3 @@
+<?php\r
+\r
+$a->strings["Submit"] = "Spara";\r
diff --git a/editplain/lang/zh-cn/strings.php b/editplain/lang/zh-cn/strings.php
new file mode 100644 (file)
index 0000000..ce91121
--- /dev/null
@@ -0,0 +1,6 @@
+<?php\r
+\r
+$a->strings["Editplain settings updated."] = "Editplain设置更新了";\r
+$a->strings["Editplain Settings"] = "Editplain设置";\r
+$a->strings["Disable richtext status editor"] = "使richtext现状编辑 不能用";\r
+$a->strings["Submit"] = "提交";\r
diff --git a/extcron/extcron.php b/extcron/extcron.php
new file mode 100644 (file)
index 0000000..4405fb4
--- /dev/null
@@ -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();
+}
diff --git a/extcron/lang/C/messages.po b/extcron/lang/C/messages.po
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/facebook/README.md b/facebook/README.md
new file mode 100644 (file)
index 0000000..6bf5c83
--- /dev/null
@@ -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)
diff --git a/facebook/facebook.css b/facebook/facebook.css
new file mode 100644 (file)
index 0000000..0c16433
--- /dev/null
@@ -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;
+}
\ No newline at end of file
diff --git a/facebook/facebook.php b/facebook/facebook.php
new file mode 100644 (file)
index 0000000..f2e965c
--- /dev/null
@@ -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);
+}}
diff --git a/facebook/lang/C/messages.po b/facebook/lang/C/messages.po
new file mode 100644 (file)
index 0000000..8018e82
--- /dev/null
@@ -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 ""
diff --git a/facebook/lang/ca/strings.php b/facebook/lang/ca/strings.php
new file mode 100644 (file)
index 0000000..14d7948
--- /dev/null
@@ -0,0 +1,49 @@
+<?php\r
+\r
+$a->strings["Settings updated."] = "Ajustos actualitzats.";\r
+$a->strings["Permission denied."] = "Permís denegat.";\r
+$a->strings["Facebook disabled"] = "Facebook deshabilitat";\r
+$a->strings["Updating contacts"] = "Actualitzant contactes";\r
+$a->strings["Facebook API key is missing."] = "La clau del API de Facebook s'ha perdut.";\r
+$a->strings["Facebook Connect"] = "Facebook Connectat";\r
+$a->strings["Install Facebook connector for this account."] = "Instal·lar el connector de Facebook per aquest compte.";\r
+$a->strings["Remove Facebook connector"] = "Eliminar el connector de Faceboook";\r
+$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.]";\r
+$a->strings["Post to Facebook by default"] = "Enviar a Facebook per defecte";\r
+$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.";\r
+$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.";\r
+$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";\r
+$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.";\r
+$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è.";\r
+$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.";\r
+$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è";\r
+$a->strings["Do not import your Facebook profile wall conversations"] = "No importi les seves converses del mur del perfil de Facebook";\r
+$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.";\r
+$a->strings["Comma separated applications to ignore"] = "Separats per comes les aplicacions a ignorar";\r
+$a->strings["Submit"] = "Enviar";\r
+$a->strings["Problems with Facebook Real-Time Updates"] = "Problemes amb Actualitzacions en Temps Real a Facebook";\r
+$a->strings["Administrator"] = "Administrador";\r
+$a->strings["Facebook"] = "Facebook";\r
+$a->strings["Facebook Connector Settings"] = "Ajustos del Connector de Facebook";\r
+$a->strings["Facebook API Key"] = "Facebook API Key";\r
+$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>";\r
+$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).";\r
+$a->strings["The given API Key seems to work correctly."] = "La API Key facilitada sembla treballar correctament.";\r
+$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.";\r
+$a->strings["App-ID / API-Key"] = "App-ID / API-Key";\r
+$a->strings["Application secret"] = "Application secret";\r
+$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)";\r
+$a->strings["Save"] = "Guardar";\r
+$a->strings["Real-Time Updates"] = "Actualitzacions en Temps Real";\r
+$a->strings["Real-Time Updates are activated."] = "Actualitzacions en Temps Real està activat.";\r
+$a->strings["Deactivate Real-Time Updates"] = "Actualitzacions en Temps Real Desactivat";\r
+$a->strings["Real-Time Updates not activated."] = "Actualitzacions en Temps Real no activat.";\r
+$a->strings["Activate Real-Time Updates"] = "Actualitzacions en Temps Real Activat";\r
+$a->strings["The new values have been saved."] = "Els nous valors s'han guardat.";\r
+$a->strings["Post to Facebook"] = "Enviament a Facebook";\r
+$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.";\r
+$a->strings["View on Friendica"] = "Vist en Friendica";\r
+$a->strings["Facebook post failed. Queued for retry."] = "Enviament a Facebook fracassat. En cua per a reintent.";\r
+$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";\r
+$a->strings["Facebook connection became invalid"] = "La seva connexió a Facebook es va convertir en no vàlida";\r
+$a->strings["status"] = "estatus";\r
diff --git a/facebook/lang/cs/strings.php b/facebook/lang/cs/strings.php
new file mode 100644 (file)
index 0000000..ad503d6
--- /dev/null
@@ -0,0 +1,49 @@
+<?php\r
+\r
+$a->strings["Settings updated."] = "Nastavení aktualizováno.";\r
+$a->strings["Permission denied."] = "Přístup odmítnut.";\r
+$a->strings["Facebook disabled"] = "Facebook zakázán";\r
+$a->strings["Updating contacts"] = "Aktualizace kontaktů";\r
+$a->strings["Facebook API key is missing."] = "Chybí Facebook API klíč.";\r
+$a->strings["Facebook Connect"] = "Facebook připojen";\r
+$a->strings["Install Facebook connector for this account."] = "Nainstalovat pro tento účet Facebook konektor.";\r
+$a->strings["Remove Facebook connector"] = "Odstranit konektor na Facebook";\r
+$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.]";\r
+$a->strings["Post to Facebook by default"] = "Standardně posílat příspěvky na Facebook";\r
+$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.";\r
+$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.";\r
+$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";\r
+$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>.";\r
+$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).";\r
+$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.";\r
+$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.";\r
+$a->strings["Do not import your Facebook profile wall conversations"] = "Neimportovat konverzace z Facebookové zdi";\r
+$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.";\r
+$a->strings["Comma separated applications to ignore"] = "čárkou oddělené aplikace k ignorování";\r
+$a->strings["Submit"] = "Odeslat";\r
+$a->strings["Problems with Facebook Real-Time Updates"] = "Problémy s Facebook Real-Time aktualizacemi";\r
+$a->strings["Administrator"] = "Administrátor";\r
+$a->strings["Facebook"] = "Facebook";\r
+$a->strings["Facebook Connector Settings"] = "Nastavení Facebook konektoru ";\r
+$a->strings["Facebook API Key"] = "Facebook API Key";\r
+$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>";\r
+$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).";\r
+$a->strings["The given API Key seems to work correctly."] = "Zadané API Key se zdá funguje v pořádku.";\r
+$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.";\r
+$a->strings["App-ID / API-Key"] = "App-ID / API-Key";\r
+$a->strings["Application secret"] = "Application secret";\r
+$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)";\r
+$a->strings["Save"] = "Uložit";\r
+$a->strings["Real-Time Updates"] = "Real-Time Aktualizace";\r
+$a->strings["Real-Time Updates are activated."] = "Real-Time aktualizace aktivovány.";\r
+$a->strings["Deactivate Real-Time Updates"] = "Deaktivovat Real-Time aktualizace";\r
+$a->strings["Real-Time Updates not activated."] = "Real-Time aktualizace nejsou aktivovány.";\r
+$a->strings["Activate Real-Time Updates"] = "Aktivovat Real-Time aktualizace";\r
+$a->strings["The new values have been saved."] = "Nové hodnoty byly uloženy";\r
+$a->strings["Post to Facebook"] = "Přidat příspěvek na Facebook";\r
+$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.";\r
+$a->strings["View on Friendica"] = "Zobrazení na Friendica";\r
+$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í.";\r
+$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.";\r
+$a->strings["Facebook connection became invalid"] = "Připojení na Facebook bylo zneplatněno.";\r
+$a->strings["status"] = "Stav";\r
diff --git a/facebook/lang/de/strings.php b/facebook/lang/de/strings.php
new file mode 100644 (file)
index 0000000..74cfe83
--- /dev/null
@@ -0,0 +1,49 @@
+<?php\r
+\r
+$a->strings["Settings updated."] = "Einstellungen aktualisiert.";\r
+$a->strings["Permission denied."] = "Zugriff verweigert.";\r
+$a->strings["Facebook disabled"] = "Facebook deaktiviert";\r
+$a->strings["Updating contacts"] = "Aktualisiere Kontakte";\r
+$a->strings["Facebook API key is missing."] = "Facebook-API-Schlüssel nicht gefunden";\r
+$a->strings["Facebook Connect"] = "Mit Facebook verbinden";\r
+$a->strings["Install Facebook connector for this account."] = "Facebook-Connector für dieses Konto installieren.";\r
+$a->strings["Remove Facebook connector"] = "Facebook-Connector entfernen";\r
+$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.]";\r
+$a->strings["Post to Facebook by default"] = "Veröffentliche standardmäßig bei Facebook";\r
+$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.";\r
+$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.";\r
+$a->strings["Link all your Facebook friends and conversations on this website"] = "All meine Facebook-Kontakte und -Konversationen hier auf diese Website importieren";\r
+$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>.";\r
+$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.";\r
+$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.";\r
+$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";\r
+$a->strings["Do not import your Facebook profile wall conversations"] = "Facebook-Pinnwand nicht importieren";\r
+$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.";\r
+$a->strings["Comma separated applications to ignore"] = "Kommaseparierte Anwendungen, die ignoriert werden sollen";\r
+$a->strings["Submit"] = "Senden";\r
+$a->strings["Problems with Facebook Real-Time Updates"] = "Probleme mit Facebook Echtzeit-Updates";\r
+$a->strings["Administrator"] = "Administrator";\r
+$a->strings["Facebook"] = "Facebook";\r
+$a->strings["Facebook Connector Settings"] = "Facebook-Verbindungseinstellungen";\r
+$a->strings["Facebook API Key"] = "Facebook API Schlüssel";\r
+$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>";\r
+$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).";\r
+$a->strings["The given API Key seems to work correctly."] = "Der angegebene API Schlüssel scheint korrekt zu funktionieren.";\r
+$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.";\r
+$a->strings["App-ID / API-Key"] = "App-ID / API-Key";\r
+$a->strings["Application secret"] = "Anwendungs-Geheimnis";\r
+$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)";\r
+$a->strings["Save"] = "Speichern";\r
+$a->strings["Real-Time Updates"] = "Echtzeit Aktualisierungen";\r
+$a->strings["Real-Time Updates are activated."] = "Echtzeit-Updates sind aktiviert.";\r
+$a->strings["Deactivate Real-Time Updates"] = "Echtzeit-Updates deaktivieren";\r
+$a->strings["Real-Time Updates not activated."] = "Echtzeit-Updates nicht aktiviert.";\r
+$a->strings["Activate Real-Time Updates"] = "Echtzeit-Updates aktivieren";\r
+$a->strings["The new values have been saved."] = "Die neuen Einstellungen wurden gespeichert.";\r
+$a->strings["Post to Facebook"] = "Bei Facebook veröffentlichen";\r
+$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.";\r
+$a->strings["View on Friendica"] = "In Friendica betrachten";\r
+$a->strings["Facebook post failed. Queued for retry."] = "Veröffentlichung bei Facebook gescheitert. Wir versuchen es später erneut.";\r
+$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "Deine Facebook Anmeldedaten sind ungültig geworden. Bitte re-authentifiziere dich.";\r
+$a->strings["Facebook connection became invalid"] = "Facebook Anmeldedaten sind ungültig geworden";\r
+$a->strings["status"] = "Status";\r
diff --git a/facebook/lang/eo/strings.php b/facebook/lang/eo/strings.php
new file mode 100644 (file)
index 0000000..43115eb
--- /dev/null
@@ -0,0 +1,49 @@
+<?php\r
+\r
+$a->strings["Settings updated."] = "Agordoj ĝisdatigita.";\r
+$a->strings["Permission denied."] = "Malpermesita.";\r
+$a->strings["Facebook disabled"] = "Facebook malŝaltita";\r
+$a->strings["Updating contacts"] = "Mi ĝisdatigas la kontaktojn.";\r
+$a->strings["Facebook API key is missing."] = "La API ŝlosilo de Facebook ne estas konata ĉi tie.";\r
+$a->strings["Facebook Connect"] = "Kontekto al Facebook";\r
+$a->strings["Install Facebook connector for this account."] = "Instali la Facebook konektilo por ĉi tiu konto.";\r
+$a->strings["Remove Facebook connector"] = "Forigi la Facebook konektilon.";\r
+$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.]";\r
+$a->strings["Post to Facebook by default"] = "Ĉiam afiŝi al Facebook.";\r
+$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.";\r
+$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.";\r
+$a->strings["Link all your Facebook friends and conversations on this website"] = "Alligu ĉiujn viajn Facebook amikojn kaj konversaciojn je ĉi-tiu retejo.";\r
+$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.";\r
+$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.";\r
+$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.";\r
+$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.";\r
+$a->strings["Do not import your Facebook profile wall conversations"] = "Ne importi konversaciojn de via Facebook profilmuro";\r
+$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.";\r
+$a->strings["Comma separated applications to ignore"] = "Ignorotaj programoj, disigita per komo";\r
+$a->strings["Submit"] = "Sendi";\r
+$a->strings["Problems with Facebook Real-Time Updates"] = "Problemoj kun Facebook Realtempaj Ĝisdatigoj";\r
+$a->strings["Administrator"] = "Administranto";\r
+$a->strings["Facebook"] = "Facebook";\r
+$a->strings["Facebook Connector Settings"] = "Agordoj por la Facebook konektilo";\r
+$a->strings["Facebook API Key"] = "Facebook API ŝlosilo";\r
+$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>";\r
+$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).";\r
+$a->strings["The given API Key seems to work correctly."] = "La API ŝlosilo ŝajne ĝuste funkcias.";\r
+$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.";\r
+$a->strings["App-ID / API-Key"] = "Programo ID / API Ŝlosilo";\r
+$a->strings["Application secret"] = "Programo sekreto";\r
+$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)";\r
+$a->strings["Save"] = "Konservi";\r
+$a->strings["Real-Time Updates"] = "Realtempaj Ĝisdatigoj";\r
+$a->strings["Real-Time Updates are activated."] = "Realtempaj Ĝisdatigoj estas ŝaltita";\r
+$a->strings["Deactivate Real-Time Updates"] = "Malŝalti Realtempaj Ĝisdatigoj";\r
+$a->strings["Real-Time Updates not activated."] = "Realtempaj Ĝisdatigoj estas malŝaltita";\r
+$a->strings["Activate Real-Time Updates"] = "Ŝalti Realtempaj Ĝisdatigoj";\r
+$a->strings["The new values have been saved."] = "Konservis novajn valorojn.";\r
+$a->strings["Post to Facebook"] = "Afiŝi al Facebook";\r
+$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "Afiŝado al Facebook nuligita ĉar okazis konflikto en la multretpermesoj.";\r
+$a->strings["View on Friendica"] = "Vidi ĉe Friendica";\r
+$a->strings["Facebook post failed. Queued for retry."] = "Malsukcesis afiŝi ĉe Facebook. Enigita en vico.";\r
+$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "Via Facbook konekto iĝis nevalida. Bonvolu reaŭtentiĝi.";\r
+$a->strings["Facebook connection became invalid"] = "Facebook konekto iĝis nevalida.";\r
+$a->strings["status"] = "staton";\r
diff --git a/facebook/lang/es/strings.php b/facebook/lang/es/strings.php
new file mode 100644 (file)
index 0000000..a5b496e
--- /dev/null
@@ -0,0 +1,49 @@
+<?php\r
+\r
+$a->strings["Settings updated."] = "Configuración actualizada.";\r
+$a->strings["Permission denied."] = "Permiso denegado.";\r
+$a->strings["Facebook disabled"] = "Facebook deshabilitado";\r
+$a->strings["Updating contacts"] = "Actualizando contactos";\r
+$a->strings["Facebook API key is missing."] = "Falta la clave API de Facebook.";\r
+$a->strings["Facebook Connect"] = "Conexión con Facebook";\r
+$a->strings["Install Facebook connector for this account."] = "Instalar el conector de Facebook para esta cuenta.";\r
+$a->strings["Remove Facebook connector"] = "Eliminar el conector de Facebook";\r
+$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.]";\r
+$a->strings["Post to Facebook by default"] = "Publicar en Facebook de forma predeterminada";\r
+$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.";\r
+$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.";\r
+$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";\r
+$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.";\r
+$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.";\r
+$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.";\r
+$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";\r
+$a->strings["Do not import your Facebook profile wall conversations"] = "No importar las conversaciones de tu muro de Facebook";\r
+$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.";\r
+$a->strings["Comma separated applications to ignore"] = "Aplicaciones a ignorar separadas por comas";\r
+$a->strings["Submit"] = "Envíar";\r
+$a->strings["Problems with Facebook Real-Time Updates"] = "Hay problemas con las actualizaciones en tiempo real de Facebook";\r
+$a->strings["Administrator"] = "Administrador";\r
+$a->strings["Facebook"] = "Facebook";\r
+$a->strings["Facebook Connector Settings"] = "Configuración de conexión a Facebook";\r
+$a->strings["Facebook API Key"] = "Llave API de Facebook";\r
+$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>";\r
+$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).";\r
+$a->strings["The given API Key seems to work correctly."] = "La Llave API proporcionada parece funcionar correctamente.";\r
+$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.";\r
+$a->strings["App-ID / API-Key"] = "Añadir ID / Llave API";\r
+$a->strings["Application secret"] = "Secreto de la aplicación";\r
+$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)";\r
+$a->strings["Save"] = "Guardar";\r
+$a->strings["Real-Time Updates"] = "Actualizaciones en tiempo real";\r
+$a->strings["Real-Time Updates are activated."] = "Actualizaciones en tiempo real activada.";\r
+$a->strings["Deactivate Real-Time Updates"] = "Desactivar actualizaciones en tiempo real";\r
+$a->strings["Real-Time Updates not activated."] = "Actualizaciones en tiempo real desactivada.";\r
+$a->strings["Activate Real-Time Updates"] = "Activar actualizaciones en tiempo real";\r
+$a->strings["The new values have been saved."] = "Los nuevos valores se han guardado.";\r
+$a->strings["Post to Facebook"] = "Publicar en Facebook";\r
+$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.";\r
+$a->strings["View on Friendica"] = "Ver en Friendica";\r
+$a->strings["Facebook post failed. Queued for retry."] = "Publicación en Facebook errónea. Reintentando...";\r
+$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "Tu conexión con Facebook ha sido invalidada. Por favor vuelve a identificarte.";\r
+$a->strings["Facebook connection became invalid"] = "La conexión con Facebook ha sido invalidada";\r
+$a->strings["status"] = "estado";\r
diff --git a/facebook/lang/fr/strings.php b/facebook/lang/fr/strings.php
new file mode 100644 (file)
index 0000000..f5276fe
--- /dev/null
@@ -0,0 +1,49 @@
+<?php\r
+\r
+$a->strings["Settings updated."] = "Réglages mis à jour.";\r
+$a->strings["Permission denied."] = "Permission refusée.";\r
+$a->strings["Facebook disabled"] = "Connecteur Facebook désactivé";\r
+$a->strings["Updating contacts"] = "Mise-à-jour des contacts";\r
+$a->strings["Facebook API key is missing."] = "Clé d'API Facebook manquante.";\r
+$a->strings["Facebook Connect"] = "Connecteur Facebook";\r
+$a->strings["Install Facebook connector for this account."] = "Installer le connecteur Facebook sur ce compte.";\r
+$a->strings["Remove Facebook connector"] = "Désinstaller le connecteur Facebook";\r
+$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.]";\r
+$a->strings["Post to Facebook by default"] = "Poster sur Facebook par défaut";\r
+$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.";\r
+$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.";\r
+$a->strings["Link all your Facebook friends and conversations on this website"] = "Lier tous vos amis et conversations Facebook sur ce site";\r
+$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.";\r
+$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.";\r
+$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.";\r
+$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.";\r
+$a->strings["Do not import your Facebook profile wall conversations"] = "Ne pas importer les conversations de votre mur Facebook.";\r
+$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é.";\r
+$a->strings["Comma separated applications to ignore"] = "Liste (séparée par des virgules) des applications à ignorer";\r
+$a->strings["Submit"] = "Envoyer";\r
+$a->strings["Problems with Facebook Real-Time Updates"] = "Problème avec les mises-à-jour en temps réel de Facebook";\r
+$a->strings["Administrator"] = "Administrateur";\r
+$a->strings["Facebook"] = "Facebook";\r
+$a->strings["Facebook Connector Settings"] = "Réglages du connecteur Facebook";\r
+$a->strings["Facebook API Key"] = "Clé d'API Facebook";\r
+$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 />";\r
+$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é)";\r
+$a->strings["The given API Key seems to work correctly."] = "La clé d'API semble fonctionner correctement.";\r
+$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.";\r
+$a->strings["App-ID / API-Key"] = "App-ID / Clé d'API";\r
+$a->strings["Application secret"] = "Secret de l'application";\r
+$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)";\r
+$a->strings["Save"] = "Sauver";\r
+$a->strings["Real-Time Updates"] = "Mises-à-jour en temps réel";\r
+$a->strings["Real-Time Updates are activated."] = "Mises-à-jour en temps réel activées.";\r
+$a->strings["Deactivate Real-Time Updates"] = "Désactiver les mises-à-jour en temps réel";\r
+$a->strings["Real-Time Updates not activated."] = "Mises-à-jour en temps réel désactivées.";\r
+$a->strings["Activate Real-Time Updates"] = "Activer les mises-à-jour en temps réel";\r
+$a->strings["The new values have been saved."] = "Les nouvelles valeurs ont été sauvées.";\r
+$a->strings["Post to Facebook"] = "Poster sur Facebook";\r
+$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.";\r
+$a->strings["View on Friendica"] = "Voir sur Friendica";\r
+$a->strings["Facebook post failed. Queued for retry."] = "Publication sur Facebook échouée. En attente pour re-tentative.";\r
+$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "Votre connexion à Facebook est devenue invalide. Merci de vous ré-authentifier.";\r
+$a->strings["Facebook connection became invalid"] = "La connexion Facebook est devenue invalide";\r
+$a->strings["status"] = "le statut";\r
diff --git a/facebook/lang/is/strings.php b/facebook/lang/is/strings.php
new file mode 100644 (file)
index 0000000..df9db5b
--- /dev/null
@@ -0,0 +1,49 @@
+<?php\r
+\r
+$a->strings["Settings updated."] = "Stillingar uppfærðar";\r
+$a->strings["Permission denied."] = "Heimild ekki veitt.";\r
+$a->strings["Facebook disabled"] = "Ekki er kveikt á Facebook ";\r
+$a->strings["Updating contacts"] = "Uppfæra tengiliði";\r
+$a->strings["Facebook API key is missing."] = "Facebook API lykill er ekki til staðar.";\r
+$a->strings["Facebook Connect"] = "Facebook tenging";\r
+$a->strings["Install Facebook connector for this account."] = "Setja þarf upp Facebook tengil fyrir þennan notanda";\r
+$a->strings["Remove Facebook connector"] = "Fjarlæga Facebook tengil";\r
+$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.]";\r
+$a->strings["Post to Facebook by default"] = "Senda sjálfgefið færslur á Facebook ";\r
+$a->strings["Facebook friend linking has been disabled on this site. The following settings will have no effect."] = "";\r
+$a->strings["Facebook friend linking has been disabled on this site. If you disable it, you will be unable to re-enable it."] = "";\r
+$a->strings["Link all your Facebook friends and conversations on this website"] = "Tengjast öllum vinum og samtölum á Facebook af þessum vef";\r
+$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.";\r
+$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.";\r
+$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. ";\r
+$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";\r
+$a->strings["Do not import your Facebook profile wall conversations"] = "Ekki sækja samtöl af Facebook forsíðu vegg";\r
+$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ð.";\r
+$a->strings["Comma separated applications to ignore"] = "Forrit sem á að hunsa (komma á milli)";\r
+$a->strings["Submit"] = "Senda inn";\r
+$a->strings["Problems with Facebook Real-Time Updates"] = "";\r
+$a->strings["Administrator"] = "Kerfisstjóri";\r
+$a->strings["Facebook"] = "Facebook";\r
+$a->strings["Facebook Connector Settings"] = "Facebook tengils stillingar";\r
+$a->strings["Facebook API Key"] = "";\r
+$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>"] = "";\r
+$a->strings["Error: the given API Key seems to be incorrect (the application access token could not be retrieved)."] = "";\r
+$a->strings["The given API Key seems to work correctly."] = "";\r
+$a->strings["The correctness of the API Key could not be detected. Something strange's going on."] = "";\r
+$a->strings["App-ID / API-Key"] = "";\r
+$a->strings["Application secret"] = "";\r
+$a->strings["Synchronize comments (no comments on Facebook are missed, at the cost of increased system load)"] = "";\r
+$a->strings["Save"] = "Vista";\r
+$a->strings["Real-Time Updates"] = "";\r
+$a->strings["Real-Time Updates are activated."] = "";\r
+$a->strings["Deactivate Real-Time Updates"] = "";\r
+$a->strings["Real-Time Updates not activated."] = "";\r
+$a->strings["Activate Real-Time Updates"] = "";\r
+$a->strings["The new values have been saved."] = "";\r
+$a->strings["Post to Facebook"] = "Senda á Facebook";\r
+$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.";\r
+$a->strings["View on Friendica"] = "Skoða á Friendica";\r
+$a->strings["Facebook post failed. Queued for retry."] = "Færsla sem átti að flæða yfir á Facebook mistókst. Sett í biðröð til endurtekningar.";\r
+$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "";\r
+$a->strings["Facebook connection became invalid"] = "";\r
+$a->strings["status"] = "staða";\r
diff --git a/facebook/lang/it/strings.php b/facebook/lang/it/strings.php
new file mode 100644 (file)
index 0000000..ddc1074
--- /dev/null
@@ -0,0 +1,49 @@
+<?php\r
+\r
+$a->strings["Settings updated."] = "Impostazioni aggiornate.";\r
+$a->strings["Permission denied."] = "Permesso negato.";\r
+$a->strings["Facebook disabled"] = "Facebook disabilitato";\r
+$a->strings["Updating contacts"] = "Aggiornamento contatti";\r
+$a->strings["Facebook API key is missing."] = "Chiave API Facebook mancante.";\r
+$a->strings["Facebook Connect"] = "Facebook Connect";\r
+$a->strings["Install Facebook connector for this account."] = "Installa Facebook connector per questo account";\r
+$a->strings["Remove Facebook connector"] = "Rimuovi Facebook connector";\r
+$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.]";\r
+$a->strings["Post to Facebook by default"] = "Invia sempre a Facebook";\r
+$a->strings["Facebook friend linking has been disabled on this site. The following settings will have no effect."] = "";\r
+$a->strings["Facebook friend linking has been disabled on this site. If you disable it, you will be unable to re-enable it."] = "";\r
+$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";\r
+$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";\r
+$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.";\r
+$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.";\r
+$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";\r
+$a->strings["Do not import your Facebook profile wall conversations"] = "Non importare le conversazione sulla tua bacheca di Facebook";\r
+$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.";\r
+$a->strings["Comma separated applications to ignore"] = "Elenco separato da virgola di applicazioni da ignorare";\r
+$a->strings["Submit"] = "Invia";\r
+$a->strings["Problems with Facebook Real-Time Updates"] = "Problemi con gli aggiornamenti in tempo reale con Facebook";\r
+$a->strings["Administrator"] = "Amministratore";\r
+$a->strings["Facebook"] = "Facebook";\r
+$a->strings["Facebook Connector Settings"] = "Impostazioni del connettore Facebook";\r
+$a->strings["Facebook API Key"] = "Facebook API Key";\r
+$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>";\r
+$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).";\r
+$a->strings["The given API Key seems to work correctly."] = "L' API Key fornita sembra funzionare correttamente.";\r
+$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.";\r
+$a->strings["App-ID / API-Key"] = "App-ID / API-Key";\r
+$a->strings["Application secret"] = "Application secret";\r
+$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)";\r
+$a->strings["Save"] = "Salva";\r
+$a->strings["Real-Time Updates"] = "Aggiornamenti Real-Time";\r
+$a->strings["Real-Time Updates are activated."] = "Gli aggiornamenti in tempo reale sono attivi";\r
+$a->strings["Deactivate Real-Time Updates"] = "Disattiva gli aggiornamenti in tempo reale";\r
+$a->strings["Real-Time Updates not activated."] = "Gli aggiornamenti in tempo reale non sono attivi";\r
+$a->strings["Activate Real-Time Updates"] = "Attiva gli aggiornamenti in tempo reale";\r
+$a->strings["The new values have been saved."] = "I nuovi valori sono stati salvati.";\r
+$a->strings["Post to Facebook"] = "Invia a Facebook";\r
+$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "Invio su Facebook annullato per un conflitto nei permessi di accesso.";\r
+$a->strings["View on Friendica"] = "Vedi su Friendica";\r
+$a->strings["Facebook post failed. Queued for retry."] = "Invio a Facebook fallito. In attesa di riprovare.";\r
+$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "La tua connessione con Facebook è diventata invalida. Per favore ri-autenticati.";\r
+$a->strings["Facebook connection became invalid"] = "La connessione Facebook è diventata invalida.";\r
+$a->strings["status"] = "stato";\r
diff --git a/facebook/lang/nb-no/strings.php b/facebook/lang/nb-no/strings.php
new file mode 100644 (file)
index 0000000..2943001
--- /dev/null
@@ -0,0 +1,49 @@
+<?php\r
+\r
+$a->strings["Settings updated."] = "Innstillinger oppdatert.";\r
+$a->strings["Permission denied."] = "Ingen tilgang.";\r
+$a->strings["Facebook disabled"] = "Facebook avskrudd";\r
+$a->strings["Updating contacts"] = "Oppdaterer kontakter";\r
+$a->strings["Facebook API key is missing."] = "Facebook API-nøkkel mangler.";\r
+$a->strings["Facebook Connect"] = "Facebook-kobling";\r
+$a->strings["Install Facebook connector for this account."] = "Legg til Facebook-kobling for denne kontoen.";\r
+$a->strings["Remove Facebook connector"] = "Fjern Facebook-kobling";\r
+$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "";\r
+$a->strings["Post to Facebook by default"] = "Post til Facebook som standard";\r
+$a->strings["Facebook friend linking has been disabled on this site. The following settings will have no effect."] = "";\r
+$a->strings["Facebook friend linking has been disabled on this site. If you disable it, you will be unable to re-enable it."] = "";\r
+$a->strings["Link all your Facebook friends and conversations on this website"] = "";\r
+$a->strings["Facebook conversations consist of your <em>profile wall</em> and your friend <em>stream</em>."] = "";\r
+$a->strings["On this website, your Facebook friend stream is only visible to you."] = "";\r
+$a->strings["The following settings determine the privacy of your Facebook profile wall on this website."] = "";\r
+$a->strings["On this website your Facebook profile wall conversations will only be visible to you"] = "";\r
+$a->strings["Do not import your Facebook profile wall conversations"] = "";\r
+$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."] = "";\r
+$a->strings["Comma separated applications to ignore"] = "";\r
+$a->strings["Submit"] = "Lagre";\r
+$a->strings["Problems with Facebook Real-Time Updates"] = "";\r
+$a->strings["Administrator"] = "Administrator";\r
+$a->strings["Facebook"] = "Facebook";\r
+$a->strings["Facebook Connector Settings"] = "Innstillinger for Facebook-kobling";\r
+$a->strings["Facebook API Key"] = "";\r
+$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>"] = "";\r
+$a->strings["Error: the given API Key seems to be incorrect (the application access token could not be retrieved)."] = "";\r
+$a->strings["The given API Key seems to work correctly."] = "";\r
+$a->strings["The correctness of the API Key could not be detected. Something strange's going on."] = "";\r
+$a->strings["App-ID / API-Key"] = "";\r
+$a->strings["Application secret"] = "";\r
+$a->strings["Synchronize comments (no comments on Facebook are missed, at the cost of increased system load)"] = "";\r
+$a->strings["Save"] = "Lagre";\r
+$a->strings["Real-Time Updates"] = "";\r
+$a->strings["Real-Time Updates are activated."] = "";\r
+$a->strings["Deactivate Real-Time Updates"] = "";\r
+$a->strings["Real-Time Updates not activated."] = "";\r
+$a->strings["Activate Real-Time Updates"] = "";\r
+$a->strings["The new values have been saved."] = "";\r
+$a->strings["Post to Facebook"] = "Post til Facebook";\r
+$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.";\r
+$a->strings["View on Friendica"] = "";\r
+$a->strings["Facebook post failed. Queued for retry."] = "Facebook-innlegg mislyktes. Innlegget er lagt i kø for å prøve igjen.";\r
+$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "";\r
+$a->strings["Facebook connection became invalid"] = "";\r
+$a->strings["status"] = "status";\r
diff --git a/facebook/lang/pl/strings.php b/facebook/lang/pl/strings.php
new file mode 100644 (file)
index 0000000..246bf0e
--- /dev/null
@@ -0,0 +1,49 @@
+<?php\r
+\r
+$a->strings["Settings updated."] = "Zaktualizowano ustawienia.";\r
+$a->strings["Permission denied."] = "Brak uprawnień.";\r
+$a->strings["Facebook disabled"] = "Facebook wyłączony";\r
+$a->strings["Updating contacts"] = "Aktualizacja kontaktów";\r
+$a->strings["Facebook API key is missing."] = "Brakuje klucza API z facebooka.";\r
+$a->strings["Facebook Connect"] = "Połącz konto z kontem Facebook";\r
+$a->strings["Install Facebook connector for this account."] = "Zainstaluj wtyczkę Facebook ";\r
+$a->strings["Remove Facebook connector"] = "Usuń wtyczkę Facebook";\r
+$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]";\r
+$a->strings["Post to Facebook by default"] = "Domyślnie opublikuj na stronie Facebook";\r
+$a->strings["Facebook friend linking has been disabled on this site. The following settings will have no effect."] = "";\r
+$a->strings["Facebook friend linking has been disabled on this site. If you disable it, you will be unable to re-enable it."] = "";\r
+$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";\r
+$a->strings["Facebook conversations consist of your <em>profile wall</em> and your friend <em>stream</em>."] = "";\r
+$a->strings["On this website, your Facebook friend stream is only visible to you."] = "";\r
+$a->strings["The following settings determine the privacy of your Facebook profile wall on this website."] = "";\r
+$a->strings["On this website your Facebook profile wall conversations will only be visible to you"] = "";\r
+$a->strings["Do not import your Facebook profile wall conversations"] = "";\r
+$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."] = "";\r
+$a->strings["Comma separated applications to ignore"] = "";\r
+$a->strings["Submit"] = "Potwierdź";\r
+$a->strings["Problems with Facebook Real-Time Updates"] = "Problemy z aktualizacjami w czasie rzeczywistym Facebook'a";\r
+$a->strings["Administrator"] = "Administrator";\r
+$a->strings["Facebook"] = "Facebook";\r
+$a->strings["Facebook Connector Settings"] = "Ustawienia połączenia z Facebook";\r
+$a->strings["Facebook API Key"] = "Facebook API Key";\r
+$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>"] = "";\r
+$a->strings["Error: the given API Key seems to be incorrect (the application access token could not be retrieved)."] = "";\r
+$a->strings["The given API Key seems to work correctly."] = "";\r
+$a->strings["The correctness of the API Key could not be detected. Something strange's going on."] = "";\r
+$a->strings["App-ID / API-Key"] = "App-ID / API-Key";\r
+$a->strings["Application secret"] = "";\r
+$a->strings["Synchronize comments (no comments on Facebook are missed, at the cost of increased system load)"] = "";\r
+$a->strings["Save"] = "Zapisz";\r
+$a->strings["Real-Time Updates"] = "Aktualizacje w czasie rzeczywistym";\r
+$a->strings["Real-Time Updates are activated."] = "Aktualizacje w czasie rzeczywistym zostały aktywowane.";\r
+$a->strings["Deactivate Real-Time Updates"] = "Zdezaktywuj aktualizacje w czasie rzeczywistym";\r
+$a->strings["Real-Time Updates not activated."] = "Aktualizacje w czasie rzeczywistym nie zostały aktywowane.";\r
+$a->strings["Activate Real-Time Updates"] = "Aktywuj aktualizacje w czasie rzeczywistym";\r
+$a->strings["The new values have been saved."] = "";\r
+$a->strings["Post to Facebook"] = "Post na Facebook";\r
+$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";\r
+$a->strings["View on Friendica"] = "Zobacz na Friendice";\r
+$a->strings["Facebook post failed. Queued for retry."] = "";\r
+$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "";\r
+$a->strings["Facebook connection became invalid"] = "Błędne połączenie z Facebookiem";\r
+$a->strings["status"] = "status";\r
diff --git a/facebook/lang/pt-br/strings.php b/facebook/lang/pt-br/strings.php
new file mode 100644 (file)
index 0000000..e370f00
--- /dev/null
@@ -0,0 +1,49 @@
+<?php\r
+\r
+$a->strings["Settings updated."] = "As configurações foram atualizadas.";\r
+$a->strings["Permission denied."] = "Permissão negada.";\r
+$a->strings["Facebook disabled"] = "O Facebook está desabilitado";\r
+$a->strings["Updating contacts"] = "Atualizando os contatos";\r
+$a->strings["Facebook API key is missing."] = "A chave de API do Facebook não foi encontrada.";\r
+$a->strings["Facebook Connect"] = "Conexão com o Facebook";\r
+$a->strings["Install Facebook connector for this account."] = "Instalar o conector do Facebook nesta conta.";\r
+$a->strings["Remove Facebook connector"] = "Remover o conector do Facebook";\r
+$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "Reautenticar [Isso é necessário sempre que sua senha do Facebook é modificada.]";\r
+$a->strings["Post to Facebook by default"] = "Publicar no Facebook por padrão";\r
+$a->strings["Facebook friend linking has been disabled on this site. The following settings will have no effect."] = "";\r
+$a->strings["Facebook friend linking has been disabled on this site. If you disable it, you will be unable to re-enable it."] = "";\r
+$a->strings["Link all your Facebook friends and conversations on this website"] = "Ligar todos os seus amigos e conversas do Facebook neste site";\r
+$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.";\r
+$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ê.";\r
+$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.";\r
+$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ê";\r
+$a->strings["Do not import your Facebook profile wall conversations"] = "Não importar as conversas do seu perfil/mural do Facebook";\r
+$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.";\r
+$a->strings["Comma separated applications to ignore"] = "Ignorar aplicações separadas por vírgula";\r
+$a->strings["Submit"] = "Enviar";\r
+$a->strings["Problems with Facebook Real-Time Updates"] = "Problemas com as atualizações em tempo real do Facebook";\r
+$a->strings["Administrator"] = "Administrador";\r
+$a->strings["Facebook"] = "Facebook";\r
+$a->strings["Facebook Connector Settings"] = "Configurações do conector do Facebook";\r
+$a->strings["Facebook API Key"] = "Chave da API do Facebook";\r
+$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>";\r
+$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).";\r
+$a->strings["The given API Key seems to work correctly."] = "A chave de API fornecida aparentemente está funcionando corretamente.";\r
+$a->strings["The correctness of the API Key could not be detected. Something strange's going on."] = "";\r
+$a->strings["App-ID / API-Key"] = "App-ID / API-Key";\r
+$a->strings["Application secret"] = "Segredo da aplicação";\r
+$a->strings["Synchronize comments (no comments on Facebook are missed, at the cost of increased system load)"] = "";\r
+$a->strings["Save"] = "Salvar";\r
+$a->strings["Real-Time Updates"] = "Atualizações em tempo real";\r
+$a->strings["Real-Time Updates are activated."] = "As atualizações em tempo real estão ativadas.";\r
+$a->strings["Deactivate Real-Time Updates"] = "Desativar as atualizações em tempo real.";\r
+$a->strings["Real-Time Updates not activated."] = "As atualizações em tempo real não estão ativadas.";\r
+$a->strings["Activate Real-Time Updates"] = "Ativar atualizações em tempo real";\r
+$a->strings["The new values have been saved."] = "Os novos valores foram salvos.";\r
+$a->strings["Post to Facebook"] = "Publicar no Facebook";\r
+$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.";\r
+$a->strings["View on Friendica"] = "Ver no Friendica";\r
+$a->strings["Facebook post failed. Queued for retry."] = "Não foi possível publicar no Facebook. Armazenado na fila para nova tentativa.";\r
+$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.";\r
+$a->strings["Facebook connection became invalid"] = "A conexão com o Facebook tornou-se inválida";\r
+$a->strings["status"] = "status";\r
diff --git a/facebook/lang/ru/strings.php b/facebook/lang/ru/strings.php
new file mode 100644 (file)
index 0000000..2b4ed2d
--- /dev/null
@@ -0,0 +1,49 @@
+<?php\r
+\r
+$a->strings["Settings updated."] = "Настройки обновлены.";\r
+$a->strings["Permission denied."] = "Нет разрешения.";\r
+$a->strings["Facebook disabled"] = "Facebook отключен";\r
+$a->strings["Updating contacts"] = "Обновление контактов";\r
+$a->strings["Facebook API key is missing."] = "Отсутствует ключ Facebook API.";\r
+$a->strings["Facebook Connect"] = "Facebook подключение";\r
+$a->strings["Install Facebook connector for this account."] = "Установить Facebook Connector для этого аккаунта.";\r
+$a->strings["Remove Facebook connector"] = "Удалить Facebook Connector";\r
+$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "Переаутентификация [Это необходимо, если вы изменили пароль на Facebook.]";\r
+$a->strings["Post to Facebook by default"] = "Отправлять на Facebook по умолчанию";\r
+$a->strings["Facebook friend linking has been disabled on this site. The following settings will have no effect."] = "";\r
+$a->strings["Facebook friend linking has been disabled on this site. If you disable it, you will be unable to re-enable it."] = "";\r
+$a->strings["Link all your Facebook friends and conversations on this website"] = "Прикрепите своих друзей и общение с Facebook на этот сайт";\r
+$a->strings["Facebook conversations consist of your <em>profile wall</em> and your friend <em>stream</em>."] = "";\r
+$a->strings["On this website, your Facebook friend stream is only visible to you."] = "Facebook-лента друзей видна только вам.";\r
+$a->strings["The following settings determine the privacy of your Facebook profile wall on this website."] = "Следующие настройки определяют параметры приватности вашей стены с Facebook на этом сайте.";\r
+$a->strings["On this website your Facebook profile wall conversations will only be visible to you"] = "Ваша лента профиля Facebook будет видна только вам";\r
+$a->strings["Do not import your Facebook profile wall conversations"] = "Не импортировать Facebook разговоров с Вашей страницы";\r
+$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."] = "";\r
+$a->strings["Comma separated applications to ignore"] = "Игнорировать приложения (список через запятую)";\r
+$a->strings["Submit"] = "Подтвердить";\r
+$a->strings["Problems with Facebook Real-Time Updates"] = "";\r
+$a->strings["Administrator"] = "Администратор";\r
+$a->strings["Facebook"] = "Facebook";\r
+$a->strings["Facebook Connector Settings"] = "Настройки подключения Facebook";\r
+$a->strings["Facebook API Key"] = "Facebook API Key";\r
+$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>"] = "";\r
+$a->strings["Error: the given API Key seems to be incorrect (the application access token could not be retrieved)."] = "";\r
+$a->strings["The given API Key seems to work correctly."] = "";\r
+$a->strings["The correctness of the API Key could not be detected. Something strange's going on."] = "";\r
+$a->strings["App-ID / API-Key"] = "App-ID / API-Key";\r
+$a->strings["Application secret"] = "Секрет приложения";\r
+$a->strings["Synchronize comments (no comments on Facebook are missed, at the cost of increased system load)"] = "";\r
+$a->strings["Save"] = "Сохранить";\r
+$a->strings["Real-Time Updates"] = "";\r
+$a->strings["Real-Time Updates are activated."] = "";\r
+$a->strings["Deactivate Real-Time Updates"] = "Отключить Real-Time обновления";\r
+$a->strings["Real-Time Updates not activated."] = "";\r
+$a->strings["Activate Real-Time Updates"] = "Активировать Real-Time обновления";\r
+$a->strings["The new values have been saved."] = "";\r
+$a->strings["Post to Facebook"] = "Отправить на Facebook";\r
+$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "Отправка на Facebook отменена из-за конфликта разрешений доступа разных сетей.";\r
+$a->strings["View on Friendica"] = "";\r
+$a->strings["Facebook post failed. Queued for retry."] = "Ошибка отправки сообщения на Facebook. В очереди на еще одну попытку.";\r
+$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "";\r
+$a->strings["Facebook connection became invalid"] = "Facebook подключение не удалось";\r
+$a->strings["status"] = "статус";\r
diff --git a/facebook/lang/sv/strings.php b/facebook/lang/sv/strings.php
new file mode 100644 (file)
index 0000000..802e13e
--- /dev/null
@@ -0,0 +1,14 @@
+<?php\r
+\r
+$a->strings["Settings updated."] = "Inst&auml;llningarna har uppdaterats.";\r
+$a->strings["Permission denied."] = "&Aring;tkomst nekad.";\r
+$a->strings["Facebook disabled"] = "Facebook inaktiverat";\r
+$a->strings["Facebook API key is missing."] = "Facebook API key is missing.";\r
+$a->strings["Facebook Connect"] = "Facebook Connect";\r
+$a->strings["Post to Facebook by default"] = "L&auml;gg alltid in inl&auml;ggen p&aring; Facebook";\r
+$a->strings["Submit"] = "Spara";\r
+$a->strings["Administrator"] = "Admin";\r
+$a->strings["Facebook"] = "Facebook";\r
+$a->strings["Facebook Connector Settings"] = "Facebook Connector Settings";\r
+$a->strings["Post to Facebook"] = "L&auml;gg in p&aring; Facebook";\r
+$a->strings["status"] = "status";\r
diff --git a/facebook/lang/zh-cn/strings.php b/facebook/lang/zh-cn/strings.php
new file mode 100644 (file)
index 0000000..3aec41b
--- /dev/null
@@ -0,0 +1,49 @@
+<?php\r
+\r
+$a->strings["Settings updated."] = "设置跟新了";\r
+$a->strings["Permission denied."] = "权限不够。";\r
+$a->strings["Facebook disabled"] = "Facebook废";\r
+$a->strings["Updating contacts"] = "正才更新熟人";\r
+$a->strings["Facebook API key is missing."] = "Facebook API钥匙失踪的。";\r
+$a->strings["Facebook Connect"] = "Facebook联络";\r
+$a->strings["Install Facebook connector for this account."] = "安装Facebook连接器为这个账户。";\r
+$a->strings["Remove Facebook connector"] = "删除Facebook连接器";\r
+$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "复认证[这是必要的每当您Facebook密码变化了]";\r
+$a->strings["Post to Facebook by default"] = "默认地放在Facebook";\r
+$a->strings["Facebook friend linking has been disabled on this site. The following settings will have no effect."] = "这个网站使Facebook朋友环节不能用。这下的设置没有印象。";\r
+$a->strings["Facebook friend linking has been disabled on this site. If you disable it, you will be unable to re-enable it."] = "这个网站使Facebook朋友环节不能用。假如那样的话您不会再使可用的。";\r
+$a->strings["Link all your Facebook friends and conversations on this website"] = "连接您所有的Facebook朋友们和交流在这个网站";\r
+$a->strings["Facebook conversations consist of your <em>profile wall</em> and your friend <em>stream</em>."] = "Facebook交流由您的<em>简介墙</em>和您朋友的<em>溪流</em>组成。 ";\r
+$a->strings["On this website, your Facebook friend stream is only visible to you."] = "在这个网站,您Facebook朋友溪流是只您可见的。";\r
+$a->strings["The following settings determine the privacy of your Facebook profile wall on this website."] = "下面的设置决定您在这个网站Facebook简介墙的隐私。";\r
+$a->strings["On this website your Facebook profile wall conversations will only be visible to you"] = "在这个网站您Facebook简介墙交流是只您可见的。";\r
+$a->strings["Do not import your Facebook profile wall conversations"] = "别进口您Facebook简介墙交流";\r
+$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简介墙被在您这网站的简介墙融合和您的这网站隐私设置决定谁能看那些交流。";\r
+$a->strings["Comma separated applications to ignore"] = "逗号分开的应用要不理";\r
+$a->strings["Submit"] = "提交";\r
+$a->strings["Problems with Facebook Real-Time Updates"] = "Facebook实时更新有问题";\r
+$a->strings["Administrator"] = "管理员";\r
+$a->strings["Facebook"] = "Facebook";\r
+$a->strings["Facebook Connector Settings"] = "Facebook连接器设置";\r
+$a->strings["Facebook API Key"] = "Facebook API密码";\r
+$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>";\r
+$a->strings["Error: the given API Key seems to be incorrect (the application access token could not be retrieved)."] = "错误:输入的API密码显得不对(取回不了应用代金券)。";\r
+$a->strings["The given API Key seems to work correctly."] = "输入的API密码显得对地运行。";\r
+$a->strings["The correctness of the API Key could not be detected. Something strange's going on."] = "API钥匙的正确性发现不了。什么奇怪的进行";\r
+$a->strings["App-ID / API-Key"] = "App-ID / API-Key";\r
+$a->strings["Application secret"] = "应用密码";\r
+$a->strings["Synchronize comments (no comments on Facebook are missed, at the cost of increased system load)"] = "同步评论(无Facebook评论错过了,代价增添系统工作量)";\r
+$a->strings["Save"] = "保存";\r
+$a->strings["Real-Time Updates"] = "实时更新";\r
+$a->strings["Real-Time Updates are activated."] = "实时更新使活动";\r
+$a->strings["Deactivate Real-Time Updates"] = "使实时更新不活动";\r
+$a->strings["Real-Time Updates not activated."] = "实时更新使不活动";\r
+$a->strings["Activate Real-Time Updates"] = "使实时更新活动";\r
+$a->strings["The new values have been saved."] = "新的设置保存了。";\r
+$a->strings["Post to Facebook"] = "放在Facebook";\r
+$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "发送到Facebook取消由于多网络准许矛盾。";\r
+$a->strings["View on Friendica"] = "看在Friendica";\r
+$a->strings["Facebook post failed. Queued for retry."] = "Facebook发送失败了。排队着待再试。";\r
+$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "您Facebook联系成无效的。请再认证。";\r
+$a->strings["Facebook connection became invalid"] = "Facebook联系成无效的";\r
+$a->strings["status"] = "现状";\r
diff --git a/facebook_restrict/facebook_restrict.php b/facebook_restrict/facebook_restrict.php
new file mode 100644 (file)
index 0000000..c0720ed
--- /dev/null
@@ -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);
+}
+
diff --git a/facebook_restrict/lang/C/messages.po b/facebook_restrict/lang/C/messages.po
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/fbpost/README.md b/fbpost/README.md
new file mode 100644 (file)
index 0000000..3b1cd84
--- /dev/null
@@ -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.
+
diff --git a/fbpost/fbpost.css b/fbpost/fbpost.css
new file mode 100644 (file)
index 0000000..224d27b
--- /dev/null
@@ -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;
+}
\ No newline at end of file
diff --git a/fbpost/fbpost.php b/fbpost/fbpost.php
new file mode 100644 (file)
index 0000000..3e6e6e0
--- /dev/null
@@ -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;
+}
diff --git a/fbpost/lang/C/messages.po b/fbpost/lang/C/messages.po
new file mode 100644 (file)
index 0000000..578a673
--- /dev/null
@@ -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 ""
diff --git a/fbpost/lang/ca/strings.php b/fbpost/lang/ca/strings.php
new file mode 100644 (file)
index 0000000..1ad8afd
--- /dev/null
@@ -0,0 +1,32 @@
+<?php\r
+\r
+$a->strings["Settings updated."] = "Ajustos actualitzats.";\r
+$a->strings["Permission denied."] = "Permís denegat.";\r
+$a->strings["Facebook Post disabled"] = "";\r
+$a->strings["Facebook API key is missing."] = "La clau del API de Facebook s'ha perdut.";\r
+$a->strings["Facebook Post"] = "";\r
+$a->strings["Install Facebook Post connector for this account."] = "";\r
+$a->strings["Remove Facebook Post connector"] = "";\r
+$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.]";\r
+$a->strings["Post to Facebook by default"] = "Enviar a Facebook per defecte";\r
+$a->strings["Suppress \"View on friendica\""] = "";\r
+$a->strings["Mirror wall posts from facebook to friendica."] = "";\r
+$a->strings["Post to page/group:"] = "";\r
+$a->strings["None"] = "Cap";\r
+$a->strings["Submit"] = "Enviar";\r
+$a->strings["Facebook"] = "Facebook";\r
+$a->strings["Facebook Post Settings"] = "";\r
+$a->strings["Facebook API Key"] = "Facebook API Key";\r
+$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>";\r
+$a->strings["App-ID / API-Key"] = "App-ID / API-Key";\r
+$a->strings["Application secret"] = "Application secret";\r
+$a->strings["Save"] = "Guardar";\r
+$a->strings["The new values have been saved."] = "Els nous valors s'han guardat.";\r
+$a->strings["Post to Facebook"] = "Enviament a Facebook";\r
+$a->strings["%s:"] = "";\r
+$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.";\r
+$a->strings["View on Friendica"] = "Vist en Friendica";\r
+$a->strings["Facebook post failed. Queued for retry."] = "Enviament a Facebook fracassat. En cua per a reintent.";\r
+$a->strings["Administrator"] = "Administrador";\r
+$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";\r
+$a->strings["Facebook connection became invalid"] = "La seva connexió a Facebook es va convertir en no vàlida";\r
diff --git a/fbpost/lang/cs/strings.php b/fbpost/lang/cs/strings.php
new file mode 100644 (file)
index 0000000..2151e0a
--- /dev/null
@@ -0,0 +1,31 @@
+<?php\r
+\r
+$a->strings["Settings updated."] = "Nastavení aktualizováno.";\r
+$a->strings["Permission denied."] = "Přístup odmítnut.";\r
+$a->strings["Facebook Post disabled"] = "Příspěvky na Facebook zakázán.";\r
+$a->strings["Facebook API key is missing."] = "Chybí Facebook API klíč.";\r
+$a->strings["Facebook Post"] = "Facebook příspěvek";\r
+$a->strings["Install Facebook Post connector for this account."] = "Instalovat pro tento účet konektor pro příspěvky na Facebook.";\r
+$a->strings["Remove Facebook Post connector"] = "Odstranit konektor pro příspěvky na Facebook";\r
+$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.]";\r
+$a->strings["Post to Facebook by default"] = "Standardně posílat příspěvky na Facebook";\r
+$a->strings["Suppress \"View on friendica\""] = "Potlačit \"Zobrazit na friendica\"";\r
+$a->strings["Post to page/group:"] = "Příspěvek na stránku/skupinu";\r
+$a->strings["None"] = "Žádný";\r
+$a->strings["Submit"] = "Odeslat";\r
+$a->strings["Facebook"] = "Facebook";\r
+$a->strings["Facebook Post Settings"] = "Nastavení konektoru pro příspěvky na Facebook";\r
+$a->strings["Facebook API Key"] = "Facebook API Key";\r
+$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>";\r
+$a->strings["App-ID / API-Key"] = "App-ID / API-Key";\r
+$a->strings["Application secret"] = "Application secret";\r
+$a->strings["Save"] = "Uložit";\r
+$a->strings["The new values have been saved."] = "Nové hodnoty byly uloženy";\r
+$a->strings["Post to Facebook"] = "Přidat příspěvek na Facebook";\r
+$a->strings["%s:"] = "%s:";\r
+$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.";\r
+$a->strings["View on Friendica"] = "Zobrazení na Friendica";\r
+$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í.";\r
+$a->strings["Administrator"] = "Administrátor";\r
+$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.";\r
+$a->strings["Facebook connection became invalid"] = "Připojení na Facebook bylo zneplatněno.";\r
diff --git a/fbpost/lang/de/strings.php b/fbpost/lang/de/strings.php
new file mode 100644 (file)
index 0000000..6746ed2
--- /dev/null
@@ -0,0 +1,32 @@
+<?php\r
+\r
+$a->strings["Settings updated."] = "Einstellungen aktualisiert.";\r
+$a->strings["Permission denied."] = "Zugriff verweigert.";\r
+$a->strings["Facebook Post disabled"] = "Nach Facebook senden deaktiviert";\r
+$a->strings["Facebook API key is missing."] = "Facebook-API-Schlüssel nicht gefunden";\r
+$a->strings["Facebook Post"] = "Facebook Relai";\r
+$a->strings["Install Facebook Post connector for this account."] = "Facebook-Connector für dieses Konto installieren.";\r
+$a->strings["Remove Facebook Post connector"] = "Facebook-Connector entfernen";\r
+$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.]";\r
+$a->strings["Post to Facebook by default"] = "Veröffentliche standardmäßig bei Facebook";\r
+$a->strings["Suppress \"View on friendica\""] = "Unterdrücke \"Auf Friendica Ansehen\"";\r
+$a->strings["Mirror wall posts from facebook to friendica."] = "Spiegle Pinnwandeinträge von Facebook auf friendica";\r
+$a->strings["Post to page/group:"] = "Auf FB Seite/Gruppe veröffentlichen";\r
+$a->strings["None"] = "Keine";\r
+$a->strings["Submit"] = "Senden";\r
+$a->strings["Facebook"] = "Facebook";\r
+$a->strings["Facebook Post Settings"] = "Facebook-Beitragseinstellungen";\r
+$a->strings["Facebook API Key"] = "Facebook API Schlüssel";\r
+$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>";\r
+$a->strings["App-ID / API-Key"] = "App-ID / API-Key";\r
+$a->strings["Application secret"] = "Anwendungs-Geheimnis";\r
+$a->strings["Save"] = "Speichern";\r
+$a->strings["The new values have been saved."] = "Die neuen Einstellungen wurden gespeichert.";\r
+$a->strings["Post to Facebook"] = "Bei Facebook veröffentlichen";\r
+$a->strings["%s:"] = "%s:";\r
+$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.";\r
+$a->strings["View on Friendica"] = "In Friendica betrachten";\r
+$a->strings["Facebook post failed. Queued for retry."] = "Veröffentlichung bei Facebook gescheitert. Wir versuchen es später erneut.";\r
+$a->strings["Administrator"] = "Administrator";\r
+$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "Deine Facebook Anmeldedaten sind ungültig geworden. Bitte re-authentifiziere dich.";\r
+$a->strings["Facebook connection became invalid"] = "Facebook Anmeldedaten sind ungültig geworden";\r
diff --git a/fbpost/lang/eo/strings.php b/fbpost/lang/eo/strings.php
new file mode 100644 (file)
index 0000000..99c70e4
--- /dev/null
@@ -0,0 +1,28 @@
+<?php\r
+\r
+$a->strings["Settings updated."] = "Agordoj ĝisdatigita.";\r
+$a->strings["Permission denied."] = "Malpermesita.";\r
+$a->strings["Facebook Post disabled"] = "";\r
+$a->strings["Facebook API key is missing."] = "La API ŝlosilo de Facebook ne estas konata ĉi tie.";\r
+$a->strings["Facebook Post"] = "";\r
+$a->strings["Install Facebook Post connector for this account."] = "";\r
+$a->strings["Remove Facebook Post connector"] = "";\r
+$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.]";\r
+$a->strings["Post to Facebook by default"] = "Ĉiam afiŝi al Facebook.";\r
+$a->strings["None"] = "Nenio";\r
+$a->strings["Submit"] = "Sendi";\r
+$a->strings["Facebook"] = "Facebook";\r
+$a->strings["Facebook Post Settings"] = "";\r
+$a->strings["Facebook API Key"] = "Facebook API ŝlosilo";\r
+$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>";\r
+$a->strings["App-ID / API-Key"] = "Programo ID / API Ŝlosilo";\r
+$a->strings["Application secret"] = "Programo sekreto";\r
+$a->strings["Save"] = "Konservi";\r
+$a->strings["The new values have been saved."] = "Konservis novajn valorojn.";\r
+$a->strings["Post to Facebook"] = "Afiŝi al Facebook";\r
+$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "Afiŝado al Facebook nuligita ĉar okazis konflikto en la multretpermesoj.";\r
+$a->strings["View on Friendica"] = "Vidi ĉe Friendica";\r
+$a->strings["Facebook post failed. Queued for retry."] = "Malsukcesis afiŝi ĉe Facebook. Enigita en vico.";\r
+$a->strings["Administrator"] = "Administranto";\r
+$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "Via Facbook konekto iĝis nevalida. Bonvolu reaŭtentiĝi.";\r
+$a->strings["Facebook connection became invalid"] = "Facebook konekto iĝis nevalida.";\r
diff --git a/fbpost/lang/es/strings.php b/fbpost/lang/es/strings.php
new file mode 100644 (file)
index 0000000..e344648
--- /dev/null
@@ -0,0 +1,28 @@
+<?php\r
+\r
+$a->strings["Settings updated."] = "Configuración actualizada.";\r
+$a->strings["Permission denied."] = "Permiso denegado.";\r
+$a->strings["Facebook Post disabled"] = "Facebook deshabilitado";\r
+$a->strings["Facebook API key is missing."] = "Falta la clave API de Facebook.";\r
+$a->strings["Facebook Post"] = "Facebook";\r
+$a->strings["Install Facebook Post connector for this account."] = "Instalar el conector de Facebook para esta cuenta.";\r
+$a->strings["Remove Facebook Post connector"] = "Eliminar el conector de Facebook";\r
+$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.]";\r
+$a->strings["Post to Facebook by default"] = "Publicar en Facebook de forma predeterminada";\r
+$a->strings["None"] = "Ninguna";\r
+$a->strings["Submit"] = "Envíar";\r
+$a->strings["Facebook"] = "Facebook";\r
+$a->strings["Facebook Post Settings"] = "Configuración de conexión a Facebook";\r
+$a->strings["Facebook API Key"] = "Llave API de Facebook";\r
+$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>";\r
+$a->strings["App-ID / API-Key"] = "Añadir ID / Llave API";\r
+$a->strings["Application secret"] = "Secreto de la aplicación";\r
+$a->strings["Save"] = "Guardar";\r
+$a->strings["The new values have been saved."] = "Los nuevos valores se han guardado.";\r
+$a->strings["Post to Facebook"] = "Publicar en Facebook";\r
+$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.";\r
+$a->strings["View on Friendica"] = "Ver en Friendica";\r
+$a->strings["Facebook post failed. Queued for retry."] = "Publicación en Facebook errónea. Reintentando...";\r
+$a->strings["Administrator"] = "Administrador";\r
+$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "Tu conexión con Facebook ha sido invalidada. Por favor vuelve a identificarte.";\r
+$a->strings["Facebook connection became invalid"] = "La conexión con Facebook ha sido invalidada";\r
diff --git a/fbpost/lang/fr/strings.php b/fbpost/lang/fr/strings.php
new file mode 100644 (file)
index 0000000..3edd9fa
--- /dev/null
@@ -0,0 +1,28 @@
+<?php\r
+\r
+$a->strings["Settings updated."] = "Réglages mis à jour.";\r
+$a->strings["Permission denied."] = "Permission refusée.";\r
+$a->strings["Facebook Post disabled"] = "Publications Facebook désactivées";\r
+$a->strings["Facebook API key is missing."] = "Clé d'API Facebook manquante.";\r
+$a->strings["Facebook Post"] = "Publications Facebook";\r
+$a->strings["Install Facebook Post connector for this account."] = "Installer le connecteur Facebook pour ce compte.";\r
+$a->strings["Remove Facebook Post connector"] = "Retirer le connecteur Facebook";\r
+$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.]";\r
+$a->strings["Post to Facebook by default"] = "Poster sur Facebook par défaut";\r
+$a->strings["None"] = "Aucun(e)";\r
+$a->strings["Submit"] = "Envoyer";\r
+$a->strings["Facebook"] = "Facebook";\r
+$a->strings["Facebook Post Settings"] = "Réglages Facebook";\r
+$a->strings["Facebook API Key"] = "Clé d'API Facebook";\r
+$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 />";\r
+$a->strings["App-ID / API-Key"] = "App-ID / Clé d'API";\r
+$a->strings["Application secret"] = "Secret de l'application";\r
+$a->strings["Save"] = "Sauver";\r
+$a->strings["The new values have been saved."] = "Les nouvelles valeurs ont été sauvées.";\r
+$a->strings["Post to Facebook"] = "Poster sur Facebook";\r
+$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.";\r
+$a->strings["View on Friendica"] = "Voir sur Friendica";\r
+$a->strings["Facebook post failed. Queued for retry."] = "Publication sur Facebook échouée. En attente pour re-tentative.";\r
+$a->strings["Administrator"] = "Administrateur";\r
+$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "Votre connexion à Facebook est devenue invalide. Merci de vous ré-authentifier.";\r
+$a->strings["Facebook connection became invalid"] = "La connexion Facebook est devenue invalide";\r
diff --git a/fbpost/lang/is/strings.php b/fbpost/lang/is/strings.php
new file mode 100644 (file)
index 0000000..6e64cde
--- /dev/null
@@ -0,0 +1,28 @@
+<?php\r
+\r
+$a->strings["Settings updated."] = "Stillingar uppfærðar";\r
+$a->strings["Permission denied."] = "Heimild ekki veitt.";\r
+$a->strings["Facebook Post disabled"] = "";\r
+$a->strings["Facebook API key is missing."] = "Facebook API lykill er ekki til staðar.";\r
+$a->strings["Facebook Post"] = "";\r
+$a->strings["Install Facebook Post connector for this account."] = "";\r
+$a->strings["Remove Facebook Post connector"] = "";\r
+$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.]";\r
+$a->strings["Post to Facebook by default"] = "Senda sjálfgefið færslur á Facebook ";\r
+$a->strings["None"] = "Ekkert";\r
+$a->strings["Submit"] = "Senda inn";\r
+$a->strings["Facebook"] = "Facebook";\r
+$a->strings["Facebook Post Settings"] = "";\r
+$a->strings["Facebook API Key"] = "";\r
+$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>"] = "";\r
+$a->strings["App-ID / API-Key"] = "";\r
+$a->strings["Application secret"] = "";\r
+$a->strings["Save"] = "Vista";\r
+$a->strings["The new values have been saved."] = "";\r
+$a->strings["Post to Facebook"] = "Senda á Facebook";\r
+$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.";\r
+$a->strings["View on Friendica"] = "Skoða á Friendica";\r
+$a->strings["Facebook post failed. Queued for retry."] = "Færsla sem átti að flæða yfir á Facebook mistókst. Sett í biðröð til endurtekningar.";\r
+$a->strings["Administrator"] = "Kerfisstjóri";\r
+$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "";\r
+$a->strings["Facebook connection became invalid"] = "";\r
diff --git a/fbpost/lang/it/strings.php b/fbpost/lang/it/strings.php
new file mode 100644 (file)
index 0000000..a1aee90
--- /dev/null
@@ -0,0 +1,32 @@
+<?php\r
+\r
+$a->strings["Settings updated."] = "Impostazioni aggiornate.";\r
+$a->strings["Permission denied."] = "Permesso negato.";\r
+$a->strings["Facebook Post disabled"] = "";\r
+$a->strings["Facebook API key is missing."] = "Chiave API Facebook mancante.";\r
+$a->strings["Facebook Post"] = "";\r
+$a->strings["Install Facebook Post connector for this account."] = "";\r
+$a->strings["Remove Facebook Post connector"] = "";\r
+$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.]";\r
+$a->strings["Post to Facebook by default"] = "Invia sempre a Facebook";\r
+$a->strings["Suppress \"View on friendica\""] = "";\r
+$a->strings["Mirror wall posts from facebook to friendica."] = "";\r
+$a->strings["Post to page/group:"] = "";\r
+$a->strings["None"] = "Nessuna";\r
+$a->strings["Submit"] = "Invia";\r
+$a->strings["Facebook"] = "Facebook";\r
+$a->strings["Facebook Post Settings"] = "";\r
+$a->strings["Facebook API Key"] = "Facebook API Key";\r
+$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>";\r
+$a->strings["App-ID / API-Key"] = "App-ID / API-Key";\r
+$a->strings["Application secret"] = "Application secret";\r
+$a->strings["Save"] = "Salva";\r
+$a->strings["The new values have been saved."] = "I nuovi valori sono stati salvati.";\r
+$a->strings["Post to Facebook"] = "Invia a Facebook";\r
+$a->strings["%s:"] = "";\r
+$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "Invio su Facebook annullato per un conflitto nei permessi di accesso.";\r
+$a->strings["View on Friendica"] = "Vedi su Friendica";\r
+$a->strings["Facebook post failed. Queued for retry."] = "Invio a Facebook fallito. In attesa di riprovare.";\r
+$a->strings["Administrator"] = "Amministratore";\r
+$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "La tua connessione con Facebook è diventata invalida. Per favore ri-autenticati.";\r
+$a->strings["Facebook connection became invalid"] = "La connessione Facebook è diventata invalida.";\r
diff --git a/fbpost/lang/nb-no/strings.php b/fbpost/lang/nb-no/strings.php
new file mode 100644 (file)
index 0000000..e4cf15b
--- /dev/null
@@ -0,0 +1,28 @@
+<?php\r
+\r
+$a->strings["Settings updated."] = "Innstillinger oppdatert.";\r
+$a->strings["Permission denied."] = "Ingen tilgang.";\r
+$a->strings["Facebook Post disabled"] = "";\r
+$a->strings["Facebook API key is missing."] = "Facebook API-nøkkel mangler.";\r
+$a->strings["Facebook Post"] = "";\r
+$a->strings["Install Facebook Post connector for this account."] = "";\r
+$a->strings["Remove Facebook Post connector"] = "";\r
+$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "";\r
+$a->strings["Post to Facebook by default"] = "Post til Facebook som standard";\r
+$a->strings["None"] = "Ingen";\r
+$a->strings["Submit"] = "Lagre";\r
+$a->strings["Facebook"] = "Facebook";\r
+$a->strings["Facebook Post Settings"] = "";\r
+$a->strings["Facebook API Key"] = "";\r
+$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>"] = "";\r
+$a->strings["App-ID / API-Key"] = "";\r
+$a->strings["Application secret"] = "";\r
+$a->strings["Save"] = "Lagre";\r
+$a->strings["The new values have been saved."] = "";\r
+$a->strings["Post to Facebook"] = "Post til Facebook";\r
+$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.";\r
+$a->strings["View on Friendica"] = "";\r
+$a->strings["Facebook post failed. Queued for retry."] = "Facebook-innlegg mislyktes. Innlegget er lagt i kø for å prøve igjen.";\r
+$a->strings["Administrator"] = "Administrator";\r
+$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "";\r
+$a->strings["Facebook connection became invalid"] = "";\r
diff --git a/fbpost/lang/pl/strings.php b/fbpost/lang/pl/strings.php
new file mode 100644 (file)
index 0000000..6de34a4
--- /dev/null
@@ -0,0 +1,32 @@
+<?php\r
+\r
+$a->strings["Settings updated."] = "Zaktualizowano ustawienia.";\r
+$a->strings["Permission denied."] = "Brak uprawnień.";\r
+$a->strings["Facebook Post disabled"] = "";\r
+$a->strings["Facebook API key is missing."] = "Brakuje klucza API z facebooka.";\r
+$a->strings["Facebook Post"] = "Wpis z Facebooka";\r
+$a->strings["Install Facebook Post connector for this account."] = "";\r
+$a->strings["Remove Facebook Post connector"] = "";\r
+$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]";\r
+$a->strings["Post to Facebook by default"] = "Domyślnie opublikuj na stronie Facebook";\r
+$a->strings["Suppress \"View on friendica\""] = "";\r
+$a->strings["Mirror wall posts from facebook to friendica."] = "";\r
+$a->strings["Post to page/group:"] = "Napisz na stronę/grupę:";\r
+$a->strings["None"] = "Brak";\r
+$a->strings["Submit"] = "Potwierdź";\r
+$a->strings["Facebook"] = "Facebook";\r
+$a->strings["Facebook Post Settings"] = "Ustawienia wpisu z Facebooka";\r
+$a->strings["Facebook API Key"] = "Facebook API Key";\r
+$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>"] = "";\r
+$a->strings["App-ID / API-Key"] = "App-ID / API-Key";\r
+$a->strings["Application secret"] = "";\r
+$a->strings["Save"] = "Zapisz";\r
+$a->strings["The new values have been saved."] = "";\r
+$a->strings["Post to Facebook"] = "Post na Facebook";\r
+$a->strings["%s:"] = "";\r
+$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";\r
+$a->strings["View on Friendica"] = "Zobacz na Friendice";\r
+$a->strings["Facebook post failed. Queued for retry."] = "";\r
+$a->strings["Administrator"] = "Administrator";\r
+$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "";\r
+$a->strings["Facebook connection became invalid"] = "Błędne połączenie z Facebookiem";\r
diff --git a/fbpost/lang/pt-br/strings.php b/fbpost/lang/pt-br/strings.php
new file mode 100644 (file)
index 0000000..3662a83
--- /dev/null
@@ -0,0 +1,28 @@
+<?php\r
+\r
+$a->strings["Settings updated."] = "As configurações foram atualizadas.";\r
+$a->strings["Permission denied."] = "Permissão negada.";\r
+$a->strings["Facebook Post disabled"] = "A publicação no Facebook foi desabilitada";\r
+$a->strings["Facebook API key is missing."] = "A chave de API do Facebook não foi encontrada.";\r
+$a->strings["Facebook Post"] = "Publicação no Facebook";\r
+$a->strings["Install Facebook Post connector for this account."] = "Instalar o conector de publicação no Facebook para esta conta.";\r
+$a->strings["Remove Facebook Post connector"] = "Remover o conector de publicação no Facebook";\r
+$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "Reautenticar [Isso é necessário sempre que sua senha do Facebook é modificada.]";\r
+$a->strings["Post to Facebook by default"] = "Publicar no Facebook por padrão";\r
+$a->strings["None"] = "Nenhuma";\r
+$a->strings["Submit"] = "Enviar";\r
+$a->strings["Facebook"] = "Facebook";\r
+$a->strings["Facebook Post Settings"] = "Configurações de publicação no Facebook";\r
+$a->strings["Facebook API Key"] = "Chave da API do Facebook";\r
+$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>";\r
+$a->strings["App-ID / API-Key"] = "App-ID / API-Key";\r
+$a->strings["Application secret"] = "Segredo da aplicação";\r
+$a->strings["Save"] = "Salvar";\r
+$a->strings["The new values have been saved."] = "Os novos valores foram salvos.";\r
+$a->strings["Post to Facebook"] = "Publicar no Facebook";\r
+$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.";\r
+$a->strings["View on Friendica"] = "Ver no Friendica";\r
+$a->strings["Facebook post failed. Queued for retry."] = "Não foi possível publicar no Facebook. Armazenado na fila para nova tentativa.";\r
+$a->strings["Administrator"] = "Administrador";\r
+$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.";\r
+$a->strings["Facebook connection became invalid"] = "A conexão com o Facebook tornou-se inválida";\r
diff --git a/fbpost/lang/ru/strings.php b/fbpost/lang/ru/strings.php
new file mode 100644 (file)
index 0000000..3aa2f44
--- /dev/null
@@ -0,0 +1,28 @@
+<?php\r
+\r
+$a->strings["Settings updated."] = "Настройки обновлены.";\r
+$a->strings["Permission denied."] = "Нет разрешения.";\r
+$a->strings["Facebook Post disabled"] = "";\r
+$a->strings["Facebook API key is missing."] = "Отсутствует ключ Facebook API.";\r
+$a->strings["Facebook Post"] = "";\r
+$a->strings["Install Facebook Post connector for this account."] = "";\r
+$a->strings["Remove Facebook Post connector"] = "";\r
+$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "Переаутентификация [Это необходимо, если вы изменили пароль на Facebook.]";\r
+$a->strings["Post to Facebook by default"] = "Отправлять на Facebook по умолчанию";\r
+$a->strings["None"] = "Ничего";\r
+$a->strings["Submit"] = "Подтвердить";\r
+$a->strings["Facebook"] = "Facebook";\r
+$a->strings["Facebook Post Settings"] = "";\r
+$a->strings["Facebook API Key"] = "Facebook API Key";\r
+$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>"] = "";\r
+$a->strings["App-ID / API-Key"] = "App-ID / API-Key";\r
+$a->strings["Application secret"] = "Секрет приложения";\r
+$a->strings["Save"] = "Сохранить";\r
+$a->strings["The new values have been saved."] = "";\r
+$a->strings["Post to Facebook"] = "Отправить на Facebook";\r
+$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "Отправка на Facebook отменена из-за конфликта разрешений доступа разных сетей.";\r
+$a->strings["View on Friendica"] = "";\r
+$a->strings["Facebook post failed. Queued for retry."] = "Ошибка отправки сообщения на Facebook. В очереди на еще одну попытку.";\r
+$a->strings["Administrator"] = "Администратор";\r
+$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "";\r
+$a->strings["Facebook connection became invalid"] = "Facebook подключение не удалось";\r
diff --git a/fbpost/lang/sv/strings.php b/fbpost/lang/sv/strings.php
new file mode 100644 (file)
index 0000000..f305348
--- /dev/null
@@ -0,0 +1,10 @@
+<?php\r
+\r
+$a->strings["Settings updated."] = "Inst&auml;llningarna har uppdaterats.";\r
+$a->strings["Permission denied."] = "&Aring;tkomst nekad.";\r
+$a->strings["Facebook API key is missing."] = "Facebook API key is missing.";\r
+$a->strings["Post to Facebook by default"] = "L&auml;gg alltid in inl&auml;ggen p&aring; Facebook";\r
+$a->strings["Submit"] = "Spara";\r
+$a->strings["Facebook"] = "Facebook";\r
+$a->strings["Post to Facebook"] = "L&auml;gg in p&aring; Facebook";\r
+$a->strings["Administrator"] = "Admin";\r
diff --git a/fbpost/lang/zh-cn/strings.php b/fbpost/lang/zh-cn/strings.php
new file mode 100644 (file)
index 0000000..55e5a94
--- /dev/null
@@ -0,0 +1,32 @@
+<?php\r
+\r
+$a->strings["Settings updated."] = "设置跟新了";\r
+$a->strings["Permission denied."] = "权限不够。";\r
+$a->strings["Facebook Post disabled"] = "使Facebook文章不可用的";\r
+$a->strings["Facebook API key is missing."] = "Facebook API钥匙失踪的。";\r
+$a->strings["Facebook Post"] = "Facebook文章";\r
+$a->strings["Install Facebook Post connector for this account."] = "安装Facebook文章连接器为这个账户";\r
+$a->strings["Remove Facebook Post connector"] = "把Facebook文章连接器删除";\r
+$a->strings["Re-authenticate [This is necessary whenever your Facebook password is changed.]"] = "复认证[这是必要的每当您Facebook密码变化了]";\r
+$a->strings["Post to Facebook by default"] = "默认地放在Facebook";\r
+$a->strings["Suppress \"View on friendica\""] = "禁止「看在Friendica」";\r
+$a->strings["Mirror wall posts from facebook to friendica."] = "复制墙文章从facebook到friendica。";\r
+$a->strings["Post to page/group:"] = "放在页/组:";\r
+$a->strings["None"] = "没有";\r
+$a->strings["Submit"] = "提交";\r
+$a->strings["Facebook"] = "Facebook";\r
+$a->strings["Facebook Post Settings"] = "Facebook文章设置";\r
+$a->strings["Facebook API Key"] = "Facebook API密码";\r
+$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>";\r
+$a->strings["App-ID / API-Key"] = "App-ID / API-Key";\r
+$a->strings["Application secret"] = "应用密码";\r
+$a->strings["Save"] = "保存";\r
+$a->strings["The new values have been saved."] = "新的设置保存了。";\r
+$a->strings["Post to Facebook"] = "放在Facebook";\r
+$a->strings["%s:"] = "%s:";\r
+$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "发送到Facebook取消由于多网络准许矛盾。";\r
+$a->strings["View on Friendica"] = "看在Friendica";\r
+$a->strings["Facebook post failed. Queued for retry."] = "Facebook发送失败了。排队着待再试。";\r
+$a->strings["Administrator"] = "管理员";\r
+$a->strings["Your Facebook connection became invalid. Please Re-authenticate."] = "您Facebook联系成无效的。请再认证。";\r
+$a->strings["Facebook connection became invalid"] = "Facebook联系成无效的";\r
diff --git a/fbsync/README.md b/fbsync/README.md
new file mode 100644 (file)
index 0000000..c35d27b
--- /dev/null
@@ -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.
+
+
diff --git a/fbsync/fbsync.css b/fbsync/fbsync.css
new file mode 100644 (file)
index 0000000..9b577ab
--- /dev/null
@@ -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;
+}
diff --git a/fbsync/fbsync.php b/fbsync/fbsync.php
new file mode 100644 (file)
index 0000000..07f6dcf
--- /dev/null
@@ -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);
+}
+?>
diff --git a/fbsync/lang/C/messages.po b/fbsync/lang/C/messages.po
new file mode 100644 (file)
index 0000000..a333d3b
--- /dev/null
@@ -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 ""
index 3022776ce3ea72292cc7b5fd236a01387e0c2859..0acfa2302f076f46c789c5a691b394aeb8e9e413 100644 (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
index a72c45ba49026885993a9b388ccc0b5ddf94061a..751384a8ec0e92a12309deca860c531e3c56b055 100644 (file)
@@ -111,7 +111,7 @@ function forumdirectory_content(&$a)
                $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"
@@ -129,7 +129,7 @@ function forumdirectory_content(&$a)
 
                foreach ($r as $rr) {
                        $profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
-
+               
                        $pdesc = (($rr['pdesc']) ? $rr['pdesc'] . '<br />' : '');
 
                        $details = '';
diff --git a/forumlist/forumlist.css b/forumlist/forumlist.css
new file mode 100644 (file)
index 0000000..18c8e16
--- /dev/null
@@ -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;
+}
+
diff --git a/forumlist/forumlist.php b/forumlist/forumlist.php
new file mode 100644 (file)
index 0000000..63a8de8
--- /dev/null
@@ -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>';
+
+}
+
+
diff --git a/forumlist/lang/C/messages.po b/forumlist/lang/C/messages.po
new file mode 100644 (file)
index 0000000..d905484
--- /dev/null
@@ -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 ""
diff --git a/forumlist/lang/ca/strings.php b/forumlist/lang/ca/strings.php
new file mode 100644 (file)
index 0000000..67c7433
--- /dev/null
@@ -0,0 +1,12 @@
+<?php\r
+\r
+$a->strings["Forums"] = "Forums";\r
+$a->strings["show/hide"] = "mostra/amaga";\r
+$a->strings["No forum subscriptions"] = "No hi ha subscripcions al fòrum";\r
+$a->strings["Forums:"] = "Fòrums:";\r
+$a->strings["Forumlist settings updated."] = "Ajustos de Forumlist actualitzats.";\r
+$a->strings["Forumlist Settings"] = "Ajustos de Forumlist";\r
+$a->strings["Randomise forum list"] = "";\r
+$a->strings["Show forums on profile page"] = "";\r
+$a->strings["Show forums on network page"] = "";\r
+$a->strings["Submit"] = "Enviar";\r
diff --git a/forumlist/lang/cs/messages.po b/forumlist/lang/cs/messages.po
new file mode 100644 (file)
index 0000000..6ce8d14
--- /dev/null
@@ -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"
diff --git a/forumlist/lang/cs/strings.php b/forumlist/lang/cs/strings.php
new file mode 100644 (file)
index 0000000..ae22a86
--- /dev/null
@@ -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";
diff --git a/forumlist/lang/de/messages.po b/forumlist/lang/de/messages.po
new file mode 100644 (file)
index 0000000..99b1299
--- /dev/null
@@ -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"
diff --git a/forumlist/lang/de/strings.php b/forumlist/lang/de/strings.php
new file mode 100644 (file)
index 0000000..382b6fc
--- /dev/null
@@ -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";
diff --git a/forumlist/lang/eo/strings.php b/forumlist/lang/eo/strings.php
new file mode 100644 (file)
index 0000000..23f9a68
--- /dev/null
@@ -0,0 +1,9 @@
+<?php\r
+\r
+$a->strings["Forums"] = "Forumoj";\r
+$a->strings["show/hide"] = "";\r
+$a->strings["No forum subscriptions"] = "";\r
+$a->strings["Forums:"] = "Forumoj:";\r
+$a->strings["Forumlist settings updated."] = "";\r
+$a->strings["Forumlist Settings"] = "";\r
+$a->strings["Submit"] = "Sendi";\r
diff --git a/forumlist/lang/es/messages.po b/forumlist/lang/es/messages.po
new file mode 100644 (file)
index 0000000..5280a1c
--- /dev/null
@@ -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"
diff --git a/forumlist/lang/es/strings.php b/forumlist/lang/es/strings.php
new file mode 100644 (file)
index 0000000..6b7d13b
--- /dev/null
@@ -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";
diff --git a/forumlist/lang/fr/strings.php b/forumlist/lang/fr/strings.php
new file mode 100644 (file)
index 0000000..881bd2f
--- /dev/null
@@ -0,0 +1,12 @@
+<?php\r
+\r
+$a->strings["Forums"] = "Forums";\r
+$a->strings["show/hide"] = "Montrer/cacher";\r
+$a->strings["No forum subscriptions"] = "Pas d'abonnement au forum";\r
+$a->strings["Forums:"] = "Forums:";\r
+$a->strings["Forumlist settings updated."] = "Paramètres de la liste des forums mis à jour.";\r
+$a->strings["Forumlist Settings"] = "Paramètres de la liste des forums";\r
+$a->strings["Randomise forum list"] = "Mélanger la liste de forums";\r
+$a->strings["Show forums on profile page"] = "Montrer les forums sur le profil";\r
+$a->strings["Show forums on network page"] = "";\r
+$a->strings["Submit"] = "Envoyer";\r
diff --git a/forumlist/lang/is/strings.php b/forumlist/lang/is/strings.php
new file mode 100644 (file)
index 0000000..ce3f530
--- /dev/null
@@ -0,0 +1,9 @@
+<?php\r
+\r
+$a->strings["Forums"] = "";\r
+$a->strings["show/hide"] = "";\r
+$a->strings["No forum subscriptions"] = "";\r
+$a->strings["Forums:"] = "";\r
+$a->strings["Forumlist settings updated."] = "";\r
+$a->strings["Forumlist Settings"] = "";\r
+$a->strings["Submit"] = "Senda inn";\r
diff --git a/forumlist/lang/it/messages.po b/forumlist/lang/it/messages.po
new file mode 100644 (file)
index 0000000..4bc22e3
--- /dev/null
@@ -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"
diff --git a/forumlist/lang/it/strings.php b/forumlist/lang/it/strings.php
new file mode 100644 (file)
index 0000000..94b1427
--- /dev/null
@@ -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";
diff --git a/forumlist/lang/nb-no/strings.php b/forumlist/lang/nb-no/strings.php
new file mode 100644 (file)
index 0000000..494de1d
--- /dev/null
@@ -0,0 +1,12 @@
+<?php\r
+\r
+$a->strings["Forums"] = "";\r
+$a->strings["show/hide"] = "";\r
+$a->strings["No forum subscriptions"] = "";\r
+$a->strings["Forums:"] = "";\r
+$a->strings["Forumlist settings updated."] = "";\r
+$a->strings["Forumlist Settings"] = "";\r
+$a->strings["Randomise forum list"] = "";\r
+$a->strings["Show forums on profile page"] = "";\r
+$a->strings["Show forums on network page"] = "";\r
+$a->strings["Submit"] = "Lagre";\r
diff --git a/forumlist/lang/pl/strings.php b/forumlist/lang/pl/strings.php
new file mode 100644 (file)
index 0000000..2111b12
--- /dev/null
@@ -0,0 +1,12 @@
+<?php\r
+\r
+$a->strings["Forums"] = "Fora";\r
+$a->strings["show/hide"] = "pokaż/ukryj";\r
+$a->strings["No forum subscriptions"] = "";\r
+$a->strings["Forums:"] = "";\r
+$a->strings["Forumlist settings updated."] = "";\r
+$a->strings["Forumlist Settings"] = "";\r
+$a->strings["Randomise forum list"] = "";\r
+$a->strings["Show forums on profile page"] = "";\r
+$a->strings["Show forums on network page"] = "";\r
+$a->strings["Submit"] = "Potwierdź";\r
diff --git a/forumlist/lang/pt-br/strings.php b/forumlist/lang/pt-br/strings.php
new file mode 100644 (file)
index 0000000..67c07aa
--- /dev/null
@@ -0,0 +1,12 @@
+<?php\r
+\r
+$a->strings["Forums"] = "Fóruns";\r
+$a->strings["show/hide"] = "";\r
+$a->strings["No forum subscriptions"] = "";\r
+$a->strings["Forums:"] = "Fóruns:";\r
+$a->strings["Forumlist settings updated."] = "";\r
+$a->strings["Forumlist Settings"] = "";\r
+$a->strings["Randomise forum list"] = "";\r
+$a->strings["Show forums on profile page"] = "";\r
+$a->strings["Show forums on network page"] = "";\r
+$a->strings["Submit"] = "Enviar";\r
diff --git a/forumlist/lang/ro/messages.po b/forumlist/lang/ro/messages.po
new file mode 100644 (file)
index 0000000..2922244
--- /dev/null
@@ -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"
diff --git a/forumlist/lang/ro/strings.php b/forumlist/lang/ro/strings.php
new file mode 100644 (file)
index 0000000..903877c
--- /dev/null
@@ -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";
diff --git a/forumlist/lang/ru/messages.po b/forumlist/lang/ru/messages.po
new file mode 100644 (file)
index 0000000..ac3d285
--- /dev/null
@@ -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 "Добавить"
diff --git a/forumlist/lang/ru/strings.php b/forumlist/lang/ru/strings.php
new file mode 100644 (file)
index 0000000..85ec1d7
--- /dev/null
@@ -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"] = "Добавить";
diff --git a/forumlist/lang/sv/messages.po b/forumlist/lang/sv/messages.po
new file mode 100644 (file)
index 0000000..a16497d
--- /dev/null
@@ -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"
diff --git a/forumlist/lang/sv/strings.php b/forumlist/lang/sv/strings.php
new file mode 100644 (file)
index 0000000..f2fe884
--- /dev/null
@@ -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";
diff --git a/forumlist/lang/zh-cn/strings.php b/forumlist/lang/zh-cn/strings.php
new file mode 100644 (file)
index 0000000..39c74c0
--- /dev/null
@@ -0,0 +1,12 @@
+<?php\r
+\r
+$a->strings["Forums"] = "论坛";\r
+$a->strings["show/hide"] = "表示/隐藏";\r
+$a->strings["No forum subscriptions"] = "没有评坛订阅";\r
+$a->strings["Forums:"] = "评坛:";\r
+$a->strings["Forumlist settings updated."] = "评坛单设置更新了。";\r
+$a->strings["Forumlist Settings"] = "评坛单设置";\r
+$a->strings["Randomise forum list"] = "洗牌评坛单";\r
+$a->strings["Show forums on profile page"] = "表示评坛在简介页";\r
+$a->strings["Show forums on network page"] = "表示评坛在网络页";\r
+$a->strings["Submit"] = "提交";\r
index afdb087b37cf163da27dd5d1d84ce5bb012ed5c1..a3944d6dbaef43268d5b264dcdde644647a0593b 100644 (file)
@@ -82,29 +82,24 @@ function fromapp_settings(&$a, &$s)
        $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="fromapp-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
 }
 
-function fromapp_post_hook(&$a, &$item)
-{
-       if (! local_user()) {
-               return;
-       }
+function fromapp_post_hook(&$a,&$item) {
+   if(! local_user())
+        return;
 
-       if (local_user() != $item['uid']) {
-               return;
-       }
+    if(local_user() != $item['uid'])
+        return;
 
-       $app = PConfig::get(local_user(), 'fromapp', 'app');
-       $force = intval(PConfig::get(local_user(), 'fromapp', 'force'));
+    $app = get_pconfig(local_user(), 'fromapp', 'app');
+       $force = intval(get_pconfig(local_user(), 'fromapp','force'));
 
-       if (is_null($app) || (! strlen($app))) {
-               return;
-       }
+    if(($app === false) || (! strlen($app)))
+        return;
 
-       if (strlen(trim($item['app'])) && (! $force)) {
+       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;
+
 }
index b8d9511a52f48c7628dde6c8f33dec05f8b5d4f2..b2c9b97f6132afff40738753e440feeb00545bda 100644 (file)
@@ -47,9 +47,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">'. L10n::t('Google+ Mirror').'</h3>';
@@ -84,14 +84,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(L10n::t('Google+ Import Settings saved.') . EOL);
        }
@@ -115,9 +115,9 @@ function fromgplus_addon_admin_post(&$a)
 }
 
 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;
 
@@ -134,7 +134,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']);
@@ -144,7 +144,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) {
@@ -204,13 +204,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);
@@ -225,7 +225,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);
@@ -246,7 +246,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'] != "")
@@ -270,14 +270,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"];
@@ -310,7 +310,7 @@ 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);
 }
 
@@ -319,7 +319,7 @@ function fromgplus_handleattachments($a, $uid, $item, $displaytext, $shared) {
 
        $post = "";
        $quote = "";
-       $pagedata = [];
+       $pagedata = array();
        $pagedata["type"] = "";
 
        foreach ($item->object->attachments as $attachment) {
@@ -346,21 +346,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"] != "") {
@@ -371,9 +370,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))) {
@@ -439,8 +437,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 = Network::fetchUrl("https://www.googleapis.com/plus/v1/people/".$account."/activities/public?alt=json&pp=1&key=".$key."&maxResults=".$maxfetch);
        //$result = file_get_contents("google.txt");
@@ -448,7 +446,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 == "");
 
@@ -473,7 +471,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;
@@ -515,7 +513,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,
@@ -565,5 +563,5 @@ function fromgplus_fetch($a, $uid) {
                }
        }
        if ($lastdate != 0)
-               PConfig::set($uid,'fromgplus','lastdate', $lastdate);
+               set_pconfig($uid,'fromgplus','lastdate', $lastdate);
 }
index 89ccd88396441eabeb1c679f8d876ca11d5fee27..3c272c9b361370e3c895fa388e834eb3efcf763e 100644 (file)
@@ -24,16 +24,15 @@ function geocoordinates_uninstall()
        Addon::unregisterHook('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";
 
@@ -78,8 +77,7 @@ 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);
 }
 
index 79e268e6eeddb2d948953fa2b41d32e97636d6ca..905dfdc599f7de36b4b0a9ef21d102bb750459e5 100644 (file)
@@ -96,8 +96,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;
@@ -143,7 +143,7 @@ function geonames_post_hook($a, &$item) {
 function geonames_addon_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(L10n::t('Geonames settings updated.') . EOL);
 }
@@ -163,7 +163,7 @@ function geonames_addon_admin(&$a,&$s) {
        if(! local_user())
                return;
 
-       $geo_account = Config::get('geonames', 'username');
+       $geo_account = get_config('geonames', 'username');
 
        if(! $geo_account)
                return;
@@ -174,7 +174,7 @@ function geonames_addon_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" ' : '');
 
index c7678a2185e8dbc0e08308e633df7d553980f7f6..87d28063b591ac29589b61f8c73e99a0c8fc881c 100644 (file)
@@ -71,7 +71,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" ' : '' );
        
@@ -93,7 +93,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'] = L10n::t('[Friendica:Notify] Comment to conversation #%d', $b['parent']);
index e294c8e0e4e16a7155d6697a050df36f92d86e40..1a2a974f34aedce312560a598f33cf9c9ebce56b 100644 (file)
@@ -23,24 +23,20 @@ function googlemaps_uninstall()
        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>';
 }
diff --git a/gpluspost/.gitignore b/gpluspost/.gitignore
new file mode 100644 (file)
index 0000000..4e76a24
--- /dev/null
@@ -0,0 +1,2 @@
+postToGooglePlus.php
+nxs-http.php
diff --git a/gpluspost/gpluspost.css b/gpluspost/gpluspost.css
new file mode 100644 (file)
index 0000000..b86364b
--- /dev/null
@@ -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;
+}
diff --git a/gpluspost/gpluspost.php b/gpluspost/gpluspost.php
new file mode 100644 (file)
index 0000000..c8918e1
--- /dev/null
@@ -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";
+       }
+}
diff --git a/gpluspost/lang/C/messages.po b/gpluspost/lang/C/messages.po
new file mode 100644 (file)
index 0000000..117b72e
--- /dev/null
@@ -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 ""
diff --git a/gpluspost/lang/cs/messages.po b/gpluspost/lang/cs/messages.po
new file mode 100644 (file)
index 0000000..0b4af87
--- /dev/null
@@ -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í."
diff --git a/gpluspost/lang/cs/strings.php b/gpluspost/lang/cs/strings.php
new file mode 100644 (file)
index 0000000..9068b64
--- /dev/null
@@ -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í.";
diff --git a/gpluspost/lang/de/messages.po b/gpluspost/lang/de/messages.po
new file mode 100644 (file)
index 0000000..1d5a621
--- /dev/null
@@ -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."
diff --git a/gpluspost/lang/de/strings.php b/gpluspost/lang/de/strings.php
new file mode 100644 (file)
index 0000000..9379073
--- /dev/null
@@ -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.";
diff --git a/gpluspost/lang/es/messages.po b/gpluspost/lang/es/messages.po
new file mode 100644 (file)
index 0000000..c0e50a6
--- /dev/null
@@ -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."
diff --git a/gpluspost/lang/es/strings.php b/gpluspost/lang/es/strings.php
new file mode 100644 (file)
index 0000000..a9bbedf
--- /dev/null
@@ -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.";
diff --git a/gpluspost/lang/it/messages.po b/gpluspost/lang/it/messages.po
new file mode 100644 (file)
index 0000000..e6d636b
--- /dev/null
@@ -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."
diff --git a/gpluspost/lang/it/strings.php b/gpluspost/lang/it/strings.php
new file mode 100644 (file)
index 0000000..9021236
--- /dev/null
@@ -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.";
diff --git a/gpluspost/lang/pt-br/messages.po b/gpluspost/lang/pt-br/messages.po
new file mode 100644 (file)
index 0000000..52931f1
--- /dev/null
@@ -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."
diff --git a/gpluspost/lang/pt-br/strings.php b/gpluspost/lang/pt-br/strings.php
new file mode 100644 (file)
index 0000000..ac49ee4
--- /dev/null
@@ -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.";
diff --git a/gpluspost/lang/ro/messages.po b/gpluspost/lang/ro/messages.po
new file mode 100644 (file)
index 0000000..f6c0f0a
--- /dev/null
@@ -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."
diff --git a/gpluspost/lang/ro/strings.php b/gpluspost/lang/ro/strings.php
new file mode 100644 (file)
index 0000000..a7494f0
--- /dev/null
@@ -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.";
diff --git a/gpluspost/lang/ru/messages.po b/gpluspost/lang/ru/messages.po
new file mode 100644 (file)
index 0000000..595ad45
--- /dev/null
@@ -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+. В очереди на еще одну попытку."
diff --git a/gpluspost/lang/ru/strings.php b/gpluspost/lang/ru/strings.php
new file mode 100644 (file)
index 0000000..0e8fbd8
--- /dev/null
@@ -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+. В очереди на еще одну попытку.";
index a765a2e0762150bd760a26fdccb31c231ecc8cdf..88db743b751b461e9696b6d2430323be10439535 100644 (file)
@@ -34,8 +34,8 @@ function gravatar_uninstall() {
  * @param &$b array
  */
 function gravatar_lookup($a, &$b) {
-       $default_avatar = Config::get('gravatar', 'default_img');
-       $rating = Config::get('gravatar', 'rating');
+       $default_avatar = get_config('gravatar', 'default_img');
+       $rating = get_config('gravatar', 'rating');
 
        // setting default value if nothing configured
        if(! $default_avatar)
@@ -50,7 +50,7 @@ function gravatar_lookup($a, &$b) {
        if ($default_avatar != "gravatar")
                $url .= '&d=' .$default_avatar;
 
-       $b['url'] = $url;
+       $b['url'] = $url;       
        $b['success'] = true;
 }
 
@@ -60,8 +60,8 @@ function gravatar_lookup($a, &$b) {
 function gravatar_addon_admin (&$a, &$o) {
        $t = get_markup_template( "admin.tpl", "addon/gravatar/" );
 
-       $default_avatar = Config::get('gravatar', 'default_img');
-       $rating = Config::get('gravatar', 'rating');
+       $default_avatar = get_config('gravatar', 'default_img');
+       $rating = get_config('gravatar', 'rating');
 
        // set default values for first configuration
        if(! $default_avatar)
@@ -82,7 +82,7 @@ function gravatar_addon_admin (&$a, &$o) {
                'pg' => 'pg',
                'r' => 'r',
                'x' => 'x'
-       ];
+       );
 
        // Check if Libravatar is enabled and show warning
        $r = q("SELECT * FROM `addon` WHERE `name` = '%s' and `installed` = 1",
index 4c0cb14a9a3aeb211ae2626fbecedcb14323f9f9..d07d8aa56bcbb3f0517537cd30034acfc41c02db 100644 (file)
@@ -41,7 +41,7 @@ function group_text_uninstall() {
 function group_text_settings_post($a,$post) {
        if(! local_user() || (! x($_POST,'group_text-submit')))
                return;
-       PConfig::set(local_user(),'system','groupedit_image_limit',intval($_POST['group_text']));
+       set_pconfig(local_user(),'system','groupedit_image_limit',intval($_POST['group_text']));
 
        info(L10n::t('Group Text settings updated.') . EOL);
 }
@@ -67,7 +67,7 @@ function group_text_settings(&$a,&$s) {
 
        /* Get the current state of our config variable */
 
-       $enabled = PConfig::get(local_user(),'system','groupedit_image_limit');
+       $enabled = get_pconfig(local_user(),'system','groupedit_image_limit');
        $checked = (($enabled) ? ' checked="checked" ' : '');
 
        /* Add some HTML to the existing form */
index bdb2b6076234c2ab808179dcb1b2b687eb08eec1..70aff1bfb3c0a9468e94edfd0c14de3cde968363 100644 (file)
@@ -1,5 +1,4 @@
 <?php
-
 /**
  * Name: IFTTT Receiver
  * Description: Receives a post from https://ifttt.com/ and distributes it.
@@ -28,27 +27,22 @@ function ifttt_uninstall()
        Addon::unregisterHook('connector_settings_post', 'addon/ifttt/ifttt.php', 'ifttt_settings_post');
 }
 
-function ifttt_module()
-{
-
+function ifttt_module() {
 }
 
-function ifttt_content()
-{
-
+function ifttt_content(&$a) {
 }
 
-function ifttt_settings(App $a, &$s)
-{
-       if (!local_user()) {
-               return;
-       }
+function ifttt_settings(&$a,&$s) {
+
+        if(! local_user())
+                return;
 
-       $key = PConfig::get(local_user(), 'ifttt', 'key');
+        $key = get_pconfig(local_user(),'ifttt','key');
 
        if (!$key) {
-               $key = random_string(20);
-               PConfig::set(local_user(), 'ifttt', 'key', $key);
+               $key = substr(random_string(),0,20);
+               set_pconfig(local_user(),'ifttt','key', $key);
        }
 
        $s .= '<span id="settings_ifttt_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_ifttt_expanded\'); openClose(\'settings_ifttt_inflated\');">';
@@ -84,122 +78,109 @@ function ifttt_settings(App $a, &$s)
        $s .= '</div>';
 }
 
-function ifttt_settings_post()
-{
-       if (x($_POST, 'ifttt-submit') && isset($_POST['ifttt-rekey'])) {
-               PConfig::delete(local_user(), 'ifttt', 'key');
-       }
+function ifttt_settings_post(&$a,&$b) {
+
+        if(x($_POST,'ifttt-submit'))
+                if (isset($_POST['ifttt-rekey']))
+                        del_pconfig(local_user(), 'ifttt', 'key');
 }
 
-function ifttt_post(App $a)
-{
-       if ($a->argc != 2) {
+function ifttt_post(&$a) {
+       if ($a->argc != 2)
                return;
-       }
 
-       $nickname = $a->argv[1];
+       $user = $a->argv[1];
 
-       $user = dba::selectFirst('user', ['uid'], ['nickname' => $nickname]);
-       if (!DBM::is_result($user)) {
-               logger('User ' . $nickname . ' not found.', LOGGER_DEBUG);
+       $r = q("SELECT `uid` FROM `user` WHERE `nickname` = '%s' LIMIT 1", dbesc($user));
+       if (!$r) {
+               logger("User ".$user." not found.", LOGGER_DEBUG);
                return;
        }
 
-       $uid = $user['uid'];
+       $uid = $r[0]["uid"];
 
-       logger('Received a post for user ' . $uid . ' from ifttt ' . print_r($_REQUEST, true), LOGGER_DEBUG);
+       logger("Received a post for user ".$uid." from ifttt ".print_r($_REQUEST, true), LOGGER_DEBUG);
 
-       if (!isset($_REQUEST['key'])) {
-               logger('No key found.');
+       if (!isset($_REQUEST["key"])) {
+               logger("No key found.");
                return;
        }
 
-       $key = $_REQUEST['key'];
+       $key = $_REQUEST["key"];
 
        // Check the key
-       if ($key != PConfig::get($uid, 'ifttt', 'key')) {
-               logger('Invalid key for user ' . $uid, LOGGER_DEBUG);
+        if ($key != get_pconfig($uid,'ifttt','key')) {
+               logger("Invalid key for user ".$uid, LOGGER_DEBUG);
                return;
        }
 
-       $item = [];
+       $item = array();
 
-       if (isset($_REQUEST['type'])) {
-               $item['type'] = $_REQUEST['type'];
-       }
+       if (isset($_REQUEST["type"]))
+               $item["type"] = $_REQUEST["type"];
 
-       if (!in_array($item['type'], ['status', 'link', 'photo'])) {
-               logger('Unknown item type ' . $item['type'], LOGGER_DEBUG);
+       if (!in_array($item["type"], array("status", "link", "photo"))) {
+               logger("Unknown item type ".$item["type"], LOGGER_DEBUG);
                return;
        }
 
-       if (isset($_REQUEST['link'])) {
-               $item['link'] = trim($_REQUEST['link']);
-       }
-       if (isset($_REQUEST['image'])) {
-               $item['image'] = trim($_REQUEST['image']);
-       }
-       if (isset($_REQUEST['title'])) {
-               $item['title'] = trim($_REQUEST['title']);
-       }
-       if (isset($_REQUEST['msg'])) {
-               $item['msg'] = trim($_REQUEST['msg']);
-       }
-       if (isset($_REQUEST['description'])) {
-               $item['description'] = trim($_REQUEST['description']);
-       }
-       if (isset($_REQUEST['date'])) {
-               $item['date'] = date('c', strtotime($date = str_replace(' at ', ', ', $_REQUEST['date'])));
-       }
-       if (isset($_REQUEST['url'])) {
-               $item['url'] = trim($_REQUEST['url']);
-       }
-
-       if ((substr($item['msg'], 0, 3) == '<<<') && (substr($item['msg'], -3, 3) == '>>>')) {
-               $item['msg'] = substr($item['msg'], 3, -3);
-       }
+       if (isset($_REQUEST["link"]))
+               $item["link"] = trim($_REQUEST["link"]);
+       if (isset($_REQUEST["image"]))
+               $item["image"] = trim($_REQUEST["image"]);
+       if (isset($_REQUEST["title"]))
+               $item["title"] = trim($_REQUEST["title"]);
+       if (isset($_REQUEST["msg"]))
+               $item["msg"] = trim($_REQUEST["msg"]);
+       if (isset($_REQUEST["description"]))
+               $item["description"] = trim($_REQUEST["description"]);
+       if (isset($_REQUEST["date"]))
+               $item["date"] = date("c", strtotime($date = str_replace(" at ", ", ", $_REQUEST["date"])));
+       if (isset($_REQUEST["url"]))
+               $item["url"] = trim($_REQUEST["url"]);
+
+       if ((substr($item["msg"], 0, 3) == "<<<") && (substr($item["msg"], -3, 3) == ">>>"))
+               $item["msg"] = substr($item["msg"], 3, -3);
 
        ifttt_message($uid, $item);
 }
 
-function ifttt_message($uid, $item)
-{
+function ifttt_message($uid, $item) {
+
        $a = get_app();
 
-       $_SESSION['authenticated'] = true;
-       $_SESSION['uid'] = $uid;
+       $_SESSION["authenticated"] = true;
+       $_SESSION["uid"] = $uid;
 
        unset($_REQUEST);
-       $_REQUEST['type'] = 'wall';
-       $_REQUEST['api_source'] = true;
-       $_REQUEST['profile_uid'] = $uid;
-       $_REQUEST['source'] = 'IFTTT';
-       $_REQUEST['title'] = '';
-       $_REQUEST['body'] = $item['msg'];
-       //$_REQUEST['date'] = $item['date'];
-       //$_REQUEST['uri'] = $item['url'];
-
-       if (strstr($item['url'], 'facebook.com')) {
-               $hash = hash('ripemd128', item['url']);
-               $_REQUEST['extid'] = NETWORK_FACEBOOK;
-               $_REQUEST['message_id'] = item_new_uri($a->get_hostname(), $uid, NETWORK_FACEBOOK . ':' . $hash);
+       $_REQUEST["type"] = "wall";
+       $_REQUEST["api_source"] = true;
+       $_REQUEST["profile_uid"] = $uid;
+       $_REQUEST["source"] = "IFTTT";
+       $_REQUEST["title"] = "";
+       $_REQUEST["body"] = $item["msg"];
+       //$_REQUEST["date"] = $item["date"];
+       //$_REQUEST["uri"] = $item["url"];
+
+       if (strstr($item["url"], "facebook.com")) {
+               $hash = hash("ripemd128", item["url"]);
+               $_REQUEST["extid"] = NETWORK_FACEBOOK;
+               $_REQUEST['message_id'] = item_new_uri($a->get_hostname(), $uid, NETWORK_FACEBOOK.":".$hash);
        }
 
-       if ($item['type'] == 'link') {
-               $data = query_page_info($item['link']);
+       if ($item["type"] == "link") {
+               $data = query_page_info($item["link"]);
 
-               if (isset($item['title']) && (trim($item['title']) != '')) {
-                       $data['title'] = $item['title'];
-               }
+               if (isset($item["title"]) && (trim($item["title"]) != ""))
+                       $data["title"] = $item["title"];
 
-               if (isset($item['description']) && (trim($item['description']) != '')) {
-                       $data['text'] = $item['description'];
-               }
+               if (isset($item["description"]) && (trim($item["description"]) != ""))
+                       $data["text"] = $item["description"];
 
-               $_REQUEST['body'] .= add_page_info_data($data);
-       } elseif (($item['type'] == 'photo') && ($item['image'] != '')) {
-               $_REQUEST['body'] .= "\n\n[img]" . $item['image'] . "[/img]\n";
-       }
+               $_REQUEST["body"] .=  add_page_info_data($data);
+       } elseif (($item["type"] == "photo") && ($item["image"] != ""))
+               $_REQUEST["body"] .= "\n\n[img]".$item["image"]."[/img]\n";
 
+       //print_r($_REQUEST);
        item_post($a);
 }
diff --git a/ifttt/lang/C/messages.po b/ifttt/lang/C/messages.po
deleted file mode 100644 (file)
index 1ea670b..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-# ADDON ifttt
-# Copyright (C) 
-# This file is distributed under the same license as the Friendica ifttt addon package.
-# 
-#
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: \n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2017-11-27 09:30+0100\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"
-
-#: ifttt.php:53 ifttt.php:57
-msgid "IFTTT Mirror"
-msgstr ""
-
-#: ifttt.php:61
-msgid ""
-"Create an account at <a href=\"http://www.ifttt.com\">IFTTT</a>. Create "
-"three Facebook recipes that are connected with <a href=\"https://ifttt.com/"
-"maker\">Maker</a> (In the form \"if Facebook then Maker\") with the "
-"following parameters:"
-msgstr ""
-
-#: ifttt.php:68
-msgid "Body for \"new status message\""
-msgstr ""
-
-#: ifttt.php:70
-msgid "Body for \"new photo upload\""
-msgstr ""
-
-#: ifttt.php:72
-msgid "Body for \"new link post\""
-msgstr ""
-
-#: ifttt.php:77
-msgid "Generate new key"
-msgstr ""
-
-#: ifttt.php:81
-msgid "Save Settings"
-msgstr ""
diff --git a/ifttt/lang/de/messages.po b/ifttt/lang/de/messages.po
deleted file mode 100644 (file)
index 1cacfc9..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-# ADDON ifttt
-# Copyright (C)
-# This file is distributed under the same license as the Friendica ifttt addon package.
-# 
-# 
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: \n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2017-11-27 09:30+0100\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: Andreas H. <webmaster@a-zwenkau.de>, 2017\n"
-"Language-Team: German (https://www.transifex.com/Friendica/teams/12172/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"
-
-#: ifttt.php:53 ifttt.php:57
-msgid "IFTTT Mirror"
-msgstr "IFTTT Spiegel"
-
-#: ifttt.php:61
-msgid ""
-"Create an account at <a href=\"http://www.ifttt.com\">IFTTT</a>. Create "
-"three Facebook recipes that are connected with <a "
-"href=\"https://ifttt.com/maker\">Maker</a> (In the form \"if Facebook then "
-"Maker\") with the following parameters:"
-msgstr ""
-"Lege ein Konto bei <a href=\"http://www.ifttt.com\"> IFTTT an</a>. Gebe drei"
-" Facebook Empfänger ein, die mit <a href=\"https://ifttt.com/maker\">Maker "
-"</a> verbunden sind (in der Form \"wenn Facebook dann Maker\"), mit den "
-"folgenden Parametern:"
-
-#: ifttt.php:68
-msgid "Body for \"new status message\""
-msgstr "Body für \"Neue Status Meldung\""
-
-#: ifttt.php:70
-msgid "Body for \"new photo upload\""
-msgstr "Body für \"Neues Foto hochgeladen\""
-
-#: ifttt.php:72
-msgid "Body for \"new link post\""
-msgstr "Body für \"Neue Nachricht\""
-
-#: ifttt.php:77
-msgid "Generate new key"
-msgstr "Generiere neuen Schlüssel"
-
-#: ifttt.php:81
-msgid "Save Settings"
-msgstr "Speichere Einstellungen"
diff --git a/ifttt/lang/de/strings.php b/ifttt/lang/de/strings.php
deleted file mode 100644 (file)
index a16db4e..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-
-if(! function_exists("string_plural_select_de")) {
-function string_plural_select_de($n){
-       return ($n != 1);;
-}}
-;
-$a->strings["IFTTT Mirror"] = "IFTTT Spiegel";
-$a->strings["Create an account at <a href=\"http://www.ifttt.com\">IFTTT</a>. Create three Facebook recipes that are connected with <a href=\"https://ifttt.com/maker\">Maker</a> (In the form \"if Facebook then Maker\") with the following parameters:"] = "Lege ein Konto bei <a href=\"http://www.ifttt.com\"> IFTTT an</a>. Gebe drei Facebook Empfänger ein, die mit <a href=\"https://ifttt.com/maker\">Maker </a> verbunden sind (in der Form \"wenn Facebook dann Maker\"), mit den folgenden Parametern:";
-$a->strings["Body for \"new status message\""] = "Body für \"Neue Status Meldung\"";
-$a->strings["Body for \"new photo upload\""] = "Body für \"Neues Foto hochgeladen\"";
-$a->strings["Body for \"new link post\""] = "Body für \"Neue Nachricht\"";
-$a->strings["Generate new key"] = "Generiere neuen Schlüssel";
-$a->strings["Save Settings"] = "Speichere Einstellungen";
index 8d5290855f0e08496b9dc56e6f1ed18125862eed..091edec388c196007bf7cb7777ab6e6c2b7e4232 100644 (file)
@@ -37,9 +37,9 @@ function ijpost_jot_nets(&$a,&$b) {
     if(! local_user())
         return;
 
-    $ij_post = PConfig::get(local_user(),'ijpost','post');
+    $ij_post = get_pconfig(local_user(),'ijpost','post');
     if(intval($ij_post) == 1) {
-        $ij_defpost = PConfig::get(local_user(),'ijpost','post_by_default');
+        $ij_defpost = get_pconfig(local_user(),'ijpost','post_by_default');
         $selected = ((intval($ij_defpost) == 1) ? ' checked="checked" ' : '');
         $b .= '<div class="profile-jot-net"><input type="checkbox" name="ijpost_enable" ' . $selected . ' value="1" /> '
             . L10n::t('Post to Insanejournal') . '</div>';
@@ -58,16 +58,16 @@ function ijpost_settings(&$a,&$s) {
 
     /* Get the current state of our config variables */
 
-    $enabled = PConfig::get(local_user(),'ijpost','post');
+    $enabled = get_pconfig(local_user(),'ijpost','post');
 
     $checked = (($enabled) ? ' checked="checked" ' : '');
 
-    $def_enabled = PConfig::get(local_user(),'ijpost','post_by_default');
+    $def_enabled = get_pconfig(local_user(),'ijpost','post_by_default');
 
     $def_checked = (($def_enabled) ? ' checked="checked" ' : '');
 
-       $ij_username = PConfig::get(local_user(), 'ijpost', 'ij_username');
-       $ij_password = PConfig::get(local_user(), 'ijpost', 'ij_password');
+       $ij_username = get_pconfig(local_user(), 'ijpost', 'ij_username');
+       $ij_password = get_pconfig(local_user(), 'ijpost', 'ij_password');
 
 
     /* Add some HTML to the existing form */
@@ -110,10 +110,10 @@ function ijpost_settings_post(&$a,&$b) {
 
        if(x($_POST,'ijpost-submit')) {
 
-               PConfig::set(local_user(),'ijpost','post',intval($_POST['ijpost']));
-               PConfig::set(local_user(),'ijpost','post_by_default',intval($_POST['ij_bydefault']));
-               PConfig::set(local_user(),'ijpost','ij_username',trim($_POST['ij_username']));
-               PConfig::set(local_user(),'ijpost','ij_password',trim($_POST['ij_password']));
+               set_pconfig(local_user(),'ijpost','post',intval($_POST['ijpost']));
+               set_pconfig(local_user(),'ijpost','post_by_default',intval($_POST['ij_bydefault']));
+               set_pconfig(local_user(),'ijpost','ij_username',trim($_POST['ij_username']));
+               set_pconfig(local_user(),'ijpost','ij_password',trim($_POST['ij_password']));
 
        }
 
@@ -132,11 +132,11 @@ function ijpost_post_local(&$a,&$b) {
        if($b['private'] || $b['parent'])
                return;
 
-    $ij_post   = intval(PConfig::get(local_user(),'ijpost','post'));
+    $ij_post   = intval(get_pconfig(local_user(),'ijpost','post'));
 
        $ij_enable = (($ij_post && x($_REQUEST,'ijpost_enable')) ? intval($_REQUEST['ijpost_enable']) : 0);
 
-       if($_REQUEST['api_source'] && intval(PConfig::get(local_user(),'ijpost','post_by_default')))
+       if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'ijpost','post_by_default')))
                $ij_enable = 1;
 
     if(! $ij_enable)
@@ -161,7 +161,7 @@ function ijpost_send(&$a,&$b) {
     if($b['parent'] != $b['id'])
         return;
 
-       // insanejournal post in the LJ user's timezone.
+       // insanejournal post in the LJ user's timezone. 
        // Hopefully the person's Friendica account
        // will be set to the same thing.
 
@@ -171,10 +171,10 @@ function ijpost_send(&$a,&$b) {
                intval($b['uid'])
        );
        if($x && strlen($x[0]['timezone']))
-               $tz = $x[0]['timezone'];
+               $tz = $x[0]['timezone'];        
 
-       $ij_username = PConfig::get($b['uid'],'ijpost','ij_username');
-       $ij_password = PConfig::get($b['uid'],'ijpost','ij_password');
+       $ij_username = get_pconfig($b['uid'],'ijpost','ij_username');
+       $ij_password = get_pconfig($b['uid'],'ijpost','ij_password');
        $ij_blog = 'http://www.insanejournal.com/interface/xmlrpc';
 
        if($ij_username && $ij_password && $ij_blog) {
index 50458ee5e7bdb9699dc004388ebd926f33b8e372..e64e1cd2479ee7c35c8a1c6877f58acd02eaef04 100644 (file)
@@ -30,7 +30,7 @@ function impressum_module() {
 }
 function impressum_content() {
     $a = get_app();
-    goaway('friendica/');
+    goaway($a->get_baseurl().'/friendica/');
 }
 
 function obfuscate_email ($s) {
index 6aeacbe65ce4c90d59ef3f7b262eb09607461b2e..e8dd92f46f586dfb704e4755ce58479365403967 100644 (file)
@@ -33,8 +33,8 @@ function irc_addon_settings(&$a,&$s) {
 //     $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . $a->get_baseurl() . '/addon/irc/irc.css' . '" media="all" />' . "\r\n";
 
     /* setting popular channels, auto connect channels */
-       $sitechats = PConfig::get( local_user(), 'irc','sitechats'); /* popular channels */
-       $autochans = PConfig::get( local_user(), 'irc','autochans');  /* auto connect chans */
+       $sitechats = get_pconfig( local_user(), 'irc','sitechats'); /* popular channels */
+       $autochans = get_pconfig( local_user(), 'irc','autochans');  /* auto connect chans */
 
        $t = get_markup_template( "settings.tpl", "addon/irc/" );
        $s .= replace_macros($t, [
@@ -55,8 +55,8 @@ function irc_addon_settings_post(&$a,&$b) {
                return;
 
        if($_POST['irc-submit']) {
-               PConfig::set( local_user(), 'irc','autochans',trim($_POST['autochans']));
-               PConfig::set( local_user(), 'irc','sitechats',trim($_POST['sitechats']));
+               set_pconfig( local_user(), 'irc','autochans',trim($_POST['autochans']));
+               set_pconfig( local_user(), 'irc','sitechats',trim($_POST['sitechats']));
                /* upid pop-up thing */
                info(L10n::t('IRC settings saved.') . EOL);
        }
@@ -79,16 +79,16 @@ function irc_content(&$a) {
 
        /* set the list of popular channels */
        if (local_user()) {
-           $sitechats = PConfig::get( local_user(), 'irc', 'sitechats');
+           $sitechats = get_pconfig( local_user(), 'irc', 'sitechats');
            if (!$sitechats)
-               $sitechats = Config::get('irc', 'sitechats');
+               $sitechats = get_config('irc', 'sitechats');
        } else {
-           $sitechats = Config::get('irc','sitechats');
+           $sitechats = get_config('irc','sitechats');
        }
        if($sitechats)
                $chats = explode(',',$sitechats);
        else
-               $chats = ['friendica','chat','chatback','hottub','ircbar','dateroom','debian'];
+               $chats = array('friendica','chat','chatback','hottub','ircbar','dateroom','debian');
 
 
        $a->page['aside'] .= '<div class="widget"><h3>' . L10n::t('Popular Channels') . '</h3><ul>';
@@ -99,11 +99,11 @@ function irc_content(&$a) {
 
         /* setting the channel(s) to auto connect */
        if (local_user()) {
-           $autochans = PConfig::get(local_user(), 'irc', 'autochans');
+           $autochans = get_pconfig(local_user(), 'irc', 'autochans');
            if (!$autochans)
-               $autochans = Config::get('irc','autochans');
+               $autochans = get_config('irc','autochans');
        } else {
-           $autochans = Config::get('irc','autochans');
+           $autochans = get_config('irc','autochans');
        }
        if($autochans)
                $channels = $autochans;
@@ -118,7 +118,7 @@ function irc_content(&$a) {
 EOT;
 
 return $o;
-
+    
 }
 
 function irc_addon_admin_post (&$a) {
@@ -126,8 +126,8 @@ function irc_addon_admin_post (&$a) {
                return;
 
        if($_POST['irc-submit']) {
-               Config::set('irc','autochans',trim($_POST['autochans']));
-               Config::set('irc','sitechats',trim($_POST['sitechats']));
+               set_config('irc','autochans',trim($_POST['autochans']));
+               set_config('irc','sitechats',trim($_POST['sitechats']));
                /* stupid pop-up thing */
                info(L10n::t('IRC settings saved.') . EOL);
        }
diff --git a/jappixmini.tgz b/jappixmini.tgz
new file mode 100644 (file)
index 0000000..676f147
Binary files /dev/null and b/jappixmini.tgz differ
index 23f99f17ad211fabf1278ce96d2d857e57fed0ec..fb9034935dcdb0c3ef4751263417d3815ef0a0dd 100644 (file)
@@ -1,12 +1,13 @@
 <?php
 
 /**
- * Name: jappixmini
- * Description: Provides a Facebook-like chat using Jappix Mini
- * Version: 1.0.1
- * Author: leberwurscht <leberwurscht@hoegners.de>
- *
- */
+* Name: jappixmini
+* Description: Provides a Facebook-like chat using Jappix Mini
+* Version: 1.0.1
+* Author: leberwurscht <leberwurscht@hoegners.de>
+*
+*/
+
 //
 // Copyright 2012 "Leberwurscht" <leberwurscht@hoegners.de>
 //
 
 /*
 
-  Problem:
- * jabber password should not be stored on server
- * jabber password should not be sent between server and browser as soon as the user is logged in
- * jabber password should not be reconstructible from communication between server and browser as soon as the user is logged in
+Problem:
+* jabber password should not be stored on server
+* jabber password should not be sent between server and browser as soon as the user is logged in
+* jabber password should not be reconstructible from communication between server and browser as soon as the user is logged in
 
-  Solution:
-  Only store an encrypted version of the jabber password on the server. The encryption key is only available to the browser
-  and not to the server (at least as soon as the user is logged in). It can be stored using the jappix setDB function.
+Solution:
+Only store an encrypted version of the jabber password on the server. The encryption key is only available to the browser
+and not to the server (at least as soon as the user is logged in). It can be stored using the jappix setDB function.
 
-  This encryption key could be the friendica password, but then this password would be stored in the browser in cleartext.
-  It is better to use a hash of the password.
-  The server should not be able to reconstruct the password, so we can't take the same hash the server stores. But we can
 use hash("some_prefix"+password). This will however not work with OpenID logins, for this type of login the password must
-  be queried manually.
+This encryption key could be the friendica password, but then this password would be stored in the browser in cleartext.
+It is better to use a hash of the password.
+The server should not be able to reconstruct the password, so we can't take the same hash the server stores. But we can
+ use hash("some_prefix"+password). This will however not work with OpenID logins, for this type of login the password must
+be queried manually.
 
-  Problem:
-  How to discover the jabber addresses of the friendica contacts?
+Problem:
+How to discover the jabber addresses of the friendica contacts?
 
-  Solution:
-  Each Friendica site with this addon provides a /jappixmini/ module page. We go through our contacts and retrieve
-  this information every week using a cron hook.
+Solution:
+Each Friendica site with this addon provides a /jappixmini/ module page. We go through our contacts and retrieve
+this information every week using a cron hook.
 
-  Problem:
-  We do not want to make the jabber address public.
+Problem:
+We do not want to make the jabber address public.
 
-  Solution:
-  When two friendica users connect using DFRN, the relation gets a DFRN ID and a keypair is generated.
-  Using this keypair, we can provide the jabber address only to contacts:
+Solution:
+When two friendica users connect using DFRN, the relation gets a DFRN ID and a keypair is generated.
+Using this keypair, we can provide the jabber address only to contacts:
 
-  Alice:
+Alice:
   signed_address = openssl_*_encrypt(alice_jabber_address)
-  send signed_address to Bob, who does
+send signed_address to Bob, who does
   trusted_address = openssl_*_decrypt(signed_address)
   save trusted_address
   encrypted_address = openssl_*_encrypt(bob_jabber_address)
-  reply with encrypted_address to Alice, who does
+reply with encrypted_address to Alice, who does
   decrypted_address = openssl_*_decrypt(encrypted_address)
   save decrypted_address
 
-  Interface for this:
-  GET /jappixmini/?role=%s&signed_address=%s&dfrn_id=%s
-
-  Response:
-  json({"status":"ok", "encrypted_address":"%s"})
+Interface for this:
+GET /jappixmini/?role=%s&signed_address=%s&dfrn_id=%s
 
- */
+Response:
+json({"status":"ok", "encrypted_address":"%s"})
 
 use Friendica\App;
 use Friendica\Core\Addon;
@@ -83,25 +82,21 @@ function jappixmini_install()
        // Jappix source download as required by AGPL
        Addon::registerHook('about_hook', 'addon/jappixmini/jappixmini.php', 'jappixmini_download_source');
 
-       // set standard configuration
-       $info_text = Config::get("jappixmini", "infotext");
-       if (!$info_text)
-               set_confConfig::setig("jappixmini", "infotext", "To get the chat working, you need to know a BOSH host which works with your Jabber account. " .
-                       "An example of a BOSH server that works for all accounts is https://bind.jappix.com/, but keep " .
-                       "in mind that the BOSH server can read along all chat messages. If you know that your Jabber " .
-                       "server also provides an own BOSH server, it is much better to use this one!"
-               );
-
-       $bosh_proxy = Config::get("jappixmini", "bosh_proxy");
-       if ($bosh_proxy === "") {
-               Config::set("jappixmini", "bosh_proxy", "1");
-       }
-
-       // set addon version so that safe updates are possible later
-       $addon_version = Config::get("jappixmini", "version");
-       if ($addon_version === "") {
-               Config::set("jappixmini", "version", "1");
-       }
+// set standard configuration
+$info_text = get_config("jappixmini", "infotext");
+if (!$info_text) set_config("jappixmini", "infotext",
+       "To get the chat working, you need to know a BOSH host which works with your Jabber account. ".
+       "An example of a BOSH server that works for all accounts is https://bind.jappix.com/, but keep ".
+       "in mind that the BOSH server can read along all chat messages. If you know that your Jabber ".
+       "server also provides an own BOSH server, it is much better to use this one!"
+);
+
+$bosh_proxy = get_config("jappixmini", "bosh_proxy");
+if ($bosh_proxy==="") set_config("jappixmini", "bosh_proxy", "1");
+
+// set addon version so that safe updates are possible later
+$addon_version = get_config("jappixmini", "version");
+if ($addon_version==="") set_config("jappixmini", "version", "1");
 }
 
 function jappixmini_uninstall()
@@ -120,42 +115,41 @@ function jappixmini_uninstall()
 function jappixmini_addon_admin(App $a, &$o)
 {
        // display instructions and warnings on addon settings page for admin
+
        if (!file_exists("addon/jappixmini.tgz")) {
                $o .= '<p><strong style="color:#fff;background-color:#f00">The source archive jappixmini.tgz does not exist. This is probably a violation of the Jappix License (AGPL).</strong></p>';
        }
 
        // warn if cron job has not yet been executed
-       $cron_run = Config::get("jappixmini", "last_cron_execution");
-       if (!$cron_run) {
-               $o .= "<p><strong>Warning: The cron job has not yet been executed. If this message is still there after some time (usually 10 minutes), this means that autosubscribe and autoaccept will not work.</strong></p>";
-       }
+       $cron_run = get_config("jappixmini", "last_cron_execution");
+       if (!$cron_run) $o .= "<p><strong>Warning: The cron job has not yet been executed. If this message is still there after some time (usually 10 minutes), this means that autosubscribe and autoaccept will not work.</strong></p>";
 
        // bosh proxy
-       $bosh_proxy = intval(Config::get("jappixmini", "bosh_proxy"));
+       $bosh_proxy = intval(get_config("jappixmini", "bosh_proxy"));
        $bosh_proxy = intval($bosh_proxy) ? ' checked="checked"' : '';
        $o .= '<label for="jappixmini-proxy">Activate BOSH proxy</label>';
-       $o .= ' <input id="jappixmini-proxy" type="checkbox" name="jappixmini-proxy" value="1"' . $bosh_proxy . ' /><br />';
+       $o .= ' <input id="jappixmini-proxy" type="checkbox" name="jappixmini-proxy" value="1"'.$bosh_proxy.' /><br />';
 
        // bosh address
-       $bosh_address = Config::get("jappixmini", "bosh_address");
+       $bosh_address = get_config("jappixmini", "bosh_address");
        $o .= '<p><label for="jappixmini-address">Adress of the default BOSH proxy. If enabled it overrides the user settings:</label><br />';
-       $o .= '<input id="jappixmini-address" type="text" name="jappixmini-address" value="' . $bosh_address . '" /></p>';
+        $o .= '<input id="jappixmini-address" type="text" name="jappixmini-address" value="'.$bosh_address.'" /></p>';
 
        // default server address
-       $default_server = Config::get("jappixmini", "default_server");
+       $default_server = get_config("jappixmini", "default_server");
        $o .= '<p><label for="jappixmini-server">Adress of the default jabber server:</label><br />';
-       $o .= '<input id="jappixmini-server" type="text" name="jappixmini-server" value="' . $default_server . '" /></p>';
+        $o .= '<input id="jappixmini-server" type="text" name="jappixmini-server" value="'.$default_server.'" /></p>';
 
        // default user name to friendica nickname
-       $default_user = intval(Config::get("jappixmini", "default_user"));
+       $default_user = intval(get_config("jappixmini", "default_user"));
        $default_user = intval($default_user) ? ' checked="checked"' : '';
        $o .= '<label for="jappixmini-user">Set the default username to the nickname:</label>';
-       $o .= ' <input id="jappixmini-user" type="checkbox" name="jappixmini-defaultuser" value="1"' . $default_user . ' /><br />';
+       $o .= ' <input id="jappixmini-user" type="checkbox" name="jappixmini-defaultuser" value="1"'.$default_user.' /><br />';
 
        // info text field
-       $info_text = Config::get("jappixmini", "infotext");
+       $info_text = get_config("jappixmini", "infotext");
        $o .= '<p><label for="jappixmini-infotext">Info text to help users with configuration (important if you want to provide your own BOSH host!):</label><br />';
-       $o .= '<textarea id="jappixmini-infotext" name="jappixmini-infotext" rows="5" cols="50">' . htmlentities($info_text) . '</textarea></p>';
+       $o .= '<textarea id="jappixmini-infotext" name="jappixmini-infotext" rows="5" cols="50">'.htmlentities($info_text).'</textarea></p>';
 
        // submit button
        $o .= '<input type="submit" name="jappixmini-admin-settings" value="OK" />';
@@ -171,43 +165,37 @@ function jappixmini_addon_admin_post(App $a)
                $default_user = intval($_REQUEST['jappixmini-defaultuser']);
                $bosh_address = $_REQUEST['jappixmini-address'];
                $default_server = $_REQUEST['jappixmini-server'];
-               Config::set("jappixmini", "infotext", $info_text);
-               Config::set("jappixmini", "bosh_proxy", $bosh_proxy);
-               Config::set("jappixmini", "bosh_address", $bosh_address);
-               Config::set("jappixmini", "default_server", $default_server);
-               Config::set("jappixmini", "default_user", $default_user);
+               set_config("jappixmini", "infotext", $info_text);
+               set_config("jappixmini", "bosh_proxy", $bosh_proxy);
+               set_config("jappixmini", "bosh_address", $bosh_address);
+               set_config("jappixmini", "default_server", $default_server);
+               set_config("jappixmini", "default_user", $default_user);
        }
 }
 
-function jappixmini_module()
-{
-
-}
-
-function jappixmini_init()
-{
+function jappixmini_module() {}
+function jappixmini_init(&$a) {
        // module page where other Friendica sites can submit Jabber addresses to and also can query Jabber addresses
-       // of local users
+        // of local users
+
        $dfrn_id = $_REQUEST["dfrn_id"];
-       if (!$dfrn_id) {
-               killme();
-       }
+       if (!$dfrn_id) killme();
 
        $role = $_REQUEST["role"];
-       if ($role == "pub") {
-               $r = q("SELECT * FROM `contact` WHERE LENGTH(`pubkey`) AND `dfrn-id`='%s' LIMIT 1", dbesc($dfrn_id));
-               if (!count($r)) {
-                       killme();
-               }
+       if ($role=="pub") {
+               $r = q("SELECT * FROM `contact` WHERE LENGTH(`pubkey`) AND `dfrn-id`='%s' LIMIT 1",
+                       dbesc($dfrn_id)
+               );
+               if (!count($r)) killme();
 
                $encrypt_func = openssl_public_encrypt;
                $decrypt_func = openssl_public_decrypt;
                $key = $r[0]["pubkey"];
-       } else if ($role == "prv") {
-               $r = q("SELECT * FROM `contact` WHERE LENGTH(`prvkey`) AND `issued-id`='%s' LIMIT 1", dbesc($dfrn_id));
-               if (!count($r)) {
-                       killme();
-               }
+       } else if ($role=="prv") {
+               $r = q("SELECT * FROM `contact` WHERE LENGTH(`prvkey`) AND `issued-id`='%s' LIMIT 1",
+                       dbesc($dfrn_id)
+               );
+               if (!count($r)) killme();
 
                $encrypt_func = openssl_private_encrypt;
                $decrypt_func = openssl_private_decrypt;
@@ -227,9 +215,8 @@ function jappixmini_init()
                $decrypt_func($signed_address, $trusted_address, $key);
 
                $now = intval(time());
-               PConfig::set($uid, "jappixmini", "id:$dfrn_id", "$now:$trusted_address");
+               set_pconfig($uid, "jappixmini", "id:$dfrn_id", "$now:$trusted_address");
        } catch (Exception $e) {
-
        }
 
        // do not return an address if user deactivated addon
@@ -240,8 +227,8 @@ function jappixmini_init()
 
        // return the requested Jabber address
        try {
-               $username = PConfig::get($uid, 'jappixmini', 'username');
-               $server = PConfig::get($uid, 'jappixmini', 'server');
+               $username = get_pconfig($uid, 'jappixmini', 'username');
+               $server = get_pconfig($uid, 'jappixmini', 'server');
                $address = "$username@$server";
 
                $encrypted_address = "";
@@ -249,10 +236,10 @@ function jappixmini_init()
 
                $encrypted_address_hex = bin2hex($encrypted_address);
 
-               $answer = [
-                       "status" => "ok",
-                       "encrypted_address" => $encrypted_address_hex
-               ];
+               $answer = Array(
+                       "status"=>"ok",
+                       "encrypted_address"=>$encrypted_address_hex
+               );
 
                $answer_json = json_encode($answer);
                echo $answer_json;
@@ -419,20 +406,22 @@ function jappixmini_settings(App $a, &$s)
     </script>";
 }
 
-function jappixmini_settings_post(App $a, &$b)
-{
+function jappixmini_settings_post(&$a,&$b) {
        // save addon settings for a user
-       if (!local_user()) {
-               return;
-       }
+
+       if(! local_user()) return;
        $uid = local_user();
 
-       if ($_POST['jappixmini-submit']) {
+       if($_POST['jappixmini-submit']) {
                $encrypt = intval($b['jappixmini-encrypt']);
                if ($encrypt) {
                        // check that Jabber password was encrypted with correct Friendica password
                        $friendica_password = trim($b['jappixmini-friendica-password']);
-                       if (!User::authenticate((int) $uid, $friendica_password)) {
+                       $encrypted = hash('whirlpool',$friendica_password);
+                       $r = q("SELECT * FROM `user` WHERE `uid`=$uid AND `password`='%s'",
+                               dbesc($encrypted)
+                       );
+                       if (!count($r)) {
                                info("Wrong friendica password!");
                                return;
                        }
@@ -441,152 +430,142 @@ function jappixmini_settings_post(App $a, &$b)
                $purge = intval($b['jappixmini-purge']);
 
                $username = trim($b['jappixmini-username']);
-               $old_username = PConfig::get($uid, 'jappixmini', 'username');
-               if ($username != $old_username) {
-                       $purge = 1;
-               }
+               $old_username = get_pconfig($uid,'jappixmini','username');
+               if ($username!=$old_username) $purge = 1;
 
                $server = trim($b['jappixmini-server']);
-               $old_server = PConfig::get($uid, 'jappixmini', 'server');
-               if ($server != $old_server) {
-                       $purge = 1;
-               }
-
-               PConfig::set($uid, 'jappixmini', 'username'      , $username);
-               PConfig::set($uid, 'jappixmini', 'server'        , $server);
-               PConfig::set($uid, 'jappixmini', 'bosh'          , trim($b['jappixmini-bosh']));
-               PConfig::set($uid, 'jappixmini', 'password'      , trim($b['jappixmini-encrypted-password']));
-               PConfig::set($uid, 'jappixmini', 'autosubscribe' , intval($b['jappixmini-autosubscribe']));
-               PConfig::set($uid, 'jappixmini', 'autoapprove'   , intval($b['jappixmini-autoapprove']));
-               PConfig::set($uid, 'jappixmini', 'activate'      , intval($b['jappixmini-activate']));
-               PConfig::set($uid, 'jappixmini', 'dontinsertchat', intval($b['jappixmini-dont-insertchat']));
-               PConfig::set($uid, 'jappixmini', 'encrypt'       , $encrypt);
-               info('Jappix Mini settings saved.');
+               $old_server = get_pconfig($uid,'jappixmini','server');
+               if ($server!=$old_server) $purge = 1;
+
+               set_pconfig($uid,'jappixmini','username',$username);
+               set_pconfig($uid,'jappixmini','server',$server);
+               set_pconfig($uid,'jappixmini','bosh',trim($b['jappixmini-bosh']));
+               set_pconfig($uid,'jappixmini','password',trim($b['jappixmini-encrypted-password']));
+               set_pconfig($uid,'jappixmini','autosubscribe',intval($b['jappixmini-autosubscribe']));
+               set_pconfig($uid,'jappixmini','autoapprove',intval($b['jappixmini-autoapprove']));
+               set_pconfig($uid,'jappixmini','activate',intval($b['jappixmini-activate']));
+               set_pconfig($uid,'jappixmini','dontinsertchat',intval($b['jappixmini-dont-insertchat']));
+               set_pconfig($uid,'jappixmini','encrypt',$encrypt);
+               info( 'Jappix Mini settings saved.' );
 
                if ($purge) {
                        q("DELETE FROM `pconfig` WHERE `uid`=$uid AND `cat`='jappixmini' AND `k` LIKE 'id:%%'");
-                       info('List of addresses purged.');
+                       info( 'List of addresses purged.' );
                }
        }
 }
 
-function jappixmini_script(App $a)
-{
-       // adds the script to the page header which starts Jappix Mini
-       if (!local_user()) {
-               return;
-       }
+function jappixmini_script(&$a,&$s) {
+    // adds the script to the page header which starts Jappix Mini
 
-       if ($_GET["mode"] == "minimal") {
-               return;
-       }
+    if(! local_user()) return;
 
-       $activate = PConfig::get(local_user(), 'jappixmini', 'activate');
-       $dontinsertchat = PConfig::get(local_user(), 'jappixmini', 'dontinsertchat');
-       if (!$activate || $dontinsertchat) {
-               return;
-       }
-
-       $a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/jappixmini/jappix/php/get.php?t=js&amp;g=mini.xml"></script>' . "\r\n";
-       $a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/jappixmini/jappix/php/get.php?t=js&amp;f=presence.js~caps.js~name.js~roster.js"></script>' . "\r\n";
-
-       $a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/jappixmini/lib.js"></script>' . "\r\n";
-
-       $username = PConfig::get(local_user(), 'jappixmini', 'username');
-       $username = str_replace("'", "\\'", $username);
-       $server = PConfig::get(local_user(), 'jappixmini', 'server');
-       $server = str_replace("'", "\\'", $server);
-       $bosh = PConfig::get(local_user(), 'jappixmini', 'bosh');
-       $bosh = str_replace("'", "\\'", $bosh);
-       $encrypt = PConfig::get(local_user(), 'jappixmini', 'encrypt');
-       $encrypt = intval($encrypt);
-       $password = PConfig::get(local_user(), 'jappixmini', 'password');
-       $password = str_replace("'", "\\'", $password);
-
-       $autoapprove = PConfig::get(local_user(), 'jappixmini', 'autoapprove');
-       $autoapprove = intval($autoapprove);
-       $autosubscribe = PConfig::get(local_user(), 'jappixmini', 'autosubscribe');
-       $autosubscribe = intval($autosubscribe);
-
-       // set proxy if necessary
-       $use_proxy = Config::get('jappixmini', 'bosh_proxy');
-       if ($use_proxy) {
-               $proxy = $a->get_baseurl() . '/addon/jappixmini/proxy.php';
-       } else {
-               $proxy = "";
-       }
-
-       // get a list of jabber accounts of the contacts
-       $contacts = [];
-       $uid = local_user();
-       $rows = q("SELECT * FROM `pconfig` WHERE `uid`=$uid AND `cat`='jappixmini' AND `k` LIKE 'id:%%'");
-       foreach ($rows as $row) {
-               $key = $row['k'];
-               $pos = strpos($key, ":");
-               $dfrn_id = substr($key, $pos + 1);
-               $r = q("SELECT `name` FROM `contact` WHERE `uid`=$uid AND (`dfrn-id`='%s' OR `issued-id`='%s')", dbesc($dfrn_id), dbesc($dfrn_id));
-               if (count($r))
-                       $name = $r[0]["name"];
-
-               $value = $row['v'];
-               $pos = strpos($value, ":");
-               $address = substr($value, $pos + 1);
-               if (!$address) {
-                       continue;
-               }
-               if (!$name) {
-                       $name = $address;
-               }
-
-               $contacts[$address] = $name;
-       }
-       $contacts_json = json_encode($contacts);
-       $contacts_hash = sha1($contacts_json);
-
-       // get nickname
-       $r = q("SELECT `username` FROM `user` WHERE `uid`=$uid");
-       $nickname = json_encode($r[0]["username"]);
-       $groupchats = Config::get('jappixmini', 'groupchats');
-       //if $groupchats has no value jappix_addon_start will produce a syntax error
-       if (empty($groupchats)) {
-               $groupchats = "{}";
-       }
+    if ($_GET["mode"] == "minimal")
+       return;
 
-       // add javascript to start Jappix Mini
-       $a->page['htmlhead'] .= "<script type=\"text/javascript\">
+    $activate = get_pconfig(local_user(),'jappixmini','activate');
+    $dontinsertchat = get_pconfig(local_user(), 'jappixmini','dontinsertchat');
+    if (!$activate || $dontinsertchat) return;
+
+    $a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/jappixmini/jappix/php/get.php?t=js&amp;g=mini.xml"></script>'."\r\n";
+    $a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/jappixmini/jappix/php/get.php?t=js&amp;f=presence.js~caps.js~name.js~roster.js"></script>'."\r\n";
+
+    $a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/jappixmini/lib.js"></script>'."\r\n";
+
+    $username = get_pconfig(local_user(),'jappixmini','username');
+    $username = str_replace("'", "\\'", $username);
+    $server = get_pconfig(local_user(),'jappixmini','server');
+    $server = str_replace("'", "\\'", $server);
+    $bosh = get_pconfig(local_user(),'jappixmini','bosh');
+    $bosh = str_replace("'", "\\'", $bosh);
+    $encrypt = get_pconfig(local_user(),'jappixmini','encrypt');
+    $encrypt = intval($encrypt);
+    $password = get_pconfig(local_user(),'jappixmini','password');
+    $password = str_replace("'", "\\'", $password);
+
+    $autoapprove = get_pconfig(local_user(),'jappixmini','autoapprove');
+    $autoapprove = intval($autoapprove);
+    $autosubscribe = get_pconfig(local_user(),'jappixmini','autosubscribe');
+    $autosubscribe = intval($autosubscribe);
+
+    // set proxy if necessary
+    $use_proxy = get_config('jappixmini','bosh_proxy');
+    if ($use_proxy) {
+        $proxy = $a->get_baseurl().'/addon/jappixmini/proxy.php';
+    }
+    else {
+        $proxy = "";
+    }
+
+    // get a list of jabber accounts of the contacts
+    $contacts = Array();
+    $uid = local_user();
+    $rows = q("SELECT * FROM `pconfig` WHERE `uid`=$uid AND `cat`='jappixmini' AND `k` LIKE 'id:%%'");
+    foreach ($rows as $row) {
+        $key = $row['k'];
+       $pos = strpos($key, ":");
+       $dfrn_id = substr($key, $pos+1);
+        $r = q("SELECT `name` FROM `contact` WHERE `uid`=$uid AND (`dfrn-id`='%s' OR `issued-id`='%s')",
+               dbesc($dfrn_id),
+               dbesc($dfrn_id)
+       );
+       if (count($r))
+               $name = $r[0]["name"];
+
+        $value = $row['v'];
+        $pos = strpos($value, ":");
+        $address = substr($value, $pos+1);
+       if (!$address) continue;
+       if (!$name) $name = $address;
+
+       $contacts[$address] = $name;
+    }
+    $contacts_json = json_encode($contacts);
+    $contacts_hash = sha1($contacts_json);
+
+    // get nickname
+    $r = q("SELECT `username` FROM `user` WHERE `uid`=$uid");
+    $nickname = json_encode($r[0]["username"]);
+    $groupchats = get_config('jappixmini','groupchats');
+    //if $groupchats has no value jappix_addon_start will produce a syntax error
+    if(empty($groupchats)){
+       $groupchats = "{}";
+    }
+
+    // add javascript to start Jappix Mini
+    $a->page['htmlhead'] .= "<script type=\"text/javascript\">
         jQuery(document).ready(function() {
            jappixmini_addon_start('$server', '$username', '$proxy', '$bosh', $encrypt, '$password', $nickname, $contacts_json, '$contacts_hash', $autoapprove, $autosubscribe, $groupchats);
         });
     </script>";
 
-       return;
+    return;
 }
 
-function jappixmini_login(App $a, &$o)
-{
-       // create client secret on login to be able to encrypt jabber passwords
-       // for setDB and str_sha1, needed by jappixmini_addon_set_client_secret
-       $a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/jappixmini/jappix/php/get.php?t=js&amp;f=datastore.js~jsjac.js"></script>' . "\r\n";
+function jappixmini_login(&$a, &$o) {
+    // create client secret on login to be able to encrypt jabber passwords
+
+    // for setDB and str_sha1, needed by jappixmini_addon_set_client_secret
+    $a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/jappixmini/jappix/php/get.php?t=js&amp;f=datastore.js~jsjac.js"></script>'."\r\n";
 
-       // for jappixmini_addon_set_client_secret
-       $a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/jappixmini/lib.js"></script>' . "\r\n";
+    // for jappixmini_addon_set_client_secret
+    $a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/jappixmini/lib.js"></script>'."\r\n";
 
-       // save hash of password
-       $o = str_replace("<form ", "<form onsubmit=\"jappixmini_addon_set_client_secret(this.elements['id_password'].value);return true;\" ", $o);
+    // save hash of password
+    $o = str_replace("<form ", "<form onsubmit=\"jappixmini_addon_set_client_secret(this.elements['id_password'].value);return true;\" ", $o);
 }
 
-function jappixmini_cron(App $a, $d)
-{
+function jappixmini_cron(&$a, $d) {
        // For autosubscribe/autoapprove, we need to maintain a list of jabber addresses of our contacts.
-       Config::set("jappixmini", "last_cron_execution", $d);
+
+       set_config("jappixmini", "last_cron_execution", $d);
 
        // go through list of users with jabber enabled
        $users = q("SELECT `uid` FROM `pconfig` WHERE `cat`='jappixmini' AND (`k`='autosubscribe' OR `k`='autoapprove') AND `v`='1'");
-       logger("jappixmini: Update list of contacts' jabber accounts for " . count($users) . " users.");
+       logger("jappixmini: Update list of contacts' jabber accounts for ".count($users)." users.");
 
-       if (!count($users)) {
+       if(! count($users))
                return;
-       }
 
        foreach ($users as $row) {
                $uid = $row["uid"];
@@ -596,9 +575,7 @@ function jappixmini_cron(App $a, $d)
                        intval($uid), dbesc(NETWORK_DFRN));
                foreach ($contacts as $contact_row) {
                        $request = $contact_row["request"];
-                       if (!$request) {
-                               continue;
-                       }
+                       if (!$request) continue;
 
                        $dfrn_id = $contact_row["dfrn-id"];
                        if ($dfrn_id) {
@@ -615,7 +592,7 @@ function jappixmini_cron(App $a, $d)
                        }
 
                        // check if jabber address already present
-                       $present = PConfig::get($uid, "jappixmini", "id:" . $dfrn_id);
+                       $present = get_pconfig($uid, "jappixmini", "id:".$dfrn_id);
                        $now = intval(time());
                        if ($present) {
                                // $present has format "timestamp:jabber_address"
@@ -624,30 +601,22 @@ function jappixmini_cron(App $a, $d)
 
                                // do not re-retrieve jabber address if last retrieval
                                // is not older than a week
-                               if ($now - $timestamp < 3600 * 24 * 7) {
-                                       continue;
-                               }
+                               if ($now-$timestamp<3600*24*7) continue;
                        }
 
                        // construct base retrieval address
                        $pos = strpos($request, "/dfrn_request/");
-                       if ($pos === false) {
-                               continue;
-                       }
+                       if ($pos===false) continue;
 
-                       $base = substr($request, 0, $pos) . "/jappixmini?role=$role";
+                       $base = substr($request, 0, $pos)."/jappixmini?role=$role";
 
                        // construct own address
-                       $username = PConfig::get($uid, 'jappixmini', 'username');
-                       if (!$username) {
-                               continue;
-                       }
-                       $server = PConfig::get($uid, 'jappixmini', 'server');
-                       if (!$server) {
-                               continue;
-                       }
+                       $username = get_pconfig($uid, 'jappixmini', 'username');
+                       if (!$username) continue;
+                       $server = get_pconfig($uid, 'jappixmini', 'server');
+                       if (!$server) continue;
 
-                       $address = $username . "@" . $server;
+                       $address = $username."@".$server;
 
                        // sign address
                        $signed_address = "";
@@ -655,7 +624,7 @@ function jappixmini_cron(App $a, $d)
 
                        // construct request url
                        $signed_address_hex = bin2hex($signed_address);
-                       $url = $base . "&signed_address=$signed_address_hex&dfrn_id=" . urlencode($dfrn_id);
+                       $url = $base."&signed_address=$signed_address_hex&dfrn_id=".urlencode($dfrn_id);
 
                        try {
                                // send request
@@ -663,40 +632,32 @@ function jappixmini_cron(App $a, $d)
 
                                // parse answer
                                $answer = json_decode($answer_json);
-                               if ($answer->status != "ok") {
-                                       throw new Exception();
-                               }
+                               if ($answer->status != "ok") throw new Exception();
 
                                $encrypted_address_hex = $answer->encrypted_address;
-                               if (!$encrypted_address_hex) {
-                                       throw new Exception();
-                               }
+                               if (!$encrypted_address_hex) throw new Exception();
 
                                $encrypted_address = hex2bin($encrypted_address_hex);
-                               if (!$encrypted_address) {
-                                       throw new Exception();
-                               }
+                               if (!$encrypted_address) throw new Exception();
 
                                // decrypt address
                                $decrypted_address = "";
                                $decrypt_func($encrypted_address, $decrypted_address, $key);
-                               if (!$decrypted_address) {
-                                       throw new Exception();
-                               }
+                               if (!$decrypted_address) throw new Exception();
                        } catch (Exception $e) {
                                $decrypted_address = "";
                        }
 
                        // save address
-                       PConfig::set($uid, "jappixmini", "id:$dfrn_id", "$now:$decrypted_address");
+                       set_pconfig($uid, "jappixmini", "id:$dfrn_id", "$now:$decrypted_address");
                }
        }
 }
 
-function jappixmini_download_source(App $a, &$b)
-{
+function jappixmini_download_source(&$a,&$b) {
        // Jappix Mini source download link on About page
+
        $b .= '<h1>Jappix Mini</h1>';
-       $b .= '<p>This site uses the jappixmini addon, which includes Jappix Mini by the <a href="' . $a->get_baseurl() . '/addon/jappixmini/jappix/AUTHORS">Jappix authors</a> and is distributed under the terms of the <a href="' . $a->get_baseurl() . '/addon/jappixmini/jappix/COPYING">GNU Affero General Public License</a>.</p>';
-       $b .= '<p>You can download the <a href="' . $a->get_baseurl() . '/addon/jappixmini.tgz">source code of the addon</a>. The rest of Friendica is distributed under compatible licenses and can be retrieved from <a href="https://github.com/friendica/friendica">https://github.com/friendica/friendica</a> and <a href="https://github.com/friendica/friendica-addons">https://github.com/friendica/friendica-addons</a></p>';
+       $b .= '<p>This site uses the jappixmini addon, which includes Jappix Mini by the <a href="'.$a->get_baseurl().'/addon/jappixmini/jappix/AUTHORS">Jappix authors</a> and is distributed under the terms of the <a href="'.$a->get_baseurl().'/addon/jappixmini/jappix/COPYING">GNU Affero General Public License</a>.</p>';
+       $b .= '<p>You can download the <a href="'.$a->get_baseurl().'/addon/jappixmini.tgz">source code of the addon</a>. The rest of Friendica is distributed under compatible licenses and can be retrieved from <a href="https://github.com/friendica/friendica">https://github.com/friendica/friendica</a> and <a href="https://github.com/friendica/friendica-addons">https://github.com/friendica/friendica-addons</a></p>';
 }
index c4e3a03ca2f7bea462dc7da7e12fdbebac33b684..a9f6db44611f6076eed4e982c9e74675decaf8e2 100644 (file)
@@ -46,7 +46,7 @@ if($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
        header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
        header('Access-Control-Allow-Headers: Content-Type');
        header('Access-Control-Max-Age: 31536000');
-
+       
        exit;
 }
 
@@ -58,7 +58,7 @@ if($data) {
        // CORS headers
        header('Access-Control-Allow-Origin: *');
        header('Access-Control-Allow-Headers: Content-Type');
-
+       
        $method = 'POST';
 }
 
@@ -76,7 +76,7 @@ else {
 }
 
 // HTTP headers
-$headers = ['User-Agent: Jappix (BOSH PHP Proxy)', 'Connection: keep-alive', 'Content-Type: text/xml; charset=utf-8', 'Content-Length: '.strlen($data)];
+$headers = array('User-Agent: Jappix (BOSH PHP Proxy)', 'Connection: keep-alive', 'Content-Type: text/xml; charset=utf-8', 'Content-Length: '.strlen($data));
 
 // CURL is better if available
 if(function_exists('curl_init'))
@@ -91,7 +91,7 @@ $use_curl = false;
 if($use_curl) {
        // Initialize CURL
        $connection = curl_init($HOST_BOSH);
-
+       
        // Set the CURL settings
        curl_setopt($connection, CURLOPT_HEADER, 0);
        curl_setopt($connection, CURLOPT_POST, 1);
@@ -104,7 +104,7 @@ if($use_curl) {
        curl_setopt($connection, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($connection, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($connection, CURLOPT_RETURNTRANSFER, 1);
-
+       
        // Get the CURL output
        $output = curl_exec($connection);
 }
@@ -112,11 +112,11 @@ if($use_curl) {
 // Built-in stream functions
 else {
        // HTTP parameters
-       $parameters = ['http' => [
+       $parameters = array('http' => array(
                                        'method' => 'POST',
                                        'content' => $data
-                                     ]
-                     ];
+                                     )
+                     );
 
        $parameters['http']['header'] = $headers;
 
@@ -148,7 +148,7 @@ header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
 if($method == 'POST') {
        // XML header
        header('Content-Type: text/xml; charset=utf-8');
-
+       
        if(!$output)
                echo('<body xmlns=\'http://jabber.org/protocol/httpbind\' type=\'terminate\'/>');
        else
@@ -159,10 +159,10 @@ if($method == 'POST') {
 if($method == 'GET') {
        // JSON header
        header('Content-type: application/json');
-
+       
        // Encode output to JSON
        $json_output = json_encode($output);
-
+       
        if(($output == false) || ($output == '') || ($json_output == 'null'))
                echo($callback.'({"reply":"<body xmlns=\'http:\/\/jabber.org\/protocol\/httpbind\' type=\'terminate\'\/>"});');
        else
index 2b15720b4fa5eeb0c72ae00fcbb82499346756e1..e16ee2d074bf655754cb78685ef7262cae16615d 100644 (file)
@@ -10,7 +10,7 @@
  *
  * JavaScript Photo/Image Uploader
  *
- * Uses Valum 'qq' Uploader.
+ * Uses Valum 'qq' Uploader. 
  * Module Author: Chris Case
  *
  */
@@ -46,19 +46,19 @@ function js_upload_form(&$a,&$b) {
        $cancel = L10n::t('Cancel');
        $failed = L10n::t('Failed');
 
-       $maximagesize = intval(Config::get('system','maximagesize'));
+       $maximagesize = intval(get_config('system','maximagesize'));
 
        $b['addon_text'] .= <<< EOT
-
- <div id="file-uploader-demo1">
-  <noscript>
+       
+ <div id="file-uploader-demo1">                
+  <noscript>                   
    <p>Please enable JavaScript to use file uploader.</p>
    <!-- or put a simple form for upload here -->
-  </noscript>
+  </noscript> 
  </div>
 
 <script type="text/javascript">
-var uploader = null;
+var uploader = null;       
 function getSelected(opt) {
             var selected = new Array();
             var index = 0;
@@ -72,16 +72,16 @@ function getSelected(opt) {
                }
             }
             return selected;
-         }
+         } 
 function createUploader() {
        uploader = new qq.FileUploader({
                element: document.getElementById('file-uploader-demo1'),
                action: '{$b['post_url']}',
 
-        template: '<div class="qq-uploader">' +
+        template: '<div class="qq-uploader">' + 
                 '<div class="qq-upload-drop-area"><span>$drop_msg</span></div>' +
                 '<div class="qq-upload-button">$upload_msg</div>' +
-                '<ul class="qq-upload-list"></ul>' +
+                '<ul class="qq-upload-list"></ul>' + 
              '</div>',
 
         // template for one item in file list
@@ -91,7 +91,7 @@ function createUploader() {
                 '<span class="qq-upload-size"></span>' +
                 '<a class="qq-upload-cancel" href="#">$cancel</a>' +
                 '<span class="qq-upload-failed-text">$failed</span>' +
-            '</li>',
+            '</li>',        
 
                debug: true,
                sizeLimit: $maximagesize,
@@ -118,17 +118,17 @@ function createUploader() {
                                });
                        }
                }
-       });
+       });           
 }
 
 
 // in your app create uploader as soon as the DOM is ready
-// don't wait for the window to load
-window.onload = createUploader;
+// don't wait for the window to load  
+window.onload = createUploader;     
 
 
 </script>
-
 EOT;
 
 
@@ -138,11 +138,11 @@ function js_upload_post_init(&$a,&$b) {
 
        // list of valid extensions, ex. array("jpeg", "xml", "bmp")
 
-       $allowedExtensions = ["jpeg","gif","png","jpg"];
+       $allowedExtensions = array("jpeg","gif","png","jpg");
 
        // max file size in bytes
 
-       $sizeLimit = Config::get('system','maximagesize'); //6 * 1024 * 1024;
+       $sizeLimit = get_config('system','maximagesize'); //6 * 1024 * 1024;
 
        $uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
 
@@ -195,10 +195,10 @@ class qqUploadedFileXhr {
      * Save the file in the temp dir.
      * @return boolean TRUE on success
      */
-    function save() {
+    function save() {    
         $input = fopen("php://input", "r");
 
-               $upload_dir = Config::get('system','tempdir');
+               $upload_dir = get_config('system','tempdir');
                if(! $upload_dir)
                        $upload_dir = sys_get_temp_dir();
 
@@ -209,8 +209,8 @@ class qqUploadedFileXhr {
 
         fclose($input);
                fclose($temp);
-
-        if ($realSize != $this->getSize()){
+        
+        if ($realSize != $this->getSize()){            
             return false;
         }
         return true;
@@ -226,18 +226,18 @@ class qqUploadedFileXhr {
 
     function getSize() {
         if (isset($_SERVER["CONTENT_LENGTH"])){
-            return (int)$_SERVER["CONTENT_LENGTH"];
+            return (int)$_SERVER["CONTENT_LENGTH"];            
         } else {
             throw new Exception('Getting content length is not supported.');
-        }
-    }
+        }      
+    }   
 }
 
 /**
  * Handle file uploads via regular form post (uses the $_FILES array)
  */
 
-class qqUploadedFileForm {
+class qqUploadedFileForm {  
 
 
     /**
@@ -263,60 +263,60 @@ class qqUploadedFileForm {
 }
 
 class qqFileUploader {
-    private $allowedExtensions = [];
+    private $allowedExtensions = array();
     private $sizeLimit = 10485760;
     private $file;
 
-    function __construct(array $allowedExtensions = [], $sizeLimit = 10485760){
+    function __construct(array $allowedExtensions = array(), $sizeLimit = 10485760){        
         $allowedExtensions = array_map("strtolower", $allowedExtensions);
-
-        $this->allowedExtensions = $allowedExtensions;
+            
+        $this->allowedExtensions = $allowedExtensions;        
         $this->sizeLimit = $sizeLimit;
-
+        
         if (isset($_GET['qqfile'])) {
             $this->file = new qqUploadedFileXhr();
         } elseif (isset($_FILES['qqfile'])) {
             $this->file = new qqUploadedFileForm();
         } else {
-            $this->file = false;
+            $this->file = false; 
         }
 
     }
-
-
+    
+    
     private function toBytes($str){
         $val = trim($str);
         $last = strtolower($str[strlen($str)-1]);
         switch($last) {
             case 'g': $val *= 1024;
             case 'm': $val *= 1024;
-            case 'k': $val *= 1024;
+            case 'k': $val *= 1024;        
         }
         return $val;
     }
-
+    
     /**
      * Returns array('success'=>true) or array('error'=>'error message')
      */
     function handleUpload(){
-
+        
         if (!$this->file){
             return ['error' => L10n::t('No files were uploaded.')];
         }
-
+        
         $size = $this->file->getSize();
-
+        
         if ($size == 0) {
             return ['error' => L10n::t('Uploaded file is empty')];
         }
-
+        
 //        if ($size > $this->sizeLimit) {
 
 //            return array('error' => L10n::t('Uploaded file is too large'));
 //        }
+        
 
-
-               $maximagesize = Config::get('system','maximagesize');
+               $maximagesize = get_config('system','maximagesize');
 
                if(($maximagesize) && ($size > $maximagesize)) {
                        return ['error' => L10n::t('Image exceeds size limit of ') . $maximagesize ];
@@ -332,20 +332,20 @@ class qqFileUploader {
             $these = implode(', ', $this->allowedExtensions);
             return ['error' => L10n::t('File has an invalid extension, it should be one of ') . $these . '.'];
         }
-
+        
         if ($this->file->save()){
-            return [
+            return array(
                                'success'=>true,
-                               'path' => $this->file->getPath(),
+                               'path' => $this->file->getPath(), 
                                'filename' => $filename . '.' . $ext
-                       ];
+                       );
         } else {
             return [
                                'error'=> L10n::t('Upload was cancelled, or server error encountered'),
                                'path' => $this->file->getPath(),
                                'filename' => $filename . '.' . $ext
-                       ];
+                       );
         }
-
-    }
+        
+    }    
 }
index 47372926d9273920954299615a4b92def7eea189..3f114073c8d300a1043ea06260e0596e10f46c44 100644 (file)
@@ -83,7 +83,7 @@ function krynn_post_hook($a, &$item) {
 
        /* Retrieve our personal config setting */
 
-       $active = PConfig::get(local_user(), 'krynn', 'enable');
+       $active = get_pconfig(local_user(), 'krynn', 'enable');
 
        if(! $active)
                return;
@@ -97,7 +97,7 @@ function krynn_post_hook($a, &$item) {
         *
         */
 
-       $krynn = ['Ansalon','Abanasinia','Solace','Haven','Gateway','Qualinost','Ankatavaka','Pax Tharkas','Ergoth','Newsea','Straights of Schallsea','Plains of Dust','Tarsis','Barren Hills','Que Shu','Citadel of Light','Solinari','Hedge Maze','Tower of High Sorcery','Inn of the Last Home','Last Heroes Tomb','Academy of Sorcery','Gods Row','Temple of Majere','Temple of Kiri-Jolith','Temple of Mishakal','Temple of Zeboim','The Trough','Sad Town','Xak Tsaroth','Zhaman','Skullcap','Saifhum','Karthay','Mithas','Kothas','Silver Dragon Mountain','Silvanesti'];
+       $krynn = array('Ansalon','Abanasinia','Solace','Haven','Gateway','Qualinost','Ankatavaka','Pax Tharkas','Ergoth','Newsea','Straights of Schallsea','Plains of Dust','Tarsis','Barren Hills','Que Shu','Citadel of Light','Solinari','Hedge Maze','Tower of High Sorcery','Inn of the Last Home','Last Heroes Tomb','Academy of Sorcery','Gods Row','Temple of Majere','Temple of Kiri-Jolith','Temple of Mishakal','Temple of Zeboim','The Trough','Sad Town','Xak Tsaroth','Zhaman','Skullcap','Saifhum','Karthay','Mithas','Kothas','Silver Dragon Mountain','Silvanesti');
 
        $planet = array_rand($krynn,1);
        $item['location'] = $krynn[$planet];
@@ -121,7 +121,7 @@ function krynn_settings_post($a,$post) {
        if(! local_user())
                return;
        if($_POST['krynn-submit'])
-               PConfig::set(local_user(),'krynn','enable',intval($_POST['krynn']));
+               set_pconfig(local_user(),'krynn','enable',intval($_POST['krynn']));
 }
 
 
@@ -145,7 +145,7 @@ function krynn_settings(&$a,&$s) {
 
        /* Get the current state of our config variable */
 
-       $enabled = PConfig::get(local_user(),'krynn','enable');
+       $enabled = get_pconfig(local_user(),'krynn','enable');
 
        $checked = (($enabled) ? ' checked="checked" ' : '');
 
index 81f9f6ecb4bf12f772a540a35eabd9f5c952ca96..5df153eb978a1ce26bf99f8eeb90670231e44969 100644 (file)
@@ -36,21 +36,16 @@ function langfilter_uninstall()
  * 2nd get the current settings
  * 3rd parse a SMARTY3 template, replacing some translateable strings for the form
  */
-
-function langfilter_addon_settings(App $a, &$s)
-{
-       if (!local_user()) {
+function langfilter_addon_settings(&$a,&$s) {
+       if(! local_user())
                return;
-       }
-
-       $enable_checked = (intval(PConfig::get(local_user(), 'langfilter', 'disable')) ? '' : ' checked="checked" ');
-       $languages      = PConfig::get(local_user(), 'langfilter', 'languages');
-       $minconfidence  = PConfig::get(local_user(), 'langfilter', 'minconfidence') * 100;
-       $minlength      = PConfig::get(local_user(), 'langfilter', 'minlength');
 
-       if (!$languages) {
+       $enable_checked = (intval(get_pconfig(local_user(),'langfilter','disable')) ? '' : ' checked="checked" ');
+       $languages = get_pconfig(local_user(),'langfilter','languages');
+       $minconfidence = get_pconfig(local_user(),'langfilter','minconfidence')*100;
+       $minlength = get_pconfig(local_user(),'langfilter','minlength');
+       if(! $languages)
                $languages = 'en,de,fr,it,es';
-       }
 
        $t = get_markup_template("settings.tpl", "addon/langfilter/");
        $s .= replace_macros($t, [
@@ -65,18 +60,14 @@ function langfilter_addon_settings(App $a, &$s)
 
        return;
 }
-
 /* Save the settings
  * 1st check it's a logged in user calling
  * 2nd check the langfilter form is to be saved
  * 3rd save the settings to the DB for later usage
  */
-
-function langfilter_addon_settings_post(App $a, &$b)
-{
-       if (!local_user()) {
+function langfilter_addon_settings_post(&$a,&$b) {
+       if(! local_user())
                return;
-       }
 
        if ($_POST['langfilter-settings-submit']) {
                PConfig::set(local_user(), 'langfilter', 'languages', trim($_POST['langfilter_languages']));
@@ -104,7 +95,6 @@ function langfilter_addon_settings_post(App $a, &$b)
                info(L10n::t('Language Filter Settings saved.') . EOL);
        }
 }
-
 /* Actually filter postings by their language
  * 1st check if the user wants to filter postings
  * 2nd get the user settings which languages shall be not filtered out
@@ -113,71 +103,51 @@ function langfilter_addon_settings_post(App $a, &$b)
  *     of the user, then collapse the posting, but provide a link to
  *     expand it again.
  */
+function langfilter_prepare_body(&$a,&$b) {
 
-function langfilter_prepare_body(App $a, &$b)
-{
-       $logged_user = local_user();
-       if (!$logged_user) {
-               return;
-       }
+    $logged_user = local_user();
+    if ( ! $logged_user ) return;
 
-       // Never filter own messages
-       // TODO: find a better way to extract this
-       $logged_user_profile = $a->get_baseurl() . '/profile/' . $a->user['nickname'];
-       if ($logged_user_profile == $b['item']['author-link']) {
-               return;
-       }
+    # Never filter own messages
+    # TODO: find a better way to extract this
+    $logged_user_profile = $a->config['system']['url'] . '/profile/' . $a->user['nickname'];
+    if ( $logged_user_profile == $b['item']['author-link'] ) return;
 
-       // Don't filter if language filter is disabled
-       if (PConfig::get($logged_user, 'langfilter', 'disable')) {
-               return;
-       }
+    # Don't filter if language filter is disabled
+    if( get_pconfig($logged_user,'langfilter','disable') ) return;
 
-       // Don't filter if body lenght is below minimum
-       $minlen = PConfig::get(local_user(), 'langfilter', 'minlength');
-       if (!$minlen) {
-               $minlen = 32;
-       }
-       if (strlen($b['item']['body']) < $minlen) {
-               return;
-       }
+    # Don't filter if body lenght is below minimum
+    $minlen = get_pconfig(local_user(),'langfilter','minlength');
+    if ( ! $minlen ) $minlen = 32;
+    if ( strlen($b['item']['body']) < $minlen ) return;
 
-       $spoken_config = PConfig::get(local_user(), 'langfilter', 'languages');
-       $minconfidence = PConfig::get(local_user(), 'langfilter', 'minconfidence');
+    $spoken_config = get_pconfig(local_user(),'langfilter','languages');
+    $minconfidence = get_pconfig(local_user(),'langfilter','minconfidence');
 
-       // Don't filter if no spoken languages are configured
-       if (!$spoken_config)
-               return;
-       $spoken_languages = explode(',', $spoken_config);
+    # Don't filter if no spoken languages are configured 
+    if ( ! $spoken_config ) return;
+    $spoken_languages = explode(',', $spoken_config);
 
-       // Extract the language of the post
-       $opts = $b['item']['postopts'];
-       if (!$opts) {
-               // no options associated to post
-               return;
-       }
-       if (!preg_match('/\blang=([^;]*);([^:]*)/', $opts, $matches)) {
-               // no lang options associated to post
-               return;
-       }
+    # Extract the language of the post
+    $opts = $b['item']['postopts'];
+    if ( ! $opts ) return; # no options associated to post
+    if ( ! preg_match('/\blang=([^;]*);([^:]*)/', $opts, $matches ) )
+            return; # no lang options associated to post
 
-       $lang = $matches[1];
-       $confidence = $matches[2];
+    $lang = $matches[1];
+    $confidence = $matches[2];
 
-       // Do not filter if language detection confidence is too low
-       if ($minconfidence && $confidence < $minconfidence) {
-               return;
-       }
+    # Do not filter if language detection confidence is too low
+    if ( $minconfidence && $confidence < $minconfidence ) return;
 
-       $iso2 = Text_LanguageDetect_ISO639::nameToCode2($lang);
+    $iso2 = Text_LanguageDetect_ISO639::nameToCode2($lang);
 
-       if (!$iso2) {
-               return;
-       }
-       $spoken = in_array($iso2, $spoken_languages);
+    if ( ! $iso2 ) return;
+    $spoken = in_array($iso2, $spoken_languages);
 
        if (!$spoken) {
                $rnd = random_string(8);
                $b['html'] = '<div id="langfilter-wrap-' . $rnd . '" class="fakelink" onclick=openClose(\'langfilter-' . $rnd . '\'); >' . L10n::t('unspoken language %s - Click to open/close', $lang) . '</div><div id="langfilter-' . $rnd . '" style="display: none; " >' . $b['html'] . '</div>';
        }
 }
+?>
index d06874b7cbfaf1696e7a0416a4ee0c7ee28c2573..4a882a212df686e480581e48b57f9634de566085 100644 (file)
@@ -1,5 +1,4 @@
 <?php
-
 /**
  * Name: LDAP Authenticate
  * Description: Authenticate a user against an LDAP directory
@@ -7,10 +6,10 @@
  * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
  * Author: aymhce
  */
-
 /**
  * Friendica addon
- *
+ * 
  * Module: LDAP Authenticate
  *
  * Authenticate a user against an LDAP directory
  *
  * Optionally authenticates only if a member of a given group in the directory.
  *
- * By default, the person must have registered with Friendica using the normal registration
+ * By default, the person must have registered with Friendica using the normal registration 
  * procedures in order to have a Friendica user record, contact, and profile.
  * However, it's possible with an option to automate the creation of a Friendica basic account.
  *
  * Note when using with Windows Active Directory: you may need to set TLS_CACERT in your site
- * ldap.conf file to the signing cert for your LDAP server.
- *
+ * ldap.conf file to the signing cert for your LDAP server. 
+ * 
  * The configuration options for this module may be set in the .htconfig.php file
  * e.g.:
  *
@@ -66,133 +65,132 @@ function ldapauth_uninstall()
        Addon::unregisterHook('authenticate', 'addon/ldapauth/ldapauth.php', 'ldapauth_hook_authenticate');
 }
 
-function ldapauth_hook_authenticate($a, &$b)
-{
-       if (ldapauth_authenticate($b['username'], $b['password'])) {
-               $results = get_existing_account($b['username']);
-               if (!empty($results)) {
-                       $b['user_record'] = $results[0];
-                       $b['authenticated'] = 1;
-               }
-       }
-       return;
+
+function ldapauth_hook_authenticate($a,&$b) {
+    if(ldapauth_authenticate($b['username'],$b['password'])) {
+       $results = get_existing_account($b['username']);
+       if(! empty($results)){
+            $b['user_record'] = $results[0];
+            $b['authenticated'] = 1;
+       }
+    }
+    return;
 }
 
-function ldapauth_authenticate($username, $password)
-{
-       $ldap_server   = Config::get('ldapauth', 'ldap_server');
-       $ldap_binddn   = Config::get('ldapauth', 'ldap_binddn');
-       $ldap_bindpw   = Config::get('ldapauth', 'ldap_bindpw');
-       $ldap_searchdn = Config::get('ldapauth', 'ldap_searchdn');
-       $ldap_userattr = Config::get('ldapauth', 'ldap_userattr');
-       $ldap_group    = Config::get('ldapauth', 'ldap_group');
-       $ldap_autocreateaccount = Config::get('ldapauth', 'ldap_autocreateaccount');
-       $ldap_autocreateaccount_emailattribute = Config::get('ldapauth', 'ldap_autocreateaccount_emailattribute');
-       $ldap_autocreateaccount_nameattribute  = Config::get('ldapauth', 'ldap_autocreateaccount_nameattribute');
-
-       if (!(strlen($password) && function_exists('ldap_connect') && strlen($ldap_server))) {
-               logger("ldapauth: not configured or missing php-ldap module");
-               return false;
-       }
-
-       $connect = @ldap_connect($ldap_server);
-
-       if ($connect === false) {
-               logger("ldapauth: could not connect to $ldap_server");
-               return false;
-       }
-
-       @ldap_set_option($connect, LDAP_OPT_PROTOCOL_VERSION, 3);
-       @ldap_set_option($connect, LDAP_OPT_REFERRALS, 0);
-       if ((@ldap_bind($connect, $ldap_binddn, $ldap_bindpw)) === false) {
-               logger("ldapauth: could not bind $ldap_server as $ldap_binddn");
-               return false;
-       }
-
-       $res = @ldap_search($connect, $ldap_searchdn, $ldap_userattr . '=' . $username);
-
-       if (!$res) {
-               logger("ldapauth: $ldap_userattr=$username,$ldap_searchdn not found");
-               return false;
-       }
-
-       $id = @ldap_first_entry($connect, $res);
-
-       if (!$id) {
-               return false;
-       }
-
-       $dn = @ldap_get_dn($connect, $id);
-
-       if (!@ldap_bind($connect, $dn, $password)) {
-               return false;
-       }
-
-       $emailarray = [];
-       $namearray = [];
-       if ($ldap_autocreateaccount == "true") {
-               if (!strlen($ldap_autocreateaccount_emailattribute)) {
-                       $ldap_autocreateaccount_emailattribute = "mail";
-               }
-               if (!strlen($ldap_autocreateaccount_nameattribute)) {
-                       $ldap_autocreateaccount_nameattribute = "givenName";
-               }
-               $emailarray = @ldap_get_values($connect, $id, $ldap_autocreateaccount_emailattribute);
-               $namearray = @ldap_get_values($connect, $id, $ldap_autocreateaccount_nameattribute);
-       }
-
-       if (!strlen($ldap_group)) {
-               ldap_autocreateaccount($ldap_autocreateaccount, $username, $password, $emailarray[0], $namearray[0]);
-               return true;
-       }
-
-       $r = @ldap_compare($connect, $ldap_group, 'member', $dn);
-       if ($r === -1) {
-               $err = @ldap_error($connect);
-               $eno = @ldap_errno($connect);
-               @ldap_close($connect);
-
-               if ($eno === 32) {
-                       logger("ldapauth: access control group Does Not Exist");
-                       return false;
-               } elseif ($eno === 16) {
-                       logger('ldapauth: membership attribute does not exist in access control group');
-                       return false;
-               } else {
-                       logger('ldapauth: error: ' . $err);
-                       return false;
-               }
-       } elseif ($r === false) {
-               @ldap_close($connect);
-               return false;
-       }
-
-       ldap_autocreateaccount($ldap_autocreateaccount, $username, $password, $emailarray[0], $namearray[0]);
-       return true;
+function ldapauth_authenticate($username,$password) {
+
+    $ldap_server   = get_config('ldapauth','ldap_server');
+    $ldap_binddn   = get_config('ldapauth','ldap_binddn');
+    $ldap_bindpw   = get_config('ldapauth','ldap_bindpw');
+    $ldap_searchdn = get_config('ldapauth','ldap_searchdn');
+    $ldap_userattr = get_config('ldapauth','ldap_userattr');
+    $ldap_group    = get_config('ldapauth','ldap_group');
+    $ldap_autocreateaccount = get_config('ldapauth','ldap_autocreateaccount');
+    $ldap_autocreateaccount_emailattribute = get_config('ldapauth','ldap_autocreateaccount_emailattribute');
+    $ldap_autocreateaccount_nameattribute = get_config('ldapauth','ldap_autocreateaccount_nameattribute');
+       
+    if(! ((strlen($password))
+            && (function_exists('ldap_connect'))
+            && (strlen($ldap_server)))) {
+            logger("ldapauth: not configured or missing php-ldap module");
+            return false;
+    }
+
+    $connect = @ldap_connect($ldap_server);
+
+    if($connect === false) {
+        logger("ldapauth: could not connect to $ldap_server");
+        return false;
+    }
+
+    @ldap_set_option($connect, LDAP_OPT_PROTOCOL_VERSION,3);
+    @ldap_set_option($connect, LDAP_OPT_REFERRALS, 0);
+    if((@ldap_bind($connect,$ldap_binddn,$ldap_bindpw)) === false) {
+        logger("ldapauth: could not bind $ldap_server as $ldap_binddn");
+        return false;
+    }
+
+    $res = @ldap_search($connect,$ldap_searchdn, $ldap_userattr . '=' . $username);
+
+    if(! $res) {
+        logger("ldapauth: $ldap_userattr=$username,$ldap_searchdn not found");
+        return false;
+    }
+
+    $id = @ldap_first_entry($connect,$res);
+
+    if(! $id) {
+        return false;
+    }
+
+    $dn = @ldap_get_dn($connect,$id);
+
+    if(! @ldap_bind($connect,$dn,$password))
+        return false;
+    
+    $emailarray = [];
+    $namearray = [];
+    if($ldap_autocreateaccount == "true"){
+        if(! strlen($ldap_autocreateaccount_emailattribute))
+            $ldap_autocreateaccount_emailattribute = "mail";
+        if(! strlen($ldap_autocreateaccount_nameattribute))
+            $ldap_autocreateaccount_nameattribute = "givenName";
+       $emailarray = @ldap_get_values($connect, $id, $ldap_autocreateaccount_emailattribute);
+       $namearray = @ldap_get_values($connect, $id, $ldap_autocreateaccount_nameattribute);
+    }
+
+    if(! strlen($ldap_group)){
+       ldap_autocreateaccount($ldap_autocreateaccount,$username,$password,$emailarray[0],$namearray[0]);
+        return true;
+    }
+
+    $r = @ldap_compare($connect,$ldap_group,'member',$dn);
+    if ($r === -1) {
+        $err = @ldap_error($connect);
+        $eno = @ldap_errno($connect);
+        @ldap_close($connect);
+
+        if ($eno === 32) {
+            logger("ldapauth: access control group Does Not Exist");
+            return false;
+        }
+        elseif ($eno === 16) {
+            logger('ldapauth: membership attribute does not exist in access control group');
+            return false;
+        }
+        else {
+            logger('ldapauth: error: ' . $err);
+            return false;
+        }
+    }
+    elseif ($r === false) {
+        @ldap_close($connect);
+        return false;
+    }
+
+    ldap_autocreateaccount($ldap_autocreateaccount,$username,$password,$emailarray[0],$namearray[0]);
+    return true;
 }
 
-function ldap_autocreateaccount($ldap_autocreateaccount, $username, $password, $email, $name)
-{
-       if ($ldap_autocreateaccount == "true") {
-               $results = get_existing_account($username);
-               if (empty($results)) {
-                       if (strlen($email) > 0 && strlen($name) > 0) {
-                               $arr = ['username' => $name, 'nickname' => $username, 'email' => $email, 'password' => $password, 'verified' => 1];
-
-                               try {
-                                       User::create($arr);
-                                       logger("ldapauth: account " . $username . " created");
-                               } catch (Exception $ex) {
-                                       logger("ldapauth: account " . $username . " was not created ! : " . $ex->getMessage());
-                               }
-                       } else {
-                               logger("ldapauth: unable to create account, no email or nickname found");
-                       }
-               }
-       }
+function ldap_autocreateaccount($ldap_autocreateaccount,$username,$password,$email,$name) {
+    if($ldap_autocreateaccount == "true"){
+        $results = get_existing_account($username);
+        if(empty($results)){
+            if (strlen($email) > 0 && strlen($name) > 0){
+                $arr = array('username'=>$name,'nickname'=>$username,'email'=>$email,'password'=>$password,'verified'=>1);
+                $result = create_user($arr);
+                if ($result['success']){
+                    logger("ldapauth: account " . $username . " created");
+                }else{
+                    logger("ldapauth: account " . $username . " was not created ! : " . implode($result));
+                }
+            }else{
+                logger("ldapauth: unable to create account, no email or nickname found");
+            }
+        }
+    }
 }
 
-function get_existing_account($username)
-{
-       return q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `blocked` = 0 AND `verified` = 1 LIMIT 1", $username);
+function get_existing_account($username){
+    return q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `blocked` = 0 AND `verified` = 1 LIMIT 1",$username);
 }
index 04d3e556d6bbba17babed29cec1b3e6e37266a17..0c3136a4c326d7a1a0da084594b7233637951a49 100644 (file)
@@ -37,7 +37,7 @@ function leistungsschutzrecht_getsiteinfo($a, &$siteinfo) {
 }
 
 function leistungsschutzrecht_cuttext($text) {
-       $text = str_replace(["\r", "\n"], [" ", " "], $text);
+       $text = str_replace(array("\r", "\n"), array(" ", " "), $text);
 
        do {
                $oldtext = $text;
@@ -73,7 +73,7 @@ function leistungsschutzrecht_fetchsites()
        $sitelist = Network::fetchUrl($url);
        $siteurls = explode(',', $sitelist);
 
-       $whitelist = ['tagesschau.de', 'heute.de', 'wdr.de'];
+       $whitelist = array('tagesschau.de', 'heute.de', 'wdr.de');
 
        $sites = [];
        foreach ($siteurls as $site) {
@@ -117,12 +117,12 @@ function leistungsschutzrecht_fetchsites()
 */
 
        if (sizeof($sites)) {
-               Config::set('leistungsschutzrecht','sites',$sites);
+               set_config('leistungsschutzrecht','sites',$sites);
        }
 }
 
 function leistungsschutzrecht_is_member_site($url) {
-       $sites = Config::get('leistungsschutzrecht','sites');
+       $sites = get_config('leistungsschutzrecht','sites');
 
        if ($sites == "")
                return(false);
@@ -144,7 +144,7 @@ function leistungsschutzrecht_is_member_site($url) {
 }
 
 function leistungsschutzrecht_cron($a,$b) {
-       $last = Config::get('leistungsschutzrecht','last_poll');
+       $last = get_config('leistungsschutzrecht','last_poll');
 
        if($last) {
                $next = $last + 86400;
@@ -154,6 +154,6 @@ function leistungsschutzrecht_cron($a,$b) {
                }
        }
        leistungsschutzrecht_fetchsites();
-       Config::set('leistungsschutzrecht','last_poll', time());
+       set_config('leistungsschutzrecht','last_poll', time());
 }
 ?>
index 0685123842d189fb43cc336e04dee181cfdfc0cd..9ecabc2fb001ef75eb297d1ffed43205f7cc4579 100644 (file)
@@ -31,9 +31,9 @@ function libertree_jot_nets(&$a,&$b) {
     if(! local_user())
         return;
 
-    $ltree_post = PConfig::get(local_user(),'libertree','post');
+    $ltree_post = get_pconfig(local_user(),'libertree','post');
     if(intval($ltree_post) == 1) {
-        $ltree_defpost = PConfig::get(local_user(),'libertree','post_by_default');
+        $ltree_defpost = get_pconfig(local_user(),'libertree','post_by_default');
         $selected = ((intval($ltree_defpost) == 1) ? ' checked="checked" ' : '');
         $b .= '<div class="profile-jot-net"><input type="checkbox" name="libertree_enable"' . $selected . ' value="1" /> '
             . L10n::t('Post to libertree') . '</div>';
@@ -52,16 +52,16 @@ function libertree_settings(&$a,&$s) {
 
     /* Get the current state of our config variables */
 
-    $enabled = PConfig::get(local_user(),'libertree','post');
+    $enabled = get_pconfig(local_user(),'libertree','post');
     $checked = (($enabled) ? ' checked="checked" ' : '');
     $css = (($enabled) ? '' : '-disabled');
 
-    $def_enabled = PConfig::get(local_user(),'libertree','post_by_default');
+    $def_enabled = get_pconfig(local_user(),'libertree','post_by_default');
 
     $def_checked = (($def_enabled) ? ' checked="checked" ' : '');
 
-    $ltree_api_token = PConfig::get(local_user(), 'libertree', 'libertree_api_token');
-    $ltree_url = PConfig::get(local_user(), 'libertree', 'libertree_url');
+    $ltree_api_token = get_pconfig(local_user(), 'libertree', 'libertree_api_token');
+    $ltree_url = get_pconfig(local_user(), 'libertree', 'libertree_url');
 
 
     /* Add some HTML to the existing form */
@@ -105,10 +105,10 @@ function libertree_settings_post(&$a,&$b) {
 
        if(x($_POST,'libertree-submit')) {
 
-               PConfig::set(local_user(),'libertree','post',intval($_POST['libertree']));
-               PConfig::set(local_user(),'libertree','post_by_default',intval($_POST['libertree_bydefault']));
-               PConfig::set(local_user(),'libertree','libertree_api_token',trim($_POST['libertree_api_token']));
-               PConfig::set(local_user(),'libertree','libertree_url',trim($_POST['libertree_url']));
+               set_pconfig(local_user(),'libertree','post',intval($_POST['libertree']));
+               set_pconfig(local_user(),'libertree','post_by_default',intval($_POST['libertree_bydefault']));
+               set_pconfig(local_user(),'libertree','libertree_api_token',trim($_POST['libertree_api_token']));
+               set_pconfig(local_user(),'libertree','libertree_url',trim($_POST['libertree_url']));
 
        }
 
@@ -130,11 +130,11 @@ function libertree_post_local(&$a,&$b) {
                return;
        }
 
-       $ltree_post   = intval(PConfig::get(local_user(),'libertree','post'));
+       $ltree_post   = intval(get_pconfig(local_user(),'libertree','post'));
 
        $ltree_enable = (($ltree_post && x($_REQUEST,'libertree_enable')) ? intval($_REQUEST['libertree_enable']) : 0);
 
-       if ($b['api_source'] && intval(PConfig::get(local_user(),'libertree','post_by_default'))) {
+       if ($b['api_source'] && intval(get_pconfig(local_user(),'libertree','post_by_default'))) {
                $ltree_enable = 1;
        }
 
@@ -156,27 +156,18 @@ function libertree_send(&$a,&$b) {
 
        logger('libertree_send: invoked');
 
-       if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) {
-               return;
-       }
+    if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
+        return;
 
-       if (! strstr($b['postopts'],'libertree')) {
-               return;
-       }
+    if(! strstr($b['postopts'],'libertree'))
+        return;
 
-       if ($b['parent'] != $b['id']) {
-               return;
-       }
+    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;
-       }
 
-       $ltree_api_token = PConfig::get($b['uid'],'libertree','libertree_api_token');
-       $ltree_url = PConfig::get($b['uid'],'libertree','libertree_url');
+       $ltree_api_token = get_pconfig($b['uid'],'libertree','libertree_api_token');
+       $ltree_url = get_pconfig($b['uid'],'libertree','libertree_url');
        $ltree_blog = "$ltree_url/api/v1/posts/create/?token=$ltree_api_token";
        $ltree_source = $a->get_hostname();
 
@@ -186,7 +177,7 @@ function libertree_send(&$a,&$b) {
        if($ltree_url && $ltree_api_token && $ltree_blog && $ltree_source) {
 
                require_once('include/bb2diaspora.php');
-               $tag_arr = [];
+               $tag_arr = array();
                $tags = '';
                $x = preg_match_all('/\#\[(.*?)\](.*?)\[/',$b['tag'],$matches,PREG_SET_ORDER);
 
@@ -224,11 +215,11 @@ function libertree_send(&$a,&$b) {
                        $body = "## ".html_entity_decode($title)."\n\n".$body;
 
 
-               $params = [
+               $params = array(
                        'text' => $body,
                        'source' => $ltree_source
                //      'token' => $ltree_api_token
-               ];
+               );
 
                $result = Network::post($ltree_blog, $params);
                logger('libertree: ' . $result);
index dd1d613f0d31e7f2fc44f784451116beb3df32bc..133b8a8f1a0cff371a6a549b4fcf39dc48012e8f 100644 (file)
@@ -45,7 +45,7 @@ function libravatar_lookup($a, &$b)
 
        if (! $default_avatar) {
                // if not set, look up if there was one from the gravatar addon
-               $default_avatar = Config::get('gravatar', 'default_img');
+               $default_avatar = get_config('gravatar', 'default_img');
                // setting default avatar if nothing configured
                if (!$default_avatar) {
                        $default_avatar = 'identicon'; // default image will be a random pattern
@@ -69,7 +69,7 @@ function libravatar_addon_admin(&$a, &$o)
 {
        $t = get_markup_template("admin.tpl", "addon/libravatar");
 
-       $default_avatar = Config::get('libravatar', 'default_img');
+       $default_avatar = get_config('libravatar', 'default_img');
 
        // set default values for first configuration
        if (!$default_avatar) {
index ec99f9ba9361585971ed4b12810d44230fd67828..7cfba81ed5074d1a12bb335982fe65c245488b4c 100644 (file)
@@ -37,9 +37,9 @@ function ljpost_jot_nets(&$a,&$b) {
     if(! local_user())
         return;
 
-    $lj_post = PConfig::get(local_user(),'ljpost','post');
+    $lj_post = get_pconfig(local_user(),'ljpost','post');
     if(intval($lj_post) == 1) {
-        $lj_defpost = PConfig::get(local_user(),'ljpost','post_by_default');
+        $lj_defpost = get_pconfig(local_user(),'ljpost','post_by_default');
         $selected = ((intval($lj_defpost) == 1) ? ' checked="checked" ' : '');
         $b .= '<div class="profile-jot-net"><input type="checkbox" name="ljpost_enable" ' . $selected . ' value="1" /> '
             . L10n::t('Post to LiveJournal') . '</div>';
@@ -58,16 +58,16 @@ function ljpost_settings(&$a,&$s) {
 
     /* Get the current state of our config variables */
 
-    $enabled = PConfig::get(local_user(),'ljpost','post');
+    $enabled = get_pconfig(local_user(),'ljpost','post');
 
     $checked = (($enabled) ? ' checked="checked" ' : '');
 
-    $def_enabled = PConfig::get(local_user(),'ljpost','post_by_default');
+    $def_enabled = get_pconfig(local_user(),'ljpost','post_by_default');
 
     $def_checked = (($def_enabled) ? ' checked="checked" ' : '');
 
-       $lj_username = PConfig::get(local_user(), 'ljpost', 'lj_username');
-       $lj_password = PConfig::get(local_user(), 'ljpost', 'lj_password');
+       $lj_username = get_pconfig(local_user(), 'ljpost', 'lj_username');
+       $lj_password = get_pconfig(local_user(), 'ljpost', 'lj_password');
 
 
     /* Add some HTML to the existing form */
@@ -105,10 +105,10 @@ function ljpost_settings_post(&$a,&$b) {
 
        if(x($_POST,'ljpost-submit')) {
 
-               PConfig::set(local_user(),'ljpost','post',intval($_POST['ljpost']));
-               PConfig::set(local_user(),'ljpost','post_by_default',intval($_POST['lj_bydefault']));
-               PConfig::set(local_user(),'ljpost','lj_username',trim($_POST['lj_username']));
-               PConfig::set(local_user(),'ljpost','lj_password',trim($_POST['lj_password']));
+               set_pconfig(local_user(),'ljpost','post',intval($_POST['ljpost']));
+               set_pconfig(local_user(),'ljpost','post_by_default',intval($_POST['lj_bydefault']));
+               set_pconfig(local_user(),'ljpost','lj_username',trim($_POST['lj_username']));
+               set_pconfig(local_user(),'ljpost','lj_password',trim($_POST['lj_password']));
 
        }
 
@@ -127,11 +127,11 @@ function ljpost_post_local(&$a,&$b) {
        if($b['private'] || $b['parent'])
                return;
 
-    $lj_post   = intval(PConfig::get(local_user(),'ljpost','post'));
+    $lj_post   = intval(get_pconfig(local_user(),'ljpost','post'));
 
        $lj_enable = (($lj_post && x($_REQUEST,'ljpost_enable')) ? intval($_REQUEST['ljpost_enable']) : 0);
 
-       if($_REQUEST['api_source'] && intval(PConfig::get(local_user(),'ljpost','post_by_default')))
+       if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'ljpost','post_by_default')))
                $lj_enable = 1;
 
     if(! $lj_enable)
@@ -156,7 +156,7 @@ function ljpost_send(&$a,&$b) {
     if($b['parent'] != $b['id'])
         return;
 
-       // LiveJournal post in the LJ user's timezone.
+       // LiveJournal post in the LJ user's timezone. 
        // Hopefully the person's Friendica account
        // will be set to the same thing.
 
@@ -166,15 +166,15 @@ function ljpost_send(&$a,&$b) {
                intval($b['uid'])
        );
        if($x && strlen($x[0]['timezone']))
-               $tz = $x[0]['timezone'];
+               $tz = $x[0]['timezone'];        
 
-       $lj_username = xmlify(PConfig::get($b['uid'],'ljpost','lj_username'));
-       $lj_password = xmlify(PConfig::get($b['uid'],'ljpost','lj_password'));
-       $lj_journal = xmlify(PConfig::get($b['uid'],'ljpost','lj_journal'));
+       $lj_username = xmlify(get_pconfig($b['uid'],'ljpost','lj_username'));
+       $lj_password = xmlify(get_pconfig($b['uid'],'ljpost','lj_password'));
+       $lj_journal = xmlify(get_pconfig($b['uid'],'ljpost','lj_journal'));
 //     if(! $lj_journal)
 //             $lj_journal = $lj_username;
 
-       $lj_blog = xmlify(PConfig::get($b['uid'],'ljpost','lj_blog'));
+       $lj_blog = xmlify(get_pconfig($b['uid'],'ljpost','lj_blog'));
        if(! strlen($lj_blog))
                $lj_blog = xmlify('http://www.livejournal.com/interface/xmlrpc');
 
index 6c057b21b9bfa15aa1d65605242c350854b1f923..50f820e7e2d09948df9415dccbf30744031a6667 100644 (file)
@@ -21,37 +21,37 @@ function mailstream_install() {
        Addon::registerHook('post_remote_end', 'addon/mailstream/mailstream.php', 'mailstream_post_hook');
        Addon::registerHook('cron', 'addon/mailstream/mailstream.php', 'mailstream_cron');
 
-       if (Config::get('mailstream', 'dbversion') == '0.1') {
+       if (get_config('mailstream', 'dbversion') == '0.1') {
                q('ALTER TABLE `mailstream_item` DROP INDEX `uid`');
                q('ALTER TABLE `mailstream_item` DROP INDEX `contact-id`');
                q('ALTER TABLE `mailstream_item` DROP INDEX `plink`');
                q('ALTER TABLE `mailstream_item` CHANGE `plink` `uri` char(255) NOT NULL');
-               Config::set('mailstream', 'dbversion', '0.2');
+               set_config('mailstream', 'dbversion', '0.2');
        }
-       if (Config::get('mailstream', 'dbversion') == '0.2') {
+       if (get_config('mailstream', 'dbversion') == '0.2') {
                q('DELETE FROM `pconfig` WHERE `cat` = "mailstream" AND `k` = "delay"');
-               Config::set('mailstream', 'dbversion', '0.3');
+               set_config('mailstream', 'dbversion', '0.3');
        }
-       if (Config::get('mailstream', 'dbversion') == '0.3') {
+       if (get_config('mailstream', 'dbversion') == '0.3') {
                q('ALTER TABLE `mailstream_item` CHANGE `created` `created` timestamp NOT NULL DEFAULT now()');
                q('ALTER TABLE `mailstream_item` CHANGE `completed` `completed` timestamp NULL DEFAULT NULL');
-               Config::set('mailstream', 'dbversion', '0.4');
+               set_config('mailstream', 'dbversion', '0.4');
        }
-       if (Config::get('mailstream', 'dbversion') == '0.4') {
+       if (get_config('mailstream', 'dbversion') == '0.4') {
                q('ALTER TABLE `mailstream_item` CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin');
-               Config::set('mailstream', 'dbversion', '0.5');
+               set_config('mailstream', 'dbversion', '0.5');
        }
-       if (Config::get('mailstream', 'dbversion') == '0.5') {
-               Config::set('mailstream', 'dbversion', '1.0');
+       if (get_config('mailstream', 'dbversion') == '0.5') {
+               set_config('mailstream', 'dbversion', '1.0');
        }
 
-       if (Config::get('retriever', 'dbversion') != '1.0') {
+       if (get_config('retriever', 'dbversion') != '1.0') {
                $schema = file_get_contents(dirname(__file__).'/database.sql');
                $arr = explode(';', $schema);
                foreach ($arr as $a) {
                        $r = q($a);
                }
-               Config::set('mailstream', 'dbversion', '1.0');
+               set_config('mailstream', 'dbversion', '1.0');
        }
 }
 
@@ -84,7 +84,7 @@ function mailstream_addon_admin(&$a,&$o) {
 
 function mailstream_addon_admin_post ($a) {
        if (x($_POST, 'frommail')) {
-               Config::set('mailstream', 'frommail', $_POST['frommail']);
+               set_config('mailstream', 'frommail', $_POST['frommail']);
        }
 }
 
@@ -98,7 +98,7 @@ function mailstream_generate_id($a, $uri) {
 }
 
 function mailstream_post_hook(&$a, &$item) {
-       if (!PConfig::get($item['uid'], 'mailstream', 'enabled')) {
+       if (!get_pconfig($item['uid'], 'mailstream', 'enabled')) {
                return;
        }
        if (!$item['uid']) {
@@ -110,7 +110,7 @@ function mailstream_post_hook(&$a, &$item) {
        if (!$item['uri']) {
                return;
        }
-       if (PConfig::get($item['uid'], 'mailstream', 'nolikes')) {
+       if (get_pconfig($item['uid'], 'mailstream', 'nolikes')) {
                if ($item['verb'] == ACTIVITY_LIKE) {
                        return;
                }
@@ -147,10 +147,10 @@ function mailstream_get_user($uid) {
 }
 
 function mailstream_do_images($a, &$item, &$attachments) {
-       if (!PConfig::get($item['uid'], 'mailstream', 'attachimg')) {
+       if (!get_pconfig($item['uid'], 'mailstream', 'attachimg')) {
                return;
        }
-       $attachments = [];
+       $attachments = array();
        $baseurl = $a->get_baseurl();
        preg_match_all("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", $item["body"], $matches1);
        preg_match_all("/\[img\](.*?)\[\/img\]/ism", $item["body"], $matches2);
@@ -161,7 +161,7 @@ function mailstream_do_images($a, &$item, &$attachments) {
                        'data' => Network::fetchUrl($url, true, $redirects, 0, null, $cookiejar),
                        'guid' => hash("crc32", $url),
                        'filename' => basename($url),
-                       'type' => $a->get_curl_content_type()];
+                       'type' => $a->get_curl_content_type());
                if (strlen($attachments[$url]['data'])) {
                        $item['body'] = str_replace($url, 'cid:' . $attachments[$url]['guid'], $item['body']);
                        continue;
@@ -172,7 +172,7 @@ function mailstream_do_images($a, &$item, &$attachments) {
 
 function mailstream_sender($item) {
        $r = q('SELECT * FROM `contact` WHERE `id` = %d', $item['contact-id']);
-       if (DBM::is_result($r)) {
+       if (dbm::is_result($r)) {
                $contact = $r[0];
                if ($contact['name'] != $item['author-name']) {
                        return $contact['name'] . ' - ' . $item['author-name'];
@@ -213,7 +213,7 @@ function mailstream_subject($item) {
        // Don't look more than 100 levels deep for a subject, in case of loops
        for ($i = 0; ($i < 100) && $parent; $i++) {
                $r = q("SELECT `thr-parent`, `title` FROM `item` WHERE `uri` = '%s'", dbesc($parent));
-               if (!DBM::is_result($r)) {
+               if (!dbm::is_result($r)) {
                        break;
                }
                if ($r[0]['thr-parent'] === $parent) {
@@ -260,11 +260,11 @@ function mailstream_send($a, $message_id, $item, $user) {
 
        $attachments = [];
        mailstream_do_images($a, $item, $attachments);
-       $frommail = Config::get('mailstream', 'frommail');
+       $frommail = get_config('mailstream', 'frommail');
        if ($frommail == "") {
                $frommail = 'friendica@localhost.local';
        }
-       $address = PConfig::get($item['uid'], 'mailstream', 'address');
+       $address = get_pconfig($item['uid'], 'mailstream', 'address');
        if (!$address) {
                $address = $user['email'];
        }
@@ -356,8 +356,8 @@ function mailstream_addon_settings(&$a,&$s) {
        $nolikes = PConfig::get(local_user(), 'mailstream', 'nolikes');
        $attachimg= PConfig::get(local_user(), 'mailstream', 'attachimg');
        $template = get_markup_template('settings.tpl', 'addon/mailstream/');
-       $s .= replace_macros($template, [
-                                '$enabled' => [
+       $s .= replace_macros($template, array(
+                                '$enabled' => array(
                                        'mailstream_enabled',
                                        L10n::t('Enabled'),
                                        $enabled],
@@ -382,28 +382,28 @@ function mailstream_addon_settings(&$a,&$s) {
 
 function mailstream_addon_settings_post($a,$post) {
        if ($_POST['mailstream_address'] != "") {
-               PConfig::set(local_user(), 'mailstream', 'address', $_POST['mailstream_address']);
+               set_pconfig(local_user(), 'mailstream', 'address', $_POST['mailstream_address']);
        }
        else {
-               PConfig::delete(local_user(), 'mailstream', 'address');
+               del_pconfig(local_user(), 'mailstream', 'address');
        }
        if ($_POST['mailstream_nolikes']) {
-               PConfig::set(local_user(), 'mailstream', 'nolikes', $_POST['mailstream_enabled']);
+               set_pconfig(local_user(), 'mailstream', 'nolikes', $_POST['mailstream_enabled']);
        }
        else {
-               PConfig::delete(local_user(), 'mailstream', 'nolikes');
+               del_pconfig(local_user(), 'mailstream', 'nolikes');
        }
        if ($_POST['mailstream_enabled']) {
-               PConfig::set(local_user(), 'mailstream', 'enabled', $_POST['mailstream_enabled']);
+               set_pconfig(local_user(), 'mailstream', 'enabled', $_POST['mailstream_enabled']);
        }
        else {
-               PConfig::delete(local_user(), 'mailstream', 'enabled');
+               del_pconfig(local_user(), 'mailstream', 'enabled');
        }
        if ($_POST['mailstream_attachimg']) {
-               PConfig::set(local_user(), 'mailstream', 'attachimg', $_POST['mailstream_attachimg']);
+               set_pconfig(local_user(), 'mailstream', 'attachimg', $_POST['mailstream_attachimg']);
        }
        else {
-               PConfig::delete(local_user(), 'mailstream', 'attachimg');
+               del_pconfig(local_user(), 'mailstream', 'attachimg');
        }
 }
 
index d51857f3f789edca46d772c1a52ee32ca0151b1b..62c33c9c191713de4d5f5cb8547c48fea14838e2 100644 (file)
@@ -28,12 +28,12 @@ function mathjax_settings_post ($a, $post) {
     // don't check statusnet settings if statusnet submit button is not clicked
     if (!x($_POST,'mathjax-submit'))
         return;
-    PConfig::set(local_user(),'mathjax','use',intval($_POST['mathjax_use']));
+    set_pconfig(local_user(),'mathjax','use',intval($_POST['mathjax_use']));
 }
 function mathjax_settings (&$a, &$s) {
     if (! local_user())
         return;
-    $use = PConfig::get(local_user(),'mathjax','use');
+    $use = get_pconfig(local_user(),'mathjax','use');
     $usetext = (($use) ? ' checked="checked" ' : '');
     $s .= '<span id="settings_mathjax_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_mathjax_expanded\'); openClose(\'settings_mathjax_inflated\');">';
     $s .= '<h3>MathJax '.L10n::t('Settings').'</h3>';
@@ -56,14 +56,14 @@ function mathjax_settings (&$a, &$s) {
 function mathjax_page_header($a, &$b) {
     //  if the visitor of the page is not a local_user, use MathJax
     //  otherwise check the users settings.
-    $url = Config::get ('mathjax','baseurl');
+    $url = get_config ('mathjax','baseurl');
        if(! $url)
                $url = 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML';
     if (! local_user()) {
         $b .= '<script type="text/javascript" src="'.$url.'"></script>';
     } else {
-        $use = PConfig::get(local_user(),'mathjax','use');
-        if ($use) {
+        $use = get_pconfig(local_user(),'mathjax','use');
+        if ($use) { 
             $b .= '<script type="text/javascript" src="'.$url.'"></script>';
         }
     }
@@ -75,8 +75,8 @@ function mathjax_addon_admin_post (&$a) {
 }
 function mathjax_addon_admin (&$a, &$o) {
        $t = get_markup_template( "admin.tpl", "addon/mathjax/" );
-       if (Config::get('mathjax','baseurl','') == '') {
-               Config::set('mathjax','baseurl','http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML');
+       if (get_config('mathjax','baseurl','') == '') {
+               set_config('mathjax','baseurl','http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML');
        }
 
        $o = replace_macros( $t, [
diff --git a/notifyall/lang/fr/messages.po b/notifyall/lang/fr/messages.po
deleted file mode 100644 (file)
index dbc88ab..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-# ADDON notifyall
-# Copyright (C)
-# This file is distributed under the same license as the Friendica notifyall addon package.
-# 
-# 
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: \n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2016-08-14 16:41+0200\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: Thecross <louis1302@hotmail.fr>, 2017\n"
-"Language-Team: French (https://www.transifex.com/Friendica/teams/12172/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"
-
-#: notifyall.php:26
-msgid "Send email to all members"
-msgstr "Envoyer un courriel à tous les membres"
-
-#: notifyall.php:42
-#, php-format
-msgid "%s Administrator"
-msgstr ""
-
-#: notifyall.php:44
-#, php-format
-msgid "%1$s, %2$s Administrator"
-msgstr ""
-
-#: notifyall.php:60
-msgid "No recipients found."
-msgstr "Aucun destinataire trouvé."
-
-#: notifyall.php:78
-msgid "Emails sent"
-msgstr "Courriels envoyés"
-
-#: notifyall.php:86
-msgid "Send email to all members of this Friendica instance."
-msgstr "Envoyer un courriel à tous les membres de cet instance Friendica."
-
-#: notifyall.php:91
-msgid "Message subject"
-msgstr "Objet du message"
-
-#: notifyall.php:92
-msgid "Test mode (only send to administrator)"
-msgstr "Mode test (envoyer uniquement à l'administrateur)"
-
-#: notifyall.php:93
-msgid "Submit"
-msgstr "Envoyer"
diff --git a/notifyall/lang/fr/strings.php b/notifyall/lang/fr/strings.php
deleted file mode 100644 (file)
index b0fbefa..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-if(! function_exists("string_plural_select_fr")) {
-function string_plural_select_fr($n){
-       return ($n > 1);;
-}}
-;
-$a->strings["Send email to all members"] = "Envoyer un courriel à tous les membres";
-$a->strings["%s Administrator"] = "";
-$a->strings["%1\$s, %2\$s Administrator"] = "";
-$a->strings["No recipients found."] = "Aucun destinataire trouvé.";
-$a->strings["Emails sent"] = "Courriels envoyés";
-$a->strings["Send email to all members of this Friendica instance."] = "Envoyer un courriel à tous les membres de cet instance Friendica.";
-$a->strings["Message subject"] = "Objet du message";
-$a->strings["Test mode (only send to administrator)"] = "Mode test (envoyer uniquement à l'administrateur)";
-$a->strings["Submit"] = "Envoyer";
index 5ea0db38c614749007d33a81d8254a16713d6642..c49128319f3ce102340e7316bbe514efafd315b4 100644 (file)
@@ -55,11 +55,13 @@ function notifyall_post(&$a) {
 
        $htmlversion = BBCode::convert(stripslashes(str_replace(["\\r", "\\n"], ["", "<br />\n"], $text)));
 
+       $htmlversion = bbcode(stripslashes(str_replace(array("\\r","\\n"), array("","<br />\n"),$text)));
+       
        // if this is a test, send it only to the admin(s)
        // admin_email might be a comma separated list, but we need "a@b','c@d','e@f
        if (intval($_REQUEST['test'])) {
                $email = $a->config['admin_email'];
-               $email = "'" . str_replace([" ",","], ["","','"], $email) . "'";
+               $email = "'" . str_replace(array(" ",","), array("","','"), $email) . "'";
        }
        $sql_extra = ((intval($_REQUEST['test'])) ? sprintf(" AND `email` in ( %s )", $email) : '');
 
@@ -79,7 +81,7 @@ function notifyall_post(&$a) {
                        'messageSubject'       => $subject,
                        'htmlVersion'          => $htmlversion,
                        'textVersion'          => $textversion
-               ]);
+               ));
        }
 
        notice(L10n::t('Emails sent'));
index 93782878a246e6dea1a993d2449183c70b34ab66..fb32717965c2ed79453014694c9b9c0d756c3087 100644 (file)
@@ -32,11 +32,10 @@ function notimeline_settings_post($a, $post)
        info(L10n::t('No Timeline settings updated.') . EOL);
 }
 
-function notimeline_settings(&$a, &$s)
-{
-       if (! local_user()) {
+function notimeline_settings(&$a,&$s) {
+
+       if(! local_user())
                return;
-       }
 
        /* Add our stylesheet to the page so we can make our settings look nice */
 
@@ -44,7 +43,9 @@ function notimeline_settings(&$a, &$s)
 
        /* Get the current state of our config variable */
 
-       $notimeline = PConfig::get(local_user(), 'system', 'no_wall_archive_widget', false);
+       $notimeline = get_pconfig(local_user(),'system','no_wall_archive_widget');
+       if($notimeline === false)
+               $notimeline = false;
 
        $notimeline_checked = (($notimeline) ? ' checked="checked" ' : '');
 
index 836f6541f9b5825c93cad706a02708ebadc6d197..74c64cbe07a099ec28aa662bc87bda11dcce898c 100644 (file)
@@ -4,7 +4,7 @@
  * Description: Collapse posts with inappropriate content
  * Version: 1.0
  * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
- *
+ * 
  */
 use Friendica\Core\Addon;
 use Friendica\Core\L10n;
@@ -25,8 +25,8 @@ function nsfw_uninstall()
        Addon::unregisterHook('addon_settings_post', 'addon/nsfw/nsfw.php', 'nsfw_addon_settings_post');
 }
 
-// This function isn't perfect and isn't trying to preserve the html structure - it's just a
-// quick and dirty filter to pull out embedded photo blobs because 'nsfw' seems to come up
+// This function isn't perfect and isn't trying to preserve the html structure - it's just a 
+// quick and dirty filter to pull out embedded photo blobs because 'nsfw' seems to come up 
 // inside them quite often. We don't need anything fancy, just pull out the data blob so we can
 // check against the rest of the body.
 
@@ -158,8 +158,8 @@ function nsfw_prepare_body(&$a, &$b)
                                                }
                                        }
                                }
-                       }
-               }
+                       } 
+               }               
        }
 
        if ($found) {
diff --git a/numfriends/lang/fr/messages.po b/numfriends/lang/fr/messages.po
deleted file mode 100644 (file)
index 31f3220..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-# ADDON numfriends
-# Copyright (C)
-# This file is distributed under the same license as the Friendica numfriends addon package.
-# 
-# 
-# Translators:
-# Thecross, 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-12-09 23:22+0000\n"
-"Last-Translator: Thecross\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"
-
-#: numfriends.php:46
-msgid "Numfriends settings updated."
-msgstr "Configuration de Numfriends mise à jour."
-
-#: numfriends.php:77
-msgid "Numfriends Settings"
-msgstr "Réglages de Numfriends"
-
-#: numfriends.php:79
-msgid "How many contacts to display on profile sidebar"
-msgstr "Nombre de contacts à afficher dans le volet de profil"
-
-#: numfriends.php:85
-msgid "Submit"
-msgstr "Appliquer"
index 84ec8c8d19dff51398839b892342d27af5a3cc81..447ae3669a58fddccd5c85801c74332eed91abdf 100644 (file)
@@ -1,11 +1,6 @@
-<?php
-
-if(! function_exists("string_plural_select_fr")) {
-function string_plural_select_fr($n){
-       return ($n > 1);;
-}}
-;
-$a->strings["Numfriends settings updated."] = "Configuration de Numfriends mise à jour.";
-$a->strings["Numfriends Settings"] = "Réglages de Numfriends";
-$a->strings["How many contacts to display on profile sidebar"] = "Nombre de contacts à afficher dans le volet de profil";
-$a->strings["Submit"] = "Appliquer";
+<?php\r
+\r
+$a->strings["Numfriends settings updated."] = "Réglages numfriends sauvés.";\r
+$a->strings["Numfriends Settings"] = "Réglages de numfriends";\r
+$a->strings["How many contacts to display on profile sidebar"] = "Nombre de contacts à montrer sur le panneau latéral du profil";\r
+$a->strings["Submit"] = "Envoyer";\r
index 247c7dc7593e98aa9fa66e4ba42c12e12b7cd55c..7acb914dc7d6a7df820a712d92dd987a7ddba3cf 100644 (file)
@@ -54,7 +54,6 @@ function numfriends_settings(&$a, &$s)
 {
        if (! local_user()) {
                return;
-       }
 
        /* Add our stylesheet to the page so we can make our settings look nice */
 
@@ -62,7 +61,9 @@ function numfriends_settings(&$a, &$s)
 
        /* Get the current state of our config variable */
 
-       $numfriends = PConfig::get(local_user(), 'system', 'display_friend_count', 24);
+       $numfriends = get_pconfig(local_user(),'system','display_friend_count');
+       if($numfriends === false)
+               $numfriends = 24;
        
        /* Add some HTML to the existing form */
 
index 974be0a0a0c651488cb486526d324157f3d2f9a3..bfe960fad5e347fcec2b0c3595a977919f78019e 100644 (file)
@@ -42,8 +42,7 @@ function openstreetmap_uninstall()
        logger("removed openstreetmap");
 }
 
-function openstreetmap_alterheader($a, &$navHtml)
-{
+function openstreetmap_alterheader($a, &$navHtml) {
        $addScriptTag = '<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/openstreetmap/openstreetmap.js"></script>' . "\r\n";
        $a->page['htmlhead'] .= $addScriptTag;
 }
@@ -53,7 +52,7 @@ function openstreetmap_alterheader($a, &$navHtml)
  *
  * If an item has coordinates add link to a tile map server, e.g. openstreetmap.org.
  * If an item has a location open it with the help of OSM's Nominatim reverse geocode search.
- *
+ * 
  * @param mixed $a
  * @param array& $item
  */
@@ -61,7 +60,6 @@ function openstreetmap_location($a, &$item)
 {
        if (!(strlen($item['location']) || strlen($item['coord']))) {
                return;
-       }
 
        /*
         * Get the configuration variables from the config.
@@ -94,15 +92,13 @@ function openstreetmap_location($a, &$item)
                }
        }
 
-       if ($target == "") {
+       if ($target == "")
                $target = $nomserver.'?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>';
 }
@@ -216,3 +212,5 @@ function openstreetmap_addon_admin_post(&$a)
 
        info(L10n::t('Settings updated.') . EOL);
 }
+
+
index 8b3282fb77a9fc5eff2d87a9bf9f25dfb2216ca5..24608edb7622fbddaf11213c8f22db2a0be06a6f 100644 (file)
@@ -17,7 +17,7 @@
 
 .pageheader {
     text-align: center;
-       width: 100%;
+       width 100%;
        margin-top: 25px;
        font-size: 20px;
 }
index eb121fb53638d60cc980ac8e271c63562a29fffd..6a99d64c932bd64103650587f269552c6c9a34c4 100644 (file)
@@ -44,7 +44,7 @@ function pageheader_addon_settings(&$a,&$s) {
     $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . $a->get_baseurl() . '/addon/pageheader/pageheader.css' . '" media="all" />' . "\r\n";
 
 
-       $words = Config::get('pageheader','text');
+       $words = get_config('pageheader','text');
        if(! $words)
                $words = '';
 
@@ -75,7 +75,7 @@ function pageheader_fetch($a,&$b) {
        if(file_exists('pageheader.html')){
                $s = file_get_contents('pageheader.html');
        } else {
-               $s = Config::get('pageheader', 'text');
+               $s = get_config('pageheader', 'text');
        }
 
     $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'
index bbec1f6fc5f3853342635a233a950e5130340409..213125d2779879015859745306440bd438c239aa 100644 (file)
@@ -57,10 +57,10 @@ function piwik_analytics($a,&$b) {
        /*
         *   Get the configuration variables from the .htconfig file.
         */
-       $baseurl = Config::get('piwik','baseurl');
-       $siteid  = Config::get('piwik','siteid');
-       $optout  = Config::get('piwik','optout');
-       $async   = Config::get('piwik','async');
+       $baseurl = get_config('piwik','baseurl');
+       $siteid  = get_config('piwik','siteid');
+       $optout  = get_config('piwik','optout');
+       $async   = get_config('piwik','async');
 
        /*
         *   Add the Piwik tracking code for the site.
index cb4e7631981fa0e051105ec2bf55e2aec9999320..067db51d6132e2f82d14604282a8e480bf2f314d 100644 (file)
@@ -80,7 +80,7 @@ function planets_post_hook($a, &$item) {
 
        /* Retrieve our personal config setting */
 
-       $active = PConfig::get(local_user(), 'planets', 'enable');
+       $active = get_pconfig(local_user(), 'planets', 'enable');
 
        if(! $active)
                return;
@@ -94,7 +94,7 @@ function planets_post_hook($a, &$item) {
         *
         */
 
-       $planets = ['Alderaan','Tatooine','Dagobah','Polis Massa','Coruscant','Hoth','Endor','Kamino','Rattatak','Mustafar','Iego','Geonosis','Felucia','Dantooine','Ansion','Artaru','Bespin','Boz Pity','Cato Neimoidia','Christophsis','Kashyyyk','Kessel','Malastare','Mygeeto','Nar Shaddaa','Ord Mantell','Saleucami','Subterrel','Death Star','Teth','Tund','Utapau','Yavin'];
+       $planets = array('Alderaan','Tatooine','Dagobah','Polis Massa','Coruscant','Hoth','Endor','Kamino','Rattatak','Mustafar','Iego','Geonosis','Felucia','Dantooine','Ansion','Artaru','Bespin','Boz Pity','Cato Neimoidia','Christophsis','Kashyyyk','Kessel','Malastare','Mygeeto','Nar Shaddaa','Ord Mantell','Saleucami','Subterrel','Death Star','Teth','Tund','Utapau','Yavin');
 
        $planet = array_rand($planets,1);
        $item['location'] = $planets[$planet];
@@ -118,7 +118,7 @@ function planets_settings_post($a,$post) {
        if(! local_user())
                return;
        if($_POST['planets-submit'])
-               PConfig::set(local_user(),'planets','enable',intval($_POST['planets']));
+               set_pconfig(local_user(),'planets','enable',intval($_POST['planets']));
 }
 
 
@@ -142,7 +142,7 @@ function planets_settings(&$a,&$s) {
 
        /* Get the current state of our config variable */
 
-       $enabled = PConfig::get(local_user(),'planets','enable');
+       $enabled = get_pconfig(local_user(),'planets','enable');
 
        $checked = (($enabled) ? ' checked="checked" ' : '');
 
index 5195871cff12dce08adbbab34d9b0a0f4a580496..9cb9896d34344c31ffdc9b0b0307781793b21db6 100644 (file)
@@ -22,7 +22,7 @@
 
 .pledgie {
     text-align: center;
-       width: 100%;
+       width 100%;
        margin-top: 25px;
        font-size: 20px;
 }
index 8b736d8b9d48d13a05325d6f8772a9ff374b9f2d..1df9c8598da79fa3fda88744e613459a588bef0a 100644 (file)
@@ -32,8 +32,8 @@ function pledgie_addon_settings(&$a,&$s) {
 
        $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . $a->get_baseurl() . '/addon/pledgie/pledgie.css' . '" media="all" />' . "\r\n";
 
-       $campaign = Config::get('pledgie-campaign','text');
-       $describe = Config::get('pledgie-describe','text');
+       $campaign = get_config('pledgie-campaign','text');
+       $describe = get_config('pledgie-describe','text');
        
        if(! $campaign)
                $campaign = '';
@@ -71,8 +71,8 @@ function pledgie_addon_settings_post(&$a,&$b) {
 }
 
 function pledgie_active(&$a,&$b) {
-       $campaign = Config::get('pledgie-campaign','text');
-       $describe = Config::get('pledgie-describe','text');
+       $campaign = get_config('pledgie-campaign','text');
+       $describe = get_config('pledgie-describe','text');
        $b .= '<div style="position: fixed; padding:5px; border-style:dotted; border-width:1px; background-color: white; line-height: 1; bottom: 5px; left: 20px; z-index: 1000; width: 150px; font-size: 12px;">';
        $b .= $describe . '<br/><a href="https://pledgie.com/campaigns/';
        $b .= $campaign;
diff --git a/poormancron/lang/C/messages.po b/poormancron/lang/C/messages.po
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/poormancron/poormancron.php b/poormancron/poormancron.php
new file mode 100644 (file)
index 0000000..493f0f1
--- /dev/null
@@ -0,0 +1,69 @@
+<?php
+/**
+ * Name: Poor Man Cron
+ * Description: Execute updates on pageviews, without the need of commandline php - only for use in total desperation as page loads will take forever
+ * Version: 1.2
+ * Author: Fabio Comuni <http://kirgroup.com/profile/fabrix>
+ * Status: Unsupported
+ */
+
+function poormancron_install() {
+       // check for command line php
+       $a = get_app();
+       $ex = Array();
+       $ex[0] = ((x($a->config,'php_path')) && (strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
+       $ex[1] = dirname(dirname(dirname(__file__)))."/testargs.php";
+       $ex[2] = "test";
+       $out = exec(implode(" ", $ex));
+       if ($out==="test") {
+               set_config('poormancron','usecli',1);
+               logger("poormancron will use cli php");
+       } else {
+               set_config('poormancron','usecli',0);
+               logger("poormancron will NOT use cli php");
+       }
+       
+       register_hook('page_end', 'addon/poormancron/poormancron.php', 'poormancron_hook');
+       register_hook('proc_run', 'addon/poormancron/poormancron.php','poormancron_procrun');
+       logger("installed poormancron");
+}
+
+function poormancron_uninstall() {
+       unregister_hook('page_end', 'addon/poormancron/poormancron.php', 'poormancron_hook');
+       unregister_hook('proc_run', 'addon/poormancron/poormancron.php','poormancron_procrun');
+       logger("removed poormancron");
+}
+
+
+
+function poormancron_hook(&$a,&$b) {
+       return; // deactivated
+
+       //$now = time();
+       //$lastupdate = get_config('poormancron', 'lastupdate');
+
+       // 300 secs, 5 mins
+       //if (!$lastupdate || ($now-$lastupdate)>300) {
+       //      set_config('poormancron','lastupdate', $now);
+       //      proc_run('php',"include/poller.php");
+       //}
+}
+
+function poormancron_procrun(&$a, &$arr) {
+       return; // deactivated
+
+       if (get_config('poormancron','usecli')==1) return;
+       $argv = $arr['args'];
+       $arr['run_cmd'] = false;
+       logger("poormancron procrun ".implode(", ",$argv));
+       array_shift($argv);
+       $argc = count($argv);
+       logger("poormancron procrun require_once ".basename($argv[0]));
+       require_once(basename($argv[0]));
+       $funcname=str_replace(".php", "", basename($argv[0]))."_run";
+  
+       $funcname($argv, $argc);
+}
+
+
+?>
diff --git a/posterous/lang/C/messages.po b/posterous/lang/C/messages.po
new file mode 100644 (file)
index 0000000..99327c2
--- /dev/null
@@ -0,0 +1,58 @@
+# ADDON posterous
+# Copyright (C) 
+# This file is distributed under the same license as the Friendica posterous 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"
+
+#: posterous.php:37
+msgid "Post to Posterous"
+msgstr ""
+
+#: posterous.php:70
+msgid "Posterous Post Settings"
+msgstr ""
+
+#: posterous.php:72
+msgid "Enable Posterous Post Plugin"
+msgstr ""
+
+#: posterous.php:77
+msgid "Posterous login"
+msgstr ""
+
+#: posterous.php:82
+msgid "Posterous password"
+msgstr ""
+
+#: posterous.php:87
+msgid "Posterous site ID"
+msgstr ""
+
+#: posterous.php:92
+msgid "Posterous API token"
+msgstr ""
+
+#: posterous.php:97
+msgid "Post to Posterous by default"
+msgstr ""
+
+#: posterous.php:103
+msgid "Submit"
+msgstr ""
+
+#: posterous.php:189
+msgid "Post from Friendica"
+msgstr ""
diff --git a/posterous/lang/ca/strings.php b/posterous/lang/ca/strings.php
new file mode 100644 (file)
index 0000000..ec7bedf
--- /dev/null
@@ -0,0 +1,12 @@
+<?php\r
+\r
+$a->strings["Post to Posterous"] = "enviament a Posterous";\r
+$a->strings["Posterous Post Settings"] = "Configuració d'Enviaments a Posterous";\r
+$a->strings["Enable Posterous Post Plugin"] = "Habilitar plugin d'Enviament de Posterous";\r
+$a->strings["Posterous login"] = "Inici de sessió a Posterous";\r
+$a->strings["Posterous password"] = "Contrasenya a Posterous";\r
+$a->strings["Posterous site ID"] = "ID al lloc Posterous";\r
+$a->strings["Posterous API token"] = "Posterous API token";\r
+$a->strings["Post to Posterous by default"] = "Enviar a Posterous per defecte";\r
+$a->strings["Submit"] = "Enviar";\r
+$a->strings["Post from Friendica"] = "Enviament des de Friendica";\r
diff --git a/posterous/lang/cs/strings.php b/posterous/lang/cs/strings.php
new file mode 100644 (file)
index 0000000..733ec89
--- /dev/null
@@ -0,0 +1,12 @@
+<?php\r
+\r
+$a->strings["Post to Posterous"] = "Poslat na Posterous";\r
+$a->strings["Posterous Post Settings"] = "Posterous nastavení příspěvků";\r
+$a->strings["Enable Posterous Post Plugin"] = "Umožnit Posterous Plugin";\r
+$a->strings["Posterous login"] = "Posterous login";\r
+$a->strings["Posterous password"] = "Posterous heslo";\r
+$a->strings["Posterous site ID"] = "Posterous site ID";\r
+$a->strings["Posterous API token"] = "Posterous API token";\r
+$a->strings["Post to Posterous by default"] = "Příspěvky standardně posílat na Posterous";\r
+$a->strings["Submit"] = "Odeslat";\r
+$a->strings["Post from Friendica"] = "Příspěvek z Friendica";\r
diff --git a/posterous/lang/de/strings.php b/posterous/lang/de/strings.php
new file mode 100644 (file)
index 0000000..186c53d
--- /dev/null
@@ -0,0 +1,12 @@
+<?php\r
+\r
+$a->strings["Post to Posterous"] = "Nach Posterous senden";\r
+$a->strings["Posterous Post Settings"] = "Posterous Beitrags-Einstellungen";\r
+$a->strings["Enable Posterous Post Plugin"] = "Posterous-Plugin aktivieren";\r
+$a->strings["Posterous login"] = "Posterous-Anmeldename";\r
+$a->strings["Posterous password"] = "Posterous-Passwort";\r
+$a->strings["Posterous site ID"] = "Posterous site ID";\r
+$a->strings["Posterous API token"] = "Posterous API token";\r
+$a->strings["Post to Posterous by default"] = "Veröffentliche öffentliche Beiträge standardmäßig bei Posterous";\r
+$a->strings["Submit"] = "Senden";\r
+$a->strings["Post from Friendica"] = "Beitrag via Friendica";\r
diff --git a/posterous/lang/eo/strings.php b/posterous/lang/eo/strings.php
new file mode 100644 (file)
index 0000000..06f4863
--- /dev/null
@@ -0,0 +1,12 @@
+<?php\r
+\r
+$a->strings["Post to Posterous"] = "Afiŝi al Posterous";\r
+$a->strings["Posterous Post Settings"] = "Agordoj pri afiŝoj ĉe Posterous";\r
+$a->strings["Enable Posterous Post Plugin"] = "Ŝalti la Poserous-afiŝo kromprogramon";\r
+$a->strings["Posterous login"] = "Posterous salutnomo";\r
+$a->strings["Posterous password"] = "Posterous pasvorto";\r
+$a->strings["Posterous site ID"] = "Idento de Posterous retejo";\r
+$a->strings["Posterous API token"] = "API ĵetono de Posterous retejo";\r
+$a->strings["Post to Posterous by default"] = "Defaŭlte afiŝi al Posterous";\r
+$a->strings["Submit"] = "Sendi";\r
+$a->strings["Post from Friendica"] = "Afiŝo de Friendica";\r
diff --git a/posterous/lang/es/strings.php b/posterous/lang/es/strings.php
new file mode 100644 (file)
index 0000000..9198865
--- /dev/null
@@ -0,0 +1,12 @@
+<?php\r
+\r
+$a->strings["Post to Posterous"] = "Publicar en Posterous";\r
+$a->strings["Posterous Post Settings"] = "Configuración de las publicaciones en Posterous";\r
+$a->strings["Enable Posterous Post Plugin"] = "Activar el módulo de publicación en Posterous";\r
+$a->strings["Posterous login"] = "Entrar en Posterous";\r
+$a->strings["Posterous password"] = "Contraseña de Posterous";\r
+$a->strings["Posterous site ID"] = "ID de Posterous";\r
+$a->strings["Posterous API token"] = "API de Posterous";\r
+$a->strings["Post to Posterous by default"] = "Publicar en Posterous por defecto";\r
+$a->strings["Submit"] = "Envíar";\r
+$a->strings["Post from Friendica"] = "Publicado desde Friendica";\r
diff --git a/posterous/lang/fr/strings.php b/posterous/lang/fr/strings.php
new file mode 100644 (file)
index 0000000..be14e1e
--- /dev/null
@@ -0,0 +1,12 @@
+<?php\r
+\r
+$a->strings["Post to Posterous"] = "Envoyer à Posterous";\r
+$a->strings["Posterous Post Settings"] = "Réglages de l'envoi à Posterous";\r
+$a->strings["Enable Posterous Post Plugin"] = "Activer l'envoi à Posterous";\r
+$a->strings["Posterous login"] = "Login Posterous";\r
+$a->strings["Posterous password"] = "Mot de passe";\r
+$a->strings["Posterous site ID"] = "ID du site Posterous";\r
+$a->strings["Posterous API token"] = "Clé d'API Posterous";\r
+$a->strings["Post to Posterous by default"] = "Envoyer à Posterous par défaut";\r
+$a->strings["Submit"] = "Envoyer";\r
+$a->strings["Post from Friendica"] = "Publier depuis Friendica";\r
diff --git a/posterous/lang/is/strings.php b/posterous/lang/is/strings.php
new file mode 100644 (file)
index 0000000..d48afbb
--- /dev/null
@@ -0,0 +1,12 @@
+<?php\r
+\r
+$a->strings["Post to Posterous"] = "Senda færslu á Posterous";\r
+$a->strings["Posterous Post Settings"] = "Stilla Posterous Post";\r
+$a->strings["Enable Posterous Post Plugin"] = "Kveðja á Posterous Post viðbót ";\r
+$a->strings["Posterous login"] = "Posterous notendanafn";\r
+$a->strings["Posterous password"] = "Posterous aðgangsorð";\r
+$a->strings["Posterous site ID"] = "";\r
+$a->strings["Posterous API token"] = "";\r
+$a->strings["Post to Posterous by default"] = "Sjálfgefið láta færslur flæða á Posterous";\r
+$a->strings["Submit"] = "Senda inn";\r
+$a->strings["Post from Friendica"] = "Færslur frá Friendica";\r
diff --git a/posterous/lang/it/strings.php b/posterous/lang/it/strings.php
new file mode 100644 (file)
index 0000000..3c2e406
--- /dev/null
@@ -0,0 +1,12 @@
+<?php\r
+\r
+$a->strings["Post to Posterous"] = "Invia a Posterous";\r
+$a->strings["Posterous Post Settings"] = "Impostazioni di invio a Posterous";\r
+$a->strings["Enable Posterous Post Plugin"] = "Abilita il plugin di invio a Posterous";\r
+$a->strings["Posterous login"] = "Posterous login";\r
+$a->strings["Posterous password"] = "Posterous password";\r
+$a->strings["Posterous site ID"] = "";\r
+$a->strings["Posterous API token"] = "";\r
+$a->strings["Post to Posterous by default"] = "Invia sempre a Posterous";\r
+$a->strings["Submit"] = "Invia";\r
+$a->strings["Post from Friendica"] = "Messaggio da Friendica";\r
diff --git a/posterous/lang/nb-no/strings.php b/posterous/lang/nb-no/strings.php
new file mode 100644 (file)
index 0000000..64d3fb6
--- /dev/null
@@ -0,0 +1,12 @@
+<?php\r
+\r
+$a->strings["Post to Posterous"] = "";\r
+$a->strings["Posterous Post Settings"] = "";\r
+$a->strings["Enable Posterous Post Plugin"] = "";\r
+$a->strings["Posterous login"] = "";\r
+$a->strings["Posterous password"] = "";\r
+$a->strings["Posterous site ID"] = "";\r
+$a->strings["Posterous API token"] = "";\r
+$a->strings["Post to Posterous by default"] = "";\r
+$a->strings["Submit"] = "Lagre";\r
+$a->strings["Post from Friendica"] = "";\r
diff --git a/posterous/lang/pl/strings.php b/posterous/lang/pl/strings.php
new file mode 100644 (file)
index 0000000..2514fad
--- /dev/null
@@ -0,0 +1,12 @@
+<?php\r
+\r
+$a->strings["Post to Posterous"] = "";\r
+$a->strings["Posterous Post Settings"] = "";\r
+$a->strings["Enable Posterous Post Plugin"] = "";\r
+$a->strings["Posterous login"] = "";\r
+$a->strings["Posterous password"] = "";\r
+$a->strings["Posterous site ID"] = "";\r
+$a->strings["Posterous API token"] = "";\r
+$a->strings["Post to Posterous by default"] = "";\r
+$a->strings["Submit"] = "Potwierdź";\r
+$a->strings["Post from Friendica"] = "Post z Friendica";\r
diff --git a/posterous/lang/pt-br/strings.php b/posterous/lang/pt-br/strings.php
new file mode 100644 (file)
index 0000000..c2ab297
--- /dev/null
@@ -0,0 +1,12 @@
+<?php\r
+\r
+$a->strings["Post to Posterous"] = "Postar no Posterous";\r
+$a->strings["Posterous Post Settings"] = "Configurações de Postagem do Posterous";\r
+$a->strings["Enable Posterous Post Plugin"] = "Habilitar Plugin de Postagem do Posterous";\r
+$a->strings["Posterous login"] = "Login do Posterous";\r
+$a->strings["Posterous password"] = "Senha do Posterous";\r
+$a->strings["Posterous site ID"] = "";\r
+$a->strings["Posterous API token"] = "";\r
+$a->strings["Post to Posterous by default"] = "Postar para o Posterous como padrão";\r
+$a->strings["Submit"] = "Enviar";\r
+$a->strings["Post from Friendica"] = "Postar do Friendica";\r
diff --git a/posterous/lang/ru/strings.php b/posterous/lang/ru/strings.php
new file mode 100644 (file)
index 0000000..2d1268b
--- /dev/null
@@ -0,0 +1,12 @@
+<?php\r
+\r
+$a->strings["Post to Posterous"] = "";\r
+$a->strings["Posterous Post Settings"] = "";\r
+$a->strings["Enable Posterous Post Plugin"] = "Включить Posterous  плагин сообщений";\r
+$a->strings["Posterous login"] = "";\r
+$a->strings["Posterous password"] = "";\r
+$a->strings["Posterous site ID"] = "";\r
+$a->strings["Posterous API token"] = "";\r
+$a->strings["Post to Posterous by default"] = "";\r
+$a->strings["Submit"] = "Подтвердить";\r
+$a->strings["Post from Friendica"] = "Сообщение от Friendica";\r
diff --git a/posterous/lang/sv/strings.php b/posterous/lang/sv/strings.php
new file mode 100644 (file)
index 0000000..3ec569a
--- /dev/null
@@ -0,0 +1,3 @@
+<?php\r
+\r
+$a->strings["Submit"] = "Spara";\r
diff --git a/posterous/lang/zh-cn/strings.php b/posterous/lang/zh-cn/strings.php
new file mode 100644 (file)
index 0000000..ab258a2
--- /dev/null
@@ -0,0 +1,12 @@
+<?php\r
+\r
+$a->strings["Post to Posterous"] = "发送往Posterous";\r
+$a->strings["Posterous Post Settings"] = "Posterous发送设置";\r
+$a->strings["Enable Posterous Post Plugin"] = "使Posterous发送插件可用的";\r
+$a->strings["Posterous login"] = "Posterous登记名";\r
+$a->strings["Posterous password"] = "Posterous密码";\r
+$a->strings["Posterous site ID"] = "Posterous网站身份证明";\r
+$a->strings["Posterous API token"] = "Posterous API令牌";\r
+$a->strings["Post to Posterous by default"] = "默认地发送往Posterous";\r
+$a->strings["Submit"] = "提交";\r
+$a->strings["Post from Friendica"] = "文章从Friendica";\r
diff --git a/posterous/posterous.css b/posterous/posterous.css
new file mode 100644 (file)
index 0000000..0a43bf3
--- /dev/null
@@ -0,0 +1,16 @@
+
+#posterous-enable-label, #posterous-username-label, #posterous-password-label, #posterous-site_id-label, #posterous-api_token-label, #posterous-bydefault-label {
+       float: left;
+       width: 200px;
+       margin-top: 10px;
+}
+
+#posterous-checkbox, #posterous-username, #posterous-password, #posterous-site_id, #posterous-api_token, #posterous-bydefault {
+       float: left;
+       margin-top: 10px;
+}
+
+#posterous-submit {
+       margin-top: 15px;
+}
+
diff --git a/posterous/posterous.php b/posterous/posterous.php
new file mode 100644 (file)
index 0000000..76eaf77
--- /dev/null
@@ -0,0 +1,215 @@
+<?php
+
+/**
+ * Name: Posterous Post Connector
+ * Description: Post to Posterous accounts
+ * Version: 1.0
+ * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
+ * Author: Tony Baldwin <https://free-haven.org/u/tony>
+ * Status: Unsupported
+ */
+
+function posterous_install() {
+    register_hook('post_local',           'addon/posterous/posterous.php', 'posterous_post_local');
+    register_hook('notifier_normal',      'addon/posterous/posterous.php', 'posterous_send');
+    register_hook('jot_networks',         'addon/posterous/posterous.php', 'posterous_jot_nets');
+    register_hook('connector_settings',      'addon/posterous/posterous.php', 'posterous_settings');
+    register_hook('connector_settings_post', 'addon/posterous/posterous.php', 'posterous_settings_post');
+
+}
+function posterous_uninstall() {
+    unregister_hook('post_local',       'addon/posterous/posterous.php', 'posterous_post_local');
+    unregister_hook('notifier_normal',  'addon/posterous/posterous.php', 'posterous_send');
+    unregister_hook('jot_networks',     'addon/posterous/posterous.php', 'posterous_jot_nets');
+    unregister_hook('connector_settings',      'addon/posterous/posterous.php', 'posterous_settings');
+    unregister_hook('connector_settings_post', 'addon/posterous/posterous.php', 'posterous_settings_post');
+}
+
+
+function posterous_jot_nets(&$a,&$b) {
+    if(! local_user())
+        return;
+
+    $pstr_post = get_pconfig(local_user(),'posterous','post');
+    if(intval($pstr_post) == 1) {
+        $pstr_defpost = get_pconfig(local_user(),'posterous','post_by_default');
+        $selected = ((intval($pstr_defpost) == 1) ? ' checked="checked" ' : '');
+        $b .= '<div class="profile-jot-net"><input type="checkbox" name="posterous_enable"' . $selected . ' value="1" /> '
+            . t('Post to Posterous') . '</div>';
+    }
+}
+
+
+function posterous_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/posterous/posterous.css' . '" media="all" />' . "\r\n";
+
+    /* Get the current state of our config variables */
+
+    $enabled = get_pconfig(local_user(),'posterous','post');
+
+    $checked = (($enabled) ? ' checked="checked" ' : '');
+
+    $def_enabled = get_pconfig(local_user(),'posterous','post_by_default');
+
+    $def_checked = (($def_enabled) ? ' checked="checked" ' : '');
+
+       $pstr_username = get_pconfig(local_user(), 'posterous', 'posterous_username');
+       $pstr_password = get_pconfig(local_user(), 'posterous', 'posterous_password');
+       $pstr_site_id = get_pconfig(local_user(), 'posterous', 'posterous_site_id');
+       $pstr_api_token = get_pconfig(local_user(), 'posterous', 'posterous_api_token');
+
+
+    /* Add some HTML to the existing form */
+
+    $s .= '<div class="settings-block">';
+    $s .= '<h3>' . t('Posterous Post Settings') . '</h3>';
+    $s .= '<div id="posterous-enable-wrapper">';
+    $s .= '<label id="posterous-enable-label" for="posterous-checkbox">' . t('Enable Posterous Post Plugin') . '</label>';
+    $s .= '<input id="posterous-checkbox" type="checkbox" name="posterous" value="1" ' . $checked . '/>';
+    $s .= '</div><div class="clear"></div>';
+
+    $s .= '<div id="posterous-username-wrapper">';
+    $s .= '<label id="posterous-username-label" for="posterous-username">' . t('Posterous login') . '</label>';
+    $s .= '<input id="posterous-username" type="text" name="posterous_username" value="' . $pstr_username . '" />';
+    $s .= '</div><div class="clear"></div>';
+
+    $s .= '<div id="posterous-password-wrapper">';
+    $s .= '<label id="posterous-password-label" for="posterous-password">' . t('Posterous password') . '</label>';
+    $s .= '<input id="posterous-password" type="password" name="posterous_password" value="' . $pstr_password . '" />';
+    $s .= '</div><div class="clear"></div>';
+
+    $s .= '<div id="posterous-site_id-wrapper">';
+    $s .= '<label id="posterous-site_id-label" for="posterous-site_id">' . t('Posterous site ID') . '</label>';
+    $s .= '<input id="posterous-site_id" type="text" name="posterous_site_id" value="' . $pstr_site_id . '" />';
+    $s .= '</div><div class="clear"></div>';
+
+    $s .= '<div id="posterous-api_token-wrapper">';
+    $s .= '<label id="posterous-api_token-label" for="posterous-api_token">' . t('Posterous API token') . '</label>';
+    $s .= '<input id="posterous-api_token" type="text" name="posterous_api_token" value="' . $pstr_api_token . '" />';
+    $s .= '</div><div class="clear"></div>';
+
+    $s .= '<div id="posterous-bydefault-wrapper">';
+    $s .= '<label id="posterous-bydefault-label" for="posterous-bydefault">' . t('Post to Posterous by default') . '</label>';
+    $s .= '<input id="posterous-bydefault" type="checkbox" name="posterous_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="posterous-submit" name="posterous-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>';
+
+}
+
+
+function posterous_settings_post(&$a,&$b) {
+
+       if(x($_POST,'posterous-submit')) {
+
+               set_pconfig(local_user(),'posterous','post',intval($_POST['posterous']));
+               set_pconfig(local_user(),'posterous','post_by_default',intval($_POST['posterous_bydefault']));
+               set_pconfig(local_user(),'posterous','posterous_username',trim($_POST['posterous_username']));
+               set_pconfig(local_user(),'posterous','posterous_password',trim($_POST['posterous_password']));
+               set_pconfig(local_user(),'posterous','posterous_site_id',trim($_POST['posterous_site_id']));
+               set_pconfig(local_user(),'posterous','posterous_api_token',trim($_POST['posterous_api_token']));
+
+       }
+
+}
+
+function posterous_post_local(&$a,&$b) {
+
+       // This can probably be changed to allow editing by pointing to a different API endpoint
+
+       if($b['edit'])
+               return;
+
+       if((! local_user()) || (local_user() != $b['uid']))
+               return;
+
+       if($b['private'] || $b['parent'])
+               return;
+
+    $pstr_post   = intval(get_pconfig(local_user(),'posterous','post'));
+
+       $pstr_enable = (($pstr_post && x($_REQUEST,'posterous_enable')) ? intval($_REQUEST['posterous_enable']) : 0);
+
+       if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'posterous','post_by_default')))
+               $pstr_enable = 1;
+
+    if(! $pstr_enable)
+       return;
+
+    if(strlen($b['postopts']))
+       $b['postopts'] .= ',';
+     $b['postopts'] .= 'posterous';
+}
+
+
+
+
+function posterous_send(&$a,&$b) {
+
+    if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
+        return;
+
+    if(! strstr($b['postopts'],'posterous'))
+        return;
+
+    if($b['parent'] != $b['id'])
+        return;
+
+
+       $pstr_username = get_pconfig($b['uid'],'posterous','posterous_username');
+       $pstr_password = get_pconfig($b['uid'],'posterous','posterous_password');
+       $pstr_site_id = get_pconfig($b['uid'],'posterous','posterous_site_id');
+       $pstr_blog = "http://posterous.com/api/2/sites/$pstr_site_id/posts";
+       $pstr_api_token = get_pconfig($b['uid'],'posterous','posterous_api_token');
+
+       if($pstr_username && $pstr_password && $pstr_blog) {
+
+               require_once('include/bbcode.php');
+               $tag_arr = array();
+               $tags = '';
+               $x = preg_match_all('/\#\[(.*?)\](.*?)\[/',$b['tag'],$matches,PREG_SET_ORDER);
+
+               if($x) {
+                       foreach($matches as $mtch) {
+                               $tag_arr[] = $mtch[2];
+                       }
+               }
+               if(count($tag_arr))
+                       $tags = implode(',',$tag_arr);          
+
+
+               $params = array(
+                       'post[title]' => (($b['title']) ? $b['title'] : t('Post from Friendica')),
+                       'post[source]' => 'Friendica',
+                       'post[tags]' => $tags,
+                       'post[body]' => bbcode($b['body']),
+                       'api_token' => $pstr_api_token,
+                       'site_id' => $pstr_site_id
+               );
+       
+               $ch = curl_init();
+               curl_setopt($ch, CURLOPT_URL, $pstr_blog);
+               curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+               curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
+               curl_setopt($ch, CURLOPT_HEADER, false);
+               curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
+               curl_setopt($ch, CURLOPT_USERPWD, $pstr_username . ':' . $pstr_password);
+               curl_setopt($ch, CURLOPT_POST, true);
+               curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
+
+               $data = curl_exec($ch);
+               $result = curl_multi_getcontent($ch);
+               curl_close($ch);
+
+               logger('posterous_send: ' . $result);
+       }
+}
+
diff --git a/procrunner/lang/C/messages.po b/procrunner/lang/C/messages.po
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/procrunner/procrunner.php b/procrunner/procrunner.php
new file mode 100644 (file)
index 0000000..12f8f41
--- /dev/null
@@ -0,0 +1,55 @@
+<?php
+/**
+ * Name: Proc Runner
+ * Description: Derivative of poormancron when proc_open() and exec() are disabled
+ * Version: 1.0
+ * Author: Fabio Comuni <http://kirgroup.com/profile/fabrix>
+ * Author: Mike Macgirvin
+ * Status: Unsupported
+ */
+
+function procrunner_install() {
+
+       $addons = get_config('system','addon');
+       if(strstr('poormancron',$addons)) {
+               logger('procrunner incompatible with poormancron. Not installing procrunner.');
+               return;
+       }
+
+       // check for command line php
+       $a = get_app();
+       $ex = Array();
+       $ex[0] = ((x($a->config,'php_path')) && (strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
+       $ex[1] = dirname(dirname(dirname(__file__)))."/testargs.php";
+       $ex[2] = "test";
+       $out = exec(implode(" ", $ex));
+       if ($out==="test") {
+               logger('procrunner not required on this system. Not installing.');
+               return;
+       } else {
+               register_hook('proc_run', 'addon/procrunner/procrunner.php','procrunner_procrun');
+               logger("installed procrunner");
+       }
+       
+}
+
+function procrunner_uninstall() {
+       unregister_hook('proc_run', 'addon/procrunner/procrunner.php','procrunner_procrun');
+       logger("removed procrunner");
+}
+
+
+
+function procrunner_procrun(&$a, &$arr) {
+       return; // deactivated
+
+       $argv = $arr['args'];
+       $arr['run_cmd'] = false;
+       logger("procrunner procrun ".implode(", ",$argv));
+       array_shift($argv);
+       $argc = count($argv);
+       logger("procrunner procrun require_once ".basename($argv[0]));
+       require_once(basename($argv[0]));
+       $funcname=str_replace(".php", "", basename($argv[0]))."_run";  
+       $funcname($argv, $argc);
+}
index cfcb8fd74fe52ed7d5f05fa119dbf51daa98a16a..f6eb03e6a951c4c754d982b28f39970d2dd0e71a 100644 (file)
@@ -64,7 +64,7 @@ function public_server_cron($a, $b)
                                'source_name'  => L10n::t('Administrator'),
                                'source_link'  => $a->get_baseurl(),
                                'source_photo' => $a->get_baseurl() . '/images/person-80.jpg',
-                       ]);
+                       ));
 
                        $fields = ['expire_notification_sent' => DateTimeFormat::utcNow()];
                        dba::update('user', $fields, ['uid' => $rr['uid']]);
index a1ca2ade7dec6f125c2b76ade46fb17ddf8f7468..05ab4626e99f307975c05d9c28463cd6349d4437 100644 (file)
@@ -78,8 +78,8 @@ function pumpio_content(&$a) {
 }
 
 function pumpio_check_item_notification($a, &$notification_data) {
-       $hostname = PConfig::get($notification_data["uid"], 'pumpio','host');
-       $username = PConfig::get($notification_data["uid"], "pumpio", "user");
+       $hostname = get_pconfig($notification_data["uid"], 'pumpio','host');
+       $username = get_pconfig($notification_data["uid"], "pumpio", "user");
 
         $notification_data["profiles"][] = "https://".$hostname."/".$username;
 }
@@ -89,9 +89,9 @@ function pumpio_registerclient(&$a, $host) {
 
        $url = "https://".$host."/api/client/register";
 
-       $params = [];
+       $params = array();
 
-       $application_name  = Config::get('pumpio', 'application_name');
+       $application_name  = get_config('pumpio', 'application_name');
 
        if ($application_name == "")
                $application_name = $a->get_hostname();
@@ -132,18 +132,18 @@ function pumpio_connect(&$a) {
        session_start();
 
        // Define the needed keys
-       $consumer_key = PConfig::get(local_user(), 'pumpio','consumer_key');
-       $consumer_secret = PConfig::get(local_user(), 'pumpio','consumer_secret');
-       $hostname = PConfig::get(local_user(), 'pumpio','host');
+       $consumer_key = get_pconfig(local_user(), 'pumpio','consumer_key');
+       $consumer_secret = get_pconfig(local_user(), 'pumpio','consumer_secret');
+       $hostname = get_pconfig(local_user(), 'pumpio','host');
 
        if ((($consumer_key == "") || ($consumer_secret == "")) && ($hostname != "")) {
                logger("pumpio_connect: register client");
                $clientdata = pumpio_registerclient($a, $hostname);
-               PConfig::set(local_user(), 'pumpio','consumer_key', $clientdata->client_id);
-               PConfig::set(local_user(), 'pumpio','consumer_secret', $clientdata->client_secret);
+               set_pconfig(local_user(), 'pumpio','consumer_key', $clientdata->client_id);
+               set_pconfig(local_user(), 'pumpio','consumer_secret', $clientdata->client_secret);
 
-               $consumer_key = PConfig::get(local_user(), 'pumpio','consumer_key');
-               $consumer_secret = PConfig::get(local_user(), 'pumpio','consumer_secret');
+               $consumer_key = get_pconfig(local_user(), 'pumpio','consumer_key');
+               $consumer_secret = get_pconfig(local_user(), 'pumpio','consumer_secret');
 
                logger("pumpio_connect: ckey: ".$consumer_key." csecrect: ".$consumer_secret, LOGGER_DEBUG);
        }
@@ -180,8 +180,8 @@ function pumpio_connect(&$a) {
                if (($success = $client->Process())) {
                        if (strlen($client->access_token)) {
                                logger("pumpio_connect: otoken: ".$client->access_token." osecrect: ".$client->access_token_secret, LOGGER_DEBUG);
-                               PConfig::set(local_user(), "pumpio", "oauth_token", $client->access_token);
-                               PConfig::set(local_user(), "pumpio", "oauth_token_secret", $client->access_token_secret);
+                               set_pconfig(local_user(), "pumpio", "oauth_token", $client->access_token);
+                               set_pconfig(local_user(), "pumpio", "oauth_token_secret", $client->access_token_secret);
                        }
                }
                $success = $client->Finalize($success);
@@ -205,9 +205,9 @@ function pumpio_jot_nets(&$a,&$b) {
        if(! local_user())
                return;
 
-       $pumpio_post = PConfig::get(local_user(),'pumpio','post');
+       $pumpio_post = get_pconfig(local_user(),'pumpio','post');
        if(intval($pumpio_post) == 1) {
-               $pumpio_defpost = PConfig::get(local_user(),'pumpio','post_by_default');
+               $pumpio_defpost = get_pconfig(local_user(),'pumpio','post_by_default');
                $selected = ((intval($pumpio_defpost) == 1) ? ' checked="checked" ' : '');
                $b .= '<div class="profile-jot-net"><input type="checkbox" name="pumpio_enable"' . $selected . ' value="1" /> '
                        . L10n::t('Post to pumpio') . '</div>';
@@ -226,24 +226,24 @@ function pumpio_settings(&$a,&$s) {
 
        /* Get the current state of our config variables */
 
-       $import_enabled = PConfig::get(local_user(),'pumpio','import');
+       $import_enabled = get_pconfig(local_user(),'pumpio','import');
        $import_checked = (($import_enabled) ? ' checked="checked" ' : '');
 
-       $enabled = PConfig::get(local_user(),'pumpio','post');
+       $enabled = get_pconfig(local_user(),'pumpio','post');
        $checked = (($enabled) ? ' checked="checked" ' : '');
        $css = (($enabled) ? '' : '-disabled');
 
-       $def_enabled = PConfig::get(local_user(),'pumpio','post_by_default');
+       $def_enabled = get_pconfig(local_user(),'pumpio','post_by_default');
        $def_checked = (($def_enabled) ? ' checked="checked" ' : '');
 
-       $public_enabled = PConfig::get(local_user(),'pumpio','public');
+       $public_enabled = get_pconfig(local_user(),'pumpio','public');
        $public_checked = (($public_enabled) ? ' checked="checked" ' : '');
 
-       $mirror_enabled = PConfig::get(local_user(),'pumpio','mirror');
+       $mirror_enabled = get_pconfig(local_user(),'pumpio','mirror');
        $mirror_checked = (($mirror_enabled) ? ' checked="checked" ' : '');
 
-       $servername = PConfig::get(local_user(), "pumpio", "host");
-       $username = PConfig::get(local_user(), "pumpio", "user");
+       $servername = get_pconfig(local_user(), "pumpio", "host");
+       $username = get_pconfig(local_user(), "pumpio", "user");
 
        /* Add some HTML to the existing form */
 
@@ -267,8 +267,8 @@ function pumpio_settings(&$a,&$s) {
 
        if (($username != '') && ($servername != '')) {
 
-               $oauth_token = PConfig::get(local_user(), "pumpio", "oauth_token");
-               $oauth_token_secret = PConfig::get(local_user(), "pumpio", "oauth_token_secret");
+               $oauth_token = get_pconfig(local_user(), "pumpio", "oauth_token");
+               $oauth_token_secret = get_pconfig(local_user(), "pumpio", "oauth_token_secret");
 
                $s .= '<div id="pumpio-password-wrapper">';
                if (($oauth_token == "") || ($oauth_token_secret == "")) {
@@ -320,19 +320,19 @@ function pumpio_settings_post(&$a,&$b) {
 
        if(x($_POST,'pumpio-submit')) {
                if(x($_POST,'pumpio_delete')) {
-                       PConfig::set(local_user(),'pumpio','consumer_key','');
-                       PConfig::set(local_user(),'pumpio','consumer_secret','');
-                       PConfig::set(local_user(),'pumpio','oauth_token','');
-                       PConfig::set(local_user(),'pumpio','oauth_token_secret','');
-                       PConfig::set(local_user(),'pumpio','post',false);
-                       PConfig::set(local_user(),'pumpio','import',false);
-                       PConfig::set(local_user(),'pumpio','host','');
-                       PConfig::set(local_user(),'pumpio','user','');
-                       PConfig::set(local_user(),'pumpio','public',false);
-                       PConfig::set(local_user(),'pumpio','mirror',false);
-                       PConfig::set(local_user(),'pumpio','post_by_default',false);
-                       PConfig::set(local_user(),'pumpio','lastdate', 0);
-                       PConfig::set(local_user(),'pumpio','last_id', '');
+                       set_pconfig(local_user(),'pumpio','consumer_key','');
+                       set_pconfig(local_user(),'pumpio','consumer_secret','');
+                       set_pconfig(local_user(),'pumpio','oauth_token','');
+                       set_pconfig(local_user(),'pumpio','oauth_token_secret','');
+                       set_pconfig(local_user(),'pumpio','post',false);
+                       set_pconfig(local_user(),'pumpio','import',false);
+                       set_pconfig(local_user(),'pumpio','host','');
+                       set_pconfig(local_user(),'pumpio','user','');
+                       set_pconfig(local_user(),'pumpio','public',false);
+                       set_pconfig(local_user(),'pumpio','mirror',false);
+                       set_pconfig(local_user(),'pumpio','post_by_default',false);
+                       set_pconfig(local_user(),'pumpio','lastdate', 0);
+                       set_pconfig(local_user(),'pumpio','last_id', '');
                } else {
                        // filtering the username if it is filled wrong
                        $user = $_POST['pumpio_user'];
@@ -345,18 +345,18 @@ function pumpio_settings_post(&$a,&$b) {
                        // Filtering the hostname if someone is entering it with "http"
                        $host = $_POST['pumpio_host'];
                        $host = trim($host);
-                       $host = str_replace(["https://", "http://"], ["", ""], $host);
+                       $host = str_replace(array("https://", "http://"), array("", ""), $host);
 
-                       PConfig::set(local_user(),'pumpio','post',intval($_POST['pumpio']));
-                       PConfig::set(local_user(),'pumpio','import',$_POST['pumpio_import']);
-                       PConfig::set(local_user(),'pumpio','host',$host);
-                       PConfig::set(local_user(),'pumpio','user',$user);
-                       PConfig::set(local_user(),'pumpio','public',$_POST['pumpio_public']);
-                       PConfig::set(local_user(),'pumpio','mirror',$_POST['pumpio_mirror']);
-                       PConfig::set(local_user(),'pumpio','post_by_default',intval($_POST['pumpio_bydefault']));
+                       set_pconfig(local_user(),'pumpio','post',intval($_POST['pumpio']));
+                       set_pconfig(local_user(),'pumpio','import',$_POST['pumpio_import']);
+                       set_pconfig(local_user(),'pumpio','host',$host);
+                       set_pconfig(local_user(),'pumpio','user',$user);
+                       set_pconfig(local_user(),'pumpio','public',$_POST['pumpio_public']);
+                       set_pconfig(local_user(),'pumpio','mirror',$_POST['pumpio_mirror']);
+                       set_pconfig(local_user(),'pumpio','post_by_default',intval($_POST['pumpio_bydefault']));
 
                        if (!$_POST['pumpio_mirror'])
-                               PConfig::delete(local_user(),'pumpio','lastdate');
+                               del_pconfig(local_user(),'pumpio','lastdate');
 
                        //header("Location: ".$a->get_baseurl()."/pumpio/connect");
                }
@@ -369,11 +369,11 @@ function pumpio_post_local(&$a, &$b) {
                return;
        }
 
-       $pumpio_post   = intval(PConfig::get(local_user(), 'pumpio', 'post'));
+       $pumpio_post   = intval(get_pconfig(local_user(), 'pumpio', 'post'));
 
        $pumpio_enable = (($pumpio_post && x($_REQUEST,'pumpio_enable')) ? intval($_REQUEST['pumpio_enable']) : 0);
 
-       if ($b['api_source'] && intval(PConfig::get(local_user(), 'pumpio', 'post_by_default'))) {
+       if ($b['api_source'] && intval(get_pconfig(local_user(), 'pumpio', 'post_by_default'))) {
                $pumpio_enable = 1;
        }
 
@@ -393,7 +393,7 @@ function pumpio_post_local(&$a, &$b) {
 
 function pumpio_send(&$a,&$b) {
 
-       if (!PConfig::get($b["uid"],'pumpio','import')) {
+       if (!get_pconfig($b["uid"],'pumpio','import')) {
                if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
                        return;
        }
@@ -421,16 +421,8 @@ function pumpio_send(&$a,&$b) {
 
                logger("pumpio_send: receiver ".print_r($receiver, true));
 
-               if (!count($receiver) && ($b['private'] || !strstr($b['postopts'],'pumpio'))) {
+               if (!count($receiver) && ($b['private'] || !strstr($b['postopts'],'pumpio')))
                        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;
-               }
        }
 
        if($b['verb'] == ACTIVITY_LIKE) {
@@ -461,28 +453,28 @@ function pumpio_send(&$a,&$b) {
        // Support for native shares
        // http://<hostname>/api/<type>/shares?id=<the-object-id>
 
-       $oauth_token = PConfig::get($b['uid'], "pumpio", "oauth_token");
-       $oauth_token_secret = PConfig::get($b['uid'], "pumpio", "oauth_token_secret");
-       $consumer_key = PConfig::get($b['uid'], "pumpio","consumer_key");
-       $consumer_secret = PConfig::get($b['uid'], "pumpio","consumer_secret");
+       $oauth_token = get_pconfig($b['uid'], "pumpio", "oauth_token");
+       $oauth_token_secret = get_pconfig($b['uid'], "pumpio", "oauth_token_secret");
+       $consumer_key = get_pconfig($b['uid'], "pumpio","consumer_key");
+       $consumer_secret = get_pconfig($b['uid'], "pumpio","consumer_secret");
 
-       $host = PConfig::get($b['uid'], "pumpio", "host");
-       $user = PConfig::get($b['uid'], "pumpio", "user");
-       $public = PConfig::get($b['uid'], "pumpio", "public");
+       $host = get_pconfig($b['uid'], "pumpio", "host");
+       $user = get_pconfig($b['uid'], "pumpio", "user");
+       $public = get_pconfig($b['uid'], "pumpio", "public");
 
        if($oauth_token && $oauth_token_secret) {
                $title = trim($b['title']);
 
                $content = BBCode::convert($b['body'], false, 4);
 
-               $params = [];
+               $params = array();
 
                $params["verb"] = "post";
 
                if (!$iscomment) {
-                       $params["object"] = [
+                       $params["object"] = array(
                                                'objectType' => "note",
-                                               'content' => $content];
+                                               'content' => $content);
 
                        if ($title != "")
                                $params["object"]["displayName"] = $title;
@@ -500,16 +492,16 @@ function pumpio_send(&$a,&$b) {
                                $params["bcc"] = $receiver["bcc"];
 
                 } else {
-                       $inReplyTo = ["id" => $orig_post["uri"],
-                                       "objectType" => "note"];
+                       $inReplyTo = array("id" => $orig_post["uri"],
+                                       "objectType" => "note");
 
                        if (($orig_post["object-type"] != "") && (strstr($orig_post["object-type"], NAMESPACE_ACTIVITY_SCHEMA)))
                                $inReplyTo["objectType"] = str_replace(NAMESPACE_ACTIVITY_SCHEMA, '', $orig_post["object-type"]);
 
-                       $params["object"] = [
+                       $params["object"] = array(
                                                'objectType' => "comment",
                                                'content' => $content,
-                                               'inReplyTo' => $inReplyTo];
+                                               'inReplyTo' => $inReplyTo);
 
                        if ($title != "")
                                $params["object"]["displayName"] = $title;
@@ -528,14 +520,14 @@ function pumpio_send(&$a,&$b) {
                $url = 'https://'.$host.'/api/user/'.$user.'/feed';
 
                if (pumpio_reachable($url))
-                       $success = $client->CallAPI($url, 'POST', $params, ['FailOnAccessError'=>true, 'RequestContentType'=>'application/json'], $user);
+                       $success = $client->CallAPI($url, 'POST', $params, array('FailOnAccessError'=>true, 'RequestContentType'=>'application/json'), $user);
                else
                        $success = false;
 
                if($success) {
 
                        if ($user->generator->displayName)
-                               PConfig::set($b["uid"], "pumpio", "application_name", $user->generator->displayName);
+                               set_pconfig($b["uid"], "pumpio", "application_name", $user->generator->displayName);
 
                        $post_id = $user->object->id;
                        logger('pumpio_send '.$username.': success '.$post_id);
@@ -561,15 +553,15 @@ function pumpio_send(&$a,&$b) {
 function pumpio_action(&$a, $uid, $uri, $action, $content = "") {
 
        // Don't do likes and other stuff if you don't import the timeline
-       if (!PConfig::get($uid,'pumpio','import'))
+       if (!get_pconfig($uid,'pumpio','import'))
                return;
 
-       $ckey    = PConfig::get($uid, 'pumpio', 'consumer_key');
-       $csecret = PConfig::get($uid, 'pumpio', 'consumer_secret');
-       $otoken  = PConfig::get($uid, 'pumpio', 'oauth_token');
-       $osecret = PConfig::get($uid, 'pumpio', 'oauth_token_secret');
-       $hostname = PConfig::get($uid, 'pumpio','host');
-       $username = PConfig::get($uid, "pumpio", "user");
+       $ckey    = get_pconfig($uid, 'pumpio', 'consumer_key');
+       $csecret = get_pconfig($uid, 'pumpio', 'consumer_secret');
+       $otoken  = get_pconfig($uid, 'pumpio', 'oauth_token');
+       $osecret = get_pconfig($uid, 'pumpio', 'oauth_token_secret');
+       $hostname = get_pconfig($uid, 'pumpio','host');
+       $username = get_pconfig($uid, "pumpio", "user");
 
        $r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
                                dbesc($uri),
@@ -596,9 +588,9 @@ function pumpio_action(&$a, $uid, $uri, $action, $content = "") {
                $objectType = "image";
 
        $params["verb"] = $action;
-       $params["object"] = ['id' => $uri,
+       $params["object"] = array('id' => $uri,
                                "objectType" => $objectType,
-                               "content" => $content];
+                               "content" => $content);
 
        $client = new oauth_client_class;
        $client->oauth_version = '1.0a';
@@ -613,7 +605,7 @@ function pumpio_action(&$a, $uid, $uri, $action, $content = "") {
        $url = 'https://'.$hostname.'/api/user/'.$username.'/feed';
 
        if (pumpio_reachable($url))
-               $success = $client->CallAPI($url, 'POST', $params, ['FailOnAccessError'=>true, 'RequestContentType'=>'application/json'], $user);
+               $success = $client->CallAPI($url, 'POST', $params, array('FailOnAccessError'=>true, 'RequestContentType'=>'application/json'), $user);
        else
                $success = false;
 
@@ -640,9 +632,9 @@ function pumpio_sync(&$a) {
        if (!count($r))
                return;
 
-       $last = Config::get('pumpio','last_poll');
+       $last = get_config('pumpio','last_poll');
 
-       $poll_interval = intval(Config::get('pumpio','poll_interval'));
+       $poll_interval = intval(get_config('pumpio','poll_interval'));
        if(! $poll_interval)
                $poll_interval = PUMPIO_DEFAULT_POLL_INTERVAL;
 
@@ -663,7 +655,7 @@ function pumpio_sync(&$a) {
                }
        }
 
-       $abandon_days = intval(Config::get('system','account_abandon_days'));
+       $abandon_days = intval(get_config('system','account_abandon_days'));
        if ($abandon_days < 1)
                $abandon_days = 0;
 
@@ -684,7 +676,7 @@ function pumpio_sync(&$a) {
                        pumpio_fetchinbox($a, $rr['uid']);
 
                        // check for new contacts once a day
-                       $last_contact_check = PConfig::get($rr['uid'],'pumpio','contact_check');
+                       $last_contact_check = get_pconfig($rr['uid'],'pumpio','contact_check');
                        if($last_contact_check)
                                $next_contact_check = $last_contact_check + 86400;
                        else
@@ -692,35 +684,36 @@ function pumpio_sync(&$a) {
 
                        if($next_contact_check <= time()) {
                                pumpio_getallusers($a, $rr["uid"]);
-                               PConfig::set($rr['uid'],'pumpio','contact_check',time());
+                               set_pconfig($rr['uid'],'pumpio','contact_check',time());
                        }
                }
        }
 
        logger('pumpio: cron_end');
 
-       Config::set('pumpio','last_poll', time());
+       set_config('pumpio','last_poll', time());
 }
 
 function pumpio_cron(&$a,$b) {
-       Worker::add(PRIORITY_MEDIUM,"addon/pumpio/pumpio_sync.php");
+       //pumpio_sync($a);
+       proc_run("php","addon/pumpio/pumpio_sync.php");
 }
 
 function pumpio_fetchtimeline(&$a, $uid) {
-       $ckey    = PConfig::get($uid, 'pumpio', 'consumer_key');
-       $csecret = PConfig::get($uid, 'pumpio', 'consumer_secret');
-       $otoken  = PConfig::get($uid, 'pumpio', 'oauth_token');
-       $osecret = PConfig::get($uid, 'pumpio', 'oauth_token_secret');
-       $lastdate = PConfig::get($uid, 'pumpio', 'lastdate');
-       $hostname = PConfig::get($uid, 'pumpio','host');
-       $username = PConfig::get($uid, "pumpio", "user");
+       $ckey    = get_pconfig($uid, 'pumpio', 'consumer_key');
+       $csecret = get_pconfig($uid, 'pumpio', 'consumer_secret');
+       $otoken  = get_pconfig($uid, 'pumpio', 'oauth_token');
+       $osecret = get_pconfig($uid, 'pumpio', 'oauth_token_secret');
+       $lastdate = get_pconfig($uid, 'pumpio', 'lastdate');
+       $hostname = get_pconfig($uid, 'pumpio','host');
+       $username = get_pconfig($uid, "pumpio", "user");
 
        //  get the application name for the pump.io app
        //  1st try personal config, then system config and fallback to the
        //  hostname of the node if neither one is set.
        $application_name  = PConfig::get($uid, 'pumpio', 'application_name');
        if ($application_name == "")
-               $application_name  = Config::get('pumpio', 'application_name');
+               $application_name  = get_config('pumpio', 'application_name');
        if ($application_name == "")
                $application_name = $a->get_hostname();
 
@@ -743,7 +736,7 @@ function pumpio_fetchtimeline(&$a, $uid) {
        $username = $user.'@'.$host;
 
        if (pumpio_reachable($url))
-               $success = $client->CallAPI($url, 'GET', [], ['FailOnAccessError'=>true], $user);
+               $success = $client->CallAPI($url, 'GET', array(), array('FailOnAccessError'=>true), $user);
        else
                $success = false;
 
@@ -768,7 +761,7 @@ function pumpio_fetchtimeline(&$a, $uid) {
                        if ($first_time)
                                continue;
 
-                       $receiptians = [];
+                       $receiptians = array();
                        if (@is_array($post->cc))
                                $receiptians = array_merge($receiptians, $post->cc);
 
@@ -823,7 +816,7 @@ function pumpio_fetchtimeline(&$a, $uid) {
        }
 
        if ($lastdate != 0)
-               PConfig::set($uid,'pumpio','lastdate', $lastdate);
+               set_pconfig($uid,'pumpio','lastdate', $lastdate);
 }
 
 function pumpio_dounlike(&$a, $uid, $self, $post, $own_id) {
@@ -940,7 +933,7 @@ function pumpio_dolike(&$a, $uid, $self, $post, $own_id, $threadcompletion = tru
                return;
        }
 
-       $likedata = [];
+       $likedata = array();
        $likedata['parent'] = $orig_post['id'];
        $likedata['verb'] = ACTIVITY_LIKE;
        $likedata['gravity'] = 3;
@@ -972,11 +965,11 @@ function pumpio_dolike(&$a, $uid, $self, $post, $own_id, $threadcompletion = tru
 
 function pumpio_get_contact($uid, $contact, $no_insert = false) {
 
-       GContact::update(["url" => $contact->url, "network" => NETWORK_PUMPIO, "generation" => 2,
+       update_gcontact(array("url" => $contact->url, "network" => NETWORK_PUMPIO, "generation" => 2,
                        "photo" => $contact->image->url, "name" => $contact->displayName,  "hide" => true,
                        "nick" => $contact->preferredUsername, "location" => $contact->location->displayName,
-                       "about" => $contact->summary, "addr" => str_replace("acct:", "", $contact->id)]);
-       $cid = Contact::getIdForURL($contact->url, $uid);
+                       "about" => $contact->summary, "addr" => str_replace("acct:", "", $contact->id)));
+       $cid = get_contact($contact->url, $uid);
 
        if ($no_insert)
                return($cid);
@@ -1020,7 +1013,14 @@ function pumpio_get_contact($uid, $contact, $no_insert = false) {
 
                $contact_id = $r[0]['id'];
 
-               Group::addMember(User::getDefaultGroup($uid), $contact_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']);
+               }
        } else {
                $contact_id = $r[0]["id"];
 
@@ -1035,7 +1035,8 @@ function pumpio_get_contact($uid, $contact, $no_insert = false) {
                */
        }
 
-       Contact::updateAvatar($contact->image->url, $uid, $contact_id);
+       if (function_exists("update_contact_avatar"))
+               update_contact_avatar($contact->image->url, $uid, $contact_id);
 
        return($contact_id);
 }
@@ -1096,7 +1097,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
        if (!strstr("post|share|update", $post->verb))
                return false;
 
-       $receiptians = [];
+       $receiptians = array();
        if (@is_array($post->cc))
                $receiptians = array_merge($receiptians, $post->cc);
 
@@ -1108,7 +1109,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
                        if ($receiver->id == "http://activityschema.org/collection/public")
                                $public = true;
 
-       $postarray = [];
+       $postarray = array();
         $postarray['network'] = NETWORK_PUMPIO;
        $postarray['gravity'] = 0;
        $postarray['uid'] = $uid;
@@ -1209,7 +1210,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
                $postarray['edited'] = $postarray['created'];
 
        if ($post->verb == "share") {
-               if (!intval(Config::get('system','wall-to-wall_share'))) {
+               if (!intval(get_config('system','wall-to-wall_share'))) {
                        if (isset($post->object->author->displayName) && ($post->object->author->displayName != ""))
                                $share_author = $post->object->author->displayName;
                        elseif (isset($post->object->author->preferredUsername) && ($post->object->author->preferredUsername != ""))
@@ -1285,7 +1286,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
 
                                        $conv_parent = $conv['parent'];
 
-                                       notification([
+                                       notification(array(
                                                'type'         => NOTIFY_COMMENT,
                                                'notify_flags' => $user[0]['notify-flags'],
                                                'language'     => $user[0]['language'],
@@ -1300,7 +1301,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
                                                'verb'         => ACTIVITY_POST,
                                                'otype'        => 'item',
                                                'parent'       => $conv_parent,
-                                               ]);
+                                               ));
 
                                        // only send one notification
                                        break;
@@ -1314,13 +1315,13 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
 
 function pumpio_fetchinbox(&$a, $uid) {
 
-       $ckey    = PConfig::get($uid, 'pumpio', 'consumer_key');
-       $csecret = PConfig::get($uid, 'pumpio', 'consumer_secret');
-       $otoken  = PConfig::get($uid, 'pumpio', 'oauth_token');
-       $osecret = PConfig::get($uid, 'pumpio', 'oauth_token_secret');
-       $lastdate = PConfig::get($uid, 'pumpio', 'lastdate');
-       $hostname = PConfig::get($uid, 'pumpio','host');
-       $username = PConfig::get($uid, "pumpio", "user");
+       $ckey    = get_pconfig($uid, 'pumpio', 'consumer_key');
+       $csecret = get_pconfig($uid, 'pumpio', 'consumer_secret');
+       $otoken  = get_pconfig($uid, 'pumpio', 'oauth_token');
+       $osecret = get_pconfig($uid, 'pumpio', 'oauth_token_secret');
+       $lastdate = get_pconfig($uid, 'pumpio', 'lastdate');
+       $hostname = get_pconfig($uid, 'pumpio','host');
+       $username = get_pconfig($uid, "pumpio", "user");
 
        $own_id = "https://".$hostname."/".$username;
 
@@ -1345,7 +1346,7 @@ function pumpio_fetchinbox(&$a, $uid) {
        $client->access_token = $otoken;
        $client->access_token_secret = $osecret;
 
-       $last_id = PConfig::get($uid,'pumpio','last_id');
+       $last_id = get_pconfig($uid,'pumpio','last_id');
 
        $url = 'https://'.$hostname.'/api/user/'.$username.'/inbox';
 
@@ -1353,7 +1354,7 @@ function pumpio_fetchinbox(&$a, $uid) {
                $url .= '?since='.urlencode($last_id);
 
        if (pumpio_reachable($url))
-               $success = $client->CallAPI($url, 'GET', [], ['FailOnAccessError'=>true], $user);
+               $success = $client->CallAPI($url, 'GET', array(), array('FailOnAccessError'=>true), $user);
        else
                $success = false;
 
@@ -1370,16 +1371,16 @@ function pumpio_fetchinbox(&$a, $uid) {
        foreach ($lastitems AS $item)
                pumpio_fetchallcomments($a, $uid, $item["uri"]);
 
-       PConfig::set($uid,'pumpio','last_id', $last_id);
+       set_pconfig($uid,'pumpio','last_id', $last_id);
 }
 
 function pumpio_getallusers(&$a, $uid) {
-       $ckey    = PConfig::get($uid, 'pumpio', 'consumer_key');
-       $csecret = PConfig::get($uid, 'pumpio', 'consumer_secret');
-       $otoken  = PConfig::get($uid, 'pumpio', 'oauth_token');
-       $osecret = PConfig::get($uid, 'pumpio', 'oauth_token_secret');
-       $hostname = PConfig::get($uid, 'pumpio','host');
-       $username = PConfig::get($uid, "pumpio", "user");
+       $ckey    = get_pconfig($uid, 'pumpio', 'consumer_key');
+       $csecret = get_pconfig($uid, 'pumpio', 'consumer_secret');
+       $otoken  = get_pconfig($uid, 'pumpio', 'oauth_token');
+       $osecret = get_pconfig($uid, 'pumpio', 'oauth_token_secret');
+       $hostname = get_pconfig($uid, 'pumpio','host');
+       $username = get_pconfig($uid, "pumpio", "user");
 
        $client = new oauth_client_class;
        $client->oauth_version = '1.0a';
@@ -1394,7 +1395,7 @@ function pumpio_getallusers(&$a, $uid) {
        $url = 'https://'.$hostname.'/api/user/'.$username.'/following';
 
        if (pumpio_reachable($url))
-               $success = $client->CallAPI($url, 'GET', [], ['FailOnAccessError'=>true], $users);
+               $success = $client->CallAPI($url, 'GET', array(), array('FailOnAccessError'=>true), $users);
        else
                $success = false;
 
@@ -1402,7 +1403,7 @@ function pumpio_getallusers(&$a, $uid) {
                $url = 'https://'.$hostname.'/api/user/'.$username.'/following?count='.$users->totalItems;
 
                if (pumpio_reachable($url))
-                       $success = $client->CallAPI($url, 'GET', [], ['FailOnAccessError'=>true], $users);
+                       $success = $client->CallAPI($url, 'GET', array(), array('FailOnAccessError'=>true), $users);
                else
                        $success = false;
        }
@@ -1439,13 +1440,13 @@ function pumpio_queue_hook(&$a,&$b) {
 
                //logger('pumpio_queue: fetching userdata '.print_r($userdata, true));
 
-               $oauth_token = PConfig::get($userdata['uid'], "pumpio", "oauth_token");
-               $oauth_token_secret = PConfig::get($userdata['uid'], "pumpio", "oauth_token_secret");
-               $consumer_key = PConfig::get($userdata['uid'], "pumpio","consumer_key");
-               $consumer_secret = PConfig::get($userdata['uid'], "pumpio","consumer_secret");
+               $oauth_token = get_pconfig($userdata['uid'], "pumpio", "oauth_token");
+               $oauth_token_secret = get_pconfig($userdata['uid'], "pumpio", "oauth_token_secret");
+               $consumer_key = get_pconfig($userdata['uid'], "pumpio","consumer_key");
+               $consumer_secret = get_pconfig($userdata['uid'], "pumpio","consumer_secret");
 
-               $host = PConfig::get($userdata['uid'], "pumpio", "host");
-               $user = PConfig::get($userdata['uid'], "pumpio", "user");
+               $host = get_pconfig($userdata['uid'], "pumpio", "host");
+               $user = get_pconfig($userdata['uid'], "pumpio", "user");
 
                $success = false;
 
@@ -1467,7 +1468,7 @@ function pumpio_queue_hook(&$a,&$b) {
                        $client->client_secret = $consumer_secret;
 
                        if (pumpio_reachable($z['url']))
-                               $success = $client->CallAPI($z['url'], 'POST', $z['post'], ['FailOnAccessError'=>true, 'RequestContentType'=>'application/json'], $user);
+                               $success = $client->CallAPI($z['url'], 'POST', $z['post'], array('FailOnAccessError'=>true, 'RequestContentType'=>'application/json'), $user);
                        else
                                $success = false;
 
@@ -1493,19 +1494,19 @@ function pumpio_queue_hook(&$a,&$b) {
 
 function pumpio_getreceiver(&$a, $b) {
 
-       $receiver = [];
+       $receiver = array();
 
        if (!$b["private"]) {
 
                if(! strstr($b['postopts'],'pumpio'))
                        return $receiver;
 
-               $public = PConfig::get($b['uid'], "pumpio", "public");
+               $public = get_pconfig($b['uid'], "pumpio", "public");
 
                if ($public)
-                       $receiver["to"][] = [
+                       $receiver["to"][] = Array(
                                                "objectType" => "collection",
-                                               "id" => "http://activityschema.org/collection/public"];
+                                               "id" => "http://activityschema.org/collection/public");
        } else {
                $cids = explode("><", $b["allow_cid"]);
                $gids = explode("><", $b["allow_gid"]);
@@ -1520,29 +1521,30 @@ function pumpio_getreceiver(&$a, $b) {
                                );
 
                        if (count($r)) {
-                               $receiver["bcc"][] = [
+                               $receiver["bcc"][] = Array(
                                                        "displayName" => $r[0]["name"],
                                                        "objectType" => "person",
                                                        "preferredUsername" => $r[0]["nick"],
-                                                       "url" => $r[0]["url"]];
+                                                       "url" => $r[0]["url"]);
                        }
                }
                foreach ($gids AS $gid) {
                        $gid = trim($gid, " <>");
 
                        $r = q("SELECT `contact`.`name`, `contact`.`nick`, `contact`.`url`, `contact`.`network` ".
-                               "FROM `group_member`, `contact` WHERE `group_member`.`gid` = %d ".
+                               "FROM `group_member`, `contact` WHERE `group_member`.`gid` = %d AND `group_member`.`uid` = %d ".
                                "AND `contact`.`id` = `group_member`.`contact-id` AND `contact`.`network` = '%s'",
                                        intval($gid),
+                                       intval($b["uid"]),
                                        dbesc(NETWORK_PUMPIO)
                                );
 
                        foreach ($r AS $row)
-                               $receiver["bcc"][] = [
+                               $receiver["bcc"][] = Array(
                                                        "displayName" => $row["name"],
                                                        "objectType" => "person",
                                                        "preferredUsername" => $row["nick"],
-                                                       "url" => $row["url"]];
+                                                       "url" => $row["url"]);
                }
        }
 
@@ -1563,11 +1565,11 @@ function pumpio_getreceiver(&$a, $b) {
                                );
 
                        if (count($r)) {
-                                       $receiver["to"][] = [
+                                       $receiver["to"][] = Array(
                                                                "displayName" => $r[0]["name"],
                                                                "objectType" => "person",
                                                                "preferredUsername" => $r[0]["nick"],
-                                                               "url" => $r[0]["url"]];
+                                                               "url" => $r[0]["url"]);
                        }
                }
        }
@@ -1576,12 +1578,12 @@ function pumpio_getreceiver(&$a, $b) {
 }
 
 function pumpio_fetchallcomments(&$a, $uid, $id) {
-       $ckey    = PConfig::get($uid, 'pumpio', 'consumer_key');
-       $csecret = PConfig::get($uid, 'pumpio', 'consumer_secret');
-       $otoken  = PConfig::get($uid, 'pumpio', 'oauth_token');
-       $osecret = PConfig::get($uid, 'pumpio', 'oauth_token_secret');
-       $hostname = PConfig::get($uid, 'pumpio','host');
-       $username = PConfig::get($uid, "pumpio", "user");
+       $ckey    = get_pconfig($uid, 'pumpio', 'consumer_key');
+       $csecret = get_pconfig($uid, 'pumpio', 'consumer_secret');
+       $otoken  = get_pconfig($uid, 'pumpio', 'oauth_token');
+       $osecret = get_pconfig($uid, 'pumpio', 'oauth_token_secret');
+       $hostname = get_pconfig($uid, 'pumpio','host');
+       $username = get_pconfig($uid, "pumpio", "user");
 
        logger("pumpio_fetchallcomments: completing comment for user ".$uid." post id ".$id);
 
@@ -1614,7 +1616,7 @@ function pumpio_fetchallcomments(&$a, $uid, $id) {
        logger("pumpio_fetchallcomments: fetching comment for user ".$uid." url ".$url);
 
        if (pumpio_reachable($url))
-               $success = $client->CallAPI($url, 'GET', [], ['FailOnAccessError'=>true], $item);
+               $success = $client->CallAPI($url, 'GET', array(), array('FailOnAccessError'=>true), $item);
        else
                $success = false;
 
index c499fb868cd744a3ad3b0a8a3e589874969be131..deb6a02f47131608c26530bb33cda503047161a2 100644 (file)
@@ -37,11 +37,10 @@ function qcomment_addon_settings(&$a, &$s)
 {
        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/qcomment/qcomment.css' . '" media="all" />' . "\r\n";
+    $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . $a->get_baseurl() . '/addon/qcomment/qcomment.css' . '" media="all" />' . "\r\n";
 
        $words = PConfig::get(local_user(), 'qcomment', 'words', L10n::t(':-)') . "\n" . L10n::t(':-(') . "\n" .  L10n::t('lol'));
 
@@ -57,6 +56,7 @@ function qcomment_addon_settings(&$a, &$s)
        $s .= '</div>';
 
        return;
+
 }
 
 function qcomment_addon_settings_post(&$a,&$b) {
index abf59e2dffd1ab852041109a4734092ede016311..ca4d3d797d0783d24a5becefb3f1aabc448a3dcc 100644 (file)
@@ -4,9 +4,9 @@
  * Description: Sample Friendica addon. Set a random place when posting.
  * Version: 1.0
  * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
- *
- *
- *
+ * 
+ * 
+ * 
  *
  * Addons are registered with the system through the admin
  * panel.
@@ -14,7 +14,7 @@
  * When registration is detected, the system calls the addon
  * name_install() function, located in 'addon/name/name.php',
  * where 'name' is the name of the addon.
- * If the addon is removed from the configuration list, the
+ * If the addon is removed from the configuration list, the 
  * system will call the name_uninstall() function.
  *
  */
@@ -92,7 +92,7 @@ function randplace_post_hook($a, &$item) {
 
        /* Retrieve our personal config setting */
 
-       $active = PConfig::get(local_user(), 'randplace', 'enable');
+       $active = get_pconfig(local_user(), 'randplace', 'enable');
 
        if(! $active)
                return;
@@ -106,7 +106,7 @@ function randplace_post_hook($a, &$item) {
         *
         */
 
-       $cities = [];
+       $cities = array();
        $zones = timezone_identifiers_list();
        foreach($zones as $zone) {
                if((strpos($zone,'/')) && (! stristr($zone,'US/')) && (! stristr($zone,'Etc/')))
@@ -137,7 +137,7 @@ function randplace_settings_post($a,$post) {
        if(! local_user())
                return;
        if($_POST['randplace-submit'])
-               PConfig::set(local_user(),'randplace','enable',intval($_POST['randplace']));
+               set_pconfig(local_user(),'randplace','enable',intval($_POST['randplace']));
 }
 
 
@@ -161,7 +161,7 @@ function randplace_settings(&$a,&$s) {
 
        /* Get the current state of our config variable */
 
-       $enabled = PConfig::get(local_user(),'randplace','enable');
+       $enabled = get_pconfig(local_user(),'randplace','enable');
 
        $checked = (($enabled) ? ' checked="checked" ' : '');
 
index 94bdf5c11ea0d89a8a7320cf9882287e015759c9..b1651517408060f029fe3061a15248c7a5beddd3 100644 (file)
@@ -4,7 +4,7 @@
  * Description: Allow the recipients of private posts to see who else can see the post by clicking the lock icon
  * Version: 1.0
  * Author: Zach <https://f.shmuz.in/profile/techcity>
- *
+ * 
  */
 use Friendica\Core\Addon;
 use Friendica\Core\Config;
@@ -28,7 +28,7 @@ function remote_permissions_settings(&$a,&$o) {
        if(! local_user())
                return;
 
-       $global = Config::get("remote_perms", "global");
+       $global = get_config("remote_perms", "global");
        if($global == 1)
                return;
 
@@ -38,8 +38,8 @@ function remote_permissions_settings(&$a,&$o) {
 
        /* Get the current state of our config variable */
 
-       $remote_perms = PConfig::get(local_user(),'remote_perms','show');
-
+       $remote_perms = get_pconfig(local_user(),'remote_perms','show');
+       
        /* Add some HTML to the existing form */
 
 //     $t = file_get_contents("addon/remote_permissions/settings.tpl" );
@@ -66,13 +66,13 @@ function remote_permissions_content($a, $item_copy) {
        if($item_copy['uid'] != local_user())
                return;
 
-       if(Config::get('remote_perms','global') == 0) {
+       if(get_config('remote_perms','global') == 0) {
                // Admin has set Individual choice. We need to find
                // the original poster. First, get the contact's info
                $r = q("SELECT nick, url FROM contact WHERE id = %d LIMIT 1",
                       intval($item_copy['contact-id'])
                );
-               if(! $r)
+               if(! $r) 
                        return;
 
                // Find out if the contact lives here
@@ -89,14 +89,14 @@ function remote_permissions_content($a, $item_copy) {
                if(! $r)
                        return;
 
-               if(PConfig::get($r[0]['uid'],'remote_perms','show') == 0)
+               if(get_pconfig($r[0]['uid'],'remote_perms','show') == 0)
                        return;
        }
 
        if(($item_copy['private'] == 1) && (! strlen($item_copy['allow_cid'])) && (! strlen($item_copy['allow_gid']))
                && (! strlen($item_copy['deny_cid'])) && (! strlen($item_copy['deny_gid']))) {
 
-               $allow_names = [];
+               $allow_names = array();
 
                // Check for the original post here -- that's the only way
                // to definitely get all of the recipients
@@ -132,7 +132,7 @@ function remote_permissions_content($a, $item_copy) {
                                $r = q("SELECT DISTINCT `contact-id` FROM group_member WHERE gid IN ( %s )",
                                        dbesc(implode(', ', $allowed_groups))
                                );
-                               foreach($r as $rr)
+                               foreach($r as $rr) 
                                        $allow[] = $rr['contact-id'];
                        }
                        $allow = array_unique($allow + $allowed_users);
@@ -141,7 +141,7 @@ function remote_permissions_content($a, $item_copy) {
                                $r = q("SELECT DISTINCT `contact-id` FROM group_member WHERE gid IN ( %s )",
                                        dbesc(implode(', ', $deny_groups))
                                );
-                               foreach($r as $rr)
+                               foreach($r as $rr) 
                                        $deny[] = $rr['contact-id'];
                        }
                        $deny = $deny + $deny_users;
@@ -168,7 +168,7 @@ function remote_permissions_content($a, $item_copy) {
                        if(! $r)
                                return;
 
-                       $allow = [];
+                       $allow = array();
                        foreach($r as $rr)
                                $allow[] = $rr['uid'];
 
diff --git a/rendertime/lang/fr/messages.po b/rendertime/lang/fr/messages.po
deleted file mode 100644 (file)
index 42bd84a..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-# ADDON rendertime
-# Copyright (C)
-# This file is distributed under the same license as the Friendica rendertime addon package.
-# 
-# 
-# Translators:
-# Thecross, 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-12-04 22:24+0000\n"
-"Last-Translator: Thecross\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"
-
-#: rendertime.php:29
-#, php-format
-msgid ""
-"Performance: Database: %s, Network: %s, Rendering: %s, Parser: %s, I/O: %s, "
-"Other: %s, Total: %s"
-msgstr "Performances: Base de données : %s, Réseau : %s, Rendu : %s, Parser : %s, Entrées/sorties : %s, Autre : %s, Total : %s"
index b806c8f3a3f991c4d2c6bf67eaeb08d6b86491a3..ab4fa67a01a0faa5e9ef79cc221abc59b8c9bb82 100644 (file)
@@ -1,8 +1,2 @@
-<?php
-
-if(! function_exists("string_plural_select_fr")) {
-function string_plural_select_fr($n){
-       return ($n > 1);;
-}}
-;
-$a->strings["Performance: Database: %s, Network: %s, Rendering: %s, Parser: %s, I/O: %s, Other: %s, Total: %s"] = "Performances: Base de données : %s, Réseau : %s, Rendu : %s, Parser : %s, Entrées/sorties : %s, Autre : %s, Total : %s";
+<?php\r
+\r
index 81aea8b18a4b4aa82a06874c0c7137862561fd78..a638865a210e3aedc8137dd71454cd704cf8f2ee 100644 (file)
@@ -27,7 +27,7 @@ function rendertime_page_end(&$a, &$o) {
 
        $duration = microtime(true)-$a->performance["start"];
 
-       $ignored_modules = ["fbrowser"];
+       $ignored_modules = array("fbrowser");
        $ignored = in_array($a->module, $ignored_modules);
 
        if (is_site_admin() && ($_GET["mode"] != "minimal") && !$a->is_mobile && !$a->is_tablet && !$ignored) {
@@ -46,7 +46,7 @@ function rendertime_page_end(&$a, &$o) {
                        //round($a->performance["plugin"], 3)
                        )."</div>";
 
-               if (Config::get("rendertime", "callstack")) {
+               if (get_config("rendertime", "callstack")) {
                        $o .= "<pre>";
                        $o .= "\nDatabase Read:\n";
                        foreach ($a->callstack["database"] AS $func => $time) {
diff --git a/retriever/README b/retriever/README
new file mode 100644 (file)
index 0000000..b972815
--- /dev/null
@@ -0,0 +1,5 @@
+"retriever" is deactivated since it has side effects for all received posts.
+
+It was created in a time when the option 'Fetch further information for feeds' didn't exist.
+
+To activate it, please go to the list of your contacts, edit the contact and then select between the different options.
diff --git a/retriever/database.sql b/retriever/database.sql
new file mode 100644 (file)
index 0000000..23cac12
--- /dev/null
@@ -0,0 +1,36 @@
+CREATE TABLE IF NOT EXISTS `retriever_rule` (
+       `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+       `uid` int(11) NOT NULL,
+       `contact-id` int(11) NOT NULL,
+       `data` mediumtext NOT NULL,
+       PRIMARY KEY (`id`),
+       KEY `uid` (`uid`),
+       KEY `contact-id` (`contact-id`)
+) DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+
+CREATE TABLE IF NOT EXISTS `retriever_item` (
+       `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+       `item-uri` varchar(800) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
+       `item-uid` int(10) unsigned NOT NULL DEFAULT '0',
+       `contact-id` int(10) unsigned NOT NULL DEFAULT '0',
+       `resource` int(11) NOT NULL,
+       `finished` tinyint(1) unsigned NOT NULL DEFAULT '0',
+       KEY `resource` (`resource`),
+       KEY `all` (`item-uri`, `item-uid`, `contact-id`),
+       PRIMARY KEY (`id`)
+) DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+
+CREATE TABLE IF NOT EXISTS `retriever_resource` (
+       `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+       `type` char(255) NOT NULL,
+       `binary` int(1) NOT NULL DEFAULT 0,
+       `url` varchar(800) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
+       `created` timestamp NOT NULL DEFAULT now(),
+       `completed` timestamp NULL DEFAULT NULL,
+       `last-try` timestamp NULL DEFAULT NULL,
+       `num-tries` int(11) NOT NULL DEFAULT 0,
+       `data` mediumtext NOT NULL,
+       `http-code` smallint(1) unsigned NULL DEFAULT NULL,
+       `redirect-url` varchar(800) CHARACTER SET ascii COLLATE ascii_bin NULL DEFAULT NULL,
+       PRIMARY KEY (`id`)
+) DEFAULT CHARSET=utf8 COLLATE=utf8_bin
diff --git a/retriever/lang/C/messages.po b/retriever/lang/C/messages.po
new file mode 100644 (file)
index 0000000..e9d20af
--- /dev/null
@@ -0,0 +1,102 @@
+# ADDON retriever
+# Copyright (C) 
+# This file is distributed under the same license as the Friendica retriever addon package.
+# 
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: \n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-06-23 14:45+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"
+
+#: retriever.php:445
+msgid "Retrieved"
+msgstr ""
+
+#: retriever.php:654
+msgid "Enabled"
+msgstr ""
+
+#: retriever.php:658
+msgid "URL Pattern"
+msgstr ""
+
+#: retriever.php:660
+msgid "Regular expression matching part of the URL to replace"
+msgstr ""
+
+#: retriever.php:663
+msgid "URL Replace"
+msgstr ""
+
+#: retriever.php:665
+msgid "Text to replace matching part of above regular expression"
+msgstr ""
+
+#: retriever.php:668
+msgid "Download Images"
+msgstr ""
+
+#: retriever.php:672
+msgid "Retrospectively Apply"
+msgstr ""
+
+#: retriever.php:674
+msgid "Reapply the rules to this number of posts"
+msgstr ""
+
+#: retriever.php:675
+msgid "Retrieve Feed Content"
+msgstr ""
+
+#: retriever.php:677 retriever.php:721
+msgid "Save Settings"
+msgstr ""
+
+#: retriever.php:679
+msgid "Tag"
+msgstr ""
+
+#: retriever.php:680
+msgid "Attribute"
+msgstr ""
+
+#: retriever.php:681
+msgid "Value"
+msgstr ""
+
+#: retriever.php:682
+msgid "Add"
+msgstr ""
+
+#: retriever.php:683
+msgid "Remove"
+msgstr ""
+
+#: retriever.php:684
+msgid "Include"
+msgstr ""
+
+#: retriever.php:686
+msgid "Exclude"
+msgstr ""
+
+#: retriever.php:697
+msgid "Retriever"
+msgstr ""
+
+#: retriever.php:722
+msgid "Retriever Settings"
+msgstr ""
+
+#: retriever.php:725
+msgid "All Photos"
+msgstr ""
diff --git a/retriever/retriever.php b/retriever/retriever.php
new file mode 100644 (file)
index 0000000..72e327b
--- /dev/null
@@ -0,0 +1,839 @@
+<?php
+/**
+ * Name: Retrieve Feed Content
+ * Description: Follow the permalink of RSS/Atom feed items and replace the summary with the full content.
+ * Version: 1.0
+ * Author: Matthew Exon <http://mat.exon.name>
+ * Status: Unsupported
+ */
+
+require_once('include/html2bbcode.php');       
+require_once('include/Photo.php');     
+
+function retriever_install() {
+    register_hook('plugin_settings', 'addon/retriever/retriever.php', 'retriever_plugin_settings');
+    register_hook('plugin_settings_post', 'addon/retriever/retriever.php', 'retriever_plugin_settings_post');
+    register_hook('post_remote', 'addon/retriever/retriever.php', 'retriever_post_remote_hook');
+    register_hook('contact_photo_menu', 'addon/retriever/retriever.php', 'retriever_contact_photo_menu');
+    register_hook('cron', 'addon/retriever/retriever.php', 'retriever_cron');
+
+    $r = q("SELECT `id` FROM `pconfig` WHERE `cat` LIKE 'retriever_%%'");
+    if (count($r) || (get_config('retriever', 'dbversion') == '0.1')) {
+        $retrievers = array();
+        $r = q("SELECT SUBSTRING(`cat`, 10) AS `contact`, `k`, `v` FROM `pconfig` WHERE `cat` LIKE 'retriever%%'");
+        foreach ($r as $rr) {
+            $retrievers[$rr['contact']][$rr['k']] = $rr['v'];
+        }
+        foreach ($retrievers as $k => $v) {
+            $rr = q("SELECT `uid` FROM `contact` WHERE `id` = %d", intval($k));
+            $uid = $rr[0]['uid'];
+            $v['images'] = 'on';
+            q("INSERT INTO `retriever_rule` (`uid`, `contact-id`, `data`) VALUES (%d, %d, '%s')",
+              intval($uid), intval($k), dbesc(json_encode($v)));
+        }
+        q("DELETE FROM `pconfig` WHERE `cat` LIKE 'retriever_%%'");
+        set_config('retriever', 'dbversion', '0.2');
+    }
+    if (get_config('retriever', 'dbversion') == '0.2') {
+        q("ALTER TABLE `retriever_resource` DROP COLUMN `retriever`");
+        set_config('retriever', 'dbversion', '0.3');
+    }
+    if (get_config('retriever', 'dbversion') == '0.3') {
+        q("ALTER TABLE `retriever_item` MODIFY COLUMN `item-uri` varchar(800) CHARACTER SET ascii NOT NULL");
+        q("ALTER TABLE `retriever_resource` MODIFY COLUMN `url` varchar(800) CHARACTER SET ascii NOT NULL");
+        set_config('retriever', 'dbversion', '0.4');
+    }
+    if (get_config('retriever', 'dbversion') == '0.4') {
+        q("ALTER TABLE `retriever_item` ADD COLUMN `finished` tinyint(1) unsigned NOT NULL DEFAULT '0'");
+        set_config('retriever', 'dbversion', '0.5');
+    }
+    if (get_config('retriever', 'dbversion') == '0.5') {
+        q('ALTER TABLE `retriever_resource` CHANGE `created` `created` timestamp NOT NULL DEFAULT now()');
+        q('ALTER TABLE `retriever_resource` CHANGE `completed` `completed` timestamp NULL DEFAULT NULL');
+        q('ALTER TABLE `retriever_resource` CHANGE `last-try` `last-try` timestamp NULL DEFAULT NULL');
+        q('ALTER TABLE `retriever_item` DROP KEY `all`');
+        q('ALTER TABLE `retriever_item` ADD KEY `all` (`item-uri`, `item-uid`, `contact-id`)');
+        set_config('retriever', 'dbversion', '0.6');
+    }
+    if (get_config('retriever', 'dbversion') == '0.6') {
+        q('ALTER TABLE `retriever_item` CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin');
+        q('ALTER TABLE `retriever_item` CHANGE `item-uri` `item-uri`  varchar(800) CHARACTER SET ascii COLLATE ascii_bin NOT NULL');
+        q('ALTER TABLE `retriever_resource` CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin');
+        q('ALTER TABLE `retriever_resource` CHANGE `url` `url`  varchar(800) CHARACTER SET ascii COLLATE ascii_bin NOT NULL');
+        q('ALTER TABLE `retriever_rule` CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin');
+        set_config('retriever', 'dbversion', '0.7');
+    }
+    if (get_config('retriever', 'dbversion') == '0.7') {
+        $r = q("SELECT `id`, `data` FROM `retriever_rule`");
+        foreach ($r as $rr) {
+            logger('retriever_install: retriever ' . $rr['id'] . ' old config ' . $rr['data'], LOGGER_DATA);
+            $data = json_decode($rr['data'], true);
+            if ($data['pattern']) {
+                $matches = array();
+                if (preg_match("/\/(.*)\//", $data['pattern'], $matches)) {
+                    $data['pattern'] = $matches[1];
+                }
+            }
+            if ($data['match']) {
+                $include = array();
+                foreach (explode('|', $data['match']) as $component) {
+                    $matches = array();
+                    if (preg_match("/([A-Za-z][A-Za-z0-9]*)\[@([A-Za-z][a-z0-9]*)='([^']*)'\]/", $component, $matches)) {
+                        $include[] = array(
+                            'element' => $matches[1],
+                            'attribute' => $matches[2],
+                            'value' => $matches[3]);
+                    }
+                    if (preg_match("/([A-Za-z][A-Za-z0-9]*)\[contains(concat(' ',normalize-space(@class),' '),' ([^ ']+) ')]/", $component, $matches)) {
+                        $include[] = array(
+                            'element' => $matches[1],
+                            'attribute' => $matches[2],
+                            'value' => $matches[3]);
+                    }
+                }
+                $data['include'] = $include;
+                unset($data['match']);
+            }
+            if ($data['remove']) {
+                $exclude = array();
+                foreach (explode('|', $data['remove']) as $component) {
+                    $matches = array();
+                    if (preg_match("/([A-Za-z][A-Za-z0-9]*)\[@([A-Za-z][a-z0-9]*)='([^']*)'\]/", $component, $matches)) {
+                        $exclude[] = array(
+                            'element' => $matches[1],
+                            'attribute' => $matches[2],
+                            'value' => $matches[3]);
+                    }
+                    if (preg_match("/([A-Za-z][A-Za-z0-9]*)\[contains(concat(' ',normalize-space(@class),' '),' ([^ ']+) ')]/", $component, $matches)) {
+                        $exclude[] = array(
+                            'element' => $matches[1],
+                            'attribute' => $matches[2],
+                            'value' => $matches[3]);
+                    }
+                }
+                $data['exclude'] = $exclude;
+                unset($data['remove']);
+            }
+            $r = q('UPDATE `retriever_rule` SET `data` = "%s" WHERE `id` = %d', dbesc(json_encode($data)), $rr['id']);
+            logger('retriever_install: retriever ' . $rr['id'] . ' new config ' . json_encode($data), LOGGER_DATA);
+        }
+        set_config('retriever', 'dbversion', '0.8');
+    }
+    if (get_config('retriever', 'dbversion') == '0.8') {
+        q("ALTER TABLE `retriever_resource` ADD COLUMN `http-code` smallint(1) unsigned NULL DEFAULT NULL");
+        set_config('retriever', 'dbversion', '0.9');
+    }
+    if (get_config('retriever', 'dbversion') == '0.9') {
+        q("ALTER TABLE `retriever_item` DROP COLUMN `parent`");
+        q("ALTER TABLE `retriever_resource` ADD COLUMN `redirect-url` varchar(800) CHARACTER SET ascii COLLATE ascii_bin NULL DEFAULT NULL");
+        set_config('retriever', 'dbversion', '0.10');
+    }
+
+    if (get_config('retriever', 'dbversion') != '0.10') {
+        $schema = file_get_contents(dirname(__file__).'/database.sql');
+        $arr = explode(';', $schema);
+        foreach ($arr as $a) {
+            $r = q($a);
+        }
+        set_config('retriever', 'dbversion', '0.10');
+    }
+}
+
+function retriever_uninstall() {
+    unregister_hook('plugin_settings', 'addon/retriever/retriever.php', 'retriever_plugin_settings');
+    unregister_hook('plugin_settings_post', 'addon/retriever/retriever.php', 'retriever_plugin_settings_post');
+    unregister_hook('post_remote', 'addon/retriever/retriever.php', 'retriever_post_remote_hook');
+    unregister_hook('plugin_settings', 'addon/retriever/retriever.php', 'retriever_plugin_settings');
+    unregister_hook('plugin_settings_post', 'addon/retriever/retriever.php', 'retriever_plugin_settings_post');
+    unregister_hook('contact_photo_menu', 'addon/retriever/retriever.php', 'retriever_contact_photo_menu');
+    unregister_hook('cron', 'addon/retriever/retriever.php', 'retriever_cron');
+}
+
+function retriever_module() {}
+
+function retriever_cron($a, $b) {
+    // 100 is a nice sane number.  Maybe this should be configurable.
+    retriever_retrieve_items(100);
+    retriever_tidy();
+}
+
+$retriever_item_count = 0;
+
+function retriever_retrieve_items($max_items) {
+    global $retriever_item_count;
+
+    $retriever_schedule = array(array(1,'minute'),
+                                array(10,'minute'),
+                                array(1,'hour'),
+                                array(1,'day'),
+                                array(2,'day'),
+                                array(1,'week'),
+                                array(1,'month'));
+
+    $schedule_clauses = array();
+    for ($i = 0; $i < count($retriever_schedule); $i++) {
+        $num = $retriever_schedule[$i][0];
+        $unit = $retriever_schedule[$i][1];
+        array_push($schedule_clauses,
+                   '(`num-tries` = ' . $i . ' AND TIMESTAMPADD(' . dbesc($unit) .
+                   ', ' . intval($num) . ', `last-try`) < now())');
+    }
+
+    $retrieve_items = $max_items - $retriever_item_count;
+    logger('retriever_retrieve_items: asked for maximum ' . $max_items . ', already retrieved ' . $retriever_item_count . ', retrieve ' . $retrieve_items, LOGGER_DEBUG);
+    do {
+        $r = q("SELECT * FROM `retriever_resource` WHERE `completed` IS NULL AND (`last-try` IS NULL OR %s) ORDER BY `last-try` ASC LIMIT %d",
+               dbesc(implode($schedule_clauses, ' OR ')),
+               intval($retrieve_items));
+        if (!is_array($r)) {
+            break;
+        }
+        if (count($r) == 0) {
+            break;
+        }
+        logger('retriever_retrieve_items: found ' . count($r) . ' waiting resources in database', LOGGER_DEBUG);
+        foreach ($r as $rr) {
+            retrieve_resource($rr);
+            $retriever_item_count++;
+        }
+        $retrieve_items = $max_items - $retriever_item_count;
+    }
+    while ($retrieve_items > 0);
+
+    /* Look for items that are waiting even though the resource has
+     * completed.  This usually happens because we've been asked to
+     * retrospectively apply a config change.  It could also happen
+     * due to a cron job dying or something. */
+    $r = q("SELECT retriever_resource.`id` as resource, retriever_item.`id` as item FROM retriever_resource, retriever_item, retriever_rule WHERE retriever_item.`finished` = 0 AND retriever_item.`resource` = retriever_resource.`id` AND retriever_resource.`completed` IS NOT NULL AND retriever_item.`contact-id` = retriever_rule.`contact-id` AND retriever_item.`item-uid` = retriever_rule.`uid` LIMIT %d",
+           intval($retrieve_items));
+    if (!$r) {
+        $r = array();
+    }
+    logger('retriever_retrieve_items: items waiting even though resource has completed: ' . count($r), LOGGER_DEBUG);
+    foreach ($r as $rr) {
+        $resource = q("SELECT * FROM retriever_resource WHERE `id` = %d", $rr['resource']);
+        $retriever_item = retriever_get_retriever_item($rr['item']);
+        if (!$retriever_item) {
+            logger('retriever_retrieve_items: no retriever item with id ' . $rr['item'], LOGGER_NORMAL);
+            continue;
+        }
+        $item = retriever_get_item($retriever_item);
+        if (!$item) {
+            logger('retriever_retrieve_items: no item ' . $retriever_item['item-uri'], LOGGER_NORMAL);
+            continue;
+        }
+        $retriever = get_retriever($item['contact-id'], $item['uid']);
+        if (!$retriever) {
+            logger('retriever_retrieve_items: no retriever for item ' .
+                   $retriever_item['item-uri'] . ' ' . $retriever_item['uid'] . ' ' . $item['contact-id'],
+                   LOGGER_NORMAL);
+            continue;
+        }
+        retriever_apply_completed_resource_to_item($retriever, $item, $resource[0]);
+        q("UPDATE `retriever_item` SET `finished` = 1 WHERE id = %d",
+          intval($retriever_item['id']));
+        retriever_check_item_completed($item);
+    }
+}
+
+function retriever_tidy() {
+    q("DELETE FROM retriever_resource WHERE completed IS NOT NULL AND completed < DATE_SUB(now(), INTERVAL 1 WEEK)");
+    q("DELETE FROM retriever_resource WHERE completed IS NULL AND created < DATE_SUB(now(), INTERVAL 3 MONTH)");
+
+    $r = q("SELECT retriever_item.id FROM retriever_item LEFT OUTER JOIN retriever_resource ON (retriever_item.resource = retriever_resource.id) WHERE retriever_resource.id is null");
+    logger('retriever_tidy: found ' . count($r) . ' retriever_items with no retriever_resource');
+    foreach ($r as $rr) {
+        q('DELETE FROM retriever_item WHERE id = %d', intval($rr['id']));
+    }
+}
+
+function retrieve_resource($resource) {
+    $a = get_app();
+
+    logger('retrieve_resource: ' . ($resource['num-tries'] + 1) .
+           ' attempt at resource ' . $resource['id'] . ' ' . $resource['url'], LOGGER_DEBUG);
+    $redirects;
+    $cookiejar = tempnam(get_temppath(), 'cookiejar-retriever-');
+    $fetch_result = z_fetch_url($resource['url'], $resource['binary'], $redirects, array('cookiejar' => $cookiejar));
+    unlink($cookiejar);
+    $resource['data'] = $fetch_result['body'];
+    $resource['http-code'] = $a->get_curl_code();
+    $resource['type'] = $a->get_curl_content_type();
+    $resource['redirect-url'] = $fetch_result['redirect_url'];
+    logger('retrieve_resource: got code ' . $resource['http-code'] .
+           ' retrieving resource ' . $resource['id'] .
+           ' final url ' . $resource['redirect-url'], LOGGER_DEBUG);
+    q("UPDATE `retriever_resource` SET `last-try` = now(), `num-tries` = `num-tries` + 1, `http-code` = %d, `redirect-url` = '%s' WHERE id = %d",
+      intval($resource['http-code']),
+      dbesc($resource['redirect-url']),
+      intval($resource['id']));
+    if ($resource['data']) {
+        q("UPDATE `retriever_resource` SET `completed` = now(), `data` = '%s', `type` = '%s' WHERE id = %d",
+          dbesc($resource['data']),
+          dbesc($resource['type']),
+          intval($resource['id']));
+        retriever_resource_completed($resource);
+    }
+}
+
+function get_retriever($contact_id, $uid, $create = false) {
+    $r = q("SELECT * FROM `retriever_rule` WHERE `contact-id` = %d AND `uid` = %d",
+           intval($contact_id), intval($uid));
+    if (count($r)) {
+        $r[0]['data'] = json_decode($r[0]['data'], true);
+        return $r[0];
+    }
+    if ($create) {
+        q("INSERT INTO `retriever_rule` (`uid`, `contact-id`) VALUES (%d, %d)",
+          intval($uid), intval($contact_id));
+        $r = q("SELECT * FROM `retriever_rule` WHERE `contact-id` = %d AND `uid` = %d",
+               intval($contact_id), intval($uid));
+        return $r[0];
+    }
+}
+
+function retriever_get_retriever_item($id) {
+    $retriever_items = q("SELECT * FROM `retriever_item` WHERE id = %d", intval($id));
+    if (count($retriever_items) != 1) {
+        logger('retriever_get_retriever_item: unable to find retriever_item ' . $id, LOGGER_NORMAL);
+        return;
+    }
+    return $retriever_items[0];
+}
+
+function retriever_get_item($retriever_item) {
+    $items = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d AND `contact-id` = %d",
+               dbesc($retriever_item['item-uri']),
+               intval($retriever_item['item-uid']),
+               intval($retriever_item['contact-id']));
+    if (count($items) != 1) {
+        logger('retriever_get_item: unexpected number of results ' .
+               count($items) . " when searching for item $uri $uid $cid", LOGGER_NORMAL);
+        return;
+    }
+    return $items[0];
+}
+
+function retriever_item_completed($retriever_item_id, $resource) {
+    logger('retriever_item_completed: id ' . $retriever_item_id . ' url ' . $resource['url'], LOGGER_DEBUG);
+
+    $retriever_item = retriever_get_retriever_item($retriever_item_id);
+    if (!$retriever_item) {
+        return;
+    }
+    // Note: the retriever might be null.  Doesn't matter.
+    $retriever = get_retriever($retriever_item['contact-id'], $retriever_item['item-uid']);
+    $item = retriever_get_item($retriever_item);
+    if (!$item) {
+        return;
+    }
+
+    retriever_apply_completed_resource_to_item($retriever, $item, $resource);
+
+    q("UPDATE `retriever_item` SET `finished` = 1 WHERE id = %d",
+      intval($retriever_item['id']));
+    retriever_check_item_completed($item);
+}
+
+function retriever_resource_completed($resource) {
+    logger('retriever_resource_completed: id ' . $resource['id'] . ' url ' . $resource['url'], LOGGER_DEBUG);
+    $r = q("SELECT `id` FROM `retriever_item` WHERE `resource` = %d", $resource['id']);
+    foreach ($r as $rr) {
+        retriever_item_completed($rr['id'], $resource);
+    }
+}
+
+function apply_retrospective($retriever, $num) {
+    $r = q("SELECT * FROM `item` WHERE `contact-id` = %d ORDER BY `received` DESC LIMIT %d",
+           intval($retriever['contact-id']), intval($num));
+    foreach ($r as $item) {
+        q('UPDATE `item` SET `visible` = 0 WHERE `id` = %d', $item['id']);
+        q('UPDATE `thread` SET `visible` = 0 WHERE `iid` = %d', $item['id']);
+        retriever_on_item_insert($retriever, $item);
+    }
+}
+
+function retriever_on_item_insert($retriever, &$item) {
+    if (!$retriever || !$retriever['id']) {
+        logger('retriever_on_item_insert: No retriever supplied', LOGGER_NORMAL);
+        return;
+    }
+    if (!$retriever["data"]['enable'] == "on") {
+        return;
+    }
+    if ($retriever["data"]['pattern']) {
+        $url = preg_replace('/' . $retriever["data"]['pattern'] . '/', $retriever["data"]['replace'], $item['plink']);
+        logger('retriever_on_item_insert: Changed ' . $item['plink'] . ' to ' . $url, LOGGER_DATA);
+    }
+    else {
+        $url = $item['plink'];
+    }
+
+    $resource = add_retriever_resource($url);
+    $retriever_item_id = add_retriever_item($item, $resource);
+}
+
+function add_retriever_resource($url, $binary = false) {
+    logger('add_retriever_resource: ' . $url, LOGGER_DEBUG);
+
+    $scheme = parse_url($url, PHP_URL_SCHEME);
+    if ($scheme == 'data') {
+        $fp = fopen($url, 'r');
+        $meta = stream_get_meta_data($fp);
+        $type = $meta['mediatype'];
+        $data = stream_get_contents($fp);
+        fclose($fp);
+
+        $url = 'md5://' . hash('md5', $url);
+        $r = q("SELECT * FROM `retriever_resource` WHERE `url` = '%s'", dbesc($url));
+        $resource = $r[0];
+        if (count($r)) {
+            logger('add_retriever_resource: Resource ' . $url . ' already requested', LOGGER_DEBUG);
+            return $resource;
+        }
+
+        logger('retrieve_resource: got data URL type ' . $resource['type'], LOGGER_DEBUG);
+        q("INSERT INTO `retriever_resource` (`type`, `binary`, `url`, `completed`, `data`) " .
+          "VALUES ('%s', %d, '%s', now(), '%s')",
+          dbesc($type),
+          intval($binary ? 1 : 0),
+          dbesc($url),
+          dbesc($data));
+        $r = q("SELECT * FROM `retriever_resource` WHERE `url` = '%s'", dbesc($url));
+        $resource = $r[0];
+        if (count($r)) {
+            retriever_resource_completed($resource);
+        }
+        return $resource;
+    }
+
+    if (strlen($url) > 800) {
+        logger('add_retriever_resource: URL is longer than 800 characters', LOGGER_NORMAL);
+    }
+
+    $r = q("SELECT * FROM `retriever_resource` WHERE `url` = '%s'", dbesc($url));
+    $resource = $r[0];
+    if (count($r)) {
+        logger('add_retriever_resource: Resource ' . $url . ' already requested', LOGGER_DEBUG);
+        return $resource;
+    }
+
+    q("INSERT INTO `retriever_resource` (`binary`, `url`) " .
+      "VALUES (%d, '%s')", intval($binary ? 1 : 0), dbesc($url));
+    $r = q("SELECT * FROM `retriever_resource` WHERE `url` = '%s'", dbesc($url));
+    return $r[0];
+}
+
+function add_retriever_item(&$item, $resource) {
+    logger('add_retriever_item: ' . $resource['url'] . ' for ' . $item['uri'] . ' ' . $item['uid'] . ' ' . $item['contact-id'], LOGGER_DEBUG);
+
+    q("INSERT INTO `retriever_item` (`item-uri`, `item-uid`, `contact-id`, `resource`) " .
+      "VALUES ('%s', %d, %d, %d)",
+      dbesc($item['uri']), intval($item['uid']), intval($item['contact-id']), intval($resource["id"]));
+    $r = q("SELECT id FROM `retriever_item` WHERE " .
+           "`item-uri` = '%s' AND `item-uid` = %d AND `contact-id` = %d AND `resource` = %d ORDER BY id DESC",
+           dbesc($item['uri']), intval($item['uid']), intval($item['contact-id']), intval($resource['id']));
+    if (!count($r)) {
+        logger("add_retriever_item: couldn't create retriever item for " .
+               $item['uri'] . ' ' . $item['uid'] . ' ' . $item['contact-id'],
+               LOGGER_NORMAL);
+        return;
+    }
+    logger('add_retriever_item: created retriever_item ' . $r[0]['id'] . ' for item ' . $item['uri'] . ' ' . $item['uid'] . ' ' . $item['contact-id'], LOGGER_DEBUG);
+    return $r[0]['id'];
+}
+
+function retriever_get_encoding($resource) {
+    $matches = array();
+    if (preg_match('/charset=(.*)/', $resource['type'], $matches)) {
+        return trim(array_pop($matches));
+    }
+    return 'utf-8';
+}
+
+function retriever_apply_xslt_text($xslt_text, $doc) {
+    if (!$xslt_text) {
+        logger('retriever_apply_xslt_text: empty XSLT text', LOGGER_NORMAL);
+        return $doc;
+    }
+    $xslt_doc = new DOMDocument();
+    if (!$xslt_doc->loadXML($xslt_text)) {
+        logger('retriever_apply_xslt_text: could not load XML', LOGGER_NORMAL);
+        return $doc;
+    }
+    $xp = new XsltProcessor();
+    $xp->importStylesheet($xslt_doc);
+    $result = $xp->transformToDoc($doc);
+    return $result;
+}
+
+function retriever_apply_dom_filter($retriever, &$item, $resource) {
+    logger('retriever_apply_dom_filter: applying XSLT to ' . $item['id'] . ' ' . $item['uri'] . ' contact ' . $item['contact-id'], LOGGER_DEBUG);
+
+    if (!$retriever['data']['include'] && !$retriever['data']['customxslt']) {
+        return;
+    }
+    if (!$resource['data']) {
+        logger('retriever_apply_dom_filter: no text to work with', LOGGER_NORMAL);
+        return;
+    }
+
+    $encoding = retriever_get_encoding($resource);
+    $content = mb_convert_encoding($resource['data'], 'HTML-ENTITIES', $encoding);
+    $doc = new DOMDocument('1.0', 'UTF-8');
+    if (strpos($resource['type'], 'html') !== false) {
+        @$doc->loadHTML($content);
+    }
+    else {
+        $doc->loadXML($content);
+    }
+
+    $params = array('$spec' => $retriever['data']);
+    $extract_template = get_markup_template('extract.tpl', 'addon/retriever/');
+    $extract_xslt = replace_macros($extract_template, $params);
+    if ($retriever['data']['include']) {
+        $doc = retriever_apply_xslt_text($extract_xslt, $doc);
+    }
+    if ($retriever['data']['customxslt']) {
+        $doc = retriever_apply_xslt_text($retriever['data']['customxslt'], $doc);
+    }
+    if (!$doc) {
+        logger('retriever_apply_dom_filter: failed to apply extract XSLT template', LOGGER_NORMAL);
+        return;
+    }
+
+    $components = parse_url($resource['redirect-url']);
+    $rooturl = $components['scheme'] . "://" . $components['host'];
+    $dirurl = $rooturl . dirname($components['path']) . "/";
+    $params = array('$dirurl' => $dirurl, '$rooturl' => $rooturl);
+    $fix_urls_template = get_markup_template('fix-urls.tpl', 'addon/retriever/');
+    $fix_urls_xslt = replace_macros($fix_urls_template, $params);
+    $doc = retriever_apply_xslt_text($fix_urls_xslt, $doc);
+    if (!$doc) {
+        logger('retriever_apply_dom_filter: failed to apply fix urls XSLT template', LOGGER_NORMAL);
+        return;
+    }
+
+    $item['body'] = html2bbcode($doc->saveXML());
+    if (!strlen($item['body'])) {
+        logger('retriever_apply_dom_filter retriever ' . $retriever['id'] . ' item ' . $item['id'] . ': output was empty', LOGGER_NORMAL);
+        return;
+    }
+    $item['body'] .= "\n\n" . t('Retrieved') . ' ' . date("Y-m-d") . ': [url=';
+    $item['body'] .=  $item['plink'];
+    $item['body'] .= ']' . $item['plink'] . '[/url]';
+    q("UPDATE `item` SET `body` = '%s' WHERE `id` = %d",
+      dbesc($item['body']), intval($item['id']));
+}
+
+function retrieve_images(&$item) {
+    $matches1 = array();
+    preg_match_all("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", $item["body"], $matches1);
+    $matches2 = array();
+    preg_match_all("/\[img\](.*?)\[\/img\]/ism", $item["body"], $matches2);
+    $matches = array_merge($matches1[3], $matches2[1]);
+    logger('retrieve_images: found ' . count($matches) . ' images for item ' . $item['uri'] . ' ' . $item['uid'] . ' ' . $item['contact-id'], LOGGER_DEBUG);
+    foreach ($matches as $url) {
+        if (strpos($url, get_app()->get_baseurl()) === FALSE) {
+            $resource = add_retriever_resource($url, true);
+            if (!$resource['completed']) {
+                add_retriever_item($item, $resource);
+            }
+            else {
+                retriever_transform_images($item, $resource);
+            }
+        }
+    }
+}
+
+function retriever_check_item_completed(&$item)
+{
+    $r = q('SELECT count(*) FROM retriever_item WHERE `item-uri` = "%s" ' .
+           'AND `item-uid` = %d AND `contact-id` = %d AND `finished` = 0',
+           dbesc($item['uri']), intval($item['uid']),
+           intval($item['contact-id']));
+    $waiting = $r[0]['count(*)'];
+    logger('retriever_check_item_completed: item ' . $item['uri'] . ' ' . $item['uid']
+           . ' '. $item['contact-id'] . ' waiting for ' . $waiting . ' resources', LOGGER_DEBUG);
+    $old_visible = $item['visible'];
+    $item['visible'] = $waiting ? 0 : 1;
+    if (($item['id'] > 0) && ($old_visible != $item['visible'])) {
+        logger('retriever_check_item_completed: changing visible flag to ' . $item['visible'] . ' and invoking notifier ("edit_post", ' . $item['id'] . ')', LOGGER_DEBUG);
+        q("UPDATE `item` SET `visible` = %d WHERE `id` = %d",
+          intval($item['visible']),
+          intval($item['id']));
+        q("UPDATE `thread` SET `visible` = %d WHERE `iid` = %d",
+          intval($item['visible']),
+          intval($item['id']));
+    }
+}
+
+function retriever_apply_completed_resource_to_item($retriever, &$item, $resource) {
+    logger('retriever_apply_completed_resource_to_item: retriever ' .
+           ($retriever ? $retriever['id'] : 'none') .
+           ' resource ' . $resource['url'] . ' plink ' . $item['plink'], LOGGER_DEBUG);
+    if (strpos($resource['type'], 'image') !== false) {
+        retriever_transform_images($item, $resource);
+    }
+    if (!$retriever) {
+        return;
+    }
+    if ((strpos($resource['type'], 'html') !== false) ||
+        (strpos($resource['type'], 'xml') !== false)) {
+        retriever_apply_dom_filter($retriever, $item, $resource);
+        if ($retriever["data"]['images'] ) {
+            retrieve_images($item);
+        }
+    }
+}
+
+function retriever_store_photo($item, &$resource) {
+    $hash = photo_new_resource();
+
+    if (class_exists('Imagick')) {
+        try {
+            $image = new Imagick();
+            $image->readImageBlob($resource['data']);
+            $resource['width'] = $image->getImageWidth();
+            $resource['height'] = $image->getImageHeight();
+        }
+        catch (Exception $e) {
+            logger("ImageMagick couldn't process image " . $resource['id'] . " " . $resource['url'] . ' length ' . strlen($resource['data']) . ': ' . $e->getMessage(), LOGGER_DEBUG);
+            return false;
+        }
+    }
+    if (!array_key_exists('width', $resource)) {
+        $image = @imagecreatefromstring($resource['data']);
+        if ($image === false) {
+            logger("Couldn't process image " . $resource['id'] . " " . $resource['url'], LOGGER_DEBUG);
+            return false;
+        }
+        $resource['width']  = imagesx($image);
+        $resource['height'] = imagesy($image);
+        imagedestroy($image);
+    }
+
+    $url_components = parse_url($resource['url']);
+    $filename = basename($url_components['path']);
+    if (!strlen($filename)) {
+        $filename = 'image';
+    }
+    $r = q("INSERT INTO `photo`
+                ( `uid`, `contact-id`, `guid`, `resource-id`, `created`, `edited`, `filename`, `type`, `album`, `height`, `width`, `datasize`, `data` )
+                VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, '%s' )",
+           intval($item['item-uid']),
+           intval($item['contact-id']),
+           dbesc(get_guid()),
+           dbesc($hash),
+           dbesc(datetime_convert()),
+           dbesc(datetime_convert()),
+           dbesc($filename),
+           dbesc($resource['type']),
+           dbesc('Retrieved Images'),
+           intval($resource['height']),
+           intval($resource['width']),
+           intval(strlen($resource['data'])),
+           dbesc($resource['data'])
+        );
+
+    return $hash;
+}
+
+function retriever_transform_images(&$item, $resource) {
+    if (!$resource["data"]) {
+        logger('retriever_transform_images: no data available for '
+               . $resource['id'] . ' ' . $resource['url'], LOGGER_NORMAL);
+        return;
+    }
+
+    $hash = retriever_store_photo($item, $resource);
+    if ($hash === false) {
+        logger('retriever_transform_images: unable to store photo '
+               . $resource['id'] . ' ' . $resource['url'], LOGGER_NORMAL);
+        return;
+    }
+
+    $new_url = get_app()->get_baseurl() . '/photo/' . $hash;
+    logger('retriever_transform_images: replacing ' . $resource['url'] . ' with ' .
+           $new_url . ' in item ' . $item['plink'], LOGGER_DEBUG);
+    $transformed = str_replace($resource["url"], $new_url, $item['body']);
+    if ($transformed === $item['body']) {
+        return;
+    }
+
+    $item['body'] = $transformed;
+    q("UPDATE `item` SET `body` = '%s' WHERE `plink` = '%s' AND `uid` = %d AND `contact-id` = %d",
+      dbesc($item['body']),
+      dbesc($item['plink']),
+      intval($item['uid']),
+      intval($item['contact-id']));
+}
+
+function retriever_content($a) {
+    if (!local_user()) {
+        $a->page['content'] .= "<p>Please log in</p>";
+        return;
+    }
+    if ($a->argv[1] === 'help') {
+        $feeds = q("SELECT `id`, `name`, `thumb` FROM contact WHERE `uid` = %d AND `network` = 'feed'",
+                   local_user());
+        foreach ($feeds as $k=>$v) {
+            $feeds[$k]['url'] = $a->get_baseurl() . '/retriever/' . $v['id'];
+        }
+        $template = get_markup_template('/help.tpl', 'addon/retriever/');
+        $a->page['content'] .= replace_macros($template, array(
+                                                  '$config' => $a->get_baseurl() . '/settings/addon',
+                                                  '$feeds' => $feeds));
+        return;
+    }
+    if ($a->argv[1]) {
+        $retriever = get_retriever($a->argv[1], local_user(), false);
+
+        if (x($_POST["id"])) {
+            $retriever = get_retriever($a->argv[1], local_user(), true);
+            $retriever["data"] = array();
+            foreach (array('pattern', 'replace', 'enable', 'images', 'customxslt') as $setting) {
+                if (x($_POST['retriever_' . $setting])) {
+                    $retriever["data"][$setting] = $_POST['retriever_' . $setting];
+                }
+            }
+            foreach ($_POST as $k=>$v) {
+                if (preg_match("/retriever-(include|exclude)-(\d+)-(element|attribute|value)/", $k, $matches)) {
+                    $retriever['data'][$matches[1]][intval($matches[2])][$matches[3]] = $v;
+                }
+            }
+            // You've gotta have an element, even if it's just "*"
+            foreach ($retriever['data']['include'] as $k=>$clause) {
+                if (!$clause['element']) {
+                    unset($retriever['data']['include'][$k]);
+                }
+            }
+            foreach ($retriever['data']['exclude'] as $k=>$clause) {
+                if (!$clause['element']) {
+                    unset($retriever['data']['exclude'][$k]);
+                }
+            }
+            q("UPDATE `retriever_rule` SET `data`='%s' WHERE `id` = %d",
+              dbesc(json_encode($retriever["data"])), intval($retriever["id"]));
+            $a->page['content'] .= "<p><b>Settings Updated";
+            if (x($_POST["retriever_retrospective"])) {
+                apply_retrospective($retriever, $_POST["retriever_retrospective"]);
+                $a->page['content'] .= " and retrospectively applied to " . $_POST["apply"] . " posts";
+            }
+            $a->page['content'] .= ".</p></b>";
+        }
+
+        $template = get_markup_template('/rule-config.tpl', 'addon/retriever/');
+        $a->page['content'] .= replace_macros($template, array(
+                                                  '$enable' => array(
+                                                      'retriever_enable',
+                                                      t('Enabled'),
+                                                      $retriever['data']['enable']),
+                                                  '$pattern' => array(
+                                                      'retriever_pattern',
+                                                      t('URL Pattern'),
+                                                      $retriever["data"]['pattern'],
+                                                      t('Regular expression matching part of the URL to replace')),
+                                                  '$replace' => array(
+                                                      'retriever_replace',
+                                                      t('URL Replace'),
+                                                      $retriever["data"]['replace'],
+                                                      t('Text to replace matching part of above regular expression')),
+                                                  '$images' => array(
+                                                      'retriever_images',
+                                                      t('Download Images'),
+                                                      $retriever['data']['images']),
+                                                  '$retrospective' => array(
+                                                      'retriever_retrospective',
+                                                      t('Retrospectively Apply'),
+                                                      '0',
+                                                      t('Reapply the rules to this number of posts')),
+                                                  '$customxslt' => array(
+                                                      'retriever_customxslt',
+                                                      t('Custom XSLT'),
+                                                      $retriever['data']['customxslt'],
+                                                      t("When standard rules aren't enough, apply custom XSLT to the article")),
+                                                  '$title' => t('Retrieve Feed Content'),
+                                                  '$help' => $a->get_baseurl() . '/retriever/help',
+                                                  '$help_t' => t('Get Help'),
+                                                  '$submit_t' => t('Submit'),
+                                                  '$submit' => t('Save Settings'),
+                                                  '$id' => ($retriever["id"] ? $retriever["id"] : "create"),
+                                                  '$tag_t' => t('Tag'),
+                                                  '$attribute_t' => t('Attribute'),
+                                                  '$value_t' => t('Value'),
+                                                  '$add_t' => t('Add'),
+                                                  '$remove_t' => t('Remove'),
+                                                  '$include_t' => t('Include'),
+                                                  '$include' => $retriever['data']['include'],
+                                                  '$exclude_t' => t('Exclude'),
+                                                  '$exclude' => $retriever["data"]['exclude']));
+        return;
+    }
+}
+
+function retriever_contact_photo_menu($a, &$args) {
+    if (!$args) {
+        return;
+    }
+    if ($args["contact"]["network"] == "feed") {
+        $args["menu"][ 'retriever' ] = array(t('Retriever'), $a->get_baseurl() . '/retriever/' . $args["contact"]['id']);
+    }
+}
+
+function retriever_post_remote_hook(&$a, &$item) {
+    logger('retriever_post_remote_hook: ' . $item['uri'] . ' ' . $item['uid'] . ' ' . $item['contact-id'], LOGGER_DEBUG);
+
+    $retriever = get_retriever($item['contact-id'], $item["uid"], false);
+    if ($retriever) {
+        retriever_on_item_insert($retriever, $item);
+    }
+    else {
+        if (get_pconfig($item["uid"], 'retriever', 'oembed')) {
+            // Convert to HTML and back to take advantage of bbcode's resolution of oembeds.
+            $body = html2bbcode(bbcode($item['body']));
+            if ($body) {
+                $item['body'] = $body;
+            }
+        }
+        if (get_pconfig($item["uid"], 'retriever', 'all_photos')) {
+            retrieve_images($item, null);
+        }
+    }
+    retriever_check_item_completed($item);
+}
+
+function retriever_plugin_settings(&$a,&$s) {
+    $all_photos = get_pconfig(local_user(), 'retriever', 'all_photos');
+    $oembed = get_pconfig(local_user(), 'retriever', 'oembed');
+    $template = get_markup_template('/settings.tpl', 'addon/retriever/');
+    $s .= replace_macros($template, array(
+                             '$allphotos' => array(
+                                 'retriever_all_photos',
+                                 t('All Photos'),
+                                 $all_photos,
+                                 t('Check this to retrieve photos for all posts')),
+                             '$oembed' => array(
+                                 'retriever_oembed',
+                                 t('Resolve OEmbed'),
+                                 $oembed,
+                                 t('Check this to attempt to retrieve embedded content for all posts - useful e.g. for Facebook posts')),
+                             '$submit' => t('Save Settings'),
+                             '$title' => t('Retriever Settings'),
+                             '$help' => $a->get_baseurl() . '/retriever/help'));
+}
+
+function retriever_plugin_settings_post($a,$post) {
+    if ($_POST['retriever_all_photos']) {
+        set_pconfig(local_user(), 'retriever', 'all_photos', $_POST['retriever_all_photos']);
+    }
+    else {
+        del_pconfig(local_user(), 'retriever', 'all_photos');
+    }
+    if ($_POST['retriever_oembed']) {
+        set_pconfig(local_user(), 'retriever', 'oembed', $_POST['retriever_oembed']);
+    }
+    else {
+        del_pconfig(local_user(), 'retriever', 'oembed');
+    }
+}
diff --git a/retriever/templates/extract.tpl b/retriever/templates/extract.tpl
new file mode 100644 (file)
index 0000000..fd38bde
--- /dev/null
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+  <xsl:template match="text()"/>
+
+{{function clause_xpath}}
+{{if !$clause.attribute}}
+{{$clause.element}}{{elseif $clause.attribute == 'class'}}
+{{$clause.element}}[contains(concat(' ', normalize-space(@class), ' '), '{{$clause.value}}')]{{else}}
+{{$clause.element}}[@{{$clause.attribute}}='{{$clause.value}}']{{/if}}
+{{/function}}
+
+{{foreach $spec.include as $clause}}
+  <xsl:template match="{{clause_xpath clause=$clause}}">
+    <xsl:copy>
+      <xsl:apply-templates select="node()|@*" mode="remove"/>
+    </xsl:copy>
+  </xsl:template>
+{{/foreach}}
+
+{{foreach $spec.exclude as $clause}}
+  <xsl:template match="{{clause_xpath clause=$clause}}" mode="remove"/>
+{{/foreach}}
+
+  <xsl:template match="node()|@*" mode="remove">
+    <xsl:copy>
+      <xsl:apply-templates select="node()|@*" mode="remove"/>
+    </xsl:copy>
+  </xsl:template>
+
+</xsl:stylesheet>
diff --git a/retriever/templates/fix-urls.tpl b/retriever/templates/fix-urls.tpl
new file mode 100644 (file)
index 0000000..5bb665a
--- /dev/null
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- attempt to replace relative URLs with absolute URLs -->
+<!-- http://stackoverflow.com/questions/3824631/replace-href-value-in-anchor-tags-of-html-using-xslt -->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+  <xsl:output method="xml"/>
+
+  <xsl:template match="node()|@*">
+    <xsl:copy>
+      <xsl:apply-templates select="node()|@*"/>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="*/@src[starts-with(.,'.')]">
+    <xsl:attribute name="src">
+      <xsl:value-of select="concat('{{$dirurl}}',.)"/>
+    </xsl:attribute>
+  </xsl:template>
+  <xsl:template match="*/@src[starts-with(.,'/')]">
+    <xsl:attribute name="src">
+      <xsl:value-of select="concat('{{$rooturl}}',.)"/>
+    </xsl:attribute>
+  </xsl:template>
+
+</xsl:stylesheet>
diff --git a/retriever/templates/help.tpl b/retriever/templates/help.tpl
new file mode 100644 (file)
index 0000000..10b421d
--- /dev/null
@@ -0,0 +1,148 @@
+<h2>Retriever Plugin Help</h2>
+<p>
+This plugin replaces the short excerpts you normally get in RSS feeds
+with the full content of the article from the source website.  You
+specify which part of the page you're interested in with a set of
+rules.  When each item arrives, the plugin downloads the full page
+from the website, extracts content using the rules, and replaces the
+original article.
+</p>
+<p>
+There's a few reasons you may want to do this.  The source website
+might be slow or overloaded.  The source website might be
+untrustworthy, in which case using Friendica to scrub the HTML is a
+good idea.  You might be on a LAN that blacklists certain websites.
+It also works neatly with the mailstream plugin, allowing you to read
+a news stream comfortably without needing continuous Internet
+connectivity.
+</p>
+<p>
+However, setting up retriever can be quite tricky since it depends on
+the internal design of the website.  That was designed to make life
+easy for the website's developers, not for you.  You'll need to have
+some familiarity with HTML, and be willing to adapt when the website
+suddenly changes everything without notice.
+</p>
+<h3>Configuring Retriever for a feed</h3>
+<p>
+To set up retriever for an RSS feed, go to the "Contacts" page and
+find your feed.  Then click on the drop-down menu on the contact.
+Select "Retriever" to get to the retriever configuration.
+</p>
+<p>
+The "Include" configuration section specifies parts of the page to
+include in the article.  Each row has three components:
+</p>
+<ul>
+<li>An HTML tag (e.g. "div", "span", "p")</li>
+<li>An attribute (usually "class" or "id")</li>
+<li>A value for the attribute</li>
+</ul>
+<p>
+A simple case is when the article is wrapped in a "div" element:
+</p>
+<pre>
+    ...
+    &lt;div class="ArticleWrapper"&gt;
+      &lt;h2&gt;Man Bites Dog&lt;/h2&gt;
+      &lt;img src="mbd.jpg"&gt;
+      &lt;p&gt;
+        Residents of the sleepy community of Nowheresville were
+        shocked yesterday by the sight of creepy local weirdo Jim
+        McOddman assaulting innocent local dog Snufflekins with his
+        false teeth.
+      &lt;/p&gt;
+      ...
+    &lt;/div&gt;
+    ...
+</pre>
+<p>
+You then specify the tag "div", attribute "class", and value
+"ArticleWrapper".  Everything else in the page, such as navigation
+panels and menus and footers and so on, will be discarded.  If there
+is more than one section of the page you want to include, specify each
+one on a separate row.  If the matching section contains some sections
+you want to remove, specify those in the "Exclude" section in the same
+way.
+</p>
+<p>
+Once you've got a configuration that you think will work, you can try
+it out on some existing articles.  Type a number into the
+"Retrospectively Apply" box and click "Submit".  After a while
+(exactly how long depends on your system's cron configuration) the new
+articles should be available.
+</p>
+<h3>Techniques</h3>
+<p>
+You can leave the attribute and value blank to include all the
+corresponding elements with the specified tag name.  You can also use
+a tag name of just an asterisk ("*"), which will match any element type with the
+specified attribute regardless of the tag.
+</p>
+<p>
+Note that the "class" attribute is a special case.  Many web page
+templates will put multiple different classes in the same element,
+separated by spaces.  If you specify an attribute of "class" it will
+match an element if any of its classes matches the specified value.
+For example:
+</p>
+<pre>
+    &lt;div class="article breaking-news"&gt;
+</pre>
+<p>
+In this case you can specify a value of "article", or "breaking-news".
+You can also specify "article breaking-news", but that won't match if
+the website suddenly changes to "breaking-news article", so that's not
+recommended.
+</p>
+<p>
+One useful trick you can try is using the website's "print" pages.
+Many news sites have print versions of all their articles.  These are
+usually drastically simplified compared to the live website page.
+Sometimes this is a good way to get the whole article when it's
+normally split across multiple pages.
+</p>
+<p>
+Hopefully the URL for the print page is a predictable variant of the
+normal article URL.  For example, an article URL like:
+</p>
+<pre>
+    http://www.newssite.com/article-8636.html
+</pre>
+<p>
+...might have a print version at:
+</p>
+<pre>
+    http://www.newssite.com/print/article-8636.html
+</pre>
+<p>
+To change the URL used to retrieve the page, use the "URL Pattern" and
+"URL Replace" fields.  The pattern is a regular expression matching
+part of the URL to replace.  In this case, you might use a pattern of
+"/article" and a replace string of "/print/article".  A common pattern
+is simply a dollar sign ("$"), used to add the replace string to the end of the URL.
+</p>
+<h3>Background Processing</h3>
+<p>
+Note that retrieving and processing the articles can take some time,
+so it's done in the background.  Incoming articles will be marked as
+invisible while they're in the process of being downloaded.  If a URL
+fails, the plugin will keep trying at progressively longer intervals
+for up to a month, in case the website is temporarily overloaded or
+the network is down.
+</p>
+<h3>Retrieving Images</h3>
+<p>
+Retriever can also optionally download images and store them in the
+local Friendica instance.  Just check the "Download Images" box.  You
+can also download images in every item from your network, whether it's
+an RSS feed or not.  Go to the "Settings" page and
+click <a href="$config">"Plugin settings"</a>.  Then check the "All
+Photos" box in the "Retriever Settings" section and click "Submit".
+</p>
+<h2>Configure Feeds:</h2>
+<div>
+{{foreach $feeds as $feed}}
+{{include file='contact_template.tpl' contact=$feed}}
+{{/foreach}}
+</div>
diff --git a/retriever/templates/rule-config.tpl b/retriever/templates/rule-config.tpl
new file mode 100644 (file)
index 0000000..228d032
--- /dev/null
@@ -0,0 +1,112 @@
+<div class="settings-block">
+  <script language="javascript">
+function retriever_add_row(id)
+{
+    var tbody = document.getElementById(id);
+    var last = tbody.rows[tbody.childElementCount - 1];
+    var count = +last.id.replace(id + '-', '');
+    count++;
+    var row = document.createElement('tr');
+    row.id = id + '-' + count;
+    var cell1 = document.createElement('td');
+    var inptag = document.createElement('input');
+    inptag.name = row.id + '-element';
+    cell1.appendChild(inptag);
+    row.appendChild(cell1);
+    var cell2 = document.createElement('td');
+    var inpatt = document.createElement('input');
+    inpatt.name = row.id + '-attribute';
+    cell2.appendChild(inpatt);
+    row.appendChild(cell2);
+    var cell3 = document.createElement('td');
+    var inpval = document.createElement('input');
+    inpval.name = row.id + '-value';
+    cell3.appendChild(inpval);
+    row.appendChild(cell3);
+    var cell4 = document.createElement('td');
+    var butrem = document.createElement('input');
+    butrem.id = row.id + '-rem';
+    butrem.type = 'button';
+    butrem.onclick = function(){retriever_remove_row(id, count)};
+    butrem.value = '{{$remove_t}}';
+    cell4.appendChild(butrem);
+    row.appendChild(cell4);
+    tbody.appendChild(row);
+}
+
+function retriever_remove_row(id, number)
+{
+    var tbody = document.getElementById(id);
+    var row = document.getElementById(id + '-' + number);
+    tbody.removeChild(row);
+}
+  </script>
+  <h2>{{$title}}</h2>
+  <p><a href="{{$help}}">{{$help_t}}</a></p>
+  <form method="post">
+    <input type="hidden" name="id" value="{{$id}}">
+{{include file="field_checkbox.tpl" field=$enable}}
+{{include file="field_input.tpl" field=$pattern}}
+{{include file="field_input.tpl" field=$replace}}
+{{include file="field_checkbox.tpl" field=$images}}
+{{include file="field_input.tpl" field=$retrospective}}
+    <h3>{{$include_t}}:</h3>
+    <div>
+      <table>
+        <thead>
+          <tr><th>{{$tag_t}}</th><th>{{$attribute_t}}</th><th>{{$value_t}}</th></tr>
+        </thead>
+        <tbody id="retriever-include">
+{{if $include}}
+  {{foreach $include as $k=>$m}}
+          <tr id="retriever-include-{{$k}}">
+            <td><input name="retriever-include-{{$k}}-element" value="{{$m.element}}"></td>
+            <td><input name="retriever-include-{{$k}}-attribute" value="{{$m.attribute}}"></td>
+            <td><input name="retriever-include-{{$k}}-value" value="{{$m.value}}"></td>
+            <td><input id="retrieve-include-{{$k}}-rem" type="button" onclick="retriever_remove_row('retriever-include', {{$k}})" value="{{$remove_t}}"></td>
+          </tr>
+  {{/foreach}}
+{{else}}
+          <tr id="retriever-include-0">
+            <td><input name="retriever-include-0-element"></td>
+            <td><input name="retriever-include-0-attribute"></td>
+            <td><input name="retriever-include-0-value"></td>
+            <td><input id="retrieve-include-0-rem" type="button" onclick="retriever_remove_row('retriever-include', 0)" value="{{$remove_t}}"></td>
+          </tr>
+{{/if}}
+        </tbody>
+      </table>
+      <input type="button" onclick="retriever_add_row('retriever-include')" value="{{$add_t}}">
+    </div>
+    <h3>{{$exclude_t}}:</h3>
+    <div>
+      <table>
+        <thead>
+          <tr><th>Tag</th><th>Attribute</th><th>Value</th></tr>
+        </thead>
+        <tbody id="retriever-exclude">
+{{if $exclude}}
+  {{foreach $exclude as $k=>$r}}
+          <tr id="retriever-exclude-{{$k}}">
+            <td><input name="retriever-exclude-{{$k}}-element" value="{{$r.element}}"></td>
+            <td><input name="retriever-exclude-{{$k}}-attribute" value="{{$r.attribute}}"></td>
+            <td><input name="retriever-exclude-{{$k}}-value" value="{{$r.value}}"></td>
+            <td><input id="retrieve-exclude-{{$k}}-rem" type="button" onclick="retriever_remove_row('retriever-exclude', {{$k}})" value="{{$remove_t}}"></td>
+          </tr>
+  {{/foreach}}
+{{else}}
+          <tr id="retriever-exclude-0">
+            <td><input name="retriever-exclude-0-element"></td>
+            <td><input name="retriever-exclude-0-attribute"></td>
+            <td><input name="retriever-exclude-0-value"></td>
+            <td><input id="retrieve-exclude-0-rem" type="button" onclick="retriever_remove_row('retriever-exclude', 0)" value="{{$remove_t}}"></td>
+          </tr>
+{{/if}}
+        </tbody>
+      </table>
+      <input type="button" onclick="retriever_add_row('retriever-exclude')" value="{{$add_t}}">
+    </div>
+{{include file="field_textarea.tpl" field=$customxslt}}
+    <input type="submit" size="70" value="{{$submit_t}}">
+  </form>
+</div>
diff --git a/retriever/templates/settings.tpl b/retriever/templates/settings.tpl
new file mode 100644 (file)
index 0000000..8bfe8db
--- /dev/null
@@ -0,0 +1,9 @@
+<div class="settings-block">
+  <h3>{{$title}}</h3>
+  <p>
+    <a href="{{$help}}">Get Help</a>
+  </p>
+{{include file="field_checkbox.tpl" field=$allphotos}}
+{{include file="field_checkbox.tpl" field=$oembed}}
+  <input type="submit" value="{{$submit}}">
+</div>
index d63c2ee97df2d0a4c8c8d0294eef5c86c1f99a2b..21ed28331d0dc27e09ce344824335d999efb5e19 100644 (file)
@@ -57,8 +57,8 @@ function securemail_settings(App &$a, &$s){
         return;
     }
 
-    $enable = intval(PConfig::get(local_user(), 'securemail', 'enable'));
-    $publickey = PConfig::get(local_user(), 'securemail', 'pkey');
+    $enable = intval(get_pconfig(local_user(), 'securemail', 'enable'));
+    $publickey = get_pconfig(local_user(), 'securemail', 'pkey');
 
     $t = get_markup_template('admin.tpl', 'addon/securemail/');
 
@@ -88,7 +88,7 @@ function securemail_settings_post(App &$a, array &$b){
     }
 
     if ($_POST['securemail-submit']) {
-        PConfig::set(local_user(), 'securemail', 'pkey', trim($_POST['securemail-pkey']));
+        set_pconfig(local_user(), 'securemail', 'pkey', trim($_POST['securemail-pkey']));
         $enable = ((x($_POST, 'securemail-enable')) ? 1 : 0);
         PConfig::set(local_user(), 'securemail', 'enable', $enable);
         info(L10n::t('Secure Mail Settings saved.') . EOL);
@@ -109,7 +109,7 @@ function securemail_settings_post(App &$a, array &$b){
             $subject = 'Friendica - Secure Mail - Test';
             $message = 'This is a test message from your Friendica Secure Mail addon.';
 
-            $params = [
+            $params = array(
                 'uid' => local_user(),
                 'fromName' => $sitename,
                 'fromEmail' => $sender_email,
@@ -117,15 +117,15 @@ function securemail_settings_post(App &$a, array &$b){
                 'messageSubject' => $subject,
                 'htmlVersion' => "<p>{$message}</p>",
                 'textVersion' => $message,
-            ];
+            );
 
             // enable addon for test
-            PConfig::set(local_user(), 'securemail', 'enable', 1);
+            set_pconfig(local_user(), 'securemail', 'enable', 1);
 
             $res = Emailer::send($params);
 
             // revert to saved value
-            PConfig::set(local_user(), 'securemail', 'enable', $enable);
+            set_pconfig(local_user(), 'securemail', 'enable', $enable);
 
             if ($res) {
                 info(L10n::t('Test email sent') . EOL);
@@ -153,12 +153,12 @@ function securemail_emailer_send_prepare(App &$a, array &$b) {
 
     $uid = $b['uid'];
 
-    $enable_checked = PConfig::get($uid, 'securemail', 'enable');
+    $enable_checked = get_pconfig($uid, 'securemail', 'enable');
     if (!$enable_checked) {
         return;
     }
 
-    $public_key_ascii = PConfig::get($uid, 'securemail', 'pkey');
+    $public_key_ascii = get_pconfig($uid, 'securemail', 'pkey');
 
     preg_match('/-----BEGIN ([A-Za-z ]+)-----/', $public_key_ascii, $matches);
     $marker = (empty($matches[1])) ? 'MESSAGE' : $matches[1];
@@ -166,11 +166,11 @@ function securemail_emailer_send_prepare(App &$a, array &$b) {
 
     $key = OpenPGP_Message::parse($public_key);
 
-    $data = new OpenPGP_LiteralDataPacket($b['textVersion'], [
+    $data = new OpenPGP_LiteralDataPacket($b['textVersion'], array(
         'format' => 'u',
         'filename' => 'encrypted.gpg'
-    ]);
-    $encrypted = OpenPGP_Crypt_Symmetric::encrypt($key, new OpenPGP_Message([$data]));
+    ));
+    $encrypted = OpenPGP_Crypt_Symmetric::encrypt($key, new OpenPGP_Message(array($data)));
     $armored_encrypted = wordwrap(
         OpenPGP::enarmor($encrypted->to_bytes(), 'PGP MESSAGE'),
         64,
index 89cec83d4d6dc75590c3eb356ef8eadeed12762c..d3753e6fdc1340b3d4c3f26974195d3e8b9a93b0 100644 (file)
@@ -32,8 +32,8 @@ function showmore_addon_settings(&$a,&$s) {
 
        $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.$a->get_baseurl().'/addon/showmore/showmore.css'.'" media="all"/>'."\r\n";
 
-       $enable_checked = (intval(PConfig::get(local_user(),'showmore','disable')) ? '' : ' checked="checked"');
-       $chars = PConfig::get(local_user(),'showmore','chars');
+       $enable_checked = (intval(get_pconfig(local_user(),'showmore','disable')) ? '' : ' checked="checked"');
+       $chars = get_pconfig(local_user(),'showmore','chars');
        if(!$chars)
                $chars = '1100';
 
@@ -67,7 +67,7 @@ function showmore_addon_settings_post(&$a,&$b) {
                return;
 
        if($_POST['showmore-submit']) {
-               PConfig::set(local_user(),'showmore','chars',trim($_POST['showmore-chars']));
+               set_pconfig(local_user(),'showmore','chars',trim($_POST['showmore-chars']));
                $enable = ((x($_POST,'showmore-enable')) ? intval($_POST['showmore-enable']) : 0);
                $disable = 1-$enable;
                PConfig::set(local_user(),'showmore','disable', $disable);
@@ -110,10 +110,10 @@ function get_body_length($body) {
 function showmore_prepare_body(&$a,&$b) {
 
        $words = null;
-       if(PConfig::get(local_user(),'showmore','disable'))
+       if(get_pconfig(local_user(),'showmore','disable'))
                return;
 
-       $chars = (int)PConfig::get(local_user(),'showmore','chars');
+       $chars = (int)get_pconfig(local_user(),'showmore','chars');
        if(!$chars)
                $chars = 1100;
 
@@ -157,7 +157,7 @@ function showmore_cutitem($text, $limit) {
        @$doc->loadHTML($doctype."<html><body>".$text."</body></html>");
 
        $text = $doc->saveHTML();
-       $text = str_replace(["<html><body>", "</body></html>", $doctype], ["", "", ""], $text);
+       $text = str_replace(array("<html><body>", "</body></html>", $doctype), array("", "", ""), $text);
 
        return($text);
 }
index 2d4a0743e62cf737c8a62317dcf85a2d66e7261e..7c5e84f92e816215e5f6b564587a9494f6c36502 100644 (file)
@@ -41,34 +41,34 @@ function show_button($a, &$b) {
         *
         */
 
-       $texts =  [
-               '&lt;3',
-               '&lt;/3',
-               ':-)',
-               ';-)',
-               ':-(',
-               ':-P',
-               ':-X',
-               ':-D',
-               ':-O',
-               '\\\\o/',
-               'O_o',
-               ":\'(",
-               ":-!",
-               ":-/",
-               ":-[",
+       $texts =  array( 
+               '&lt;3', 
+               '&lt;/3', 
+               ':-)', 
+               ';-)', 
+               ':-(', 
+               ':-P', 
+               ':-X', 
+               ':-D', 
+               ':-O', 
+               '\\\\o/', 
+               'O_o', 
+               ":\'(", 
+               ":-!", 
+               ":-/", 
+               ":-[", 
                "8-)",
-               ':beer',
-               ':coffee',
+               ':beer', 
+               ':coffee', 
                ':facepalm',
                ':like',
                ':dislike',
                 '~friendica',
                 'red#'
 
-       ];
+       );
 
-       $icons = [
+       $icons = array(
                '<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-heart.gif" alt="<3" />',
                '<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-brokenheart.gif" alt="</3" />',
                '<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-smile.gif" alt=":-)" />',
@@ -77,7 +77,7 @@ function show_button($a, &$b) {
                '<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-tongue-out.gif" alt=":-P" />',
                '<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-kiss.gif" alt=":-X" />',
                '<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-laughing.gif" alt=":-D" />',
-               '<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-surprised.gif" alt=":-O" />',
+               '<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-surprised.gif" alt=":-O" />',                
                '<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-thumbsup.gif" alt="\\o/" />',
                '<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-Oo.gif" alt="O_o" />',
                '<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-cry.gif" alt=":\'(" />',
@@ -92,8 +92,8 @@ function show_button($a, &$b) {
                '<img class="smiley" src="' . $a->get_baseurl() . '/images/dislike.gif" alt=":dislike" />',
                '<img class="smiley" src="' . $a->get_baseurl() . '/images/friendica-16.png" alt="~friendica" />',
                '<img class="smiley" src="' . $a->get_baseurl() . '/images/rhash-16.png" alt="red" />'
-       ];
-
+       );
+       
        // Call hooks to get aditional smileies from other addons
        $params = ['texts' => $texts, 'icons' => $icons, 'string' => ""]; //changed
        Addon::callHooks('smilie', $params);
@@ -113,16 +113,16 @@ function show_button($a, &$b) {
 
        //Add css to header
        $css_file = 'addon/smileybutton/view/'.current_theme().'.css';
-       if (! file_exists($css_file))
+       if (! file_exists($css_file)) 
                $css_file = 'addon/smileybutton/view/default.css';
        $css_url = $a->get_baseurl().'/'.$css_file;
 
        $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.$css_url.'" media="all" />'."\r\n";
 
-
+       
        //Get the correct image for the theme
        $image = 'addon/smileybutton/view/'.current_theme().'.png';
-       if (! file_exists($image))
+       if (! file_exists($image)) 
                $image = 'addon/smileybutton/view/default.png';
        $image_url = $a->get_baseurl().'/'.$image;
 
diff --git a/snautofollow/lang/C/messages.po b/snautofollow/lang/C/messages.po
new file mode 100644 (file)
index 0000000..1cfdbc5
--- /dev/null
@@ -0,0 +1,34 @@
+# ADDON snautofollow
+# Copyright (C) 
+# This file is distributed under the same license as the Friendica snautofollow 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"
+
+#: snautofollow.php:32
+msgid "StatusNet AutoFollow settings updated."
+msgstr ""
+
+#: snautofollow.php:56
+msgid "StatusNet AutoFollow Settings"
+msgstr ""
+
+#: snautofollow.php:58
+msgid "Automatically follow any StatusNet followers/mentioners"
+msgstr ""
+
+#: snautofollow.php:64
+msgid "Submit"
+msgstr ""
diff --git a/snautofollow/lang/ca/strings.php b/snautofollow/lang/ca/strings.php
new file mode 100644 (file)
index 0000000..824361a
--- /dev/null
@@ -0,0 +1,6 @@
+<?php\r
+\r
+$a->strings["StatusNet AutoFollow settings updated."] = "Ajustos de AutoSeguiment a StatusNet actualitzats.";\r
+$a->strings["StatusNet AutoFollow Settings"] = "Ajustos de AutoSeguiment a StatusNet";\r
+$a->strings["Automatically follow any StatusNet followers/mentioners"] = "Segueix Automaticament qualsevol seguidor/mencionador de StatusNet";\r
+$a->strings["Submit"] = "Enviar";\r
diff --git a/snautofollow/lang/cs/messages.po b/snautofollow/lang/cs/messages.po
new file mode 100644 (file)
index 0000000..933478c
--- /dev/null
@@ -0,0 +1,36 @@
+# ADDON snautofollow
+# Copyright (C)
+# This file is distributed under the same license as the Friendica snautofollow 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:45+0200\n"
+"PO-Revision-Date: 2014-07-28 18:12+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"
+
+#: snautofollow.php:32
+msgid "StatusNet AutoFollow settings updated."
+msgstr "Nastavení automatického následování na StatusNet  aktualizováno."
+
+#: snautofollow.php:56 snautofollow.php:60
+msgid "StatusNet AutoFollow"
+msgstr "Nastavení StatusNet automatického následování (AutoFollow)"
+
+#: snautofollow.php:64
+msgid "Automatically follow any StatusNet followers/mentioners"
+msgstr "Automaticky následovat jakékoliv StatusNet následníky/přispivatele"
+
+#: snautofollow.php:70
+msgid "Save Settings"
+msgstr "Uložit Nastavení"
diff --git a/snautofollow/lang/cs/strings.php b/snautofollow/lang/cs/strings.php
new file mode 100644 (file)
index 0000000..144b8d8
--- /dev/null
@@ -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["StatusNet AutoFollow settings updated."] = "Nastavení automatického následování na StatusNet  aktualizováno.";
+$a->strings["StatusNet AutoFollow"] = "Nastavení StatusNet automatického následování (AutoFollow)";
+$a->strings["Automatically follow any StatusNet followers/mentioners"] = "Automaticky následovat jakékoliv StatusNet následníky/přispivatele";
+$a->strings["Save Settings"] = "Uložit Nastavení";
diff --git a/snautofollow/lang/de/messages.po b/snautofollow/lang/de/messages.po
new file mode 100644 (file)
index 0000000..fb19d4f
--- /dev/null
@@ -0,0 +1,36 @@
+# ADDON snautofollow
+# Copyright (C)
+# This file is distributed under the same license as the Friendica snautofollow 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-23 14:45+0200\n"
+"PO-Revision-Date: 2014-10-02 14: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"
+
+#: snautofollow.php:32
+msgid "StatusNet AutoFollow settings updated."
+msgstr "StatusNet AutoFollow Einstellungen aktualisiert."
+
+#: snautofollow.php:56 snautofollow.php:60
+msgid "StatusNet AutoFollow"
+msgstr "StatusNet AutoFollow"
+
+#: snautofollow.php:64
+msgid "Automatically follow any StatusNet followers/mentioners"
+msgstr "Automatisch allen StatusNet Followern/Erwähnungen folgen"
+
+#: snautofollow.php:70
+msgid "Save Settings"
+msgstr "Einstellungen speichern"
diff --git a/snautofollow/lang/de/strings.php b/snautofollow/lang/de/strings.php
new file mode 100644 (file)
index 0000000..83e99b8
--- /dev/null
@@ -0,0 +1,11 @@
+<?php
+
+if(! function_exists("string_plural_select_de")) {
+function string_plural_select_de($n){
+       return ($n != 1);;
+}}
+;
+$a->strings["StatusNet AutoFollow settings updated."] = "StatusNet AutoFollow Einstellungen aktualisiert.";
+$a->strings["StatusNet AutoFollow"] = "StatusNet AutoFollow";
+$a->strings["Automatically follow any StatusNet followers/mentioners"] = "Automatisch allen StatusNet Followern/Erwähnungen folgen";
+$a->strings["Save Settings"] = "Einstellungen speichern";
diff --git a/snautofollow/lang/eo/strings.php b/snautofollow/lang/eo/strings.php
new file mode 100644 (file)
index 0000000..8bd03fc
--- /dev/null
@@ -0,0 +1,6 @@
+<?php\r
+\r
+$a->strings["StatusNet AutoFollow settings updated."] = "Ĝidatigis StatusNet AutoFollow agordojn.";\r
+$a->strings["StatusNet AutoFollow Settings"] = "StatusNet AutoFollow agordoj";\r
+$a->strings["Automatically follow any StatusNet followers/mentioners"] = "Aŭtomate sekvu ĉiujn StatusNet sekvantojn/menciantojn.";\r
+$a->strings["Submit"] = "Sendi";\r
diff --git a/snautofollow/lang/es/messages.po b/snautofollow/lang/es/messages.po
new file mode 100644 (file)
index 0000000..afd8833
--- /dev/null
@@ -0,0 +1,36 @@
+# ADDON snautofollow
+# Copyright (C)
+# This file is distributed under the same license as the Friendica snautofollow addon package.
+# 
+# 
+# Translators:
+# Albert, 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-11-17 22:37+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"
+
+#: snautofollow.php:32
+msgid "StatusNet AutoFollow settings updated."
+msgstr "Ajustes de StatusNet AutoFollow actualizados."
+
+#: snautofollow.php:56
+msgid "StatusNet AutoFollow Settings"
+msgstr "Ajustes de StatusNet AutoFollow"
+
+#: snautofollow.php:58
+msgid "Automatically follow any StatusNet followers/mentioners"
+msgstr "Seguir automáticamente a cualquiera que te siga/mencione en StatusNet"
+
+#: snautofollow.php:64
+msgid "Submit"
+msgstr "Enviar"
diff --git a/snautofollow/lang/es/strings.php b/snautofollow/lang/es/strings.php
new file mode 100644 (file)
index 0000000..2800360
--- /dev/null
@@ -0,0 +1,11 @@
+<?php
+
+if(! function_exists("string_plural_select_es")) {
+function string_plural_select_es($n){
+       return ($n != 1);;
+}}
+;
+$a->strings["StatusNet AutoFollow settings updated."] = "Ajustes de StatusNet AutoFollow actualizados.";
+$a->strings["StatusNet AutoFollow Settings"] = "Ajustes de StatusNet AutoFollow";
+$a->strings["Automatically follow any StatusNet followers/mentioners"] = "Seguir automáticamente a cualquiera que te siga/mencione en StatusNet";
+$a->strings["Submit"] = "Enviar";
diff --git a/snautofollow/lang/fr/strings.php b/snautofollow/lang/fr/strings.php
new file mode 100644 (file)
index 0000000..f6791ff
--- /dev/null
@@ -0,0 +1,6 @@
+<?php\r
+\r
+$a->strings["StatusNet AutoFollow settings updated."] = "Réglages de suivi automatique sur StatusNet mis à jour.";\r
+$a->strings["StatusNet AutoFollow Settings"] = "Réglages de suivi automatique sur StatusNet";\r
+$a->strings["Automatically follow any StatusNet followers/mentioners"] = "Suivre automatiquement les personnes qui vous suivent ou vous mentionnent sur Statusnet";\r
+$a->strings["Submit"] = "Envoyer";\r
diff --git a/snautofollow/lang/is/strings.php b/snautofollow/lang/is/strings.php
new file mode 100644 (file)
index 0000000..73eda76
--- /dev/null
@@ -0,0 +1,6 @@
+<?php\r
+\r
+$a->strings["StatusNet AutoFollow settings updated."] = "";\r
+$a->strings["StatusNet AutoFollow Settings"] = "";\r
+$a->strings["Automatically follow any StatusNet followers/mentioners"] = "";\r
+$a->strings["Submit"] = "Senda inn";\r
diff --git a/snautofollow/lang/it/messages.po b/snautofollow/lang/it/messages.po
new file mode 100644 (file)
index 0000000..b7b8d3f
--- /dev/null
@@ -0,0 +1,36 @@
+# ADDON snautofollow
+# Copyright (C)
+# This file is distributed under the same license as the Friendica snautofollow addon package.
+# 
+# 
+# Translators:
+# fabrixxm <fabrix.xm@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-08-31 10:23+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"
+
+#: snautofollow.php:32
+msgid "StatusNet AutoFollow settings updated."
+msgstr "Impostazioni \"StatusNet AutoFollow\" aggiornate."
+
+#: snautofollow.php:56
+msgid "StatusNet AutoFollow Settings"
+msgstr "Impostazioni StatusNet AutoFollow"
+
+#: snautofollow.php:58
+msgid "Automatically follow any StatusNet followers/mentioners"
+msgstr "Segui automanticamente chiunque da StatusNet ti segua o ti menzioni"
+
+#: snautofollow.php:64
+msgid "Submit"
+msgstr "Invia"
diff --git a/snautofollow/lang/it/strings.php b/snautofollow/lang/it/strings.php
new file mode 100644 (file)
index 0000000..b6fab06
--- /dev/null
@@ -0,0 +1,11 @@
+<?php
+
+if(! function_exists("string_plural_select_it")) {
+function string_plural_select_it($n){
+       return ($n != 1);;
+}}
+;
+$a->strings["StatusNet AutoFollow settings updated."] = "Impostazioni \"StatusNet AutoFollow\" aggiornate.";
+$a->strings["StatusNet AutoFollow Settings"] = "Impostazioni StatusNet AutoFollow";
+$a->strings["Automatically follow any StatusNet followers/mentioners"] = "Segui automanticamente chiunque da StatusNet ti segua o ti menzioni";
+$a->strings["Submit"] = "Invia";
diff --git a/snautofollow/lang/nb-no/strings.php b/snautofollow/lang/nb-no/strings.php
new file mode 100644 (file)
index 0000000..6a25c73
--- /dev/null
@@ -0,0 +1,6 @@
+<?php\r
+\r
+$a->strings["StatusNet AutoFollow settings updated."] = "";\r
+$a->strings["StatusNet AutoFollow Settings"] = "";\r
+$a->strings["Automatically follow any StatusNet followers/mentioners"] = "";\r
+$a->strings["Submit"] = "Lagre";\r
diff --git a/snautofollow/lang/pl/strings.php b/snautofollow/lang/pl/strings.php
new file mode 100644 (file)
index 0000000..8ffa6d9
--- /dev/null
@@ -0,0 +1,6 @@
+<?php\r
+\r
+$a->strings["StatusNet AutoFollow settings updated."] = "";\r
+$a->strings["StatusNet AutoFollow Settings"] = "";\r
+$a->strings["Automatically follow any StatusNet followers/mentioners"] = "";\r
+$a->strings["Submit"] = "Potwierdź";\r
diff --git a/snautofollow/lang/pt-br/strings.php b/snautofollow/lang/pt-br/strings.php
new file mode 100644 (file)
index 0000000..c932de9
--- /dev/null
@@ -0,0 +1,6 @@
+<?php\r
+\r
+$a->strings["StatusNet AutoFollow settings updated."] = "";\r
+$a->strings["StatusNet AutoFollow Settings"] = "";\r
+$a->strings["Automatically follow any StatusNet followers/mentioners"] = "";\r
+$a->strings["Submit"] = "Enviar";\r
diff --git a/snautofollow/lang/ro/messages.po b/snautofollow/lang/ro/messages.po
new file mode 100644 (file)
index 0000000..108b6c8
--- /dev/null
@@ -0,0 +1,35 @@
+# ADDON snautofollow
+# Copyright (C)
+# This file is distributed under the same license as the Friendica snautofollow addon package.
+# 
+# 
+# Translators:
+msgid ""
+msgstr ""
+"Project-Id-Version: friendica\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-06-23 14:45+0200\n"
+"PO-Revision-Date: 2014-07-08 12:07+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"
+
+#: snautofollow.php:32
+msgid "StatusNet AutoFollow settings updated."
+msgstr "Configurări StatusNet AutoFollow actualizate."
+
+#: snautofollow.php:56 snautofollow.php:60
+msgid "StatusNet AutoFollow"
+msgstr "StatusNet AutoFollow"
+
+#: snautofollow.php:64
+msgid "Automatically follow any StatusNet followers/mentioners"
+msgstr "Urmărește automat orice susținător/pe cei ce vă menționează pe StatusNet"
+
+#: snautofollow.php:70
+msgid "Save Settings"
+msgstr "Salvare Configurări"
diff --git a/snautofollow/lang/ro/strings.php b/snautofollow/lang/ro/strings.php
new file mode 100644 (file)
index 0000000..b8fb967
--- /dev/null
@@ -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["StatusNet AutoFollow settings updated."] = "Configurări StatusNet AutoFollow actualizate.";
+$a->strings["StatusNet AutoFollow"] = "StatusNet AutoFollow";
+$a->strings["Automatically follow any StatusNet followers/mentioners"] = "Urmărește automat orice susținător/pe cei ce vă menționează pe StatusNet";
+$a->strings["Save Settings"] = "Salvare Configurări";
diff --git a/snautofollow/lang/ru/strings.php b/snautofollow/lang/ru/strings.php
new file mode 100644 (file)
index 0000000..2f7dec4
--- /dev/null
@@ -0,0 +1,6 @@
+<?php\r
+\r
+$a->strings["StatusNet AutoFollow settings updated."] = "";\r
+$a->strings["StatusNet AutoFollow Settings"] = "";\r
+$a->strings["Automatically follow any StatusNet followers/mentioners"] = "";\r
+$a->strings["Submit"] = "Подтвердить";\r
diff --git a/snautofollow/lang/sv/strings.php b/snautofollow/lang/sv/strings.php
new file mode 100644 (file)
index 0000000..3ec569a
--- /dev/null
@@ -0,0 +1,3 @@
+<?php\r
+\r
+$a->strings["Submit"] = "Spara";\r
diff --git a/snautofollow/lang/zh-cn/strings.php b/snautofollow/lang/zh-cn/strings.php
new file mode 100644 (file)
index 0000000..1c70424
--- /dev/null
@@ -0,0 +1,6 @@
+<?php\r
+\r
+$a->strings["StatusNet AutoFollow settings updated."] = "StatusNet自动关注设置更新了。";\r
+$a->strings["StatusNet AutoFollow Settings"] = "StatusNet自动关注设置";\r
+$a->strings["Automatically follow any StatusNet followers/mentioners"] = "自动关注所有的StatusGet关注者/提及";\r
+$a->strings["Submit"] = "提交";\r
diff --git a/snautofollow/snautofollow.css b/snautofollow/snautofollow.css
new file mode 100644 (file)
index 0000000..243ecaa
--- /dev/null
@@ -0,0 +1,14 @@
+
+
+
+#snautofollow-label {
+       float: left;
+       width: 200px;
+       margin-bottom: 25px;
+}
+
+#snautofollow-checkbox {
+       float: left;
+}
+
+
diff --git a/snautofollow/snautofollow.php b/snautofollow/snautofollow.php
new file mode 100644 (file)
index 0000000..2d953d5
--- /dev/null
@@ -0,0 +1,71 @@
+<?php
+/**
+ * Name: Snautofollow
+ * Description: Automatic follow/friend of statusnet people who mention/follow you
+ * Version: 1.0
+ * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
+ * Status: Unsupported
+ */
+
+
+function snautofollow_install() {
+
+       register_hook('connector_settings', 'addon/snautofollow/snautofollow.php', 'snautofollow_settings');
+       register_hook('connector_settings_post', 'addon/snautofollow/snautofollow.php', 'snautofollow_settings_post');
+
+}
+
+
+function snautofollow_uninstall() {
+       unregister_hook('connector_settings', 'addon/snautofollow/snautofollow.php', 'snautofollow_settings');
+       unregister_hook('connector_settings_post', 'addon/snautofollow/snautofollow.php', 'snautofollow_settings_post');
+
+}
+
+
+function snautofollow_settings_post($a,$post) {
+       if(! local_user() || (! x($_POST,'snautofollow-submit')))
+               return;
+
+       set_pconfig(local_user(),'system','ostatus_autofriend',intval($_POST['snautofollow']));
+       info( t('StatusNet AutoFollow settings updated.') . EOL);
+}
+
+function snautofollow_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/snautofollow/snautofollow.css' . '" media="all" />' . "\r\n";
+
+       /* Get the current state of our config variable */
+
+       $snautofollow = get_pconfig(local_user(),'system','ostatus_autofriend');
+       if($snautofollow === false)
+               $snautofollow = false;
+
+       $snautofollow_checked = (($snautofollow) ? ' checked="checked" ' : '');
+
+
+       /* Add some HTML to the existing form */
+
+       $s .= '<span id="settings_snautofollow_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_snautofollow_expanded\'); openClose(\'settings_snautofollow_inflated\');">';
+       $s .= '<h3>' . t('StatusNet AutoFollow') . '</h3>';
+       $s .= '</span>';
+       $s .= '<div id="settings_snautofollow_expanded" class="settings-block" style="display: none;">';
+       $s .= '<span class="fakelink" onclick="openClose(\'settings_snautofollow_expanded\'); openClose(\'settings_snautofollow_inflated\');">';
+       $s .= '<h3>' . t('StatusNet AutoFollow') . '</h3>';
+       $s .= '</span>';
+
+       $s .= '<div id="snautofollow-wrapper">';
+       $s .= '<label id="snautofollow-label" for="snautofollow-checkbox">' . t('Automatically follow any StatusNet followers/mentioners') . '</label>';
+       $s .= '<input id="snautofollow-checkbox" type="checkbox" name="snautofollow" value="1" ' . $snautofollow_checked . '/>';
+       $s .= '</div><div class="clear"></div>';
+
+       /* provide a submit button */
+
+       $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="snautofollow-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>';
+
+}
index 840b547e5ecc76f0c560e75118d5f5ce4f05ff69..a70e657397e9477d2f56a334d5eca6cc2c7a5218 100644 (file)
@@ -4,7 +4,7 @@
  * Description: Set a preferred page to load on login from home page
  * Version: 1.0
  * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
- *
+ * 
  */
 use Friendica\Core\Addon;
 use Friendica\Core\L10n;
@@ -29,9 +29,12 @@ function startpage_home_init($a, $b) {
        if(! local_user())
                return;
 
-       $page = PConfig::get(local_user(),'startpage','startpage');
+       $page = get_pconfig(local_user(),'startpage','startpage');
        if(strlen($page)) {
-               goaway($page);
+               $slash = ((strpos($page,'/') === 0) ? true : false);
+               if(stristr($page,'://'))
+                       goaway($page);
+               goaway($a->get_baseurl() . (($slash) ? '' : '/') . $page);
        }
        return;
 }
@@ -49,7 +52,7 @@ function startpage_settings_post($a,$post) {
        if(! local_user())
                return;
        if($_POST['startpage-submit'])
-               PConfig::set(local_user(),'startpage','startpage',strip_tags(trim($_POST['startpage'])));
+               set_pconfig(local_user(),'startpage','startpage',strip_tags(trim($_POST['startpage'])));
 }
 
 /**
@@ -69,7 +72,7 @@ function startpage_settings(&$a,&$s) {
 
        /* Get the current state of our config variable */
 
-       $page = PConfig::get(local_user(),'startpage','startpage');
+       $page = get_pconfig(local_user(),'startpage','startpage');
 
 
        /* Add some HTML to the existing form */
diff --git a/statistics_json/README.md b/statistics_json/README.md
new file mode 100644 (file)
index 0000000..a4d542c
--- /dev/null
@@ -0,0 +1,14 @@
+With this addon you send some information about your friendica node to the
+[the-federation.info](http://the-federation.info) page. It collects
+statistical data about building blocks of *The Federation*, the decentralized
+federated social networks (Diaspora*, ~friendica and red#matrix).
+
+The information includes
+
+* the name of your node
+* friendica version
+* registration policy
+* total number of users of that node and the active user number
+* total number of public postings
+* which plugins are activated (only Facebook, Twitter, Tumblr and Wordpress
+  will be displayed on the statistics page at the moment).
diff --git a/statistics_json/lang/C/messages.po b/statistics_json/lang/C/messages.po
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/statistics_json/statistics_json.php b/statistics_json/statistics_json.php
new file mode 100644 (file)
index 0000000..2bd2f41
--- /dev/null
@@ -0,0 +1,148 @@
+<?php
+
+/**
+ * Name: Statistics
+ * Description: Generates some statistics for http://the-federation.info/
+ * Version: 0.2
+ * Author: Michael Vogel <https://pirati.ca/profile/heluecht>
+ * Status: Unsupported
+ */
+
+function statistics_json_install() {
+       register_hook('cron', 'addon/statistics_json/statistics_json.php', 'statistics_json_cron');
+}
+
+
+function statistics_json_uninstall() {
+       unregister_hook('cron', 'addon/statistics_json/statistics_json.php', 'statistics_json_cron');
+}
+
+function statistics_json_module() {}
+
+function statistics_json_plugin_enabled($plugin) {
+       $r = q("SELECT * FROM `addon` WHERE `installed` = 1 AND `name` = '%s'", $plugin);
+       return((bool)(count($r) > 0));
+}
+
+function statistics_json_init() {
+       global $a;
+
+       $statistics = array(
+                       "name" => $a->config["sitename"],
+                       "network" => FRIENDICA_PLATFORM,
+                       "version" => FRIENDICA_VERSION."-".DB_UPDATE_VERSION,
+                       "registrations_open" => ($a->config['register_policy'] != 0),
+                       "total_users" => get_config('statistics_json','total_users'),
+                       "active_users_halfyear" => get_config('statistics_json','active_users_halfyear'),
+                       "active_users_monthly" => get_config('statistics_json','active_users_monthly'),
+                       "local_posts" => get_config('statistics_json','local_posts')
+                       );
+
+       $statistics["services"] = array();
+       $statistics["services"]["appnet"] = statistics_json_plugin_enabled("appnet");
+       $statistics["services"]["blogger"] = statistics_json_plugin_enabled("blogger");
+       $statistics["services"]["buffer"] = statistics_json_plugin_enabled("buffer");
+       $statistics["services"]["dreamwidth"] = statistics_json_plugin_enabled("dwpost");
+       $statistics["services"]["facebook"] = statistics_json_plugin_enabled("fbpost");
+       $statistics["services"]["gnusocial"] = statistics_json_plugin_enabled("statusnet");
+       $statistics["services"]["googleplus"] = statistics_json_plugin_enabled("gpluspost");
+       $statistics["services"]["libertree"] = statistics_json_plugin_enabled("libertree");
+       $statistics["services"]["livejournal"] = statistics_json_plugin_enabled("ljpost");
+       $statistics["services"]["pumpio"] = statistics_json_plugin_enabled("pumpio");
+       $statistics["services"]["twitter"] = statistics_json_plugin_enabled("twitter");
+       $statistics["services"]["tumblr"] = statistics_json_plugin_enabled("tumblr");
+       $statistics["services"]["wordpress"] = statistics_json_plugin_enabled("wppost");
+
+       $statistics["appnet"] = $statistics["services"]["appnet"];
+       $statistics["blogger"] = $statistics["services"]["blogger"];
+       $statistics["buffer"] = $statistics["services"]["buffer"];
+       $statistics["dreamwidth"] = $statistics["services"]["dreamwidth"];
+       $statistics["facebook"] = $statistics["services"]["facebook"];
+       $statistics["gnusocial"] = $statistics["services"]["gnusocial"];
+       $statistics["googleplus"] = $statistics["services"]["googleplus"];
+       $statistics["libertree"] = $statistics["services"]["libertree"];
+       $statistics["livejournal"] = $statistics["services"]["livejournal"];
+       $statistics["pumpio"] = $statistics["services"]["pumpio"];
+       $statistics["twitter"] = $statistics["services"]["twitter"];
+       $statistics["tumblr"] = $statistics["services"]["tumblr"];
+       $statistics["wordpress"] = $statistics["services"]["wordpress"];
+
+       header("Content-Type: application/json");
+       echo json_encode($statistics);
+       logger("statistics_init: printed ".print_r($statistics, true));
+       killme();
+}
+
+function statistics_json_cron($a,$b) {
+       $last = get_config('statistics_json','last_calucation');
+
+       if($last) {
+               // Calculate every 24 hours
+               $next = $last + (24 * 60 * 60);
+               if($next > time()) {
+                       logger('statistics_json_cron: calculation intervall not reached');
+                       return;
+               }
+       }
+        logger('statistics_json_cron: cron_start');
+
+
+       $users = q("SELECT profile.*, `user`.`login_date`, `lastitem`.`lastitem_date`
+                       FROM (SELECT MAX(`item`.`changed`) as `lastitem_date`, `item`.`uid`
+                               FROM `item`
+                                       WHERE `item`.`type` = 'wall'
+                                               GROUP BY `item`.`uid`) AS `lastitem`
+                                               RIGHT OUTER JOIN `user` ON `user`.`uid` = `lastitem`.`uid`, `contact`, `profile`
+                                WHERE
+                                       `user`.`uid` = `contact`.`uid` AND `profile`.`uid` = `user`.`uid`
+                                       AND `profile`.`is-default` AND (`profile`.`publish` OR `profile`.`net-publish`)
+                                       AND `user`.`verified` AND `contact`.`self`
+                                       AND NOT `user`.`blocked`
+                                       AND NOT `user`.`account_removed`
+                                       AND NOT `user`.`account_expired`");
+
+       if (is_array($users)) {
+                       $total_users = count($users);
+                       $active_users_halfyear = 0;
+                       $active_users_monthly = 0;
+
+                       $halfyear = time() - (180 * 24 * 60 * 60);
+                       $month = time() - (30 * 24 * 60 * 60);
+
+                       foreach ($users AS $user) {
+                               if ((strtotime($user['login_date']) > $halfyear) ||
+                                       (strtotime($user['lastitem_date']) > $halfyear))
+                                       ++$active_users_halfyear;
+
+                               if ((strtotime($user['login_date']) > $month) ||
+                                       (strtotime($user['lastitem_date']) > $month))
+                                       ++$active_users_monthly;
+
+                       }
+                       set_config('statistics_json','total_users', $total_users);
+                       logger('statistics_json_cron: total_users: '.$total_users, LOGGER_DEBUG);
+
+                       set_config('statistics_json','active_users_halfyear', $active_users_halfyear);
+                       set_config('statistics_json','active_users_monthly', $active_users_monthly);
+       }
+
+       $posts = q("SELECT COUNT(*) AS local_posts FROM `item` WHERE `wall` AND `uid` != 0 AND `id` = `parent` AND left(body, 6) != '[share'");
+
+       if (!is_array($posts))
+               $local_posts = -1;
+       else
+               $local_posts = $posts[0]["local_posts"];
+
+       set_config('statistics_json','local_posts', $local_posts);
+
+        logger('statistics_json_cron: local_posts: '.$local_posts, LOGGER_DEBUG);
+
+       // Now trying to register
+       $url = "http://the-federation.info/register/".$a->get_hostname();
+        logger('statistics_json_cron: registering url: '.$url, LOGGER_DEBUG);
+       $ret = fetch_url($url);
+        logger('statistics_json_cron: registering answer: '.$ret, LOGGER_DEBUG);
+
+        logger('statistics_json_cron: cron_end');
+       set_config('statistics_json','last_calucation', time());
+}
index c54ff55f6c923ce65d4b4e3051bf2d770144884c..16f68a8aa1f5b36f5cf190ebdcddb4b8278b9896 100644 (file)
@@ -1,5 +1,4 @@
 <?php
-
 /**
  * Name: GNU Social Connector
  * Description: Bidirectional (posting, relaying and reading) connector for GNU Social.
@@ -56,8 +55,7 @@ use Friendica\Model\User;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Network;
 
-function statusnet_install()
-{
+function statusnet_install() {
        //  we need some hooks, for the configuration and for sending tweets
        Addon::registerHook('connector_settings', 'addon/statusnet/statusnet.php', 'statusnet_settings');
        Addon::registerHook('connector_settings_post', 'addon/statusnet/statusnet.php', 'statusnet_settings_post');
@@ -87,52 +85,46 @@ function statusnet_uninstall()
        Addon::unregisterHook('addon_settings_post', 'addon/statusnet/statusnet.php', 'statusnet_settings_post');
 }
 
-function statusnet_check_item_notification(App $a, &$notification_data)
-{
-       $notification_data["profiles"][] = PConfig::get($notification_data["uid"], 'statusnet', 'own_url');
+function statusnet_check_item_notification($a, &$notification_data) {
+       $notification_data["profiles"][] = get_pconfig($notification_data["uid"], 'statusnet', 'own_url');
 }
 
-function statusnet_jot_nets(App $a, &$b)
-{
-       if (!local_user()) {
+function statusnet_jot_nets(&$a,&$b) {
+       if(! local_user())
                return;
-       }
 
-       $statusnet_post = PConfig::get(local_user(), 'statusnet', 'post');
-       if (intval($statusnet_post) == 1) {
-               $statusnet_defpost = PConfig::get(local_user(), 'statusnet', 'post_by_default');
+       $statusnet_post = get_pconfig(local_user(),'statusnet','post');
+       if(intval($statusnet_post) == 1) {
+               $statusnet_defpost = get_pconfig(local_user(),'statusnet','post_by_default');
                $selected = ((intval($statusnet_defpost) == 1) ? ' checked="checked" ' : '');
                $b .= '<div class="profile-jot-net"><input type="checkbox" name="statusnet_enable"' . $selected . ' value="1" /> '
                        . L10n::t('Post to GNU Social') . '</div>';
        }
 }
 
-function statusnet_settings_post(App $a, $post)
-{
-       if (!local_user()) {
+function statusnet_settings_post ($a,$post) {
+       if(! local_user())
                return;
-       }
        // don't check GNU Social settings if GNU Social submit button is not clicked
-       if (!x($_POST, 'statusnet-submit')) {
+       if (!x($_POST,'statusnet-submit'))
                return;
-       }
 
        if (isset($_POST['statusnet-disconnect'])) {
-               /*               * *
+               /***
                 * if the GNU Social-disconnect checkbox is set, clear the GNU Social configuration
                 */
-               PConfig::delete(local_user(), 'statusnet', 'consumerkey');
-               PConfig::delete(local_user(), 'statusnet', 'consumersecret');
-               PConfig::delete(local_user(), 'statusnet', 'post');
-               PConfig::delete(local_user(), 'statusnet', 'post_by_default');
-               PConfig::delete(local_user(), 'statusnet', 'oauthtoken');
-               PConfig::delete(local_user(), 'statusnet', 'oauthsecret');
-               PConfig::delete(local_user(), 'statusnet', 'baseapi');
-               PConfig::delete(local_user(), 'statusnet', 'lastid');
-               PConfig::delete(local_user(), 'statusnet', 'mirror_posts');
-               PConfig::delete(local_user(), 'statusnet', 'import');
-               PConfig::delete(local_user(), 'statusnet', 'create_user');
-               PConfig::delete(local_user(), 'statusnet', 'own_id');
+               del_pconfig(local_user(), 'statusnet', 'consumerkey');
+               del_pconfig(local_user(), 'statusnet', 'consumersecret');
+               del_pconfig(local_user(), 'statusnet', 'post');
+               del_pconfig(local_user(), 'statusnet', 'post_by_default');
+               del_pconfig(local_user(), 'statusnet', 'oauthtoken');
+               del_pconfig(local_user(), 'statusnet', 'oauthsecret');
+               del_pconfig(local_user(), 'statusnet', 'baseapi');
+               del_pconfig(local_user(), 'statusnet', 'lastid');
+               del_pconfig(local_user(), 'statusnet', 'mirror_posts');
+               del_pconfig(local_user(), 'statusnet', 'import');
+               del_pconfig(local_user(), 'statusnet', 'create_user');
+               del_pconfig(local_user(), 'statusnet', 'own_id');
        } else {
                if (isset($_POST['statusnet-preconf-apiurl'])) {
                        /*                       * *
@@ -164,11 +156,10 @@ function statusnet_settings_post(App $a, $post)
                                $apibase = $_POST['statusnet-baseapi'];
                                $c = Network::fetchUrl($apibase . 'statusnet/version.xml');
                                if (strlen($c) > 0) {
-                                       //  ok the API path is correct, let's save the settings
-                                       PConfig::set(local_user(), 'statusnet', 'consumerkey', $_POST['statusnet-consumerkey']);
-                                       PConfig::set(local_user(), 'statusnet', 'consumersecret', $_POST['statusnet-consumersecret']);
-                                       PConfig::set(local_user(), 'statusnet', 'baseapi', $apibase);
-                                       //PConfig::set(local_user(), 'statusnet', 'application_name', $_POST['statusnet-applicationname'] );
+                                       set_pconfig(local_user(), 'statusnet', 'consumerkey', $asn['consumerkey'] );
+                                       set_pconfig(local_user(), 'statusnet', 'consumersecret', $asn['consumersecret'] );
+                                       set_pconfig(local_user(), 'statusnet', 'baseapi', $asn['apiurl'] );
+                                       //set_pconfig(local_user(), 'statusnet', 'application_name', $asn['applicationname'] );
                                } else {
                                        //  the API path is not correct, maybe missing trailing / ?
                                        $apibase = $apibase . '/';
@@ -183,7 +174,31 @@ function statusnet_settings_post(App $a, $post)
                                                notice(L10n::t('We could not contact the GNU Social API with the Path you entered.') . EOL);
                                        }
                                }
-                               goaway('settings/connectors');
+                       }
+               }
+               goaway($a->get_baseurl().'/settings/connectors');
+       } else {
+       if (isset($_POST['statusnet-consumersecret'])) {
+               //  check if we can reach the API of the GNU Social server
+               //  we'll check the API Version for that, if we don't get one we'll try to fix the path but will
+               //  resign quickly after this one try to fix the path ;-)
+               $apibase = $_POST['statusnet-baseapi'];
+               $c = fetch_url( $apibase . 'statusnet/version.xml' );
+               if (strlen($c) > 0) {
+                       //  ok the API path is correct, let's save the settings
+                       set_pconfig(local_user(), 'statusnet', 'consumerkey', $_POST['statusnet-consumerkey']);
+                       set_pconfig(local_user(), 'statusnet', 'consumersecret', $_POST['statusnet-consumersecret']);
+                       set_pconfig(local_user(), 'statusnet', 'baseapi', $apibase );
+                       //set_pconfig(local_user(), 'statusnet', 'application_name', $_POST['statusnet-applicationname'] );
+               } else {
+                       //  the API path is not correct, maybe missing trailing / ?
+                       $apibase = $apibase . '/';
+                       $c = fetch_url( $apibase . 'statusnet/version.xml' );
+                       if (strlen($c) > 0) {
+                               //  ok the API path is now correct, let's save the settings
+                               set_pconfig(local_user(), 'statusnet', 'consumerkey', $_POST['statusnet-consumerkey']);
+                               set_pconfig(local_user(), 'statusnet', 'consumersecret', $_POST['statusnet-consumersecret']);
+                               set_pconfig(local_user(), 'statusnet', 'baseapi', $apibase );
                        } else {
                                if (isset($_POST['statusnet-pin'])) {
                                        //  if the user supplied us with a PIN from GNU Social, let the magic of OAuth happen
@@ -218,38 +233,67 @@ function statusnet_settings_post(App $a, $post)
                                }
                        }
                }
-       }
+               goaway($a->get_baseurl().'/settings/connectors');
+       } else {
+       if (isset($_POST['statusnet-pin'])) {
+               //  if the user supplied us with a PIN from GNU Social, let the magic of OAuth happen
+               $api     = get_pconfig(local_user(), 'statusnet', 'baseapi');
+               $ckey    = get_pconfig(local_user(), 'statusnet', 'consumerkey'  );
+               $csecret = get_pconfig(local_user(), 'statusnet', 'consumersecret' );
+               //  the token and secret for which the PIN was generated were hidden in the settings
+               //  form as token and token2, we need a new connection to GNU Social using these token
+               //  and secret to request a Access Token with the PIN
+               $connection = new StatusNetOAuth($api, $ckey, $csecret, $_POST['statusnet-token'], $_POST['statusnet-token2']);
+               $token   = $connection->getAccessToken( $_POST['statusnet-pin'] );
+               //  ok, now that we have the Access Token, save them in the user config
+               set_pconfig(local_user(),'statusnet', 'oauthtoken',  $token['oauth_token']);
+               set_pconfig(local_user(),'statusnet', 'oauthsecret', $token['oauth_token_secret']);
+               set_pconfig(local_user(),'statusnet', 'post', 1);
+               set_pconfig(local_user(),'statusnet', 'post_taglinks', 1);
+               //  reload the Addon Settings page, if we don't do it see Bug #42
+               goaway($a->get_baseurl().'/settings/connectors');
+       } else {
+               //  if no PIN is supplied in the POST variables, the user has changed the setting
+               //  to post a dent for every new __public__ posting to the wall
+               set_pconfig(local_user(),'statusnet','post',intval($_POST['statusnet-enable']));
+               set_pconfig(local_user(),'statusnet','post_by_default',intval($_POST['statusnet-default']));
+               set_pconfig(local_user(), 'statusnet', 'mirror_posts', intval($_POST['statusnet-mirror']));
+               set_pconfig(local_user(), 'statusnet', 'import', intval($_POST['statusnet-import']));
+               set_pconfig(local_user(), 'statusnet', 'create_user', intval($_POST['statusnet-create_user']));
+
+               if (!intval($_POST['statusnet-mirror']))
+                       del_pconfig(local_user(),'statusnet','lastid');
+
+               info( t('GNU Social settings updated.') . EOL);
+       }}}}
 }
-
-function statusnet_settings(App $a, &$s)
-{
-       if (!local_user()) {
+function statusnet_settings(&$a,&$s) {
+       if(! local_user())
                return;
-       }
        $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . $a->get_baseurl() . '/addon/statusnet/statusnet.css' . '" media="all" />' . "\r\n";
-       /*       * *
+       /***
         * 1) Check that we have a base api url and a consumer key & secret
         * 2) If no OAuthtoken & stuff is present, generate button to get some
         *    allow the user to cancel the connection process at this step
         * 3) Checkbox for "Send public notices (respect size limitation)
         */
-       $api     = PConfig::get(local_user(), 'statusnet', 'baseapi');
-       $ckey    = PConfig::get(local_user(), 'statusnet', 'consumerkey');
-       $csecret = PConfig::get(local_user(), 'statusnet', 'consumersecret');
-       $otoken  = PConfig::get(local_user(), 'statusnet', 'oauthtoken');
-       $osecret = PConfig::get(local_user(), 'statusnet', 'oauthsecret');
-       $enabled = PConfig::get(local_user(), 'statusnet', 'post');
+       $api     = get_pconfig(local_user(), 'statusnet', 'baseapi');
+       $ckey    = get_pconfig(local_user(), 'statusnet', 'consumerkey');
+       $csecret = get_pconfig(local_user(), 'statusnet', 'consumersecret');
+       $otoken  = get_pconfig(local_user(), 'statusnet', 'oauthtoken');
+       $osecret = get_pconfig(local_user(), 'statusnet', 'oauthsecret');
+       $enabled = get_pconfig(local_user(), 'statusnet', 'post');
        $checked = (($enabled) ? ' checked="checked" ' : '');
-       $defenabled = PConfig::get(local_user(), 'statusnet', 'post_by_default');
+       $defenabled = get_pconfig(local_user(),'statusnet','post_by_default');
        $defchecked = (($defenabled) ? ' checked="checked" ' : '');
-       $mirrorenabled = PConfig::get(local_user(), 'statusnet', 'mirror_posts');
+       $mirrorenabled = get_pconfig(local_user(),'statusnet','mirror_posts');
        $mirrorchecked = (($mirrorenabled) ? ' checked="checked" ' : '');
-       $import = PConfig::get(local_user(), 'statusnet', 'import');
-       $importselected = ["", "", ""];
+       $import = get_pconfig(local_user(),'statusnet','import');
+       $importselected = array("", "", "");
        $importselected[$import] = ' selected="selected"';
-       //$importenabled = PConfig::get(local_user(),'statusnet','import');
+       //$importenabled = get_pconfig(local_user(),'statusnet','import');
        //$importchecked = (($importenabled) ? ' checked="checked" ' : '');
-       $create_userenabled = PConfig::get(local_user(), 'statusnet', 'create_user');
+       $create_userenabled = get_pconfig(local_user(),'statusnet','create_user');
        $create_userchecked = (($create_userenabled) ? ' checked="checked" ' : '');
 
        $css = (($enabled) ? '' : '-disabled');
@@ -262,12 +306,12 @@ function statusnet_settings(App $a, &$s)
        $s .= '<img class="connector' . $css . '" src="images/gnusocial.png" /><h3 class="connector">' . L10n::t('GNU Social Import/Export/Mirror') . '</h3>';
        $s .= '</span>';
 
-       if ((!$ckey) && (!$csecret)) {
-               /*               * *
+       if ( (!$ckey) && (!$csecret) ) {
+               /***
                 * no consumer keys
                 */
-               $globalsn = Config::get('statusnet', 'sites');
-               /*               * *
+               $globalsn = get_config('statusnet', 'sites');
+               /***
                 * lets check if we have one or more globally configured GNU Social
                 * server OAuth credentials in the configuration. If so offer them
                 * with a little explanation to the user as choice - otherwise
@@ -278,7 +322,7 @@ function statusnet_settings(App $a, &$s)
                        $s .= '<p>' . L10n::t("There are preconfigured OAuth key pairs for some GNU Social servers available. If you are using one of them, please use these credentials. If not feel free to connect to any other GNU Social instance \x28see below\x29.") . '</p>';
                        $s .= '<div id="statusnet-preconf-wrapper">';
                        foreach ($globalsn as $asn) {
-                               $s .= '<input type="radio" name="statusnet-preconf-apiurl" value="' . $asn['apiurl'] . '">' . $asn['sitename'] . '<br />';
+                               $s .= '<input type="radio" name="statusnet-preconf-apiurl" value="'. $asn['apiurl'] .'">'. $asn['sitename'] .'<br />';
                        }
                        $s .= '<p></p><div class="clear"></div></div>';
                        $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div>';
@@ -301,11 +345,11 @@ function statusnet_settings(App $a, &$s)
                $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div>';
                $s .= '</div>';
        } else {
-               /*               * *
+               /***
                 * ok we have a consumer key pair now look into the OAuth stuff
                 */
-               if ((!$otoken) && (!$osecret)) {
-                       /*                       * *
+               if ( (!$otoken) && (!$osecret) ) {
+                       /***
                         * the user has not yet connected the account to GNU Social
                         * get a temporary OAuth key/secret pair and display a button with
                         * which the user can request a PIN to connect the account to a
@@ -314,7 +358,7 @@ function statusnet_settings(App $a, &$s)
                        $connection = new StatusNetOAuth($api, $ckey, $csecret);
                        $request_token = $connection->getRequestToken('oob');
                        $token = $request_token['oauth_token'];
-                       /*                       * *
+                       /***
                         *  make some nice form
                         */
                        $s .= '<p>' . L10n::t('To connect to your GNU Social account click the button below to get a security code from GNU Social which you have to copy into the input box below and submit the form. Only your <strong>public</strong> posts will be posted to GNU Social.') . '</p>';
@@ -322,8 +366,8 @@ function statusnet_settings(App $a, &$s)
                        $s .= '<div id="statusnet-pin-wrapper">';
                        $s .= '<label id="statusnet-pin-label" for="statusnet-pin">' . L10n::t('Copy the security code from GNU Social here') . '</label>';
                        $s .= '<input id="statusnet-pin" type="text" name="statusnet-pin" />';
-                       $s .= '<input id="statusnet-token" type="hidden" name="statusnet-token" value="' . $token . '" />';
-                       $s .= '<input id="statusnet-token2" type="hidden" name="statusnet-token2" value="' . $request_token['oauth_token_secret'] . '" />';
+                       $s .= '<input id="statusnet-token" type="hidden" name="statusnet-token" value="'.$token.'" />';
+                       $s .= '<input id="statusnet-token2" type="hidden" name="statusnet-token2" value="'.$request_token['oauth_token_secret'].'" />';
                        $s .= '</div><div class="clear"></div>';
                        $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div>';
                        $s .= '<h4>' . L10n::t('Cancel Connection Process') . '</h4>';
@@ -334,11 +378,11 @@ function statusnet_settings(App $a, &$s)
                        $s .= '</div><div class="clear"></div>';
                        $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div>';
                } else {
-                       /*                       * *
+                       /***
                         *  we have an OAuth key / secret pair for the user
                         *  so let's give a chance to disable the postings to GNU Social
                         */
-                       $connection = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret);
+                       $connection = new StatusNetOAuth($api,$ckey,$csecret,$otoken,$osecret);
                        $details = $connection->get('account/verify_credentials');
                        $s .= '<div id="statusnet-info" ><img id="statusnet-avatar" src="' . $details->profile_image_url . '" /><p id="statusnet-info-block">' . L10n::t('Currently connected to: ') . '<a href="' . $details->statusnet_profile_url . '" target="_statusnet">' . $details->screen_name . '</a><br /><em>' . $details->description . '</em></p></div>';
                        $s .= '<p>' . L10n::t('If enabled all your <strong>public</strong> postings can be posted to the associated GNU Social account. You can choose to do so by default (here) or for every posting separately in the posting options when writing the entry.') . '</p>';
@@ -383,8 +427,8 @@ function statusnet_settings(App $a, &$s)
        $s .= '</div><div class="clear"></div>';
 }
 
-function statusnet_post_local(App $a, &$b)
-{
+
+function statusnet_post_local(&$a, &$b) {
        if ($b['edit']) {
                return;
        }
@@ -393,11 +437,11 @@ function statusnet_post_local(App $a, &$b)
                return;
        }
 
-       $statusnet_post = PConfig::get(local_user(), 'statusnet', 'post');
-       $statusnet_enable = (($statusnet_post && x($_REQUEST, 'statusnet_enable')) ? intval($_REQUEST['statusnet_enable']) : 0);
+       $statusnet_post = get_pconfig(local_user(),'statusnet','post');
+       $statusnet_enable = (($statusnet_post && x($_REQUEST,'statusnet_enable')) ? intval($_REQUEST['statusnet_enable']) : 0);
 
        // if API is used, default to the chosen settings
-       if ($b['api_source'] && intval(PConfig::get(local_user(), 'statusnet', 'post_by_default'))) {
+       if ($b['api_source'] && intval(get_pconfig(local_user(),'statusnet','post_by_default'))) {
                $statusnet_enable = 1;
        }
 
@@ -412,61 +456,64 @@ function statusnet_post_local(App $a, &$b)
        $b['postopts'] .= 'statusnet';
 }
 
-function statusnet_action(App $a, $uid, $pid, $action)
-{
-       $api = PConfig::get($uid, 'statusnet', 'baseapi');
-       $ckey = PConfig::get($uid, 'statusnet', 'consumerkey');
-       $csecret = PConfig::get($uid, 'statusnet', 'consumersecret');
-       $otoken = PConfig::get($uid, 'statusnet', 'oauthtoken');
-       $osecret = PConfig::get($uid, 'statusnet', 'oauthsecret');
+function statusnet_action($a, $uid, $pid, $action) {
+       $api     = get_pconfig($uid, 'statusnet', 'baseapi');
+       $ckey    = get_pconfig($uid, 'statusnet', 'consumerkey');
+       $csecret = get_pconfig($uid, 'statusnet', 'consumersecret');
+       $otoken  = get_pconfig($uid, 'statusnet', 'oauthtoken');
+       $osecret = get_pconfig($uid, 'statusnet', 'oauthsecret');
 
-       $connection = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret);
+       $connection = new StatusNetOAuth($api,$ckey,$csecret,$otoken,$osecret);
 
-       logger("statusnet_action '" . $action . "' ID: " . $pid, LOGGER_DATA);
+       logger("statusnet_action '".$action."' ID: ".$pid, LOGGER_DATA);
 
        switch ($action) {
                case "delete":
-                       $result = $connection->post("statuses/destroy/" . $pid);
+                       $result = $connection->post("statuses/destroy/".$pid);
                        break;
                case "like":
-                       $result = $connection->post("favorites/create/" . $pid);
+                       $result = $connection->post("favorites/create/".$pid);
                        break;
                case "unlike":
-                       $result = $connection->post("favorites/destroy/" . $pid);
+                       $result = $connection->post("favorites/destroy/".$pid);
                        break;
        }
-       logger("statusnet_action '" . $action . "' send, result: " . print_r($result, true), LOGGER_DEBUG);
+       logger("statusnet_action '".$action."' send, result: " . print_r($result, true), LOGGER_DEBUG);
 }
 
-function statusnet_post_hook(App $a, &$b)
-{
+function statusnet_post_hook(&$a,&$b) {
+
        /**
         * Post to GNU Social
         */
-       if (!PConfig::get($b["uid"], 'statusnet', 'import')) {
-               if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
+
+       if (!get_pconfig($b["uid"],'statusnet','import')) {
+               if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
                        return;
        }
 
-       $api = PConfig::get($b["uid"], 'statusnet', 'baseapi');
+       $api = get_pconfig($b["uid"], 'statusnet', 'baseapi');
        $hostname = preg_replace("=https?://([\w\.]*)/.*=ism", "$1", $api);
 
-       if ($b['parent'] != $b['id']) {
-               logger("statusnet_post_hook: parameter " . print_r($b, true), LOGGER_DATA);
+       if($b['parent'] != $b['id']) {
+               logger("statusnet_post_hook: parameter ".print_r($b, true), LOGGER_DATA);
 
                // Looking if its a reply to a GNU Social post
                $hostlength = strlen($hostname) + 2;
-               if ((substr($b["parent-uri"], 0, $hostlength) != $hostname . "::") && (substr($b["extid"], 0, $hostlength) != $hostname . "::") && (substr($b["thr-parent"], 0, $hostlength) != $hostname . "::")) {
-                       logger("statusnet_post_hook: no GNU Social post " . $b["parent"]);
+               if ((substr($b["parent-uri"], 0, $hostlength) != $hostname."::") && (substr($b["extid"], 0, $hostlength) != $hostname."::")
+                       && (substr($b["thr-parent"], 0, $hostlength) != $hostname."::")) {
+                       logger("statusnet_post_hook: no GNU Social post ".$b["parent"]);
                        return;
                }
 
                $r = q("SELECT `item`.`author-link`, `item`.`uri`, `contact`.`nick` AS contact_nick
                        FROM `item` INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
-                       WHERE `item`.`uri` = '%s' AND `item`.`uid` = %d LIMIT 1", dbesc($b["thr-parent"]), intval($b["uid"]));
+                       WHERE `item`.`uri` = '%s' AND `item`.`uid` = %d LIMIT 1",
+                       dbesc($b["thr-parent"]),
+                       intval($b["uid"]));
 
-               if (!count($r)) {
-                       logger("statusnet_post_hook: no parent found " . $b["thr-parent"]);
+               if(!count($r)) {
+                       logger("statusnet_post_hook: no parent found ".$b["thr-parent"]);
                        return;
                } else {
                        $iscomment = true;
@@ -478,36 +525,26 @@ function statusnet_post_hook(App $a, &$b)
 
                $nick = preg_replace("=https?://(.*)/(.*)=ism", "$2", $orig_post["author-link"]);
 
-               $nickname = "@[url=" . $orig_post["author-link"] . "]" . $nick . "[/url]";
-               $nicknameplain = "@" . $nick;
+               $nickname = "@[url=".$orig_post["author-link"]."]".$nick."[/url]";
+               $nicknameplain = "@".$nick;
 
-               logger("statusnet_post_hook: 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("statusnet_post_hook: 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("statusnet_post_hook: parent found " . print_r($orig_post, true), LOGGER_DEBUG);
+               logger("statusnet_post_hook: parent found ".print_r($orig_post, true), LOGGER_DEBUG);
        } else {
                $iscomment = false;
 
-               if ($b['private'] || !strstr($b['postopts'], 'statusnet')) {
-                       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['private'] || !strstr($b['postopts'],'statusnet'))
                        return;
-               }
        }
 
-       if (($b['verb'] == ACTIVITY_POST) && $b['deleted']) {
+       if (($b['verb'] == ACTIVITY_POST) && $b['deleted'])
                statusnet_action($a, $b["uid"], substr($orig_post["uri"], $hostlength), "delete");
-       }
 
-       if ($b['verb'] == ACTIVITY_LIKE) {
-               logger("statusnet_post_hook: parameter 2 " . substr($b["thr-parent"], $hostlength), LOGGER_DEBUG);
+       if($b['verb'] == ACTIVITY_LIKE) {
+               logger("statusnet_post_hook: parameter 2 ".substr($b["thr-parent"], $hostlength), LOGGER_DEBUG);
                if ($b['deleted'])
                        statusnet_action($a, $b["uid"], substr($b["thr-parent"], $hostlength), "unlike");
                else
@@ -515,39 +552,36 @@ function statusnet_post_hook(App $a, &$b)
                return;
        }
 
-       if ($b['deleted'] || ($b['created'] !== $b['edited'])) {
+       if($b['deleted'] || ($b['created'] !== $b['edited']))
                return;
-       }
 
        // if posts comes from GNU Social don't send it back
-       if ($b['extid'] == NETWORK_STATUSNET) {
+       if($b['extid'] == NETWORK_STATUSNET)
                return;
-       }
 
-       if ($b['app'] == "StatusNet") {
+       if($b['app'] == "StatusNet")
                return;
-       }
 
        logger('GNU Socialpost invoked');
 
-       PConfig::load($b['uid'], 'statusnet');
+       load_pconfig($b['uid'], 'statusnet');
+
+       $api     = get_pconfig($b['uid'], 'statusnet', 'baseapi');
+       $ckey    = get_pconfig($b['uid'], 'statusnet', 'consumerkey');
+       $csecret = get_pconfig($b['uid'], 'statusnet', 'consumersecret');
+       $otoken  = get_pconfig($b['uid'], 'statusnet', 'oauthtoken');
+       $osecret = get_pconfig($b['uid'], 'statusnet', 'oauthsecret');
 
-       $api     = PConfig::get($b['uid'], 'statusnet', 'baseapi');
-       $ckey    = PConfig::get($b['uid'], 'statusnet', 'consumerkey');
-       $csecret = PConfig::get($b['uid'], 'statusnet', 'consumersecret');
-       $otoken  = PConfig::get($b['uid'], 'statusnet', 'oauthtoken');
-       $osecret = PConfig::get($b['uid'], 'statusnet', 'oauthsecret');
+       if($ckey && $csecret && $otoken && $osecret) {
 
-       if ($ckey && $csecret && $otoken && $osecret) {
                // If it's a repeated message from GNU Social then do a native retweet and exit
-               if (statusnet_is_retweet($a, $b['uid'], $b['body'])) {
+               if (statusnet_is_retweet($a, $b['uid'], $b['body']))
                        return;
-               }
 
                $dent = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret);
                $max_char = $dent->get_maxlength(); // max. length for a dent
 
-               PConfig::set($b['uid'], 'statusnet', 'max_char', $max_char);
+               set_pconfig($b['uid'], 'statusnet', 'max_char', $max_char);
 
                $tempfile = "";
                $msgarr = BBCode::toPlaintext($b, $max_char, true, 7);
@@ -562,22 +596,20 @@ function statusnet_post_hook(App $a, &$b)
                        $msg .= " \n" . $msgarr["url"];
                } elseif (isset($msgarr["image"]) && ($msgarr["type"] != "video")) {
                        $image = $msgarr["image"];
-               }
 
                if ($image != "") {
                        $img_str = Network::fetchUrl($image);
                        $tempfile = tempnam(get_temppath(), "cache");
                        file_put_contents($tempfile, $img_str);
-                       $postdata = ["status" => $msg, "media[]" => $tempfile];
-               } else {
-                       $postdata = ["status" => $msg];
-               }
+                       $postdata = array("status" => $msg, "media[]" => $tempfile);
+               } else
+                       $postdata = array("status"=>$msg);
 
                // and now send it :-)
                if (strlen($msg)) {
                        if ($iscomment) {
                                $postdata["in_reply_to_status_id"] = substr($orig_post["uri"], $hostlength);
-                               logger('statusnet_post send reply ' . print_r($postdata, true), LOGGER_DEBUG);
+                               logger('statusnet_post send reply '.print_r($postdata, true), LOGGER_DEBUG);
                        }
 
                        // New code that is able to post pictures
@@ -588,23 +620,21 @@ function statusnet_post_hook(App $a, &$b)
                        $cb->setToken($otoken, $osecret);
                        $result = $cb->statuses_update($postdata);
                        //$result = $dent->post('statuses/update', $postdata);
-                       logger('statusnet_post send, result: ' . print_r($result, true) .
-                               "\nmessage: " . $msg, LOGGER_DEBUG . "\nOriginal post: " . print_r($b, true) . "\nPost Data: " . print_r($postdata, true));
+                       logger('statusnet_post send, result: ' . print_r($result, true).
+                               "\nmessage: ".$msg, LOGGER_DEBUG."\nOriginal post: ".print_r($b, true)."\nPost Data: ".print_r($postdata, true));
 
-                       if ($result->source) {
-                               PConfig::set($b["uid"], "statusnet", "application_name", strip_tags($result->source));
-                       }
+                       if ($result->source)
+                               set_pconfig($b["uid"], "statusnet", "application_name", strip_tags($result->source));
 
                        if ($result->error) {
-                               logger('Send to GNU Social failed: "' . $result->error . '"');
+                               logger('Send to GNU Social failed: "'.$result->error.'"');
                        } elseif ($iscomment) {
                                logger('statusnet_post: Update extid ' . $result->id . " for post id " . $b['id']);
                                Item::update(['extid' => $hostname . "::" . $result->id, 'body' => $result->text], ['id' => $b['id']]);
                        }
                }
-               if ($tempfile != "") {
+               if ($tempfile != "")
                        unlink($tempfile);
-               }
        }
 }
 
@@ -612,32 +642,34 @@ function statusnet_addon_admin_post(App $a)
 {
        $sites = [];
 
-       foreach ($_POST['sitename'] as $id => $sitename) {
-               $sitename = trim($sitename);
-               $apiurl = trim($_POST['apiurl'][$id]);
-               if (!(substr($apiurl, -1) == '/')) {
-                       $apiurl = $apiurl . '/';
-               }
-               $secret = trim($_POST['secret'][$id]);
-               $key = trim($_POST['key'][$id]);
+       $sites = array();
+
+       foreach($_POST['sitename'] as $id=>$sitename){
+               $sitename=trim($sitename);
+               $apiurl=trim($_POST['apiurl'][$id]);
+               if (! (substr($apiurl, -1)=='/'))
+                   $apiurl=$apiurl.'/';
+               $secret=trim($_POST['secret'][$id]);
+               $key=trim($_POST['key'][$id]);
                //$applicationname = ((x($_POST, 'applicationname')) ? notags(trim($_POST['applicationname'][$id])):'');
-               if ($sitename != "" &&
-                       $apiurl != "" &&
-                       $secret != "" &&
-                       $key != "" &&
-                       !x($_POST['delete'][$id])) {
-
-                       $sites[] = [
-                               'sitename' => $sitename,
-                               'apiurl' => $apiurl,
-                               'consumersecret' => $secret,
-                               'consumerkey' => $key,
-                               //'applicationname' => $applicationname
-                       ];
+               if ($sitename!="" &&
+                       $apiurl!="" &&
+                       $secret!="" &&
+                       $key!="" &&
+                       !x($_POST['delete'][$id])){
+
+                               $sites[] = Array(
+                                       'sitename' => $sitename,
+                                       'apiurl' => $apiurl,
+                                       'consumersecret' => $secret,
+                                       'consumerkey' => $key,
+                                       //'applicationname' => $applicationname
+                               );
                }
        }
 
-       $sites = Config::set('statusnet', 'sites', $sites);
+       $sites = set_config('statusnet','sites', $sites);
+
 }
 
 function statusnet_addon_admin(App $a, &$o)
@@ -652,8 +684,8 @@ function statusnet_addon_admin(App $a, &$o)
                                'secret' => ["secret[$id]", "Secret", $s['consumersecret'], ""],
                                'key' => ["key[$id]", "Key", $s['consumerkey'], ""],
                                //'applicationname' => Array("applicationname[$id]", "Application name", $s['applicationname'], ""),
-                               'delete' => ["delete[$id]", "Delete", False, "Check to delete this preset"],
-                       ];
+                               'delete' => Array("delete[$id]", "Delete", False , "Check to delete this preset"),
+                       );
                }
        }
        /* empty form to add new site */
@@ -670,20 +702,17 @@ function statusnet_addon_admin(App $a, &$o)
        $o = replace_macros($t, [
                '$submit' => L10n::t('Save Settings'),
                '$sites' => $sitesform,
-       ]);
+       ));
 }
 
-function statusnet_prepare_body(App $a, &$b)
-{
-       if ($b["item"]["network"] != NETWORK_STATUSNET) {
-               return;
-       }
+function statusnet_prepare_body(&$a,&$b) {
+        if ($b["item"]["network"] != NETWORK_STATUSNET)
+                return;
 
-       if ($b["preview"]) {
-               $max_char = PConfig::get(local_user(), 'statusnet', 'max_char');
-               if (intval($max_char) == 0) {
+        if ($b["preview"]) {
+               $max_char = get_pconfig(local_user(),'statusnet','max_char');
+               if (intval($max_char) == 0)
                        $max_char = 140;
-               }
 
                $item = $b["item"];
                $item["plink"] = $a->get_baseurl() . "/display/" . $a->user["nickname"] . "/" . $item["parent"];
@@ -694,48 +723,46 @@ function statusnet_prepare_body(App $a, &$b)
                         dbesc($item["thr-parent"]),
                         intval(local_user()));
 
-               if (count($r)) {
-                       $orig_post = $r[0];
+                if(count($r)) {
+                        $orig_post = $r[0];
                        //$nickname = "@[url=".$orig_post["author-link"]."]".$orig_post["contact_nick"]."[/url]";
                        //$nicknameplain = "@".$orig_post["contact_nick"];
 
                        $nick = preg_replace("=https?://(.*)/(.*)=ism", "$2", $orig_post["author-link"]);
 
-                       $nickname = "@[url=" . $orig_post["author-link"] . "]" . $nick . "[/url]";
-                       $nicknameplain = "@" . $nick;
+                       $nickname = "@[url=".$orig_post["author-link"]."]".$nick."[/url]";
+                       $nicknameplain = "@".$nick;
 
-                       if ((strpos($item["body"], $nickname) === false) && (strpos($item["body"], $nicknameplain) === false)) {
-                               $item["body"] = $nickname . " " . $item["body"];
-                       }
-               }
+                       if ((strpos($item["body"], $nickname) === false) && (strpos($item["body"], $nicknameplain) === false))
+                               $item["body"] = $nickname." ".$item["body"];
+                }
 
                $msgarr = BBCode::toPlaintext($item, $max_char, true, 7);
                $msg = $msgarr["text"];
 
-               if (isset($msgarr["url"]) && ($msgarr["type"] != "photo")) {
-                       $msg .= " " . $msgarr["url"];
-               }
+                $msgarr = plaintext($a, $item, $max_char, true, 7);
+                $msg = $msgarr["text"];
 
-               if (isset($msgarr["image"])) {
-                       $msg .= " " . $msgarr["image"];
-               }
+                if (isset($msgarr["url"]) && ($msgarr["type"] != "photo"))
+                        $msg .= " ".$msgarr["url"];
 
-               $b['html'] = nl2br(htmlspecialchars($msg));
-       }
+                if (isset($msgarr["image"]))
+                        $msg .= " ".$msgarr["image"];
+
+                $b['html'] = nl2br(htmlspecialchars($msg));
+        }
 }
 
-function statusnet_cron(App $a, $b)
-{
-       $last = Config::get('statusnet', 'last_poll');
+function statusnet_cron($a,$b) {
+       $last = get_config('statusnet','last_poll');
 
-       $poll_interval = intval(Config::get('statusnet', 'poll_interval'));
-       if (!$poll_interval) {
+       $poll_interval = intval(get_config('statusnet','poll_interval'));
+       if(! $poll_interval)
                $poll_interval = STATUSNET_DEFAULT_POLL_INTERVAL;
-       }
 
-       if ($last) {
+       if($last) {
                $next = $last + ($poll_interval * 60);
-               if ($next > time()) {
+               if($next > time()) {
                        logger('statusnet: poll intervall not reached');
                        return;
                }
@@ -743,188 +770,171 @@ function statusnet_cron(App $a, $b)
        logger('statusnet: cron_start');
 
        $r = q("SELECT * FROM `pconfig` WHERE `cat` = 'statusnet' AND `k` = 'mirror_posts' AND `v` = '1' ORDER BY RAND() ");
-       if (count($r)) {
-               foreach ($r as $rr) {
-                       logger('statusnet: fetching for user ' . $rr['uid']);
+       if(count($r)) {
+               foreach($r as $rr) {
+                       logger('statusnet: fetching for user '.$rr['uid']);
                        statusnet_fetchtimeline($a, $rr['uid']);
                }
        }
 
-       $abandon_days = intval(Config::get('system', 'account_abandon_days'));
-       if ($abandon_days < 1) {
+       $abandon_days = intval(get_config('system','account_abandon_days'));
+       if ($abandon_days < 1)
                $abandon_days = 0;
-       }
 
        $abandon_limit = date(DateTimeFormat::MYSQL, time() - $abandon_days * 86400);
 
        $r = q("SELECT * FROM `pconfig` WHERE `cat` = 'statusnet' AND `k` = 'import' AND `v` ORDER BY RAND()");
-       if (count($r)) {
-               foreach ($r as $rr) {
+       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');
+                                       logger('abandoned account: timeline from user '.$rr['uid'].' will not be imported');
                                        continue;
                                }
                        }
 
-                       logger('statusnet: importing timeline from user ' . $rr['uid']);
+                       logger('statusnet: importing timeline from user '.$rr['uid']);
                        statusnet_fetchhometimeline($a, $rr["uid"], $rr["v"]);
                }
        }
 
        logger('statusnet: cron_end');
 
-       Config::set('statusnet', 'last_poll', time());
+       set_config('statusnet','last_poll', time());
 }
 
-function statusnet_fetchtimeline(App $a, $uid)
-{
-       $ckey    = PConfig::get($uid, 'statusnet', 'consumerkey');
-       $csecret = PConfig::get($uid, 'statusnet', 'consumersecret');
-       $api     = PConfig::get($uid, 'statusnet', 'baseapi');
-       $otoken  = PConfig::get($uid, 'statusnet', 'oauthtoken');
-       $osecret = PConfig::get($uid, 'statusnet', 'oauthsecret');
-       $lastid  = PConfig::get($uid, 'statusnet', 'lastid');
-
-       require_once 'mod/item.php';
-       require_once 'include/items.php';
+function statusnet_fetchtimeline($a, $uid) {
+       $ckey    = get_pconfig($uid, 'statusnet', 'consumerkey');
+       $csecret = get_pconfig($uid, 'statusnet', 'consumersecret');
+       $api     = get_pconfig($uid, 'statusnet', 'baseapi');
+       $otoken  = get_pconfig($uid, 'statusnet', 'oauthtoken');
+       $osecret = get_pconfig($uid, 'statusnet', 'oauthsecret');
+       $lastid  = get_pconfig($uid, 'statusnet', 'lastid');
+
+       require_once('mod/item.php');
+       require_once('include/items.php');
 
        //  get the application name for the SN app
        //  1st try personal config, then system config and fallback to the
        //  hostname of the node if neither one is set.
-       $application_name = PConfig::get($uid, 'statusnet', 'application_name');
-       if ($application_name == "") {
-               $application_name = Config::get('statusnet', 'application_name');
-       }
-       if ($application_name == "") {
+       $application_name  = get_pconfig( $uid, 'statusnet', 'application_name');
+       if ($application_name == "")
+               $application_name  = get_config('statusnet', 'application_name');
+       if ($application_name == "")
                $application_name = $a->get_hostname();
-       }
 
-       $connection = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret);
+       $connection = new StatusNetOAuth($api, $ckey,$csecret,$otoken,$osecret);
 
-       $parameters = ["exclude_replies" => true, "trim_user" => true, "contributor_details" => false, "include_rts" => false];
+       $parameters = array("exclude_replies" => true, "trim_user" => true, "contributor_details" => false, "include_rts" => false);
 
        $first_time = ($lastid == "");
 
-       if ($lastid <> "") {
+       if ($lastid <> "")
                $parameters["since_id"] = $lastid;
-       }
 
        $items = $connection->get('statuses/user_timeline', $parameters);
 
-       if (!is_array($items)) {
+       if (!is_array($items))
                return;
-       }
 
        $posts = array_reverse($items);
 
        if (count($posts)) {
-               foreach ($posts as $post) {
-                       if ($post->id > $lastid)
-                               $lastid = $post->id;
+           foreach ($posts as $post) {
+               if ($post->id > $lastid)
+                       $lastid = $post->id;
 
-                       if ($first_time) {
-                               continue;
-                       }
+               if ($first_time)
+                       continue;
 
-                       if ($post->source == "activity") {
-                               continue;
-                       }
+               if ($post->source == "activity")
+                       continue;
 
-                       if (is_object($post->retweeted_status)) {
-                               continue;
-                       }
+               if (is_object($post->retweeted_status))
+                       continue;
 
-                       if ($post->in_reply_to_status_id != "") {
-                               continue;
-                       }
+               if ($post->in_reply_to_status_id != "")
+                       continue;
 
-                       if (!stristr($post->source, $application_name)) {
-                               $_SESSION["authenticated"] = true;
-                               $_SESSION["uid"] = $uid;
+               if (!stristr($post->source, $application_name)) {
+                       $_SESSION["authenticated"] = true;
+                       $_SESSION["uid"] = $uid;
 
-                               unset($_REQUEST);
-                               $_REQUEST["type"] = "wall";
-                               $_REQUEST["api_source"] = true;
-                               $_REQUEST["profile_uid"] = $uid;
-                               //$_REQUEST["source"] = "StatusNet";
-                               $_REQUEST["source"] = $post->source;
-                               $_REQUEST["extid"] = NETWORK_STATUSNET;
+                       unset($_REQUEST);
+                       $_REQUEST["type"] = "wall";
+                       $_REQUEST["api_source"] = true;
+                       $_REQUEST["profile_uid"] = $uid;
+                       //$_REQUEST["source"] = "StatusNet";
+                       $_REQUEST["source"] = $post->source;
+                       $_REQUEST["extid"] = NETWORK_STATUSNET;
 
-                               if (isset($post->id)) {
-                                       $_REQUEST['message_id'] = item_new_uri($a->get_hostname(), $uid, NETWORK_STATUSNET . ":" . $post->id);
-                               }
+                       if (isset($post->id)) {
+                               $_REQUEST['message_id'] = item_new_uri($a->get_hostname(), $uid, NETWORK_STATUSNET.":".$post->id);
+                       }
 
-                               //$_REQUEST["date"] = $post->created_at;
+                       //$_REQUEST["date"] = $post->created_at;
 
-                               $_REQUEST["title"] = "";
+                       $_REQUEST["title"] = "";
 
-                               $_REQUEST["body"] = add_page_info_to_body($post->text, true);
-                               if (is_string($post->place->name)) {
-                                       $_REQUEST["location"] = $post->place->name;
-                               }
+                       $_REQUEST["body"] = add_page_info_to_body($post->text, true);
+                       if (is_string($post->place->name))
+                               $_REQUEST["location"] = $post->place->name;
 
-                               if (is_string($post->place->full_name)) {
-                                       $_REQUEST["location"] = $post->place->full_name;
-                               }
+                       if (is_string($post->place->full_name))
+                               $_REQUEST["location"] = $post->place->full_name;
 
-                               if (is_array($post->geo->coordinates)) {
-                                       $_REQUEST["coord"] = $post->geo->coordinates[0] . " " . $post->geo->coordinates[1];
-                               }
+                       if (is_array($post->geo->coordinates))
+                               $_REQUEST["coord"] = $post->geo->coordinates[0]." ".$post->geo->coordinates[1];
 
-                               if (is_array($post->coordinates->coordinates)) {
-                                       $_REQUEST["coord"] = $post->coordinates->coordinates[1] . " " . $post->coordinates->coordinates[0];
-                               }
+                       if (is_array($post->coordinates->coordinates))
+                               $_REQUEST["coord"] = $post->coordinates->coordinates[1]." ".$post->coordinates->coordinates[0];
 
-                               //print_r($_REQUEST);
-                               if ($_REQUEST["body"] != "") {
-                                       logger('statusnet: posting for user ' . $uid);
+                       //print_r($_REQUEST);
+                       if ($_REQUEST["body"] != "") {
+                               logger('statusnet: posting for user '.$uid);
 
-                                       item_post($a);
-                               }
+                               item_post($a);
                        }
                }
+           }
        }
-       PConfig::set($uid, 'statusnet', 'lastid', $lastid);
+       set_pconfig($uid, 'statusnet', 'lastid', $lastid);
 }
 
-function statusnet_address($contact)
-{
+function statusnet_address($contact) {
        $hostname = normalise_link($contact->statusnet_profile_url);
        $nickname = $contact->screen_name;
 
        $hostname = preg_replace("=https?://([\w\.]*)/.*=ism", "$1", $contact->statusnet_profile_url);
 
-       $address = $contact->screen_name . "@" . $hostname;
+       $address = $contact->screen_name."@".$hostname;
 
-       return $address;
+       return($address);
 }
 
-function statusnet_fetch_contact($uid, $contact, $create_user)
-{
-       if ($contact->statusnet_profile_url == "") {
-               return -1;
-       }
+function statusnet_fetch_contact($uid, $contact, $create_user) {
+       if ($contact->statusnet_profile_url == "")
+               return(-1);
 
-       GContact::update(["url" => $contact->statusnet_profile_url,
-               "network" => NETWORK_STATUSNET, "photo" => $contact->profile_image_url,
-               "name" => $contact->name, "nick" => $contact->screen_name,
-               "location" => $contact->location, "about" => $contact->description,
-               "addr" => statusnet_address($contact), "generation" => 3]);
+       update_gcontact(array("url" => $contact->statusnet_profile_url,
+                       "network" => NETWORK_STATUSNET, "photo" => $contact->profile_image_url,
+                       "name" => $contact->name, "nick" => $contact->screen_name,
+                       "location" => $contact->location, "about" => $contact->description,
+                       "addr" => statusnet_address($contact), "generation" => 3));
 
-       $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' AND `network` = '%s'LIMIT 1", intval($uid), dbesc(normalise_link($contact->statusnet_profile_url)), dbesc(NETWORK_STATUSNET));
+       $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' AND `network` = '%s'LIMIT 1",
+               intval($uid), dbesc(normalise_link($contact->statusnet_profile_url)), dbesc(NETWORK_STATUSNET));
 
-       if (!count($r) && !$create_user) {
-               return 0;
-       }
+       if(!count($r) && !$create_user)
+               return(0);
 
        if (count($r) && ($r[0]["readonly"] || $r[0]["blocked"])) {
-               logger("statusnet_fetch_contact: Contact '" . $r[0]["nick"] . "' is blocked or readonly.", LOGGER_DEBUG);
-               return -1;
+               logger("statusnet_fetch_contact: Contact '".$r[0]["nick"]."' is blocked or readonly.", LOGGER_DEBUG);
+               return(-1);
        }
 
-       if (!count($r)) {
+       if(!count($r)) {
                // create contact record
                q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
                                        `name`, `nick`, `photo`, `network`, `rel`, `priority`,
@@ -954,15 +964,23 @@ function statusnet_fetch_contact($uid, $contact, $create_user)
                        intval($uid),
                        dbesc(NETWORK_STATUSNET));
 
-               if (!count($r)) {
-                       return false;
-               }
+               if(! count($r))
+                       return(false);
+
+               $contact_id  = $r[0]['id'];
+
+               $g = q("SELECT def_gid FROM user WHERE uid = %d LIMIT 1",
+                       intval($uid)
+               );
 
-               $contact_id = $r[0]['id'];
+               if($g && intval($g[0]['def_gid'])) {
+                       require_once('include/group.php');
+                       group_add_member($uid,'',$contact_id,$g[0]['def_gid']);
+               }
 
-               Group::addMember(User::getDefaultGroup($uid), $contact_id);
+               require_once("Photo.php");
 
-               $photos = Photo::importProfilePhoto($contact->profile_image_url, $uid, $contact_id);
+               $photos = import_profile_photo($contact->profile_image_url,$uid,$contact_id);
 
                q("UPDATE `contact` SET `photo` = '%s',
                                        `thumb` = '%s',
@@ -981,10 +999,14 @@ function statusnet_fetch_contact($uid, $contact, $create_user)
                $update_photo = ($r[0]['avatar-date'] < DateTimeFormat::utc('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("statusnet_fetch_contact: Updating contact " . $contact->screen_name, LOGGER_DEBUG);
 
-                       $photos = Photo::importProfilePhoto($contact->profile_image_url, $uid, $r[0]['id']);
+               if((!$r[0]['photo']) || (!$r[0]['thumb']) || (!$r[0]['micro']) || ($update_photo)) {
+
+                       logger("statusnet_fetch_contact: Updating contact ".$contact->screen_name, LOGGER_DEBUG);
+
+                       require_once("Photo.php");
+
+                       $photos = import_profile_photo($contact->profile_image_url, $uid, $r[0]['id']);
 
                        q("UPDATE `contact` SET `photo` = '%s',
                                                `thumb` = '%s',
@@ -1018,16 +1040,15 @@ function statusnet_fetch_contact($uid, $contact, $create_user)
                }
        }
 
-       return $r[0]["id"];
+       return($r[0]["id"]);
 }
 
-function statusnet_fetchuser(App $a, $uid, $screen_name = "", $user_id = "")
-{
-       $ckey    = PConfig::get($uid, 'statusnet', 'consumerkey');
-       $csecret = PConfig::get($uid, 'statusnet', 'consumersecret');
-       $api     = PConfig::get($uid, 'statusnet', 'baseapi');
-       $otoken  = PConfig::get($uid, 'statusnet', 'oauthtoken');
-       $osecret = PConfig::get($uid, 'statusnet', 'oauthsecret');
+function statusnet_fetchuser($a, $uid, $screen_name = "", $user_id = "") {
+       $ckey    = get_pconfig($uid, 'statusnet', 'consumerkey');
+       $csecret = get_pconfig($uid, 'statusnet', 'consumersecret');
+       $api     = get_pconfig($uid, 'statusnet', 'baseapi');
+       $otoken  = get_pconfig($uid, 'statusnet', 'oauthtoken');
+       $osecret = get_pconfig($uid, 'statusnet', 'oauthsecret');
 
        require_once __DIR__ . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'codebirdsn.php';
 
@@ -1038,44 +1059,40 @@ function statusnet_fetchuser(App $a, $uid, $screen_name = "", $user_id = "")
        $r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
                intval($uid));
 
-       if (count($r)) {
+       if(count($r)) {
                $self = $r[0];
-       } else {
+       } else
                return;
-       }
 
-       $parameters = [];
+       $parameters = array();
 
-       if ($screen_name != "") {
+       if ($screen_name != "")
                $parameters["screen_name"] = $screen_name;
-       }
 
-       if ($user_id != "") {
+       if ($user_id != "")
                $parameters["user_id"] = $user_id;
-       }
 
        // Fetching user data
        $user = $cb->users_show($parameters);
 
-       if (!is_object($user)) {
+       if (!is_object($user))
                return;
-       }
 
        $contact_id = statusnet_fetch_contact($uid, $user, true);
 
        return $contact_id;
 }
 
-function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_existing_contact)
-{
-       require_once "include/html2bbcode.php";
+function statusnet_createpost($a, $uid, $post, $self, $create_user, $only_existing_contact) {
+
+       require_once("include/html2bbcode.php");
 
        logger("statusnet_createpost: start", LOGGER_DEBUG);
 
-       $api = PConfig::get($uid, 'statusnet', 'baseapi');
+       $api = get_pconfig($uid, 'statusnet', 'baseapi');
        $hostname = preg_replace("=https?://([\w\.]*)/.*=ism", "$1", $api);
 
-       $postarray = [];
+       $postarray = array();
        $postarray['network'] = NETWORK_STATUSNET;
        $postarray['gravity'] = 0;
        $postarray['uid'] = $uid;
@@ -1084,31 +1101,29 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
        if (is_object($post->retweeted_status)) {
                $content = $post->retweeted_status;
                statusnet_fetch_contact($uid, $content->user, false);
-       } else {
+       } else
                $content = $post;
-       }
 
-       $postarray['uri'] = $hostname . "::" . $content->id;
+       $postarray['uri'] = $hostname."::".$content->id;
 
        $r = q("SELECT * FROM `item` WHERE `extid` = '%s' AND `uid` = %d LIMIT 1",
                        dbesc($postarray['uri']),
                        intval($uid)
-       );
+               );
 
-       if (count($r)) {
-               return [];
-       }
+       if (count($r))
+               return(array());
 
        $contactid = 0;
 
        if ($content->in_reply_to_status_id != "") {
 
-               $parent = $hostname . "::" . $content->in_reply_to_status_id;
+               $parent = $hostname."::".$content->in_reply_to_status_id;
 
                $r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
                                dbesc($parent),
                                intval($uid)
-               );
+                       );
                if (count($r)) {
                        $postarray['thr-parent'] = $r[0]["uri"];
                        $postarray['parent-uri'] = $r[0]["parent-uri"];
@@ -1118,7 +1133,7 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
                        $r = q("SELECT * FROM `item` WHERE `extid` = '%s' AND `uid` = %d LIMIT 1",
                                        dbesc($parent),
                                        intval($uid)
-                       );
+                               );
                        if (count($r)) {
                                $postarray['thr-parent'] = $r[0]['uri'];
                                $postarray['parent-uri'] = $r[0]['parent-uri'];
@@ -1132,21 +1147,20 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
                }
 
                // Is it me?
-               $own_url = PConfig::get($uid, 'statusnet', 'own_url');
+               $own_url = get_pconfig($uid, 'statusnet', 'own_url');
 
                if ($content->user->id == $own_url) {
                        $r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
                                intval($uid));
 
-                       if (count($r)) {
+                       if(count($r)) {
                                $contactid = $r[0]["id"];
 
-                               $postarray['owner-name'] = $r[0]["name"];
+                               $postarray['owner-name'] =  $r[0]["name"];
                                $postarray['owner-link'] = $r[0]["url"];
-                               $postarray['owner-avatar'] = $r[0]["photo"];
-                       } else {
-                               return [];
-                       }
+                               $postarray['owner-avatar'] =  $r[0]["photo"];
+                       } else
+                               return(array());
                }
                // Don't create accounts of people who just comment something
                $create_user = false;
@@ -1161,11 +1175,10 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
                $postarray['owner-link'] = $post->user->statusnet_profile_url;
                $postarray['owner-avatar'] = $post->user->profile_image_url;
        }
-       if (($contactid == 0) && !$only_existing_contact) {
+       if(($contactid == 0) && !$only_existing_contact)
                $contactid = $self['id'];
-       } elseif ($contactid <= 0) {
-               return [];
-       }
+       elseif ($contactid <= 0)
+               return(array());
 
        $postarray['contact-id'] = $contactid;
 
@@ -1176,9 +1189,9 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
        $postarray['author-avatar'] = $content->user->profile_image_url;
 
        // To-Do: Maybe unreliable? Can the api be entered without trailing "/"?
-       $hostname = str_replace("/api/", "/notice/", PConfig::get($uid, 'statusnet', 'baseapi'));
+       $hostname = str_replace("/api/", "/notice/", get_pconfig($uid, 'statusnet', 'baseapi'));
 
-       $postarray['plink'] = $hostname . $content->id;
+       $postarray['plink'] = $hostname.$content->id;
        $postarray['app'] = strip_tags($content->source);
 
        if ($content->user->protected) {
@@ -1195,75 +1208,82 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
        $postarray['created'] = DateTimeFormat::utc($content->created_at);
        $postarray['edited'] = DateTimeFormat::utc($content->created_at);
 
-       if (is_string($content->place->name)) {
+       if (is_string($content->place->name))
                $postarray["location"] = $content->place->name;
-       }
 
-       if (is_string($content->place->full_name)) {
+       if (is_string($content->place->full_name))
                $postarray["location"] = $content->place->full_name;
-       }
 
-       if (is_array($content->geo->coordinates)) {
-               $postarray["coord"] = $content->geo->coordinates[0] . " " . $content->geo->coordinates[1];
-       }
+       if (is_array($content->geo->coordinates))
+               $postarray["coord"] = $content->geo->coordinates[0]." ".$content->geo->coordinates[1];
 
-       if (is_array($content->coordinates->coordinates)) {
-               $postarray["coord"] = $content->coordinates->coordinates[1] . " " . $content->coordinates->coordinates[0];
-       }
+       if (is_array($content->coordinates->coordinates))
+               $postarray["coord"] = $content->coordinates->coordinates[1]." ".$content->coordinates->coordinates[0];
 
-       logger("statusnet_createpost: end", LOGGER_DEBUG);
+       /*if (is_object($post->retweeted_status)) {
+               $postarray['body'] = html2bbcode($post->retweeted_status->statusnet_html);
+
+               $converted = statusnet_convertmsg($a, $postarray['body'], false);
+               $postarray['body'] = $converted["body"];
+               $postarray['tag'] = $converted["tags"];
+
+               statusnet_fetch_contact($uid, $post->retweeted_status->user, false);
 
-       return $postarray;
+               // Let retweets look like wall-to-wall posts
+               $postarray['author-name'] = $post->retweeted_status->user->name;
+               $postarray['author-link'] = $post->retweeted_status->user->statusnet_profile_url;
+               $postarray['author-avatar'] = $post->retweeted_status->user->profile_image_url;
+       }*/
+       logger("statusnet_createpost: end", LOGGER_DEBUG);
+       return($postarray);
 }
 
-function statusnet_checknotification(App $a, $uid, $own_url, $top_item, $postarray)
-{
+function statusnet_checknotification($a, $uid, $own_url, $top_item, $postarray) {
+
        // This function necer worked and need cleanup
+
        $user = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` LIMIT 1",
                        intval($uid)
-       );
+               );
 
-       if (!count($user)) {
+       if(!count($user))
                return;
-       }
 
        // Is it me?
-       if (link_compare($user[0]["url"], $postarray['author-link'])) {
+       if (link_compare($user[0]["url"], $postarray['author-link']))
                return;
-       }
 
        $own_user = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
                        intval($uid),
                        dbesc($own_url)
-       );
+               );
 
-       if (!count($own_user)) {
+       if(!count($own_user))
                return;
-       }
 
        // Is it me from GNU Social?
-       if (link_compare($own_user[0]["url"], $postarray['author-link'])) {
+       if (link_compare($own_user[0]["url"], $postarray['author-link']))
                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)) {
-               foreach ($myconv as $conv) {
+       if(count($myconv)) {
+
+               foreach($myconv as $conv) {
                        // now if we find a match, it means we're in this conversation
-                       if (!link_compare($conv['author-link'], $user[0]["url"]) && !link_compare($conv['author-link'], $own_user[0]["url"])) {
+
+                       if(!link_compare($conv['author-link'],$user[0]["url"]) && !link_compare($conv['author-link'],$own_user[0]["url"]))
                                continue;
-                       }
 
-                       require_once 'include/enotify.php';
+                       require_once('include/enotify.php');
 
                        $conv_parent = $conv['parent'];
 
-                       notification([
-                               'type' => NOTIFY_COMMENT,
+                       notification(array(
+                               'type'         => NOTIFY_COMMENT,
                                'notify_flags' => $user[0]['notify-flags'],
                                'language' => $user[0]['language'],
                                'to_name' => $user[0]['username'],
@@ -1274,10 +1294,10 @@ function statusnet_checknotification(App $a, $uid, $own_url, $top_item, $postarr
                                'source_name' => $postarray['author-name'],
                                'source_link' => $postarray['author-link'],
                                'source_photo' => $postarray['author-avatar'],
-                               'verb' => ACTIVITY_POST,
-                               'otype' => 'item',
-                               'parent' => $conv_parent,
-                       ]);
+                               'verb'         => ACTIVITY_POST,
+                               'otype'        => 'item',
+                               'parent'       => $conv_parent,
+                       ));
 
                        // only send one notification
                        break;
@@ -1285,25 +1305,24 @@ function statusnet_checknotification(App $a, $uid, $own_url, $top_item, $postarr
        }
 }
 
-function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
-{
-       $conversations = [];
+function statusnet_fetchhometimeline($a, $uid, $mode = 1) {
+       $conversations = array();
 
-       $ckey    = PConfig::get($uid, 'statusnet', 'consumerkey');
-       $csecret = PConfig::get($uid, 'statusnet', 'consumersecret');
-       $api     = PConfig::get($uid, 'statusnet', 'baseapi');
-       $otoken  = PConfig::get($uid, 'statusnet', 'oauthtoken');
-       $osecret = PConfig::get($uid, 'statusnet', 'oauthsecret');
-       $create_user = PConfig::get($uid, 'statusnet', 'create_user');
+       $ckey    = get_pconfig($uid, 'statusnet', 'consumerkey');
+       $csecret = get_pconfig($uid, 'statusnet', 'consumersecret');
+       $api     = get_pconfig($uid, 'statusnet', 'baseapi');
+       $otoken  = get_pconfig($uid, 'statusnet', 'oauthtoken');
+       $osecret = get_pconfig($uid, 'statusnet', 'oauthsecret');
+       $create_user = get_pconfig($uid, 'statusnet', 'create_user');
 
        // "create_user" is deactivated, since currently you cannot add users manually by now
        $create_user = true;
 
-       logger("statusnet_fetchhometimeline: Fetching for user " . $uid, LOGGER_DEBUG);
+       logger("statusnet_fetchhometimeline: Fetching for user ".$uid, LOGGER_DEBUG);
 
        require_once 'include/items.php';
 
-       $connection = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret);
+       $connection = new StatusNetOAuth($api, $ckey,$csecret,$otoken,$osecret);
 
        $own_contact = statusnet_fetch_own_contact($a, $uid);
 
@@ -1311,75 +1330,71 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
                intval($own_contact),
                intval($uid));
 
-       if (count($r)) {
+       if(count($r)) {
                $nick = $r[0]["nick"];
        } else {
-               logger("statusnet_fetchhometimeline: Own GNU Social contact not found for user " . $uid, LOGGER_DEBUG);
+               logger("statusnet_fetchhometimeline: Own GNU Social contact not found for user ".$uid, LOGGER_DEBUG);
                return;
        }
 
        $r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
                intval($uid));
 
-       if (count($r)) {
+       if(count($r)) {
                $self = $r[0];
        } else {
-               logger("statusnet_fetchhometimeline: Own contact not found for user " . $uid, LOGGER_DEBUG);
+               logger("statusnet_fetchhometimeline: Own contact not found for user ".$uid, LOGGER_DEBUG);
                return;
        }
 
        $u = q("SELECT * FROM user WHERE uid = %d LIMIT 1",
                intval($uid));
-       if (!count($u)) {
-               logger("statusnet_fetchhometimeline: Own user not found for user " . $uid, LOGGER_DEBUG);
+       if(!count($u)) {
+               logger("statusnet_fetchhometimeline: Own user not found for user ".$uid, LOGGER_DEBUG);
                return;
        }
 
-       $parameters = ["exclude_replies" => false, "trim_user" => false, "contributor_details" => true, "include_rts" => true];
+       $parameters = array("exclude_replies" => false, "trim_user" => false, "contributor_details" => true, "include_rts" => true);
        //$parameters["count"] = 200;
 
        if ($mode == 1) {
                // Fetching timeline
-               $lastid = PConfig::get($uid, 'statusnet', 'lasthometimelineid');
+               $lastid  = get_pconfig($uid, 'statusnet', 'lasthometimelineid');
                //$lastid = 1;
 
                $first_time = ($lastid == "");
 
-               if ($lastid != "") {
+               if ($lastid <> "")
                        $parameters["since_id"] = $lastid;
-               }
 
                $items = $connection->get('statuses/home_timeline', $parameters);
 
                if (!is_array($items)) {
-                       if (is_object($items) && isset($items->error)) {
+                       if (is_object($items) && isset($items->error))
                                $errormsg = $items->error;
-                       } elseif (is_object($items)) {
+                       elseif (is_object($items))
                                $errormsg = print_r($items, true);
-                       } elseif (is_string($items) || is_float($items) || is_int($items)) {
+                       elseif (is_string($items) || is_float($items) || is_int($items))
                                $errormsg = $items;
-                       } else {
+                       else
                                $errormsg = "Unknown error";
-                       }
 
-                       logger("statusnet_fetchhometimeline: Error fetching home timeline: " . $errormsg, LOGGER_DEBUG);
+                       logger("statusnet_fetchhometimeline: Error fetching home timeline: ".$errormsg, LOGGER_DEBUG);
                        return;
                }
 
                $posts = array_reverse($items);
 
-               logger("statusnet_fetchhometimeline: Fetching timeline for user " . $uid . " " . sizeof($posts) . " items", LOGGER_DEBUG);
+               logger("statusnet_fetchhometimeline: Fetching timeline for user ".$uid." ".sizeof($posts)." items", LOGGER_DEBUG);
 
                if (count($posts)) {
                        foreach ($posts as $post) {
 
-                               if ($post->id > $lastid) {
+                               if ($post->id > $lastid)
                                        $lastid = $post->id;
-                               }
 
-                               if ($first_time) {
+                               if ($first_time)
                                        continue;
-                               }
 
                                if (isset($post->statusnet_conversation_id)) {
                                        if (!isset($conversations[$post->statusnet_conversation_id])) {
@@ -1389,52 +1404,48 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
                                } else {
                                        $postarray = statusnet_createpost($a, $uid, $post, $self, $create_user, true);
 
-                                       if (trim($postarray['body']) == "") {
+                                       if (trim($postarray['body']) == "")
                                                continue;
-                                       }
 
                                        $item = Item::insert($postarray);
                                        $postarray["id"] = $item;
 
-                                       logger('statusnet_fetchhometimeline: User ' . $self["nick"] . ' posted home timeline item ' . $item);
+                                       logger('statusnet_fetchhometimeline: User '.$self["nick"].' posted home timeline item '.$item);
 
-                                       if ($item && !function_exists("check_item_notification")) {
+                                       if ($item && !function_exists("check_item_notification"))
                                                statusnet_checknotification($a, $uid, $nick, $item, $postarray);
-                                       }
                                }
+
                        }
                }
-               PConfig::set($uid, 'statusnet', 'lasthometimelineid', $lastid);
+               set_pconfig($uid, 'statusnet', 'lasthometimelineid', $lastid);
        }
 
        // Fetching mentions
-       $lastid = PConfig::get($uid, 'statusnet', 'lastmentionid');
+       $lastid  = get_pconfig($uid, 'statusnet', 'lastmentionid');
        $first_time = ($lastid == "");
 
-       if ($lastid != "") {
+       if ($lastid <> "")
                $parameters["since_id"] = $lastid;
-       }
 
        $items = $connection->get('statuses/mentions_timeline', $parameters);
 
        if (!is_array($items)) {
-               logger("statusnet_fetchhometimeline: Error fetching mentions: " . print_r($items, true), LOGGER_DEBUG);
+               logger("statusnet_fetchhometimeline: Error fetching mentions: ".print_r($items, true), LOGGER_DEBUG);
                return;
        }
 
        $posts = array_reverse($items);
 
-       logger("statusnet_fetchhometimeline: Fetching mentions for user " . $uid . " " . sizeof($posts) . " items", LOGGER_DEBUG);
+       logger("statusnet_fetchhometimeline: Fetching mentions for user ".$uid." ".sizeof($posts)." items", LOGGER_DEBUG);
 
        if (count($posts)) {
                foreach ($posts as $post) {
-                       if ($post->id > $lastid) {
+                       if ($post->id > $lastid)
                                $lastid = $post->id;
-                       }
 
-                       if ($first_time) {
+                       if ($first_time)
                                continue;
-                       }
 
                        $postarray = statusnet_createpost($a, $uid, $post, $self, false, false);
 
@@ -1444,17 +1455,16 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
                                        $conversations[$post->statusnet_conversation_id] = $post->statusnet_conversation_id;
                                }
                        } else {
-                               if (trim($postarray['body']) == "") {
+                               if (trim($postarray['body']) != "") {
                                        continue;
-                               }
 
                                $item = Item::insert($postarray);
                                $postarray["id"] = $item;
 
-                               logger('statusnet_fetchhometimeline: User ' . $self["nick"] . ' posted mention timeline item ' . $item);
+                                       logger('statusnet_fetchhometimeline: User '.$self["nick"].' posted mention timeline item '.$item);
 
-                               if ($item && function_exists("check_item_notification")) {
-                                       check_item_notification($item, $uid, NOTIFY_TAGSELF);
+                                       if ($item && function_exists("check_item_notification"))
+                                               check_item_notification($item, $uid, NOTIFY_TAGSELF);
                                }
                        }
 
@@ -1468,8 +1478,8 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
                        }
 
                        if (($item != 0) && !function_exists("check_item_notification")) {
-                               require_once 'include/enotify.php';
-                               notification([
+                               require_once('include/enotify.php');
+                               notification(array(
                                        'type'         => NOTIFY_TAGSELF,
                                        'notify_flags' => $u[0]['notify-flags'],
                                        'language'     => $u[0]['language'],
@@ -1484,46 +1494,43 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
                                        'verb'         => ACTIVITY_TAG,
                                        'otype'        => 'item',
                                        'parent'       => $parent_id,
-                               ]);
+                               ));
                        }
                }
        }
 
-       PConfig::set($uid, 'statusnet', 'lastmentionid', $lastid);
+       set_pconfig($uid, 'statusnet', 'lastmentionid', $lastid);
 }
 
-function statusnet_complete_conversation(App $a, $uid, $self, $create_user, $nick, $conversation)
-{
-       $ckey    = PConfig::get($uid, 'statusnet', 'consumerkey');
-       $csecret = PConfig::get($uid, 'statusnet', 'consumersecret');
-       $api     = PConfig::get($uid, 'statusnet', 'baseapi');
-       $otoken  = PConfig::get($uid, 'statusnet', 'oauthtoken');
-       $osecret = PConfig::get($uid, 'statusnet', 'oauthsecret');
-       $own_url = PConfig::get($uid, 'statusnet', 'own_url');
+function statusnet_complete_conversation($a, $uid, $self, $create_user, $nick, $conversation) {
+       $ckey    = get_pconfig($uid, 'statusnet', 'consumerkey');
+       $csecret = get_pconfig($uid, 'statusnet', 'consumersecret');
+       $api     = get_pconfig($uid, 'statusnet', 'baseapi');
+       $otoken  = get_pconfig($uid, 'statusnet', 'oauthtoken');
+       $osecret = get_pconfig($uid, 'statusnet', 'oauthsecret');
+       $own_url = get_pconfig($uid, 'statusnet', 'own_url');
 
        $connection = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret);
 
        $parameters["count"] = 200;
 
-       $items = $connection->get('statusnet/conversation/' . $conversation, $parameters);
+       $items = $connection->get('statusnet/conversation/'.$conversation, $parameters);
        if (is_array($items)) {
                $posts = array_reverse($items);
 
                foreach ($posts as $post) {
                        $postarray = statusnet_createpost($a, $uid, $post, $self, false, false);
 
-                       if (trim($postarray['body']) == "") {
+                       if (trim($postarray['body']) == "")
                                continue;
-                       }
 
                        $item = Item::insert($postarray);
                        $postarray["id"] = $item;
 
-                       logger('statusnet_complete_conversation: User ' . $self["nick"] . ' posted home timeline item ' . $item);
+                       logger('statusnet_complete_conversation: User '.$self["nick"].' posted home timeline item '.$item);
 
-                       if ($item && !function_exists("check_item_notification")) {
+                       if ($item && !function_exists("check_item_notification"))
                                statusnet_checknotification($a, $uid, $nick, $item, $postarray);
-                       }
                }
        }
 }
@@ -1532,10 +1539,10 @@ function statusnet_convertmsg(App $a, $body, $no_tags = false)
 {
        require_once "include/items.php";
 
-       $body = preg_replace("=\[url\=https?://([0-9]*).([0-9]*).([0-9]*).([0-9]*)/([0-9]*)\](.*?)\[\/url\]=ism", "$1.$2.$3.$4/$5", $body);
+       $body = preg_replace("=\[url\=https?://([0-9]*).([0-9]*).([0-9]*).([0-9]*)/([0-9]*)\](.*?)\[\/url\]=ism","$1.$2.$3.$4/$5",$body);
 
        $URLSearchString = "^\[\]";
-       $links = preg_match_all("/[^!#@]\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", $body, $matches, PREG_SET_ORDER);
+       $links = preg_match_all("/[^!#@]\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", $body,$matches,PREG_SET_ORDER);
 
        $footer = "";
        $footerurl = "";
@@ -1544,27 +1551,25 @@ function statusnet_convertmsg(App $a, $body, $no_tags = false)
 
        if ($links) {
                foreach ($matches AS $match) {
-                       $search = "[url=" . $match[1] . "]" . $match[2] . "[/url]";
+                       $search = "[url=".$match[1]."]".$match[2]."[/url]";
 
-                       logger("statusnet_convertmsg: expanding url " . $match[1], LOGGER_DEBUG);
+                       logger("statusnet_convertmsg: expanding url ".$match[1], LOGGER_DEBUG);
 
                        $expanded_url = Network::finalUrl($match[1]);
 
-                       logger("statusnet_convertmsg: fetching data for " . $expanded_url, LOGGER_DEBUG);
+                       logger("statusnet_convertmsg: fetching data for ".$expanded_url, LOGGER_DEBUG);
 
-                       $oembed_data = OEmbed::fetchURL($expanded_url, true);
+                       $oembed_data = oembed_fetch_url($expanded_url, true);
 
                        logger("statusnet_convertmsg: fetching data: done", LOGGER_DEBUG);
 
-                       if ($type == "") {
+                       if ($type == "")
                                $type = $oembed_data->type;
-                       }
-
                        if ($oembed_data->type == "video") {
                                //$body = str_replace($search, "[video]".$expanded_url."[/video]", $body);
                                $type = $oembed_data->type;
                                $footerurl = $expanded_url;
-                               $footerlink = "[url=" . $expanded_url . "]" . $expanded_url . "[/url]";
+                               $footerlink = "[url=".$expanded_url."]".$expanded_url."[/url]";
 
                                $body = str_replace($search, $footerlink, $body);
                        } elseif (($oembed_data->type == "photo") && isset($oembed_data->url) && !$dontincludemedia) {
@@ -1581,72 +1586,67 @@ function statusnet_convertmsg(App $a, $body, $no_tags = false)
 
                                if (substr($mime, 0, 6) == "image/") {
                                        $type = "photo";
-                                       $body = str_replace($search, "[img]" . $expanded_url . "[/img]", $body);
+                                       $body = str_replace($search, "[img]".$expanded_url."[/img]", $body);
                                } else {
                                        $type = $oembed_data->type;
                                        $footerurl = $expanded_url;
-                                       $footerlink = "[url=" . $expanded_url . "]" . $expanded_url . "[/url]";
+                                       $footerlink = "[url=".$expanded_url."]".$expanded_url."[/url]";
 
                                        $body = str_replace($search, $footerlink, $body);
                                }
                        }
                }
 
-               if ($footerurl != "") {
+               if ($footerurl != "")
                        $footer = add_page_info($footerurl);
-               }
 
                if (($footerlink != "") && (trim($footer) != "")) {
                        $removedlink = trim(str_replace($footerlink, "", $body));
 
-                       if (($removedlink == "") || strstr($body, $removedlink)) {
+                       if (($removedlink == "") || strstr($body, $removedlink))
                                $body = $removedlink;
-                       }
 
                        $body .= $footer;
                }
        }
 
-       if ($no_tags) {
-               return ["body" => $body, "tags" => ""];
-       }
+       if ($no_tags)
+               return(array("body" => $body, "tags" => ""));
 
        $str_tags = '';
 
-       $cnt = preg_match_all("/([!#@])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", $body, $matches, PREG_SET_ORDER);
-       if ($cnt) {
-               foreach ($matches as $mtch) {
-                       if (strlen($str_tags)) {
+       $cnt = preg_match_all("/([!#@])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",$body,$matches,PREG_SET_ORDER);
+       if($cnt) {
+               foreach($matches as $mtch) {
+                       if(strlen($str_tags))
                                $str_tags .= ',';
-                       }
 
                        if ($mtch[1] == "#") {
                                // Replacing the hash tags that are directed to the GNU Social server with internal links
-                               $snhash = "#[url=" . $mtch[2] . "]" . $mtch[3] . "[/url]";
-                               $frdchash = '#[url=' . $a->get_baseurl() . '/search?tag=' . rawurlencode($mtch[3]) . ']' . $mtch[3] . '[/url]';
+                               $snhash = "#[url=".$mtch[2]."]".$mtch[3]."[/url]";
+                               $frdchash = '#[url='.$a->get_baseurl().'/search?tag='.rawurlencode($mtch[3]).']'.$mtch[3].'[/url]';
                                $body = str_replace($snhash, $frdchash, $body);
 
                                $str_tags .= $frdchash;
-                       } else {
-                               $str_tags .= "@[url=" . $mtch[2] . "]" . $mtch[3] . "[/url]";
-                       }
-                       // To-Do:
-                       // There is a problem with links with to GNU Social groups, so these links are stored with "@" like friendica groups
-                       //$str_tags .= $mtch[1]."[url=".$mtch[2]."]".$mtch[3]."[/url]";
+                       } else
+                               $str_tags .= "@[url=".$mtch[2]."]".$mtch[3]."[/url]";
+                               // To-Do:
+                               // There is a problem with links with to GNU Social groups, so these links are stored with "@" like friendica groups
+                               //$str_tags .= $mtch[1]."[url=".$mtch[2]."]".$mtch[3]."[/url]";
                }
        }
 
-       return ["body" => $body, "tags" => $str_tags];
+       return(array("body"=>$body, "tags"=>$str_tags));
+
 }
 
-function statusnet_fetch_own_contact(App $a, $uid)
-{
-       $ckey    = PConfig::get($uid, 'statusnet', 'consumerkey');
-       $csecret = PConfig::get($uid, 'statusnet', 'consumersecret');
-       $api     = PConfig::get($uid, 'statusnet', 'baseapi');
-       $otoken  = PConfig::get($uid, 'statusnet', 'oauthtoken');
-       $osecret = PConfig::get($uid, 'statusnet', 'oauthsecret');
-       $own_url = PConfig::get($uid, 'statusnet', 'own_url');
+function statusnet_fetch_own_contact($a, $uid) {
+       $ckey    = get_pconfig($uid, 'statusnet', 'consumerkey');
+       $csecret = get_pconfig($uid, 'statusnet', 'consumersecret');
+       $api     = get_pconfig($uid, 'statusnet', 'baseapi');
+       $otoken  = get_pconfig($uid, 'statusnet', 'oauthtoken');
+       $osecret = get_pconfig($uid, 'statusnet', 'oauthsecret');
+       $own_url = get_pconfig($uid, 'statusnet', 'own_url');
 
        $contact_id = 0;
 
@@ -1656,73 +1656,66 @@ function statusnet_fetch_own_contact(App $a, $uid)
                // Fetching user data
                $user = $connection->get('account/verify_credentials');
 
-               PConfig::set($uid, 'statusnet', 'own_url', normalise_link($user->statusnet_profile_url));
+               set_pconfig($uid, 'statusnet', 'own_url', normalise_link($user->statusnet_profile_url));
 
                $contact_id = statusnet_fetch_contact($uid, $user, true);
+
        } else {
                $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
                        intval($uid), dbesc($own_url));
-               if (count($r)) {
+               if(count($r))
                        $contact_id = $r[0]["id"];
-               } else {
-                       PConfig::delete($uid, 'statusnet', 'own_url');
-               }
+               else
+                       del_pconfig($uid, 'statusnet', 'own_url');
+
        }
-       return $contact_id;
+       return($contact_id);
 }
 
-function statusnet_is_retweet(App $a, $uid, $body)
-{
+function statusnet_is_retweet($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;
-       }
+       if (strpos($body, "[share") > 0)
+               return(false);
 
        // Does it end with a share?
-       if (strlen($body) > (strrpos($body, "[/share]") + 8)) {
-               return false;
-       }
+       if (strlen($body) > (strrpos($body, "[/share]") + 8))
+               return(false);
 
-       $attributes = preg_replace("/\[share(.*?)\]\s?(.*?)\s?\[\/share\]\s?/ism", "$1", $body);
+       $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;
-       }
+       if ($body == $attributes)
+               return(false);
 
        $link = "";
        preg_match("/link='(.*?)'/ism", $attributes, $matches);
-       if ($matches[1] != "") {
+       if ($matches[1] != "")
                $link = $matches[1];
-       }
 
        preg_match('/link="(.*?)"/ism', $attributes, $matches);
-       if ($matches[1] != "") {
+       if ($matches[1] != "")
                $link = $matches[1];
-       }
 
-       $ckey    = PConfig::get($uid, 'statusnet', 'consumerkey');
-       $csecret = PConfig::get($uid, 'statusnet', 'consumersecret');
-       $api     = PConfig::get($uid, 'statusnet', 'baseapi');
-       $otoken  = PConfig::get($uid, 'statusnet', 'oauthtoken');
-       $osecret = PConfig::get($uid, 'statusnet', 'oauthsecret');
+       $ckey    = get_pconfig($uid, 'statusnet', 'consumerkey');
+       $csecret = get_pconfig($uid, 'statusnet', 'consumersecret');
+       $api     = get_pconfig($uid, 'statusnet', 'baseapi');
+       $otoken  = get_pconfig($uid, 'statusnet', 'oauthtoken');
+       $osecret = get_pconfig($uid, 'statusnet', 'oauthsecret');
        $hostname = preg_replace("=https?://([\w\.]*)/.*=ism", "$1", $api);
 
-       $id = preg_replace("=https?://" . $hostname . "/notice/(.*)=ism", "$1", $link);
+       $id = preg_replace("=https?://".$hostname."/notice/(.*)=ism", "$1", $link);
 
-       if ($id == $link) {
-               return false;
-       }
+       if ($id == $link)
+               return(false);
 
-       logger('statusnet_is_retweet: Retweeting id ' . $id . ' for user ' . $uid, LOGGER_DEBUG);
-
-       $connection = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret);
+       logger('statusnet_is_retweet: Retweeting id '.$id.' for user '.$uid, LOGGER_DEBUG);
 
-       $result = $connection->post('statuses/retweet/' . $id);
+       $connection = new StatusNetOAuth($api, $ckey,$csecret,$otoken,$osecret);
 
-       logger('statusnet_is_retweet: result ' . print_r($result, true), LOGGER_DEBUG);
+       $result = $connection->post('statuses/retweet/'.$id);
 
-       return isset($result->id);
+       logger('statusnet_is_retweet: result '.print_r($result, true), LOGGER_DEBUG);
+       return(isset($result->id));
 }
index 3bbdeb906afe22d8c4967effbc2930e2c073e385..5f81fef81bcbb11f9d0a748c7149270906730355 100644 (file)
@@ -4,15 +4,15 @@
 # 
 # 
 # Translators:
-# Albert, 2016-2017
+# Albert, 2016
 # juanman <juanma@gnutn.org.ar>, 2017
 msgid ""
 msgstr ""
 "Project-Id-Version: friendica\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2017-04-21 08:45+0200\n"
-"PO-Revision-Date: 2017-10-26 18:00+0000\n"
-"Last-Translator: Albert\n"
+"PO-Revision-Date: 2017-07-04 16:27+0000\n"
+"Last-Translator: juanman <juanma@gnutn.org.ar>\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"
@@ -22,7 +22,7 @@ msgstr ""
 
 #: superblock.php:53 superblock.php:57
 msgid "\"Superblock\""
-msgstr "«Superbloque»"
+msgstr ""
 
 #: superblock.php:60
 msgid "Comma separated profile URLS to block"
@@ -34,7 +34,7 @@ msgstr "Guardar configuración"
 
 #: superblock.php:76
 msgid "SUPERBLOCK Settings saved."
-msgstr "Ajustes de SUPERBLOQUE guardados."
+msgstr ""
 
 #: superblock.php:148
 msgid "Block Completely"
@@ -42,4 +42,4 @@ msgstr "Bloquear completamente"
 
 #: superblock.php:168
 msgid "superblock settings updated"
-msgstr "ajustes de superbloque actualizados"
+msgstr ""
index 1b40975f169813778b718e89a1b9e12beff57553..cb80c96e80b86a05752c4ed8528c44cb980c5dc4 100644 (file)
@@ -5,9 +5,9 @@ function string_plural_select_es($n){
        return ($n != 1);;
 }}
 ;
-$a->strings["\"Superblock\""] = "«Superbloque»";
+$a->strings["\"Superblock\""] = "";
 $a->strings["Comma separated profile URLS to block"] = "Perfil de URLS a bloque separado por comas";
 $a->strings["Save Settings"] = "Guardar configuración";
-$a->strings["SUPERBLOCK Settings saved."] = "Ajustes de SUPERBLOQUE guardados.";
+$a->strings["SUPERBLOCK Settings saved."] = "";
 $a->strings["Block Completely"] = "Bloquear completamente";
-$a->strings["superblock settings updated"] = "ajustes de superbloque actualizados";
+$a->strings["superblock settings updated"] = "";
index 241114866b739f9a3a8ecbeab90de6ab920b7435..1c9dab7cabcad188df3562a40c325281ae816646 100644 (file)
@@ -47,7 +47,7 @@ function superblock_addon_settings(&$a,&$s) {
 
        $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . $a->get_baseurl() . '/addon/superblock/superblock.css' . '" media="all" />' . "\r\n";
 
-       $words = PConfig::get(local_user(),'system','blocked');
+       $words = get_pconfig(local_user(),'system','blocked');
        if(! $words) {
                $words = '';
        }
@@ -82,7 +82,7 @@ function superblock_addon_settings_post(&$a,&$b) {
 
 function superblock_enotify_store(&$a,&$b) {
 
-       $words = PConfig::get($b['uid'],'system','blocked');
+       $words = get_pconfig($b['uid'],'system','blocked');
        if($words) {
                $arr = explode(',',$words);
        }
@@ -114,7 +114,7 @@ function superblock_conversation_start(&$a,&$b) {
        if(! local_user())
                return;
 
-       $words = PConfig::get(local_user(),'system','blocked');
+       $words = get_pconfig(local_user(),'system','blocked');
        if($words) {
                $a->data['superblock'] = explode(',',$words);
        }
@@ -159,7 +159,7 @@ function superblock_init(&$a) {
        if(! local_user())
                return;
 
-       $words = PConfig::get(local_user(),'system','blocked');
+       $words = get_pconfig(local_user(),'system','blocked');
 
        if(array_key_exists('block',$_GET) && $_GET['block']) {
                if(strlen($words))
index 5c3930cd35188167186d1b21fc185c18debf210e..4398ffbf9cb98575f32115fc62ec871bc80b5a14 100644 (file)
@@ -39,7 +39,7 @@ function testdrive_register_account($a,$b) {
 
        $uid = $b;
 
-       $days = Config::get('testdrive','expiredays');
+       $days = get_config('testdrive','expiredays');
        if(! $days)
                return;
 
@@ -59,7 +59,7 @@ function testdrive_cron($a,$b) {
 
        if(count($r)) {
                foreach($r as $rr) {
-                       notification([
+                       notification(array(
                                'uid' => $rr['uid'],
                                'type' => NOTIFY_SYSTEM,
                                'system_type' => 'testdrive_expire',
@@ -69,7 +69,7 @@ function testdrive_cron($a,$b) {
                                'source_name'  => L10n::t('Administrator'),
                                'source_link'  => $a->get_baseurl(),
                                'source_photo' => $a->get_baseurl() . '/images/person-80.jpg',
-                       ]);
+                       ));
 
                        q("update user set expire_notification_sent = '%s' where uid = %d",
                                dbesc(DateTimeFormat::utcNow()),
@@ -81,10 +81,12 @@ function testdrive_cron($a,$b) {
 
        $r = q("select * from user where account_expired = 1 and account_expires_on < UTC_TIMESTAMP() - INTERVAL 5 DAY ");
        if(count($r)) {
-               foreach($r as $rr) {
-                       User::remove($rr['uid']);
-               }
+               require_once('include/Contact.php');
+               foreach($r as $rr)
+                       user_remove($rr['uid']);
+
        }
+
 }
 
 function testdrive_enotify(&$a, &$b) {
index fe2c5cf12d5034306159506de74fac76d0f843dc..ffea3c2648861b35010e1da76c99d4a2c4fcca20 100644 (file)
@@ -40,7 +40,7 @@ function tictac_content(&$a) {
     $dimen = $a->argv[3];
     $yours = $a->argv[4];
     $mine  = $a->argv[5];
-
+    
     $yours .= $_POST['move'];
   }
   elseif($a->argc > 1) {
@@ -74,11 +74,11 @@ class tictac {
   private $handicap = 0;
   private $yours;
   private $mine;
-  private $winning_play;
+  private $winning_play;  
   private $you;
   private $me;
   private $debug = 1;
-  private $crosses = ['011','101','110','112','121','211'];
+  private $crosses = array('011','101','110','112','121','211');
 
 /*
     '001','010','011','012','021',
@@ -86,82 +86,82 @@ class tictac {
     '201','210','211','212','221');
 */
 
-  private $corners = [
+  private $corners = array(
     '000','002','020','022',
-    '200','202','220','222'];
-
-  private $planes = [
-    ['000','001','002','010','011','012','020','021','022'], // horiz 1
-    ['100','101','102','110','111','112','120','121','122'], // 2
-    ['200','201','202','210','211','212','220','221','222'], // 3
-    ['000','010','020','100','110','120','200','210','220'], // vert left
-    ['000','001','002','100','101','102','200','201','202'], // vert top
-    ['002','012','022','102','112','122','202','212','222'], // vert right
-    ['020','021','022','120','121','122','220','221','222'], // vert bot
-    ['010','011','012','110','111','112','210','211','212'], // left vertx
-    ['001','011','021','101','111','221','201','211','221'], // top vertx
-    ['000','001','002','110','111','112','220','221','222'], // diag top
-    ['020','021','022','110','111','112','200','201','202'], // diag bot
-    ['000','010','020','101','111','121','202','212','222'], // diag left
-    ['002','012','022','101','111','121','200','210','220'], // diag right
-    ['002','011','020','102','111','120','202','211','220'], // diag x
-    ['000','011','022','100','111','122','200','211','222']  // diag x
-
-  ];
-
-
-  private $winner = [
-     ['000','001','002'],         // board 0 winners  - left corner across
-     ['000','010','020'],         // down
-     ['000','011','022'],         // diag
-     ['001','011','021'],         // middle-top down
-     ['010','011','012'],         // middle-left across
-     ['002','011','020'],         // right-top diag
-     ['002','012','022'],         // right-top down
-     ['020','021','022'],        // bottom-left across
-     ['100','101','102'],      // board 1 winners
-     ['100','110','120'],
-     ['100','111','122'],
-     ['101','111','121'],
-     ['110','111','112'],
-     ['102','111','120'],
-     ['102','112','122'],
-     ['120','121','122'],
-     ['200','201','202'],    // board 2 winners
-     ['200','210','220'],
-     ['200','211','222'],
-     ['201','211','221'],
-     ['210','211','212'],
-     ['202','211','220'],
-     ['202','212','222'],
-     ['220','221','222'],
-     ['000','100','200'],      // top-left corner 3d
-     ['000','101','202'],
-     ['000','110','220'],
-     ['000','111','222'],
-     ['001','101','201'],      // top-middle 3d
-     ['001','111','221'],
-     ['002','102','202'],      // top-right corner 3d
-     ['002','101','200'],
-     ['002','112','222'],
-     ['002','111','220'],
-     ['010','110','210'],      // left-middle 3d
-     ['010','111','212'],
-     ['011','111','211'],      // middle-middle 3d
-     ['012','112','212'],      // right-middle 3d
-     ['012','111','210'],
-     ['020','120','220'],      // bottom-left corner 3d
-     ['020','110','200'],
-     ['020','121','222'],
-     ['020','111','202'],
-     ['021','121','221'],      // bottom-middle 3d
-     ['021','111','201'],
-     ['022','122','222'],      // bottom-right corner 3d
-     ['022','121','220'],
-     ['022','112','202'],
-     ['022','111','200']
-
-  ];
+    '200','202','220','222');
+
+  private $planes = array(
+    array('000','001','002','010','011','012','020','021','022'), // horiz 1
+    array('100','101','102','110','111','112','120','121','122'), // 2
+    array('200','201','202','210','211','212','220','221','222'), // 3
+    array('000','010','020','100','110','120','200','210','220'), // vert left
+    array('000','001','002','100','101','102','200','201','202'), // vert top
+    array('002','012','022','102','112','122','202','212','222'), // vert right
+    array('020','021','022','120','121','122','220','221','222'), // vert bot
+    array('010','011','012','110','111','112','210','211','212'), // left vertx
+    array('001','011','021','101','111','221','201','211','221'), // top vertx
+    array('000','001','002','110','111','112','220','221','222'), // diag top
+    array('020','021','022','110','111','112','200','201','202'), // diag bot
+    array('000','010','020','101','111','121','202','212','222'), // diag left
+    array('002','012','022','101','111','121','200','210','220'), // diag right
+    array('002','011','020','102','111','120','202','211','220'), // diag x
+    array('000','011','022','100','111','122','200','211','222')  // diag x
+    
+  );
+
+
+  private $winner = array(
+     array('000','001','002'),         // board 0 winners  - left corner across
+     array('000','010','020'),         // down
+     array('000','011','022'),         // diag
+     array('001','011','021'),         // middle-top down
+     array('010','011','012'),         // middle-left across
+     array('002','011','020'),         // right-top diag
+     array('002','012','022'),         // right-top down
+     array('020','021','022'),        // bottom-left across
+     array('100','101','102'),      // board 1 winners
+     array('100','110','120'),
+     array('100','111','122'),
+     array('101','111','121'),
+     array('110','111','112'),
+     array('102','111','120'),
+     array('102','112','122'),
+     array('120','121','122'),
+     array('200','201','202'),    // board 2 winners
+     array('200','210','220'),
+     array('200','211','222'),
+     array('201','211','221'),
+     array('210','211','212'),
+     array('202','211','220'),
+     array('202','212','222'),
+     array('220','221','222'),
+     array('000','100','200'),      // top-left corner 3d
+     array('000','101','202'),
+     array('000','110','220'),
+     array('000','111','222'),
+     array('001','101','201'),      // top-middle 3d
+     array('001','111','221'),
+     array('002','102','202'),      // top-right corner 3d
+     array('002','101','200'),
+     array('002','112','222'),
+     array('002','111','220'),
+     array('010','110','210'),      // left-middle 3d
+     array('010','111','212'),
+     array('011','111','211'),      // middle-middle 3d
+     array('012','112','212'),      // right-middle 3d
+     array('012','111','210'),
+     array('020','120','220'),      // bottom-left corner 3d
+     array('020','110','200'),
+     array('020','121','222'),
+     array('020','111','202'),
+     array('021','121','221'),      // bottom-middle 3d
+     array('021','111','201'),
+     array('022','122','222'),      // bottom-right corner 3d
+     array('022','121','220'),
+     array('022','112','202'),
+     array('022','111','200')
+
+  );
 
   function __construct($dimen,$handicap,$mefirst,$yours,$mine) {
     $this->dimen = 3;
@@ -210,7 +210,7 @@ class tictac {
          $this->mine .= $move;
          $this->me = $this->parse_moves('me');
        }
-       else {
+       else {  
          $move = $this->offensive_move();
          if(strlen($move)) {
            $this->mine .= $move;
@@ -232,7 +232,7 @@ class tictac {
       $str = $this->mine;
     if($player == 'you')
       $str = $this->yours;
-    $ret = [];
+    $ret = array();
       while(strlen($str)) {
          $ret[] = substr($str,0,3);
          $str = substr($str,3);
@@ -300,7 +300,7 @@ function winning_move() {
       if($this->handicap) {
         $p = $this->uncontested_plane();
         foreach($this->corners as $c)
-          if((in_array($c,$p))
+          if((in_array($c,$p)) 
             && (! $this->is_yours($c)) && (! $this->is_mine($c)))
               return($c);
       }
@@ -321,11 +321,11 @@ function winning_move() {
           if(in_array($this->me[0],$this->corners)) {
             $p = $this->my_best_plane();
             foreach($this->winner as $w) {
-              if((in_array($w[0],$this->you))
+              if((in_array($w[0],$this->you)) 
               || (in_array($w[1],$this->you))
               || (in_array($w[2],$this->you)))
-                continue;
-              if(in_array($w[0],$this->corners)
+                continue;        
+              if(in_array($w[0],$this->corners) 
                 && in_array($w[2],$this->corners)
                 && in_array($w[0],$p) && in_array($w[2],$p)) {
                   if($this->me[0] == $w[0])
@@ -339,7 +339,7 @@ function winning_move() {
         else {
           $r = $this->get_corners($this->me);
           if(count($r) > 1) {
-            $w1 = []; $w2 = [];
+            $w1 = array(); $w2 = array();
             foreach($this->winner as $w) {
               if(in_array('111',$w))
                 continue;
@@ -351,13 +351,13 @@ function winning_move() {
             if(count($w1) && count($w2)) {
               foreach($w1 as $a) {
                 foreach($w2 as $b) {
-                  if((in_array($a[0],$this->you))
+                  if((in_array($a[0],$this->you)) 
                   || (in_array($a[1],$this->you))
                   || (in_array($a[2],$this->you))
                   || (in_array($b[0],$this->you))
                   || (in_array($b[1],$this->you))
                   || (in_array($b[2],$this->you)))
-                    continue;
+                    continue; 
                   if(($a[0] == $b[0]) && ! $this->is_mine($a[0])) {
                     return $a[0];
                   }
@@ -376,8 +376,8 @@ function winning_move() {
  //     && in_array($this->you[0],$this->corners)
  //     && $this->is_neighbor($this->me[0],$this->you[0])) {
 
-      // Yuck. You foiled my plan. Since you obviously aren't playing to win,
-      // I'll try again. You may keep me busy for a few rounds, but I'm
+      // Yuck. You foiled my plan. Since you obviously aren't playing to win, 
+      // I'll try again. You may keep me busy for a few rounds, but I'm 
       // gonna' get you eventually.
 
 //      $p = $this->uncontested_plane();
@@ -389,14 +389,14 @@ function winning_move() {
 
 
     // find all the winners containing my points.
-    $mywinners = [];
+    $mywinners = array();
     foreach($this->winner as $w)
       foreach($this->me as $m)
         if((in_array($m,$w)) && (! in_array($w,$mywinners)))
           $mywinners[] = $w;
 
     // find all the rules where my points are in the center.
-      $trythese = [];
+      $trythese = array();
       if(count($mywinners)) {
         foreach($mywinners as $w) {
           foreach($this->me as $m) {
@@ -407,19 +407,19 @@ function winning_move() {
         }
       }
 
-      $myplanes = [];
+      $myplanes = array();
       for($p = 0; $p < count($this->planes); $p ++) {
         if($this->handicap && in_array('111',$this->planes[$p]))
           continue;
         foreach($this->me as $m)
-          if((in_array($m,$this->planes[$p]))
+          if((in_array($m,$this->planes[$p])) 
             && (! in_array($this->planes[$p],$myplanes)))
               $myplanes[] = $this->planes[$p];
       }
       shuffle($myplanes);
 
     // find all winners which share an endpoint, and which are uncontested
-      $candidates = [];
+      $candidates = array();
       if(count($trythese) && count($myplanes)) {
         foreach($trythese as $t) {
           foreach($this->winner as $w) {
@@ -437,7 +437,7 @@ function winning_move() {
 
       // Find out if we are about to force a win.
       // Looking for two winning vectors with a common endpoint
-      // and where we own the middle of both - we are now going to
+      // and where we own the middle of both - we are now going to 
       // grab the endpoint. The game isn't yet over but we've already won.
 
       if(count($candidates)) {
@@ -453,7 +453,7 @@ function winning_move() {
        }
 
        // find opponents planes
-      $yourplanes = [];
+      $yourplanes = array();
       for($p = 0; $p < count($this->planes); $p ++) {
         if($this->handicap && in_array('111',$this->planes[$p]))
           continue;
@@ -467,7 +467,7 @@ function winning_move() {
          // We now have a list of winning strategy vectors for our second point
          // Pick one that will force you into defensive mode.
          // Pick a point close to you so we don't risk giving you two
-         // in a row when you block us. That would force *us* into
+         // in a row when you block us. That would force *us* into 
          // defensive mode.
          // We want:        or:         not:
          //           X|O|     X| |       X| |
@@ -476,41 +476,41 @@ function winning_move() {
 
          if(count($this->you) == 1) {
            foreach($this->winner as $w) {
-             if(in_array($this->me[0], $w) && in_array($c[1],$w)
-               && $this->uncontested_winner($w)
+             if(in_array($this->me[0], $w) && in_array($c[1],$w) 
+               && $this->uncontested_winner($w) 
                && $this->is_neighbor($this->you[0],$c[1])) {
                  return($c[1]);
-             }
+             }  
            }
          }
-       }
+       }         
 
-       // You're somewhere else entirely or have made more than one move
+       // You're somewhere else entirely or have made more than one move 
        // - any strategy vector which puts you on the defense will have to do
 
        foreach($candidates as $c) {
          foreach($this->winner as $w) {
-           if(in_array($this->me[0], $w) && in_array($c[1],$w)
+           if(in_array($this->me[0], $w) && in_array($c[1],$w) 
              && $this->uncontested_winner($w)) {
                    return($c[1]);
-           }
+           }  
          }
        }
      }
 
-    // worst case scenario, no strategy we can play,
+    // worst case scenario, no strategy we can play, 
     // just find an empty space and take it
 
     for($x = 0; $x < $this->dimen; $x ++)
       for($y = 0; $y < $this->dimen; $y ++)
         for($z = 0; $z < $this->dimen; $z ++)
-          if((! $this->marked_yours($x,$y,$z))
+          if((! $this->marked_yours($x,$y,$z)) 
             && (! $this->marked_mine($x,$y,$z))) {
             if($this->handicap && $x == 1 && $y == 1 && $z == 1)
               continue;
             return(sprintf("%d%d%d",$x,$y,$z));
           }
-
+       
   return '';
   }
 
@@ -541,7 +541,7 @@ function winning_move() {
   }
 
   function get_corners($a) {
-    $total = [];
+    $total = array();
     if(count($a))
       foreach($a as $b)
         if(in_array($b,$this->corners))
@@ -576,7 +576,7 @@ function winning_move() {
 
   function my_best_plane() {
 
-    $second_choice = [];
+    $second_choice = array();
     shuffle($this->planes);
     for($p = 0; $p < count($this->planes); $p ++ ) {
       $contested = 0;
@@ -586,7 +586,7 @@ function winning_move() {
         continue;
       foreach($this->you as $m) {
         if(in_array($m,$this->planes[$p]))
-          $contested ++;
+          $contested ++;   
       }
       if(! $contested)
         return($this->planes[$p]);
@@ -611,8 +611,8 @@ function winning_move() {
         if($this->handicap && in_array('111',$pl[$p]))
           continue;
        foreach($this->you as $m) {
-         if(in_array($m,$pl[$p]))
-           $freeplane = false;
+         if(in_array($m,$pl[$p]))   
+           $freeplane = false;         
        }
        if(! $freeplane) {
          $freeplane = true;
@@ -621,7 +621,7 @@ function winning_move() {
        if($freeplane)
          return($pl[$p]);
     }
-    return [];
+    return array();
   }
 
   function fullboard() {
@@ -642,7 +642,7 @@ function winning_move() {
           $bordertop = (($y != 0) ? " border-top: 2px solid #000;" : "");
           $borderleft = (($z != 0) ? " border-left: 2px solid #000;" : "");
           if($this->handicap && $x == 1 && $y == 1 && $z == 1)
-            $o .=  "<td style=\"width: 25px; height: 25px; $bordertop $borderleft\" align=\"center\">&nbsp;</td>";
+            $o .=  "<td style=\"width: 25px; height: 25px; $bordertop $borderleft\" align=\"center\">&nbsp;</td>";                  
           elseif($this->marked_yours($x,$y,$z))
             $o .=  "<td style=\"width: 25px; height: 25px; $bordertop $borderleft $winner\" align=\"center\">X</td>";
           elseif($this->marked_mine($x,$y,$z))
index b2dec5b544a3735c35fc74fc785f011b66abb372..e038b843a80cda4a282368291b79d1dfb112f510 100644 (file)
@@ -85,8 +85,8 @@ function tumblr_connect($a) {
        //require_once('addon/tumblr/tumblroauth/tumblroauth.php');
 
        // Define the needed keys
-       $consumer_key = Config::get('tumblr','consumer_key');
-       $consumer_secret = Config::get('tumblr','consumer_secret');
+       $consumer_key = get_config('tumblr','consumer_key');
+       $consumer_secret = get_config('tumblr','consumer_secret');
 
        // The callback URL is the script that gets called after the user authenticates with tumblr
        // In this example, it would be the included callback.php
@@ -135,8 +135,8 @@ function tumblr_callback($a) {
        //require_once('addon/tumblr/tumblroauth/tumblroauth.php');
 
        // Define the needed keys
-       $consumer_key = Config::get('tumblr','consumer_key');
-       $consumer_secret = Config::get('tumblr','consumer_secret');
+       $consumer_key = get_config('tumblr','consumer_key');
+       $consumer_secret = get_config('tumblr','consumer_secret');
 
        // Once the user approves your app at Tumblr, they are sent back to this script.
        // This script is passed two parameters in the URL, oauth_token (our Request Token)
@@ -162,8 +162,8 @@ function tumblr_callback($a) {
        }
 
        // What's next?  Now that we have an Access Token and Secret, we can make an API call.
-       PConfig::set(local_user(), "tumblr", "oauth_token", $access_token['oauth_token']);
-       PConfig::set(local_user(), "tumblr", "oauth_token_secret", $access_token['oauth_token_secret']);
+       set_pconfig(local_user(), "tumblr", "oauth_token", $access_token['oauth_token']);
+       set_pconfig(local_user(), "tumblr", "oauth_token_secret", $access_token['oauth_token_secret']);
 
        $o = L10n::t("You are now authenticated to tumblr.");
        $o .= '<br /><a href="'.$a->get_baseurl().'/settings/connectors">'.L10n::t("return to the connector page").'</a>';
@@ -174,9 +174,9 @@ function tumblr_jot_nets(&$a,&$b) {
        if(! local_user())
                return;
 
-       $tmbl_post = PConfig::get(local_user(),'tumblr','post');
+       $tmbl_post = get_pconfig(local_user(),'tumblr','post');
        if(intval($tmbl_post) == 1) {
-               $tmbl_defpost = PConfig::get(local_user(),'tumblr','post_by_default');
+               $tmbl_defpost = get_pconfig(local_user(),'tumblr','post_by_default');
                $selected = ((intval($tmbl_defpost) == 1) ? ' checked="checked" ' : '');
                $b .= '<div class="profile-jot-net"><input type="checkbox" name="tumblr_enable"' . $selected . ' value="1" /> '
                        . L10n::t('Post to Tumblr') . '</div>';
@@ -195,11 +195,11 @@ function tumblr_settings(&$a,&$s) {
 
        /* Get the current state of our config variables */
 
-       $enabled = PConfig::get(local_user(),'tumblr','post');
+       $enabled = get_pconfig(local_user(),'tumblr','post');
        $checked = (($enabled) ? ' checked="checked" ' : '');
        $css = (($enabled) ? '' : '-disabled');
 
-       $def_enabled = PConfig::get(local_user(),'tumblr','post_by_default');
+       $def_enabled = get_pconfig(local_user(),'tumblr','post_by_default');
 
        $def_checked = (($def_enabled) ? ' checked="checked" ' : '');
 
@@ -227,26 +227,26 @@ function tumblr_settings(&$a,&$s) {
        $s .= '<input id="tumblr-bydefault" type="checkbox" name="tumblr_bydefault" value="1" ' . $def_checked . '/>';
        $s .= '</div><div class="clear"></div>';
 
-       $oauth_token = PConfig::get(local_user(), "tumblr", "oauth_token");
-       $oauth_token_secret = PConfig::get(local_user(), "tumblr", "oauth_token_secret");
+       $oauth_token = get_pconfig(local_user(), "tumblr", "oauth_token");
+       $oauth_token_secret = get_pconfig(local_user(), "tumblr", "oauth_token_secret");
 
        $s .= '<div id="tumblr-page-wrapper">';
        if (($oauth_token != "") && ($oauth_token_secret != "")) {
 
-               $page = PConfig::get(local_user(),'tumblr','page');
-               $consumer_key = Config::get('tumblr','consumer_key');
-               $consumer_secret = Config::get('tumblr','consumer_secret');
+               $page = get_pconfig(local_user(),'tumblr','page');
+               $consumer_key = get_config('tumblr','consumer_key');
+               $consumer_secret = get_config('tumblr','consumer_secret');
 
                $tum_oauth = new TumblrOAuth($consumer_key, $consumer_secret, $oauth_token, $oauth_token_secret);
 
                $userinfo = $tum_oauth->get('user/info');
 
-               $blogs = [];
+               $blogs = array();
 
                $s .= '<label id="tumblr-page-label" for="tumblr-page">' . L10n::t('Post to page:') . '</label>';
                $s .= '<select name="tumblr_page" id="tumblr-page">';
                foreach($userinfo->response->user->blogs as $blog) {
-                       $blogurl = substr(str_replace(["http://", "https://"], ["", ""], $blog->url), 0, -1);
+                       $blogurl = substr(str_replace(array("http://", "https://"), array("", ""), $blog->url), 0, -1);
                        if ($page == $blogurl)
                                $s .= "<option value='".$blogurl."' selected>".$blogurl."</option>";
                        else
@@ -269,9 +269,9 @@ function tumblr_settings_post(&$a,&$b) {
 
        if(x($_POST,'tumblr-submit')) {
 
-               PConfig::set(local_user(),'tumblr','post',intval($_POST['tumblr']));
-               PConfig::set(local_user(),'tumblr','page',$_POST['tumblr_page']);
-               PConfig::set(local_user(),'tumblr','post_by_default',intval($_POST['tumblr_bydefault']));
+               set_pconfig(local_user(),'tumblr','post',intval($_POST['tumblr']));
+               set_pconfig(local_user(),'tumblr','page',$_POST['tumblr_page']);
+               set_pconfig(local_user(),'tumblr','post_by_default',intval($_POST['tumblr_bydefault']));
 
        }
 
@@ -293,11 +293,11 @@ function tumblr_post_local(&$a, &$b) {
                return;
        }
 
-       $tmbl_post   = intval(PConfig::get(local_user(),'tumblr','post'));
+       $tmbl_post   = intval(get_pconfig(local_user(),'tumblr','post'));
 
        $tmbl_enable = (($tmbl_post && x($_REQUEST,'tumblr_enable')) ? intval($_REQUEST['tumblr_enable']) : 0);
 
-       if ($b['api_source'] && intval(PConfig::get(local_user(),'tumblr','post_by_default'))) {
+       if ($b['api_source'] && intval(get_pconfig(local_user(),'tumblr','post_by_default'))) {
                $tmbl_enable = 1;
        }
 
@@ -317,28 +317,18 @@ function tumblr_post_local(&$a, &$b) {
 
 function tumblr_send(&$a,&$b) {
 
-       if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) {
+       if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
                return;
-       }
-
-       if(! strstr($b['postopts'],'tumblr')) {
-               return;
-       }
 
-       if($b['parent'] != $b['id']) {
+       if(! strstr($b['postopts'],'tumblr'))
                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;
-       }
 
-       $oauth_token = PConfig::get($b['uid'], "tumblr", "oauth_token");
-       $oauth_token_secret = PConfig::get($b['uid'], "tumblr", "oauth_token_secret");
-       $page = PConfig::get($b['uid'], "tumblr", "page");
+       $oauth_token = get_pconfig($b['uid'], "tumblr", "oauth_token");
+       $oauth_token_secret = get_pconfig($b['uid'], "tumblr", "oauth_token_secret");
+       $page = get_pconfig($b['uid'], "tumblr", "page");
        $tmbl_blog = 'blog/'.$page.'/post';
 
        if($oauth_token && $oauth_token_secret && $tmbl_blog) {
@@ -358,11 +348,11 @@ function tumblr_send(&$a,&$b) {
 
                $siteinfo = BBCode::getAttachedData($b["body"]);
 
-               $params = [
+               $params = array(
                        'state' => 'published',
                        'tags' => $tags,
                        'tweet' => 'off',
-                       'format' => 'html'];
+                       'format' => 'html');
 
                if (!isset($siteinfo["type"]))
                        $siteinfo["type"] = "";
@@ -415,8 +405,8 @@ function tumblr_send(&$a,&$b) {
                if (trim($params['caption']) == "")
                        $params['caption'] = BBCode::convert("[quote]" . $siteinfo["description"] . "[/quote]", false, 4);
 
-               $consumer_key = Config::get('tumblr','consumer_key');
-               $consumer_secret = Config::get('tumblr','consumer_secret');
+               $consumer_key = get_config('tumblr','consumer_key');
+               $consumer_secret = get_config('tumblr','consumer_secret');
 
                $tum_oauth = new TumblrOAuth($consumer_key, $consumer_secret, $oauth_token, $oauth_token_secret);
 
index a460fd70f14b894f506805bcb45a7accec0ca4d1..148a498b1d3fbbff5877c99426c80b4574f10c45 100644 (file)
@@ -89,8 +89,7 @@ require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'a
 
 define('TWITTER_DEFAULT_POLL_INTERVAL', 5); // given in minutes
 
-function twitter_install()
-{
+function twitter_install() {
        //  we need some hooks, for the configuration and for sending tweets
        Addon::registerHook('connector_settings', 'addon/twitter/twitter.php', 'twitter_settings');
        Addon::registerHook('connector_settings_post', 'addon/twitter/twitter.php', 'twitter_settings_post');
@@ -126,27 +125,24 @@ function twitter_uninstall()
        Addon::unregisterHook('addon_settings_post', 'addon/twitter/twitter.php', 'twitter_settings_post');
 }
 
-function twitter_check_item_notification(App $a, &$notification_data)
-{
-       $own_id = PConfig::get($notification_data["uid"], 'twitter', 'own_id');
+function twitter_check_item_notification($a, &$notification_data) {
+       $own_id = get_pconfig($notification_data["uid"], 'twitter', 'own_id');
 
        $own_user = q("SELECT `url` FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
                        intval($notification_data["uid"]),
                        dbesc("twitter::".$own_id)
-       );
+               );
 
-       if ($own_user) {
+       if ($own_user)
                $notification_data["profiles"][] = $own_user[0]["url"];
-       }
 }
 
-function twitter_follow(App $a, &$contact)
-{
-       logger("twitter_follow: Check if contact is twitter contact. " . $contact["url"], LOGGER_DEBUG);
+function twitter_follow($a, &$contact) {
+
+       logger("twitter_follow: Check if contact is twitter contact. ".$contact["url"], LOGGER_DEBUG);
 
-       if (!strstr($contact["url"], "://twitter.com") && !strstr($contact["url"], "@twitter.com")) {
+       if (!strstr($contact["url"], "://twitter.com") && !strstr($contact["url"], "@twitter.com"))
                return;
-       }
 
        // contact seems to be a twitter contact, so continue
        $nickname = preg_replace("=https?://twitter.com/(.*)=ism", "$1", $contact["url"]);
@@ -174,52 +170,46 @@ function twitter_follow(App $a, &$contact)
                FROM `contact` WHERE `uid` = %d AND `nick` = '%s'",
                                intval($uid),
                                dbesc($nickname));
-       if (count($r)) {
+       if (count($r))
                $contact["contact"] = $r[0];
-       }
 }
 
-function twitter_jot_nets(App $a, &$b)
-{
-       if (!local_user()) {
+function twitter_jot_nets(&$a,&$b) {
+       if(! local_user())
                return;
-       }
 
-       $tw_post = PConfig::get(local_user(), 'twitter', 'post');
-       if (intval($tw_post) == 1) {
-               $tw_defpost = PConfig::get(local_user(), 'twitter', 'post_by_default');
+       $tw_post = get_pconfig(local_user(),'twitter','post');
+       if(intval($tw_post) == 1) {
+               $tw_defpost = get_pconfig(local_user(),'twitter','post_by_default');
                $selected = ((intval($tw_defpost) == 1) ? ' checked="checked" ' : '');
                $b .= '<div class="profile-jot-net"><input type="checkbox" name="twitter_enable"' . $selected . ' value="1" /> '
                        . L10n::t('Post to Twitter') . '</div>';
        }
 }
 
-function twitter_settings_post(App $a, $post)
-{
-       if (!local_user()) {
+function twitter_settings_post ($a,$post) {
+       if(! local_user())
                return;
-       }
        // don't check twitter settings if twitter submit button is not clicked
        if (empty($_POST['twitter-disconnect']) && empty($_POST['twitter-submit'])) {
                return;
-       }
 
        if (!empty($_POST['twitter-disconnect'])) {
                /*               * *
                 * if the twitter-disconnect checkbox is set, clear the OAuth key/secret pair
                 * from the user configuration
                 */
-               PConfig::delete(local_user(), 'twitter', 'consumerkey');
-               PConfig::delete(local_user(), 'twitter', 'consumersecret');
-               PConfig::delete(local_user(), 'twitter', 'oauthtoken');
-               PConfig::delete(local_user(), 'twitter', 'oauthsecret');
-               PConfig::delete(local_user(), 'twitter', 'post');
-               PConfig::delete(local_user(), 'twitter', 'post_by_default');
-               PConfig::delete(local_user(), 'twitter', 'lastid');
-               PConfig::delete(local_user(), 'twitter', 'mirror_posts');
-               PConfig::delete(local_user(), 'twitter', 'import');
-               PConfig::delete(local_user(), 'twitter', 'create_user');
-               PConfig::delete(local_user(), 'twitter', 'own_id');
+               del_pconfig(local_user(), 'twitter', 'consumerkey');
+               del_pconfig(local_user(), 'twitter', 'consumersecret');
+               del_pconfig(local_user(), 'twitter', 'oauthtoken');
+               del_pconfig(local_user(), 'twitter', 'oauthsecret');
+               del_pconfig(local_user(), 'twitter', 'post');
+               del_pconfig(local_user(), 'twitter', 'post_by_default');
+               del_pconfig(local_user(), 'twitter', 'lastid');
+               del_pconfig(local_user(), 'twitter', 'mirror_posts');
+               del_pconfig(local_user(), 'twitter', 'import');
+               del_pconfig(local_user(), 'twitter', 'create_user');
+               del_pconfig(local_user(), 'twitter', 'own_id');
        } else {
                if (isset($_POST['twitter-pin'])) {
                        //  if the user supplied us with a PIN from Twitter, let the magic of OAuth happen
@@ -262,17 +252,14 @@ function twitter_settings_post(App $a, $post)
                }
        }
 }
-
-function twitter_settings(App $a, &$s)
-{
-       if (!local_user()) {
+function twitter_settings(&$a,&$s) {
+       if(! local_user())
                return;
-       }
        $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . $a->get_baseurl() . '/addon/twitter/twitter.css' . '" media="all" />' . "\r\n";
-       /*       * *
+       /***
         * 1) Check that we have global consumer key & secret
         * 2) If no OAuthtoken & stuff is present, generate button to get some
-        * 3) Checkbox for "Send public notices (280 chars only)
+        * 3) Checkbox for "Send public notices (140 chars only)
         */
        $ckey    = Config::get('twitter', 'consumerkey');
        $csecret = Config::get('twitter', 'consumersecret');
@@ -321,12 +308,24 @@ function twitter_settings(App $a, &$s)
                        $s .= '</div><div class="clear"></div>';
                        $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="twitter-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div>';
                } else {
-                       /*                       * *
+                       /***
                         *  we have an OAuth key / secret pair for the user
                         *  so let's give a chance to disable the postings to Twitter
                         */
                        $connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret);
                        $details = $connection->get('account/verify_credentials');
+                       $s .= '<div id="twitter-info" ><img id="twitter-avatar" src="'.$details->profile_image_url.'" /><p id="twitter-info-block">'. t('Currently connected to: ') .'<a href="https://twitter.com/'.$details->screen_name.'" target="_twitter">'.$details->screen_name.'</a><br /><em>'.$details->description.'</em></p></div>';
+                       $s .= '<p>'. t('If enabled all your <strong>public</strong> postings can be posted to the associated Twitter account. You can choose to do so by default (here) or for every posting separately in the posting options when writing the entry.') .'</p>';
+                       if ($a->user['hidewall']) {
+                           $s .= '<p>'. t('<strong>Note</strong>: Due your privacy settings (<em>Hide your profile details from unknown viewers?</em>) the link potentially included in public postings relayed to Twitter will lead the visitor to a blank page informing the visitor that the access to your profile has been restricted.') .'</p>';
+                       }
+                       $s .= '<div id="twitter-enable-wrapper">';
+                       $s .= '<label id="twitter-enable-label" for="twitter-checkbox">'. t('Allow posting to Twitter'). '</label>';
+                       $s .= '<input id="twitter-checkbox" type="checkbox" name="twitter-enable" value="1" ' . $checked . '/>';
+                       $s .= '<div class="clear"></div>';
+                       $s .= '<label id="twitter-default-label" for="twitter-default">'. t('Send public postings to Twitter by default') .'</label>';
+                       $s .= '<input id="twitter-default" type="checkbox" name="twitter-default" value="1" ' . $defchecked . '/>';
+                       $s .= '<div class="clear"></div>';
 
                        $field_checkbox = get_markup_template('field_checkbox.tpl');
 
@@ -340,6 +339,7 @@ function twitter_settings(App $a, &$s)
                                </p>
                        </div>';
                        $s .= '<div class="clear"></div>';
+                       $s .= '</div>';
 
                        $s .= replace_macros($field_checkbox, [
                                '$field' => ['twitter-enable', L10n::t('Allow posting to Twitter'), $enabled, L10n::t('If enabled all your <strong>public</strong> postings can be posted to the associated Twitter account. You can choose to do so by default (here) or for every posting separately in the posting options when writing the entry.')]
@@ -360,6 +360,8 @@ function twitter_settings(App $a, &$s)
                                '$field' => ['twitter-create_user', L10n::t('Automatically create contacts'), $create_userenabled, '']
                        ]);
 
+                       $s .= '<label id="twitter-create_user-label" for="twitter-create_user">'.t('Automatically create contacts').'</label>';
+                       $s .= '<input id="twitter-create_user" type="checkbox" name="twitter-create_user" value="1" '. $create_userchecked . '/>';
                        $s .= '<div class="clear"></div>';
                        $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="twitter-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div>';
                }
@@ -367,8 +369,9 @@ function twitter_settings(App $a, &$s)
        $s .= '</div><div class="clear"></div>';
 }
 
-function twitter_post_local(App $a, &$b)
-{
+
+function twitter_post_local(&$a, &$b) {
+
        if ($b['edit']) {
                return;
        }
@@ -377,11 +380,11 @@ function twitter_post_local(App $a, &$b)
                return;
        }
 
-       $twitter_post = intval(PConfig::get(local_user(), 'twitter', 'post'));
+       $twitter_post = intval(get_pconfig(local_user(), 'twitter', 'post'));
        $twitter_enable = (($twitter_post && x($_REQUEST, 'twitter_enable')) ? intval($_REQUEST['twitter_enable']) : 0);
 
        // if API is used, default to the chosen settings
-       if ($b['api_source'] && intval(PConfig::get(local_user(), 'twitter', 'post_by_default'))) {
+       if ($b['api_source'] && intval(get_pconfig(local_user(), 'twitter', 'post_by_default'))) {
                $twitter_enable = 1;
        }
 
@@ -396,18 +399,13 @@ function twitter_post_local(App $a, &$b)
        $b['postopts'] .= 'twitter';
 }
 
-function twitter_action(App $a, $uid, $pid, $action)
-{
-       $ckey = Config::get('twitter', 'consumerkey');
-       $csecret = Config::get('twitter', 'consumersecret');
-       $otoken = PConfig::get($uid, 'twitter', 'oauthtoken');
-       $osecret = PConfig::get($uid, 'twitter', 'oauthsecret');
+function twitter_action($a, $uid, $pid, $action) {
 
        $connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret);
 
-       $post = ['id' => $pid];
+       $post = array('id' => $pid);
 
-       logger("twitter_action '" . $action . "' ID: " . $pid . " data: " . print_r($post, true), LOGGER_DATA);
+       logger("twitter_action '".$action."' ID: ".$pid." data: " . print_r($post, true), LOGGER_DATA);
 
        switch ($action) {
                case "delete":
@@ -420,7 +418,7 @@ function twitter_action(App $a, $uid, $pid, $action)
                        $result = $connection->post('favorites/destroy', $post);
                        break;
        }
-       logger("twitter_action '" . $action . "' send, result: " . print_r($result, true), LOGGER_DEBUG);
+       logger("twitter_action '".$action."' send, result: " . print_r($result, true), LOGGER_DEBUG);
 }
 
 function twitter_post_hook(App $a, &$b)
@@ -431,8 +429,8 @@ function twitter_post_hook(App $a, &$b)
                return;
        }
 
-       if ($b['parent'] != $b['id']) {
-               logger("twitter_post_hook: parameter " . print_r($b, true), LOGGER_DATA);
+       if($b['parent'] != $b['id']) {
+               logger("twitter_post_hook: parameter ".print_r($b, true), LOGGER_DATA);
 
                // Looking if its a reply to a twitter post
                if ((substr($b["parent-uri"], 0, 9) != "twitter::")
@@ -447,8 +445,8 @@ function twitter_post_hook(App $a, &$b)
                        dbesc($b["thr-parent"]),
                        intval($b["uid"]));
 
-               if (!count($r)) {
-                       logger("twitter_post_hook: no parent found " . $b["thr-parent"]);
+               if(!count($r)) {
+                       logger("twitter_post_hook: no parent found ".$b["thr-parent"]);
                        return;
                } else {
                        $iscomment = true;
@@ -457,33 +455,23 @@ function twitter_post_hook(App $a, &$b)
 
 
                $nicknameplain = preg_replace("=https?://twitter.com/(.*)=ism", "$1", $orig_post["author-link"]);
-               $nickname = "@[url=" . $orig_post["author-link"] . "]" . $nicknameplain . "[/url]";
-               $nicknameplain = "@" . $nicknameplain;
+               $nickname = "@[url=".$orig_post["author-link"]."]".$nicknameplain."[/url]";
+               $nicknameplain = "@".$nicknameplain;
 
-               logger("twitter_post_hook: 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("twitter_post_hook: 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("twitter_post_hook: parent found " . print_r($orig_post, true), LOGGER_DATA);
+               logger("twitter_post_hook: parent found ".print_r($orig_post, true), LOGGER_DATA);
        } else {
                $iscomment = false;
 
-               if ($b['private'] || !strstr($b['postopts'], 'twitter')) {
+               if($b['private'] || !strstr($b['postopts'],'twitter'))
                        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;
-               }
        }
 
-       if (($b['verb'] == ACTIVITY_POST) && $b['deleted']) {
+       if (($b['verb'] == ACTIVITY_POST) && $b['deleted'])
                twitter_action($a, $b["uid"], substr($orig_post["uri"], 9), "delete");
-       }
 
        if ($b['verb'] == ACTIVITY_LIKE) {
                logger("twitter_post_hook: parameter 2 " . substr($b["thr-parent"], 9), LOGGER_DEBUG);
@@ -496,35 +484,32 @@ function twitter_post_hook(App $a, &$b)
                return;
        }
 
-       if ($b['deleted'] || ($b['created'] !== $b['edited'])) {
+       if($b['deleted'] || ($b['created'] !== $b['edited']))
                return;
-       }
 
        // if post comes from twitter don't send it back
-       if ($b['extid'] == NETWORK_TWITTER) {
+       if($b['extid'] == NETWORK_TWITTER)
                return;
-       }
 
-       if ($b['app'] == "Twitter") {
+       if($b['app'] == "Twitter")
                return;
-       }
 
        logger('twitter post invoked');
 
-       PConfig::load($b['uid'], 'twitter');
 
-       $ckey    = Config::get('twitter', 'consumerkey');
-       $csecret = Config::get('twitter', 'consumersecret');
-       $otoken  = PConfig::get($b['uid'], 'twitter', 'oauthtoken');
-       $osecret = PConfig::get($b['uid'], 'twitter', 'oauthsecret');
+       load_pconfig($b['uid'], 'twitter');
 
-       if ($ckey && $csecret && $otoken && $osecret) {
+       $ckey    = get_config('twitter', 'consumerkey');
+       $csecret = get_config('twitter', 'consumersecret');
+       $otoken  = get_pconfig($b['uid'], 'twitter', 'oauthtoken');
+       $osecret = get_pconfig($b['uid'], 'twitter', 'oauthsecret');
+
+       if($ckey && $csecret && $otoken && $osecret) {
                logger('twitter: we have customer key and oauth stuff, going to send.', LOGGER_DEBUG);
 
                // If it's a repeated message from twitter then do a native retweet and exit
-               if (twitter_is_retweet($a, $b['uid'], $b['body'])) {
+               if (twitter_is_retweet($a, $b['uid'], $b['body']))
                        return;
-               }
 
                $connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret);
 
@@ -538,13 +523,11 @@ function twitter_post_hook(App $a, &$b)
 
                $image = "";
 
-               if (isset($msgarr["url"]) && ($msgarr["type"] != "photo")) {
-                       $msg .= "\n" . $msgarr["url"];
-               }
+               if (isset($msgarr["url"]) && ($msgarr["type"] != "photo"))
+                       $msg .= "\n".$msgarr["url"];
 
-               if (isset($msgarr["image"]) && ($msgarr["type"] != "video")) {
+               if (isset($msgarr["image"]) && ($msgarr["type"] != "video"))
                        $image = $msgarr["image"];
-               }
 
                // and now tweet it :-)
                if (strlen($msg) && ($image != "")) {
@@ -553,23 +536,21 @@ function twitter_post_hook(App $a, &$b)
 
                        $post = ['status' => $msg, 'media_ids' => $media->media_id_string];
 
-                       if ($iscomment) {
+                       if ($iscomment)
                                $post["in_reply_to_status_id"] = substr($orig_post["uri"], 9);
-                       }
 
                        $result = $connection->post('statuses/update', $post);
 
                        logger('twitter_post_with_media send, result: ' . print_r($result, true), LOGGER_DEBUG);
 
-                       if ($result->source) {
-                               Config::set("twitter", "application_name", strip_tags($result->source));
-                       }
+                       if ($result->source)
+                               set_config("twitter", "application_name", strip_tags($result->source));
 
                        if ($result->errors || $result->error) {
                                logger('Send to Twitter failed: "' . print_r($result->errors, true) . '"');
 
                                // Workaround: Remove the picture link so that the post can be reposted without it
-                               $msg .= " " . $image;
+                               $msg .= " ".$image;
                                $image = "";
                        } elseif ($iscomment) {
                                logger('twitter_post: Update extid ' . $result->id_str . " for post id " . $b['id']);
@@ -592,26 +573,23 @@ function twitter_post_hook(App $a, &$b)
                        }
 // -----------------
                        $url = 'statuses/update';
-                       $post = ['status' => $msg, 'weighted_character_count' => 'true'];
+                       $post = array('status' => $msg);
 
-                       if ($iscomment) {
+                       if ($iscomment)
                                $post["in_reply_to_status_id"] = substr($orig_post["uri"], 9);
-                       }
 
                        $result = $connection->post($url, $post);
                        logger('twitter_post send, result: ' . print_r($result, true), LOGGER_DEBUG);
 
-                       if ($result->source) {
-                               Config::set("twitter", "application_name", strip_tags($result->source));
-                       }
+                       if ($result->source)
+                               set_config("twitter", "application_name", strip_tags($result->source));
 
                        if ($result->errors) {
                                logger('Send to Twitter failed: "' . print_r($result->errors, true) . '"');
 
                                $r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self`", intval($b['uid']));
-                               if (count($r)) {
+                               if (count($r))
                                        $a->contact = $r[0]["id"];
-                               }
 
                                $s = serialize(['url' => $url, 'item' => $b['id'], 'post' => $post]);
 
@@ -633,6 +611,8 @@ function twitter_addon_admin_post(App $a)
        Config::set('twitter', 'consumersecret', $consumersecret);
        info(L10n::t('Settings updated.') . EOL);
 }
+function twitter_plugin_admin(&$a, &$o){
+       $t = get_markup_template( "admin.tpl", "addon/twitter/" );
 
 function twitter_addon_admin(App $a, &$o)
 {
@@ -646,18 +626,16 @@ function twitter_addon_admin(App $a, &$o)
        ]);
 }
 
-function twitter_cron(App $a, $b)
-{
-       $last = Config::get('twitter', 'last_poll');
+function twitter_cron($a,$b) {
+       $last = get_config('twitter','last_poll');
 
-       $poll_interval = intval(Config::get('twitter', 'poll_interval'));
-       if (!$poll_interval) {
+       $poll_interval = intval(get_config('twitter','poll_interval'));
+       if(! $poll_interval)
                $poll_interval = TWITTER_DEFAULT_POLL_INTERVAL;
-       }
 
-       if ($last) {
+       if($last) {
                $next = $last + ($poll_interval * 60);
-               if ($next > time()) {
+               if($next > time()) {
                        logger('twitter: poll intervall not reached');
                        return;
                }
@@ -665,10 +643,10 @@ function twitter_cron(App $a, $b)
        logger('twitter: cron_start');
 
        $r = q("SELECT * FROM `pconfig` WHERE `cat` = 'twitter' AND `k` = 'mirror_posts' AND `v` = '1'");
-       if (count($r)) {
-               foreach ($r as $rr) {
-                       logger('twitter: fetching for user ' . $rr['uid']);
-                       Worker::add(PRIORITY_MEDIUM, "addon/twitter/twitter_sync.php", 1, (int) $rr['uid']);
+       if(count($r)) {
+               foreach($r as $rr) {
+                       logger('twitter: fetching for user '.$rr['uid']);
+                       proc_run(PRIORITY_MEDIUM, "addon/twitter/twitter_sync.php", 1, (int)$rr['uid']);
                }
        }
 
@@ -680,59 +658,59 @@ function twitter_cron(App $a, $b)
        $abandon_limit = date(DateTimeFormat::MYSQL, time() - $abandon_days * 86400);
 
        $r = q("SELECT * FROM `pconfig` WHERE `cat` = 'twitter' AND `k` = 'import' AND `v` = '1'");
-       if (count($r)) {
-               foreach ($r as $rr) {
+       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');
+                                       logger('abandoned account: timeline from user '.$rr['uid'].' will not be imported');
                                        continue;
                                }
                        }
 
-                       logger('twitter: importing timeline from user ' . $rr['uid']);
-                       Worker::add(PRIORITY_MEDIUM, "addon/twitter/twitter_sync.php", 2, (int) $rr['uid']);
-                       /*
-                         // To-Do
-                         // check for new contacts once a day
-                         $last_contact_check = PConfig::get($rr['uid'],'pumpio','contact_check');
-                         if($last_contact_check)
-                         $next_contact_check = $last_contact_check + 86400;
-                         else
-                         $next_contact_check = 0;
-
-                         if($next_contact_check <= time()) {
-                         pumpio_getallusers($a, $rr["uid"]);
-                         PConfig::set($rr['uid'],'pumpio','contact_check',time());
-                         }
-                        */
+                       logger('twitter: importing timeline from user '.$rr['uid']);
+                       proc_run(PRIORITY_MEDIUM, "addon/twitter/twitter_sync.php", 2, (int)$rr['uid']);
+/*
+                       // To-Do
+                       // check for new contacts once a day
+                       $last_contact_check = get_pconfig($rr['uid'],'pumpio','contact_check');
+                       if($last_contact_check)
+                               $next_contact_check = $last_contact_check + 86400;
+                       else
+                               $next_contact_check = 0;
+
+                       if($next_contact_check <= time()) {
+                               pumpio_getallusers($a, $rr["uid"]);
+                               set_pconfig($rr['uid'],'pumpio','contact_check',time());
+                       }
+*/
+
                }
        }
 
        logger('twitter: cron_end');
 
-       Config::set('twitter', 'last_poll', time());
+       set_config('twitter','last_poll', time());
 }
 
-function twitter_expire(App $a, $b)
-{
-       $days = Config::get('twitter', 'expire');
+function twitter_expire($a,$b) {
+
+       $days = get_config('twitter', 'expire');
 
-       if ($days == 0) {
+       if ($days == 0)
                return;
-       }
 
        if (method_exists('dba', 'delete')) {
-               $r = dba::select('item', ['id'], ['deleted' => true, 'network' => NETWORK_TWITTER]);
+               $r = dba::select('item', array('id'), array('deleted' => true, 'network' => NETWORK_TWITTER));
                while ($row = dba::fetch($r)) {
-                       dba::delete('item', ['id' => $row['id']]);
+                       dba::delete('item', array('id' => $row['id']));
                }
                dba::close($r);
        } else {
                $r = q("DELETE FROM `item` WHERE `deleted` AND `network` = '%s'", dbesc(NETWORK_TWITTER));
        }
 
-       require_once "include/items.php";
+       require_once("include/items.php");
 
        logger('twitter_expire: expire_start');
 
@@ -747,70 +725,64 @@ function twitter_expire(App $a, $b)
        logger('twitter_expire: expire_end');
 }
 
-function twitter_prepare_body(App $a, &$b)
-{
-       if ($b["item"]["network"] != NETWORK_TWITTER) {
+function twitter_prepare_body(&$a,&$b) {
+       if ($b["item"]["network"] != NETWORK_TWITTER)
                return;
-       }
 
        if ($b["preview"]) {
                $max_char = 280;
                $item = $b["item"];
-               $item["plink"] = $a->get_baseurl() . "/display/" . $a->user["nickname"] . "/" . $item["parent"];
+               $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)) {
+               if(count($r)) {
                        $orig_post = $r[0];
 
                        $nicknameplain = preg_replace("=https?://twitter.com/(.*)=ism", "$1", $orig_post["author-link"]);
-                       $nickname = "@[url=" . $orig_post["author-link"] . "]" . $nicknameplain . "[/url]";
-                       $nicknameplain = "@" . $nicknameplain;
+                       $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"];
-                       }
+                       if ((strpos($item["body"], $nickname) === false) && (strpos($item["body"], $nicknameplain) === false))
+                               $item["body"] = $nickname." ".$item["body"];
                }
 
                $msgarr = BBCode::toPlaintext($item, $max_char, true, 8);
                $msg = $msgarr["text"];
 
-               if (isset($msgarr["url"]) && ($msgarr["type"] != "photo")) {
-                       $msg .= " " . $msgarr["url"];
-               }
+               if (isset($msgarr["url"]) && ($msgarr["type"] != "photo"))
+                       $msg .= " ".$msgarr["url"];
 
-               if (isset($msgarr["image"])) {
-                       $msg .= " " . $msgarr["image"];
-               }
+               if (isset($msgarr["image"]))
+                       $msg .= " ".$msgarr["image"];
 
-               $b['html'] = nl2br(htmlspecialchars($msg));
+                $b['html'] = nl2br(htmlspecialchars($msg));
        }
 }
 
 /**
  * @brief Build the item array for the mirrored post
  *
- * @param App $a Application class
+ * @param object $a Application class
  * @param integer $uid User id
  * @param object $post Twitter object with the post
  *
  * @return array item data to be posted
  */
-function twitter_do_mirrorpost(App $a, $uid, $post)
-{
+function twitter_do_mirrorpost($a, $uid, $post) {
        $datarray["type"] = "wall";
        $datarray["api_source"] = true;
        $datarray["profile_uid"] = $uid;
        $datarray["extid"] = NETWORK_TWITTER;
-       $datarray['message_id'] = item_new_uri($a->get_hostname(), $uid, NETWORK_TWITTER . ":" . $post->id);
+       $datarray['message_id'] = item_new_uri($a->get_hostname(), $uid, NETWORK_TWITTER.":".$post->id);
        $datarray['object'] = json_encode($post);
        $datarray["title"] = "";
 
        if (is_object($post->retweeted_status)) {
                // We don't support nested shares, so we mustn't show quotes as shares on retweets
-               $item = twitter_createpost($a, $uid, $post->retweeted_status, ['id' => 0], false, false, true);
+               $item = twitter_createpost($a, $uid, $post->retweeted_status, array('id' => 0), false, false, true);
 
                $datarray['body'] = "\n" . share_header(
                        $item['author-name'],
@@ -821,9 +793,9 @@ function twitter_do_mirrorpost(App $a, $uid, $post)
                        $item['plink']
                );
 
-               $datarray['body'] .= $item['body'] . '[/share]';
+               $datarray['body'] .= $item['body'].'[/share]';
        } else {
-               $item = twitter_createpost($a, $uid, $post, ['id' => 0], false, false, false);
+               $item = twitter_createpost($a, $uid, $post, array('id' => 0), false, false, false);
 
                $datarray['body'] = $item['body'];
        }
@@ -842,83 +814,77 @@ function twitter_do_mirrorpost(App $a, $uid, $post)
        return $datarray;
 }
 
-function twitter_fetchtimeline(App $a, $uid)
-{
-       $ckey    = Config::get('twitter', 'consumerkey');
-       $csecret = Config::get('twitter', 'consumersecret');
-       $otoken  = PConfig::get($uid, 'twitter', 'oauthtoken');
-       $osecret = PConfig::get($uid, 'twitter', 'oauthsecret');
-       $lastid  = PConfig::get($uid, 'twitter', 'lastid');
+function twitter_fetchtimeline($a, $uid) {
+       $ckey    = get_config('twitter', 'consumerkey');
+       $csecret = get_config('twitter', 'consumersecret');
+       $otoken  = get_pconfig($uid, 'twitter', 'oauthtoken');
+       $osecret = get_pconfig($uid, 'twitter', 'oauthsecret');
+       $lastid  = get_pconfig($uid, 'twitter', 'lastid');
 
-       $application_name = Config::get('twitter', 'application_name');
+       $application_name  = get_config('twitter', 'application_name');
 
-       if ($application_name == "") {
+       if ($application_name == "")
                $application_name = $a->get_hostname();
-       }
 
        $has_picture = false;
 
-       require_once 'mod/item.php';
-       require_once 'include/items.php';
-       require_once 'mod/share.php';
+       require_once('mod/item.php');
+       require_once('include/items.php');
+       require_once('mod/share.php');
 
        $connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret);
 
-       $parameters = ["exclude_replies" => true, "trim_user" => false, "contributor_details" => true, "include_rts" => true, "tweet_mode" => "extended"];
+       $parameters = array("exclude_replies" => true, "trim_user" => false, "contributor_details" => true, "include_rts" => true, "tweet_mode" => "extended");
 
        $first_time = ($lastid == "");
 
-       if ($lastid != "") {
+       if ($lastid <> "")
                $parameters["since_id"] = $lastid;
-       }
 
        $items = $connection->get('statuses/user_timeline', $parameters);
 
-       if (!is_array($items)) {
+       if (!is_array($items))
                return;
-       }
 
        $posts = array_reverse($items);
 
        if (count($posts)) {
-               foreach ($posts as $post) {
-                       if ($post->id_str > $lastid) {
-                               $lastid = $post->id_str;
-                               PConfig::set($uid, 'twitter', 'lastid', $lastid);
-                       }
+           foreach ($posts as $post) {
+               if ($post->id_str > $lastid) {
+                       $lastid = $post->id_str;
+                       set_pconfig($uid, 'twitter', 'lastid', $lastid);
+               }
 
-                       if ($first_time) {
-                               continue;
-                       }
+               if ($first_time)
+                       continue;
 
-                       if (!stristr($post->source, $application_name)) {
-                               $_SESSION["authenticated"] = true;
-                               $_SESSION["uid"] = $uid;
+               if (!stristr($post->source, $application_name)) {
 
-                               $_REQUEST = twitter_do_mirrorpost($a, $uid, $post);
+                       $_SESSION["authenticated"] = true;
+                       $_SESSION["uid"] = $uid;
 
-                               logger('twitter: posting for user ' . $uid);
+                       $_REQUEST = twitter_do_mirrorpost($a, $uid, $post);
 
-                               item_post($a);
-                       }
+                       logger('twitter: posting for user '.$uid);
+
+                       item_post($a);
                }
+           }
        }
-       PConfig::set($uid, 'twitter', 'lastid', $lastid);
+       set_pconfig($uid, 'twitter', 'lastid', $lastid);
 }
 
-function twitter_queue_hook(App $a, &$b)
-{
+function twitter_queue_hook(&$a,&$b) {
+
        $qi = q("SELECT * FROM `queue` WHERE `network` = '%s'",
                dbesc(NETWORK_TWITTER)
-       );
-       if (!count($qi)) {
+               );
+       if(! count($qi))
                return;
-       }
 
        foreach ($qi as $x) {
                if ($x['network'] !== NETWORK_TWITTER) {
                        continue;
-               }
 
                logger('twitter_queue: run');
 
@@ -926,20 +892,20 @@ function twitter_queue_hook(App $a, &$b)
                        WHERE `contact`.`self` = 1 AND `contact`.`id` = %d LIMIT 1",
                        intval($x['cid'])
                );
-               if (!count($r)) {
+               if(! count($r))
                        continue;
-               }
 
                $user = $r[0];
 
-               $ckey    = Config::get('twitter', 'consumerkey');
-               $csecret = Config::get('twitter', 'consumersecret');
-               $otoken  = PConfig::get($user['uid'], 'twitter', 'oauthtoken');
-               $osecret = PConfig::get($user['uid'], 'twitter', 'oauthsecret');
+               $ckey    = get_config('twitter', 'consumerkey');
+               $csecret = get_config('twitter', 'consumersecret');
+               $otoken  = get_pconfig($user['uid'], 'twitter', 'oauthtoken');
+               $osecret = get_pconfig($user['uid'], 'twitter', 'oauthsecret');
 
                $success = false;
 
                if ($ckey && $csecret && $otoken && $osecret) {
+
                        logger('twitter_queue: able to post');
 
                        $z = unserialize($x['content']);
@@ -949,15 +915,14 @@ function twitter_queue_hook(App $a, &$b)
 
                        logger('twitter_queue: post result: ' . print_r($result, true), LOGGER_DEBUG);
 
-                       if ($result->errors) {
+                       if ($result->errors)
                                logger('twitter_queue: Send to Twitter failed: "' . print_r($result->errors, true) . '"');
-                       else {
+                       else {
                                $success = true;
                                Queue::removeItem($x['id']);
                        }
-               } else {
-                       logger("twitter_queue: Error getting tokens for user " . $user['uid']);
-               }
+               } else
+                       logger("twitter_queue: Error getting tokens for user ".$user['uid']);
 
                if (!$success) {
                        logger('twitter_queue: delayed');
@@ -966,46 +931,44 @@ function twitter_queue_hook(App $a, &$b)
        }
 }
 
-function twitter_fix_avatar($avatar)
-{
+function twitter_fix_avatar($avatar) {
+       require_once("include/Photo.php");
+
        $new_avatar = str_replace("_normal.", ".", $avatar);
 
-       $info = Image::getInfoFromURL($new_avatar);
-       if (!$info) {
+       $info = get_photo_info($new_avatar);
+       if (!$info)
                $new_avatar = $avatar;
-       }
 
        return $new_avatar;
 }
 
-function twitter_fetch_contact($uid, $contact, $create_user)
-{
-       if ($contact->id_str == "") {
-               return -1;
-       }
+function twitter_fetch_contact($uid, $contact, $create_user) {
+
+       if ($contact->id_str == "")
+               return(-1);
 
        $avatar = twitter_fix_avatar($contact->profile_image_url_https);
 
-       GContact::update(["url" => "https://twitter.com/" . $contact->screen_name,
-               "network" => NETWORK_TWITTER, "photo" => $avatar, "hide" => true,
-               "name" => $contact->name, "nick" => $contact->screen_name,
-               "location" => $contact->location, "about" => $contact->description,
-               "addr" => $contact->screen_name . "@twitter.com", "generation" => 2]);
+       update_gcontact(array("url" => "https://twitter.com/".$contact->screen_name,
+                       "network" => NETWORK_TWITTER, "photo" => $avatar,  "hide" => true,
+                       "name" => $contact->name, "nick" => $contact->screen_name,
+                       "location" => $contact->location, "about" => $contact->description,
+                       "addr" => $contact->screen_name."@twitter.com", "generation" => 2));
 
        $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
                intval($uid),
                dbesc("twitter::" . $contact->id_str));
 
-       if (!count($r) && !$create_user) {
-               return 0;
-       }
+       if(!count($r) && !$create_user)
+               return(0);
 
        if (count($r) && ($r[0]["readonly"] || $r[0]["blocked"])) {
-               logger("twitter_fetch_contact: Contact '" . $r[0]["nick"] . "' is blocked or readonly.", LOGGER_DEBUG);
-               return -1;
+               logger("twitter_fetch_contact: Contact '".$r[0]["nick"]."' is blocked or readonly.", LOGGER_DEBUG);
+               return(-1);
        }
 
-       if (!count($r)) {
+       if(!count($r)) {
                // create contact record
                q("INSERT INTO `contact` (`uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
                                        `name`, `nick`, `photo`, `network`, `rel`, `priority`,
@@ -1016,9 +979,9 @@ function twitter_fetch_contact($uid, $contact, $create_user)
                        dbesc("https://twitter.com/" . $contact->screen_name),
                        dbesc(normalise_link("https://twitter.com/" . $contact->screen_name)),
                        dbesc($contact->screen_name."@twitter.com"),
-                       dbesc("twitter::" . $contact->id_str),
+                       dbesc("twitter::".$contact->id_str),
                        dbesc(''),
-                       dbesc("twitter::" . $contact->id_str),
+                       dbesc("twitter::".$contact->id_str),
                        dbesc($contact->name),
                        dbesc($contact->screen_name),
                        dbesc($avatar),
@@ -1033,17 +996,25 @@ function twitter_fetch_contact($uid, $contact, $create_user)
                $r = q("SELECT * FROM `contact` WHERE `alias` = '%s' AND `uid` = %d LIMIT 1",
                        dbesc("twitter::".$contact->id_str),
                        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 (!count($r)) {
-                       return false;
+               if($g && intval($g[0]['def_gid'])) {
+                       require_once('include/group.php');
+                       group_add_member($uid,'',$contact_id,$g[0]['def_gid']);
                }
 
-               $contact_id = $r[0]['id'];
+               require_once("Photo.php");
 
-               Group::addMember(User::getDefaultGroup($uid), $contact_id);
-
-               $photos = Photo::importProfilePhoto($avatar, $uid, $contact_id, true);
+               $photos = import_profile_photo($avatar, $uid, $contact_id, true);
 
                if ($photos) {
                        q("UPDATE `contact` SET `photo` = '%s',
@@ -1068,10 +1039,14 @@ function twitter_fetch_contact($uid, $contact, $create_user)
                $update_photo = ($r[0]['avatar-date'] < DateTimeFormat::utc('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("twitter_fetch_contact: Updating contact " . $contact->screen_name, LOGGER_DEBUG);
 
-                       $photos = Photo::importProfilePhoto($avatar, $uid, $r[0]['id'], true);
+               if((! $r[0]['photo']) || (! $r[0]['thumb']) || (! $r[0]['micro']) || ($update_photo)) {
+
+                       logger("twitter_fetch_contact: Updating contact ".$contact->screen_name, LOGGER_DEBUG);
+
+                       require_once("Photo.php");
+
+                       $photos = import_profile_photo($avatar, $uid, $r[0]['id'], true);
 
                        if ($photos) {
                                q("UPDATE `contact` SET `photo` = '%s',
@@ -1107,7 +1082,7 @@ function twitter_fetch_contact($uid, $contact, $create_user)
                }
        }
 
-       return $r[0]["id"];
+       return($r[0]["id"]);
 }
 
 function twitter_fetchuser(App $a, $uid, $screen_name = "", $user_id = "")
@@ -1120,29 +1095,25 @@ function twitter_fetchuser(App $a, $uid, $screen_name = "", $user_id = "")
        $r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
                intval($uid));
 
-       if (count($r)) {
+       if(count($r)) {
                $self = $r[0];
-       } else {
+       } else
                return;
-       }
 
-       $parameters = [];
+       $parameters = array();
 
-       if ($screen_name != "") {
+       if ($screen_name != "")
                $parameters["screen_name"] = $screen_name;
-       }
 
-       if ($user_id != "") {
+       if ($user_id != "")
                $parameters["user_id"] = $user_id;
-       }
 
        // Fetching user data
        $connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret);
        $user = $connection->get('users/show', $parameters);
 
-       if (!is_object($user)) {
+       if (!is_object($user))
                return;
-       }
 
        $contact_id = twitter_fetch_contact($uid, $user, true);
 
@@ -1179,16 +1150,14 @@ function twitter_expand_entities(App $a, $body, $item, $picture)
                        if ($url->url && $url->expanded_url && $url->display_url) {
                                $expanded_url = Network::finalUrl($url->expanded_url);
 
-                               $oembed_data = OEmbed::fetchURL($expanded_url);
+                               $oembed_data = oembed_fetch_url($expanded_url);
 
                                // Quickfix: Workaround for URL with "[" and "]" in it
-                               if (strpos($expanded_url, "[") || strpos($expanded_url, "]")) {
+                               if (strpos($expanded_url, "[") || strpos($expanded_url, "]"))
                                        $expanded_url = $url->url;
-                               }
 
-                               if ($type == "") {
+                               if ($type == "")
                                        $type = $oembed_data->type;
-                               }
 
                                if ($oembed_data->type == "video") {
                                        //$body = str_replace($url->url,
@@ -1196,12 +1165,14 @@ function twitter_expand_entities(App $a, $body, $item, $picture)
                                        //$dontincludemedia = true;
                                        $type = $oembed_data->type;
                                        $footerurl = $expanded_url;
-                                       $footerlink = "[url=" . $expanded_url . "]" . $expanded_url . "[/url]";
+                                       $footerlink = "[url=".$expanded_url."]".$expanded_url."[/url]";
 
                                        $body = str_replace($url->url, $footerlink, $body);
-                                       //} elseif (($oembed_data->type == "photo") AND isset($oembed_data->url) AND !$dontincludemedia) {
+                               //} elseif (($oembed_data->type == "photo") AND isset($oembed_data->url) AND !$dontincludemedia) {
                                } elseif (($oembed_data->type == "photo") && isset($oembed_data->url)) {
-                                       $body = str_replace($url->url, "[url=" . $expanded_url . "][img]" . $oembed_data->url . "[/img][/url]", $body);
+                                       $body = str_replace($url->url,
+                                                       "[url=".$expanded_url."][img]".$oembed_data->url."[/img][/url]",
+                                                       $body);
                                        //$dontincludemedia = true;
                                } elseif ($oembed_data->type != "link") {
                                        $body = str_replace($url->url, "[url=" . $expanded_url . "]" . $expanded_url . "[/url]", $body);
@@ -1215,12 +1186,12 @@ function twitter_expand_entities(App $a, $body, $item, $picture)
 
                                        if (substr($mime, 0, 6) == "image/") {
                                                $type = "photo";
-                                               $body = str_replace($url->url, "[img]" . $expanded_url . "[/img]", $body);
+                                               $body = str_replace($url->url, "[img]".$expanded_url."[/img]", $body);
                                                //$dontincludemedia = true;
                                        } else {
                                                $type = $oembed_data->type;
                                                $footerurl = $expanded_url;
-                                               $footerlink = "[url=" . $expanded_url . "]" . $expanded_url . "[/url]";
+                                               $footerlink = "[url=".$expanded_url."]".$expanded_url."[/url]";
 
                                                $body = str_replace($url->url, $footerlink, $body);
                                        }
@@ -1228,23 +1199,21 @@ function twitter_expand_entities(App $a, $body, $item, $picture)
                        }
                }
 
-               if ($footerurl != "") {
+               if ($footerurl != "")
                        $footer = add_page_info($footerurl, false, $picture);
-               }
 
                if (($footerlink != "") && (trim($footer) != "")) {
                        $removedlink = trim(str_replace($footerlink, "", $body));
 
-                       if (($removedlink == "") || strstr($body, $removedlink)) {
+                       if (($removedlink == "") || strstr($body, $removedlink))
                                $body = $removedlink;
-                       }
 
                        $body .= $footer;
                }
 
-               if (($footer == "") && ($picture != "")) {
-                       $body .= "\n\n[img]" . $picture . "[/img]\n";
-               } elseif (($footer == "") && ($picture == "")) {
+               if (($footer == "") && ($picture != ""))
+                       $body .= "\n\n[img]".$picture."[/img]\n";
+               elseif (($footer == "") && ($picture == ""))
                        $body = add_page_info_to_body($body);
                }
        }
@@ -1261,7 +1230,6 @@ function twitter_expand_entities(App $a, $body, $item, $picture)
                        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)) {
@@ -1301,8 +1269,8 @@ function twitter_expand_entities(App $a, $body, $item, $picture)
  *
  * @return $picture string Image URL or empty string
  */
-function twitter_media_entities($post, &$postarray)
-{
+function twitter_media_entities($post, &$postarray) {
+
        // There are no media entities? So we quit.
        if (!is_array($post->extended_entities->media)) {
                return "";
@@ -1312,7 +1280,7 @@ function twitter_media_entities($post, &$postarray)
        // We only do this when there is exactly one media.
        if ((count($post->entities->urls) > 0) && (count($post->extended_entities->media) == 1)) {
                $picture = "";
-               foreach ($post->extended_entities->media AS $medium) {
+               foreach($post->extended_entities->media AS $medium) {
                        if (isset($medium->media_url_https)) {
                                $picture = $medium->media_url_https;
                                $postarray['body'] = str_replace($medium->url, "", $postarray['body']);
@@ -1322,23 +1290,23 @@ function twitter_media_entities($post, &$postarray)
        }
 
        // This is a pure media post, first search for all media urls
-       $media = [];
-       foreach ($post->extended_entities->media AS $medium) {
-               switch ($medium->type) {
+       $media = array();
+       foreach($post->extended_entities->media AS $medium) {
+               switch($medium->type) {
                        case 'photo':
-                               $media[$medium->url] .= "\n[img]" . $medium->media_url_https . "[/img]";
+                               $media[$medium->url] .= "\n[img]".$medium->media_url_https."[/img]";
                                $postarray['object-type'] = ACTIVITY_OBJ_IMAGE;
                                break;
                        case 'video':
                        case 'animated_gif':
-                               $media[$medium->url] .= "\n[img]" . $medium->media_url_https . "[/img]";
+                               $media[$medium->url] .= "\n[img]".$medium->media_url_https."[/img]";
                                $postarray['object-type'] = ACTIVITY_OBJ_VIDEO;
                                if (is_array($medium->video_info->variants)) {
                                        $bitrate = 0;
                                        // We take the video with the highest bitrate
                                        foreach ($medium->video_info->variants AS $variant) {
                                                if (($variant->content_type == "video/mp4") && ($variant->bitrate >= $bitrate)) {
-                                                       $media[$medium->url] = "\n[video]" . $variant->url . "[/video]";
+                                                       $media[$medium->url] = "\n[video]".$variant->url."[/video]";
                                                        $bitrate = $variant->bitrate;
                                                }
                                        }
@@ -1352,19 +1320,19 @@ function twitter_media_entities($post, &$postarray)
 
        // Now we replace the media urls.
        foreach ($media AS $key => $value) {
-               $postarray['body'] = str_replace($key, "\n" . $value . "\n", $postarray['body']);
+               $postarray['body'] = str_replace($key, "\n".$value."\n", $postarray['body']);
        }
        return "";
 }
 
-function twitter_createpost(App $a, $uid, $post, $self, $create_user, $only_existing_contact, $noquote)
-{
-       $postarray = [];
+function twitter_createpost($a, $uid, $post, $self, $create_user, $only_existing_contact, $noquote) {
+
+       $postarray = array();
        $postarray['network'] = NETWORK_TWITTER;
        $postarray['gravity'] = 0;
        $postarray['uid'] = $uid;
        $postarray['wall'] = 0;
-       $postarray['uri'] = "twitter::" . $post->id_str;
+       $postarray['uri'] = "twitter::".$post->id_str;
        $postarray['object'] = json_encode($post);
 
        // Don't import our own comments
@@ -1374,14 +1342,15 @@ function twitter_createpost(App $a, $uid, $post, $self, $create_user, $only_exis
        );
 
        if (count($r)) {
-               logger("Item with extid " . $postarray['uri'] . " found.", LOGGER_DEBUG);
-               return [];
+               logger("Item with extid ".$postarray['uri']." found.", LOGGER_DEBUG);
+               return(array());
        }
 
        $contactid = 0;
 
        if ($post->in_reply_to_status_id_str != "") {
-               $parent = "twitter::" . $post->in_reply_to_status_id_str;
+
+               $parent = "twitter::".$post->in_reply_to_status_id_str;
 
                $r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
                        dbesc($parent),
@@ -1410,21 +1379,21 @@ function twitter_createpost(App $a, $uid, $post, $self, $create_user, $only_exis
                }
 
                // Is it me?
-               $own_id = PConfig::get($uid, 'twitter', 'own_id');
+               $own_id = get_pconfig($uid, 'twitter', 'own_id');
 
                if ($post->user->id_str == $own_id) {
                        $r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
                                intval($uid));
 
-                       if (count($r)) {
+                       if(count($r)) {
                                $contactid = $r[0]["id"];
 
-                               $postarray['owner-name']   = $r[0]["name"];
-                               $postarray['owner-link']   = $r[0]["url"];
-                               $postarray['owner-avatar'] = $r[0]["photo"];
+                               $postarray['owner-name']  $r[0]["name"];
+                               $postarray['owner-link'] = $r[0]["url"];
+                               $postarray['owner-avatar'] =  $r[0]["photo"];
                        } else {
-                               logger("No self contact for user " . $uid, LOGGER_DEBUG);
-                               return [];
+                               logger("No self contact for user ".$uid, LOGGER_DEBUG);
+                               return(array());
                        }
                }
                // Don't create accounts of people who just comment something
@@ -1438,15 +1407,15 @@ function twitter_createpost(App $a, $uid, $post, $self, $create_user, $only_exis
                $contactid = twitter_fetch_contact($uid, $post->user, $create_user);
 
                $postarray['owner-name'] = $post->user->name;
-               $postarray['owner-link'] = "https://twitter.com/" . $post->user->screen_name;
+               $postarray['owner-link'] = "https://twitter.com/".$post->user->screen_name;
                $postarray['owner-avatar'] = twitter_fix_avatar($post->user->profile_image_url_https);
        }
 
-       if (($contactid == 0) && !$only_existing_contact) {
+       if(($contactid == 0) && !$only_existing_contact) {
                $contactid = $self['id'];
        } elseif ($contactid <= 0) {
                logger("Contact ID is zero or less than zero.", LOGGER_DEBUG);
-               return [];
+               return(array());
        }
 
        $postarray['contact-id'] = $contactid;
@@ -1455,7 +1424,7 @@ function twitter_createpost(App $a, $uid, $post, $self, $create_user, $only_exis
        $postarray['author-name'] = $postarray['owner-name'];
        $postarray['author-link'] = $postarray['owner-link'];
        $postarray['author-avatar'] = $postarray['owner-avatar'];
-       $postarray['plink'] = "https://twitter.com/" . $post->user->screen_name . "/status/" . $post->id_str;
+       $postarray['plink'] = "https://twitter.com/".$post->user->screen_name."/status/".$post->id_str;
        $postarray['app'] = strip_tags($post->source);
 
        if ($post->user->protected) {
@@ -1492,10 +1461,10 @@ function twitter_createpost(App $a, $uid, $post, $self, $create_user, $only_exis
                $postarray["location"] = $post->place->full_name;
        }
        if (is_array($post->geo->coordinates)) {
-               $postarray["coord"] = $post->geo->coordinates[0] . " " . $post->geo->coordinates[1];
+               $postarray["coord"] = $post->geo->coordinates[0]." ".$post->geo->coordinates[1];
        }
        if (is_array($post->coordinates->coordinates)) {
-               $postarray["coord"] = $post->coordinates->coordinates[1] . " " . $post->coordinates->coordinates[0];
+               $postarray["coord"] = $post->coordinates->coordinates[1]." ".$post->coordinates->coordinates[0];
        }
        if (is_object($post->retweeted_status)) {
                $retweet = twitter_createpost($a, $uid, $post->retweeted_status, $self, false, false, $noquote);
@@ -1525,60 +1494,56 @@ function twitter_createpost(App $a, $uid, $post, $self, $create_user, $only_exis
                        $quoted['plink']
                );
 
-               $postarray['body'] .= $quoted['body'] . '[/share]';
+               $postarray['body'] .= $quoted['body'].'[/share]';
        }
 
-       return $postarray;
+       return($postarray);
 }
 
-function twitter_checknotification(App $a, $uid, $own_id, $top_item, $postarray)
-{
-       /// TODO: this whole function doesn't seem to work. Needs complete check
+function twitter_checknotification($a, $uid, $own_id, $top_item, $postarray) {
+
+       // this whole function doesn't seem to work. Needs complete check
+
        $user = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` LIMIT 1",
                intval($uid)
        );
 
-       if (!count($user)) {
+       if(!count($user))
                return;
-       }
 
        // Is it me?
-       if (link_compare($user[0]["url"], $postarray['author-link'])) {
+       if (link_compare($user[0]["url"], $postarray['author-link']))
                return;
-       }
 
        $own_user = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
                intval($uid),
                dbesc("twitter::".$own_id)
        );
 
-       if (!count($own_user)) {
+       if(!count($own_user))
                return;
-       }
 
        // Is it me from twitter?
-       if (link_compare($own_user[0]["url"], $postarray['author-link'])) {
+       if (link_compare($own_user[0]["url"], $postarray['author-link']))
                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)) {
-               foreach ($myconv as $conv) {
+               foreach($myconv as $conv) {
                        // now if we find a match, it means we're in this conversation
-                       if (!link_compare($conv['author-link'], $user[0]["url"]) && !link_compare($conv['author-link'], $own_user[0]["url"])) {
+
+                       if(!link_compare($conv['author-link'],$user[0]["url"]) && !link_compare($conv['author-link'],$own_user[0]["url"]))
                                continue;
-                       }
 
-                       require_once 'include/enotify.php';
+                       require_once('include/enotify.php');
 
                        $conv_parent = $conv['parent'];
 
-                       notification([
-                               'type' => NOTIFY_COMMENT,
+                       notification(array(
+                               'type'         => NOTIFY_COMMENT,
                                'notify_flags' => $user[0]['notify-flags'],
                                'language' => $user[0]['language'],
                                'to_name' => $user[0]['username'],
@@ -1589,10 +1554,10 @@ function twitter_checknotification(App $a, $uid, $own_id, $top_item, $postarray)
                                'source_name' => $postarray['author-name'],
                                'source_link' => $postarray['author-link'],
                                'source_photo' => $postarray['author-avatar'],
-                               'verb' => ACTIVITY_POST,
-                               'otype' => 'item',
-                               'parent' => $conv_parent,
-                       ]);
+                               'verb'         => ACTIVITY_POST,
+                               'otype'        => 'item',
+                               'parent'       => $conv_parent,
+                       ));
 
                        // only send one notification
                        break;
@@ -1600,19 +1565,18 @@ function twitter_checknotification(App $a, $uid, $own_id, $top_item, $postarray)
        }
 }
 
-function twitter_fetchparentposts(App $a, $uid, $post, $connection, $self, $own_id)
-{
-       logger("twitter_fetchparentposts: Fetching for user " . $uid . " and post " . $post->id_str, LOGGER_DEBUG);
+function twitter_fetchparentposts($a, $uid, $post, $connection, $self, $own_id) {
+       logger("twitter_fetchparentposts: Fetching for user ".$uid." and post ".$post->id_str, LOGGER_DEBUG);
 
-       $posts = [];
+       $posts = array();
 
        while ($post->in_reply_to_status_id_str != "") {
-               $parameters = ["trim_user" => false, "tweet_mode" => "extended", "id" => $post->in_reply_to_status_id_str];
+               $parameters = array("trim_user" => false, "tweet_mode" => "extended", "id" => $post->in_reply_to_status_id_str);
 
                $post = $connection->get('statuses/show', $parameters);
 
                if (!count($post)) {
-                       logger("twitter_fetchparentposts: Can't fetch post " . $parameters->id, LOGGER_DEBUG);
+                       logger("twitter_fetchparentposts: Can't fetch post ".$parameters->id, LOGGER_DEBUG);
                        break;
                }
 
@@ -1621,14 +1585,13 @@ function twitter_fetchparentposts(App $a, $uid, $post, $connection, $self, $own_
                        intval($uid)
                );
 
-               if (count($r)) {
+               if (count($r))
                        break;
-               }
 
                $posts[] = $post;
        }
 
-       logger("twitter_fetchparentposts: Fetching " . count($posts) . " parents", LOGGER_DEBUG);
+       logger("twitter_fetchparentposts: Fetching ".count($posts)." parents", LOGGER_DEBUG);
 
        $posts = array_reverse($posts);
 
@@ -1643,35 +1606,32 @@ function twitter_fetchparentposts(App $a, $uid, $post, $connection, $self, $own_
                        $item = Item::insert($postarray);
                        $postarray["id"] = $item;
 
-                       logger('twitter_fetchparentpost: User ' . $self["nick"] . ' posted parent timeline item ' . $item);
+                       logger('twitter_fetchparentpost: User '.$self["nick"].' posted parent timeline item '.$item);
 
-                       if ($item && !function_exists("check_item_notification")) {
+                       if ($item && !function_exists("check_item_notification"))
                                twitter_checknotification($a, $uid, $own_id, $item, $postarray);
-                       }
                }
        }
 }
 
-function twitter_fetchhometimeline(App $a, $uid)
-{
-       $ckey    = Config::get('twitter', 'consumerkey');
-       $csecret = Config::get('twitter', 'consumersecret');
-       $otoken  = PConfig::get($uid, 'twitter', 'oauthtoken');
-       $osecret = PConfig::get($uid, 'twitter', 'oauthsecret');
-       $create_user = PConfig::get($uid, 'twitter', 'create_user');
-       $mirror_posts = PConfig::get($uid, 'twitter', 'mirror_posts');
+function twitter_fetchhometimeline($a, $uid) {
+       $ckey    = get_config('twitter', 'consumerkey');
+       $csecret = get_config('twitter', 'consumersecret');
+       $otoken  = get_pconfig($uid, 'twitter', 'oauthtoken');
+       $osecret = get_pconfig($uid, 'twitter', 'oauthsecret');
+       $create_user = get_pconfig($uid, 'twitter', 'create_user');
+       $mirror_posts = get_pconfig($uid, 'twitter', 'mirror_posts');
 
-       logger("twitter_fetchhometimeline: Fetching for user " . $uid, LOGGER_DEBUG);
+       logger("twitter_fetchhometimeline: Fetching for user ".$uid, LOGGER_DEBUG);
 
-       $application_name = Config::get('twitter', 'application_name');
+       $application_name  = get_config('twitter', 'application_name');
 
-       if ($application_name == "") {
+       if ($application_name == "")
                $application_name = $a->get_hostname();
-       }
 
        require_once 'include/items.php';
 
-       $connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret);
+       $connection = new TwitterOAuth($ckey,$csecret,$otoken,$osecret);
 
        $own_contact = twitter_fetch_own_contact($a, $uid);
 
@@ -1679,62 +1639,62 @@ function twitter_fetchhometimeline(App $a, $uid)
                intval($own_contact),
                intval($uid));
 
-       if (count($r)) {
+       if(count($r)) {
                $own_id = $r[0]["nick"];
        } else {
-               logger("twitter_fetchhometimeline: Own twitter contact not found for user " . $uid, LOGGER_DEBUG);
+               logger("twitter_fetchhometimeline: Own twitter contact not found for user ".$uid, LOGGER_DEBUG);
                return;
        }
 
        $r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
                intval($uid));
 
-       if (count($r)) {
+       if(count($r)) {
                $self = $r[0];
        } else {
-               logger("twitter_fetchhometimeline: Own contact not found for user " . $uid, LOGGER_DEBUG);
+               logger("twitter_fetchhometimeline: Own contact not found for user ".$uid, LOGGER_DEBUG);
                return;
        }
 
        $u = q("SELECT * FROM user WHERE uid = %d LIMIT 1",
                intval($uid));
-       if (!count($u)) {
-               logger("twitter_fetchhometimeline: Own user not found for user " . $uid, LOGGER_DEBUG);
+       if(!count($u)) {
+               logger("twitter_fetchhometimeline: Own user not found for user ".$uid, LOGGER_DEBUG);
                return;
        }
 
-       $parameters = ["exclude_replies" => false, "trim_user" => false, "contributor_details" => true, "include_rts" => true, "tweet_mode" => "extended"];
+       $parameters = array("exclude_replies" => false, "trim_user" => false, "contributor_details" => true, "include_rts" => true, "tweet_mode" => "extended");
        //$parameters["count"] = 200;
+
+
        // Fetching timeline
-       $lastid = PConfig::get($uid, 'twitter', 'lasthometimelineid');
+       $lastid  = get_pconfig($uid, 'twitter', 'lasthometimelineid');
 
        $first_time = ($lastid == "");
 
-       if ($lastid != "") {
+       if ($lastid <> "")
                $parameters["since_id"] = $lastid;
-       }
 
        $items = $connection->get('statuses/home_timeline', $parameters);
 
        if (!is_array($items)) {
-               logger("twitter_fetchhometimeline: Error fetching home timeline: " . print_r($items, true), LOGGER_DEBUG);
+               logger("twitter_fetchhometimeline: Error fetching home timeline: ".print_r($items, true), LOGGER_DEBUG);
                return;
        }
 
        $posts = array_reverse($items);
 
-       logger("twitter_fetchhometimeline: Fetching timeline for user " . $uid . " " . sizeof($posts) . " items", LOGGER_DEBUG);
+       logger("twitter_fetchhometimeline: Fetching timeline for user ".$uid." ".sizeof($posts)." items", LOGGER_DEBUG);
 
        if (count($posts)) {
                foreach ($posts as $post) {
                        if ($post->id_str > $lastid) {
                                $lastid = $post->id_str;
-                               PConfig::set($uid, 'twitter', 'lasthometimelineid', $lastid);
+                               set_pconfig($uid, 'twitter', 'lasthometimelineid', $lastid);
                        }
 
-                       if ($first_time) {
+                       if ($first_time)
                                continue;
-                       }
 
                        if (stristr($post->source, $application_name) && $post->user->screen_name == $own_id) {
                                logger("twitter_fetchhometimeline: Skip previously sended post", LOGGER_DEBUG);
@@ -1746,80 +1706,71 @@ function twitter_fetchhometimeline(App $a, $uid)
                                continue;
                        }
 
-                       if ($post->in_reply_to_status_id_str != "") {
+                       if ($post->in_reply_to_status_id_str != "")
                                twitter_fetchparentposts($a, $uid, $post, $connection, $self, $own_id);
-                       }
 
                        $postarray = twitter_createpost($a, $uid, $post, $self, $create_user, true, false);
 
-                       if (trim($postarray['body']) == "") {
+                       if (trim($postarray['body']) == "")
                                continue;
-                       }
 
                        $item = Item::insert($postarray);
                        $postarray["id"] = $item;
 
-                       logger('twitter_fetchhometimeline: User ' . $self["nick"] . ' posted home timeline item ' . $item);
+                       logger('twitter_fetchhometimeline: User '.$self["nick"].' posted home timeline item '.$item);
 
-                       if ($item && !function_exists("check_item_notification")) {
+                       if ($item && !function_exists("check_item_notification"))
                                twitter_checknotification($a, $uid, $own_id, $item, $postarray);
-                       }
+
                }
        }
-       PConfig::set($uid, 'twitter', 'lasthometimelineid', $lastid);
+       set_pconfig($uid, 'twitter', 'lasthometimelineid', $lastid);
 
        // Fetching mentions
-       $lastid = PConfig::get($uid, 'twitter', 'lastmentionid');
+       $lastid  = get_pconfig($uid, 'twitter', 'lastmentionid');
 
        $first_time = ($lastid == "");
 
-       if ($lastid != "") {
+       if ($lastid <> "")
                $parameters["since_id"] = $lastid;
-       }
 
        $items = $connection->get('statuses/mentions_timeline', $parameters);
 
        if (!is_array($items)) {
-               logger("twitter_fetchhometimeline: Error fetching mentions: " . print_r($items, true), LOGGER_DEBUG);
+               logger("twitter_fetchhometimeline: Error fetching mentions: ".print_r($items, true), LOGGER_DEBUG);
                return;
        }
 
        $posts = array_reverse($items);
 
-       logger("twitter_fetchhometimeline: Fetching mentions for user " . $uid . " " . sizeof($posts) . " items", LOGGER_DEBUG);
+       logger("twitter_fetchhometimeline: Fetching mentions for user ".$uid." ".sizeof($posts)." items", LOGGER_DEBUG);
 
        if (count($posts)) {
                foreach ($posts as $post) {
-                       if ($post->id_str > $lastid) {
+                       if ($post->id_str > $lastid)
                                $lastid = $post->id_str;
-                       }
 
-                       if ($first_time) {
+                       if ($first_time)
                                continue;
-                       }
 
-                       if ($post->in_reply_to_status_id_str != "") {
+                       if ($post->in_reply_to_status_id_str != "")
                                twitter_fetchparentposts($a, $uid, $post, $connection, $self, $own_id);
-                       }
 
                        $postarray = twitter_createpost($a, $uid, $post, $self, false, false, false);
 
-                       if (trim($postarray['body']) == "") {
+                       if (trim($postarray['body']) == "")
                                continue;
-                       }
 
                        $item = Item::insert($postarray);
                        $postarray["id"] = $item;
 
-                       if ($item && function_exists("check_item_notification")) {
+                       if ($item && function_exists("check_item_notification"))
                                check_item_notification($item, $uid, NOTIFY_TAGSELF);
-                       }
 
-                       if (!isset($postarray["parent"]) || ($postarray["parent"] == 0)) {
+                       if (!isset($postarray["parent"]) || ($postarray["parent"] == 0))
                                $postarray["parent"] = $item;
-                       }
 
-                       logger('twitter_fetchhometimeline: User ' . $self["nick"] . ' posted mention timeline item ' . $item);
+                       logger('twitter_fetchhometimeline: User '.$self["nick"].' posted mention timeline item '.$item);
 
                        if ($item == 0) {
                                $r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
@@ -1835,8 +1786,8 @@ function twitter_fetchhometimeline(App $a, $uid)
                        }
 
                        if (($item != 0) && !function_exists("check_item_notification")) {
-                               require_once 'include/enotify.php';
-                               notification([
+                               require_once('include/enotify.php');
+                               notification(array(
                                        'type'         => NOTIFY_TAGSELF,
                                        'notify_flags' => $u[0]['notify-flags'],
                                        'language'     => $u[0]['language'],
@@ -1851,22 +1802,21 @@ function twitter_fetchhometimeline(App $a, $uid)
                                        'verb'         => ACTIVITY_TAG,
                                        'otype'        => 'item',
                                        'parent'       => $parent_id
-                               ]);
+                               ));
                        }
                }
        }
 
-       PConfig::set($uid, 'twitter', 'lastmentionid', $lastid);
+       set_pconfig($uid, 'twitter', 'lastmentionid', $lastid);
 }
 
-function twitter_fetch_own_contact(App $a, $uid)
-{
-       $ckey    = Config::get('twitter', 'consumerkey');
-       $csecret = Config::get('twitter', 'consumersecret');
-       $otoken  = PConfig::get($uid, 'twitter', 'oauthtoken');
-       $osecret = PConfig::get($uid, 'twitter', 'oauthsecret');
+function twitter_fetch_own_contact($a, $uid) {
+       $ckey    = get_config('twitter', 'consumerkey');
+       $csecret = get_config('twitter', 'consumersecret');
+       $otoken  = get_pconfig($uid, 'twitter', 'oauthtoken');
+       $osecret = get_pconfig($uid, 'twitter', 'oauthsecret');
 
-       $own_id = PConfig::get($uid, 'twitter', 'own_id');
+       $own_id = get_pconfig($uid, 'twitter', 'own_id');
 
        $contact_id = 0;
 
@@ -1876,71 +1826,65 @@ function twitter_fetch_own_contact(App $a, $uid)
                // Fetching user data
                $user = $connection->get('account/verify_credentials');
 
-               PConfig::set($uid, 'twitter', 'own_id', $user->id_str);
+               set_pconfig($uid, 'twitter', 'own_id', $user->id_str);
 
                $contact_id = twitter_fetch_contact($uid, $user, true);
+
        } else {
                $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
-                       intval($uid),
-                       dbesc("twitter::" . $own_id));
-               if (count($r)) {
+                       intval($uid), dbesc("twitter::".$own_id));
+               if(count($r))
                        $contact_id = $r[0]["id"];
-               } else {
-                       PConfig::delete($uid, 'twitter', 'own_id');
-               }
+               else
+                       del_pconfig($uid, 'twitter', 'own_id');
+
        }
 
-       return $contact_id;
+       return($contact_id);
 }
 
-function twitter_is_retweet(App $a, $uid, $body)
-{
+function twitter_is_retweet($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;
-       }
+       if (strpos($body, "[share") > 0)
+               return(false);
 
        // Does it end with a share?
-       if (strlen($body) > (strrpos($body, "[/share]") + 8)) {
-               return false;
-       }
+       if (strlen($body) > (strrpos($body, "[/share]") + 8))
+               return(false);
 
-       $attributes = preg_replace("/\[share(.*?)\]\s?(.*?)\s?\[\/share\]\s?/ism", "$1", $body);
+       $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;
-       }
+       if ($body == $attributes)
+               return(false);
 
        $link = "";
        preg_match("/link='(.*?)'/ism", $attributes, $matches);
-       if ($matches[1] != "") {
+       if ($matches[1] != "")
                $link = $matches[1];
-       }
 
        preg_match('/link="(.*?)"/ism', $attributes, $matches);
-       if ($matches[1] != "") {
+       if ($matches[1] != "")
                $link = $matches[1];
-       }
 
        $id = preg_replace("=https?://twitter.com/(.*)/status/(.*)=ism", "$2", $link);
-       if ($id == $link) {
-               return false;
-       }
+       if ($id == $link)
+               return(false);
 
-       logger('twitter_is_retweet: Retweeting id ' . $id . ' for user ' . $uid, LOGGER_DEBUG);
+       logger('twitter_is_retweet: Retweeting id '.$id.' for user '.$uid, LOGGER_DEBUG);
 
-       $ckey    = Config::get('twitter', 'consumerkey');
-       $csecret = Config::get('twitter', 'consumersecret');
-       $otoken  = PConfig::get($uid, 'twitter', 'oauthtoken');
-       $osecret = PConfig::get($uid, 'twitter', 'oauthsecret');
+       $ckey    = get_config('twitter', 'consumerkey');
+       $csecret = get_config('twitter', 'consumersecret');
+       $otoken  = get_pconfig($uid, 'twitter', 'oauthtoken');
+       $osecret = get_pconfig($uid, 'twitter', 'oauthsecret');
 
        $connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret);
        $result = $connection->post('statuses/retweet/' . $id);
 
-       logger('twitter_is_retweet: result ' . print_r($result, true), LOGGER_DEBUG);
+       logger('twitter_is_retweet: result '.print_r($result, true), LOGGER_DEBUG);
 
-       return !isset($result->errors);
+       return(!isset($result->errors));
 }
+?>
diff --git a/uhremotestorage/lang/C/messages.po b/uhremotestorage/lang/C/messages.po
new file mode 100644 (file)
index 0000000..c4b824b
--- /dev/null
@@ -0,0 +1,42 @@
+# ADDON uhremotestorage
+# Copyright (C) 
+# This file is distributed under the same license as the Friendica uhremotestorage 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"
+
+#: uhremotestorage.php:84
+#, php-format
+msgid ""
+"Allow to use your friendica id (%s) to connecto to external unhosted-enabled "
+"storage (like ownCloud). See <a href=\"http://www.w3.org/community/unhosted/"
+"wiki/RemoteStorage#WebFinger\">RemoteStorage WebFinger</a>"
+msgstr ""
+
+#: uhremotestorage.php:85
+msgid "Template URL (with {category})"
+msgstr ""
+
+#: uhremotestorage.php:86
+msgid "OAuth end-point"
+msgstr ""
+
+#: uhremotestorage.php:87
+msgid "Api"
+msgstr ""
+
+#: uhremotestorage.php:89
+msgid "Submit"
+msgstr ""
diff --git a/uhremotestorage/lang/ca/strings.php b/uhremotestorage/lang/ca/strings.php
new file mode 100644 (file)
index 0000000..2cfd653
--- /dev/null
@@ -0,0 +1,7 @@
+<?php\r
+\r
+$a->strings["Allow to use your friendica id (%s) to connecto to external unhosted-enabled storage (like ownCloud). See <a href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage WebFinger</a>"] = "Permetre l'ús del seu ID de friendica (%s) per Connectar a l'emmagatzematge extern (com ownCloud). Veure <a href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\"> WebFinger RemoteStorage </a>";\r
+$a->strings["Template URL (with {category})"] = "Plantilles de URL (amb {categoria})";\r
+$a->strings["OAuth end-point"] = "OAuth end-point";\r
+$a->strings["Api"] = "Api";\r
+$a->strings["Submit"] = "Enviar";\r
diff --git a/uhremotestorage/lang/cs/messages.po b/uhremotestorage/lang/cs/messages.po
new file mode 100644 (file)
index 0000000..599ff2b
--- /dev/null
@@ -0,0 +1,45 @@
+# ADDON uhremotestorage
+# Copyright (C)
+# This file is distributed under the same license as the Friendica uhremotestorage 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:45+0200\n"
+"PO-Revision-Date: 2014-07-07 19:28+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"
+
+#: uhremotestorage.php:84
+#, php-format
+msgid ""
+"Allow to use your friendica id (%s) to connecto to external unhosted-enabled"
+" storage (like ownCloud). See <a "
+"href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage"
+" WebFinger</a>"
+msgstr "Umožnit využití friendica id (%s) k napojení na externí úložiště (unhosted-enabled) (jako ownCloud). Více informací na <a href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage WebFinger</a>"
+
+#: uhremotestorage.php:85
+msgid "Template URL (with {category})"
+msgstr "Dočasná URL adresa (s {category})"
+
+#: uhremotestorage.php:86
+msgid "OAuth end-point"
+msgstr "OAuth end-point"
+
+#: uhremotestorage.php:87
+msgid "Api"
+msgstr "Api"
+
+#: uhremotestorage.php:89
+msgid "Save Settings"
+msgstr "Uložit Nastavení"
diff --git a/uhremotestorage/lang/cs/strings.php b/uhremotestorage/lang/cs/strings.php
new file mode 100644 (file)
index 0000000..0c31cc4
--- /dev/null
@@ -0,0 +1,12 @@
+<?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["Allow to use your friendica id (%s) to connecto to external unhosted-enabled storage (like ownCloud). See <a href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage WebFinger</a>"] = "Umožnit využití friendica id (%s) k napojení na externí úložiště (unhosted-enabled) (jako ownCloud). Více informací na <a href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage WebFinger</a>";
+$a->strings["Template URL (with {category})"] = "Dočasná URL adresa (s {category})";
+$a->strings["OAuth end-point"] = "OAuth end-point";
+$a->strings["Api"] = "Api";
+$a->strings["Save Settings"] = "Uložit Nastavení";
diff --git a/uhremotestorage/lang/de/messages.po b/uhremotestorage/lang/de/messages.po
new file mode 100644 (file)
index 0000000..7c520ac
--- /dev/null
@@ -0,0 +1,45 @@
+# ADDON uhremotestorage
+# Copyright (C)
+# This file is distributed under the same license as the Friendica uhremotestorage 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-23 14:45+0200\n"
+"PO-Revision-Date: 2014-10-14 05:48+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"
+
+#: uhremotestorage.php:84
+#, php-format
+msgid ""
+"Allow to use your friendica id (%s) to connecto to external unhosted-enabled"
+" storage (like ownCloud). See <a "
+"href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage"
+" WebFinger</a>"
+msgstr "Ermöglicht es deine friendica id (%s) mit externen unhosted-fähigen Speichern (z.B. ownCloud) zu verbinden. Siehe <a href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage WebFinger</a>"
+
+#: uhremotestorage.php:85
+msgid "Template URL (with {category})"
+msgstr "Vorlagen URL (mit {Kategorie})"
+
+#: uhremotestorage.php:86
+msgid "OAuth end-point"
+msgstr "OAuth end-point"
+
+#: uhremotestorage.php:87
+msgid "Api"
+msgstr "Api"
+
+#: uhremotestorage.php:89
+msgid "Save Settings"
+msgstr "Einstellungen speichern"
diff --git a/uhremotestorage/lang/de/strings.php b/uhremotestorage/lang/de/strings.php
new file mode 100644 (file)
index 0000000..a6b9bf0
--- /dev/null
@@ -0,0 +1,12 @@
+<?php
+
+if(! function_exists("string_plural_select_de")) {
+function string_plural_select_de($n){
+       return ($n != 1);;
+}}
+;
+$a->strings["Allow to use your friendica id (%s) to connecto to external unhosted-enabled storage (like ownCloud). See <a href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage WebFinger</a>"] = "Ermöglicht es deine friendica id (%s) mit externen unhosted-fähigen Speichern (z.B. ownCloud) zu verbinden. Siehe <a href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage WebFinger</a>";
+$a->strings["Template URL (with {category})"] = "Vorlagen URL (mit {Kategorie})";
+$a->strings["OAuth end-point"] = "OAuth end-point";
+$a->strings["Api"] = "Api";
+$a->strings["Save Settings"] = "Einstellungen speichern";
diff --git a/uhremotestorage/lang/eo/strings.php b/uhremotestorage/lang/eo/strings.php
new file mode 100644 (file)
index 0000000..94020c3
--- /dev/null
@@ -0,0 +1,7 @@
+<?php\r
+\r
+$a->strings["Allow to use your friendica id (%s) to connecto to external unhosted-enabled storage (like ownCloud). See <a href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage WebFinger</a>"] = "Permesi vian identecon ĉe Friendica (%s) por konekti al eksteraj konservejoj subtenata de unhosted (ekz. OwnCloud). Vidu <a href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage WebFinger</a>";\r
+$a->strings["Template URL (with {category})"] = "URL adreso de ŝablono (kun {category})";\r
+$a->strings["OAuth end-point"] = "OAuth finpunkto";\r
+$a->strings["Api"] = "Api";\r
+$a->strings["Submit"] = "Sendi";\r
diff --git a/uhremotestorage/lang/es/messages.po b/uhremotestorage/lang/es/messages.po
new file mode 100644 (file)
index 0000000..9b3de00
--- /dev/null
@@ -0,0 +1,45 @@
+# ADDON uhremotestorage
+# Copyright (C)
+# This file is distributed under the same license as the Friendica uhremotestorage addon package.
+# 
+# 
+# Translators:
+# Albert, 2016
+msgid ""
+msgstr ""
+"Project-Id-Version: friendica\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-06-23 14:45+0200\n"
+"PO-Revision-Date: 2016-11-19 11:35+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"
+
+#: uhremotestorage.php:84
+#, php-format
+msgid ""
+"Allow to use your friendica id (%s) to connecto to external unhosted-enabled"
+" storage (like ownCloud). See <a "
+"href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage"
+" WebFinger</a>"
+msgstr "Permite usar su ID de Friendica (%s) para conectar a un almacén habilitado externo sin hospedar (como ownCloud). Vea <a href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage WebFinger</a>"
+
+#: uhremotestorage.php:85
+msgid "Template URL (with {category})"
+msgstr "Plantilla de URL (con {categoría})"
+
+#: uhremotestorage.php:86
+msgid "OAuth end-point"
+msgstr "Punto final de OAuth"
+
+#: uhremotestorage.php:87
+msgid "Api"
+msgstr "API"
+
+#: uhremotestorage.php:89
+msgid "Save Settings"
+msgstr "Guardar Ajustes"
diff --git a/uhremotestorage/lang/es/strings.php b/uhremotestorage/lang/es/strings.php
new file mode 100644 (file)
index 0000000..910a056
--- /dev/null
@@ -0,0 +1,12 @@
+<?php
+
+if(! function_exists("string_plural_select_es")) {
+function string_plural_select_es($n){
+       return ($n != 1);;
+}}
+;
+$a->strings["Allow to use your friendica id (%s) to connecto to external unhosted-enabled storage (like ownCloud). See <a href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage WebFinger</a>"] = "Permite usar su ID de Friendica (%s) para conectar a un almacén habilitado externo sin hospedar (como ownCloud). Vea <a href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage WebFinger</a>";
+$a->strings["Template URL (with {category})"] = "Plantilla de URL (con {categoría})";
+$a->strings["OAuth end-point"] = "Punto final de OAuth";
+$a->strings["Api"] = "API";
+$a->strings["Save Settings"] = "Guardar Ajustes";
diff --git a/uhremotestorage/lang/fr/strings.php b/uhremotestorage/lang/fr/strings.php
new file mode 100644 (file)
index 0000000..7bb4631
--- /dev/null
@@ -0,0 +1,7 @@
+<?php\r
+\r
+$a->strings["Allow to use your friendica id (%s) to connecto to external unhosted-enabled storage (like ownCloud). See <a href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage WebFinger</a>"] = "Permet l'utilisation de votre ID Friendica (%s) pour vous connecter à des sites compatibles \"unhosted\" (comme ownCloud). Voyez <a href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage WebFinger</a>";\r
+$a->strings["Template URL (with {category})"] = "Modèle d'URL (avec {catégorie})";\r
+$a->strings["OAuth end-point"] = "URL OAuth";\r
+$a->strings["Api"] = "Type d'API";\r
+$a->strings["Submit"] = "Envoyer";\r
diff --git a/uhremotestorage/lang/is/strings.php b/uhremotestorage/lang/is/strings.php
new file mode 100644 (file)
index 0000000..83f8013
--- /dev/null
@@ -0,0 +1,7 @@
+<?php\r
+\r
+$a->strings["Allow to use your friendica id (%s) to connecto to external unhosted-enabled storage (like ownCloud). See <a href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage WebFinger</a>"] = "";\r
+$a->strings["Template URL (with {category})"] = "";\r
+$a->strings["OAuth end-point"] = "";\r
+$a->strings["Api"] = "Api";\r
+$a->strings["Submit"] = "Senda inn";\r
diff --git a/uhremotestorage/lang/it/messages.po b/uhremotestorage/lang/it/messages.po
new file mode 100644 (file)
index 0000000..67fbc57
--- /dev/null
@@ -0,0 +1,45 @@
+# ADDON uhremotestorage
+# Copyright (C)
+# This file is distributed under the same license as the Friendica uhremotestorage addon package.
+# 
+# 
+# Translators:
+# fabrixxm <fabrix.xm@gmail.com>, 2015
+msgid ""
+msgstr ""
+"Project-Id-Version: friendica\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-06-23 14:45+0200\n"
+"PO-Revision-Date: 2015-08-31 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"
+
+#: uhremotestorage.php:84
+#, php-format
+msgid ""
+"Allow to use your friendica id (%s) to connecto to external unhosted-enabled"
+" storage (like ownCloud). See <a "
+"href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage"
+" WebFinger</a>"
+msgstr "Permette di usare il tuo id friendica (%s) per collegarsi a storage esterni che supportano unhosted (come ownCloud). Vedi <a href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage WebFinger</a>"
+
+#: uhremotestorage.php:85
+msgid "Template URL (with {category})"
+msgstr "Template URL (con {category})"
+
+#: uhremotestorage.php:86
+msgid "OAuth end-point"
+msgstr "OAuth end-point"
+
+#: uhremotestorage.php:87
+msgid "Api"
+msgstr "Api"
+
+#: uhremotestorage.php:89
+msgid "Save Settings"
+msgstr "Salva Impostazioni"
diff --git a/uhremotestorage/lang/it/strings.php b/uhremotestorage/lang/it/strings.php
new file mode 100644 (file)
index 0000000..9a34489
--- /dev/null
@@ -0,0 +1,12 @@
+<?php
+
+if(! function_exists("string_plural_select_it")) {
+function string_plural_select_it($n){
+       return ($n != 1);;
+}}
+;
+$a->strings["Allow to use your friendica id (%s) to connecto to external unhosted-enabled storage (like ownCloud). See <a href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage WebFinger</a>"] = "Permette di usare il tuo id friendica (%s) per collegarsi a storage esterni che supportano unhosted (come ownCloud). Vedi <a href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage WebFinger</a>";
+$a->strings["Template URL (with {category})"] = "Template URL (con {category})";
+$a->strings["OAuth end-point"] = "OAuth end-point";
+$a->strings["Api"] = "Api";
+$a->strings["Save Settings"] = "Salva Impostazioni";
diff --git a/uhremotestorage/lang/nb-no/strings.php b/uhremotestorage/lang/nb-no/strings.php
new file mode 100644 (file)
index 0000000..7ffd910
--- /dev/null
@@ -0,0 +1,7 @@
+<?php\r
+\r
+$a->strings["Allow to use your friendica id (%s) to connecto to external unhosted-enabled storage (like ownCloud). See <a href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage WebFinger</a>"] = "Tillat å bruke din friendica id (%s) for å koble til ekstern unhosted-aktivert lagring (som ownCloud). Se <a href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage WebFinger</a>";\r
+$a->strings["Template URL (with {category})"] = "";\r
+$a->strings["OAuth end-point"] = "";\r
+$a->strings["Api"] = "";\r
+$a->strings["Submit"] = "Lagre";\r
diff --git a/uhremotestorage/lang/pl/strings.php b/uhremotestorage/lang/pl/strings.php
new file mode 100644 (file)
index 0000000..9f2ace1
--- /dev/null
@@ -0,0 +1,7 @@
+<?php\r
+\r
+$a->strings["Allow to use your friendica id (%s) to connecto to external unhosted-enabled storage (like ownCloud). See <a href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage WebFinger</a>"] = "";\r
+$a->strings["Template URL (with {category})"] = "";\r
+$a->strings["OAuth end-point"] = "";\r
+$a->strings["Api"] = "Api";\r
+$a->strings["Submit"] = "Potwierdź";\r
diff --git a/uhremotestorage/lang/pt-br/strings.php b/uhremotestorage/lang/pt-br/strings.php
new file mode 100644 (file)
index 0000000..082096d
--- /dev/null
@@ -0,0 +1,7 @@
+<?php\r
+\r
+$a->strings["Allow to use your friendica id (%s) to connecto to external unhosted-enabled storage (like ownCloud). See <a href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage WebFinger</a>"] = "Permite o uso do id friendica (%s) para conectar ao armazenamento tipo unhosted externo (ex: ownCloud). Veja <a href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage WebFinger</a>";\r
+$a->strings["Template URL (with {category})"] = "URL do Template (com {category})";\r
+$a->strings["OAuth end-point"] = "OAuth terminal";\r
+$a->strings["Api"] = "Api";\r
+$a->strings["Submit"] = "Enviar";\r
diff --git a/uhremotestorage/lang/ro/messages.po b/uhremotestorage/lang/ro/messages.po
new file mode 100644 (file)
index 0000000..7eeadf4
--- /dev/null
@@ -0,0 +1,44 @@
+# ADDON uhremotestorage
+# Copyright (C)
+# This file is distributed under the same license as the Friendica uhremotestorage addon package.
+# 
+# 
+# Translators:
+msgid ""
+msgstr ""
+"Project-Id-Version: friendica\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-06-23 14:45+0200\n"
+"PO-Revision-Date: 2014-07-08 12:11+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"
+
+#: uhremotestorage.php:84
+#, php-format
+msgid ""
+"Allow to use your friendica id (%s) to connecto to external unhosted-enabled"
+" storage (like ownCloud). See <a "
+"href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage"
+" WebFinger</a>"
+msgstr "Permiteți utilizarea id-ului dvs. friendica (%s) să se conecteze cu medii de stocare externe de tip unhosted (precum ownCloud). Consultați <a href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage WebFinger</a>"
+
+#: uhremotestorage.php:85
+msgid "Template URL (with {category})"
+msgstr "URL șablon (cu {categorie})"
+
+#: uhremotestorage.php:86
+msgid "OAuth end-point"
+msgstr "Punct-final OAuth "
+
+#: uhremotestorage.php:87
+msgid "Api"
+msgstr "Api"
+
+#: uhremotestorage.php:89
+msgid "Save Settings"
+msgstr "Salvare Configurări"
diff --git a/uhremotestorage/lang/ro/strings.php b/uhremotestorage/lang/ro/strings.php
new file mode 100644 (file)
index 0000000..7db8eda
--- /dev/null
@@ -0,0 +1,12 @@
+<?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["Allow to use your friendica id (%s) to connecto to external unhosted-enabled storage (like ownCloud). See <a href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage WebFinger</a>"] = "Permiteți utilizarea id-ului dvs. friendica (%s) să se conecteze cu medii de stocare externe de tip unhosted (precum ownCloud). Consultați <a href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage WebFinger</a>";
+$a->strings["Template URL (with {category})"] = "URL șablon (cu {categorie})";
+$a->strings["OAuth end-point"] = "Punct-final OAuth ";
+$a->strings["Api"] = "Api";
+$a->strings["Save Settings"] = "Salvare Configurări";
diff --git a/uhremotestorage/lang/ru/strings.php b/uhremotestorage/lang/ru/strings.php
new file mode 100644 (file)
index 0000000..ebce59a
--- /dev/null
@@ -0,0 +1,7 @@
+<?php\r
+\r
+$a->strings["Allow to use your friendica id (%s) to connecto to external unhosted-enabled storage (like ownCloud). See <a href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage WebFinger</a>"] = "";\r
+$a->strings["Template URL (with {category})"] = "";\r
+$a->strings["OAuth end-point"] = "";\r
+$a->strings["Api"] = "Api";\r
+$a->strings["Submit"] = "Подтвердить";\r
diff --git a/uhremotestorage/lang/sv/strings.php b/uhremotestorage/lang/sv/strings.php
new file mode 100644 (file)
index 0000000..3ec569a
--- /dev/null
@@ -0,0 +1,3 @@
+<?php\r
+\r
+$a->strings["Submit"] = "Spara";\r
diff --git a/uhremotestorage/lang/zh-cn/strings.php b/uhremotestorage/lang/zh-cn/strings.php
new file mode 100644 (file)
index 0000000..7f7c269
--- /dev/null
@@ -0,0 +1,7 @@
+<?php\r
+\r
+$a->strings["Allow to use your friendica id (%s) to connecto to external unhosted-enabled storage (like ownCloud). See <a href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage WebFinger</a>"] = "许用您的friendica用户名(%s)根对外没主办的贮藏(比如ownCloud)。看<a href=\"http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger\">RemoteStorage WebFinger</a>";\r
+$a->strings["Template URL (with {category})"] = "模板URL(根{category})";\r
+$a->strings["OAuth end-point"] = "OAuth 端点";\r
+$a->strings["Api"] = "API";\r
+$a->strings["Submit"] = "提交";\r
diff --git a/uhremotestorage/templates/settings.tpl b/uhremotestorage/templates/settings.tpl
new file mode 100644 (file)
index 0000000..9a0a55f
--- /dev/null
@@ -0,0 +1,9 @@
+<div class="settings-block">
+       <h3>{{$title}}</h3>
+       <p>{{$desc}}</p>
+       {{include file="field_input.tpl" field=$url}}
+       {{include file="field_input.tpl" field=$auth}}
+       {{include file="field_select.tpl" field=$api}}
+       <div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>  
+
+</div>
diff --git a/uhremotestorage/uhremotestorage.php b/uhremotestorage/uhremotestorage.php
new file mode 100644 (file)
index 0000000..76320f5
--- /dev/null
@@ -0,0 +1,93 @@
+<?php
+/**
+ * Name: unhosted remote storage
+ * Description: Expose in user XRD the link to external user's unhosted-enabled storage
+ * Version: 1.0
+ * Author: Fabio Comuni <http://kirgroup.com/profile/fabrixxm>
+ * Status: Unsupported
+ */
+ function uhremotestorage_install() {
+       register_hook('personal_xrd', 'addon/uhremotestorage/uhremotestorage.php', 'uhremotestorage_personal_xrd');
+       register_hook('plugin_settings', 'addon/uhremotestorage/uhremotestorage.php', 'uhremotestorage_settings');
+       register_hook('plugin_settings_post', 'addon/uhremotestorage/uhremotestorage.php', 'uhremotestorage_settings_post');
+
+       logger("installed uhremotestorage");
+}
+
+
+function uhremotestorage_uninstall() {
+
+       unregister_hook('personal_xrd', 'addon/uhremotestorage/uhremotestorage.php', 'uhremotestorage_personal_xrd');
+       unregister_hook('plugin_settings', 'addon/uhremotestorage/uhremotestorage.php', 'uhremotestorage_settings');
+       unregister_hook('plugin_settings_post', 'addon/uhremotestorage/uhremotestorage.php', 'uhremotestorage_settings_post');
+
+       logger("removed uhremotestorage");
+}
+
+function uhremotestorage_personal_xrd($a, &$b){
+       list($user, $host) = explode("@",$_GET['uri']);
+       $user = str_replace("acct:","",$user);
+       $r = q("SELECT uid FROM user WHERE nickname='%s'", dbesc($user));
+       $uid = $r[0]['uid'];
+       
+       $url = get_pconfig($uid,'uhremotestorage','unhoestedurl');
+       $auth = get_pconfig($uid,'uhremotestorage','unhoestedauth');
+       $api = get_pconfig($uid,'uhremotestorage','unhoestedapi');
+       
+       if ($url){
+               $b['xml'] = str_replace(
+                       '</XRD>', 
+                       "\t".'<Link rel="remoteStorage" template="'.$url.'" api="'.$api.'" auth="'.$auth.'" ></Link>'."\n</XRD>",
+                       $b['xml']
+               );
+       }
+}
+
+function uhremotestorage_settings_post($a, $post){
+       if(! local_user())
+               return;
+       set_pconfig(local_user(),'uhremotestorage','unhoestedurl',$_POST['unhoestedurl']);
+       set_pconfig(local_user(),'uhremotestorage','unhoestedauth',$_POST['unhoestedauth']);
+       set_pconfig(local_user(),'uhremotestorage','unhoestedapi',$_POST['unhoestedapi']);
+}
+
+function uhremotestorage_settings($a, &$s){
+       if(! local_user())
+               return;
+       
+       $uid = $a->user['nickname'] ."@". $a->get_hostname();
+       
+       $url = get_pconfig(local_user(),'uhremotestorage','unhoestedurl');
+       $auth = get_pconfig(local_user(),'uhremotestorage','unhoestedauth');
+       $api = get_pconfig(local_user(),'uhremotestorage','unhoestedapi');
+       
+       
+       $arr_api = array(
+               'WebDAV' => "WebDAV",
+               'simple' => "simple WebDAV",
+               'CouchDB' => "CouchDB",
+       );
+       /* experimental apis */
+       /*
+       $api = array_merge($api, array(
+               'git' => "git",
+               'tahoe-lafs' => 'tahoe-lafs',
+               'camlistore' => 'camlistore',
+               'AmazonS3' => 'AmazonS3',
+               'GoogleDocs' => 'GoogleDocs',
+               'Dropbox' => 'Dropbox',
+       );
+       */
+       $tpl = get_markup_template("settings.tpl", "addon/uhremotestorage/");
+       $s .= replace_macros($tpl, array(
+               '$title' => 'Unhosted remote storage',
+               '$desc' => sprintf( t('Allow to use your friendica id (%s) to connecto to external unhosted-enabled storage (like ownCloud). See <a href="http://www.w3.org/community/unhosted/wiki/RemoteStorage#WebFinger">RemoteStorage WebFinger</a>'), $uid ),
+               '$url'  => array( 'unhoestedurl', t('Template URL (with {category})'), $url, 'If your are using ownCloud, your unhosted url will be like <tt>http://<i>HOST</i>/apps/remoteStorage/WebDAV.php/<i>USER</i>/remoteStorage/{category}</tt>'),
+               '$auth' => array( 'unhoestedauth', t('OAuth end-point'), $auth, 'If your are using ownCloud, your OAuth endpoint will be like <tt>http://<i>HOST</i>/apps/remoteStorage/auth.php/<i>USER</i></tt>'),
+               '$api'  => array( 'unhoestedapi', t('Api'), $api, 'If your are using ownCloud, your api will be <tt>WebDAV</tt>', $arr_api),
+               
+               '$submit' => t('Save Settings'),
+       ));
+       
+}
index c7ed10c717023bea22c63556292952cc5b884ce3..d3d9876b44742d8eafbda47b3992d777643d968b 100644 (file)
@@ -4,7 +4,7 @@
  * Description: Add "View Source" link to item context
  * Version: 1.0
  * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
- *
+ * 
  */
 use Friendica\Core\Addon;
 use Friendica\Core\L10n;
index 47cd734ccd22ecc3a9322210a8228890e6e8ef13..cdf7fd2a4df055063cfe682c2b9b529bf7c209fa 100644 (file)
@@ -44,7 +44,7 @@ function webrtc_content(&$a) {
         $o = '';
 
         /* landingpage to create chatrooms */
-        $webrtcurl = Config::get('webrtc','webrtcurl');
+        $webrtcurl = get_config('webrtc','webrtcurl');
 
         /* embedd the landing page in an iframe */
         $o .= '<h2>'.L10n::t('Video Chat').'</h2>';
index f8033667563656f08a92cde29d1980ded0bd7410..cd3083c489c914d5c3aa4db59713e973d04fc791 100644 (file)
@@ -43,7 +43,7 @@ function friendheader_widget_content(&$a, $conf)
                .allcontact-link { float: right; margin: 0px; }
                .contact-block-content { clear:both; }
                .contact-block-div { display: block !important; float: left!important; width: 50px!important; height: 50px!important; margin: 2px!important;}
-
+               
        </style>";
        $o .= _abs_url(contact_block());
        $o .= "<a href='".$a->get_baseurl().'/profile/'.$a->profile['nickname']."' target=new>". L10n::t('Get added to this list!') ."</a>";
index b5a078861e949f0229f63bd26f83f98b40e8ccc6..0d218b13604e48fc8fe69141594c5fc67c52fb96 100644 (file)
@@ -45,7 +45,7 @@ function friends_widget_content(&$a, $conf)
                .allcontact-link { float: right; margin: 0px; }
                .contact-block-content { clear:both; }
                .contact-block-div { display: block !important; float: left!important; width: 50px!important; height: 50px!important; margin: 2px!important;}
-
+               
        </style>";
        $o .= _abs_url(contact_block());
        $o .= "<a href='".$a->get_baseurl().'/profile/'.$a->profile['nickname']."'>". L10n::t('Connect on Friendica!') ."</a>";
index 5f03c12eb6abf96954216642578af1daa3cda146..27b5fbe6681928bd15bbb4c6a0f44dd836d2c7d0 100644 (file)
@@ -10,30 +10,30 @@ function like_widget_help() {
 }
 
 function like_widget_args(){
-       return ["KEY"];
+       return Array("KEY");
 }
 
 function like_widget_size(){
-       return ['60px','20px'];
+       return Array('60px','20px');
 }
 
 
 function like_widget_content(&$a, $conf){
        $args = explode(",",$_GET['a']);
-
-
+       
+       
        $baseq="SELECT COUNT(`item`.`id`) as `c`, `p`.`id`
-                                       FROM `item`,
-                                               (SELECT `i`.`id` FROM `item` as `i` WHERE
+                                       FROM `item`, 
+                                               (SELECT `i`.`id` FROM `item` as `i` WHERE 
                                                        `i`.`visible` = 1 AND `i`.`deleted` = 0
-                                                       AND (( `i`.`wall` = 1 AND `i`.`allow_cid` = ''
-                                                                       AND `i`.`allow_gid` = ''
-                                                                       AND `i`.`deny_cid`  = ''
-                                                                       AND `i`.`deny_gid`  = '' )
+                                                       AND (( `i`.`wall` = 1 AND `i`.`allow_cid` = ''  
+                                                                       AND `i`.`allow_gid` = '' 
+                                                                       AND `i`.`deny_cid`  = '' 
+                                                                       AND `i`.`deny_gid`  = '' ) 
                                                                  OR `i`.`uid` = %d )
                                                        AND `i`.`body` LIKE '%%%s%%' LIMIT 1) as `p`
                                        WHERE `item`.`parent` = `p`.`id` ";
-
+       
        // count likes
        $r = q( $baseq . "AND `item`.`verb` = 'http://activitystrea.ms/schema/1.0/like'",
                        intval($conf['uid']),
@@ -41,22 +41,22 @@ function like_widget_content(&$a, $conf){
        );
        $likes = $r[0]['c'];
        $iid = $r[0]['id'];
-
+       
        // count dislikes
        $r = q( $baseq . "AND `item`.`verb` = 'http://purl.org/macgirvin/dfrn/1.0/dislike'",
                        intval($conf['uid']),
                        dbesc($args[0])
        );
        $dislikes = $r[0]['c'];
-
-
+       
+       
        require_once("include/conversation.php");
-
+       
        $o = "";
-
+       
 #      $t = file_get_contents( dirname(__file__). "/widget_like.tpl" );
        $t = get_markup_template("widget_like.tpl", "addon/widgets/");
-       $o .= replace_macros($t, [
+       $o .= replace_macros($t, array(
                '$like'         => $likes,
                '$strlike'      => L10n::tt("%d person likes this", "%d people like this", $likes),
 
@@ -64,7 +64,7 @@ function like_widget_content(&$a, $conf){
                '$strdislike'=> L10n::tt("%d person doesn't like this", "%d people don't like this", $dislikes),
 
                '$baseurl' => $a->get_baseurl(),
-       ]);
-
+       ));
+               
        return $o;
 }
index 1c7489f1ca6503f05c142721048db92e277cd900..76fc14b48b4270a49d4623c1b95c04d62509ffed 100644 (file)
@@ -24,20 +24,20 @@ function widgets_settings_post(){
        if(! local_user())
                return;
        if (isset($_POST['widgets-submit'])){
-               PConfig::delete(local_user(), 'widgets', 'key');
-
+               del_pconfig(local_user(), 'widgets', 'key');
+               
        }
 }
 
 function widgets_settings(&$a,&$o) {
     if(! local_user())
-               return;
-
+               return;         
+       
+       
+       $key = get_pconfig(local_user(), 'widgets', 'key' );
+       if ($key=='') { $key = mt_rand(); set_pconfig(local_user(), 'widgets', 'key', $key); }
 
-       $key = PConfig::get(local_user(), 'widgets', 'key' );
-       if ($key=='') { $key = mt_rand(); PConfig::set(local_user(), 'widgets', 'key', $key); }
-
-       $widgets = [];
+       $widgets = array();
        $d = dir(dirname(__file__));
        while(false !== ($f = $d->read())) {
                 if(substr($f,0,7)=="widget_") {
@@ -45,14 +45,14 @@ function widgets_settings(&$a,&$o) {
                         $w=$m[1];
                         if ($w!=""){
                                require_once($f);
-                               $widgets[] = [$w, call_user_func($w."_widget_name")];
+                               $widgets[] = array($w, call_user_func($w."_widget_name"));
                        }
 
                 }
        }
 
-
-
+       
+       
 #      $t = file_get_contents( dirname(__file__). "/settings.tpl" );
        $t = get_markup_template("settings.tpl", "addon/widgets/");
        $o .= replace_macros($t, [
@@ -63,8 +63,8 @@ function widgets_settings(&$a,&$o) {
                '$key' => $key,
                '$widgets_h' => L10n::t('Widgets available'),
                '$widgets' => $widgets,
-       ]);
-
+       ));
+       
 }
 
 function widgets_module() {
@@ -78,7 +78,7 @@ function _abs_url($s){
 
 function _randomAlphaNum($length){
        return substr(str_shuffle(str_repeat('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',$length)),0,$length);
-}
+} 
 
 
 function widgets_content(&$a) {
@@ -94,12 +94,12 @@ function widgets_content(&$a) {
        if (!count($r)){
                if($a->argv[2]=="cb"){header('HTTP/1.0 400 Bad Request'); killme();}
                return;
-       }
-       $conf = [];
+       }    
+       $conf = array();
        $conf['uid'] = $r[0]['uid'];
        foreach($r as $e) { $conf[$e['k']]=$e['v']; }
-
-       $o = "";
+       
+       $o = "";        
 
        $widgetfile =dirname(__file__)."/widget_".$a->argv[1].".php";
        if (file_exists($widgetfile)){
@@ -107,8 +107,8 @@ function widgets_content(&$a) {
        } else {
                if($a->argv[2]=="cb"){header('HTTP/1.0 400 Bad Request'); killme();}
                return;
-       }
-
+       }               
+       
 
 
 
@@ -116,10 +116,10 @@ function widgets_content(&$a) {
        if ($a->argv[2]=="cb"){
                /*header('Access-Control-Allow-Origin: *');*/
                $o .= call_user_func($a->argv[1].'_widget_content',$a, $conf);
-
+               
        } else {
 
-
+               
                if (isset($_GET['p']) && local_user()==$conf['uid'] ) {
                        $o .= "<style>.f9k_widget { float: left;border:1px solid black; }</style>";
                        $o .= "<h1>Preview Widget</h1>";
@@ -132,13 +132,13 @@ function widgets_content(&$a) {
                } else {
                        header("content-type: application/x-javascript");
                }
-
-
-
+       
+       
+               
                $widget_size = call_user_func($a->argv[1].'_widget_size');
-
+       
                $script = file_get_contents(dirname(__file__)."/widgets.js");
-               $o .= replace_macros($script, [
+               $o .= replace_macros($script, array(
                        '$entrypoint' => $a->get_baseurl()."/widgets/".$a->argv[1]."/cb/",
                        '$key' => $conf['key'],
                        '$widget_id' => 'f9a_'.$a->argv[1]."_"._randomAlphaNum(6),
@@ -147,25 +147,25 @@ function widgets_content(&$a) {
                        '$width' => $widget_size[0],
                        '$height' => $widget_size[1],
                        '$type' => $a->argv[1],
-               ]);
-
+               ));
 
+       
                if (isset($_GET['p'])) {
                        $wargs = call_user_func($a->argv[1].'_widget_args');
                        $jsargs = implode("</em>,<em>", $wargs);
                        if ($jsargs!='') $jsargs = "&a=<em>".$jsargs."</em>";
-
+                               
                        $o .= "</script>
                        <br style='clear:left'/><br/>
                        <h4>Copy and paste this code</h4>
                        <code>"
-
+                       
                        .htmlspecialchars('<script src="'.$a->get_baseurl().'/widgets/'.$a->argv[1].'?k='.$conf['key'])
                        .$jsargs
                        .htmlspecialchars('"></script>')
                        ."</code>";
 
-
+                       
                        return $o;
                }
        }
index 206b0883e4b03241db96b7909d50ea28372a853e..9837e1fe573fbac0f6787d523e611639cfa29ba2 100644 (file)
@@ -1,26 +1,25 @@
 <?php
-
 /**
  * Name: WindowsPhonePush
  * Description: Enable push notification to send information to Friendica Mobile app on Windows phone (count of unread timeline entries, text of last posting - if wished by user)
  * Version: 2.0
  * Author: Gerhard Seeber <http://friendica.seeber.at/profile/admin>
- *
- *
+ * 
+ * 
  * Pre-requisite: Windows Phone mobile device (at least WP 7.0)
  *                Friendica mobile app on Windows Phone
  *
  * When addon is installed, the system calls the addon
  * name_install() function, located in 'addon/name/name.php',
  * where 'name' is the name of the addon.
- * If the addon is removed from the configuration list, the
+ * If the addon is removed from the configuration list, the 
  * system will call the name_uninstall() function.
  *
  * Version history:
- * 1.1  : addon crashed on php versions >= 5.4 as of removed deprecated call-time
+ * 1.1  : addon crashed on php versions >= 5.4 as of removed deprecated call-time 
  *        pass-by-reference used in function calls within function windowsphonepush_content
  * 2.0  : adaption for supporting emphasizing new entries in app (count on tile cannot be read out,
- *        so we need to retrieve counter through show_settings secondly). Provide new function for
+ *        so we need to retrieve counter through show_settings secondly). Provide new function for 
  *        calling from app to set the counter back after start (if user starts again before cronjob
  *        sets the counter back
  *        count only unseen elements which are not type=activity (likes and dislikes not seen as new elements)
@@ -38,6 +37,7 @@ function windowsphonepush_install()
        /* Our addon will attach in three places.
         * The first is within cron - so the push notifications will be
         * sent every 10 minutes (or whatever is set in crontab).
+        *
         */
        Addon::registerHook('cron', 'addon/windowsphonepush/windowsphonepush.php', 'windowsphonepush_cron');
 
@@ -45,6 +45,7 @@ function windowsphonepush_install()
         * settings post hook so that we can create and update
         * user preferences. User shall be able to activate the addon and
         * define whether he allows pushing first characters of item text
+        *
         */
        Addon::registerHook('addon_settings', 'addon/windowsphonepush/windowsphonepush.php', 'windowsphonepush_settings');
        Addon::registerHook('addon_settings_post', 'addon/windowsphonepush/windowsphonepush.php', 'windowsphonepush_settings_post');
@@ -52,10 +53,14 @@ function windowsphonepush_install()
        logger("installed windowsphonepush");
 }
 
-function windowsphonepush_uninstall()
-{
-       /* uninstall unregisters any hooks created with register_hook
+
+function windowsphonepush_uninstall() {
+
+       /**
+        *
+        * uninstall unregisters any hooks created with register_hook
         * during install. Don't delete data in table `pconfig`.
+        *
         */
        Addon::unregisterHook('cron', 'addon/windowsphonepush/windowsphonepush.php', 'windowsphonepush_cron');
        Addon::unregisterHook('addon_settings', 'addon/windowsphonepush/windowsphonepush.php', 'windowsphonepush_settings');
@@ -64,54 +69,54 @@ function windowsphonepush_uninstall()
        logger("removed windowsphonepush");
 }
 
+
 /* declare the windowsphonepush function so that /windowsphonepush url requests will land here */
-function windowsphonepush_module()
-{
+function windowsphonepush_module() {}
 
-}
 
-/* Callback from the settings post function.
+/**
+ *
+ * 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 windowsphonepush_settings_post($a, $post)
-{
-       if (!local_user() || (!x($_POST, 'windowsphonepush-submit'))) {
+function windowsphonepush_settings_post($a,$post) {
+       if(! local_user() || (! x($_POST,'windowsphonepush-submit')))
                return;
-       }
        $enable = intval($_POST['windowsphonepush']);
-       PConfig::set(local_user(), 'windowsphonepush', 'enable', $enable);
+       set_pconfig(local_user(),'windowsphonepush','enable',$enable);
 
-       if ($enable) {
-               PConfig::set(local_user(), 'windowsphonepush', 'counterunseen', 0);
+       if($enable) {
+               set_pconfig(local_user(),'windowsphonepush','counterunseen', 0);
        }
 
-       PConfig::set(local_user(), 'windowsphonepush', 'senditemtext', intval($_POST['windowsphonepush-senditemtext']));
+       set_pconfig(local_user(),'windowsphonepush','senditemtext',intval($_POST['windowsphonepush-senditemtext']));
 
        info(L10n::t('WindowsPhonePush settings updated.') . EOL);
 }
 
 /* Called from the Addon Setting form.
  * Add our own settings info to the page.
+ *
  */
-function windowsphonepush_settings(&$a, &$s)
-{
-       if (!local_user()) {
+function windowsphonepush_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/windowsphonepush/windowsphonepush.css' . '" media="all" />' . "\r\n";
 
        /* Get the current state of our config variables */
-       $enabled = PConfig::get(local_user(), 'windowsphonepush', 'enable');
+       $enabled = get_pconfig(local_user(),'windowsphonepush','enable');
        $checked_enabled = (($enabled) ? ' checked="checked" ' : '');
 
-       $senditemtext = PConfig::get(local_user(), 'windowsphonepush', 'senditemtext');
+       $senditemtext = get_pconfig(local_user(), 'windowsphonepush', 'senditemtext');
        $checked_senditemtext = (($senditemtext) ? ' checked="checked" ' : '');
 
-       $device_url = PConfig::get(local_user(), 'windowsphonepush', 'device_url');
+       $device_url = get_pconfig(local_user(), 'windowsphonepush', 'device_url');
 
        /* Add some HTML to the existing form */
        $s .= '<div class="settings-block">';
@@ -135,41 +140,45 @@ function windowsphonepush_settings(&$a, &$s)
        $s .= '<label id="windowsphonepush-device_url-label" for="windowsphonepush-device_url-text">Device-URL</label>';
        $s .= '<input id="windowsphonepush-device_url-text" type="text" readonly value=' . $device_url . '/>';
        $s .= '</div><div class="clear"></div></div>';
-
+       
        return;
+
 }
 
 /* Cron function used to regularly check all users on the server with active windowsphonepushaddon and send
  * notifications to the Microsoft servers and consequently to the Windows Phone device
+ *
  */
 function windowsphonepush_cron()
 {
        // retrieve all UID's for which the addon windowsphonepush is enabled and loop through every user
        $r = q("SELECT * FROM `pconfig` WHERE `cat` = 'windowsphonepush' AND `k` = 'enable' AND `v` = 1");
-       if (count($r)) {
-               foreach ($r as $rr) {
+       if(count($r)) {
+               foreach($r as $rr) {
                        // load stored information for the user-id of the current loop
-                       $device_url = PConfig::get($rr['uid'], 'windowsphonepush', 'device_url');
-                       $lastpushid = PConfig::get($rr['uid'], 'windowsphonepush', 'lastpushid');
+                       $device_url = get_pconfig($rr['uid'], 'windowsphonepush', 'device_url');
+                       $lastpushid = get_pconfig($rr['uid'], 'windowsphonepush', 'lastpushid');
 
-                       // pushing only possible if device_url (the URI on Microsoft server) is available or not "NA" (which will be sent
+                       // pushing only possible if device_url (the URI on Microsoft server) is available or not "NA" (which will be sent 
                        // by app if user has switched the server setting in app - sending blank not possible as this would return an update error)
                        if (( $device_url == "" ) || ( $device_url == "NA" )) {
                                // no Device-URL for the user availabe, but addon is enabled --> write info to Logger
                                logger("WARN: windowsphonepush is enable for user " . $rr['uid'] . ", but no Device-URL is specified for the user.");
                        } else {
-                               // retrieve the number of unseen items and the id of the latest one (if there are more than
+                               // retrieve the number of unseen items and the id of the latest one (if there are more than 
                                // one new entries since last poller run, only the latest one will be pushed)
-                               $count = q("SELECT count(`id`) as count, max(`id`) as max FROM `item` WHERE `unseen` = 1 AND `type` <> 'activity' AND `uid` = %d", intval($rr['uid']));
+                               $count = q("SELECT count(`id`) as count, max(`id`) as max FROM `item` WHERE `unseen` = 1 AND `type` <> 'activity' AND `uid` = %d",
+                                       intval($rr['uid'])
+                               );
 
-                               // send number of unseen items to the device (the number will be displayed on Start screen until
-                               // App will be started by user) - this update will be sent every 10 minutes to update the number to 0 if
+                               // send number of unseen items to the device (the number will be displayed on Start screen until 
+                               // App will be started by user) - this update will be sent every 10 minutes to update the number to 0 if 
                                // user has loaded the timeline through app or website
                                $res_tile = send_tile_update($device_url, "", $count[0]['count'], "");
                                switch (trim($res_tile)) {
                                        case "Received":
-                                               // ok, count has been pushed, let's save it in personal settings
-                                               PConfig::set($rr['uid'], 'windowsphonepush', 'counterunseen', $count[0]['count']);
+                                               // ok, count has been pushed, let's save it in personal settings 
+                                               set_pconfig($rr['uid'], 'windowsphonepush', 'counterunseen', $count[0]['count']);
                                                break;
                                        case "QueueFull":
                                                // maximum of 30 messages reached, server rejects any further push notification until device reconnects
@@ -192,23 +201,25 @@ function windowsphonepush_cron()
                                if (intval($count[0]['max']) > intval($lastpushid)) {
                                        // user can define if he wants to see the text of the item in the push notification
                                        // this has been implemented as the device_url is not a https uri (not so secure)
-                                       $senditemtext = PConfig::get($rr['uid'], 'windowsphonepush', 'senditemtext');
+                                       $senditemtext = get_pconfig($rr['uid'], 'windowsphonepush', 'senditemtext');
                                        if ($senditemtext == 1) {
                                                // load item with the max id
-                                               $item = q("SELECT `author-name` as author, `body` as body FROM `item` where `id` = %d", intval($count[0]['max']));
+                                               $item = q("SELECT `author-name` as author, `body` as body FROM `item` where `id` = %d",
+                                                       intval($count[0]['max'])
+                                               );
 
                                                // as user allows to send the item, we want to show the sender of the item in the toast
-                                               // toasts are limited to one line, therefore place is limited - author shall be in
+                                               // toasts are limited to one line, therefore place is limited - author shall be in 
                                                // max. 15 chars (incl. dots); author is displayed in bold font
                                                $author = $item[0]['author'];
                                                $author = ((strlen($author) > 12) ? substr($author, 0, 12) . "..." : $author);
 
                                                // normally we show the body of the item, however if it is an url or an image we cannot
-                                               // show this in the toast (only test), therefore changing to an alternate text
+                                               // show this in the toast (only test), therefore changing to an alternate text 
                                                // Otherwise BBcode-Tags will be eliminated and plain text cutted to 140 chars (incl. dots)
                                                // BTW: information only possible in English
                                                $body = $item[0]['body'];
-                                               if (substr($body, 0, 4) == "[url") {
+                                               if (substr($body, 0, 4) == "[url") 
                                                        $body = "URL/Image ...";
                                                } else {
                                                        require_once("include/html2plain.php");
@@ -218,82 +229,91 @@ function windowsphonepush_cron()
                                                        $body = ((strlen($body) > 137) ? substr($body, 0, 137) . "..." : $body);
                                                }
                                        } else {
-                                               // if user wishes higher privacy, we only display "Friendica - New timeline entry arrived"
+                                       // if user wishes higher privacy, we only display "Friendica - New timeline entry arrived"
                                                $author = "Friendica";
                                                $body = "New timeline entry arrived ...";
                                        }
-                                       // only if toast push notification returns the Notification status "Received" we will update th settings with the
+                                       // only if toast push notification returns the Notification status "Received" we will update th settings with the 
                                        // new indicator max-id is checked against (QueueFull, Suppressed, N/A, Dropped shall qualify to resend
-                                       // the push notification some minutes later (BTW: if resulting in Expired for subscription status the
+                                       // the push notification some minutes later (BTW: if resulting in Expired for subscription status the 
                                        // device_url will be deleted (no further try on this url, see send_push)
                                        // further log information done on count pushing with send_tile (see above)
                                        $res_toast = send_toast($device_url, $author, $body);
                                        if (trim($res_toast) === 'Received') {
-                                               PConfig::set($rr['uid'], 'windowsphonepush', 'lastpushid', $count[0]['max']);
-                                       }
+                                               set_pconfig($rr['uid'], 'windowsphonepush', 'lastpushid', $count[0]['max']);
+                                       }                               
                                }
                        }
                }
        }
 }
 
-/* Tile push notification change the number in the icon of the App in Start Screen of
+
+/* 
+ *
+ * Tile push notification change the number in the icon of the App in Start Screen of
  * a Windows Phone Device, Image could be changed, not used for App "Friendica Mobile"
+ * 
  */
-function send_tile_update($device_url, $image_url, $count, $title, $priority = 1)
-{
+function send_tile_update($device_url, $image_url, $count, $title, $priority = 1) {
        $msg = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" .
                "<wp:Notification xmlns:wp=\"WPNotification\">" .
-               "<wp:Tile>" .
-               "<wp:BackgroundImage>" . $image_url . "</wp:BackgroundImage>" .
-               "<wp:Count>" . $count . "</wp:Count>" .
-               "<wp:Title>" . $title . "</wp:Title>" .
-               "</wp:Tile> " .
+                       "<wp:Tile>".
+                               "<wp:BackgroundImage>" . $image_url . "</wp:BackgroundImage>" .
+                               "<wp:Count>" . $count . "</wp:Count>" .
+                               "<wp:Title>" . $title . "</wp:Title>" .
+                       "</wp:Tile> " .
                "</wp:Notification>";
 
-       $result = send_push($device_url, [
+       $result = send_push($device_url, array(
                'X-WindowsPhone-Target: token',
                'X-NotificationClass: ' . $priority,
-               ], $msg);
+               ), $msg);
        return $result;
 }
 
-/* Toast push notification send information to the top of the display
+/*
+ * 
+ * Toast push notification send information to the top of the display
  * if the user is not currently using the Friendica Mobile App, however
  * there is only one line for displaying the information
+ *
  */
-function send_toast($device_url, $title, $message, $priority = 2)
-{
-       $msg = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" .
+function send_toast($device_url, $title, $message, $priority = 2) {
+       $msg = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" . 
                "<wp:Notification xmlns:wp=\"WPNotification\">" .
-               "<wp:Toast>" .
-               "<wp:Text1>" . $title . "</wp:Text1>" .
-               "<wp:Text2>" . $message . "</wp:Text2>" .
-               "<wp:Param></wp:Param>" .
-               "</wp:Toast>" .
+                       "<wp:Toast>" .
+                               "<wp:Text1>" . $title . "</wp:Text1>" .
+                               "<wp:Text2>" . $message . "</wp:Text2>" .
+                               "<wp:Param></wp:Param>" . 
+                       "</wp:Toast>" .
                "</wp:Notification>";
 
-       $result = send_push($device_url, [
+       $result = send_push($device_url, array(
                'X-WindowsPhone-Target: toast',
-               'X-NotificationClass: ' . $priority,
-               ], $msg);
+               'X-NotificationClass: ' . $priority, 
+               ), $msg);
        return $result;
 }
 
-// General function to send the push notification via cURL
-function send_push($device_url, $headers, $msg)
-{
+/* 
+ *
+ * General function to send the push notification via cURL
+ *
+ */ 
+function send_push($device_url, $headers, $msg) {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $device_url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_POST, true);
-       curl_setopt($ch, CURLOPT_HEADER, true);
-       curl_setopt($ch, CURLOPT_HTTPHEADER, $headers + [
-               'Content-Type: text/xml',
-               'charset=utf-8',
-               'Accept: application/*',
-               ]
-       );
+       curl_setopt($ch, CURLOPT_HEADER, true); 
+       curl_setopt($ch, CURLOPT_HTTPHEADER,
+               $headers + array(
+                       'Content-Type: text/xml',
+                       'charset=utf-8',
+                       'Accept: application/*',
+                       )
+               );
        curl_setopt($ch, CURLOPT_POSTFIELDS, $msg);
 
        $output = curl_exec($ch);
@@ -303,31 +323,35 @@ function send_push($device_url, $headers, $msg)
        // and log this fact
        $subscriptionStatus = get_header_value($output, 'X-SubscriptionStatus');
        if ($subscriptionStatus == "Expired") {
-               PConfig::set(local_user(), 'windowsphonepush', 'device_url', "");
+               set_pconfig(local_user(),'windowsphonepush','device_url', "");
                logger("ERROR: the stored Device-URL " . $device_url . "returned an 'Expired' error, it has been deleted now.");
        }
 
-       // the notification status shall be returned to windowsphonepush_cron (will
+       // the notification status shall be returned to windowsphonepush_cron (will 
        // update settings if 'Received' otherwise keep old value in settings (on QueuedFull. Suppressed, N/A, Dropped)
        $notificationStatus = get_header_value($output, 'X-NotificationStatus');
        return $notificationStatus;
-}
+    }
 
-// helper function to receive statuses from webresponse of Microsoft server
-function get_header_value($content, $header)
-{
+/*
+ * helper function to receive statuses from webresponse of Microsoft server
+ */ 
+function get_header_value($content, $header) {
        return preg_match_all("/$header: (.*)/i", $content, $match) ? $match[1][0] : "";
 }
 
-/* reading information from url and deciding which function to start
+
+/*
+ * 
+ * reading information from url and deciding which function to start
  * show_settings = delivering settings to check
  * update_settings = set the device_url
  * update_counterunseen = set counter for unseen elements to zero
+ *
  */
-function windowsphonepush_content(App $a)
-{
+function windowsphonepush_content(&$a) {       
        // Login with the specified Network credentials (like in api.php)
-       windowsphonepush_login($a);
+       windowsphonepush_login();
 
        $path = $a->argv[0];
        $path2 = $a->argv[1];
@@ -339,14 +363,14 @@ function windowsphonepush_content(App $a)
                                break;
                        case "update_settings":
                                $ret = windowsphonepush_updatesettings($a);
-                               header("Content-Type: application/json; charset=utf-8");
-                               echo json_encode(['status' => $ret]);
-                               killme();
+                               header("Content-Type: application/json; charset=utf-8");        
+                               echo json_encode(array('status' => $ret));
+                               killme();                               
                                break;
                        case "update_counterunseen":
                                $ret = windowsphonepush_updatecounterunseen();
                                header("Content-Type: application/json; charset=utf-8");
-                               echo json_encode(['status' => $ret]);
+                               echo json_encode(array('status' => $ret));
                                killme();
                                break;
                        default:
@@ -355,44 +379,42 @@ function windowsphonepush_content(App $a)
        }
 }
 
-// return settings for windowsphonepush addon to be able to check them in WP app
-function windowsphonepush_showsettings()
-{
-       if (!local_user()) {
+/* 
+ * return settings for windowsphonepush addon to be able to check them in WP app
+ */
+function windowsphonepush_showsettings(&$a) {
+       if(! local_user())
                return;
-       }
 
-       $enable = PConfig::get(local_user(), 'windowsphonepush', 'enable');
-       $device_url = PConfig::get(local_user(), 'windowsphonepush', 'device_url');
-       $senditemtext = PConfig::get(local_user(), 'windowsphonepush', 'senditemtext');
-       $lastpushid = PConfig::get(local_user(), 'windowsphonepush', 'lastpushid');
-       $counterunseen = PConfig::get(local_user(), 'windowsphonepush', 'counterunseen');
+       $enable = get_pconfig(local_user(), 'windowsphonepush', 'enable');
+       $device_url = get_pconfig(local_user(), 'windowsphonepush', 'device_url');
+       $senditemtext = get_pconfig(local_user(), 'windowsphonepush', 'senditemtext');
+       $lastpushid = get_pconfig(local_user(), 'windowsphonepush', 'lastpushid');
+       $counterunseen = get_pconfig(local_user(), 'windowsphonepush', 'counterunseen');
        $addonversion = "2.0";
 
-       if (!$device_url) {
+       if (!$device_url)
                $device_url = "";
-       }
 
-       if (!$lastpushid) {
+       if (!$lastpushid)
                $lastpushid = 0;
-       }
 
-       header("Content-Type: application/json");
-       echo json_encode(['uid' => local_user(),
-               'enable' => $enable,
-               'device_url' => $device_url,
-               'senditemtext' => $senditemtext,
-               'lastpushid' => $lastpushid,
-               'counterunseen' => $counterunseen,
-               'addonversion' => $addonversion]);
+       header ("Content-Type: application/json");
+       echo json_encode(array('uid' => local_user(), 
+                               'enable' => $enable, 
+                               'device_url' => $device_url, 
+                               'senditemtext' => $senditemtext,
+                               'lastpushid' => $lastpushid, 
+                               'counterunseen' => $counterunseen, 
+                               'addonversion' => $addonversion));
 }
 
-/* update_settings is used to transfer the device_url from WP device to the Friendica server
+/* 
+ * update_settings is used to transfer the device_url from WP device to the Friendica server
  * return the status of the operation to the server
  */
-function windowsphonepush_updatesettings()
-{
-       if (!local_user()) {
+function windowsphonepush_updatesettings(&$a) {
+       if(! local_user()) {  
                return "Not Authenticated";
        }
 
@@ -409,31 +431,32 @@ function windowsphonepush_updatesettings()
                return "No valid Device-URL specified";
        }
 
-       // check if sent url is already stored in database for another user, we assume that there was a change of
+       // check if sent url is already stored in database for another user, we assume that there was a change of 
        // the user on the Windows Phone device and that device url is no longer true for the other user, so we
-       // et the device_url for the OTHER user blank (should normally not occur as App should include User/server
+       // et the device_url for the OTHER user blank (should normally not occur as App should include User/server 
        // in url request to Microsoft Push Notification server)
-       $r = q("SELECT * FROM `pconfig` WHERE `uid` <> " . local_user() . " AND
-                                               `cat` = 'windowsphonepush' AND
-                                               `k` = 'device_url' AND
+       $r = q("SELECT * FROM `pconfig` WHERE `uid` <> " . local_user() . " AND 
+                                               `cat` = 'windowsphonepush' AND 
+                                               `k` = 'device_url' AND 
                                                `v` = '" . $device_url . "'");
-       if (count($r)) {
-               foreach ($r as $rr) {
-                       PConfig::set($rr['uid'], 'windowsphonepush', 'device_url', '');
-                       logger("WARN: the sent URL was already registered with user '" . $rr['uid'] . "'. Deleted for this user as we expect to be correct now for user '" . local_user() . "'.");
+       if(count($r)) {
+               foreach($r as $rr) {
+               set_pconfig($rr['uid'], 'windowsphonepush', 'device_url', '');
+               logger("WARN: the sent URL was already registered with user '" . $rr['uid'] . "'. Deleted for this user as we expect to be correct now for user '" . local_user() . "'.");
                }
        }
 
-       PConfig::set(local_user(), 'windowsphonepush', 'device_url', $device_url);
+       set_pconfig(local_user(),'windowsphonepush','device_url', $device_url);
        // output the successfull update of the device URL to the logger for error analysis if necessary
        logger("INFO: Device-URL for user '" . local_user() . "' has been updated with '" . $device_url . "'");
        return "Device-URL updated successfully!";
 }
 
-// update_counterunseen is used to reset the counter to zero from Windows Phone app
-function windowsphonepush_updatecounterunseen()
-{
-       if (!local_user()) {
+/* 
+ * update_counterunseen is used to reset the counter to zero from Windows Phone app 
+ */
+function windowsphonepush_updatecounterunseen() {
+       if(! local_user()) {  
                return "Not Authenticated";
        }
 
@@ -443,31 +466,40 @@ function windowsphonepush_updatecounterunseen()
                return "Plug-in not enabled";
        }
 
-       PConfig::set(local_user(), 'windowsphonepush', 'counterunseen', 0);
+       set_pconfig(local_user(),'windowsphonepush','counterunseen', 0);
        return "Counter set to zero";
 }
 
-/* helper function to login to the server with the specified Network credentials
+/*
+ * helper function to login to the server with the specified Network credentials
  * (mainly copied from api.php)
  */
-function windowsphonepush_login(App $a)
-{
+function windowsphonepush_login() {
        if (!isset($_SERVER['PHP_AUTH_USER'])) {
-               logger('API_login: ' . print_r($_SERVER, true), LOGGER_DEBUG);
-               header('WWW-Authenticate: Basic realm="Friendica"');
-               header('HTTP/1.0 401 Unauthorized');
-               die('This api requires login');
+           logger('API_login: ' . print_r($_SERVER, true), LOGGER_DEBUG);
+           header('WWW-Authenticate: Basic realm="Friendica"');
+           header('HTTP/1.0 401 Unauthorized');
+           die('This api requires login');
        }
 
-       $user_id = User::authenticate($_SERVER['PHP_AUTH_USER'], trim($_SERVER['PHP_AUTH_PW']));
+       $user = $_SERVER['PHP_AUTH_USER'];
+       $encrypted = hash('whirlpool',trim($_SERVER['PHP_AUTH_PW']));
 
-       if ($user_id) {
-               $record = dba::selectFirst('user', [], ['uid' => $user_id]);
+       // check if user specified by app is available in the user table
+       $r = q("SELECT * FROM `user` WHERE ( `email` = '%s' OR `nickname` = '%s' )
+           AND `password` = '%s' AND `blocked` = 0 AND `account_expired` = 0 AND `account_removed` = 0 AND `verified` = 1 LIMIT 1",
+           dbesc(trim($user)),
+           dbesc(trim($user)),
+           dbesc($encrypted)
+       );
+
+       if(count($r)){
+           $record = $r[0];
        } else {
-               logger('API_login failure: ' . print_r($_SERVER, true), LOGGER_DEBUG);
-               header('WWW-Authenticate: Basic realm="Friendica"');
-               header('HTTP/1.0 401 Unauthorized');
-               die('This api requires login');
+           logger('API_login failure: ' . print_r($_SERVER,true), LOGGER_DEBUG);
+           header('WWW-Authenticate: Basic realm="Friendica"');
+           header('HTTP/1.0 401 Unauthorized');
+           die('This api requires login');
        }
 
        require_once 'include/security.php';
@@ -475,3 +507,4 @@ function windowsphonepush_login(App $a)
        $_SESSION["allow_api"] = true;
        Addon::callHooks('logged_in', $a->user);
 }
+
index 8d14b17016ec1deee552e7ee5acfe0ab6131ff42..96209b1513358afd6468f53fca5fe66fe4c7482e 100644 (file)
@@ -38,9 +38,9 @@ function wppost_jot_nets(&$a,&$b) {
     if(! local_user())
         return;
 
-    $wp_post = PConfig::get(local_user(),'wppost','post');
+    $wp_post = get_pconfig(local_user(),'wppost','post');
     if(intval($wp_post) == 1) {
-        $wp_defpost = PConfig::get(local_user(),'wppost','post_by_default');
+        $wp_defpost = get_pconfig(local_user(),'wppost','post_by_default');
         $selected = ((intval($wp_defpost) == 1) ? ' checked="checked" ' : '');
         $b .= '<div class="profile-jot-net"><input type="checkbox" name="wppost_enable" ' . $selected . ' value="1" /> '
             . L10n::t('Post to Wordpress') . '</div>';
@@ -59,23 +59,23 @@ function wppost_settings(&$a,&$s) {
 
        /* Get the current state of our config variables */
 
-       $enabled = PConfig::get(local_user(),'wppost','post');
+       $enabled = get_pconfig(local_user(),'wppost','post');
        $checked = (($enabled) ? ' checked="checked" ' : '');
 
        $css = (($enabled) ? '' : '-disabled');
 
-       $def_enabled = PConfig::get(local_user(),'wppost','post_by_default');
-       $back_enabled = PConfig::get(local_user(),'wppost','backlink');
-       $shortcheck_enabled = PConfig::get(local_user(),'wppost','shortcheck');
+       $def_enabled = get_pconfig(local_user(),'wppost','post_by_default');
+       $back_enabled = get_pconfig(local_user(),'wppost','backlink');
+       $shortcheck_enabled = get_pconfig(local_user(),'wppost','shortcheck');
 
        $def_checked = (($def_enabled) ? ' checked="checked" ' : '');
        $back_checked = (($back_enabled) ? ' checked="checked" ' : '');
        $shortcheck_checked = (($shortcheck_enabled) ? ' checked="checked" ' : '');
 
-       $wp_username = PConfig::get(local_user(), 'wppost', 'wp_username');
-       $wp_password = PConfig::get(local_user(), 'wppost', 'wp_password');
-       $wp_blog = PConfig::get(local_user(), 'wppost', 'wp_blog');
-       $wp_backlink_text = PConfig::get(local_user(), 'wppost', 'wp_backlink_text');
+       $wp_username = get_pconfig(local_user(), 'wppost', 'wp_username');
+       $wp_password = get_pconfig(local_user(), 'wppost', 'wp_password');
+       $wp_blog = get_pconfig(local_user(), 'wppost', 'wp_blog');
+       $wp_backlink_text = get_pconfig(local_user(), 'wppost', 'wp_backlink_text');
 
 
     /* Add some HTML to the existing form */
@@ -137,17 +137,17 @@ function wppost_settings_post(&$a,&$b) {
 
        if(x($_POST,'wppost-submit')) {
 
-               PConfig::set(local_user(),'wppost','post',intval($_POST['wppost']));
-               PConfig::set(local_user(),'wppost','post_by_default',intval($_POST['wp_bydefault']));
-               PConfig::set(local_user(),'wppost','wp_username',trim($_POST['wp_username']));
-               PConfig::set(local_user(),'wppost','wp_password',trim($_POST['wp_password']));
-               PConfig::set(local_user(),'wppost','wp_blog',trim($_POST['wp_blog']));
-               PConfig::set(local_user(),'wppost','backlink',trim($_POST['wp_backlink']));
-               PConfig::set(local_user(),'wppost','shortcheck',trim($_POST['wp_shortcheck']));
+               set_pconfig(local_user(),'wppost','post',intval($_POST['wppost']));
+               set_pconfig(local_user(),'wppost','post_by_default',intval($_POST['wp_bydefault']));
+               set_pconfig(local_user(),'wppost','wp_username',trim($_POST['wp_username']));
+               set_pconfig(local_user(),'wppost','wp_password',trim($_POST['wp_password']));
+               set_pconfig(local_user(),'wppost','wp_blog',trim($_POST['wp_blog']));
+               set_pconfig(local_user(),'wppost','backlink',trim($_POST['wp_backlink']));
+               set_pconfig(local_user(),'wppost','shortcheck',trim($_POST['wp_shortcheck']));
                $wp_backlink_text = notags(trim($_POST['wp_backlink_text']));
                $wp_backlink_text = BBCode::convert($wp_backlink_text, false, 8);
                $wp_backlink_text = html2plain($wp_backlink_text, 0, true);
-               PConfig::set(local_user(),'wppost','wp_backlink_text', $wp_backlink_text);
+               set_pconfig(local_user(),'wppost','wp_backlink_text', $wp_backlink_text);
 
        }
 
@@ -169,11 +169,11 @@ function wppost_post_local(&$a, &$b) {
                return;
        }
 
-       $wp_post   = intval(PConfig::get(local_user(),'wppost','post'));
+       $wp_post   = intval(get_pconfig(local_user(),'wppost','post'));
 
        $wp_enable = (($wp_post && x($_REQUEST,'wppost_enable')) ? intval($_REQUEST['wppost_enable']) : 0);
 
-       if ($b['api_source'] && intval(PConfig::get(local_user(),'wppost','post_by_default'))) {
+       if ($b['api_source'] && intval(get_pconfig(local_user(),'wppost','post_by_default'))) {
                $wp_enable = 1;
        }
 
@@ -193,29 +193,20 @@ function wppost_post_local(&$a, &$b) {
 
 function wppost_send(&$a,&$b) {
 
-       if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) {
+       if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
                return;
-       }
 
-       if(! strstr($b['postopts'],'wppost')) {
+       if(! strstr($b['postopts'],'wppost'))
                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;
-       }
 
-       $wp_username = xmlify(PConfig::get($b['uid'],'wppost','wp_username'));
-       $wp_password = xmlify(PConfig::get($b['uid'],'wppost','wp_password'));
-       $wp_blog = PConfig::get($b['uid'],'wppost','wp_blog');
-       $wp_backlink_text = PConfig::get($b['uid'],'wppost','wp_backlink_text');
+       $wp_username = xmlify(get_pconfig($b['uid'],'wppost','wp_username'));
+       $wp_password = xmlify(get_pconfig($b['uid'],'wppost','wp_password'));
+       $wp_blog = get_pconfig($b['uid'],'wppost','wp_blog');
+       $wp_backlink_text = get_pconfig($b['uid'],'wppost','wp_backlink_text');
        if ($wp_backlink_text == '') {
                $wp_backlink_text = L10n::t('Read the orig­i­nal post and com­ment stream on Friendica');
        }
@@ -232,7 +223,7 @@ function wppost_send(&$a,&$b) {
 
                        // Is it a link to an aricle, a video or a photo?
                        if (isset($siteinfo["type"])) {
-                               if (in_array($siteinfo["type"], ["link", "audio", "video", "photo"])) {
+                               if (in_array($siteinfo["type"], array("link", "audio", "video", "photo"))) {
                                        $postentry = true;
                                }
                        }
@@ -286,7 +277,7 @@ function wppost_send(&$a,&$b) {
 
                $post = $title.$post;
 
-               $wp_backlink = intval(PConfig::get($b['uid'],'wppost','backlink'));
+               $wp_backlink = intval(get_pconfig($b['uid'],'wppost','backlink'));
                if($wp_backlink && $b['plink']) {
                        $post .= EOL . EOL . '<a href="' . $b['plink'] . '">'
                                . $wp_backlink_text . '</a>' . EOL . EOL;
diff --git a/xmpp/lang/C/messages.po b/xmpp/lang/C/messages.po
deleted file mode 100644 (file)
index a37749d..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-# ADDON xmpp
-# Copyright (C) 
-# This file is distributed under the same license as the Friendica xmpp addon package.
-# 
-#
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: \n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2017-11-27 09:30+0100\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"
-
-#: xmpp.php:38
-msgid "XMPP settings updated."
-msgstr ""
-
-#: xmpp.php:63 xmpp.php:67
-msgid "XMPP-Chat (Jabber)"
-msgstr ""
-
-#: xmpp.php:71
-msgid "Enable Webchat"
-msgstr ""
-
-#: xmpp.php:76
-msgid "Individual Credentials"
-msgstr ""
-
-#: xmpp.php:82 xmpp.php:108
-msgid "Jabber BOSH host"
-msgstr ""
-
-#: xmpp.php:91 xmpp.php:107
-msgid "Save Settings"
-msgstr ""
-
-#: xmpp.php:109
-msgid "Use central userbase"
-msgstr ""
-
-#: xmpp.php:109
-msgid ""
-"If enabled, users will automatically login to an ejabberd server that has to "
-"be installed on this machine with synchronized credentials via the "
-"\"auth_ejabberd.php\" script."
-msgstr ""
-
-#: xmpp.php:119
-msgid "Settings updated."
-msgstr ""
diff --git a/xmpp/lang/de/messages.po b/xmpp/lang/de/messages.po
deleted file mode 100644 (file)
index 252beb9..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-# ADDON xmpp
-# Copyright (C)
-# This file is distributed under the same license as the Friendica xmpp addon package.
-# 
-# 
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: \n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2017-11-27 09:30+0100\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: Andreas H. <webmaster@a-zwenkau.de>, 2017\n"
-"Language-Team: German (https://www.transifex.com/Friendica/teams/12172/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"
-
-#: xmpp.php:38
-msgid "XMPP settings updated."
-msgstr "XMPP Einstellungen aktualisiert."
-
-#: xmpp.php:63 xmpp.php:67
-msgid "XMPP-Chat (Jabber)"
-msgstr "XMPP-Chat (Jabber)"
-
-#: xmpp.php:71
-msgid "Enable Webchat"
-msgstr "Aktiviere Webchat"
-
-#: xmpp.php:76
-msgid "Individual Credentials"
-msgstr "Individuelle Anmeldedaten"
-
-#: xmpp.php:82 xmpp.php:108
-msgid "Jabber BOSH host"
-msgstr "Jabber BOSH Host"
-
-#: xmpp.php:91 xmpp.php:107
-msgid "Save Settings"
-msgstr "Speichere Einstellungen"
-
-#: xmpp.php:109
-msgid "Use central userbase"
-msgstr "Nutze zentrale Nutzerbasis"
-
-#: xmpp.php:109
-msgid ""
-"If enabled, users will automatically login to an ejabberd server that has to"
-" be installed on this machine with synchronized credentials via the "
-"\"auth_ejabberd.php\" script."
-msgstr ""
-"Wenn aktiviert, werden die Nutzer automatisch auf dem EJabber Server, der "
-"auf dieser Maschine installiert ist, angemeldet und die Zugangsdaten werden "
-"über das \"auth_ejabberd.php\"-Script synchronisiert."
-
-#: xmpp.php:119
-msgid "Settings updated."
-msgstr "Einstellungen aktualisiert."
diff --git a/xmpp/lang/de/strings.php b/xmpp/lang/de/strings.php
deleted file mode 100644 (file)
index a878502..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-if(! function_exists("string_plural_select_de")) {
-function string_plural_select_de($n){
-       return ($n != 1);;
-}}
-;
-$a->strings["XMPP settings updated."] = "XMPP Einstellungen aktualisiert.";
-$a->strings["XMPP-Chat (Jabber)"] = "XMPP-Chat (Jabber)";
-$a->strings["Enable Webchat"] = "Aktiviere Webchat";
-$a->strings["Individual Credentials"] = "Individuelle Anmeldedaten";
-$a->strings["Jabber BOSH host"] = "Jabber BOSH Host";
-$a->strings["Save Settings"] = "Speichere Einstellungen";
-$a->strings["Use central userbase"] = "Nutze zentrale Nutzerbasis";
-$a->strings["If enabled, users will automatically login to an ejabberd server that has to be installed on this machine with synchronized credentials via the \"auth_ejabberd.php\" script."] = "Wenn aktiviert, werden die Nutzer automatisch auf dem EJabber Server, der auf dieser Maschine installiert ist, angemeldet und die Zugangsdaten werden über das \"auth_ejabberd.php\"-Script synchronisiert.";
-$a->strings["Settings updated."] = "Einstellungen aktualisiert.";
index bd5adb574e2714513e779c867569a98e2a9f272c..422c6277de9117d91ecf295bf7b7f3bec2543432 100644 (file)
@@ -31,10 +31,9 @@ function xmpp_addon_settings_post()
 {
        if (!local_user() || (!x($_POST, 'xmpp-settings-submit'))) {
                return;
-       }
-       PConfig::set(local_user(), 'xmpp', 'enabled', intval($_POST['xmpp_enabled']));
-       PConfig::set(local_user(), 'xmpp', 'individual', intval($_POST['xmpp_individual']));
-       PConfig::set(local_user(), 'xmpp', 'bosh_proxy', $_POST['xmpp_bosh_proxy']);
+       set_pconfig(local_user(),'xmpp','enabled',intval($_POST['xmpp_enabled']));
+       set_pconfig(local_user(),'xmpp','individual',intval($_POST['xmpp_individual']));
+       set_pconfig(local_user(),'xmpp','bosh_proxy',$_POST['xmpp_bosh_proxy']);
 
        info(L10n::t('XMPP settings updated.') . EOL);
 }
@@ -43,7 +42,6 @@ function xmpp_addon_settings(App $a, &$s)
 {
        if (!local_user()) {
                return;
-       }
 
        /* Add our stylesheet to the xmpp so we can make our settings look nice */
 
@@ -51,13 +49,13 @@ function xmpp_addon_settings(App $a, &$s)
 
        /* Get the current state of our config variable */
 
-       $enabled = intval(PConfig::get(local_user(), 'xmpp', 'enabled'));
+       $enabled = intval(get_pconfig(local_user(),'xmpp','enabled'));
        $enabled_checked = (($enabled) ? ' checked="checked" ' : '');
 
-       $individual = intval(PConfig::get(local_user(), 'xmpp', 'individual'));
+       $individual = intval(get_pconfig(local_user(),'xmpp','individual'));
        $individual_checked = (($individual) ? ' checked="checked" ' : '');
 
-       $bosh_proxy = PConfig::get(local_user(), "xmpp", "bosh_proxy");
+       $bosh_proxy = get_pconfig(local_user(),"xmpp","bosh_proxy");
 
        /* Add some HTML to the existing form */
        $s .= '<span id="settings_xmpp_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_xmpp_expanded\'); openClose(\'settings_xmpp_inflated\');">';
@@ -92,11 +90,10 @@ function xmpp_addon_settings(App $a, &$s)
        $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="xmpp-settings-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
 }
 
-function xmpp_login()
-{
+function xmpp_login($a,$b) {
        if (!$_SESSION["allow_api"]) {
-               $password = random_string(16);
-               PConfig::set(local_user(), "xmpp", "password", $password);
+               $password = substr(random_string(),0,16);
+               set_pconfig(local_user(), "xmpp", "password", $password);
        }
 }
 
@@ -120,47 +117,40 @@ function xmpp_addon_admin_post()
        info(L10n::t('Settings updated.') . EOL);
 }
 
-function xmpp_script(App $a)
-{
-       xmpp_converse($a);
+function xmpp_script(&$a,&$s) {
+       xmpp_converse($a,$s);
 }
 
-function xmpp_converse(App $a)
-{
-       if (!local_user()) {
+function xmpp_converse(&$a,&$s) {
+       if (!local_user())
                return;
-       }
 
-       if ($_GET["mode"] == "minimal") {
+       if ($_GET["mode"] == "minimal")
                return;
-       }
 
-       if ($a->is_mobile || $a->is_tablet) {
+       if ($a->is_mobile || $a->is_tablet)
                return;
-       }
 
-       if (!PConfig::get(local_user(), "xmpp", "enabled")) {
+       if (!get_pconfig(local_user(),"xmpp","enabled"))
                return;
-       }
 
-       if (in_array($a->query_string, ["admin/federation/"])) {
+       if (in_array($a->query_string, array("admin/federation/")))
                return;
-       }
 
-       $a->page['htmlhead'] .= '<link type="text/css" rel="stylesheet" media="screen" href="addon/xmpp/converse/css/converse.css" />' . "\n";
-       $a->page['htmlhead'] .= '<script src="addon/xmpp/converse/builds/converse.min.js"></script>' . "\n";
+       $a->page['htmlhead'] .= '<link type="text/css" rel="stylesheet" media="screen" href="addon/xmpp/converse/css/converse.css" />'."\n";
+       $a->page['htmlhead'] .= '<script src="addon/xmpp/converse/builds/converse.min.js"></script>'."\n";
 
-       if (Config::get("xmpp", "central_userbase") && !PConfig::get(local_user(), "xmpp", "individual")) {
-               $bosh_proxy = Config::get("xmpp", "bosh_proxy");
+       if (get_config("xmpp", "central_userbase") && !get_pconfig(local_user(),"xmpp","individual")) {
+               $bosh_proxy = get_config("xmpp", "bosh_proxy");
 
-               $password = PConfig::get(local_user(), "xmpp", "password", '', true);
+               $password = get_pconfig(local_user(), "xmpp", "password");
 
                if ($password == "") {
-                       $password = random_string(16);
-                       PConfig::set(local_user(), "xmpp", "password", $password);
+                       $password = substr(random_string(),0,16);
+                       set_pconfig(local_user(), "xmpp", "password", $password);
                }
 
-               $jid = $a->user["nickname"] . "@" . $a->get_hostname() . "/converse-" . random_string(5);
+               $jid = $a->user["nickname"]."@".$a->get_hostname()."/converse-".substr(random_string(),0,5);;
 
                $auto_login = "auto_login: true,
                        authentication: 'login',
@@ -168,20 +158,18 @@ function xmpp_converse(App $a)
                        password: '$password',
                        allow_logout: false,";
        } else {
-               $bosh_proxy = PConfig::get(local_user(), "xmpp", "bosh_proxy");
+               $bosh_proxy = get_pconfig(local_user(), "xmpp", "bosh_proxy");
 
                $auto_login = "";
        }
 
-       if ($bosh_proxy == "") {
+       if ($bosh_proxy == "")
                return;
-       }
 
-       if (in_array($a->argv[0], ["manage", "logout"])) {
+       if (in_array($a->argv[0], array("manage", "logout")))
                $additional_commands = "converse.user.logout();\n";
-       } else {
+       else
                $additional_commands = "";
-       }
 
        $on_ready = "";
 
@@ -218,3 +206,4 @@ function xmpp_converse(App $a)
                                        });
                                </script>";
 }
+?>
index 53743650eaabbcd52ed404654d451ca3e2a8e1df..cfd09c97f5d3f4d1f2960977b6c0078a0222eda4 100644 (file)
@@ -15,7 +15,7 @@ yourls-url {
 
 .yourls {
        text-align: left;
-       width: 100%;
+       width 100%;
        margin-top: 25px;
        font-size: 20px;
 }
index c5cd12acf5de8e34cf4eac31ff312ee1a178ae87..10155b95c0fdb26ac072f0e97a1669a61a2b968c 100644 (file)
@@ -42,15 +42,15 @@ function yourls_addon_settings(&$a,&$s) {
        $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . $a->get_baseurl() . '/addon/yourls/yourls.css' . '" media="all" />' . "\r\n";
 
 
-       $yourls_url = Config::get('yourls','url1');
-       $yourls_username = Config::get('yourls','username1');
-       $yourls_password = Config::get('yourls', 'password1');
-       $ssl_enabled = Config::get('yourls','ssl1');
+       $yourls_url = get_config('yourls','url1');
+       $yourls_username = get_config('yourls','username1');
+       $yourls_password = get_config('yourls', 'password1');
+       $ssl_enabled = get_config('yourls','ssl1');
        $ssl_checked = (($ssl_enabled) ? ' checked="checked" ' : '');
 
 
 
-       $yourls_ssl = Config::get('yourls', 'ssl1');
+       $yourls_ssl = get_config('yourls', 'ssl1');
 
        $s .= '<span id="settings_yourls_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_yourls_expanded\'); openClose(\'settings_yourls_inflated\');">';
        $s .= '<h3>' . L10n::t('YourLS') . '</h3>';