aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-11-22 15:39:06 -0800
committerzotlabs <mike@macgirvin.com>2017-11-22 15:39:06 -0800
commit6c178d44858bbdfd582d09eb4568d32292c0b2c2 (patch)
treeef71ebbdd8629b8c66a52f8b14d0e9db16670499 /include
parent8bd8af7d16d6b4fb40680bd33b99bbfd582a1208 (diff)
downloadvolse-hubzilla-6c178d44858bbdfd582d09eb4568d32292c0b2c2.tar.gz
volse-hubzilla-6c178d44858bbdfd582d09eb4568d32292c0b2c2.tar.bz2
volse-hubzilla-6c178d44858bbdfd582d09eb4568d32292c0b2c2.zip
article feature
Diffstat (limited to 'include')
-rw-r--r--include/bbcode.php2
-rw-r--r--include/contact_widgets.php48
-rw-r--r--include/conversation.php22
-rw-r--r--include/nav.php11
-rw-r--r--include/taxonomy.php71
5 files changed, 153 insertions, 1 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index 050ab2d29..7ebc8d37c 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -329,6 +329,8 @@ function bb_ShareAttributes($match) {
if(strpos($link,'/cards/'))
$type = t('card');
+ elseif(strpos($link,'/articles/'))
+ $type = t('article');
else
$type = t('post');
diff --git a/include/contact_widgets.php b/include/contact_widgets.php
index 9cc9f0baf..b36471924 100644
--- a/include/contact_widgets.php
+++ b/include/contact_widgets.php
@@ -150,6 +150,54 @@ function cardcategories_widget($baseurl,$selected = '') {
}
+function articlecategories_widget($baseurl,$selected = '') {
+
+ if(! feature_enabled(App::$profile['profile_uid'],'categories'))
+ return '';
+
+ $sql_extra = item_permissions_sql(App::$profile['profile_uid']);
+
+ $item_normal = "and item.item_hidden = 0 and item.item_type = 7 and item.item_deleted = 0
+ and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_pending_remove = 0
+ and item.item_blocked = 0 ";
+
+ $terms = array();
+ $r = q("select distinct(term.term)
+ from term join item on term.oid = item.id
+ where item.uid = %d
+ and term.uid = item.uid
+ and term.ttype = %d
+ and term.otype = %d
+ and item.owner_xchan = '%s'
+ $item_normal
+ $sql_extra
+ order by term.term asc",
+ intval(App::$profile['profile_uid']),
+ intval(TERM_CATEGORY),
+ intval(TERM_OBJ_POST),
+ dbesc(App::$profile['channel_hash'])
+ );
+ if($r && count($r)) {
+ foreach($r as $rr)
+ $terms[] = array('name' => $rr['term'], 'selected' => (($selected == $rr['term']) ? 'selected' : ''));
+
+ return replace_macros(get_markup_template('categories_widget.tpl'),array(
+ '$title' => t('Categories'),
+ '$desc' => '',
+ '$sel_all' => (($selected == '') ? 'selected' : ''),
+ '$all' => t('Everything'),
+ '$terms' => $terms,
+ '$base' => $baseurl,
+
+ ));
+ }
+ return '';
+}
+
+
+
+
+
function common_friends_visitor_widget($profile_uid,$cnt = 25) {
diff --git a/include/conversation.php b/include/conversation.php
index 1cbd9116c..8c75389c4 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -539,6 +539,15 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
$jsreload = $_SESSION['return_url'];
}
+ elseif ($mode === 'articles') {
+ $profile_owner = App::$profile['profile_uid'];
+ $page_writeable = ($profile_owner == local_channel());
+ $live_update_div = '<div id="live-articles"></div>' . "\r\n"
+ . "<script> var profile_uid = " . App::$profile['profile_uid']
+ . "; var netargs = '?f='; var profile_page = " . App::$pager['page'] . "; </script>\r\n";
+ $jsreload = $_SESSION['return_url'];
+ }
+
elseif ($mode === 'display') {
$profile_owner = local_channel();
@@ -714,7 +723,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
$conv_link_mid = (($mode == 'moderate') ? $item['parent_mid'] : $item['mid']);
- $conv_link = (($item['item_type'] == ITEM_TYPE_CARD) ? $item['plink'] : z_root() . '/display/' . gen_link_id($conv_link_mid));
+ $conv_link = ((in_array($item['item_type'],[ ITEM_TYPE_CARD, ITEM_TYPE_ARTICLE] )) ? $item['plink'] : z_root() . '/display/' . gen_link_id($conv_link_mid));
$tmp_item = array(
@@ -1887,6 +1896,17 @@ function profile_tabs($a, $is_owner = false, $nickname = null){
'icon' => 'list'
);
}
+
+ if(feature_enabled($uid,'articles')) {
+ $tabs[] = array(
+ 'label' => t('articles'),
+ 'url' => z_root() . '/articles/' . $nickname,
+ 'sel' => ((argv(0) == 'articles') ? 'active' : ''),
+ 'title' => t('View Articles'),
+ 'id' => 'articles-tab',
+ 'icon' => 'file-text-o'
+ );
+ }
if($has_webpages && feature_enabled($uid,'webpages')) {
$tabs[] = array(
diff --git a/include/nav.php b/include/nav.php
index 2dcf68bc8..8ab401c76 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -491,6 +491,17 @@ function channel_apps($is_owner = false, $nickname = null) {
];
}
+ if($p['view_pages'] && feature_enabled($uid,'articles')) {
+ $tabs[] = [
+ 'label' => t('Articles'),
+ 'url' => z_root() . '/articles/' . $nickname ,
+ 'sel' => ((argv(0) == 'articles') ? 'active' : ''),
+ 'title' => t('View Articles'),
+ 'id' => 'articles-tab',
+ 'icon' => 'file-text-o'
+ ];
+ }
+
if($has_webpages && feature_enabled($uid,'webpages')) {
$tabs[] = [
diff --git a/include/taxonomy.php b/include/taxonomy.php
index 23acaa24d..fbd2a18db 100644
--- a/include/taxonomy.php
+++ b/include/taxonomy.php
@@ -253,6 +253,56 @@ function card_tagadelic($uid, $count = 0, $authors = '', $owner = '', $flags = 0
}
+function article_tagadelic($uid, $count = 0, $authors = '', $owner = '', $flags = 0, $restrict = 0, $type = TERM_CATEGORY) {
+
+ require_once('include/security.php');
+
+ if(! perm_is_allowed($uid,get_observer_hash(),'view_pages'))
+ return array();
+
+
+ $item_normal = item_normal();
+ $sql_options = item_permissions_sql($uid);
+ $count = intval($count);
+
+ if($flags) {
+ if($flags === 'wall')
+ $sql_options .= " and item_wall = 1 ";
+ }
+
+ if($authors) {
+ if(! is_array($authors))
+ $authors = array($authors);
+
+ stringify_array_elms($authors,true);
+ $sql_options .= " and author_xchan in (" . implode(',',$authors) . ") ";
+ }
+
+ if($owner) {
+ $sql_options .= " and owner_xchan = '" . dbesc($owner) . "' ";
+ }
+
+
+ // Fetch tags
+ $r = q("select term, count(term) as total from term left join item on term.oid = item.id
+ where term.uid = %d and term.ttype = %d
+ and otype = %d and item_type = %d and item_private = 0
+ $sql_options $item_normal
+ group by term order by total desc %s",
+ intval($uid),
+ intval($type),
+ intval(TERM_OBJ_POST),
+ intval($restrict),
+ ((intval($count)) ? "limit $count" : '')
+ );
+
+ if(! $r)
+ return array();
+
+ return Zotlabs\Text\Tagadelic::calc($r);
+
+}
+
@@ -395,6 +445,27 @@ function card_catblock($uid,$count = 0,$authors = '',$owner = '', $flags = 0,$re
}
+function article_catblock($uid,$count = 0,$authors = '',$owner = '', $flags = 0,$restrict = 0,$type = TERM_CATEGORY) {
+ $o = '';
+
+ $r = article_tagadelic($uid,$count,$authors,$owner,$flags,$restrict,$type);
+
+ if($r) {
+ $c = q("select channel_address from channel where channel_id = %d limit 1",
+ intval($uid)
+ );
+
+ $o = '<div class="tagblock widget"><h3>' . t('Categories') . '</h3><div class="tags" align="center">';
+ foreach($r as $rr) {
+ $o .= '<a href="articles/' . $c[0]['channel_address']. '?f=&cat=' . urlencode($rr[0]).'" class="tag'.$rr[2].'">'.$rr[0].'</a> ' . "\r\n";
+ }
+ $o .= '</div></div>';
+ }
+
+ return $o;
+}
+
+
function dir_tagblock($link,$r) {
$o = '';