From 32a97d5065efbcc6897ef7598343c6973114fff4 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 2 Jan 2013 16:28:47 -0800 Subject: zome issues registering new hubs --- include/items.php | 18 ++++++++++-------- include/zot.php | 8 +++++++- mod/zfinger.php | 2 +- version.inc | 2 +- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/include/items.php b/include/items.php index 3cfdd59da..432f26804 100755 --- a/include/items.php +++ b/include/items.php @@ -4200,13 +4200,15 @@ function fetch_post_tags($items) { $tag_finder = array(); if($items) { foreach($items as $item) { - if(array_key_exists('item_id',$item)) { - if(! in_array($item['item_id'],$tag_finder)) - $tag_finder[] = $item['item_id']; - } - else { - if(! in_array($item['id'],$tag_finder)) - $tag_finder[] = $item['id']; + if(is_array($item)) { + if(array_key_exists('item_id',$item)) { + if(! in_array($item['item_id'],$tag_finder)) + $tag_finder[] = $item['item_id']; + } + else { + if(! in_array($item['id'],$tag_finder)) + $tag_finder[] = $item['id']; + } } } } @@ -4222,7 +4224,7 @@ function fetch_post_tags($items) { for($x = 0; $x < count($items); $x ++) { - if(count($tags)) { + if($tags) { foreach($tags as $t) { if(array_key_exists('item_id',$items[$x])) { if($t['oid'] == $items[$x]['item_id']) { diff --git a/include/zot.php b/include/zot.php index 46f0bd397..5771b67d1 100644 --- a/include/zot.php +++ b/include/zot.php @@ -358,7 +358,13 @@ function zot_register_hub($arr) { $guid_hash = base64url_encode(hash('whirlpool',$arr['guid'] . $arr['guid_sig'], true)); - $x = z_fetch_url($arr['url'] . '/.well-known/zot-info/?f=&hash=' . $guid_hash); + $url = $arr['url'] . '/.well-known/zot-info/?f=&guid_hash=' . $guid_hash; + + logger('zot_register_hub: ' . $url); + + $x = z_fetch_url($url); + + logger('zot_register_hub: ' . print_r($x,true)); if($x['success']) { $record = json_decode($x['body'],true); diff --git a/mod/zfinger.php b/mod/zfinger.php index b1de33fb7..b13af50b7 100644 --- a/mod/zfinger.php +++ b/mod/zfinger.php @@ -42,7 +42,7 @@ function zfinger_init(&$a) { dbesc($zhash) ); } - if(strlen($zguid) && strlen($zguid_sig)) { + elseif(strlen($zguid) && strlen($zguid_sig)) { $r = q("select channel.*, xchan.* from channel left join xchan on channel_hash = xchan_hash where channel_guid = '%s' and channel_guid_sig = '%s' limit 1", dbesc($zguid), diff --git a/version.inc b/version.inc index 634eab4e6..f3645eb72 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2013-01-01.187 +2013-01-02.188 -- cgit v1.2.3 From 4c21abe533c6a5bcd87b453760c551fed109a79a Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 2 Jan 2013 23:07:46 -0800 Subject: verify table needs auto_increment flag --- boot.php | 2 +- images/red.png | Bin 4909 -> 1265 bytes include/notifier.php | 4 +- install/database.sql | 2 +- install/update.php | 10 ++++- mod/search.php | 112 +++++++++++++++++++++++++++++++++++++++------------ 6 files changed, 100 insertions(+), 30 deletions(-) diff --git a/boot.php b/boot.php index 9bee6c35c..b8742b458 100644 --- a/boot.php +++ b/boot.php @@ -16,7 +16,7 @@ require_once('include/features.php'); define ( 'FRIENDICA_PLATFORM', 'Friendica Red'); define ( 'FRIENDICA_VERSION', trim(file_get_contents('version.inc')) . 'R'); define ( 'ZOT_REVISION', 1 ); -define ( 'DB_UPDATE_VERSION', 1014 ); +define ( 'DB_UPDATE_VERSION', 1015 ); define ( 'EOL', '
' . "\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); diff --git a/images/red.png b/images/red.png index 1d0a2950e..c7831bb52 100644 Binary files a/images/red.png and b/images/red.png differ diff --git a/include/notifier.php b/include/notifier.php index 71571cbd5..ebb6f7bb5 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -49,7 +49,7 @@ require_once('include/html2plain.php'); require_once('include/cli_startup.php'); require_once('include/zot.php'); - +require_once('include/queue_fn.php'); function notifier_run($argv, $argc){ @@ -261,8 +261,8 @@ function notifier_run($argv, $argc){ stringify_array_elms($recipients); if(! $recipients) return; - logger('notifier: recipients: ' . print_r($recipients,true)); + logger('notifier: recipients: ' . print_r($recipients,true)); $env_recips = null; if($private) { diff --git a/install/database.sql b/install/database.sql index 5a17346e1..a4d885541 100644 --- a/install/database.sql +++ b/install/database.sql @@ -805,7 +805,7 @@ CREATE TABLE IF NOT EXISTS `tokens` ( ) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `verify` ( - `id` int(10) unsigned NOT NULL, + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `channel` int(10) unsigned NOT NULL DEFAULT '0', `type` char(32) NOT NULL DEFAULT '', `token` char(255) NOT NULL DEFAULT '', diff --git a/install/update.php b/install/update.php index 549ae63ed..cff3115a2 100644 --- a/install/update.php +++ b/install/update.php @@ -1,6 +1,6 @@ get_observer(); + $o = '' . "\r\n"; $o .= '

' . t('Search') . '

'; @@ -136,26 +139,90 @@ function search_content(&$a) { // OR your own posts if you are a logged in member // No items will be shown if the member has a blocked profile wall. - if(! get_pconfig(local_user(),'system','alt_pager')) { - $r = q("SELECT distinct(`item`.`uri`) as `total` - FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `user` ON `user`.`uid` = `item`.`uid` - WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0 - AND (( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `item`.`private` = 0 AND `user`.`hidewall` = 0) - OR `item`.`uid` = %d ) - AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 - $sql_extra group by `item`.`uri` ", - intval(local_user()) - ); - - if(count($r)) - $a->set_pager_total(count($r)); - - if(! count($r)) { - info( t('No results.') . EOL); - return $o; - } + + + + if((! $update) && (! $load)) { + + // This is ugly, but we can't pass the profile_uid through the session to the ajax updater, + // because browser prefetching might change it on us. We have to deliver it with the page. + + $o .= '
' . "\r\n"; + $o .= "\r\n"; + + $a->page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array( + '$baseurl' => z_root(), + '$pgtype' => 'search', + '$uid' => (($a->profile['profile_uid']) ? $a->profile['profile_uid'] : '0'), + '$gid' => '0', + '$cid' => '0', + '$cmin' => '0', + '$cmax' => '0', + '$star' => '0', + '$liked' => '0', + '$conv' => '0', + '$spam' => '0', + '$nouveau' => '0', + '$wall' => '0', + '$page' => (($a->pager['page'] != 1) ? $a->pager['page'] : 1), + '$search' => (($tag) ? '#' : '') . $search, + '$order' => '', + '$file' => '', + '$cats' => '', + '$dend' => '', + '$dbegin' => '' + )); + + + } + + + + if(($update) && ($load)) { + + $pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage'])); + + if($load) { + $r = q("SELECT distinct(uri), item.* from item + WHERE item_restrict = 0 + AND (( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND not ( item_flags & %d )) + OR ( `item`.`uid` = %d )) + $sql_extra + group by uri ORDER BY created DESC $pager_sql ", + intval(ITEM_PRIVATE), + intval(local_user()), + intval(ABOOK_FLAG_BLOCKED) + + ); + } + else { + $r = array(); + } + } + + if($r) { + + $parents_str = ids_to_querystr($r,'item_id'); + + $items = q("SELECT `item`.*, `item`.`id` AS `item_id` + FROM `item` + WHERE item_restrict = 0 and + $sql_extra ", + intval($a->profile['profile_uid']), + dbesc($parents_str) + ); + + xchan_query($items); + $items = fetch_post_tags($items); + $items = conv_sort($items,'created'); + + } else { + $items = array(); } + + $r = q("SELECT distinct(`item`.`uri`), `item`.*, `item`.`id` AS `item_id`, `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`rel`, `contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`, @@ -177,7 +244,7 @@ function search_content(&$a) { ); - $a = fetch_post_tags($a); +// $a = fetch_post_tags($a); if(! count($r)) { info( t('No results.') . EOL); @@ -192,12 +259,7 @@ function search_content(&$a) { $o .= conversation($a,$r,'search',false); - if(! get_pconfig(local_user(),'system','alt_pager')) { - $o .= paginate($a); - } - else { - $o .= alt_pager($a,count($r)); - } + $o .= alt_pager($a,count($r)); return $o; } -- cgit v1.2.3 From 4c196471b8c62bdee9ec1953fe55508602e6cb76 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 2 Jan 2013 23:31:01 -0800 Subject: pconfig['system']['channel_format'] lets you specify what your channel page looks like. By default it's a social network-like profile. 'full' makes it a full page of channel content with no sidebar widgets, and 'partial' includes the archive and categories widget (like a blog and only if they are enabled) on the sidebar but leaves out the 'social network' vcard and contact block. This may undergo revision as we use it and figure out how to make other pages tweakable and configurable in the same sorts of ways. --- mod/profile.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/mod/profile.php b/mod/profile.php index 68cc53f56..91623b866 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -28,11 +28,22 @@ function profile_aside(&$a) { $profile = argv(1); } - profile_load($a,$which,$profile); - - $a->set_widget('archive',posted_date_widget($a->get_baseurl(true) . '/channel/' . $a->profile['nickname'],$a->profile['profile_uid'],true)); - $a->set_widget('categories',categories_widget($a->get_baseurl(true) . '/channel/' . $a->profile['nickname'],$cat)); + $x = q("select uid as profile_uid from channel where address = '%s' limit 1", + dbesc(argv(1) + ); + if($x) { + $a->profile = $x[0]; + $channel_display = get_pconfig($a->profile['profile_uid'],'system','channel_format'); + if(! $channel_display) + profile_load($a,$which,$profile); + if($channel_display === 'full') + $a->page['template'] = 'full'; + else { + $a->set_widget('archive',posted_date_widget($a->get_baseurl(true) . '/channel/' . $a->profile['nickname'],$a->profile['profile_uid'],true)); + $a->set_widget('categories',categories_widget($a->get_baseurl(true) . '/channel/' . $a->profile['nickname'],$cat)); + } + } } -- cgit v1.2.3 From 1e7a5560f5a5887641d120e77f0f9993bf3b58b9 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 2 Jan 2013 23:37:52 -0800 Subject: missing ) --- mod/profile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/profile.php b/mod/profile.php index 91623b866..1865d69fc 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -30,7 +30,7 @@ function profile_aside(&$a) { $x = q("select uid as profile_uid from channel where address = '%s' limit 1", - dbesc(argv(1) + dbesc(argv(1)) ); if($x) { $a->profile = $x[0]; -- cgit v1.2.3