aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Widget
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Widget')
-rw-r--r--Zotlabs/Widget/Activity.php10
-rw-r--r--Zotlabs/Widget/Appcategories.php2
-rw-r--r--Zotlabs/Widget/Appstore.php7
-rw-r--r--Zotlabs/Widget/Forums.php10
-rw-r--r--Zotlabs/Widget/Pinned.php58
5 files changed, 43 insertions, 44 deletions
diff --git a/Zotlabs/Widget/Activity.php b/Zotlabs/Widget/Activity.php
index 04e9fc4b1..5d9795c7e 100644
--- a/Zotlabs/Widget/Activity.php
+++ b/Zotlabs/Widget/Activity.php
@@ -35,7 +35,7 @@ class Activity {
}
}
foreach($contributors as $k => $v) {
- $arr[] = [ 'author_xchan' => $k, 'total' => $v ];
+ $arr[] = [ 'author_xchan' => $k, 'total' => $v ];
}
usort($arr,'total_sort');
xchan_query($arr);
@@ -43,19 +43,19 @@ class Activity {
$x = [ 'entries' => $arr ];
call_hooks('activity_widget',$x);
- $arr = $x['entries'];
+ $arr = $x['entries'];
if($arr) {
$o .= '<div class="widget">';
- $o .= '<h3>' . t('Activity','widget') . '</h3><ul class="nav nav-pills flex-column">';
+ $o .= '<h3>' . t('Activity','widget') . '</h3><ul class="nav rounded-pill flex-column">';
foreach($arr as $rv) {
- $o .= '<li class="nav-item"><a class="nav-link" href="network?f=&xchan=' . urlencode($rv['author_xchan']) . '" ><span class="badge badge-secondary float-right">' . ((intval($rv['total'])) ? intval($rv['total']) : '') . '</span><img src="' . $rv['author']['xchan_photo_s'] . '" class="menu-img-1" /> ' . $rv['author']['xchan_name'] . '</a></li>';
+ $o .= '<li class="nav-item"><a class="nav-link" href="network?f=&xchan=' . urlencode($rv['author_xchan']) . '" ><span class="badge bg-secondary float-end">' . ((intval($rv['total'])) ? intval($rv['total']) : '') . '</span><img src="' . $rv['author']['xchan_photo_s'] . '" class="menu-img-1" /> ' . $rv['author']['xchan_name'] . '</a></li>';
}
$o .= '</ul></div>';
}
return $o;
}
-}
+}
diff --git a/Zotlabs/Widget/Appcategories.php b/Zotlabs/Widget/Appcategories.php
index aebd144d0..e916f095f 100644
--- a/Zotlabs/Widget/Appcategories.php
+++ b/Zotlabs/Widget/Appcategories.php
@@ -40,7 +40,7 @@ class Appcategories {
$terms[] = array('name' => $rr['term'], 'selected' => (($selected == $rr['term']) ? 'selected' : ''));
return replace_macros(get_markup_template('categories_widget.tpl'),array(
- '$title' => t('Categories'),
+ '$title' => t('App Categories'),
'$desc' => '',
'$sel_all' => (($selected == '') ? 'selected' : ''),
'$all' => t('Everything'),
diff --git a/Zotlabs/Widget/Appstore.php b/Zotlabs/Widget/Appstore.php
index 6a00ac06a..da05c0b62 100644
--- a/Zotlabs/Widget/Appstore.php
+++ b/Zotlabs/Widget/Appstore.php
@@ -6,12 +6,11 @@ namespace Zotlabs\Widget;
class Appstore {
function widget($arr) {
- $store = ((argc() > 1 && argv(1) === 'available') ? 1 : 0);
- return replace_macros(get_markup_template('appstore.tpl'), [
+ return replace_macros(get_markup_template('appstore.tpl'), [
'$title' => t('App Collections'),
'$options' => [
- [ z_root() . '/apps', t('Installed apps'), 1 - $store ],
- [ z_root() . '/apps/available', t('Available Apps'), $store ]
+ [z_root() . '/apps', t('Installed apps'), ((argc() == 1 && argv(0) === 'apps') ? 1 : 0)],
+ [z_root() . '/apps/available', t('Available Apps'), ((argc() > 1 && argv(1) === 'available') ? 1 : 0)]
]
]);
}
diff --git a/Zotlabs/Widget/Forums.php b/Zotlabs/Widget/Forums.php
index d3e2f2534..2af7347f1 100644
--- a/Zotlabs/Widget/Forums.php
+++ b/Zotlabs/Widget/Forums.php
@@ -34,7 +34,7 @@ class Forums {
intval(local_channel())
);
- if($x2) {
+ if($x2) {
$xf = ids_to_querystr($x2,'xchan',true);
// private forums
@@ -47,7 +47,7 @@ class Forums {
}
}
- $sql_extra = (($xf) ? " and ( xchan_hash in (" . $xf . ") or xchan_pubforum = 1 ) " : " and xchan_pubforum = 1 ");
+ $sql_extra = (($xf) ? " and ( xchan_hash in (" . $xf . ") or xchan_pubforum = 1 ) " : " and xchan_pubforum = 1 ");
@@ -64,7 +64,7 @@ class Forums {
// There also should be a way to update this via ajax.
for($x = 0; $x < count($r1); $x ++) {
- $r = q("select sum(item_unseen) as unseen from item
+ $r = q("select sum(item_unseen) as unseen from item
where uid = %d and owner_xchan = '%s' and item_unseen = 1 $perms_sql ",
intval(local_channel()),
dbesc($r1[$x]['xchan_hash'])
@@ -109,12 +109,12 @@ class Forums {
}
}
}
-
+
if($unseen && (! intval($rr['unseen'])))
continue;
- $o .= '<li class="nav-item"><a class="nav-link" href="' . $link . '" ><span class="badge badge-secondary float-right">' . ((intval($rr['unseen'])) ? intval($rr['unseen']) : '') . '</span><img class ="menu-img-1" src="' . $rr['xchan_photo_s'] . '" /> ' . $rr['xchan_name'] . '</a></li>';
+ $o .= '<li class="nav-item"><a class="nav-link" href="' . $link . '" ><span class="badge bg-secondary float-end">' . ((intval($rr['unseen'])) ? intval($rr['unseen']) : '') . '</span><img class ="menu-img-1" src="' . $rr['xchan_photo_s'] . '" /> ' . $rr['xchan_name'] . '</a></li>';
}
$o .= '</ul></div>';
}
diff --git a/Zotlabs/Widget/Pinned.php b/Zotlabs/Widget/Pinned.php
index cad139a91..66d06bbd3 100644
--- a/Zotlabs/Widget/Pinned.php
+++ b/Zotlabs/Widget/Pinned.php
@@ -40,15 +40,15 @@ class Pinned {
$observer = \App::get_observer();
foreach($items as $item) {
-
- $midb64 = 'b64.' . base64url_encode($item['mid']);
-
+
+ $midb64 = gen_link_id($item['mid']);
+
if(isset($observer['xchan_hash']) && in_array($observer['xchan_hash'], get_pconfig($item['uid'], 'pinned_hide', $midb64, [])))
continue;
-
+
$author = channelx_by_hash($item['author_xchan']);
$owner = channelx_by_hash($item['owner_xchan']);
-
+
$profile_avatar = $author['xchan_photo_m'];
$profile_link = chanlink_hash($item['author_xchan']);
$profile_name = $author['xchan_name'];
@@ -71,7 +71,7 @@ class Pinned {
$isevent = true;
}
}
-
+
$consensus = (intval($item['item_consensus']) ? true : false);
if($consensus) {
$conv_responses['agree'] = [ 'title' => t('Agree','title') ];
@@ -87,7 +87,7 @@ class Pinned {
$verified = (intval($item['item_verified']) ? t('Message signature validated') : '');
$forged = ((! intval($item['item_verified']) && $item['sig']) ? t('Message signature incorrect') : '');
-
+
$shareable = ((local_channel() && \App::$profile_uid == local_channel() && $item['item_private'] != 1) ? true : false);
if ($shareable) {
// This actually turns out not to be possible in some protocol stacks without opening up hundreds of new issues.
@@ -102,9 +102,9 @@ class Pinned {
$is_new = boolval(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0);
$body = prepare_body($item,true);
-
+
$str = [
- 'item_type' => intval($item['item_type']),
+ 'item_type' => intval($item['item_type']),
'body' => $body['html'],
'tags' => $body['tags'],
'categories' => $body['categories'],
@@ -115,7 +115,7 @@ class Pinned {
'id' => $item['id'],
'mids' => json_encode([ $midb64 ]),
'isevent' => $isevent,
- 'attend' => $attend,
+ 'attend' => $attend,
'consensus' => $consensus,
'conlabels' => ($canvote ? $conlabels : []),
'canvote' => $canvote,
@@ -158,55 +158,55 @@ class Pinned {
'modal_dismiss' => t('Close'),
'responses' => $conv_responses
];
-
- $tpl = get_markup_template('pinned_item.tpl');
+
+ $tpl = get_markup_template('pinned_item.tpl');
$ret['html'] .= replace_macros($tpl, $str);
}
return $ret;
}
-
+
/*
* @brief List pinned items depend on type
*
* @param $types
* @return array of pinned items
*
- */
+ */
private function list($types) {
if(empty($types) || (! is_array($types)))
return [];
-
+
$item_types = array_intersect($this->allowed_types, $types);
if(empty($item_types))
return [];
-
+
$mids_list = [];
-
+
foreach($item_types as $type) {
-
+
$mids = get_pconfig($this->uid, 'pinned', $type, []);
foreach($mids as $mid) {
- if(! empty($mid) && strpos($mid,'b64.') === 0)
- $mids_list[] = @base64url_decode(substr($mid,4));
+ if(!empty($mid))
+ $mids_list[] = unpack_link_id($mid);
}
}
if(empty($mids_list))
return [];
-
+
$r = q("SELECT * FROM item WHERE mid IN ( '%s' ) AND uid = %d AND id = parent AND item_private = 0 ORDER BY created DESC",
dbesc(implode(",", $mids_list)),
intval($this->uid)
);
if($r)
return $r;
-
+
return [];
}
-
+
/*
* @brief List activities on item
*
@@ -214,7 +214,7 @@ class Pinned {
* @param array $conv_responses
* @return array
*
- */
+ */
private function activity($item, &$conv_responses) {
foreach(array_keys($conv_responses) as $verb) {
@@ -256,23 +256,23 @@ class Pinned {
unset($conv_responses[$verb]);
continue;
}
-
+
$conv_responses[$verb]['count'] = count($r);
$conv_responses[$verb]['button'] = get_response_button_text($verb, $conv_responses[$verb]['count']);
-
+
foreach($r as $rr) {
-
+
$author = q("SELECT * FROM xchan WHERE xchan_hash = '%s' LIMIT 1",
dbesc($rr['author_xchan'])
);
$name = (($author && $author[0]['xchan_name']) ? $author[0]['xchan_name'] : t('Unknown'));
$conv_responses[$verb]['list'][] = (($rr['author_xchan'] && $author && $author[0]['xchan_photo_s']) ?
- '<a class="dropdown-item" href="' . chanlink_hash($rr['author_xchan']) . '">' . '<img class="menu-img-1" src="' . zid($author[0]['xchan_photo_s']) . '" alt="' . urlencode($name) . '" /> ' . $name . '</a>' :
+ '<a class="dropdown-item" href="' . chanlink_hash($rr['author_xchan']) . '">' . '<img class="menu-img-1" src="' . zid($author[0]['xchan_photo_s']) . '" alt="' . urlencode($name) . '" /> ' . $name . '</a>' :
'<a class="dropdown-item" href="#" class="disabled">' . $name . '</a>'
);
}
}
-
+
$conv_responses['count'] = count($conv_responses);
}
}