Merge branch 'dispy' of github.com:fabrixxm/friendika into dispy
4
.gitignore
vendored
|
@ -1,11 +1,9 @@
|
||||||
favicon.*
|
favicon.*
|
||||||
.htconfig.php
|
.htconfig.php
|
||||||
\#*
|
\#*
|
||||||
wip/*
|
|
||||||
include/jquery-1.4.2.min.js
|
include/jquery-1.4.2.min.js
|
||||||
*.log
|
*.log
|
||||||
*.out
|
*.out
|
||||||
*.version*
|
*.version*
|
||||||
push*
|
favicon.*
|
||||||
langup
|
|
||||||
home.html
|
home.html
|
||||||
|
|
|
@ -9,12 +9,13 @@ Deny from all
|
||||||
<IfModule mod_rewrite.c>
|
<IfModule mod_rewrite.c>
|
||||||
RewriteEngine on
|
RewriteEngine on
|
||||||
|
|
||||||
# RewriteRule api.* - [E=REMOTE_USER:%{HTTP:Authorization},L]
|
# Protect repository directory from browsing
|
||||||
|
|
||||||
# Protect repo directory from browsing
|
|
||||||
RewriteRule "(^|/)\.git" - [F]
|
RewriteRule "(^|/)\.git" - [F]
|
||||||
|
|
||||||
# Rewrite current-style URLs of the form 'index.php?q=x'.
|
# 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} !-f
|
||||||
RewriteCond %{REQUEST_FILENAME} !-d
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
RewriteRule ^(.*)$ index.php?q=$1 [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
|
RewriteRule ^(.*)$ index.php?q=$1 [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
|
||||||
|
|
92
INSTALL.txt
|
@ -113,3 +113,95 @@ $a->config['system']['addon'] = 'js_upload,poormancron';
|
||||||
|
|
||||||
and save your changes.
|
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
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,25 @@
|
||||||
|
|
||||||
define('FACEBOOK_MAXPOSTLEN', 420);
|
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 */
|
/* declare the facebook_module function so that /facebook url requests will land here */
|
||||||
|
|
||||||
function facebook_module() {}
|
function facebook_module() {}
|
||||||
|
@ -339,22 +358,6 @@ function facebook_content(&$a) {
|
||||||
return $o;
|
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) {
|
function facebook_cron($a,$b) {
|
||||||
|
@ -373,9 +376,12 @@ function facebook_cron($a,$b) {
|
||||||
|
|
||||||
logger('facebook_cron');
|
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)) {
|
if(count($r)) {
|
||||||
foreach($r as $rr) {
|
foreach($r as $rr) {
|
||||||
// check for new friends once a day
|
// check for new friends once a day
|
||||||
|
@ -389,6 +395,9 @@ function facebook_cron($a,$b) {
|
||||||
fb_consume_all($rr['uid']);
|
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'])) {
|
if((local_user()) && (local_user() == $b['uid'])) {
|
||||||
|
|
||||||
|
// Facebook is not considered a private network
|
||||||
|
if($b['prvnets'] && $b['private'])
|
||||||
|
return;
|
||||||
|
|
||||||
if($b['parent']) {
|
if($b['parent']) {
|
||||||
$r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
$r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||||
intval($b['parent']),
|
intval($b['parent']),
|
||||||
|
@ -817,7 +830,7 @@ function fb_consume_stream($uid,$j,$wall = false) {
|
||||||
$datarray['owner-avatar'] = $self[0]['thumb'];
|
$datarray['owner-avatar'] = $self[0]['thumb'];
|
||||||
}
|
}
|
||||||
if(isset($entry->application) && isset($entry->application->name) && strlen($entry->application->name))
|
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
|
else
|
||||||
$datarray['app'] = 'facebook';
|
$datarray['app'] = 'facebook';
|
||||||
$datarray['author-name'] = $from->name;
|
$datarray['author-name'] = $from->name;
|
||||||
|
|
|
@ -25,9 +25,9 @@ function oembed_uninstall() {
|
||||||
function oembed_settings_post($a,$b){
|
function oembed_settings_post($a,$b){
|
||||||
if(! local_user())
|
if(! local_user())
|
||||||
return;
|
return;
|
||||||
if (isset($_POST['oembed-submit'])){
|
if (x($_POST,'oembed-submit')){
|
||||||
set_pconfig(local_user(), 'oembed', 'use_for_youtube', (isset($_POST['oembed_use_for_youtube'])? intval($_POST['oembed_use_for_youtube']):0));
|
set_pconfig(local_user(), 'oembed', 'use_for_youtube', (x($_POST,'oembed_use_for_youtube')? intval($_POST['oembed_use_for_youtube']):0));
|
||||||
notice( t('OEmbed settings updated') . EOL);
|
info( t('OEmbed settings updated') . EOL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,21 +36,13 @@ function oembed_settings(&$a,&$o) {
|
||||||
return;
|
return;
|
||||||
$uofy = intval(get_pconfig(local_user(), 'oembed', 'use_for_youtube' ));
|
$uofy = intval(get_pconfig(local_user(), 'oembed', 'use_for_youtube' ));
|
||||||
|
|
||||||
$o.='
|
$t = file_get_contents( dirname(__file__). "/settings.tpl" );
|
||||||
<div class="settings-block">
|
$o .= replace_macros($t, array(
|
||||||
<h3 class="settings-heading">OEmbed</h3>
|
'$submit' => t('Submit'),
|
||||||
<div id="settings-username-wrapper">
|
'$title' => "OEmbed",
|
||||||
<label for="oembed_use_for_youtube">'
|
'$useoembed' => array('oembed_use_for_youtube', t('Use OEmbed for YouTube videos'), $uofy, ""),
|
||||||
.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>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
7
addon/oembed/settings.tpl
Normal 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
addon/piwik/admin.tpl
Normal 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>
|
|
@ -18,10 +18,10 @@
|
||||||
* Add the following two lines to your .htconfig.php file:
|
* Add the following two lines to your .htconfig.php file:
|
||||||
*
|
*
|
||||||
* $a->config['piwik']['baseurl'] = 'www.example.com/piwik/';
|
* $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
|
* $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
|
* 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
|
* about http/https but beware to put the trailing / at the end of your
|
||||||
* setting.
|
* setting.
|
||||||
|
@ -54,13 +54,13 @@ function piwik_analytics($a,&$b) {
|
||||||
* Get the configuration variables from the .htconfig file.
|
* Get the configuration variables from the .htconfig file.
|
||||||
*/
|
*/
|
||||||
$baseurl = get_config('piwik','baseurl');
|
$baseurl = get_config('piwik','baseurl');
|
||||||
$sideod = get_config('piwik','sideid');
|
$siteid = get_config('piwik','siteid');
|
||||||
$optout = get_config('piwik','optout');
|
$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
|
* If the optout variable is set to true then display the notice
|
||||||
* otherwise just include the above code into the page.
|
* 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);
|
||||||
|
}
|
||||||
|
|
|
@ -89,6 +89,9 @@ function statusnet_jot_nets(&$a,&$b) {
|
||||||
function statusnet_settings_post ($a,$post) {
|
function statusnet_settings_post ($a,$post) {
|
||||||
if(! local_user())
|
if(! local_user())
|
||||||
return;
|
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 (isset($_POST['statusnet-disconnect'])) {
|
||||||
/***
|
/***
|
||||||
* if the statusnet-disconnect checkbox is set, clear the statusnet configuration
|
* if the statusnet-disconnect checkbox is set, clear the statusnet configuration
|
||||||
|
@ -217,7 +220,7 @@ function statusnet_settings(&$a,&$s) {
|
||||||
$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 .= '<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 .= '<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>';
|
$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 .= '<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 .= '<input id="statusnet-baseapi" type="text" name="statusnet-baseapi" size="35" /><br />';
|
||||||
$s .= '<p></p><div class="clear"></div></div>';
|
$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 {
|
} else {
|
||||||
/***
|
/***
|
||||||
* ok we have a consumer key pair now look into the OAuth stuff
|
* ok we have a consumer key pair now look into the OAuth stuff
|
||||||
|
@ -264,7 +267,7 @@ function statusnet_settings(&$a,&$s) {
|
||||||
$s .= '<label id="statusnet-cancel-label" for="statusnet-cancel">'. t('Cancel StatusNet Connection') . '</label>';
|
$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 .= '<input id="statusnet-cancel" type="checkbox" name="statusnet-disconnect" value="1" />';
|
||||||
$s .= '</div><div class="clear"></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 .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . t('Submit') . '" /></div>';
|
||||||
} else {
|
} else {
|
||||||
/***
|
/***
|
||||||
* we have an OAuth key / secret pair for the user
|
* 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 .= '<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 .= '<input id="statusnet-disconnect" type="checkbox" name="statusnet-disconnect" value="1" />';
|
||||||
$s .= '</div><div class="clear"></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 .= '<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>';
|
$s .= '</div><div class="clear"></div></div>';
|
||||||
|
@ -303,6 +306,10 @@ function statusnet_post_hook(&$a,&$b) {
|
||||||
|
|
||||||
if((local_user()) && (local_user() == $b['uid']) && (! $b['private']) && (!$b['parent']) ) {
|
if((local_user()) && (local_user() == $b['uid']) && (! $b['private']) && (!$b['parent']) ) {
|
||||||
|
|
||||||
|
// Status.Net is not considered a private network
|
||||||
|
if($b['prvnets'])
|
||||||
|
return;
|
||||||
|
|
||||||
load_pconfig(local_user(), 'statusnet');
|
load_pconfig(local_user(), 'statusnet');
|
||||||
|
|
||||||
$api = get_pconfig(local_user(), 'statusnet', 'baseapi');
|
$api = get_pconfig(local_user(), 'statusnet', 'baseapi');
|
||||||
|
|
|
@ -76,6 +76,9 @@ function twitter_jot_nets(&$a,&$b) {
|
||||||
function twitter_settings_post ($a,$post) {
|
function twitter_settings_post ($a,$post) {
|
||||||
if(! local_user())
|
if(! local_user())
|
||||||
return;
|
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 (isset($_POST['twitter-disconnect'])) {
|
||||||
/***
|
/***
|
||||||
* if the twitter-disconnect checkbox is set, clear the OAuth key/secret pair
|
* 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-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 .= '<input id="twitter-token2" type="hidden" name="twitter-token2" value="'.$request_token['oauth_token_secret'].'" />';
|
||||||
$s .= '</div><div class="clear"></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 .= '<div class="settings-submit-wrapper" ><input type="submit" name="twitter-submit" class="settings-submit" value="' . t('Submit') . '" /></div>';
|
||||||
} else {
|
} else {
|
||||||
/***
|
/***
|
||||||
* we have an OAuth key / secret pair for the user
|
* 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 .= '<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 .= '<input id="twitter-disconnect" type="checkbox" name="twitter-disconnect" value="1" />';
|
||||||
$s .= '</div><div class="clear"></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 .= '<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>';
|
$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']) ) {
|
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');
|
load_pconfig(local_user(), 'twitter');
|
||||||
|
|
||||||
$ckey = get_config('twitter', 'consumerkey' );
|
$ckey = get_config('twitter', 'consumerkey' );
|
||||||
|
|
19
addon/widgets/settings.tpl
Normal 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>
|
|
@ -34,32 +34,30 @@ function widgets_settings(&$a,&$o) {
|
||||||
$key = get_pconfig(local_user(), 'widgets', 'key' );
|
$key = get_pconfig(local_user(), 'widgets', 'key' );
|
||||||
if ($key=='') { $key = mt_rand(); set_pconfig(local_user(), 'widgets', 'key', $key); }
|
if ($key=='') { $key = mt_rand(); set_pconfig(local_user(), 'widgets', 'key', $key); }
|
||||||
|
|
||||||
$o .='<h3 class="settings-heading">Widgets</h3>';
|
$widgets = array();
|
||||||
|
|
||||||
|
|
||||||
$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>';
|
|
||||||
$d = dir(dirname(__file__));
|
$d = dir(dirname(__file__));
|
||||||
while(false !== ($f = $d->read())) {
|
while(false !== ($f = $d->read())) {
|
||||||
if(substr($f,0,7)=="widget_") {
|
if(substr($f,0,7)=="widget_") {
|
||||||
preg_match("|widget_([^.]+).php|", $f, $m);
|
preg_match("|widget_([^.]+).php|", $f, $m);
|
||||||
$w=$m[1];
|
$w=$m[1];
|
||||||
require_once($f);
|
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,
|
||||||
|
));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
111
boot.php
|
@ -4,9 +4,9 @@ set_time_limit(0);
|
||||||
ini_set('pcre.backtrack_limit', 250000);
|
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 ( 'DFRN_PROTOCOL_VERSION', '2.21' );
|
||||||
define ( 'DB_UPDATE_VERSION', 1066 );
|
define ( 'DB_UPDATE_VERSION', 1073 );
|
||||||
|
|
||||||
define ( 'EOL', "<br />\r\n" );
|
define ( 'EOL', "<br />\r\n" );
|
||||||
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
|
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
|
||||||
|
@ -56,9 +56,9 @@ define ( 'REGISTER_OPEN', 2 );
|
||||||
* this relationship with contact['name']
|
* this relationship with contact['name']
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define ( 'REL_VIP', 1);
|
define ( 'REL_VIP', 1); // other person is 'following' us
|
||||||
define ( 'REL_FAN', 2);
|
define ( 'REL_FAN', 2); // we are 'following' other person
|
||||||
define ( 'REL_BUD', 3);
|
define ( 'REL_BUD', 3); // mutual relationship
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hook array order
|
* Hook array order
|
||||||
|
@ -296,6 +296,8 @@ class App {
|
||||||
$this->module = str_replace(".", "_", $this->argv[0]);
|
$this->module = str_replace(".", "_", $this->argv[0]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
$this->argc = 1;
|
||||||
|
$this->argv = array('home');
|
||||||
$this->module = 'home';
|
$this->module = 'home';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -498,9 +500,6 @@ function install_plugin($plugin){
|
||||||
if(! function_exists('check_config')) {
|
if(! function_exists('check_config')) {
|
||||||
function check_config(&$a) {
|
function check_config(&$a) {
|
||||||
|
|
||||||
|
|
||||||
load_config('system');
|
|
||||||
|
|
||||||
$build = get_config('system','build');
|
$build = get_config('system','build');
|
||||||
if(! x($build))
|
if(! x($build))
|
||||||
$build = set_config('system','build',DB_UPDATE_VERSION);
|
$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_HEADER, true);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
|
||||||
|
curl_setopt($ch, CURLOPT_USERAGENT, "Friendika");
|
||||||
|
|
||||||
$curl_time = intval(get_config('system','curl_timeout'));
|
$curl_time = intval(get_config('system','curl_timeout'));
|
||||||
curl_setopt($ch, CURLOPT_TIMEOUT, (($curl_time !== false) ? $curl_time : 60));
|
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);
|
$s = @curl_exec($ch);
|
||||||
|
|
||||||
$http_code = intval(curl_getinfo($ch, CURLINFO_HTTP_CODE));
|
$base = $s;
|
||||||
$header = substr($s,0,strpos($s,"\r\n\r\n"));
|
$curl_info = curl_getinfo($ch);
|
||||||
if(stristr($header,'100') && (strlen($header) < 30)) {
|
$http_code = $curl_info['http_code'];
|
||||||
// 100 Continue has two headers, get the real one
|
|
||||||
$s = substr($s,strlen($header)+4);
|
$header = '';
|
||||||
$header = substr($s,0,strpos($s,"\r\n\r\n"));
|
|
||||||
|
// 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) {
|
if($http_code == 301 || $http_code == 302 || $http_code == 303 || $http_code == 307) {
|
||||||
$matches = array();
|
$matches = array();
|
||||||
preg_match('/(Location:|URI:)(.*?)\n/', $header, $matches);
|
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);
|
return fetch_url($url,$binary,$redirects);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$a->set_curl_code($http_code);
|
$a->set_curl_code($http_code);
|
||||||
|
|
||||||
$body = substr($s,strlen($header)+4);
|
$body = substr($s,strlen($header));
|
||||||
|
|
||||||
/* 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
$a->set_curl_headers($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_RETURNTRANSFER,true);
|
||||||
curl_setopt($ch, CURLOPT_POST,1);
|
curl_setopt($ch, CURLOPT_POST,1);
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
|
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
|
||||||
|
curl_setopt($ch, CURLOPT_USERAGENT, "Friendika");
|
||||||
|
|
||||||
$curl_time = intval(get_config('system','curl_timeout'));
|
$curl_time = intval(get_config('system','curl_timeout'));
|
||||||
curl_setopt($ch, CURLOPT_TIMEOUT, (($curl_time !== false) ? $curl_time : 60));
|
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);
|
$s = @curl_exec($ch);
|
||||||
|
|
||||||
$http_code = intval(curl_getinfo($ch, CURLINFO_HTTP_CODE));
|
$base = $s;
|
||||||
$header = substr($s,0,strpos($s,"\r\n\r\n"));
|
$curl_info = curl_getinfo($ch);
|
||||||
if(stristr($header,'100') && (strlen($header) < 30)) {
|
$http_code = $curl_info['http_code'];
|
||||||
// 100 Continue has two headers, get the real one
|
|
||||||
$s = substr($s,strlen($header)+4);
|
$header = '';
|
||||||
$header = substr($s,0,strpos($s,"\r\n\r\n"));
|
|
||||||
|
// 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) {
|
if($http_code == 301 || $http_code == 302 || $http_code == 303) {
|
||||||
$matches = array();
|
$matches = array();
|
||||||
preg_match('/(Location:|URI:)(.*?)\n/', $header, $matches);
|
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);
|
$a->set_curl_code($http_code);
|
||||||
$body = substr($s,strlen($header)+4);
|
$body = substr($s,strlen($header));
|
||||||
|
|
||||||
/* 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
$a->set_curl_headers($header);
|
$a->set_curl_headers($header);
|
||||||
|
|
||||||
|
@ -1218,9 +1221,13 @@ function load_config($family) {
|
||||||
if(count($r)) {
|
if(count($r)) {
|
||||||
foreach($r as $rr) {
|
foreach($r as $rr) {
|
||||||
$k = $rr['k'];
|
$k = $rr['k'];
|
||||||
|
if ($rr['cat'] === 'config') {
|
||||||
|
$a->config[$k] = $rr['v'];
|
||||||
|
} else {
|
||||||
$a->config[$family][$k] = $rr['v'];
|
$a->config[$family][$k] = $rr['v'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
|
|
||||||
// get a particular config variable given the family name
|
// get a particular config variable given the family name
|
||||||
|
@ -1685,8 +1692,10 @@ function fetch_lrdd_template($host) {
|
||||||
$url1 = 'https://' . $host . '/.well-known/host-meta' ;
|
$url1 = 'https://' . $host . '/.well-known/host-meta' ;
|
||||||
$url2 = 'http://' . $host . '/.well-known/host-meta' ;
|
$url2 = 'http://' . $host . '/.well-known/host-meta' ;
|
||||||
$links = fetch_xrd_links($url1);
|
$links = fetch_xrd_links($url1);
|
||||||
|
logger('fetch_lrdd_template from: ' . $url1);
|
||||||
logger('template (https): ' . print_r($links,true));
|
logger('template (https): ' . print_r($links,true));
|
||||||
if(! count($links)) {
|
if(! count($links)) {
|
||||||
|
logger('fetch_lrdd_template from: ' . $url2);
|
||||||
$links = fetch_xrd_links($url2);
|
$links = fetch_xrd_links($url2);
|
||||||
logger('template (http): ' . print_r($links,true));
|
logger('template (http): ' . print_r($links,true));
|
||||||
}
|
}
|
||||||
|
@ -2015,7 +2024,7 @@ function get_tags($s) {
|
||||||
|
|
||||||
$s = preg_replace('/\[code\](.*?)\[\/code\]/sm','',$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) {
|
foreach($match[1] as $mtch) {
|
||||||
if(strstr($mtch,"]")) {
|
if(strstr($mtch,"]")) {
|
||||||
// we might be inside a bbcode color tag - leave it alone
|
// 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;
|
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);
|
call_hooks('profile_sidebar', $arr);
|
||||||
|
|
||||||
|
@ -2891,3 +2912,15 @@ function get_plugin_info($plugin){
|
||||||
}
|
}
|
||||||
return $info;
|
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;
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
|
35
database.sql
|
@ -169,9 +169,10 @@ CREATE TABLE IF NOT EXISTS `item` (
|
||||||
`parent-uri` char(255) NOT NULL,
|
`parent-uri` char(255) NOT NULL,
|
||||||
`extid` char(255) NOT NULL,
|
`extid` char(255) NOT NULL,
|
||||||
`thr-parent` char(255) NOT NULL,
|
`thr-parent` char(255) NOT NULL,
|
||||||
`created` datetime NOT NULL,
|
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
`edited` datetime NOT NULL,
|
`edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
`changed` datetime NOT NULL,
|
`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-name` char(255) NOT NULL,
|
||||||
`owner-link` char(255) NOT NULL,
|
`owner-link` char(255) NOT NULL,
|
||||||
`owner-avatar` 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',
|
`private` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
`pubmail` tinyint(1) NOT NULL DEFAULT '0',
|
`pubmail` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
`visible` 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',
|
`unseen` tinyint(1) NOT NULL DEFAULT '1',
|
||||||
`deleted` tinyint(1) NOT NULL DEFAULT '0',
|
`deleted` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
`last-child` tinyint(1) unsigned NOT NULL DEFAULT '1',
|
`last-child` tinyint(1) unsigned NOT NULL DEFAULT '1',
|
||||||
|
@ -215,7 +217,9 @@ CREATE TABLE IF NOT EXISTS `item` (
|
||||||
KEY `extid` (`extid`),
|
KEY `extid` (`extid`),
|
||||||
KEY `created` (`created`),
|
KEY `created` (`created`),
|
||||||
KEY `edited` (`edited`),
|
KEY `edited` (`edited`),
|
||||||
|
KEY `received` (`received`),
|
||||||
KEY `visible` (`visible`),
|
KEY `visible` (`visible`),
|
||||||
|
KEY `starred` (`starred`),
|
||||||
KEY `deleted` (`deleted`),
|
KEY `deleted` (`deleted`),
|
||||||
KEY `last-child` (`last-child`),
|
KEY `last-child` (`last-child`),
|
||||||
KEY `unseen` (`unseen`),
|
KEY `unseen` (`unseen`),
|
||||||
|
@ -241,7 +245,7 @@ CREATE TABLE IF NOT EXISTS `mail` (
|
||||||
`from-url` char(255) NOT NULL,
|
`from-url` char(255) NOT NULL,
|
||||||
`contact-id` char(255) NOT NULL,
|
`contact-id` char(255) NOT NULL,
|
||||||
`title` char(255) NOT NULL,
|
`title` char(255) NOT NULL,
|
||||||
`body` text NOT NULL,
|
`body` mediumtext NOT NULL,
|
||||||
`seen` tinyint(1) NOT NULL,
|
`seen` tinyint(1) NOT NULL,
|
||||||
`replied` tinyint(1) NOT NULL,
|
`replied` tinyint(1) NOT NULL,
|
||||||
`uri` char(255) NOT NULL,
|
`uri` char(255) NOT NULL,
|
||||||
|
@ -276,7 +280,12 @@ CREATE TABLE IF NOT EXISTS `photo` (
|
||||||
`allow_gid` mediumtext NOT NULL,
|
`allow_gid` mediumtext NOT NULL,
|
||||||
`deny_cid` mediumtext NOT NULL,
|
`deny_cid` mediumtext NOT NULL,
|
||||||
`deny_gid` 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;
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
|
@ -507,7 +516,8 @@ CREATE TABLE IF NOT EXISTS `fcontact` (
|
||||||
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
|
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
|
||||||
`url` CHAR( 255 ) NOT NULL ,
|
`url` CHAR( 255 ) NOT NULL ,
|
||||||
`name` 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;
|
) ENGINE = MYISAM DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `ffinder` (
|
CREATE TABLE IF NOT EXISTS `ffinder` (
|
||||||
|
@ -518,6 +528,19 @@ CREATE TABLE IF NOT EXISTS `ffinder` (
|
||||||
) ENGINE = MYISAM DEFAULT CHARSET=utf8;
|
) 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` (
|
CREATE TABLE IF NOT EXISTS `mailacct` (
|
||||||
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
|
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
|
||||||
`uid` INT NOT NULL,
|
`uid` INT NOT NULL,
|
||||||
|
|
BIN
images/icons.png
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 12 KiB |
|
@ -230,21 +230,21 @@ function import_profile_photo($photo,$uid,$cid) {
|
||||||
|
|
||||||
$hash = photo_new_resource();
|
$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)
|
if($r === false)
|
||||||
$photo_failure = true;
|
$photo_failure = true;
|
||||||
|
|
||||||
$img->scaleImage(80);
|
$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)
|
if($r === false)
|
||||||
$photo_failure = true;
|
$photo_failure = true;
|
||||||
|
|
||||||
$img->scaleImage(48);
|
$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)
|
if($r === false)
|
||||||
$photo_failure = true;
|
$photo_failure = true;
|
||||||
|
|
|
@ -423,7 +423,7 @@ function probe_url($url) {
|
||||||
$poll = $tapi . '?user_id=' . $tid;
|
$poll = $tapi . '?user_id=' . $tid;
|
||||||
else
|
else
|
||||||
$poll = $tapi . '?screen_name=' . $tid;
|
$poll = $tapi . '?screen_name=' . $tid;
|
||||||
$profile = 'http://twitter.com/!#/' . $tid;
|
$profile = 'http://twitter.com/#!/' . $tid;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(! x($vcard,'fn'))
|
if(! x($vcard,'fn'))
|
||||||
|
@ -442,7 +442,7 @@ function probe_url($url) {
|
||||||
|
|
||||||
if(x($feedret,'photo'))
|
if(x($feedret,'photo'))
|
||||||
$vcard['photo'] = $feedret['photo'];
|
$vcard['photo'] = $feedret['photo'];
|
||||||
require_once('simplepie/simplepie.inc');
|
require_once('library/simplepie/simplepie.inc');
|
||||||
$feed = new SimplePie();
|
$feed = new SimplePie();
|
||||||
$xml = fetch_url($poll);
|
$xml = fetch_url($poll);
|
||||||
|
|
||||||
|
|
|
@ -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) {
|
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' ) ";
|
$sql_extra .= " AND `network` IN ( 'dfrn', 'mail', 'face' ) ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if($privmail)
|
if($privmail)
|
||||||
$o .= "<select name=\"$selname\" id=\"$selclass\" class=\"$selclass\" size=\"$size\" >\r\n";
|
$o .= "<select name=\"$selname\" id=\"$selclass\" class=\"$selclass\" size=\"$size\" >\r\n";
|
||||||
else
|
else
|
||||||
|
@ -104,6 +215,7 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function fixacl(&$item) {
|
function fixacl(&$item) {
|
||||||
$item = intval(str_replace(array('<','>'),array('',''),$item));
|
$item = intval(str_replace(array('<','>'),array('',''),$item));
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,6 +177,7 @@ function conversation(&$a, $items, $mode, $update) {
|
||||||
|
|
||||||
$drop = replace_macros($droptpl,array('$id' => $item['id']));
|
$drop = replace_macros($droptpl,array('$id' => $item['id']));
|
||||||
$lock = '<div class="wall-item-lock"></div>';
|
$lock = '<div class="wall-item-lock"></div>';
|
||||||
|
$star = '';
|
||||||
|
|
||||||
$body = prepare_body($item,true);
|
$body = prepare_body($item,true);
|
||||||
|
|
||||||
|
@ -197,6 +198,7 @@ function conversation(&$a, $items, $mode, $update) {
|
||||||
'$owner_url' => $owner_url,
|
'$owner_url' => $owner_url,
|
||||||
'$owner_photo' => $owner_photo,
|
'$owner_photo' => $owner_photo,
|
||||||
'$owner_name' => $owner_name,
|
'$owner_name' => $owner_name,
|
||||||
|
'$star' => $star,
|
||||||
'$drop' => $drop,
|
'$drop' => $drop,
|
||||||
'$conv' => '<a href="' . $a->get_baseurl() . '/display/' . $nickname . '/' . $item['id'] . '">' . t('View in context') . '</a>'
|
'$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'))
|
$edpost = (((($profile_owner == local_user()) && ($toplevelpost) && (intval($item['wall']) == 1)) || ($mode === 'notes'))
|
||||||
? '<a class="editpost" href="' . $a->get_baseurl() . '/editpost/' . $item['id']
|
? '<a class="editpost icon pencil" href="' . $a->get_baseurl() . '/editpost/' . $item['id']
|
||||||
. '" title="' . t('Edit') . '"><img src="images/pencil.gif" /></a>'
|
. '" 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')));
|
$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'];
|
$photo = $item['photo'];
|
||||||
$thumb = $item['thumb'];
|
$thumb = $item['thumb'];
|
||||||
|
@ -473,6 +477,7 @@ function conversation(&$a, $items, $mode, $update) {
|
||||||
'$owner_name' => $owner_name,
|
'$owner_name' => $owner_name,
|
||||||
'$plink' => get_plink($item),
|
'$plink' => get_plink($item),
|
||||||
'$edpost' => $edpost,
|
'$edpost' => $edpost,
|
||||||
|
'$star' => $star,
|
||||||
'$drop' => $drop,
|
'$drop' => $drop,
|
||||||
'$vote' => $likebuttons,
|
'$vote' => $likebuttons,
|
||||||
'$like' => $like,
|
'$like' => $like,
|
||||||
|
|
|
@ -17,7 +17,7 @@ var gArCountryInfo;
|
||||||
var gArStateInfo;
|
var gArStateInfo;
|
||||||
// NOTE:
|
// NOTE:
|
||||||
// Some editors may exhibit problems viewing 2803 characters...
|
// 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();
|
var aStates = new Array();
|
||||||
|
|
||||||
aStates[0]="";
|
aStates[0]="";
|
||||||
|
|
|
@ -176,6 +176,11 @@ function relative_date($posted_date) {
|
||||||
$localtime = datetime_convert('UTC',date_default_timezone_get(),$posted_date);
|
$localtime = datetime_convert('UTC',date_default_timezone_get(),$posted_date);
|
||||||
|
|
||||||
$abs = strtotime($localtime);
|
$abs = strtotime($localtime);
|
||||||
|
|
||||||
|
if (is_null($posted_date) || $posted_date === '0000-00-00 00:00:00' || $abs === False) {
|
||||||
|
return t('never');
|
||||||
|
}
|
||||||
|
|
||||||
$etime = time() - $abs;
|
$etime = time() - $abs;
|
||||||
|
|
||||||
if ($etime < 1) {
|
if ($etime < 1) {
|
||||||
|
|
|
@ -4,17 +4,21 @@ require_once("boot.php");
|
||||||
function directory_run($argv, $argc){
|
function directory_run($argv, $argc){
|
||||||
global $a, $db;
|
global $a, $db;
|
||||||
|
|
||||||
if(is_null($a)){
|
if(is_null($a)) {
|
||||||
$a = new App;
|
$a = new App;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_null($db)){
|
if(is_null($db)) {
|
||||||
@include(".htconfig.php");
|
@include(".htconfig.php");
|
||||||
require_once("dba.php");
|
require_once("dba.php");
|
||||||
$db = new dba($db_host, $db_user, $db_pass, $db_data);
|
$db = new dba($db_host, $db_user, $db_pass, $db_data);
|
||||||
unset($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)
|
if($argc != 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ function format_event_html($ev) {
|
||||||
if(! ((is_array($ev)) && count($ev)))
|
if(! ((is_array($ev)) && count($ev)))
|
||||||
return '';
|
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";
|
$o = '<div class="vevent">' . "\r\n";
|
||||||
|
|
||||||
|
@ -212,7 +212,29 @@ function event_store($arr) {
|
||||||
$contact = $c[0];
|
$contact = $c[0];
|
||||||
|
|
||||||
|
|
||||||
|
// Existing event being modified
|
||||||
|
|
||||||
if($arr['id']) {
|
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
|
$r = q("UPDATE `event` SET
|
||||||
`edited` = '%s',
|
`edited` = '%s',
|
||||||
`start` = '%s',
|
`start` = '%s',
|
||||||
|
@ -260,7 +282,7 @@ function event_store($arr) {
|
||||||
dbesc($arr['allow_gid']),
|
dbesc($arr['allow_gid']),
|
||||||
dbesc($arr['deny_cid']),
|
dbesc($arr['deny_cid']),
|
||||||
dbesc($arr['deny_gid']),
|
dbesc($arr['deny_gid']),
|
||||||
dbesc(datetime_convert()),
|
dbesc($arr['edited']),
|
||||||
intval($r[0]['id']),
|
intval($r[0]['id']),
|
||||||
intval($arr['uid'])
|
intval($arr['uid'])
|
||||||
);
|
);
|
||||||
|
@ -272,6 +294,8 @@ function event_store($arr) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
// New event. Store it.
|
||||||
|
|
||||||
$r = q("INSERT INTO `event` ( `uid`,`cid`,`uri`,`created`,`edited`,`start`,`finish`,`desc`,`location`,`type`,
|
$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`)
|
`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' ) ",
|
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s' ) ",
|
||||||
|
|
|
@ -16,12 +16,16 @@ function expire_run($argv, $argc){
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
unset($db_host, $db_user, $db_pass, $db_data);
|
||||||
};
|
};
|
||||||
|
|
||||||
require_once('session.php');
|
require_once('include/session.php');
|
||||||
require_once('datetime.php');
|
require_once('include/datetime.php');
|
||||||
require_once('simplepie/simplepie.inc');
|
require_once('library/simplepie/simplepie.inc');
|
||||||
require_once('include/items.php');
|
require_once('include/items.php');
|
||||||
require_once('include/Contact.php');
|
require_once('include/Contact.php');
|
||||||
|
|
||||||
|
load_config('config');
|
||||||
|
load_config('system');
|
||||||
|
|
||||||
|
|
||||||
$a->set_baseurl(get_config('system','url'));
|
$a->set_baseurl(get_config('system','url'));
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,7 @@ function group_public_members($gid) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function group_side($every="contacts",$each="group",$edit = false) {
|
function group_side($every="contacts",$each="group",$edit = false, $group_id = 0) {
|
||||||
|
|
||||||
$o = '';
|
$o = '';
|
||||||
|
|
||||||
|
@ -145,19 +145,15 @@ function group_side($every="contacts",$each="group",$edit = false) {
|
||||||
|
|
||||||
$createtext = t('Create a new group');
|
$createtext = t('Create a new group');
|
||||||
$linktext= t('Everybody');
|
$linktext= t('Everybody');
|
||||||
|
$selected = (($group_id == 0) ? ' class="group-selected" ' : '');
|
||||||
$o .= <<< EOT
|
$o .= <<< EOT
|
||||||
|
|
||||||
<div id="group-sidebar">
|
<div id="group-sidebar">
|
||||||
<h3>Groups</h3>
|
<h3>Groups</h3>
|
||||||
|
|
||||||
<div id="sidebar-new-group">
|
|
||||||
<a href="group/new">$createtext</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="sidebar-group-list">
|
<div id="sidebar-group-list">
|
||||||
<ul id="sidebar-group-ul">
|
<ul id="sidebar-group-ul">
|
||||||
<li class="sidebar-group-li" ><a href="$every" >$linktext</a></li>
|
<li class="sidebar-group-li" ><a href="$every" $selected >$linktext</a></li>
|
||||||
|
|
||||||
EOT;
|
EOT;
|
||||||
|
|
||||||
|
@ -165,10 +161,21 @@ EOT;
|
||||||
intval($_SESSION['uid'])
|
intval($_SESSION['uid'])
|
||||||
);
|
);
|
||||||
if(count($r)) {
|
if(count($r)) {
|
||||||
foreach($r as $rr)
|
foreach($r as $rr) {
|
||||||
$o .= ' <li class="sidebar-group-li">' . (($edit) ? "<a href=\"group/{$rr['id']}\" title=\"" . t('Edit') . "\" ><img src=\"images/spencil.gif\" alt=\"" . t('Edit') . "\"></a> " : "") . "<a href=\"$each/{$rr['id']}\">{$rr['name']}</a></li>\r\n";
|
$selected = (($group_id == $rr['id']) ? ' class="group-selected" ' : '');
|
||||||
|
$o .= ' <li class="sidebar-group-li">' . (($edit) ? "<a href=\"group/{$rr['id']}\" title=\"" . t('Edit') . "\" ><img src=\"images/spencil.gif\" alt=\"" . t('Edit') . "\"></a> " : "") . "<a href=\"$each/{$rr['id']}\" $selected >{$rr['name']}</a></li>\r\n";
|
||||||
}
|
}
|
||||||
$o .= " </ul>\r\n </div>\r\n</div>";
|
}
|
||||||
|
$o .= " </ul>\r\n </div>";
|
||||||
|
|
||||||
|
$o .= <<< EOT
|
||||||
|
|
||||||
|
<div id="sidebar-new-group">
|
||||||
|
<a href="group/new">$createtext</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
EOT;
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
function hostxrd($baseurl) {
|
function hostxrd($baseurl) {
|
||||||
|
|
||||||
|
header('Access-Control-Allow-Origin: *');
|
||||||
header("Content-type: text/xml");
|
header("Content-type: text/xml");
|
||||||
$tpl = file_get_contents('view/xrd_host.tpl');
|
$tpl = file_get_contents('view/xrd_host.tpl');
|
||||||
echo str_replace('$domain',$baseurl,$tpl);
|
echo str_replace('$domain',$baseurl,$tpl);
|
||||||
|
|
|
@ -338,7 +338,7 @@ function get_atom_elements($feed,$item) {
|
||||||
|
|
||||||
$apps = $item->get_item_tags(NAMESPACE_STATUSNET,'notice_info');
|
$apps = $item->get_item_tags(NAMESPACE_STATUSNET,'notice_info');
|
||||||
if($apps && $apps[0]['attribs']['']['source']) {
|
if($apps && $apps[0]['attribs']['']['source']) {
|
||||||
$res['app'] = $apps[0]['attribs']['']['source'];
|
$res['app'] = strip_tags(unxmlify($apps[0]['attribs']['']['source']));
|
||||||
if($res['app'] === 'web')
|
if($res['app'] === 'web')
|
||||||
$res['app'] = 'OStatus';
|
$res['app'] = 'OStatus';
|
||||||
}
|
}
|
||||||
|
@ -669,6 +669,7 @@ function item_store($arr,$force_parent = false) {
|
||||||
$arr['owner-avatar'] = ((x($arr,'owner-avatar')) ? notags(trim($arr['owner-avatar'])) : '');
|
$arr['owner-avatar'] = ((x($arr,'owner-avatar')) ? notags(trim($arr['owner-avatar'])) : '');
|
||||||
$arr['created'] = ((x($arr,'created') !== false) ? datetime_convert('UTC','UTC',$arr['created']) : datetime_convert());
|
$arr['created'] = ((x($arr,'created') !== false) ? datetime_convert('UTC','UTC',$arr['created']) : datetime_convert());
|
||||||
$arr['edited'] = ((x($arr,'edited') !== false) ? datetime_convert('UTC','UTC',$arr['edited']) : datetime_convert());
|
$arr['edited'] = ((x($arr,'edited') !== false) ? datetime_convert('UTC','UTC',$arr['edited']) : datetime_convert());
|
||||||
|
$arr['received'] = datetime_convert();
|
||||||
$arr['changed'] = datetime_convert();
|
$arr['changed'] = datetime_convert();
|
||||||
$arr['title'] = ((x($arr,'title')) ? notags(trim($arr['title'])) : '');
|
$arr['title'] = ((x($arr,'title')) ? notags(trim($arr['title'])) : '');
|
||||||
$arr['location'] = ((x($arr,'location')) ? notags(trim($arr['location'])) : '');
|
$arr['location'] = ((x($arr,'location')) ? notags(trim($arr['location'])) : '');
|
||||||
|
@ -994,7 +995,7 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
|
||||||
|
|
||||||
function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $secure_feed = false) {
|
function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $secure_feed = false) {
|
||||||
|
|
||||||
require_once('simplepie/simplepie.inc');
|
require_once('library/simplepie/simplepie.inc');
|
||||||
|
|
||||||
$feed = new SimplePie();
|
$feed = new SimplePie();
|
||||||
$feed->set_raw_data($xml);
|
$feed->set_raw_data($xml);
|
||||||
|
@ -1071,13 +1072,13 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $secure_fee
|
||||||
$img->scaleImageSquare(175);
|
$img->scaleImageSquare(175);
|
||||||
|
|
||||||
$hash = $resource_id;
|
$hash = $resource_id;
|
||||||
$r = $img->store($contact['uid'], $contact['id'], $hash, basename($photo_url), t('Contact Photos') , 4);
|
$r = $img->store($contact['uid'], $contact['id'], $hash, basename($photo_url), 'Contact Photos', 4);
|
||||||
|
|
||||||
$img->scaleImage(80);
|
$img->scaleImage(80);
|
||||||
$r = $img->store($contact['uid'], $contact['id'], $hash, basename($photo_url), t('Contact Photos') , 5);
|
$r = $img->store($contact['uid'], $contact['id'], $hash, basename($photo_url), 'Contact Photos', 5);
|
||||||
|
|
||||||
$img->scaleImage(48);
|
$img->scaleImage(48);
|
||||||
$r = $img->store($contact['uid'], $contact['id'], $hash, basename($photo_url), t('Contact Photos') , 6);
|
$r = $img->store($contact['uid'], $contact['id'], $hash, basename($photo_url), 'Contact Photos', 6);
|
||||||
|
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
|
||||||
|
@ -1346,6 +1347,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $secure_fee
|
||||||
if(x($ev,'desc') && x($ev,'start')) {
|
if(x($ev,'desc') && x($ev,'start')) {
|
||||||
$ev['uid'] = $importer['uid'];
|
$ev['uid'] = $importer['uid'];
|
||||||
$ev['uri'] = $item_id;
|
$ev['uri'] = $item_id;
|
||||||
|
$ev['edited'] = $datarray['edited'];
|
||||||
|
|
||||||
if(is_array($contact))
|
if(is_array($contact))
|
||||||
$ev['cid'] = $contact['id'];
|
$ev['cid'] = $contact['id'];
|
||||||
|
@ -1447,11 +1449,11 @@ function new_follower($importer,$contact,$datarray,$item) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
// create contact record - set to readonly
|
// create contact record
|
||||||
|
|
||||||
$r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `name`, `nick`, `photo`, `network`, `rel`,
|
$r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `name`, `nick`, `photo`, `network`, `rel`,
|
||||||
`blocked`, `readonly`, `pending`, `writable` )
|
`blocked`, `readonly`, `pending`, `writable` )
|
||||||
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', %d, 0, 1, 1, 1 ) ",
|
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', %d, 0, 0, 1, 1 ) ",
|
||||||
intval($importer['uid']),
|
intval($importer['uid']),
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
dbesc($url),
|
dbesc($url),
|
||||||
|
|
|
@ -47,11 +47,7 @@
|
||||||
if(mail == 0) { mail = ''; $('#mail-update').hide() } else { $('#mail-update').show() }
|
if(mail == 0) { mail = ''; $('#mail-update').hide() } else { $('#mail-update').show() }
|
||||||
$('#mail-update').html(mail);
|
$('#mail-update').html(mail);
|
||||||
var intro = $(data).find('intro').text();
|
var intro = $(data).find('intro').text();
|
||||||
var register = $(data).find('register').text();
|
if(intro == 0) { intro = ''; $('#notify-update').hide() } else { $('#notify-update').show() }
|
||||||
if(intro == 0) { intro = ''; }
|
|
||||||
if(register != 0 && intro != '') { intro = intro+'/'+register; }
|
|
||||||
if(register != 0 && intro == '') { intro = '0/'+register; }
|
|
||||||
if (intro == '') { $('#notify-update').hide() } else { $('#notify-update').show() }
|
|
||||||
$('#notify-update').html(intro);
|
$('#notify-update').html(intro);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -178,6 +174,21 @@
|
||||||
liking = 1;
|
liking = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function dostar(ident) {
|
||||||
|
$('#like-rotator-' + ident.toString()).show();
|
||||||
|
$.get('starred/' + ident.toString(), function(data) {
|
||||||
|
if(data.match(/1/)) {
|
||||||
|
$('#starred-' + ident.toString()).addClass('starred');
|
||||||
|
$('#starred-' + ident.toString()).removeClass('unstarred');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('#starred-' + ident.toString()).addClass('unstarred');
|
||||||
|
$('#starred-' + ident.toString()).removeClass('starred');
|
||||||
|
}
|
||||||
|
$('#like-rotator-' + ident.toString()).hide();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function getPosition(e) {
|
function getPosition(e) {
|
||||||
var cursor = {x:0, y:0};
|
var cursor = {x:0, y:0};
|
||||||
if ( e.pageX || e.pageY ) {
|
if ( e.pageX || e.pageY ) {
|
||||||
|
|
|
@ -20,6 +20,9 @@ function notifier_run($argv, $argc){
|
||||||
require_once('include/items.php');
|
require_once('include/items.php');
|
||||||
require_once('include/bbcode.php');
|
require_once('include/bbcode.php');
|
||||||
|
|
||||||
|
load_config('config');
|
||||||
|
load_config('system');
|
||||||
|
|
||||||
load_hooks();
|
load_hooks();
|
||||||
|
|
||||||
if($argc < 3)
|
if($argc < 3)
|
||||||
|
@ -71,6 +74,16 @@ function notifier_run($argv, $argc){
|
||||||
if(! count($items))
|
if(! count($items))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
elseif($cmd === 'suggest') {
|
||||||
|
$suggest = q("SELECT * FROM `fsuggest` WHERE `id` = %d LIMIT 1",
|
||||||
|
intval($item_id)
|
||||||
|
);
|
||||||
|
if(! count($suggest))
|
||||||
|
return;
|
||||||
|
$uid = $suggest[0]['uid'];
|
||||||
|
$recipients[] = $suggest[0]['cid'];
|
||||||
|
$item = $suggest[0];
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
// find ancestors
|
// find ancestors
|
||||||
|
@ -106,7 +119,8 @@ function notifier_run($argv, $argc){
|
||||||
$top_level = true;
|
$top_level = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = q("SELECT `contact`.*, `user`.`timezone`, `user`.`nickname`, `user`.`sprvkey`, `user`.`spubkey`, `user`.`page-flags`
|
$r = q("SELECT `contact`.*, `user`.`timezone`, `user`.`nickname`, `user`.`sprvkey`, `user`.`spubkey`,
|
||||||
|
`user`.`page-flags`, `user`.`prvnets`
|
||||||
FROM `contact` LEFT JOIN `user` ON `user`.`uid` = `contact`.`uid`
|
FROM `contact` LEFT JOIN `user` ON `user`.`uid` = `contact`.`uid`
|
||||||
WHERE `contact`.`uid` = %d AND `contact`.`self` = 1 LIMIT 1",
|
WHERE `contact`.`uid` = %d AND `contact`.`self` = 1 LIMIT 1",
|
||||||
intval($uid)
|
intval($uid)
|
||||||
|
@ -125,7 +139,7 @@ function notifier_run($argv, $argc){
|
||||||
// fill this in with a single salmon slap if applicable
|
// fill this in with a single salmon slap if applicable
|
||||||
$slap = '';
|
$slap = '';
|
||||||
|
|
||||||
if($cmd != 'mail') {
|
if($cmd != 'mail' && $cmd != 'suggest') {
|
||||||
|
|
||||||
require_once('include/group.php');
|
require_once('include/group.php');
|
||||||
|
|
||||||
|
@ -224,6 +238,8 @@ function notifier_run($argv, $argc){
|
||||||
if($cmd === 'mail') {
|
if($cmd === 'mail') {
|
||||||
$notify_hub = false; // mail is not public
|
$notify_hub = false; // mail is not public
|
||||||
|
|
||||||
|
$body = fix_private_photos($item['body'],$owner['uid']);
|
||||||
|
|
||||||
$atom .= replace_macros($mail_template, array(
|
$atom .= replace_macros($mail_template, array(
|
||||||
'$name' => xmlify($owner['name']),
|
'$name' => xmlify($owner['name']),
|
||||||
'$profile_page' => xmlify($owner['url']),
|
'$profile_page' => xmlify($owner['url']),
|
||||||
|
@ -231,10 +247,30 @@ function notifier_run($argv, $argc){
|
||||||
'$item_id' => xmlify($item['uri']),
|
'$item_id' => xmlify($item['uri']),
|
||||||
'$subject' => xmlify($item['title']),
|
'$subject' => xmlify($item['title']),
|
||||||
'$created' => xmlify(datetime_convert('UTC', 'UTC', $item['created'] . '+00:00' , ATOM_TIME)),
|
'$created' => xmlify(datetime_convert('UTC', 'UTC', $item['created'] . '+00:00' , ATOM_TIME)),
|
||||||
'$content' => xmlify($item['body']),
|
'$content' => xmlify($body),
|
||||||
'$parent_id' => xmlify($item['parent-uri'])
|
'$parent_id' => xmlify($item['parent-uri'])
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
elseif($cmd === 'suggest') {
|
||||||
|
$notify_hub = false; // suggestions are not public
|
||||||
|
|
||||||
|
$sugg_template = get_markup_template('atom_suggest.tpl');
|
||||||
|
|
||||||
|
$atom .= replace_macros($sugg_template, array(
|
||||||
|
'$name' => xmlify($item['name']),
|
||||||
|
'$url' => xmlify($item['url']),
|
||||||
|
'$photo' => xmlify($item['photo']),
|
||||||
|
'$request' => xmlify($item['request']),
|
||||||
|
'$note' => xmlify($item['note'])
|
||||||
|
));
|
||||||
|
|
||||||
|
// We don't need this any more
|
||||||
|
|
||||||
|
q("DELETE FROM `fsuggest` WHERE `id` = %d LIMIT 1",
|
||||||
|
intval($item['id'])
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
if($followup) {
|
if($followup) {
|
||||||
foreach($items as $item) { // there is only one item
|
foreach($items as $item) { // there is only one item
|
||||||
|
@ -329,7 +365,8 @@ function notifier_run($argv, $argc){
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'stat':
|
case 'stat':
|
||||||
|
if($owner['prvnets'])
|
||||||
|
break;
|
||||||
if($followup && $contact['notify']) {
|
if($followup && $contact['notify']) {
|
||||||
logger('notifier: slapdelivery: ' . $contact['name']);
|
logger('notifier: slapdelivery: ' . $contact['name']);
|
||||||
$deliver_status = slapper($owner,$contact['notify'],$slap);
|
$deliver_status = slapper($owner,$contact['notify'],$slap);
|
||||||
|
@ -373,6 +410,7 @@ function notifier_run($argv, $argc){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'mail':
|
case 'mail':
|
||||||
|
|
||||||
// WARNING: does not currently convert to RFC2047 header encodings, etc.
|
// WARNING: does not currently convert to RFC2047 header encodings, etc.
|
||||||
|
@ -447,9 +485,9 @@ function notifier_run($argv, $argc){
|
||||||
mail($addr, $subject, $message, $headers);
|
mail($addr, $subject, $message, $headers);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'dspr':
|
|
||||||
case 'feed':
|
case 'feed':
|
||||||
case 'face':
|
case 'face':
|
||||||
|
case 'dspr':
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
require_once("boot.php");
|
require_once("boot.php");
|
||||||
|
|
||||||
|
|
||||||
function poller_run($argv, $argc){
|
function poller_run($argv, $argc){
|
||||||
global $a, $db;
|
global $a, $db;
|
||||||
|
|
||||||
|
@ -17,13 +18,16 @@ function poller_run($argv, $argc){
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
require_once('session.php');
|
require_once('include/session.php');
|
||||||
require_once('datetime.php');
|
require_once('include/datetime.php');
|
||||||
require_once('simplepie/simplepie.inc');
|
require_once('library/simplepie/simplepie.inc');
|
||||||
require_once('include/items.php');
|
require_once('include/items.php');
|
||||||
require_once('include/Contact.php');
|
require_once('include/Contact.php');
|
||||||
require_once('include/email.php');
|
require_once('include/email.php');
|
||||||
|
|
||||||
|
load_config('config');
|
||||||
|
load_config('system');
|
||||||
|
|
||||||
$a->set_baseurl(get_config('system','url'));
|
$a->set_baseurl(get_config('system','url'));
|
||||||
|
|
||||||
load_hooks();
|
load_hooks();
|
||||||
|
@ -44,18 +48,26 @@ function poller_run($argv, $argc){
|
||||||
proc_run('php','include/expire.php');
|
proc_run('php','include/expire.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// clear old cache
|
// clear old cache
|
||||||
q("DELETE FROM `cache` WHERE `updated` < '%s'",
|
q("DELETE FROM `cache` WHERE `updated` < '%s'",
|
||||||
dbesc(datetime_convert('UTC','UTC',"now - 30 days")));
|
dbesc(datetime_convert('UTC','UTC',"now - 30 days")));
|
||||||
|
|
||||||
$manual_id = 0;
|
$manual_id = 0;
|
||||||
|
$generation = 0;
|
||||||
$hub_update = false;
|
$hub_update = false;
|
||||||
$force = false;
|
$force = false;
|
||||||
|
$restart = false;
|
||||||
|
|
||||||
if(($argc > 1) && ($argv[1] == 'force'))
|
if(($argc > 1) && ($argv[1] == 'force'))
|
||||||
$force = true;
|
$force = true;
|
||||||
|
|
||||||
|
if(($argc > 1) && ($argv[1] == 'restart')) {
|
||||||
|
$restart = true;
|
||||||
|
$generation = intval($argv[2]);
|
||||||
|
if(! $generation)
|
||||||
|
killme();
|
||||||
|
}
|
||||||
|
|
||||||
if(($argc > 1) && intval($argv[1])) {
|
if(($argc > 1) && intval($argv[1])) {
|
||||||
$manual_id = intval($argv[1]);
|
$manual_id = intval($argv[1]);
|
||||||
$force = true;
|
$force = true;
|
||||||
|
@ -67,6 +79,7 @@ function poller_run($argv, $argc){
|
||||||
|
|
||||||
$d = datetime_convert();
|
$d = datetime_convert();
|
||||||
|
|
||||||
|
if(! $restart)
|
||||||
call_hooks('cron', $d);
|
call_hooks('cron', $d);
|
||||||
|
|
||||||
|
|
||||||
|
@ -151,6 +164,22 @@ function poller_run($argv, $argc){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check to see if we are running out of memory - if so spawn a new process and kill this one
|
||||||
|
|
||||||
|
$avail_memory = return_bytes(ini_get('memory_limit'));
|
||||||
|
$memused = memory_get_peak_usage(true);
|
||||||
|
if(intval($avail_memory)) {
|
||||||
|
if(($memused / $avail_memory) > 0.95) {
|
||||||
|
if($generation + 1 > 10) {
|
||||||
|
logger('poller: maximum number of spawns exceeded. Terminating.');
|
||||||
|
killme();
|
||||||
|
}
|
||||||
|
logger('poller: memory exceeded. ' . $memused . ' bytes used. Spawning new poll.');
|
||||||
|
proc_run('php', 'include/poller.php', 'restart', (string) $generation + 1);
|
||||||
|
killme();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$importer_uid = $contact['uid'];
|
$importer_uid = $contact['uid'];
|
||||||
|
|
||||||
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1",
|
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1",
|
||||||
|
@ -281,13 +310,22 @@ function poller_run($argv, $argc){
|
||||||
|
|
||||||
// Upgrading DB fields from an older Friendika version
|
// Upgrading DB fields from an older Friendika version
|
||||||
// Will only do this once per notify-enabled OStatus contact
|
// Will only do this once per notify-enabled OStatus contact
|
||||||
|
// or if relationship changes
|
||||||
|
|
||||||
if(($contact['notify']) && (! $contact['writable'])) {
|
$stat_writeable = ((($contact['notify']) && ($contact['rel'] == REL_VIP || $contact['rel'] == REL_BUD)) ? 1 : 0);
|
||||||
q("UPDATE `contact` SET `writable` = 1 WHERE `id` = %d LIMIT 1",
|
|
||||||
|
if($stat_writeable != $contact['writable']) {
|
||||||
|
q("UPDATE `contact` SET `writable` = %d WHERE `id` = %d LIMIT 1",
|
||||||
|
intval($stat_writeable),
|
||||||
intval($contact['id'])
|
intval($contact['id'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Are we allowed to import from this person?
|
||||||
|
|
||||||
|
if($contact['rel'] == REL_VIP || $contact['blocked'] || $contact['readonly'])
|
||||||
|
continue;
|
||||||
|
|
||||||
$xml = fetch_url($contact['poll']);
|
$xml = fetch_url($contact['poll']);
|
||||||
}
|
}
|
||||||
elseif($contact['network'] === NETWORK_MAIL) {
|
elseif($contact['network'] === NETWORK_MAIL) {
|
||||||
|
|
|
@ -22,6 +22,9 @@ function queue_run($argv, $argc){
|
||||||
require_once('include/items.php');
|
require_once('include/items.php');
|
||||||
require_once('include/bbcode.php');
|
require_once('include/bbcode.php');
|
||||||
|
|
||||||
|
load_config('config');
|
||||||
|
load_config('system');
|
||||||
|
|
||||||
$a->set_baseurl(get_config('system','url'));
|
$a->set_baseurl(get_config('system','url'));
|
||||||
|
|
||||||
load_hooks();
|
load_hooks();
|
||||||
|
|
|
@ -145,9 +145,9 @@ EOT;
|
||||||
|
|
||||||
// Setup RSA stuff to PKCS#1 sign the data
|
// Setup RSA stuff to PKCS#1 sign the data
|
||||||
|
|
||||||
set_include_path(get_include_path() . PATH_SEPARATOR . 'phpsec');
|
set_include_path(get_include_path() . PATH_SEPARATOR . 'library' . PATH_SEPARATOR . 'phpsec');
|
||||||
|
|
||||||
require_once('phpsec/Crypt/RSA.php');
|
require_once('library/phpsec/Crypt/RSA.php');
|
||||||
|
|
||||||
$rsa = new CRYPT_RSA();
|
$rsa = new CRYPT_RSA();
|
||||||
$rsa->signatureMode = CRYPT_RSA_SIGNATURE_PKCS1;
|
$rsa->signatureMode = CRYPT_RSA_SIGNATURE_PKCS1;
|
||||||
|
|
|
@ -44,3 +44,74 @@ function can_write_wall(&$a,$owner) {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function permissions_sql($owner_id,$remote_verified = false,$groups = null) {
|
||||||
|
|
||||||
|
$local_user = local_user();
|
||||||
|
$remote_user = remote_user();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct permissions
|
||||||
|
*
|
||||||
|
* default permissions - anonymous user
|
||||||
|
*/
|
||||||
|
|
||||||
|
$sql = " AND allow_cid = ''
|
||||||
|
AND allow_gid = ''
|
||||||
|
AND deny_cid = ''
|
||||||
|
AND deny_gid = ''
|
||||||
|
";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Profile owner - everything is visible
|
||||||
|
*/
|
||||||
|
|
||||||
|
if(($local_user) && ($local_user == $owner_id)) {
|
||||||
|
$sql = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Authenticated visitor. Unless pre-verified,
|
||||||
|
* check that the contact belongs to this $owner_id
|
||||||
|
* and load the groups the visitor belongs to.
|
||||||
|
* If pre-verified, the caller is expected to have already
|
||||||
|
* done this and passed the groups into this function.
|
||||||
|
*/
|
||||||
|
|
||||||
|
elseif($remote_user) {
|
||||||
|
|
||||||
|
if(! $remote_verified) {
|
||||||
|
$r = q("SELECT id FROM contact WHERE id = %d AND uid = %d AND blocked = 0 LIMIT 1",
|
||||||
|
intval($remote_user),
|
||||||
|
intval($owner_id)
|
||||||
|
);
|
||||||
|
if(count($r)) {
|
||||||
|
$remote_verified = true;
|
||||||
|
$groups = init_groups_visitor($remote_user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($remote_verified) {
|
||||||
|
|
||||||
|
$gs = '<<>>'; // should be impossible to match
|
||||||
|
|
||||||
|
if(is_array($groups) && count($groups)) {
|
||||||
|
foreach($groups as $g)
|
||||||
|
$gs .= '|<' . intval($g) . '>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = sprintf(
|
||||||
|
" AND ( allow_cid = '' OR allow_cid REGEXP '<%d>' )
|
||||||
|
AND ( deny_cid = '' OR NOT deny_cid REGEXP '<%d>' )
|
||||||
|
AND ( allow_gid = '' OR allow_gid REGEXP '%s' )
|
||||||
|
AND ( deny_gid = '' OR NOT deny_gid REGEXP '%s')
|
||||||
|
",
|
||||||
|
intval($remote_user),
|
||||||
|
intval($remote_user),
|
||||||
|
dbesc($gs),
|
||||||
|
dbesc($gs)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $sql;
|
||||||
|
}
|
27
index.php
|
@ -44,18 +44,19 @@ $db = new dba($db_host, $db_user, $db_pass, $db_data, $install);
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
unset($db_host, $db_user, $db_pass, $db_data);
|
||||||
|
|
||||||
|
|
||||||
/**
|
if(! $install) {
|
||||||
|
|
||||||
|
/**
|
||||||
* Load configs from db. Overwrite configs from .htconfig.php
|
* Load configs from db. Overwrite configs from .htconfig.php
|
||||||
*/
|
*/
|
||||||
$r = q("SELECT * FROM `config` WHERE `cat` IN ('system', 'config')");
|
|
||||||
foreach ($r as $c) {
|
load_config('config');
|
||||||
if ($c['cat']=='config') {
|
load_config('system');
|
||||||
$a->config[$c['k']] = $c['v'];
|
|
||||||
} else {
|
require_once("session.php");
|
||||||
$a->config[$c['cat']][$c['k']] = $c['v'];
|
load_hooks();
|
||||||
}
|
call_hooks('init_1');
|
||||||
}
|
}
|
||||||
unset($r);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,14 +71,6 @@ unset($r);
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(! $install) {
|
|
||||||
require_once("session.php");
|
|
||||||
load_hooks();
|
|
||||||
call_hooks('init_1');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
require_once("datetime.php");
|
require_once("datetime.php");
|
||||||
|
|
||||||
$a->timezone = (($default_timezone) ? $default_timezone : 'UTC');
|
$a->timezone = (($default_timezone) ? $default_timezone : 'UTC');
|
||||||
|
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 533 B After Width: | Height: | Size: 533 B |