Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Michael Vogel 2012-12-03 08:30:49 +01:00
commit 5635fe250c
97 changed files with 31044 additions and 3633 deletions

View file

@ -584,6 +584,7 @@ class Photo {
`album` = '%s',
`height` = %d,
`width` = %d,
`datasize` = %d,
`data` = '%s',
`scale` = %d,
`profile` = %d,
@ -604,6 +605,7 @@ class Photo {
dbesc($album),
intval($this->getHeight()),
intval($this->getWidth()),
dbesc(strlen($this->imageString())),
dbesc($this->imageString()),
intval($scale),
intval($profile),
@ -616,8 +618,8 @@ class Photo {
}
else {
$r = q("INSERT INTO `photo`
( `uid`, `contact-id`, `guid`, `resource-id`, `created`, `edited`, `filename`, type, `album`, `height`, `width`, `data`, `scale`, `profile`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid` )
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, '%s', '%s', '%s', '%s' )",
( `uid`, `contact-id`, `guid`, `resource-id`, `created`, `edited`, `filename`, type, `album`, `height`, `width`, `datasize`, `data`, `scale`, `profile`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid` )
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, '%s', %d, %d, '%s', '%s', '%s', '%s' )",
intval($uid),
intval($cid),
dbesc($guid),
@ -629,6 +631,7 @@ class Photo {
dbesc($album),
intval($this->getHeight()),
intval($this->getWidth()),
dbesc(strlen($this->imageString())),
dbesc($this->imageString()),
intval($scale),
intval($profile),

View file

@ -83,6 +83,8 @@ function network_to_name($s) {
NETWORK_LINKEDIN => t('LinkedIn'),
NETWORK_XMPP => t('XMPP/IM'),
NETWORK_MYSPACE => t('MySpace'),
NETWORK_MAIL2 => t('Email'),
NETWORK_GPLUS => t('Google+')
);
call_hooks('network_to_name', $nets);

View file

@ -47,6 +47,8 @@ function networks_widget($baseurl,$selected = '') {
if(! local_user())
return '';
if(! feature_enabled(local_user(),'networks'))
return '';
$r = q("select distinct(network) from contact where uid = %d and self = 0",
intval(local_user())
@ -80,6 +82,9 @@ function fileas_widget($baseurl,$selected = '') {
if(! local_user())
return '';
if(! feature_enabled(local_user(),'filing'))
return '';
$saved = get_pconfig(local_user(),'system','filetags');
if(! strlen($saved))
return;
@ -106,8 +111,12 @@ function fileas_widget($baseurl,$selected = '') {
}
function categories_widget($baseurl,$selected = '') {
$a = get_app();
if(! feature_enabled($a->profile['profile_uid'],'categories'))
return '';
$saved = get_pconfig($a->profile['profile_uid'],'system','filetags');
if(! strlen($saved))
return;
@ -196,4 +205,4 @@ function common_friends_visitor_widget($profile_uid) {
'$items' => $r
));
};
};

View file

@ -686,7 +686,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
'$mode' => $mode,
'$user' => $a->user,
'$threads' => $threads,
'$dropping' => ($page_dropping?t('Delete Selected Items'):False),
'$dropping' => ($page_dropping && feature_enabled(local_user(),'multi_delete') ? t('Delete Selected Items') : False),
));
return $o;
@ -887,9 +887,12 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
$geotag = (($x['allow_location']) ? get_markup_template('jot_geotag.tpl') : '');
$plaintext = false;
if(local_user() && intval(get_pconfig(local_user(),'system','plaintext')))
$plaintext = true;
/* $plaintext = false;
if( local_user() && (intval(get_pconfig(local_user(),'system','plaintext')) || !feature_enabled(local_user(),'richtext')) )
$plaintext = true;*/
$plaintext = true;
if( local_user() && feature_enabled(local_user(),'richtext') )
$plaintext = false;
$tpl = get_markup_template('jot-header.tpl');
$a->page['htmlhead'] .= replace_macros($tpl, array(
@ -958,7 +961,7 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
if($notes_cid)
$jotnets .= '<input type="hidden" name="contact_allow[]" value="' . $notes_cid .'" />';
$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
// $tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
$o .= replace_macros($tpl,array(
'$return_path' => $a->query_string,
@ -981,7 +984,7 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
'$title' => "",
'$placeholdertitle' => t('Set title'),
'$category' => "",
'$placeholdercategory' => t('Categories (comma-separated list)'),
'$placeholdercategory' => (feature_enabled(local_user(),'categories') ? t('Categories (comma-separated list)') : ''),
'$wait' => t('Please wait'),
'$permset' => t('Permission settings'),
'$shortpermset' => t('permissions'),
@ -1000,7 +1003,8 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
'$acl' => $x['acl'],
'$bang' => $x['bang'],
'$profile_uid' => $x['profile_uid'],
'$preview' => t('Preview'),
'$preview' => ((feature_enabled($x['profile_uid'],'preview')) ? t('Preview') : ''),
'$jotplugins' => $jotplugins,
'$sourceapp' => t($a->sourcename),
'$cancel' => t('Cancel'),
'$rand_num' => random_digits(12)

View file

@ -38,6 +38,7 @@ function directory_run(&$argv, &$argc){
call_hooks('globaldir_update', $arr);
logger('Updating directory: ' . $arr['url'], LOGGER_DEBUG);
if(strlen($arr['url']))
fetch_url($dir . '?url=' . bin2hex($arr['url']));

67
include/features.php Normal file
View file

@ -0,0 +1,67 @@
<?php
/*
* Features management
*/
function feature_enabled($uid,$feature) {
//return true;
$x = get_pconfig($uid,'feature',$feature);
$arr = array('uid' => $uid, 'feature' => $feature, 'enabled' => $x);
call_hooks('feature_enabled',$arr);
return($arr['enabled']);
}
function get_features() {
$arr = array(
// General
'general' => array(
t('General Features'),
//array('expire', t('Content Expiration'), t('Remove old posts/comments after a period of time')),
array('multi_profiles', t('Multiple Profiles'), t('Ability to create multiple profiles')),
),
// Post composition
'composition' => array(
t('Post Composition Features'),
array('richtext', t('Richtext Editor'), t('Enable richtext editor')),
array('preview', t('Post Preview'), t('Allow previewing posts and comments before publishing them')),
),
// Network sidebar widgets
'widgets' => array(
t('Network Sidebar Widgets'),
array('archives', t('Search by Date'), t('Ability to select posts by date ranges')),
array('groups', t('Group Filter'), t('Enable widget to display Network posts only from selected group')),
array('networks', t('Network Filter'), t('Enable widget to display Network posts only from selected network')),
array('savedsearch', t('Saved Searches'), t('Save search terms for re-use')),
),
// Network tabs
'net_tabs' => array(
t('Network Tabs'),
array('personal_tab', t('Network Personal Tab'), t('Enable tab to display only Network posts that you\'ve interacted on')),
array('new_tab', t('Network New Tab'), t('Enable tab to display only new Network posts (from the last 12 hours)')),
array('link_tab', t('Network Shared Links Tab'), t('Enable tab to display only Network posts with links in them')),
),
// Item tools
'tools' => array(
t('Post/Comment Tools'),
array('multi_delete', t('Multiple Deletion'), t('Select and delete multiple posts/comments at once')),
array('edit_posts', t('Edit Sent Posts'), t('Edit and correct posts and comments after sending')),
array('commtag', t('Tagging'), t('Ability to tag existing posts')),
array('categories', t('Post Categories'), t('Add categories to your posts')),
array('filing', t('Saved Folders'), t('Ability to file posts under folders')),
array('dislike', t('Dislike Posts'), t('Ability to dislike posts/comments')),
array('star_posts', t('Star Posts'), t('Ability to mark special posts with a star indicator')),
),
);
call_hooks('get_features',$arr);
return $arr;
}

View file

@ -885,7 +885,7 @@ function item_store($arr,$force_parent = false) {
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
require_once('Text/LanguageDetect.php');
require_once('library/langdet/Text/LanguageDetect.php');
$naked_body = preg_replace('/\[(.+?)\]/','',$arr['body']);
$l = new Text_LanguageDetect;
$lng = $l->detectConfidence($naked_body);
@ -4031,10 +4031,13 @@ function posted_dates($uid,$wall) {
function posted_date_widget($url,$uid,$wall) {
$o = '';
if(! feature_enabled($uid,'archives'))
return $o;
// For former Facebook folks that left because of "timeline"
if($wall && intval(get_pconfig($uid,'system','no_wall_archive_widget')))
return $o;
/* if($wall && intval(get_pconfig($uid,'system','no_wall_archive_widget')))
return $o;*/
$ret = posted_dates($uid,$wall);
if(! count($ret))

View file

@ -111,6 +111,7 @@ function nav(&$a) {
if(local_user()) {
$nav['network'] = array('network', t('Network'), "", t('Conversations from your friends'));
$nav['net_reset'] = array('network/0?f=&order=comment&nets=all', t('Network Reset'), "", t('Load Network page with no filters'));
$nav['home'] = array('profile/' . $a->user['nickname'], t('Home'), "", t('Your posts and conversations'));
@ -135,7 +136,9 @@ function nav(&$a) {
}
$nav['settings'] = array('settings', t('Settings'),"", t('Account settings'));
$nav['profiles'] = array('profiles', t('Profiles'),"", t('Manage/edit profiles'));
if(feature_enabled(local_user(),'multi_profiles'))
$nav['profiles'] = array('profiles', t('Profiles'),"", t('Manage/Edit Profiles'));
$nav['contacts'] = array('contacts', t('Contacts'),"", t('Manage/edit friends and contacts'));
}

View file

@ -606,6 +606,10 @@ function notifier_run(&$argv, &$argc){
}
continue;
}
// be sure to pick up any stragglers
if(count($this_batch))
proc_run('php','include/delivery.php',$cmd,$item_id,$this_batch);
$deliver_status = 0;

View file

@ -2,6 +2,11 @@
function auto_redir(&$a, $contact_nick) {
// prevent looping
if(x($_REQUEST,'redir') && intval($_REQUEST['redir']))
return;
if((! $contact_nick) || ($contact_nick === $a->user['nickname']))
return;
@ -20,12 +25,15 @@ function auto_redir(&$a, $contact_nick) {
if($domain_st === false)
return;
$baseurl = substr($baseurl, $domain_st + 3);
$nurl = normalise_link($baseurl);
$r = q("SELECT id FROM contact WHERE uid = ( SELECT uid FROM user WHERE nickname = '%s' LIMIT 1 )
AND nick = '%s' AND self = 0 AND url LIKE '%%%s%%' AND blocked = 0 AND pending = 0 LIMIT 1",
AND nick = '%s' AND self = 0 AND ( url LIKE '%%%s%%' or nurl LIKE '%%%s%%' ) AND blocked = 0 AND pending = 0 LIMIT 1",
dbesc($contact_nick),
dbesc($a->user['nickname']),
dbesc($baseurl)
dbesc($baseurl),
dbesc($nurl)
);
if((!$r) || (! count($r)) || $r[0]['id'] == remote_user())
@ -56,6 +64,12 @@ function auto_redir(&$a, $contact_nick) {
$dfrn_id = '0:' . $orig_id;
}
// ensure that we've got a valid ID. There may be some edge cases with forums and non-duplex mode
// that may have triggered some of the "went to {profile/intro} and got an RSS feed" issues
if(strlen($dfrn_id) < 3)
return;
$sec = random_string();
q("INSERT INTO `profile_check` ( `uid`, `cid`, `dfrn_id`, `sec`, `expire`)