aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Sources.php
diff options
context:
space:
mode:
authornobody <nobody@zotlabs.com>2021-08-25 19:13:31 -0700
committernobody <nobody@zotlabs.com>2021-08-25 19:13:31 -0700
commitaa2106f9495bee4dcf0701fbd9fec8de6fa44984 (patch)
treef2e7178f78311069bd54471f6c063c5901d16fb7 /Zotlabs/Module/Sources.php
parent73b53675b1a339cfd950845279438e35b4e2dc7c (diff)
parent6261d0826c49ca24df9f694931592fbb9bf60f7e (diff)
downloadvolse-hubzilla-aa2106f9495bee4dcf0701fbd9fec8de6fa44984.tar.gz
volse-hubzilla-aa2106f9495bee4dcf0701fbd9fec8de6fa44984.tar.bz2
volse-hubzilla-aa2106f9495bee4dcf0701fbd9fec8de6fa44984.zip
Merge branch 'dev' of https://framagit.org/hubzilla/core into dev
Diffstat (limited to 'Zotlabs/Module/Sources.php')
-rw-r--r--Zotlabs/Module/Sources.php56
1 files changed, 27 insertions, 29 deletions
diff --git a/Zotlabs/Module/Sources.php b/Zotlabs/Module/Sources.php
index e535f6ebf..ef665e727 100644
--- a/Zotlabs/Module/Sources.php
+++ b/Zotlabs/Module/Sources.php
@@ -13,7 +13,7 @@ class Sources extends Controller {
if(! Apps::system_app_installed(local_channel(), 'Channel Sources'))
return;
-
+
$source = intval($_REQUEST['source']);
$xchan = escape_tags($_REQUEST['xchan']);
$abook = intval($_REQUEST['abook']);
@@ -22,21 +22,21 @@ class Sources extends Controller {
$frequency = $_REQUEST['frequency'];
$name = escape_tags($_REQUEST['name']);
$tags = escape_tags($_REQUEST['tags']);
-
+
$channel = \App::get_channel();
-
+
if($name == '*')
$xchan = '*';
-
+
if($abook) {
$r = q("select abook_xchan from abook where abook_id = %d and abook_channel = %d limit 1",
intval($abook),
intval(local_channel())
);
- if($r)
+ if($r)
$xchan = $r[0]['abook_xchan'];
}
-
+
if(! $xchan) {
notice ( t('Failed to create source. No channel selected.') . EOL);
return;
@@ -69,27 +69,25 @@ class Sources extends Controller {
if($r) {
info( t('Source updated.') . EOL);
}
-
+
}
}
-
-
+
+
function get() {
if(! local_channel()) {
notice( t('Permission denied.') . EOL);
return;
}
-
+
if(! Apps::system_app_installed(local_channel(), 'Channel Sources')) {
//Do not display any associated widgets at this point
App::$pdl = '';
-
- $o = '<b>' . t('Sources App') . ' (' . t('Not Installed') . '):</b><br>';
- $o .= t('Automatically import channel content from other channels or feeds');
- return $o;
+ $papp = Apps::get_papp('Channel Sources');
+ return Apps::app_render($papp, 'module');
}
-
+
// list sources
if(argc() == 1) {
$r = q("select source.*, xchan.* from source left join xchan on src_xchan = xchan_hash where src_channel_id = %d",
@@ -111,23 +109,23 @@ class Sources extends Controller {
));
return $o;
}
-
+
if(argc() == 2 && argv(1) === 'new') {
// TODO add the words 'or RSS feed' and corresponding code to manage feeds and frequency
-
+
$o = replace_macros(get_markup_template('sources_new.tpl'), array(
'$title' => t('New Source'),
'$desc' => t('Import all or selected content from the following channel into this channel and distribute it according to your channel settings.'),
'$words' => array( 'words', t('Only import content with these words (one per line)'),'',t('Leave blank to import all public content')),
'$name' => array( 'name', t('Channel Name'), '', '', '', 'autocomplete="off"'),
'$tags' => array('tags', t('Add the following categories to posts imported from this source (comma separated)'),'',t('Optional')),
- '$resend' => [ 'resend', t('Resend posts with this channel as author'), 0, t('Copyrights may apply'), [ t('No'), t('Yes') ]],
+ '$resend' => [ 'resend', t('Resend posts with this channel as author'), 0, t('Copyrights may apply'), [ t('No'), t('Yes') ]],
'$submit' => t('Submit')
));
return $o;
-
+
}
-
+
if(argc() == 2 && intval(argv(1))) {
// edit source
$r = q("select source.*, xchan.* from source left join xchan on src_xchan = xchan_hash where src_id = %d and src_channel_id = %d limit 1",
@@ -144,9 +142,9 @@ class Sources extends Controller {
notice( t('Source not found.') . EOL);
return '';
}
-
+
$r[0]['src_patt'] = htmlspecialchars($r[0]['src_patt'], ENT_QUOTES,'UTF-8');
-
+
$o = replace_macros(get_markup_template('sources_edit.tpl'), array(
'$title' => t('Edit Source'),
'$drop' => t('Delete Source'),
@@ -156,15 +154,15 @@ class Sources extends Controller {
'$xchan' => $r[0]['src_xchan'],
'$abook' => $x[0]['abook_id'],
'$tags' => array('tags', t('Add the following categories to posts imported from this source (comma separated)'),$r[0]['src_tag'],t('Optional')),
- '$resend' => [ 'resend', t('Resend posts with this channel as author'), get_abconfig(local_channel(), $r[0]['xchan_hash'],'system','rself'), t('Copyrights may apply'), [ t('No'), t('Yes') ]],
+ '$resend' => [ 'resend', t('Resend posts with this channel as author'), get_abconfig(local_channel(), $r[0]['xchan_hash'],'system','rself'), t('Copyrights may apply'), [ t('No'), t('Yes') ]],
'$name' => array( 'name', t('Channel Name'), $r[0]['xchan_name'], ''),
'$submit' => t('Submit')
));
return $o;
-
+
}
-
+
if(argc() == 3 && intval(argv(1)) && argv(2) === 'drop') {
$r = q("select * from source where src_id = %d and src_channel_id = %d limit 1",
intval(argv(1)),
@@ -182,12 +180,12 @@ class Sources extends Controller {
info( t('Source removed') . EOL);
else
notice( t('Unable to remove source.') . EOL);
-
+
goaway(z_root() . '/sources');
-
+
}
-
+
// shouldn't get here.
-
+
}
}