Merge remote-tracking branch 'upstream/dev' into wiki

This commit is contained in:
Andrew Manning
2016-06-30 21:51:33 -04:00
319 changed files with 10689 additions and 8258 deletions

View File

@@ -499,11 +499,27 @@ function account_approve($hash) {
intval($register[0]['uid'])
);
// get a fresh copy after we've modified it.
$account = q("SELECT * FROM account WHERE account_id = %d LIMIT 1",
intval($register[0]['uid'])
);
if(! $account)
return $ret;
if(get_config('system','auto_channel_create') || UNO)
auto_channel_create($register[0]['uid']);
else {
$_SESSION['login_return_url'] = 'new_channel';
authenticate_success($account[0],true,true,false,true);
}
info( t('Account verified. Please login.') . EOL );
// info( t('Account verified. Please login.') . EOL );
return true;
}

View File

@@ -1468,7 +1468,7 @@ function find_filename_by_hash($channel_id, $attachHash) {
function pipe_streams($in, $out) {
$size = 0;
while (!feof($in))
$size += fwrite($out, fread($in, 8192));
$size += fwrite($out, fread($in, 16384));
return $size;
}
@@ -1909,4 +1909,4 @@ function get_attach_binname($s) {
$p = substr($p,strpos($p,'/')+1);
}
return $p;
}
}

View File

@@ -498,6 +498,18 @@ function bb_highlight($match) {
return $match[0];
}
function bb_fixtable_lf($match) {
// remove extraneous whitespace between table element tags since newlines will all
// be converted to '<br />' and turn your neatly crafted tables into a whole lot of
// empty space.
$x = preg_replace("/\]\s+\[/",'][',$match[1]);
return '[table]' . $x . '[/table]';
}
// BBcode 2 HTML was written by WAY2WEB.net
// extended to work with Mistpark/Friendica/Redmatrix/Hubzilla - Mike Macgirvin
@@ -579,7 +591,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false)
$Text = preg_replace_callback("/\[code=(.*?)\](.*?)\[\/code\]/ism", 'bb_highlight', $Text);
}
$Text = preg_replace_callback("/\[table\](.*?)\[\/table\]/ism",'bb_fixtable_lf',$Text);
// Convert new line chars to html <br /> tags

View File

@@ -747,6 +747,44 @@ function identity_export_year($channel_id,$year,$month = 0) {
return $ret;
}
// export items within an arbitrary date range. Date/time is in UTC.
function channel_export_items($channel_id,$start,$finish) {
if(! $start)
return array();
else
$start = datetime_convert('UTC','UTC',$start);
$finish = datetime_convert('UTC','UTC',(($finish) ? $finish : 'now'));
if($finish < $start)
return array();
$ret = array();
$ch = channelx_by_n($channel_id);
if($ch) {
$ret['relocate'] = [ 'channel_address' => $ch['channel_address'], 'url' => z_root()];
}
$r = q("select * from item where ( item_wall = 1 or item_type != %d ) and item_deleted = 0 and uid = %d and created >= '%s' and created < '%s' and resource_type = '' order by created",
intval(ITEM_TYPE_POST),
intval($channel_id),
dbesc($start),
dbesc($finish)
);
if($r) {
$ret['item'] = array();
xchan_query($r);
$r = fetch_post_tags($r,true);
foreach($r as $rr)
$ret['item'][] = encode_item($rr,true);
}
return $ret;
}
/**
* @brief Loads a profile into the App structure.
@@ -761,11 +799,10 @@ function identity_export_year($channel_id,$year,$month = 0) {
*
* The channel default theme is also selected for use, unless over-riden elsewhere.
*
* @param[in,out] App &$a
* @param string $nickname
* @param string $profile
*/
function profile_load(&$a, $nickname, $profile = '') {
function profile_load($nickname, $profile = '') {
// logger('profile_load: ' . $nickname . (($profile) ? ' profile: ' . $profile : ''));

View File

@@ -1703,13 +1703,19 @@ function profile_tabs($a, $is_owner = false, $nickname = null){
'title' => t('Manage Webpages'),
'id' => 'webpages-tab',
);
} else {
/**
* @FIXME we probably need a listing of events that were created by
* this channel and are visible to the observer
*/
}
if(feature_enabled($uid,'wiki') && (! UNO)) {
$tabs[] = array(
'label' => t('Wiki'),
'url' => z_root() . '/wiki/' . $nickname,
'sel' => ((argv(0) == 'wiki') ? 'active' : ''),
'title' => t('Wiki'),
'id' => 'wiki-tab',
);
}
$arr = array('is_owner' => $is_owner, 'nickname' => $nickname, 'tab' => (($tab) ? $tab : false), 'tabs' => $tabs);
call_hooks('profile_tabs', $arr);

View File

@@ -52,6 +52,7 @@ function get_features($filtered = true) {
array('advanced_profiles', t('Advanced Profiles'), t('Additional profile sections and selections'),false,get_config('feature_lock','advanced_profiles')),
array('profile_export', t('Profile Import/Export'), t('Save and load profile details across sites/channels'),false,get_config('feature_lock','profile_export')),
array('webpages', t('Web Pages'), t('Provide managed web pages on your channel'),false,get_config('feature_lock','webpages')),
array('wiki', t('Wiki'), t('Provide a wiki for your channel'),((UNO) ? false : true),get_config('feature_lock','wiki')),
array('hide_rating', t('Hide Rating'), t('Hide the rating buttons on your channel and profile pages. Note: People can still rate you somewhere else.'),false,get_config('feature_lock','hide_rating')),
array('private_notes', t('Private Notes'), t('Enables a tool to store notes and reminders (note: not encrypted)'),false,get_config('feature_lock','private_notes')),
array('nav_channel_select', t('Navigation Channel Select'), t('Change channels directly from within the navigation dropdown menu'),false,get_config('feature_lock','nav_channel_select')),

View File

@@ -4,10 +4,10 @@ function js_strings() {
return replace_macros(get_markup_template('js_strings.tpl'), array(
'$delitem' => t('Delete this item?'),
'$comment' => t('Comment'),
'$showmore' => t('[+] show all'),
'$showfewer' => t('[-] show less'),
'$divgrowmore' => t('[+] expand'),
'$divgrowless' => t('[-] collapse'),
'$showmore' => sprintf( t('%s show all'), '<i class=\'fa fa-chevron-down\'></i>'),
'$showfewer' => sprintf( t('%s show less'), '<i class=\'fa fa-chevron-up\'></i>'),
'$divgrowmore' => sprintf( t('%s expand'), '<i class=\'fa fa-chevron-down\'></i>'),
'$divgrowless' => sprintf( t('%s collapse'),'<i class=\'fa fa-chevron-up\'></i>'),
'$pwshort' => t("Password too short"),
'$pwnomatch' => t("Passwords do not match"),
'$everybody' => t('everybody'),

View File

@@ -104,6 +104,8 @@ EOT;
if(feature_enabled($channel['channel_id'],'webpages') && (! UNO))
$nav['usermenu'][] = Array('webpages/' . $channel['channel_address'],t('Webpages'),"",t('Your webpages'),'webpages_nav_btn');
if(feature_enabled($channel['channel_id'],'wiki') && (! UNO))
$nav['usermenu'][] = Array('wiki/' . $channel['channel_address'],t('Wiki'),"",t('Your wiki'),'wiki_nav_btn');
}
else {
if(! get_account_id()) {
@@ -126,7 +128,7 @@ EOT;
$nav['lock'] = array('logout','','lock',
sprintf( t('%s - click to logout'), $observer['xchan_addr']));
}
else {
elseif(! $_SESSION['authenticated']) {
$nav['loginmenu'][] = Array('rmagic',t('Remote authentication'),'',t('Click to authenticate to your home hub'),'rmagic_nav_btn');
}
@@ -143,7 +145,7 @@ EOT;
if((App::$module != 'home') && (! (local_channel())))
$nav['home'] = array($homelink, t('Home'), "", t('Home Page'),'home_nav_btn');
if((App::$config['system']['register_policy'] == REGISTER_OPEN) && (! local_channel()) && (! remote_channel()))
if((App::$config['system']['register_policy'] == REGISTER_OPEN) && (! $_SESSION['authenticated']))
$nav['register'] = array('register',t('Register'), "", t('Create an account'),'register_nav_btn');
if(! get_config('system','hide_help')) {

View File

@@ -101,6 +101,9 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) {
if(x($opts,'cookiefile'))
@curl_setopt($ch, CURLOPT_COOKIEFILE, $opts['cookiefile']);
if(x($opts,'cookie'))
@curl_setopt($ch, CURLOPT_COOKIE, $opts['cookie']);
@curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,
((x($opts,'novalidate') && intval($opts['novalidate'])) ? false : true));
@@ -258,6 +261,10 @@ function z_post_url($url,$params, $redirects = 0, $opts = array()) {
if(x($opts,'cookiefile'))
@curl_setopt($ch, CURLOPT_COOKIEFILE, $opts['cookiefile']);
if(x($opts,'cookie'))
@curl_setopt($ch, CURLOPT_COOKIE, $opts['cookie']);
@curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,
((x($opts,'novalidate') && intval($opts['novalidate'])) ? false : true));
@@ -1336,8 +1343,20 @@ function discover_by_webbie($webbie) {
$fullname = $vcard['fn'];
if($vcard['photo'] && (strpos($vcard['photo'],'http') !== 0))
$vcard['photo'] = $diaspora_base . '/' . $vcard['photo'];
if(($vcard['key']) && (! $pubkey))
$pubkey = $vcard['key'];
if(! $avatar)
$avatar = $vcard['photo'];
if($diaspora) {
if(($vcard['guid']) && (! $diaspora_guid))
$diaspora_guid = $vcard['guid'];
if(($vcard['url']) && (! $diaspora_base))
$diaspora_base = $vcard['url'];
}
}
}