aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorChristian Vogeley <christian.vogeley@hotmail.de>2013-09-15 03:21:19 +0200
committerChristian Vogeley <christian.vogeley@hotmail.de>2013-09-15 03:21:19 +0200
commit4132d1cd8e59d2cf84d7578ac700c65d7954edd6 (patch)
tree5586bb1bf97ad9e457de2eacb298d28e22c854ee /mod
parent496f869157ab76139d14a3c67fd8276ee6557517 (diff)
parentaefb0f823353d15a281d3c94ec6fc044e1b62580 (diff)
downloadvolse-hubzilla-4132d1cd8e59d2cf84d7578ac700c65d7954edd6.tar.gz
volse-hubzilla-4132d1cd8e59d2cf84d7578ac700c65d7954edd6.tar.bz2
volse-hubzilla-4132d1cd8e59d2cf84d7578ac700c65d7954edd6.zip
Upstream merge
Diffstat (limited to 'mod')
-rw-r--r--mod/chanman.php29
-rw-r--r--mod/channel.php5
-rw-r--r--mod/directory.php2
-rw-r--r--mod/dirfind.php68
-rw-r--r--mod/dirsearch.php6
-rw-r--r--mod/display.php2
-rw-r--r--mod/filestorage.php70
-rw-r--r--mod/import.php4
-rw-r--r--mod/item.php3
-rwxr-xr-xmod/like.php3
-rwxr-xr-xmod/mood.php4
-rw-r--r--mod/photos.php4
-rw-r--r--mod/post.php17
-rwxr-xr-xmod/subthread.php3
-rw-r--r--mod/zfinger.php14
15 files changed, 147 insertions, 87 deletions
diff --git a/mod/chanman.php b/mod/chanman.php
new file mode 100644
index 000000000..2657e7be9
--- /dev/null
+++ b/mod/chanman.php
@@ -0,0 +1,29 @@
+<?php /** @file */
+
+
+/**
+ Placeholder file at present. This is going to involve a bit of work.
+
+ This file will deal with the deletion of channels and management of hublocs.
+
+ We need to provide the following functionality:
+
+ - Delete my account and all channels from the entire network
+
+ - Delete my account and all channels from this server
+
+ - Delete a channel from the entire network
+
+ - Delete a channel from this server
+
+ - List all hub locations for this channel
+
+ - Remove this/some hub location from this channel
+
+ - promote this/some hub location to primary
+
+ - Remove hub location 'xyz' from this channel, (this should possibly only be allowed if that hub has been down for a period of time)
+
+ - Some of these actions should probably require email verification
+
+*/
diff --git a/mod/channel.php b/mod/channel.php
index 2544018f8..5a66f5e07 100644
--- a/mod/channel.php
+++ b/mod/channel.php
@@ -186,9 +186,8 @@ function channel_content(&$a, $update = 0, $load = false) {
$sql_extra2 .= protect_sprintf(sprintf(" AND item.created >= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery2))));
}
-
- $a->set_pager_itemspage(40);
-
+ $itemspage = get_pconfig(local_user(),'system','itemspage');
+ $a->set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20));
$pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage']));
if($load) {
diff --git a/mod/directory.php b/mod/directory.php
index b7cdaffe7..823c33cf7 100644
--- a/mod/directory.php
+++ b/mod/directory.php
@@ -70,7 +70,7 @@ function directory_content(&$a) {
if($url) {
$query = $url . '?f=' ;
if($search)
- $query .= '&name=' . urlencode($search);
+ $query .= '&name=' . urlencode($search) . '&keywords=' . urlencode($search);
if(strpos($search,'@'))
$query .= '&address=' . urlencode($search);
diff --git a/mod/dirfind.php b/mod/dirfind.php
deleted file mode 100644
index 54bbf31af..000000000
--- a/mod/dirfind.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-
-function dirfind_init(&$a) {
-
- require_once('include/contact_widgets.php');
-
- if(! x($a->page,'aside'))
- $a->page['aside'] = '';
-
- $a->page['aside'] .= follow_widget();
-
- $a->page['aside'] .= findpeople_widget();
-}
-
-
-
-function dirfind_content(&$a) {
-
- $search = notags(trim($_REQUEST['search']));
-
- if(strpos($search,'@') === 0)
- $search = substr($search,1);
-
- $o = '';
-
- $o .= '<h2>' . t('People Search') . ' - ' . $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.friendica.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' => zid($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;
-}
diff --git a/mod/dirsearch.php b/mod/dirsearch.php
index 064c3f287..6034fdc12 100644
--- a/mod/dirsearch.php
+++ b/mod/dirsearch.php
@@ -113,11 +113,11 @@ function dirsearch_content(&$a) {
if($mtime) {
$qlimit = '';
- $sql_extra .= " and xchan_hash in ( select ud_hash from updates where ud_date > '" . dbesc($mtime) . "' ) ";
+// $sql_extra .= " and xchan_hash in ( select ud_hash from updates where ud_date > '" . dbesc($mtime) . "' ) ";
}
if($sort_order == 'date')
- $order = " order by ud_date desc ";
+ $order = ""; // " order by ud_date desc ";
elseif($sort_order == 'reverse')
$order = " order by xchan_name desc ";
else
@@ -125,7 +125,7 @@ function dirsearch_content(&$a) {
- $r = q("SELECT xchan.*, xprof.*, updates.* from xchan left join xprof on xchan_hash = xprof_hash left join updates on xchan_hash = ud_hash where $logic $sql_extra and not ( xchan_flags & %d ) and not ( xchan_flags & %d ) $order $qlimit ",
+ $r = q("SELECT xchan.*, xprof.* from xchan left join xprof on xchan_hash = xprof_hash where $logic $sql_extra and not ( xchan_flags & %d ) and not ( xchan_flags & %d ) $order $qlimit ",
intval(XCHAN_FLAGS_HIDDEN),
intval(XCHAN_FLAGS_ORPHAN)
);
diff --git a/mod/display.php b/mod/display.php
index 63b5fa29b..d19502eb1 100644
--- a/mod/display.php
+++ b/mod/display.php
@@ -3,7 +3,7 @@
function display_content(&$a, $update = 0, $load = false) {
- logger("mod-display: update = $update load = $load");
+// logger("mod-display: update = $update load = $load");
if(intval(get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
notice( t('Public access denied.') . EOL);
diff --git a/mod/filestorage.php b/mod/filestorage.php
new file mode 100644
index 000000000..41055f98e
--- /dev/null
+++ b/mod/filestorage.php
@@ -0,0 +1,70 @@
+<?php
+
+function filestorage_content(&$a) {
+
+ if(argc() > 1)
+ $which = argv(1);
+ else {
+ notice( t('Requested profile is not available.') . EOL );
+ $a->error = 404;
+ return;
+ }
+
+ $r = q("select channel_id from channel where channel_address = '%s'",
+ dbesc($which)
+ );
+ if($r) {
+ $owner = intval($r[0]['channel_id']);
+ }
+
+ $is_owner = (((local_user()) && ($owner == local_user())) ? true : false);
+ if (! $is_owner) {
+ info( t('Permission Denied.') . EOL );
+ return;
+ }
+ if ((argc() > 3 && argv(3) === 'delete') ? true : false);{
+ $file = argv(2);
+ $r = q("delete from attach where id = '%s' and uid = '%s' limit 1",
+ dbesc($file),
+ intval($owner)
+ );
+
+
+ }
+
+
+$r = q("select * from attach where uid = %d order by filename asc",
+ intval($owner)
+);
+
+ $files = null;
+
+ if($r) {
+ $files = array();
+ foreach($r as $rr) {
+ $files[$rr['id']][] = array('id' => $rr['id'],'download' => $rr['hash'], 'title' => $rr['filename'], 'size' => $rr['filesize']);
+ }
+ }
+
+
+ $limit = service_class_fetch ($owner,'attach_upload_limit');
+ $r = q("select sum(filesize) as total from attach where uid = %d ",
+ intval($owner)
+ );
+ $used = $r[0]['total'];
+
+ $url = z_root() . "/filestorage/" . $which;
+ return $o . replace_macros(get_markup_template("filestorage.tpl"), array(
+ '$baseurl' => $url,
+ '$download' => t('Download'),
+ '$files' => $files,
+ '$channel' => $which,
+ '$delete' => t('Delete'),
+ '$used' => $used,
+ '$usedlabel' => t('Used: '),
+ '$limit' => $limit,
+ '$limitlabel' => t('Limit: '),
+ ));
+
+
+}
diff --git a/mod/import.php b/mod/import.php
index 08311013a..e2e54c0cd 100644
--- a/mod/import.php
+++ b/mod/import.php
@@ -347,6 +347,10 @@ function import_post(&$a) {
}
+ // This will indirectly perform a refresh_all *and* update the directory
+
+ proc_run('php', 'include/directory.php', $channel['channel_id']);
+
// send out refresh requests
notice( t('Import completed.') . EOL);
diff --git a/mod/item.php b/mod/item.php
index fd93d1dff..367a0c4be 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -689,7 +689,8 @@ function item_post(&$a) {
$post_id = 0;
- $post_id = item_store($datarray,$execflag);
+ $post = item_store($datarray,$execflag);
+ $post_id = $post['item_id'];
if($post_id) {
logger('mod_item: saved item ' . $post_id);
diff --git a/mod/like.php b/mod/like.php
index 0de65f129..84b0a6592 100755
--- a/mod/like.php
+++ b/mod/like.php
@@ -171,7 +171,8 @@ function like_content(&$a) {
$arr['deny_cid'] = $item['deny_cid'];
$arr['deny_gid'] = $item['deny_gid'];
- $post_id = item_store($arr);
+ $post = item_store($arr);
+ $post_id = $post['item_id'];
$arr['id'] = $post_id;
diff --git a/mod/mood.php b/mod/mood.php
index 7b6a0c392..83b8bfb57 100755
--- a/mod/mood.php
+++ b/mod/mood.php
@@ -84,7 +84,9 @@ function mood_init(&$a) {
$arr['verb'] = $activity;
$arr['body'] = $action;
- $item_id = item_store($arr);
+ $post = item_store($arr);
+ $item_id = $post['item_id'];
+
if($item_id) {
// q("UPDATE `item` SET `plink` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1",
// dbesc($a->get_baseurl() . '/display/' . $poster['nickname'] . '/' . $item_id),
diff --git a/mod/photos.php b/mod/photos.php
index 7da3d3e92..d60029688 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -506,7 +506,9 @@ function photos_post(&$a) {
. $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource_id'] . '</id>';
$arr['target'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource_id'] . '" />' . "\n" . '<link rel="preview" type="'.$p[0]['type'].'" href="' . $a->get_baseurl() . "/photo/" . $p[0]['resource_id'] . '-' . $best . '.' . $ext . '" />') . '</link></target>';
- $item_id = item_store($arr);
+ $post = item_store($arr);
+ $item_id = $post['item_id'];
+
if($item_id) {
q("UPDATE `item` SET `plink` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1",
dbesc($a->get_baseurl() . '/display/' . $owner_record['nickname'] . '/' . $item_id),
diff --git a/mod/post.php b/mod/post.php
index 70dd4dc19..378192cbf 100644
--- a/mod/post.php
+++ b/mod/post.php
@@ -127,6 +127,12 @@ function post_init(&$a) {
info(sprintf( t('Welcome %s. Remote authentication successful.'),$x[0]['xchan_name']));
logger('mod_zot: auth success from ' . $x[0]['xchan_addr'] . ' for ' . $webbie);
+ } else {
+ logger('mod_zot: still not authenticated: ' . $x[0]['xchan_addr']);
+ q("update hubloc set hubloc_status = (hubloc_status | %d ) where hubloc_addr = '%s'",
+ intval(HUBLOC_RECEIVE_ERROR),
+ $x[0][xchan_addr]
+ );
}
// FIXME - we really want to save the return_url in the session before we visit rmagic.
@@ -168,7 +174,18 @@ function post_post(&$a) {
if(array_key_exists('iv',$data)) {
$data = aes_unencapsulate($data,get_config('system','prvkey'));
logger('mod_zot: decrypt1: ' . $data, LOGGER_DATA);
+ if(! $data) {
+ $ret['message'] = 'Decryption failed.';
+ json_return_and_die($ret);
+ }
+
$data = json_decode($data,true);
+
+ }
+
+ if(! $data) {
+ $ret['message'] = 'No data received.';
+ json_return_and_die($ret);
}
logger('mod_zot: decoded data: ' . print_r($data,true), LOGGER_DATA);
diff --git a/mod/subthread.php b/mod/subthread.php
index 66dc86eb2..11b7236fb 100755
--- a/mod/subthread.php
+++ b/mod/subthread.php
@@ -142,7 +142,8 @@ EOT;
$arr['unseen'] = 1;
$arr['last-child'] = 0;
- $post_id = item_store($arr);
+ $post = item_store($arr);
+ $post_id = $post['item_id'];
if(! $item['visible']) {
$r = q("UPDATE `item` SET `visible` = 1 WHERE `id` = %d AND `uid` = %d LIMIT 1",
diff --git a/mod/zfinger.php b/mod/zfinger.php
index 320f0ca71..70e3bdca6 100644
--- a/mod/zfinger.php
+++ b/mod/zfinger.php
@@ -106,10 +106,13 @@ function zfinger_init(&$a) {
if($p[0]['keywords']) {
$tags = array();
$k = explode(' ',$p[0]['keywords']);
- if($k)
- foreach($k as $kk)
- if(trim($kk))
- $tags[] = trim($kk);
+ if($k) {
+ foreach($k as $kk) {
+ if(trim($kk)) {
+ $tags[] = trim($kk," \t\n\r\0\x0B,");
+ }
+ }
+ }
if($tags)
$profile['keywords'] = $tags;
}
@@ -130,7 +133,6 @@ function zfinger_init(&$a) {
$ret['photo_updated'] = $e['xchan_photo_date'];
$ret['url'] = $e['xchan_url'];
$ret['connections_url']= (($e['xchan_connurl']) ? $e['xchan_connurl'] : z_root() . '/poco/' . $e['channel_address']);
- $ret['name_updated'] = $e['xchan_name_date'];
$ret['target'] = $ztarget;
$ret['target_sig'] = $zsig;
$ret['searchable'] = $searchable;
@@ -250,4 +252,4 @@ function zfinger_init(&$a) {
}
json_return_and_die($ret);
-} \ No newline at end of file
+}