Merge branch 'master' of git://github.com/friendika/friendika
This commit is contained in:
commit
ebb8186191
|
@ -339,6 +339,7 @@ function facebook_install() {
|
||||||
register_hook('jot_networks', 'addon/facebook/facebook.php', 'facebook_jot_nets');
|
register_hook('jot_networks', 'addon/facebook/facebook.php', 'facebook_jot_nets');
|
||||||
register_hook('plugin_settings', 'addon/facebook/facebook.php', 'facebook_plugin_settings');
|
register_hook('plugin_settings', 'addon/facebook/facebook.php', 'facebook_plugin_settings');
|
||||||
register_hook('cron', 'addon/facebook/facebook.php', 'facebook_cron');
|
register_hook('cron', 'addon/facebook/facebook.php', 'facebook_cron');
|
||||||
|
register_hook('queue_predeliver', 'addon/facebook/facebook.php', 'fb_queue_hook');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -347,6 +348,7 @@ function facebook_uninstall() {
|
||||||
unregister_hook('jot_networks', 'addon/facebook/facebook.php', 'facebook_jot_nets');
|
unregister_hook('jot_networks', 'addon/facebook/facebook.php', 'facebook_jot_nets');
|
||||||
unregister_hook('plugin_settings', 'addon/facebook/facebook.php', 'facebook_plugin_settings');
|
unregister_hook('plugin_settings', 'addon/facebook/facebook.php', 'facebook_plugin_settings');
|
||||||
unregister_hook('cron', 'addon/facebook/facebook.php', 'facebook_cron');
|
unregister_hook('cron', 'addon/facebook/facebook.php', 'facebook_cron');
|
||||||
|
unregister_hook('queue_predeliver', 'addon/facebook/facebook.php', 'fb_queue_hook');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -635,9 +637,19 @@ function facebook_post_hook(&$a,&$b) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// FIXME queue the message so we can attempt to redeliver, see include/notifier.php and include/queue.php
|
if(! $likes) {
|
||||||
if(! $likes)
|
$s = serialize(array('url' => $url, 'item' => $b['id'], 'post' => $postvars));
|
||||||
notice( t('Facebook delivery failed.') . EOL);
|
q("INSERT INTO `queue` ( `network`, `cid`, `created`, `last`, `content`)
|
||||||
|
VALUES ( '%s', '%s', '%s', '%s') ",
|
||||||
|
dbesc(NETWORK_FACEBOOK),
|
||||||
|
intval($a->contact),
|
||||||
|
dbesc(datetime_convert()),
|
||||||
|
dbesc(datetime_convert()),
|
||||||
|
dbesc($s)
|
||||||
|
);
|
||||||
|
|
||||||
|
notice( t('Facebook post failed. Queued for retry.') . EOL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger('Facebook post returns: ' . $x, LOGGER_DEBUG);
|
logger('Facebook post returns: ' . $x, LOGGER_DEBUG);
|
||||||
|
@ -648,6 +660,56 @@ function facebook_post_hook(&$a,&$b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function fb_queue_hook(&$a,&$b) {
|
||||||
|
|
||||||
|
require_once('include/queue_fn.php');
|
||||||
|
if((! is_array($b)) || (! count($b)))
|
||||||
|
return;
|
||||||
|
foreach($b as $x) {
|
||||||
|
if($b['network'] !== NETWORK_FACEBOOK)
|
||||||
|
continue;
|
||||||
|
$r = q("SELECT `user`.* FROM `user` LEFT JOIN `contact` on `contact`.`uid` = `user`.`uid`
|
||||||
|
WHERE `contact`.`self` = 1 AND `contact`.`id` = %d LIMIT 1",
|
||||||
|
intval($x['cid'])
|
||||||
|
);
|
||||||
|
if(! count($r))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
$user = $r[0];
|
||||||
|
|
||||||
|
$appid = get_config('facebook', 'appid' );
|
||||||
|
$secret = get_config('facebook', 'appsecret' );
|
||||||
|
|
||||||
|
if($appid && $secret) {
|
||||||
|
$fb_post = intval(get_pconfig($user['uid'],'facebook','post'));
|
||||||
|
$fb_token = get_pconfig($user['uid'],'facebook','access_token');
|
||||||
|
|
||||||
|
if($fb_post && $fb_token) {
|
||||||
|
logger('facebook_queue: able to post');
|
||||||
|
require_once('library/facebook.php');
|
||||||
|
|
||||||
|
$z = unserialize($x['content']);
|
||||||
|
$item = $z['item'];
|
||||||
|
$j = post_url($z['url'],$z['post']);
|
||||||
|
|
||||||
|
$retj = json_decode($j);
|
||||||
|
if($retj->id) {
|
||||||
|
q("UPDATE `item` SET `extid` = '%s' WHERE `id` = %d LIMIT 1",
|
||||||
|
dbesc('fb::' . $retj->id),
|
||||||
|
intval($item)
|
||||||
|
);
|
||||||
|
logger('facebook queue: success: ' . $j);
|
||||||
|
remove_queue_item($x['id']);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
logger('facebook_queue: failed: ' . $j);
|
||||||
|
update_queue_time($x['id']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function fb_consume_all($uid) {
|
function fb_consume_all($uid) {
|
||||||
|
|
||||||
require_once('include/items.php');
|
require_once('include/items.php');
|
||||||
|
|
11
boot.php
11
boot.php
|
@ -6,7 +6,7 @@ ini_set('pcre.backtrack_limit', 250000);
|
||||||
|
|
||||||
define ( 'FRIENDIKA_VERSION', '2.2.999' );
|
define ( 'FRIENDIKA_VERSION', '2.2.999' );
|
||||||
define ( 'DFRN_PROTOCOL_VERSION', '2.21' );
|
define ( 'DFRN_PROTOCOL_VERSION', '2.21' );
|
||||||
define ( 'DB_UPDATE_VERSION', 1059 );
|
define ( 'DB_UPDATE_VERSION', 1060 );
|
||||||
|
|
||||||
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' );
|
||||||
|
@ -481,10 +481,18 @@ function check_config(&$a) {
|
||||||
$stored = intval($build);
|
$stored = intval($build);
|
||||||
$current = intval(DB_UPDATE_VERSION);
|
$current = intval(DB_UPDATE_VERSION);
|
||||||
if(($stored < $current) && file_exists('update.php')) {
|
if(($stored < $current) && file_exists('update.php')) {
|
||||||
|
|
||||||
// We're reporting a different version than what is currently installed.
|
// We're reporting a different version than what is currently installed.
|
||||||
// Run any existing update scripts to bring the database up to current.
|
// Run any existing update scripts to bring the database up to current.
|
||||||
|
|
||||||
require_once('update.php');
|
require_once('update.php');
|
||||||
|
|
||||||
|
// make sure that boot.php and update.php are the same release, we might be
|
||||||
|
// updating right this very second and the correct version of the update.php
|
||||||
|
// file may not be here yet. This can happen on a very busy site.
|
||||||
|
|
||||||
|
if(DB_UPDATE_VERSION == UPDATE_VERSION) {
|
||||||
|
|
||||||
for($x = $stored; $x < $current; $x ++) {
|
for($x = $stored; $x < $current; $x ++) {
|
||||||
if(function_exists('update_' . $x)) {
|
if(function_exists('update_' . $x)) {
|
||||||
$func = 'update_' . $x;
|
$func = 'update_' . $x;
|
||||||
|
@ -494,6 +502,7 @@ function check_config(&$a) {
|
||||||
set_config('system','build', DB_UPDATE_VERSION);
|
set_config('system','build', DB_UPDATE_VERSION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -440,6 +440,7 @@ PRIMARY KEY ( `id` )
|
||||||
CREATE TABLE IF NOT EXISTS `queue` (
|
CREATE TABLE IF NOT EXISTS `queue` (
|
||||||
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
|
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
|
||||||
`cid` INT NOT NULL ,
|
`cid` INT NOT NULL ,
|
||||||
|
`network` CHAR( 32 ) NOT NULL,
|
||||||
`created` DATETIME NOT NULL ,
|
`created` DATETIME NOT NULL ,
|
||||||
`last` DATETIME NOT NULL ,
|
`last` DATETIME NOT NULL ,
|
||||||
`content` MEDIUMTEXT NOT NULL
|
`content` MEDIUMTEXT NOT NULL
|
||||||
|
|
|
@ -53,6 +53,9 @@ Otherwise, enter your password. This will have been initially provided in your r
|
||||||
|
|
||||||
After your first login, please visit the 'Settings' page from the top menu bar and change your password to something that you will remember.
|
After your first login, please visit the 'Settings' page from the top menu bar and change your password to something that you will remember.
|
||||||
|
|
||||||
|
**Getting Started**
|
||||||
|
|
||||||
|
A ['Tips for New Members'](newmember) link will show up on your home page for two weeks to provide some important Getting Started information.
|
||||||
|
|
||||||
|
|
||||||
**See Also**
|
**See Also**
|
||||||
|
|
|
@ -63,6 +63,12 @@ if((isset($_SESSION)) && (x($_SESSION,'authenticated')) && ((! (x($_POST,'auth-p
|
||||||
$_SESSION['theme'] = $a->user['theme'];
|
$_SESSION['theme'] = $a->user['theme'];
|
||||||
$_SESSION['page_flags'] = $a->user['page-flags'];
|
$_SESSION['page_flags'] = $a->user['page-flags'];
|
||||||
|
|
||||||
|
$member_since = strtotime($a->user['register_date']);
|
||||||
|
if(time() < ($member_since + ( 60 * 60 * 24 * 14)))
|
||||||
|
$_SESSION['new_member'] = true;
|
||||||
|
else
|
||||||
|
$_SESSION['new_member'] = false;
|
||||||
|
|
||||||
if(strlen($a->user['timezone'])) {
|
if(strlen($a->user['timezone'])) {
|
||||||
date_default_timezone_set($a->user['timezone']);
|
date_default_timezone_set($a->user['timezone']);
|
||||||
$a->timezone = $a->user['timezone'];
|
$a->timezone = $a->user['timezone'];
|
||||||
|
@ -211,6 +217,13 @@ else {
|
||||||
else
|
else
|
||||||
info( t("Welcome back ") . $a->user['username'] . EOL);
|
info( t("Welcome back ") . $a->user['username'] . EOL);
|
||||||
|
|
||||||
|
|
||||||
|
$member_since = strtotime($a->user['register_date']);
|
||||||
|
if(time() < ($member_since + ( 60 * 60 * 24 * 14)))
|
||||||
|
$_SESSION['new_member'] = true;
|
||||||
|
else
|
||||||
|
$_SESSION['new_member'] = false;
|
||||||
|
|
||||||
if(strlen($a->user['timezone'])) {
|
if(strlen($a->user['timezone'])) {
|
||||||
date_default_timezone_set($a->user['timezone']);
|
date_default_timezone_set($a->user['timezone']);
|
||||||
$a->timezone = $a->user['timezone'];
|
$a->timezone = $a->user['timezone'];
|
||||||
|
|
|
@ -1,20 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
require_once("boot.php");
|
require_once("boot.php");
|
||||||
|
require_once('include/queue_fn.php');
|
||||||
function update_queue_time($id) {
|
|
||||||
logger('queue: requeue item ' . $id);
|
|
||||||
q("UPDATE `queue` SET `last` = '%s' WHERE `id` = %d LIMIT 1",
|
|
||||||
dbesc(datetime_convert()),
|
|
||||||
intval($id)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function remove_queue_item($id) {
|
|
||||||
logger('queue: remove queue item ' . $id);
|
|
||||||
q("DELETE FROM `queue` WHERE `id` = %d LIMIT 1",
|
|
||||||
intval($id)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function queue_run($argv, $argc){
|
function queue_run($argv, $argc){
|
||||||
global $a, $db;
|
global $a, $db;
|
||||||
|
@ -58,6 +44,10 @@ function queue_run($argv, $argc){
|
||||||
if(! count($r)){
|
if(! count($r)){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
call_hooks('queue_predeliver', $a, $r);
|
||||||
|
|
||||||
|
|
||||||
// delivery loop
|
// delivery loop
|
||||||
|
|
||||||
require_once('include/salmon.php');
|
require_once('include/salmon.php');
|
||||||
|
@ -69,6 +59,7 @@ function queue_run($argv, $argc){
|
||||||
if(! count($qi))
|
if(! count($qi))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
||||||
$c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
|
$c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
|
||||||
intval($qi[0]['cid'])
|
intval($qi[0]['cid'])
|
||||||
);
|
);
|
||||||
|
@ -121,7 +112,6 @@ function queue_run($argv, $argc){
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$a = get_app();
|
|
||||||
$params = array('owner' => $owner, 'contact' => $contact, 'queue' => $q_item, 'result' => false);
|
$params = array('owner' => $owner, 'contact' => $contact, 'queue' => $q_item, 'result' => false);
|
||||||
call_hooks('queue_deliver', $a, $params);
|
call_hooks('queue_deliver', $a, $params);
|
||||||
|
|
||||||
|
|
16
include/queue_fn.php
Normal file
16
include/queue_fn.php
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
function update_queue_time($id) {
|
||||||
|
logger('queue: requeue item ' . $id);
|
||||||
|
q("UPDATE `queue` SET `last` = '%s' WHERE `id` = %d LIMIT 1",
|
||||||
|
dbesc(datetime_convert()),
|
||||||
|
intval($id)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function remove_queue_item($id) {
|
||||||
|
logger('queue: remove queue item ' . $id);
|
||||||
|
q("DELETE FROM `queue` WHERE `id` = %d LIMIT 1",
|
||||||
|
intval($id)
|
||||||
|
);
|
||||||
|
}
|
45
mod/newmember.php
Normal file
45
mod/newmember.php
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
function newmember_content(&$a) {
|
||||||
|
|
||||||
|
|
||||||
|
$o = '<h3>' . t('Welcome to Friendika') . '</h3>';
|
||||||
|
|
||||||
|
$o .= '<h3>' . t('New Member Checklist') . '</h3>';
|
||||||
|
|
||||||
|
$o .= '<div style="font-size: 120%;">';
|
||||||
|
|
||||||
|
$o .= t('We would like to offer some tips and links to help make your experience enjoyable. Click any item to visit the relevant page.');
|
||||||
|
|
||||||
|
$o .= '<ul>';
|
||||||
|
|
||||||
|
$o .= '<li>' . '<a href="settings">' . t('On your <em>Settings</em> page - change your initial password. Also make a note of your Identity Address. This will be useful in making friends.') . '</a></li>' . EOL;
|
||||||
|
|
||||||
|
$o .= '<li>' . '<a href="settings">' . t('Review the other settings, particularly the choice of publishing your profile to various directories. An unpublished directory is like an unlisted phone number. Great for privacy - but unless you inform all your friends, nobody can find you.') . '</a></li>' . EOL;
|
||||||
|
|
||||||
|
$o .= '<li>' . '<a href="profile_photo">' . t('Upload a profile photo if you have not done so already. Studies have shown that people with real photos of themselves are ten times more likely to make friends than people who do not.') . '</a></li>' . EOL;
|
||||||
|
|
||||||
|
if(in_array('facebook', $a->plugins))
|
||||||
|
$o .= '<li>' . '<a href="facebook">' . t("Authorise the Facebook Connector if you currently have a Facebook account and we will \x28optionally\x29 import all your Facebook friends and conversations.") . '</a></li>' . EOL;
|
||||||
|
|
||||||
|
$mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
|
||||||
|
|
||||||
|
if(! $mail_disabled)
|
||||||
|
$o .= '<li>' . '<a href="settings">' . t('Enter your email access information on your Settings page if you wish to import and interact with friends or mailing lists from your email INBOX') . '</a></li>' . EOL;
|
||||||
|
|
||||||
|
$o .= '<li>' . '<a href="profiles">' . t('Edit your <strong>default</strong> profile to your liking. Review the settings for hiding your list of friends and hiding the profile from unknown visitors.') . '</a></li>' . EOL;
|
||||||
|
|
||||||
|
$o .= '<li>' . '<a href="profiles">' . t('Set some public keywords for your default profile which describe your interests. We may be able to find other people with similar interests and suggest friendships.') . '</a></li>' . EOL;
|
||||||
|
|
||||||
|
$o .= '<li>' . '<a href="contacts">' . t('Your Contacts page is your gateway to managing friendships and connecting with friends on other networks. Typically you enter their address or site URL in the <em>Connect</em> dialog.') . '</a></li>' . EOL;
|
||||||
|
|
||||||
|
$o .= '<li>' . '<a href="directory">' . t('The Directory page lets you find other people in this network or other federated sites. Look for a <em>Connect</em> or <em>Follow</em> link on their profile page. Provide your own Identity Address if requested.') . '</a></li>' . EOL;
|
||||||
|
|
||||||
|
$o .= '<li>' . '<a href="contacts">' . t('Once you have made some friends, organize them into private conversation groups from the sidebar of your Contacts page and then you can interact with each group privately on your Network page.') . '</a></li>' . EOL;
|
||||||
|
|
||||||
|
$o .= '<li>' . '<a href="help">' . t('Our <strong>help</strong> pages may be consulted for detail on other program features and resources.') . '</a></li>' . EOL;
|
||||||
|
|
||||||
|
$o .= '</div>';
|
||||||
|
|
||||||
|
return $o;
|
||||||
|
}
|
|
@ -126,6 +126,9 @@ function profile_content(&$a, $update = 0) {
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(x($_SESSION,'new_member') && $_SESSION['new_member'] && $is_owner)
|
||||||
|
$o .= '<a href="newmember">' . t('Tips for New Members') . '</a>' . EOL;
|
||||||
|
|
||||||
$commpage = (($a->profile['page-flags'] == PAGE_COMMUNITY) ? true : false);
|
$commpage = (($a->profile['page-flags'] == PAGE_COMMUNITY) ? true : false);
|
||||||
$commvisitor = (($commpage && $remote_contact == true) ? true : false);
|
$commvisitor = (($commpage && $remote_contact == true) ? true : false);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
define( 'UPDATE_VERSION' , 1060 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* update.php - automatic system update
|
* update.php - automatic system update
|
||||||
|
@ -28,7 +30,7 @@
|
||||||
* 2. Update this file by adding a new function at the end with the number of the current DB_UPDATE_VERSION.
|
* 2. Update this file by adding a new function at the end with the number of the current DB_UPDATE_VERSION.
|
||||||
* This function should modify the current database schema and perform any other steps necessary
|
* This function should modify the current database schema and perform any other steps necessary
|
||||||
* to ensure that upgrade is silent and free from requiring interaction.
|
* to ensure that upgrade is silent and free from requiring interaction.
|
||||||
* 3. Increment the DB_UPDATE_VERSION in boot.php
|
* 3. Increment the DB_UPDATE_VERSION in boot.php *AND* the UPDATE_VERSION in this file to match it
|
||||||
* 4. TEST the upgrade prior to checkin and filing a pull request.
|
* 4. TEST the upgrade prior to checkin and filing a pull request.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -499,3 +501,8 @@ function update_1057() {
|
||||||
function update_1058() {
|
function update_1058() {
|
||||||
q("ALTER TABLE `item` ADD `event-id` INT NOT NULL AFTER `resource-id` ");
|
q("ALTER TABLE `item` ADD `event-id` INT NOT NULL AFTER `resource-id` ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function update_1059() {
|
||||||
|
q("ALTER TABLE `queue` ADD `network` CHAR( 32 ) NOT NULL AFTER `cid` ");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue