Browse Source

Merge branch 'dispy' of github.com:fabrixxm/friendika into dispy

pull/1/head
fabrixxm 10 years ago
parent
commit
4e7a5dc56e
469 changed files with 1668 additions and 635 deletions
  1. +1
    -3
      .gitignore
  2. +4
    -3
      .htaccess
  3. +92
    -0
      INSTALL.txt
  4. +32
    -19
      addon/facebook/facebook.php
  5. +10
    -18
      addon/oembed/oembed.php
  6. +7
    -0
      addon/oembed/settings.tpl
  7. +4
    -0
      addon/piwik/admin.tpl
  8. +23
    -6
      addon/piwik/piwik.php
  9. +40
    -33
      addon/statusnet/statusnet.php
  10. +10
    -2
      addon/twitter/twitter.php
  11. +19
    -0
      addon/widgets/settings.tpl
  12. +17
    -19
      addon/widgets/widgets.php
  13. +73
    -40
      boot.php
  14. +29
    -6
      database.sql
  15. +0
    -0
      favicon.gif
  16. +0
    -0
      favicon.ico
  17. BIN
      images/icons.png
  18. +3
    -3
      include/Photo.php
  19. +2
    -2
      include/Scrape.php
  20. +112
    -0
      include/acl_selectors.php
  21. +7
    -2
      include/conversation.php
  22. +1
    -1
      include/country.js
  23. +13
    -8
      include/datetime.php
  24. +14
    -10
      include/directory.php
  25. +26
    -2
      include/event.php
  26. +7
    -3
      include/expire.php
  27. +17
    -10
      include/group.php
  28. +1
    -0
      include/hostxrd.php
  29. +9
    -7
      include/items.php
  30. +16
    -5
      include/main.js
  31. +43
    -5
      include/notifier.php
  32. +45
    -7
      include/poller.php
  33. +3
    -0
      include/queue.php
  34. +2
    -2
      include/salmon.php
  35. +71
    -0
      include/security.php
  36. +12
    -19
      index.php
  37. +0
    -0
      library/cropper/cropper.css
  38. +0
    -0
      library/cropper/cropper.html
  39. +0
    -0
      library/cropper/cropper.js
  40. +0
    -0
      library/cropper/cropper.uncompressed.js
  41. +0
    -0
      library/cropper/lib/builder.js
  42. +0
    -0
      library/cropper/lib/controls.js
  43. +0
    -0
      library/cropper/lib/dragdrop.js
  44. +0
    -0
      library/cropper/lib/effects.js
  45. +0
    -0
      library/cropper/lib/prototype.js
  46. +0
    -0
      library/cropper/lib/scriptaculous.js
  47. +0
    -0
      library/cropper/lib/slider.js
  48. +0
    -0
      library/cropper/lib/unittest.js
  49. +0
    -0
      library/cropper/licence.txt
  50. +0
    -0
      library/cropper/marqueeHoriz.gif
  51. +0
    -0
      library/cropper/marqueeVert.gif
  52. +0
    -0
      library/cropper/tests/castle.jpg
  53. +0
    -0
      library/cropper/tests/castleMed.jpg
  54. +0
    -0
      library/cropper/tests/example-Basic.htm
  55. +0
    -0
      library/cropper/tests/example-CSS-Absolute.htm
  56. +0
    -0
      library/cropper/tests/example-CSS-Float.htm
  57. +0
    -0
      library/cropper/tests/example-CSS-Relative.htm
  58. +0
    -0
      library/cropper/tests/example-CoordsOnLoad.htm
  59. +0
    -0
      library/cropper/tests/example-CoordsOnLoadWithRatio.htm
  60. +0
    -0
      library/cropper/tests/example-Dimensions.htm
  61. +0
    -0
      library/cropper/tests/example-DynamicImage.htm
  62. +0
    -0
      library/cropper/tests/example-FixedRatio.htm
  63. +0
    -0
      library/cropper/tests/example-MinimumDimensions.htm
  64. +0
    -0
      library/cropper/tests/example-MinimumWidth.htm
  65. +0
    -0
      library/cropper/tests/example-Preview.htm
  66. +0
    -0
      library/cropper/tests/poppy.jpg
  67. +0
    -0
      library/cropper/tests/staticHTMLStructure.htm
  68. +0
    -0
      library/phpsec/Crypt/AES.php
  69. +0
    -0
      library/phpsec/Crypt/DES.php
  70. +0
    -0
      library/phpsec/Crypt/Hash.php
  71. +0
    -0
      library/phpsec/Crypt/RC4.php
  72. +0
    -0
      library/phpsec/Crypt/RSA.php
  73. +0
    -0
      library/phpsec/Crypt/Random.php
  74. +0
    -0
      library/phpsec/Crypt/Rijndael.php
  75. +0
    -0
      library/phpsec/Crypt/TripleDES.php
  76. +0
    -0
      library/phpsec/Math/BigInteger.php
  77. +0
    -0
      library/phpsec/Net/SFTP.php
  78. +0
    -0
      library/phpsec/Net/SSH1.php
  79. +0
    -0
      library/phpsec/Net/SSH2.php
  80. +0
    -0
      library/phpsec/PHP/Compat/Function/array_fill.php
  81. +0
    -0
      library/phpsec/PHP/Compat/Function/bcpowmod.php
  82. +0
    -0
      library/phpsec/PHP/Compat/Function/str_split.php
  83. +0
    -0
      library/phpsec/crypt.html
  84. +0
    -0
      library/phpsec/docbook.css
  85. +0
    -0
      library/phpsec/index.html
  86. +0
    -0
      library/phpsec/intro.html
  87. +0
    -0
      library/phpsec/math.html
  88. +0
    -0
      library/phpsec/misc_crypt.html
  89. +0
    -0
      library/phpsec/net.html
  90. +0
    -0
      library/phpsec/sym_crypt.html
  91. +0
    -0
      library/simplepie/LICENSE.txt
  92. +0
    -0
      library/simplepie/README.markdown
  93. +0
    -0
      library/simplepie/compatibility_test/COMPATIBILITY README.txt
  94. +0
    -0
      library/simplepie/compatibility_test/sp_compatibility_test.php
  95. +0
    -0
      library/simplepie/create.php
  96. +0
    -0
      library/simplepie/db.sql
  97. +0
    -0
      library/simplepie/demo/cli_test.php
  98. +0
    -0
      library/simplepie/demo/for_the_demo/alternate_favicon.png
  99. +0
    -0
      library/simplepie/demo/for_the_demo/background_blockquote.png
  100. +0
    -0
      library/simplepie/demo/for_the_demo/background_menuitem.gif

+ 1
- 3
.gitignore View File

@ -1,11 +1,9 @@
favicon.*
.htconfig.php
\#*
wip/*
include/jquery-1.4.2.min.js
*.log
*.out
*.version*
push*
langup
favicon.*
home.html

+ 4
- 3
.htaccess View File

@ -9,12 +9,13 @@ Deny from all
<IfModule mod_rewrite.c>
RewriteEngine on
# RewriteRule api.* - [E=REMOTE_USER:%{HTTP:Authorization},L]
# Protect repo directory from browsing
# Protect repository directory from browsing
RewriteRule "(^|/)\.git" - [F]
# Rewrite current-style URLs of the form 'index.php?q=x'.
# Also place auth information into REMOTE_USER for sites running
# in CGI mode.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]


+ 92
- 0
INSTALL.txt View File

@ -113,3 +113,95 @@ $a->config['system']['addon'] = 'js_upload,poormancron';
and save your changes.
#####################################################################
If things don't work...
#####################################################################
#####################################################################
- If you get the message
"System is currently unavailable. Please try again later"
#####################################################################
Check your database settings. It usually means your database could not
be opened or accessed. If the database resides on the same machine, check that
the database server name is "localhost".
#####################################################################
- 500 Internal Error
#####################################################################
This could be the result of one of our Apache directives not being
supported by your version of Apache. Examine your apache server logs.
You might remove the line "Options -Indexes" from the .htaccess file if
you are using a Windows server as this has been known to cause problems.
Also check your file permissions. Your website and all contents must generally
be world-readable.
It is likely that your web server reported the source of the problem in
its error log files. Please review these system error logs to determine what
caused the problem. Often this will need to be resolved with your hosting
provider or (if self-hosted) your web server configuration.
#####################################################################
- 400 and 4xx "File not found" errors
#####################################################################
First check your file permissions. Your website and all contents must
generally be world-readable.
Ensure that mod-rewite is installed and working, and that your
.htaccess file is being used. To verify the latter, create a file test.out
containing the word "test" in the top directory of Friendika, make it world
readable and point your web browser to
http://yoursitenamehere.com/test.out
This file should be blocked. You should get a permission denied message.
If you see the word "test" your Apache configuration is not allowing
your .htaccess file to be used (there are rules in this file to block access
to any file with .out at the end, as these are typically used for system logs).
Make certain the .htaccess file exists and is readable by everybody, then
look for the existence of "AllowOverride None" in the Apache server
configuration for your site. This will need to be changed to
"AllowOverride All".
If you do not see the word "test", your .htaccess is working, but it is
likely that mod-rewrite is not installed in your web server or is not working.
On most flavour of Linux,
% a2enmod rewrite
% /etc/init.d/apache2 restart
Consult your hosting provider, experts on your particular Linux
distribution or (if Windows) the provider of your Apache server software if
you need to change either of these and can not figure out how. There is
a lot of help available on the web. Google "mod-rewrite" along with the
name of your operating system distribution or Apache package (if using
Windows).
#####################################################################
- If you are unable to write the file .htconfig.php during installation
due to permissions issues:
#####################################################################
create an empty file with that name and give it world-write permission.
For Linux:
% touch .htconfig.php
% chmod 777 .htconfig.php
Retry the installation. As soon as the database has been created,
******* this is important *********
% chmod 755 .htconfig.php

+ 32
- 19
addon/facebook/facebook.php View File

@ -43,6 +43,25 @@
define('FACEBOOK_MAXPOSTLEN', 420);
function facebook_install() {
register_hook('post_local_end', 'addon/facebook/facebook.php', 'facebook_post_hook');
register_hook('jot_networks', 'addon/facebook/facebook.php', 'facebook_jot_nets');
register_hook('plugin_settings', 'addon/facebook/facebook.php', 'facebook_plugin_settings');
register_hook('cron', 'addon/facebook/facebook.php', 'facebook_cron');
register_hook('queue_predeliver', 'addon/facebook/facebook.php', 'fb_queue_hook');
}
function facebook_uninstall() {
unregister_hook('post_local_end', 'addon/facebook/facebook.php', 'facebook_post_hook');
unregister_hook('jot_networks', 'addon/facebook/facebook.php', 'facebook_jot_nets');
unregister_hook('plugin_settings', 'addon/facebook/facebook.php', 'facebook_plugin_settings');
unregister_hook('cron', 'addon/facebook/facebook.php', 'facebook_cron');
unregister_hook('queue_predeliver', 'addon/facebook/facebook.php', 'fb_queue_hook');
}
/* declare the facebook_module function so that /facebook url requests will land here */
function facebook_module() {}
@ -339,22 +358,6 @@ function facebook_content(&$a) {
return $o;
}
function facebook_install() {
register_hook('post_local_end', 'addon/facebook/facebook.php', 'facebook_post_hook');
register_hook('jot_networks', 'addon/facebook/facebook.php', 'facebook_jot_nets');
register_hook('plugin_settings', 'addon/facebook/facebook.php', 'facebook_plugin_settings');
register_hook('cron', 'addon/facebook/facebook.php', 'facebook_cron');
register_hook('queue_predeliver', 'addon/facebook/facebook.php', 'fb_queue_hook');
}
function facebook_uninstall() {
unregister_hook('post_local_end', 'addon/facebook/facebook.php', 'facebook_post_hook');
unregister_hook('jot_networks', 'addon/facebook/facebook.php', 'facebook_jot_nets');
unregister_hook('plugin_settings', 'addon/facebook/facebook.php', 'facebook_plugin_settings');
unregister_hook('cron', 'addon/facebook/facebook.php', 'facebook_cron');
unregister_hook('queue_predeliver', 'addon/facebook/facebook.php', 'fb_queue_hook');
}
function facebook_cron($a,$b) {
@ -373,9 +376,12 @@ function facebook_cron($a,$b) {
logger('facebook_cron');
set_config('facebook','last_poll', time());
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'facebook' AND `k` = 'post' AND `v` = '1' ");
// 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) {
// check for new friends once a day
@ -389,6 +395,9 @@ function facebook_cron($a,$b) {
fb_consume_all($rr['uid']);
}
}
set_config('facebook','last_poll', time());
}
@ -431,6 +440,10 @@ function facebook_post_hook(&$a,&$b) {
if((local_user()) && (local_user() == $b['uid'])) {
// Facebook is not considered a private network
if($b['prvnets'] && $b['private'])
return;
if($b['parent']) {
$r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($b['parent']),
@ -817,7 +830,7 @@ function fb_consume_stream($uid,$j,$wall = false) {
$datarray['owner-avatar'] = $self[0]['thumb'];
}
if(isset($entry->application) && isset($entry->application->name) && strlen($entry->application->name))
$datarray['app'] = $entry->application->name;
$datarray['app'] = strip_tags($entry->application->name);
else
$datarray['app'] = 'facebook';
$datarray['author-name'] = $from->name;


+ 10
- 18
addon/oembed/oembed.php View File

@ -25,9 +25,9 @@ function oembed_uninstall() {
function oembed_settings_post($a,$b){
if(! local_user())
return;
if (isset($_POST['oembed-submit'])){
set_pconfig(local_user(), 'oembed', 'use_for_youtube', (isset($_POST['oembed_use_for_youtube'])? intval($_POST['oembed_use_for_youtube']):0));
notice( t('OEmbed settings updated') . EOL);
if (x($_POST,'oembed-submit')){
set_pconfig(local_user(), 'oembed', 'use_for_youtube', (x($_POST,'oembed_use_for_youtube')? intval($_POST['oembed_use_for_youtube']):0));
info( t('OEmbed settings updated') . EOL);
}
}
@ -36,21 +36,13 @@ function oembed_settings(&$a,&$o) {
return;
$uofy = intval(get_pconfig(local_user(), 'oembed', 'use_for_youtube' ));
$o.='
<div class="settings-block">
<h3 class="settings-heading">OEmbed</h3>
<div id="settings-username-wrapper">
<label for="oembed_use_for_youtube">'
.t('Use OEmbed for YouTube videos: ')
.'</label><input type="checkbox" id="oembed_use_for_youtube" name="oembed_use_for_youtube" value="1"'
. ($uofy==1?'checked="true"':'')
.' />
</div>
<div id="settings-username-end"></div>
<div class="settings-submit-wrapper">
<input type="submit" value="'.t('Submit').'" class="settings-submit" name="oembed-submit" />
</div>
</div>';
$t = file_get_contents( dirname(__file__). "/settings.tpl" );
$o .= replace_macros($t, array(
'$submit' => t('Submit'),
'$title' => "OEmbed",
'$useoembed' => array('oembed_use_for_youtube', t('Use OEmbed for YouTube videos'), $uofy, ""),
));
}


+ 7
- 0
addon/oembed/settings.tpl View File

@ -0,0 +1,7 @@
<div class="settings-block">
<h3 class="settings-heading">$title</h3>
{{ inc field_checkbox.tpl with $field=$useoembed }}{{ endinc }}
<div class="settings-submit-wrapper">
<input type="submit" value="$submit" class="settings-submit" name="oembed-submit" />
</div>
</div>

+ 4
- 0
addon/piwik/admin.tpl View File

@ -0,0 +1,4 @@
{{ inc field_input.tpl with $field=$baseurl }}{{ endinc }}
{{ inc field_input.tpl with $field=$siteid }}{{ endinc }}
{{ inc field_checkbox.tpl with $field=$optout }}{{ endinc }}
<div class="submit"><input type="submit" name="page_site" value="$submit" /></div>

+ 23
- 6
addon/piwik/piwik.php View File

@ -18,10 +18,10 @@
* Add the following two lines to your .htconfig.php file:
*
* $a->config['piwik']['baseurl'] = 'www.example.com/piwik/';
* $a->config['piwik']['sideid'] = '1';
* $a->config['piwik']['siteid'] = '1';
* $a->config['piwik']['optout'] = true; // set to false to disable
*
* Change the sideid to the ID that the Piwik tracker for your Friendika
* Change the siteid to the ID that the Piwik tracker for your Friendika
* installation has. Alter the baseurl to fit your needs, don't care
* about http/https but beware to put the trailing / at the end of your
* setting.
@ -54,13 +54,13 @@ function piwik_analytics($a,&$b) {
* Get the configuration variables from the .htconfig file.
*/
$baseurl = get_config('piwik','baseurl');
$sideod = get_config('piwik','sideid');
$siteid = get_config('piwik','siteid');
$optout = get_config('piwik','optout');
/*
* Add the Piwik code for the side.
* Add the Piwik code for the site.
*/
$b .= "<div id='piwik-code-block'> <!-- Piwik -->\r\n <script type=\"text/javascript\">\r\n var pkBaseURL = ((\"https:\" == document.location.protocol) ? \"https://".$baseurl."\" : \"http://".$baseurl."\");\r\n document.write(unescape(\"%3Cscript src='\" + pkBaseURL + \"piwik.js' type='text/javascript'%3E%3C/script%3E\"));\r\n </script>\r\n<script type=\"text/javascript\">\r\n try {\r\n var piwikTracker = Piwik.getTracker(pkBaseURL + \"piwik.php\", 8);\r\n piwikTracker.trackPageView();\r\n piwikTracker.enableLinkTracking();\r\n }\r\n catch( err ) {}\r\n </script>\r\n<noscript><p><img src=\"http://".$baseurl."/piwik.php?idsite=8\" style=\"border:0\" alt=\"\" /></p></noscript>\r\n <!-- End Piwik Tracking Tag --> </div>";
$b .= "<div id='piwik-code-block'> <!-- Piwik -->\r\n <script type=\"text/javascript\">\r\n var pkBaseURL = ((\"https:\" == document.location.protocol) ? \"https://".$baseurl."\" : \"http://".$baseurl."\");\r\n document.write(unescape(\"%3Cscript src='\" + pkBaseURL + \"piwik.js' type='text/javascript'%3E%3C/script%3E\"));\r\n </script>\r\n<script type=\"text/javascript\">\r\n try {\r\n var piwikTracker = Piwik.getTracker(pkBaseURL + \"piwik.php\", ".$siteid.");\r\n piwikTracker.trackPageView();\r\n piwikTracker.enableLinkTracking();\r\n }\r\n catch( err ) {}\r\n </script>\r\n<noscript><p><img src=\"http://".$baseurl."/piwik.php?idsite=".$siteid."\" style=\"border:0\" alt=\"\" /></p></noscript>\r\n <!-- End Piwik Tracking Tag --> </div>";
/*
* If the optout variable is set to true then display the notice
* otherwise just include the above code into the page.
@ -70,4 +70,21 @@ function piwik_analytics($a,&$b) {
}
}
function piwik_plugin_admin (&$a, &$o) {
$t = file_get_contents( dirname(__file__)."/admin.tpl");
$o = replace_macros( $t, array(
'$submit' => t('Submit'),
'$baseurl' => array('baseurl', t('Piwik Base URL'), get_config('piwik','baseurl' ), ''),
'$siteid' => array('siteid', t('Site ID'), get_config('piwik','siteid' ), ''),
'$optout' => array('optout', t('Show opt-out cookie link?'), get_config('piwik','optout' ), ''),
));
}
function piwik_plugin_admin_post (&$a) {
$url = ((x($_POST, 'baseurl')) ? notags(trim($_POST['baseurl'])) : '');
$id = ((x($_POST, 'siteid')) ? trim($_POST['siteid']) : '');
$optout = ((x($_POST, 'optout')) ? trim($_POST['optout']) : '');
set_config('piwik', 'baseurl', $url);
set_config('piwik', 'siteid', $id);
set_config('piwik', 'optout', $optout);
info( t('Settings updated.'). EOL);
}

+ 40
- 33
addon/statusnet/statusnet.php View File

@ -89,6 +89,9 @@ function statusnet_jot_nets(&$a,&$b) {
function statusnet_settings_post ($a,$post) {
if(! local_user())
return;
// don't check statusnet settings if statusnet submit button is not clicked
if (!x($_POST,'statusnet-submit')) return;
if (isset($_POST['statusnet-disconnect'])) {
/***
* if the statusnet-disconnect checkbox is set, clear the statusnet configuration
@ -152,28 +155,28 @@ function statusnet_settings_post ($a,$post) {
goaway($a->get_baseurl().'/settings/addon');
} else {
if (isset($_POST['statusnet-pin'])) {
// if the user supplied us with a PIN from Twitter, let the magic of OAuth happen
logger('got a StatusNet security code');
// if the user supplied us with a PIN from Twitter, let the magic of OAuth happen
logger('got a StatusNet security code');
$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 Twitter 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']);
$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 Twitter 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);
// reload the Addon Settings page, if we don't do it see Bug #42
goaway($a->get_baseurl().'/settings/addon');
} else {
// if no PIN is supplied in the POST variables, the user has changed the setting
// to post a tweet 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']));
info( t('StatusNet settings updated.') . EOL);
} else {
// if no PIN is supplied in the POST variables, the user has changed the setting
// to post a tweet 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']));
info( t('StatusNet settings updated.') . EOL);
}}}}
}
function statusnet_settings(&$a,&$s) {
@ -217,7 +220,7 @@ function statusnet_settings(&$a,&$s) {
$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="submit" class="settings-submit" value="' . t('Submit') . '" /></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . t('Submit') . '" /></div>';
}
$s .= '<h4>' . t('Provide your own OAuth Credentials') . '</h4>';
$s .= '<p>'. t('No consumer key pair for StatusNet found. Register your Friendika Account as an desktop client on your StatusNet account, copy the consumer key pair here and enter the API base root.<br />Before you register your own OAuth key pair ask the administrator if there is already a key pair for this Friendika installation at your favorited StatusNet installation.') .'</p>';
@ -231,7 +234,7 @@ function statusnet_settings(&$a,&$s) {
$s .= '<label id="statusnet-baseapi-label" for="statusnet-baseapi">'. t("Base API Path \x28remember the trailing /\x29") .'</label>';
$s .= '<input id="statusnet-baseapi" type="text" name="statusnet-baseapi" size="35" /><br />';
$s .= '<p></p><div class="clear"></div></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="submit" class="settings-submit" value="' . t('Submit') . '" /></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . t('Submit') . '" /></div>';
} else {
/***
* ok we have a consumer key pair now look into the OAuth stuff
@ -256,15 +259,15 @@ function statusnet_settings(&$a,&$s) {
$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 .= '</div><div class="clear"></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="submit" class="settings-submit" value="' . t('Submit') . '" /></div>';
$s .= '<h4>'.t('Cancel Connection Process').'</h4>';
$s .= '<div id="statusnet-cancel-wrapper">';
$s .= '<p>'.t('Current StatusNet API is').': '.$api.'</p>';
$s .= '<label id="statusnet-cancel-label" for="statusnet-cancel">'. t('Cancel StatusNet Connection') . '</label>';
$s .= '<input id="statusnet-cancel" type="checkbox" name="statusnet-disconnect" value="1" />';
$s .= '</div><div class="clear"></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="submit" class="settings-submit" value="' . t('Submit') . '" /></div>';
$s .= '</div><div class="clear"></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="submit" class="settings-submit" value="' . t('Submit') . '" /></div>';
$s .= '<h4>'.t('Cancel Connection Process').'</h4>';
$s .= '<div id="statusnet-cancel-wrapper">';
$s .= '<p>'.t('Current StatusNet API is').': '.$api.'</p>';
$s .= '<label id="statusnet-cancel-label" for="statusnet-cancel">'. t('Cancel StatusNet Connection') . '</label>';
$s .= '<input id="statusnet-cancel" type="checkbox" name="statusnet-disconnect" value="1" />';
$s .= '</div><div class="clear"></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . t('Submit') . '" /></div>';
} else {
/***
* we have an OAuth key / secret pair for the user
@ -286,7 +289,7 @@ function statusnet_settings(&$a,&$s) {
$s .= '<label id="statusnet-disconnect-label" for="statusnet-disconnect">'. t('Clear OAuth configuration') .'</label>';
$s .= '<input id="statusnet-disconnect" type="checkbox" name="statusnet-disconnect" value="1" />';
$s .= '</div><div class="clear"></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="submit" class="settings-submit" value="' . t('Submit') . '" /></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . t('Submit') . '" /></div>';
}
}
$s .= '</div><div class="clear"></div></div>';
@ -303,10 +306,14 @@ function statusnet_post_hook(&$a,&$b) {
if((local_user()) && (local_user() == $b['uid']) && (! $b['private']) && (!$b['parent']) ) {
load_pconfig(local_user(), 'statusnet');
// Status.Net is not considered a private network
if($b['prvnets'])
return;
load_pconfig(local_user(), 'statusnet');
$api = get_pconfig(local_user(), 'statusnet', 'baseapi');
$ckey = get_pconfig(local_user(), 'statusnet', 'consumerkey' );
$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' );


+ 10
- 2
addon/twitter/twitter.php View File

@ -76,6 +76,9 @@ function twitter_jot_nets(&$a,&$b) {
function twitter_settings_post ($a,$post) {
if(! local_user())
return;
// don't check twitter settings if twitter submit button is not clicked
if (!x($_POST,'twitter-submit')) return;
if (isset($_POST['twitter-disconnect'])) {
/***
* if the twitter-disconnect checkbox is set, clear the OAuth key/secret pair
@ -159,7 +162,7 @@ function twitter_settings(&$a,&$s) {
$s .= '<input id="twitter-token" type="hidden" name="twitter-token" value="'.$token.'" />';
$s .= '<input id="twitter-token2" type="hidden" name="twitter-token2" value="'.$request_token['oauth_token_secret'].'" />';
$s .= '</div><div class="clear"></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="submit" class="settings-submit" value="' . t('Submit') . '" /></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="twitter-submit" class="settings-submit" value="' . t('Submit') . '" /></div>';
} else {
/***
* we have an OAuth key / secret pair for the user
@ -178,7 +181,7 @@ function twitter_settings(&$a,&$s) {
$s .= '<label id="twitter-disconnect-label" for="twitter-disconnect">'. t('Clear OAuth configuration') .'</label>';
$s .= '<input id="twitter-disconnect" type="checkbox" name="twitter-disconnect" value="1" />';
$s .= '</div><div class="clear"></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="submit" class="settings-submit" value="' . t('Submit') . '" /></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="twitter-submit" class="settings-submit" value="' . t('Submit') . '" /></div>';
}
}
$s .= '</div><div class="clear"></div></div>';
@ -195,6 +198,11 @@ function twitter_post_hook(&$a,&$b) {
if((local_user()) && (local_user() == $b['uid']) && (! $b['private']) && (! $b['parent']) ) {
// Twitter is not considered a private network
if($b['prvnets'])
return;
load_pconfig(local_user(), 'twitter');
$ckey = get_config('twitter', 'consumerkey' );


+ 19
- 0
addon/widgets/settings.tpl View File

@ -0,0 +1,19 @@
<div class="settings-block">
<h3 class="settings-heading">$title</h3>
<div class='field noedit'>
<label>$label</label>
<tt>$key</tt>
</div>
<div class="settings-submit-wrapper">
<input type="submit" value="$submit" class="settings-submit" name="widgets-submit" />
</div>
<h4>$widgets_h</h4>
<ul>
{{ for $widgets as $w }}
<li><a href="$baseurl/widgets/$w.0/?k=$key&p=1">$w.1</a></li>
{{ endfor }}
</ul>
</div>

+ 17
- 19
addon/widgets/widgets.php View File

@ -33,34 +33,32 @@ function widgets_settings(&$a,&$o) {
$key = get_pconfig(local_user(), 'widgets', 'key' );
if ($key=='') { $key = mt_rand(); set_pconfig(local_user(), 'widgets', 'key', $key); }
$o .='<h3 class="settings-heading">Widgets</h3>';
$o.='
<div id="settings-username-wrapper">
'. t('Widgets key: ') .'<strong>'.$key.'</strong>
</div>
<div id="settings-username-end"></div>
<div class="settings-submit-wrapper">
<input type="submit" value="'.t('Generate new key').'" class="settings-submit" name="widgets-submit">
</div>';
$o.='<h4>Widgets:</h4>';
$o .= '<ul>';
$widgets = array();
$d = dir(dirname(__file__));
while(false !== ($f = $d->read())) {
if(substr($f,0,7)=="widget_") {
preg_match("|widget_([^.]+).php|", $f, $m);
$w=$m[1];
require_once($f);
$o.='<li><a href="'.$a->get_baseurl().'/widgets/'.$w.'/?k='.$key.'&p=1">'. call_user_func($w."_widget_name") .'</a></li>';
$widgets[] = array($w, call_user_func($w."_widget_name"));
}
}
$o .= '</ul>';
$t = file_get_contents( dirname(__file__). "/settings.tpl" );
$o .= replace_macros($t, array(
'$submit' => t('Generate new key'),
'$baseurl' => $a->get_baseurl(),
'$title' => "Widgets",
'$label' => t('Widgets key'),
'$key' => $key,
'$widgets_h' => t('Widgets available'),
'$widgets' => $widgets,
));
}
function widgets_module() {


+ 73
- 40
boot.php View File

@ -4,9 +4,9 @@ set_time_limit(0);
ini_set('pcre.backtrack_limit', 250000);
define ( 'FRIENDIKA_VERSION', '2.2.1019' );
define ( 'FRIENDIKA_VERSION', '2.2.1030' );
define ( 'DFRN_PROTOCOL_VERSION', '2.21' );
define ( 'DB_UPDATE_VERSION', 1066 );
define ( 'DB_UPDATE_VERSION', 1073 );
define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
@ -56,9 +56,9 @@ define ( 'REGISTER_OPEN', 2 );
* this relationship with contact['name']
*/
define ( 'REL_VIP', 1);
define ( 'REL_FAN', 2);
define ( 'REL_BUD', 3);
define ( 'REL_VIP', 1); // other person is 'following' us
define ( 'REL_FAN', 2); // we are 'following' other person
define ( 'REL_BUD', 3); // mutual relationship
/**
* Hook array order
@ -296,6 +296,8 @@ class App {
$this->module = str_replace(".", "_", $this->argv[0]);
}
else {
$this->argc = 1;
$this->argv = array('home');
$this->module = 'home';
}
@ -498,9 +500,6 @@ function install_plugin($plugin){
if(! function_exists('check_config')) {
function check_config(&$a) {
load_config('system');
$build = get_config('system','build');
if(! x($build))
$build = set_config('system','build',DB_UPDATE_VERSION);
@ -674,7 +673,7 @@ function fetch_url($url,$binary = false, &$redirects = 0) {
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_USERAGENT, "Friendika");
$curl_time = intval(get_config('system','curl_timeout'));
curl_setopt($ch, CURLOPT_TIMEOUT, (($curl_time !== false) ? $curl_time : 60));
@ -703,13 +702,21 @@ function fetch_url($url,$binary = false, &$redirects = 0) {
$s = @curl_exec($ch);
$http_code = intval(curl_getinfo($ch, CURLINFO_HTTP_CODE));
$header = substr($s,0,strpos($s,"\r\n\r\n"));
if(stristr($header,'100') && (strlen($header) < 30)) {
// 100 Continue has two headers, get the real one
$s = substr($s,strlen($header)+4);
$header = substr($s,0,strpos($s,"\r\n\r\n"));
$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 || $http_code == 307) {
$matches = array();
preg_match('/(Location:|URI:)(.*?)\n/', $header, $matches);
@ -720,16 +727,10 @@ function fetch_url($url,$binary = false, &$redirects = 0) {
return fetch_url($url,$binary,$redirects);
}
}
$a->set_curl_code($http_code);
$body = substr($s,strlen($header)+4);
/* one more try to make sure there are no more headers */
$a->set_curl_code($http_code);
if(strpos($body,'HTTP/') === 0) {
$header = substr($body,0,strpos($body,"\r\n\r\n"));
$body = substr($body,strlen($header)+4);
}
$body = substr($s,strlen($header));
$a->set_curl_headers($header);
@ -750,6 +751,7 @@ function post_url($url,$params, $headers = null, &$redirects = 0) {
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
curl_setopt($ch, CURLOPT_USERAGENT, "Friendika");
$curl_time = intval(get_config('system','curl_timeout'));
curl_setopt($ch, CURLOPT_TIMEOUT, (($curl_time !== false) ? $curl_time : 60));
@ -775,13 +777,21 @@ function post_url($url,$params, $headers = null, &$redirects = 0) {
$s = @curl_exec($ch);
$http_code = intval(curl_getinfo($ch, CURLINFO_HTTP_CODE));
$header = substr($s,0,strpos($s,"\r\n\r\n"));
if(stristr($header,'100') && (strlen($header) < 30)) {
// 100 Continue has two headers, get the real one
$s = substr($s,strlen($header)+4);
$header = substr($s,0,strpos($s,"\r\n\r\n"));
$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);
@ -793,14 +803,7 @@ function post_url($url,$params, $headers = null, &$redirects = 0) {
}
}
$a->set_curl_code($http_code);
$body = substr($s,strlen($header)+4);
/* one more try to make sure there are no more headers */
if(strpos($body,'HTTP/') === 0) {
$header = substr($body,0,strpos($body,"\r\n\r\n"));
$body = substr($body,strlen($header)+4);
}
$body = substr($s,strlen($header));
$a->set_curl_headers($header);
@ -1218,7 +1221,11 @@ function load_config($family) {
if(count($r)) {
foreach($r as $rr) {
$k = $rr['k'];
$a->config[$family][$k] = $rr['v'];
if ($rr['cat'] === 'config') {
$a->config[$k] = $rr['v'];
} else {
$a->config[$family][$k] = $rr['v'];
}
}
}
}}
@ -1685,8 +1692,10 @@ function fetch_lrdd_template($host) {
$url1 = 'https://' . $host . '/.well-known/host-meta' ;
$url2 = 'http://' . $host . '/.well-known/host-meta' ;
$links = fetch_xrd_links($url1);
logger('fetch_lrdd_template from: ' . $url1);
logger('template (https): ' . print_r($links,true));
if(! count($links)) {
logger('fetch_lrdd_template from: ' . $url2);
$links = fetch_xrd_links($url2);
logger('template (http): ' . print_r($links,true));
}
@ -2015,7 +2024,7 @@ function get_tags($s) {
$s = preg_replace('/\[code\](.*?)\[\/code\]/sm','',$s);
if(preg_match_all('/([@#][^ \x0D\x0A,:?]+)([ \x0D\x0A,:?]|$)/',$s,$match)) {
if(preg_match_all('/([@#][^ \x0D\x0A,:?]+ [^ \x0D\x0A,:?]+)([ \x0D\x0A,:?]|$)/',$s,$match)) {
foreach($match[1] as $mtch) {
if(strstr($mtch,"]")) {
// we might be inside a bbcode color tag - leave it alone
@ -2028,6 +2037,18 @@ function get_tags($s) {
}
}
if(preg_match_all('/([@#][^ \x0D\x0A,:?]+)([ \x0D\x0A,:?]|$)/',$s,$match)) {
foreach($match[1] as $mtch) {
if(strstr($mtch,"]")) {
// we might be inside a bbcode color tag - leave it alone
continue;
}
if(substr($mtch,-1,1) === '.')
$ret[] = substr($mtch,0,-1);
else
$ret[] = $mtch;
}
}
return $ret;
}}
@ -2415,7 +2436,7 @@ function profile_sidebar($profile) {
));
$arr = array('profile' => $profile, 'entry' => $o);
$arr = array('profile' => &$profile, 'entry' => &$o);
call_hooks('profile_sidebar', $arr);
@ -2891,3 +2912,15 @@ function get_plugin_info($plugin){
}
return $info;
}}
if(! function_exists('return_bytes')) {
function return_bytes ($size_str) {
switch (substr ($size_str, -1))
{
case 'M': case 'm': return (int)$size_str * 1048576;
case 'K': case 'k': return (int)$size_str * 1024;
case 'G': case 'g': return (int)$size_str * 1073741824;
default: return $size_str;
}
}}

+ 29
- 6
database.sql View File

@ -169,9 +169,10 @@ CREATE TABLE IF NOT EXISTS `item` (
`parent-uri` char(255) NOT NULL,
`extid` char(255) NOT NULL,
`thr-parent` char(255) NOT NULL,
`created` datetime NOT NULL,
`edited` datetime NOT NULL,
`changed` datetime NOT NULL,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`received` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`changed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`owner-name` char(255) NOT NULL,
`owner-link` char(255) NOT NULL,
`owner-avatar` char(255) NOT NULL,
@ -201,6 +202,7 @@ CREATE TABLE IF NOT EXISTS `item` (
`private` tinyint(1) NOT NULL DEFAULT '0',
`pubmail` tinyint(1) NOT NULL DEFAULT '0',
`visible` tinyint(1) NOT NULL DEFAULT '0',
`starred` tinyint(1) NOT NULL DEFAULT '0',
`unseen` tinyint(1) NOT NULL DEFAULT '1',
`deleted` tinyint(1) NOT NULL DEFAULT '0',
`last-child` tinyint(1) unsigned NOT NULL DEFAULT '1',
@ -215,7 +217,9 @@ CREATE TABLE IF NOT EXISTS `item` (
KEY `extid` (`extid`),
KEY `created` (`created`),
KEY `edited` (`edited`),
KEY `received` (`received`),
KEY `visible` (`visible`),
KEY `starred` (`starred`),
KEY `deleted` (`deleted`),
KEY `last-child` (`last-child`),
KEY `unseen` (`unseen`),
@ -241,7 +245,7 @@ CREATE TABLE IF NOT EXISTS `mail` (
`from-url` char(255) NOT NULL,
`contact-id` char(255) NOT NULL,
`title` char(255) NOT NULL,
`body` text NOT NULL,
`body` mediumtext NOT NULL,
`seen` tinyint(1) NOT NULL,
`replied` tinyint(1) NOT NULL,
`uri` char(255) NOT NULL,
@ -276,7 +280,12 @@ CREATE TABLE IF NOT EXISTS `photo` (
`allow_gid` mediumtext NOT NULL,
`deny_cid` mediumtext NOT NULL,
`deny_gid` mediumtext NOT NULL,
PRIMARY KEY (`id`)
PRIMARY KEY (`id`),
KEY `uid` (`uid`),
KEY `resource-id` (`resource-id`),
KEY `album` (`album`),
KEY `scale` (`scale`),
KEY `profile` (`profile`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@ -507,7 +516,8 @@ CREATE TABLE IF NOT EXISTS `fcontact` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`url` CHAR( 255 ) NOT NULL ,
`name` CHAR( 255 ) NOT NULL ,
`photo` CHAR( 255 ) NOT NULL
`photo` CHAR( 255 ) NOT NULL ,
`request` CHAR( 255 ) NOT NULL
) ENGINE = MYISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `ffinder` (
@ -518,6 +528,19 @@ CREATE TABLE IF NOT EXISTS `ffinder` (
) ENGINE = MYISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `fsuggest` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`uid` INT NOT NULL ,
`cid` INT NOT NULL ,
`name` CHAR( 255 ) NOT NULL ,
`url` CHAR( 255 ) NOT NULL ,
`request` CHAR( 255 ) NOT NULL,
`photo` CHAR( 255 ) NOT NULL ,
`note` TEXT NOT NULL ,
`created` DATETIME NOT NULL
) ENGINE = MYISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `mailacct` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`uid` INT NOT NULL,


+ 0
- 0
favicon.gif View File


+ 0
- 0
favicon.ico View File


BIN
images/icons.png View File

Before After
Width: 160  |  Height: 68  |  Size: 10 KiB Width: 160  |  Height: 68  |  Size: 12 KiB

+ 3
- 3
include/Photo.php View File

@ -230,21 +230,21 @@ function import_profile_photo($photo,$uid,$cid) {
$hash = photo_new_resource();
$r = $img->store($uid, $cid, $hash, $filename, t('Contact Photos'), 4 );
$r = $img->store($uid, $cid, $hash, $filename, 'Contact Photos', 4 );
if($r === false)
$photo_failure = true;
$img->scaleImage(80);
$r = $img->store($uid, $cid, $hash, $filename, t('Contact Photos'), 5 );
$r = $img->store($uid, $cid, $hash, $filename, 'Contact Photos', 5 );
if($r === false)
$photo_failure = true;
$img->scaleImage(48);
$r = $img->store($uid, $cid, $hash, $filename, t('Contact Photos'), 6 );
$r = $img->store($uid, $cid, $hash, $filename, 'Contact Photos', 6 );
if($r === false)
$photo_failure = true;


+ 2
- 2
include/Scrape.php View File

@ -423,7 +423,7 @@ function probe_url($url) {
$poll = $tapi . '?user_id=' . $tid;
else
$poll = $tapi . '?screen_name=' . $tid;
$profile = 'http://twitter.com/!#/' . $tid;
$profile = 'http://twitter.com/#!/' . $tid;
}
if(! x($vcard,'fn'))
@ -442,7 +442,7 @@ function probe_url($url) {
if(x($feedret,'photo'))
$vcard['photo'] = $feedret['photo'];
require_once('simplepie/simplepie.inc');
require_once('library/simplepie/simplepie.inc');
$feed = new SimplePie();
$xml = fetch_url($poll);


+ 112
- 0
include/acl_selectors.php View File

@ -41,6 +41,115 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) {
}
function contact_selector($selname, $selclass, $preselected = false, $options) {
$a = get_app();
$mutual = false;
$networks = null;
$single = false;
$exclude = false;
$size = 4;
if(is_array($options)) {
if(x($options,'size'))
$size = $options['size'];
if(x($options,'mutual_friends'))
$mutual = true;
if(x($options,'single'))
$single = true;
if(x($options,'multiple'))
$single = false;
if(x($options,'exclude'))
$exclude = $options['exclude'];
if(x($options,'networks')) {
switch($options['networks']) {
case 'DFRN_ONLY':
$networks = array('dfrn');
break;
case 'PRIVATE':
if(is_array($a->user) && $a->user['prvnets'])
$networks = array('dfrn','mail','dspr');
else
$networks = array('dfrn','face','mail', 'dspr');
break;
case 'TWO_WAY':
if(is_array($a->user) && $a->user['prvnets'])
$networks = array('dfrn','mail','dspr');
else
$networks = array('dfrn','face','mail','dspr','stat');
break;
default:
break;
}
}
}
$x = array('options' => $options, 'size' => $size, 'single' => $single, 'mutual' => $mutual, 'exclude' => $exclude, 'networks' => $networks);
call_hooks('contact_select_options', $x);
$o = '';
$sql_extra = '';
if($x['mutual']) {
$sql_extra .= sprintf(" AND `rel` = %d ", intval(REL_BUD));
}
if(intval($x['exclude']))
$sql_extra .= sprintf(" AND `id` != %d ", intval($x['exclude']));
if(is_array($x['networks']) && count($x['networks'])) {
for($y = 0; $y < count($x['networks']) ; $y ++)
$x['networks'][$y] = "'" . dbesc($x['networks'][$y]) . "'";
$str_nets = implode(',',$x['networks']);
$sql_extra .= " AND `network` IN ( $str_nets ) ";
}
if($x['single'])
$o .= "<select name=\"$selname\" id=\"$selclass\" class=\"$selclass\" size=\"" . $x['size'] . "\" >\r\n";
else
$o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"" . $x['size'] . "$\" >\r\n";
$r = q("SELECT `id`, `name`, `url`, `network` FROM `contact`
WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `notify` != ''
$sql_extra
ORDER BY `name` ASC ",
intval(local_user())
);
$arr = array('contact' => $r, 'entry' => $o);
// e.g. 'network_pre_contact_deny', 'profile_pre_contact_allow'
call_hooks($a->module . '_pre_' . $selname, $arr);
if(count($r)) {
foreach($r as $rr) {
if((is_array($preselected)) && in_array($rr['id'], $preselected))
$selected = " selected=\"selected\" ";
else
$selected = '';
$trimmed = mb_substr($rr['name'],0,20);
$o .= "<option value=\"{$rr['id']}\" $selected title=\"{$rr['name']}|{$rr['url']}\" >$trimmed</option>\r\n";
}
}
$o .= "</select>\r\n";
call_hooks($a->module . '_post_' . $selname, $o);
return $o;
}
function contact_select($selname, $selclass, $preselected = false, $size = 4, $privmail = false, $celeb = false, $privatenet = false) {
@ -64,6 +173,8 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
$sql_extra .= " AND `network` IN ( 'dfrn', 'mail', 'face' ) ";
}
if($privmail)
$o .= "<select name=\"$selname\" id=\"$selclass\" class=\"$selclass\" size=\"$size\" >\r\n";
else
@ -104,6 +215,7 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
return $o;
}
function fixacl(&$item) {
$item = intval(str_replace(array('<','>'),array('',''),$item));
}


+ 7
- 2
include/conversation.php View File

@ -177,6 +177,7 @@ function conversation(&$a, $items, $mode, $update) {
$drop = replace_macros($droptpl,array('$id' => $item['id']));
$lock = '<div class="wall-item-lock"></div>';
$star = '';
$body = prepare_body($item,true);
@ -197,6 +198,7 @@ function conversation(&$a, $items, $mode, $update) {
'$owner_url' => $owner_url,
'$owner_photo' => $owner_photo,
'$owner_name' => $owner_name,
'$star' => $star,
'$drop' => $drop,
'$conv' => '<a href="' . $a->get_baseurl() . '/display/' . $nickname . '/' . $item['id'] . '">' . t('View in context') . '</a>'
));
@ -381,8 +383,8 @@ function conversation(&$a, $items, $mode, $update) {
}
$edpost = (((($profile_owner == local_user()) && ($toplevelpost) && (intval($item['wall']) == 1)) || ($mode === 'notes'))
? '<a class="editpost" href="' . $a->get_baseurl() . '/editpost/' . $item['id']
. '" title="' . t('Edit') . '"><img src="images/pencil.gif" /></a>'
? '<a class="editpost icon pencil" href="' . $a->get_baseurl() . '/editpost/' . $item['id']
. '" title="' . t('Edit') . '"></a>'
: '');
@ -394,6 +396,8 @@ function conversation(&$a, $items, $mode, $update) {
$drop = replace_macros((($dropping)? $droptpl : $fakedrop), array('$id' => $item['id'], '$select' => t('Select'), '$delete' => t('Delete')));
$star = (($profile_owner == local_user() && $toplevelpost) ? '<a href="#" id="starred-' . $item['id'] . '" onclick="dostar(' . $item['id'] . '); return false;" class="star-item icon ' . (($item['starred']) ? 'starred' : 'unstarred') . '" title="' . t('toggle star status') . '"></a>' : '');
$photo = $item['photo'];
$thumb = $item['thumb'];
@ -473,6 +477,7 @@ function conversation(&$a, $items, $mode, $update) {
'$owner_name' => $owner_name,
'$plink' => get_plink($item),
'$edpost' => $edpost,
'$star' => $star,
'$drop' => $drop,
'$vote' => $likebuttons,
'$like' => $like,


+ 1
- 1
include/country.js View File

@ -17,7 +17,7 @@ var gArCountryInfo;
var gArStateInfo;
// NOTE:
// Some editors may exhibit problems viewing 2803 characters...
var sCountryString = "|Afghanistan|Albania|Algeria|American Samoa|Angola|Anguilla|Antartica|Antigua and Barbuda|Argentina|Armenia|Aruba|Ashmore and Cartier Island|Australia|Austria|Azerbaijan|Bahamas|Bahrain|Bangladesh|Barbados|Belarus|Belgium|Belize|Benin|Bermuda|Bhutan|Bolivia|Bosnia and Herzegovina|Botswana|Brazil|British Virgin Islands|Brunei|Bulgaria|Burkina Faso|Burma|Burundi|Cambodia|Cameroon|Canada|Cape Verde|Cayman Islands|Central African Republic|Chad|Chile|China|Christmas Island|Clipperton Island|Cocos (Keeling) Islands|Colombia|Comoros|Congo, Democratic Republic of the|Congo, Republic of the|Cook Islands|Costa Rica|Cote d'Ivoire|Croatia|Cuba|Cyprus|Czeck Republic|Denmark|Djibouti|Dominica|Dominican Republic|Ecuador|Egypt|El Salvador|Equatorial Guinea|Eritrea|Estonia|Ethiopia|Europa Island|Falkland Islands (Islas Malvinas)|Faroe Islands|Fiji|Finland|France|French Guiana|French Polynesia|French Southern and Antarctic Lands|Gabon|Gambia, The|Gaza Strip|Georgia|Germany|Ghana|Gibraltar|Glorioso Islands|Greece|Greenland|Grenada|Guadeloupe|Guam|Guatemala|Guernsey|Guinea|Guinea-Bissau|Guyana|Haiti|Heard Island and McDonald Islands|Holy See (Vatican City)|Honduras|Hong Kong|Howland Island|Hungary|Iceland|India|Indonesia|Iran|Iraq|Ireland|Ireland, Northern|Israel|Italy|Jamaica|Jan Mayen|Japan|Jarvis Island|Jersey|Johnston Atoll|Jordan|Juan de Nova Island|Kazakhstan|Kenya|Kiribati|Korea, North|Korea, South|Kuwait|Kyrgyzstan|Laos|Latvia|Lebanon|Lesotho|Liberia|Libya|Liechtenstein|Lithuania|Luxembourg|Macau|Macedonia, Former Yugoslav Republic of|Madagascar|Malawi|Malaysia|Maldives|Mali|Malta|Man, Isle of|Marshall Islands|Martinique|Mauritania|Mauritius|Mayotte|Mexico|Micronesia, Federated States of|Midway Islands|Moldova|Monaco|Mongolia|Montserrat|Morocco|Mozambique|Namibia|Nauru|Nepal|Netherlands|Netherlands Antilles|New Caledonia|New Zealand|Nicaragua|Niger|Nigeria|Niue|Norfolk Island|Northern Mariana Islands|Norway|Oman|Pakistan|Palau|Panama|Papua New Guinea|Paraguay|Peru|Philippines|Pitcaim Islands|Poland|Portugal|Puerto Rico|Qatar|Reunion|Romainia|Russia|Rwanda|Saint Helena|Saint Kitts and Nevis|Saint Lucia|Saint Pierre and Miquelon|Saint Vincent and the Grenadines|Samoa|San Marino|Sao Tome and Principe|Saudi Arabia|Scotland|Senegal|Seychelles|Sierra Leone|Singapore|Slovakia|Slovenia|Solomon Islands|Somalia|South Africa|South Georgia and South Sandwich Islands|Spain|Spratly Islands|Sri Lanka|Sudan|Suriname|Svalbard|Swaziland|Sweden|Switzerland|Syria|Taiwan|Tajikistan|Tanzania|Thailand|Tobago|Toga|Tokelau|Tonga|Trinidad|Tunisia|Turkey|Turkmenistan|Tuvalu|Uganda|Ukraine|United Arab Emirates|United Kingdom|Uruguay|USA|Uzbekistan|Vanuatu|Venezuela|Vietnam|Virgin Islands|Wales|Wallis and Futuna|West Bank|Western Sahara|Yemen|Yugoslavia|Zambia|Zimbabwe";
var sCountryString = "|Afghanistan|Albania|Algeria|American Samoa|Angola|Anguilla|Antartica|Antigua and Barbuda|Argentina|Armenia|Aruba|Ashmore and Cartier Island|Australia|Austria|Azerbaijan|Bahamas|Bahrain|Bangladesh|Barbados|Belarus|Belgium|Belize|Benin|Bermuda|Bhutan|Bolivia|Bosnia and Herzegovina|Botswana|Brazil|British Virgin Islands|Brunei|Bulgaria|Burkina Faso|Burma|Burundi|Cambodia|Cameroon|Canada|Cape Verde|Cayman Islands|Central African Republic|Chad|Chile|China|Christmas Island|Clipperton Island|Cocos (Keeling) Islands|Colombia|Comoros|Congo, Democratic Republic of the|Congo, Republic of the|Cook Islands|Costa Rica|Cote d'Ivoire|Croatia|Cuba|Cyprus|Czech Republic|Denmark|Djibouti|Dominica|Dominican Republic|Ecuador|Egypt|El Salvador|Equatorial Guinea|Eritrea|Estonia|Ethiopia|Europa Island|Falkland Islands (Islas Malvinas)|Faroe Islands|Fiji|Finland|France|French Guiana|French Polynesia|French Southern and Antarctic Lands|Gabon|Gambia, The|Gaza Strip|Georgia|Germany|Ghana|Gibraltar|Glorioso Islands|Greece|Greenland|Grenada|Guadeloupe|Guam|Guatemala|Guernsey|Guinea|Guinea-Bissau|Guyana|Haiti|Heard Island and McDonald Islands|Holy See (Vatican City)|Honduras|Hong Kong|Howland Island|Hungary|Iceland|India|Indonesia|Iran|Iraq|Ireland|Ireland, Northern|Israel|Italy|Jamaica|Jan Mayen|Japan|Jarvis Island|Jersey|Johnston Atoll|Jordan|Juan de Nova Island|Kazakhstan|Kenya|Kiribati|Korea, North|Korea, South|Kuwait|Kyrgyzstan|Laos|Latvia|Lebanon|Lesotho|Liberia|Libya|Liechtenstein|Lithuania|Luxembourg|Macau|Macedonia, Former Yugoslav Republic of|Madagascar|Malawi|Malaysia|Maldives|Mali|Malta|Man, Isle of|Marshall Islands|Martinique|Mauritania|Mauritius|Mayotte|Mexico|Micronesia, Federated States of|Midway Islands|Moldova|Monaco|Mongolia|Montserrat|Morocco|Mozambique|Namibia|Nauru|Nepal|Netherlands|Netherlands Antilles|New Caledonia|New Zealand|Nicaragua|Niger|Nigeria|Niue|Norfolk Island|Northern Mariana Islands|Norway|Oman|Pakistan|Palau|Panama|Papua New Guinea|Paraguay|Peru|Philippines|Pitcaim Islands|Poland|Portugal|Puerto Rico|Qatar|Reunion|Romainia|Russia|Rwanda|Saint Helena|Saint Kitts and Nevis|Saint Lucia|Saint Pierre and Miquelon|Saint Vincent and the Grenadines|Samoa|San Marino|Sao Tome and Principe|Saudi Arabia|Scotland|Senegal|Seychelles|Sierra Leone|Singapore|Slovakia|Slovenia|Solomon Islands|Somalia|South Africa|South Georgia and South Sandwich Islands|Spain|Spratly Islands|Sri Lanka|Sudan|Suriname|Svalbard|Swaziland|Sweden|Switzerland|Syria|Taiwan|Tajikistan|Tanzania|Thailand|Tobago|Toga|Tokelau|Tonga|Trinidad|Tunisia|Turkey|Turkmenistan|Tuvalu|Uganda|Ukraine|United Arab Emirates|United Kingdom|Uruguay|USA|Uzbekistan|Vanuatu|Venezuela|Vietnam|Virgin Islands|Wales|Wallis and Futuna|West Bank|Western Sahara|Yemen|Yugoslavia|Zambia|Zimbabwe";
var aStates = new Array();
aStates[0]="";


+ 13
- 8
include/datetime.php View File

@ -65,9 +65,9 @@ if(! function_exists('datetime_convert')) {
function datetime_convert($from = 'UTC', $to = 'UTC', $s = 'now', $fmt = "Y-m-d H:i:s") {
// Slight hackish adjustment so that 'zero' datetime actually returns what is intended
// otherwise we end up with -0001-11-30 ...
// otherwise we end up with -0001-11-30 ...
// add 32 days so that we at least get year 00, and then hack around the fact that
// months and days always start with 1.
// months and days always start with 1.
if(substr($s,0,10) == '0000-00-00') {
$d = new DateTime($s . ' + 32 days', new DateTimeZone('UTC'));
@ -176,6 +176,11 @@ function relative_date($posted_date) {
$localtime = datetime_convert('UTC',date_default_timezone_get(),$posted_date);
$abs = strtotime($localtime);
if (is_null($posted_date) || $posted_date === '0000-00-00 00:00:00' || $abs === False) {
return t('never');
}
$etime = time() - $abs;
if ($etime < 1) {
@ -183,12 +188,12 @@ function relative_date($posted_date) {
}
$a = array( 12 * 30 * 24 * 60 * 60 => array( t('year'), t('years')),
30 * 24 * 60 * 60 => array( t('month'), t('months')),
7 * 24 * 60 * 60 => array( t('week'), t('weeks')),
24 * 60 * 60 => array( t('day'), t('days')),
60 * 60 => array( t('hour'), t('hours')),
60 => array( t('minute'), t('minutes')),
1 => array( t('second'), t('seconds'))
30 * 24 * 60 * 60 => array( t('month'), t('months')),
7 * 24 * 60 * 60 => array( t('week'), t('weeks')),
24 * 60 * 60 => array( t('day'), t('days')),
60 * 60 => array( t('hour'), t('hours')),
60 => array( t('minute'), t('minutes')),
1 => array( t('second'), t('seconds'))
);
foreach ($a as $secs => $str) {


+ 14
- 10
include/directory.php View File

@ -2,18 +2,22 @@
require_once("boot.php");
function directory_run($argv, $argc){
global $a, $db;
global $a, $db;
if(is_null($a)){
$a = new App;
}
if(is_null($a)) {
$a = new App;
}
if(is_null($db)){
@include(".htconfig.php");
require_once("dba.php");
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
};
if(is_null($db)) {
@include(".htconfig.php");
require_once("dba.php");
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
};
load_config('config');
load_config('system');
if($argc != 2)
return;


+ 26
- 2
include/event.php View File

@ -8,7 +8,7 @@ function format_event_html($ev) {
if(! ((is_array($ev)) && count($ev)))
return '';
$bd_format = t('l F d, Y \@ g A') ; // Friday January 18, 2011 @ 8 AM
$bd_format = t('l F d, Y \@ g:i A') ; // Friday January 18, 2011 @ 8 AM
$o = '<div class="vevent">' . "\r\n";
@ -212,7 +212,29 @@ function event_store($arr) {
$contact = $c[0];
// Existing event being modified
if($arr['id']) {
// has the event actually changed?
$r = q("SELECT * FROM `event` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($arr['id']),
intval($arr['uid'])
);
if((! count($r)) || ($r[0]['edited'] === $arr['edited'])) {
// Nothing has changed. Grab the item id to return.
$r = q("SELECT * FROM `item` WHERE `event-id` = %d AND `uid` = %d LIMIT 1",
intval($arr['id']),
intval($arr['uid'])
);
return((count($r)) ? $r[0]['id'] : 0);
}
// The event changed. Update it.
$r = q("UPDATE `event` SET
`edited` = '%s',
`start` = '%s',
@ -260,7 +282,7 @@ function event_store($arr) {
dbesc($arr['allow_gid']),
dbesc($arr['deny_cid']),
dbesc($arr['deny_gid']),
dbesc(datetime_convert()),
dbesc($arr['edited']),
intval($r[0]['id']),
intval($arr['uid'])
);
@ -272,6 +294,8 @@ function event_store($arr) {
}
else {
// New event. Store it.
$r = q("INSERT INTO `event` ( `uid`,`cid`,`uri`,`created`,`edited`,`start`,`finish`,`desc`,`location`,`type`,
`adjust`,`nofinish`,`allow_cid`,`allow_gid`,`deny_cid`,`deny_gid`)
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s' ) ",


+ 7
- 3
include/expire.php View File

@ -16,12 +16,16 @@ function expire_run($argv, $argc){
unset($db_host, $db_user, $db_pass, $db_data);
};
require_once('session.php');
require_once('datetime.php');
require_once('simplepie/simplepie.inc');
require_once('include/session.php');
require_once('include/datetime.php');
require_once('library/simplepie/simplepie.inc');
require_once('include/items.php');
require_once('include/Contact.php');
load_config('config');
load_config('system');
$a->set_baseurl(get_config('system','url'));


+ 17
- 10
include/group.php View File