aboutsummaryrefslogtreecommitdiffstats
path: root/mod/sources.php
diff options
context:
space:
mode:
authorPaolo T <tuscanhobbit@users.noreply.github.com>2014-02-25 16:33:40 +0100
committerPaolo T <tuscanhobbit@users.noreply.github.com>2014-02-25 16:33:40 +0100
commit0a98f6b878ec89be7282621192d9daf80f125e6c (patch)
tree718a4771ce1fb86931531226898b0b5d00e4a337 /mod/sources.php
parent34d30e4d7eb48bd801482531a0d775328bd43ab4 (diff)
parentb1021df485fb6129acda5bba616bac10aea75a45 (diff)
downloadvolse-hubzilla-0a98f6b878ec89be7282621192d9daf80f125e6c.tar.gz
volse-hubzilla-0a98f6b878ec89be7282621192d9daf80f125e6c.tar.bz2
volse-hubzilla-0a98f6b878ec89be7282621192d9daf80f125e6c.zip
Merge pull request #1 from friendica/master
Update this fork
Diffstat (limited to 'mod/sources.php')
-rw-r--r--mod/sources.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/mod/sources.php b/mod/sources.php
index 125184d47..f4b36508f 100644
--- a/mod/sources.php
+++ b/mod/sources.php
@@ -9,11 +9,29 @@ function sources_post(&$a) {
$source = intval($_REQUEST['source']);
$xchan = $_REQUEST['xchan'];
+ $abook = intval($_REQUEST['abook']);
$words = $_REQUEST['words'];
$frequency = $_REQUEST['frequency'];
+ $name = $_REQUEST['name'];
$channel = $a->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_user())
+ );
+ if($r)
+ $xchan = $r[0]['abook_xchan'];
+ }
+
+ if(! $xchan) {
+ notice ( t('Failed to create source. No channel selected.') . EOL);
+ return;
+ }
if(! $source) {
$r = q("insert into source ( src_channel_id, src_channel_xchan, src_xchan, src_patt )
@@ -60,6 +78,9 @@ function sources_content(&$a) {
);
if($r) {
for($x = 0; $x < count($r); $x ++) {
+ if($r[$x]['src_xchan'] == '*') {
+ $r[$x]['xchan_name'] = t('*');
+ }
$r[$x]['src_patt'] = htmlspecialchars($r[$x]['src_patt'], ENT_COMPAT,'UTF-8');
}
}
@@ -92,6 +113,12 @@ function sources_content(&$a) {
intval(argv(1)),
intval(local_user())
);
+ if($r) {
+ $x = q("select abook_id from abook where abook_xchan = '%s' and abook_channel = %d limit 1",
+ dbesc($r[0]['src_xchan']),
+ intval(local_user())
+ );
+ }
if(! $r) {
notice( t('Source not found.') . EOL);
return '';
@@ -106,6 +133,7 @@ function sources_content(&$a) {
'$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)'),$r[0]['src_patt'],t('Leave blank to import all public content')),
'$xchan' => $r[0]['src_xchan'],
+ '$abook' => $x[0]['abook_id'],
'$name' => array( 'name', t('Channel Name'), $r[0]['xchan_name'], ''),
'$submit' => t('Submit')
));