aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Widget
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Widget')
-rw-r--r--Zotlabs/Widget/Categories.php32
-rw-r--r--Zotlabs/Widget/Notes.php4
-rw-r--r--Zotlabs/Widget/Tasklist.php9
-rw-r--r--Zotlabs/Widget/Wiki_list.php28
-rw-r--r--Zotlabs/Widget/Wiki_page_history.php36
-rw-r--r--Zotlabs/Widget/Wiki_pages.php110
6 files changed, 20 insertions, 199 deletions
diff --git a/Zotlabs/Widget/Categories.php b/Zotlabs/Widget/Categories.php
index 0c6996d55..0a1c80061 100644
--- a/Zotlabs/Widget/Categories.php
+++ b/Zotlabs/Widget/Categories.php
@@ -17,36 +17,22 @@ class Categories {
function widget($arr) {
- $cards = ((array_key_exists('cards',$arr) && $arr['cards']) ? true : false);
-
- if(($cards) && (! Apps::system_app_installed(App::$profile['profile_uid'], 'Cards')))
- return '';
-
- $articles = ((array_key_exists('articles',$arr) && $arr['articles']) ? true : false);
-
- if(($articles) && (! Apps::system_app_installed(App::$profile['profile_uid'],'Articles')))
- return '';
-
$files = ((array_key_exists('files',$arr) && $arr['files']) ? true : false);
- if((! App::$profile['profile_uid'])
- || (! perm_is_allowed(App::$profile['profile_uid'],get_observer_hash(),(($cards || $articles) ? 'view_pages' : 'view_stream')))) {
+ if(!App::$profile['profile_uid'] || !perm_is_allowed(App::$profile['profile_uid'], get_observer_hash(), 'view_stream')) {
return '';
}
- $cat = ((x($_REQUEST,'cat')) ? htmlspecialchars($_REQUEST['cat'],ENT_COMPAT,'UTF-8') : '');
- $srchurl = (($cards) ? App::$argv[0] . '/' . App::$argv[1] : App::$query_string);
- $srchurl = rtrim(preg_replace('/cat\=[^\&].*?(\&|$)/is','',$srchurl),'&');
- $srchurl = str_replace(array('?f=','&f=', '/?'),array('', '', ''),$srchurl);
+ $cat = ((x($_REQUEST, 'cat')) ? htmlspecialchars($_REQUEST['cat'], ENT_COMPAT, 'UTF-8') : '');
+ $srchurl = App::$query_string;
+ $srchurl = rtrim(preg_replace('/cat\=[^\&].*?(\&|$)/is', '', $srchurl), '&');
+ $srchurl = str_replace(['?f=','&f=', '/?'], ['', '', ''], $srchurl);
- if($cards)
- return cardcategories_widget($srchurl, $cat);
- elseif($articles)
- return articlecategories_widget($srchurl, $cat);
- elseif($files)
+ if($files) {
return filecategories_widget($srchurl, $cat);
- else
- return categories_widget($srchurl, $cat);
+ }
+
+ return categories_widget($srchurl, $cat);
}
}
diff --git a/Zotlabs/Widget/Notes.php b/Zotlabs/Widget/Notes.php
index 2e8e04e93..c9d08c6b7 100644
--- a/Zotlabs/Widget/Notes.php
+++ b/Zotlabs/Widget/Notes.php
@@ -10,6 +10,7 @@
namespace Zotlabs\Widget;
+use App;
use Zotlabs\Lib\Apps;
class Notes {
@@ -18,6 +19,9 @@ class Notes {
if(! local_channel())
return EMPTY_STR;
+ if(App::$profile_uid !== local_channel())
+ return EMPTY_STR;
+
if(! Apps::system_app_installed(local_channel(), 'Notes'))
return EMPTY_STR;
diff --git a/Zotlabs/Widget/Tasklist.php b/Zotlabs/Widget/Tasklist.php
index 5ecfd5a27..96b70af15 100644
--- a/Zotlabs/Widget/Tasklist.php
+++ b/Zotlabs/Widget/Tasklist.php
@@ -7,12 +7,17 @@
namespace Zotlabs\Widget;
+use App;
+
class Tasklist {
function widget($arr) {
- if (! local_channel())
- return;
+ if(! local_channel())
+ return EMPTY_STR;
+
+ if(App::$profile_uid !== local_channel())
+ return EMPTY_STR;
$o .= '<script>var tasksShowAll = 0; $(document).ready(function() { tasksFetch(); $("#tasklist-new-form").submit(function(event) { event.preventDefault(); $.post( "tasks/new", $("#tasklist-new-form").serialize(), function(data) { tasksFetch(); $("#tasklist-new-summary").val(""); } ); return false; } )});</script>';
$o .= '<script>function taskComplete(id) { $.post("tasks/complete/"+id, function(data) { tasksFetch();}); }
diff --git a/Zotlabs/Widget/Wiki_list.php b/Zotlabs/Widget/Wiki_list.php
deleted file mode 100644
index 217ab8706..000000000
--- a/Zotlabs/Widget/Wiki_list.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-/**
- * * Name: Wiki list
- * * Description: A list of existing wikis
- */
-
-namespace Zotlabs\Widget;
-
-class Wiki_list {
-
- function widget($arr) {
-
- $channel = channelx_by_n(\App::$profile_uid);
-
- $wikis = \Zotlabs\Lib\NativeWiki::listwikis($channel,get_observer_hash());
-
- if($wikis) {
- return replace_macros(get_markup_template('wikilist_widget.tpl'), array(
- '$header' => t('Wikis'),
- '$channel' => $channel['channel_address'],
- '$wikis' => $wikis['wikis']
- ));
- }
- return '';
- }
-
-}
diff --git a/Zotlabs/Widget/Wiki_page_history.php b/Zotlabs/Widget/Wiki_page_history.php
deleted file mode 100644
index 3c9f5ed1a..000000000
--- a/Zotlabs/Widget/Wiki_page_history.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-
-/**
- * * Name: Wiki page history
- * * Description: History of an existing wiki page
- * * Requires: wiki
- */
-
-namespace Zotlabs\Widget;
-
-class Wiki_page_history {
-
- function widget($arr) {
-
- $pageUrlName = ((array_key_exists('pageUrlName', $arr)) ? $arr['pageUrlName'] : '');
- $resource_id = ((array_key_exists('resource_id', $arr)) ? $arr['resource_id'] : '');
-
- $pageHistory = \Zotlabs\Lib\NativeWikiPage::page_history([
- 'channel_id' => \App::$profile_uid,
- 'observer_hash' => get_observer_hash(),
- 'resource_id' => $resource_id,
- 'pageUrlName' => $pageUrlName
- ]);
-
- return replace_macros(get_markup_template('nwiki_page_history.tpl'), array(
- '$pageHistory' => $pageHistory['history'],
- '$permsWrite' => $arr['permsWrite'],
- '$name_lbl' => t('Name'),
- '$msg_label' => t('Message','wiki_history'),
- '$date_lbl' => t('Date'),
- '$revert_btn' => t('Revert'),
- '$compare_btn' => t('Compare')
- ));
-
- }
-}
diff --git a/Zotlabs/Widget/Wiki_pages.php b/Zotlabs/Widget/Wiki_pages.php
deleted file mode 100644
index ece712334..000000000
--- a/Zotlabs/Widget/Wiki_pages.php
+++ /dev/null
@@ -1,110 +0,0 @@
-<?php
-
-/**
- * * Name: Wiki pages
- * * Description: A list of existing pages of a wiki
- * * Requires: wiki
- */
-
-namespace Zotlabs\Widget;
-
-use Zotlabs\Lib\NativeWiki;
-
-class Wiki_pages {
-
- function create_missing_page($arr) {
- if(argc() < 4)
- return;
-
- $c = channelx_by_nick(argv(1));
- $w = \Zotlabs\Lib\NativeWiki::exists_by_name($c['channel_id'],NativeWiki::name_decode(argv(2)));
- $arr = array(
- 'resource_id' => $w['resource_id'],
- 'channel_id' => $c['channel_id'],
- 'channel_address' => $c['channel_address'],
- 'refresh' => false
- );
-
- $can_create = perm_is_allowed(\App::$profile['uid'],get_observer_hash(),'write_wiki');
-
- $can_delete = ((local_channel() && (local_channel() == \App::$profile['uid'])) ? true : false);
- $pageName = NativeWiki::name_decode(escape_tags(argv(3)));
-
- $wikiname = $w['urlName'];
- return replace_macros(get_markup_template('wiki_page_not_found.tpl'), array(
- '$resource_id' => $arr['resource_id'],
- '$channel_address' => $arr['channel_address'],
- '$wikiname' => $wikiname,
- '$canadd' => $can_create,
- '$candel' => $can_delete,
- '$addnew' => t('Add new page'),
- '$typelock' => $typelock,
- '$lockedtype' => $w['mimeType'],
- '$mimetype' => mimetype_select(0,$w['mimeType'],
- [ 'text/markdown' => t('Markdown'), 'text/bbcode' => t('BBcode'), 'text/plain' => t('Text') ]),
- '$pageName' => array('missingPageName', 'Create Page' , $pageName),
- '$refresh' => $arr['refresh'],
- '$options' => t('Options'),
- '$submit' => t('Submit')
- ));
- }
-
- function widget($arr) {
-
- if(argc() < 3)
- return;
-
- if(! $arr['resource_id']) {
- $c = channelx_by_nick(argv(1));
- $w = \Zotlabs\Lib\NativeWiki::exists_by_name($c['channel_id'],NativeWiki::name_decode(argv(2)));
- $arr = array(
- 'resource_id' => $w['resource_id'],
- 'channel_id' => $c['channel_id'],
- 'channel_address' => $c['channel_address'],
- 'refresh' => false
- );
- }
-
- $wikiname = '';
-
- $pages = array();
-
- $p = \Zotlabs\Lib\NativeWikiPage::page_list($arr['channel_id'],get_observer_hash(),$arr['resource_id']);
-
- if($p['pages']) {
- $pages = $p['pages'];
- $w = $p['wiki'];
- // Wiki item record is $w['wiki']
- $wikiname = $w['urlName'];
- if (!$wikiname) {
- $wikiname = '';
- }
- $typelock = $w['typelock'];
- }
-
- $can_create = perm_is_allowed(\App::$profile['uid'],get_observer_hash(),'write_wiki');
-
- $can_delete = ((local_channel() && (local_channel() == \App::$profile['uid'])) ? true : false);
-
- return replace_macros(get_markup_template('wiki_page_list.tpl'), array(
- '$resource_id' => $arr['resource_id'],
- '$header' => t('Wiki Pages'),
- '$channel_address' => $arr['channel_address'],
- '$wikiname' => $wikiname,
- '$pages' => $pages,
- '$canadd' => $can_create,
- '$candel' => $can_delete,
- '$addnew' => t('Add new page'),
- '$typelock' => $typelock,
- '$lockedtype' => $w['mimeType'],
- '$mimetype' => mimetype_select(0,$w['mimeType'],
- [ 'text/markdown' => t('Markdown'), 'text/bbcode' => t('BBcode'), 'text/plain' => t('Text') ]),
- '$pageName' => array('pageName', t('Page name')),
- '$refresh' => $arr['refresh'],
- '$options' => t('Options'),
- '$submit' => t('Submit')
- ));
- }
-}
-
-