aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2016-06-30 21:51:33 -0400
committerAndrew Manning <tamanning@zoho.com>2016-06-30 21:51:33 -0400
commit0fd8eeec23a0613db8ea6c5bb54b4658ddaa0e61 (patch)
treeb6684b05aee92729406a90f397ccd446f58863c7 /include
parent7124c0aee5486aab74272c81ceb3e383b2e3a7f7 (diff)
parent852b2659e9a71f0542e822aa20efc009e22ff66a (diff)
downloadvolse-hubzilla-0fd8eeec23a0613db8ea6c5bb54b4658ddaa0e61.tar.gz
volse-hubzilla-0fd8eeec23a0613db8ea6c5bb54b4658ddaa0e61.tar.bz2
volse-hubzilla-0fd8eeec23a0613db8ea6c5bb54b4658ddaa0e61.zip
Merge remote-tracking branch 'upstream/dev' into wiki
Diffstat (limited to 'include')
-rw-r--r--include/account.php18
-rw-r--r--include/attach.php4
-rw-r--r--include/bbcode.php14
-rw-r--r--include/channel.php41
-rw-r--r--include/conversation.php16
-rw-r--r--include/features.php1
-rw-r--r--include/js_strings.php8
-rw-r--r--include/nav.php6
-rw-r--r--include/network.php19
9 files changed, 110 insertions, 17 deletions
diff --git a/include/account.php b/include/account.php
index caf12878e..c02a74928 100644
--- a/include/account.php
+++ b/include/account.php
@@ -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;
}
diff --git a/include/attach.php b/include/attach.php
index 4961d7f91..b3ddfee88 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -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;
-} \ No newline at end of file
+}
diff --git a/include/bbcode.php b/include/bbcode.php
index 0bf326506..7f7be4300 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -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
diff --git a/include/channel.php b/include/channel.php
index a7624f060..95506ed78 100644
--- a/include/channel.php
+++ b/include/channel.php
@@ -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 : ''));
diff --git a/include/conversation.php b/include/conversation.php
index d2d4ffca0..957dbf8e9 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -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);
diff --git a/include/features.php b/include/features.php
index 6d38bcfb4..2d71aa9be 100644
--- a/include/features.php
+++ b/include/features.php
@@ -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')),
diff --git a/include/js_strings.php b/include/js_strings.php
index b1817f373..1b4668061 100644
--- a/include/js_strings.php
+++ b/include/js_strings.php
@@ -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'),
diff --git a/include/nav.php b/include/nav.php
index 70faec598..6a79b6530 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -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')) {
diff --git a/include/network.php b/include/network.php
index 91dac936e..47863b680 100644
--- a/include/network.php
+++ b/include/network.php
@@ -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'];
+
+
+
+
+ }
}
}