aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/item.php5
-rw-r--r--mod/network.php2
-rw-r--r--mod/pubsub.php4
-rw-r--r--mod/search.php2
-rw-r--r--mod/tagmatch.php52
5 files changed, 61 insertions, 4 deletions
diff --git a/mod/item.php b/mod/item.php
index e5d4eea82..b8c0683aa 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -779,6 +779,11 @@ function item_post(&$a) {
}
}
+ // fallback so that parent always gets set to non-zero.
+
+ if(! $parent)
+ $parent = $post_id;
+
$r = q("UPDATE `item` SET `parent` = %d, `parent-uri` = '%s', `plink` = '%s', `changed` = '%s', `last-child` = 1, `visible` = 1
WHERE `id` = %d LIMIT 1",
intval($parent),
diff --git a/mod/network.php b/mod/network.php
index 371a35402..f0e9e4441 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -137,7 +137,7 @@ function saved_searches($search) {
if(count($r)) {
$o .= '<ul id="saved-search-ul">' . "\r\n";
foreach($r as $rr) {
- $o .= '<li class="saved-search-li clear"><a href="network/?f=&remove=1&search=' . $rr['term'] . '" class="icon drophide savedsearchdrop" title="' . t('Remove term') . '" onclick="return confirmDelete();" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></a> <a href="network/?f&search=' . $rr['term'] . '" class="savedsearchterm" >' . $rr['term'] . '</a></li>' . "\r\n";
+ $o .= '<li class="saved-search-li clear"><a href="network/?f=&remove=1&search=' . $rr['term'] . '" class="icon drophide savedsearchdrop" title="' . t('Remove term') . '" onclick="return confirmDelete();" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></a> <a href="network/?f&search=' . urlencode($rr['term']) . '" class="savedsearchterm" >' . $rr['term'] . '</a></li>' . "\r\n";
}
$o .= '</ul>';
}
diff --git a/mod/pubsub.php b/mod/pubsub.php
index b2f006927..0c506db00 100644
--- a/mod/pubsub.php
+++ b/mod/pubsub.php
@@ -132,11 +132,11 @@ function pubsub_post(&$a) {
require_once('include/items.php');
- consume_feed($xml,$importer,$contact,$feedhub,1);
+ consume_feed($xml,$importer,$contact,$feedhub,1,1);
// do it a second time so that any children find their parents.
- consume_feed($xml,$importer,$contact,$feedhub,1);
+ consume_feed($xml,$importer,$contact,$feedhub,1,2);
hub_post_return();
diff --git a/mod/search.php b/mod/search.php
index 396b50738..034794e17 100644
--- a/mod/search.php
+++ b/mod/search.php
@@ -13,7 +13,7 @@ function search_saved_searches() {
$o .= '<h3>' . t('Saved Searches') . '</h3>' . "\r\n";
$o .= '<ul id="saved-search-ul">' . "\r\n";
foreach($r as $rr) {
- $o .= '<li class="saved-search-li clear"><a href="search/?f=&remove=1&search=' . $rr['term'] . '" class="icon drophide savedsearchdrop" title="' . t('Remove term') . '" onclick="return confirmDelete();" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></a> <a href="search/?f&search=' . $rr['term'] . '" class="savedsearchterm" >' . $rr['term'] . '</a></li>' . "\r\n";
+ $o .= '<li class="saved-search-li clear"><a href="search/?f=&remove=1&search=' . $rr['term'] . '" class="icon drophide savedsearchdrop" title="' . t('Remove term') . '" onclick="return confirmDelete();" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></a> <a href="search/?f=&search=' . $rr['term'] . '" class="savedsearchterm" >' . $rr['term'] . '</a></li>' . "\r\n";
}
$o .= '</ul></div>' . "\r\n";
}
diff --git a/mod/tagmatch.php b/mod/tagmatch.php
new file mode 100644
index 000000000..8023fa433
--- /dev/null
+++ b/mod/tagmatch.php
@@ -0,0 +1,52 @@
+<?php
+
+
+function tagmatch_content(&$a) {
+
+ $search = notags(trim($_REQUEST['search']));
+
+ $o = '';
+
+ $o .= '<h2>' . t('Tag Match') . ' - ' . $search . '</h2>';
+
+ if($search) {
+
+ $p = (($a->pager['page'] != 1) ? '&p=' . $a->pager['page'] : '');
+
+ if(strlen(get_config('system','directory_submit_url')))
+ $x = fetch_url('http://dir.friendika.com/lsearch?f=' . $p . '&search=' . urlencode($search));
+
+//TODO fallback local search if global dir not available.
+// else
+// $x = post_url($a->get_baseurl() . '/lsearch', $params);
+
+ $j = json_decode($x);
+
+ if($j->total) {
+ $a->set_pager_total($j->total);
+ $a->set_pager_itemspage($j->items_page);
+ }
+
+ if(count($j->results)) {
+
+ $tpl = get_markup_template('match.tpl');
+ foreach($j->results as $jj) {
+
+ $o .= replace_macros($tpl,array(
+ '$url' => $jj->url,
+ '$name' => $jj->name,
+ '$photo' => $jj->photo,
+ '$tags' => $jj->tags
+ ));
+ }
+ }
+ else {
+ info( t('No matches') . EOL);
+ }
+
+ }
+
+ $o .= '<div class="clear"></div>';
+ $o .= paginate($a);
+ return $o;
+}