From ab72d86aa7f35157a278d9fc570504db41fb5f09 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Wed, 19 Jan 2011 14:48:30 +0100 Subject: [PATCH 1/5] Small fixs to IT language --- view/it/profile_edit.tpl | 4 ++-- view/it/settings.tpl | 2 +- view/theme/duepuntozero/style.css | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/view/it/profile_edit.tpl b/view/it/profile_edit.tpl index e5d0976ec..efdb5d448 100644 --- a/view/it/profile_edit.tpl +++ b/view/it/profile_edit.tpl @@ -30,9 +30,9 @@ $default
- + -
+
(es. titolo, posizione, altro)
diff --git a/view/it/settings.tpl b/view/it/settings.tpl index 365e5cb70..2ff259acc 100644 --- a/view/it/settings.tpl +++ b/view/it/settings.tpl @@ -153,7 +153,7 @@ Lascia questi campi in bianco per non effettuare variazioni alla password -

Impostazioni Avanzante Pagina

+

Impostazioni Avanzate Account

$pagetype diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index 9d51c86f7..ffe8b1df2 100644 --- a/view/theme/duepuntozero/style.css +++ b/view/theme/duepuntozero/style.css @@ -667,6 +667,7 @@ input#dfrn-url { margin-left: 20px; } +#profile-edit-pdesc-desc, #profile-edit-keywords-desc { float: left; margin-left: 20px; From e7c5f9e7de033098d9dcf58bb1cffda934dbd2c3 Mon Sep 17 00:00:00 2001 From: Friendika Date: Wed, 19 Jan 2011 14:19:40 -0800 Subject: [PATCH 2/5] undo sql change in f9f018ef083acb554003 (02-DEC-2010), not relevant and incorrect --- mod/display.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/display.php b/mod/display.php index cad60d275..0e5768838 100644 --- a/mod/display.php +++ b/mod/display.php @@ -93,7 +93,7 @@ function display_content(&$a) { FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 - AND `item`.`parent` = ( SELECT `parent` FROM `item` WHERE ( `id` = '%s' OR `uri` = '%s' ) AND `type` != 'remote' ) + AND `item`.`parent` = ( SELECT `parent` FROM `item` WHERE ( `id` = '%s' OR `uri` = '%s' )) $sql_extra ORDER BY `parent` DESC, `gravity` ASC, `id` ASC ", intval($a->profile['uid']), From b1d67c8d3ca217fb1383cad947c00fb560d51342 Mon Sep 17 00:00:00 2001 From: Friendika Date: Wed, 19 Jan 2011 17:56:36 -0800 Subject: [PATCH 3/5] network view all item types by date --- boot.php | 2 +- mod/network.php | 132 ++++++++++++++++++++++++++---- mod/search.php | 10 +++ util/strings.php | 4 +- view/theme/default/style.css | 7 ++ view/theme/duepuntozero/style.css | 7 ++ 6 files changed, 142 insertions(+), 20 deletions(-) diff --git a/boot.php b/boot.php index d7f32dbaf..d458b8647 100644 --- a/boot.php +++ b/boot.php @@ -3,7 +3,7 @@ set_time_limit(0); define ( 'BUILD_ID', 1033 ); -define ( 'FRIENDIKA_VERSION', '2.01.1004' ); +define ( 'FRIENDIKA_VERSION', '2.01.1005' ); define ( 'DFRN_PROTOCOL_VERSION', '2.0' ); define ( 'EOL', "
\r\n" ); diff --git a/mod/network.php b/mod/network.php index c761af810..e0636f0f8 100644 --- a/mod/network.php +++ b/mod/network.php @@ -5,6 +5,16 @@ function network_init(&$a) { require_once('include/group.php'); if(! x($a->page,'aside')) $a->page['aside'] = ''; + + $a->page['aside'] .= ''; + $a->page['aside'] .= group_side('network','network'); } @@ -25,11 +35,21 @@ function network_content(&$a, $update = 0) { if(! $update) { $o .= ''; + $nouveau = false; + + if(($a->argc > 2) && $a->argv[2] === 'new') + $nouveau = true; + // pull out the group here because the updater might have different args if($a->argc > 1) { - $group = intval($a->argv[1]); - $group_acl = array('allow_gid' => '<' . $group . '>'); + if($a->argv[1] === 'new') + $nouveau = true; + else { + $group = intval($a->argv[1]); + $group_acl = array('allow_gid' => '<' . $group . '>'); + } } + $_SESSION['return_url'] = $a->cmd; $geotag = (($a->user['allow_location']) ? load_view_file('view/jot_geotag.tpl') : ''); @@ -111,6 +131,7 @@ function network_content(&$a, $update = 0) { $contact_str = ' 0 '; notice( t('Group is empty')); } + $sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE `id` = `parent` AND `contact-id` IN ( $contact_str )) "; $o = '

' . t('Group: ') . $r[0]['name'] . '

' . $o; } @@ -130,22 +151,39 @@ function network_content(&$a, $update = 0) { if(count($r)) $a->set_pager_total($r[0]['total']); - $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, - `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, - `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`, - `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` - FROM `item`, (SELECT `p`.`id`,`p`.`created` FROM `item` AS `p` WHERE `p`.`parent`=`p`.`id`) as `parentitem`, - `contact` - WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 - AND `contact`.`id` = `item`.`contact-id` - AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 - AND `item`.`parent` = `parentitem`.`id` - $sql_extra - ORDER BY `parentitem`.`created` DESC, `item`.`gravity` ASC, `item`.`created` ASC LIMIT %d ,%d ", - intval($_SESSION['uid']), - intval($a->pager['start']), - intval($a->pager['itemspage']) - ); + if($nouveau) { + $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, + `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, + `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`, + `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` + FROM `item`, `contact` + WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 + AND `contact`.`id` = `item`.`contact-id` + AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 + $sql_extra + ORDER BY `item`.`created` DESC LIMIT %d ,%d ", + intval($_SESSION['uid']), + intval($a->pager['start']), + intval($a->pager['itemspage']) + ); + } + else { + $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, + `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, + `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`, + `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` + FROM `item`, (SELECT `p`.`id`,`p`.`created` FROM `item` AS `p` WHERE `p`.`parent`=`p`.`id`) as `parentitem`, `contact` + WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 + AND `contact`.`id` = `item`.`contact-id` + AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 + AND `item`.`parent` = `parentitem`.`id` + $sql_extra + ORDER BY `parentitem`.`created` DESC, `item`.`gravity` ASC, `item`.`created` ASC LIMIT %d ,%d ", + intval($_SESSION['uid']), + intval($a->pager['start']), + intval($a->pager['itemspage']) + ); + } $cmnt_tpl = load_view_file('view/comment_item.tpl'); @@ -158,6 +196,64 @@ function network_content(&$a, $update = 0) { if(count($r)) { + if($nouveau) { + + $tpl = load_view_file('view/search_item.tpl'); + $droptpl = load_view_file('view/wall_fake_drop.tpl'); + + foreach($r as $item) { + + $comment = ''; + $owner_url = ''; + $owner_photo = ''; + $owner_name = ''; + $sparkle = ''; + + $profile_name = ((strlen($item['author-name'])) ? $item['author-name'] : $item['name']); + $profile_avatar = ((strlen($item['author-avatar'])) ? $item['author-avatar'] : $item['thumb']); + $profile_link = ((strlen($item['author-link'])) ? $item['author-link'] : $item['url']); + + + $location = (($item['location']) ? '' . $item['location'] . '' : ''); + $coord = (($item['coord']) ? '' . $item['coord'] . '' : ''); + if($coord) { + if($location) + $location .= '
(' . $coord . ')'; + else + $location = '' . $coord . ''; + } + + $drop = replace_macros($droptpl,array('$id' => $item['id'])); + $lock = '
'; + + $o .= replace_macros($tpl,array( + '$id' => $item['item_id'], + '$profile_url' => $profile_link, + '$name' => $profile_name, + '$sparkle' => $sparkle, + '$lock' => $lock, + '$thumb' => $profile_avatar, + '$title' => $item['title'], + '$body' => bbcode($item['body']), + '$ago' => relative_date($item['created']), + '$location' => $location, + '$indent' => '', + '$owner_url' => $owner_url, + '$owner_photo' => $owner_photo, + '$owner_name' => $owner_name, + '$drop' => $drop, + '$conv' => '' . t('View in context') . '' + )); + + } + $o .= paginate($a); + + return $o; + + } + + + foreach($r as $item) { like_puller($a,$item,$alike,'like'); like_puller($a,$item,$dlike,'dislike'); diff --git a/mod/search.php b/mod/search.php index 20113e75b..a6a4b613f 100644 --- a/mod/search.php +++ b/mod/search.php @@ -81,6 +81,7 @@ function search_content(&$a) { foreach($r as $item) { + $total = 0; $comment = ''; $owner_url = ''; $owner_photo = ''; @@ -91,6 +92,8 @@ function search_content(&$a) { && ($item['id'] != $item['parent'])) continue; + $total ++; + $profile_name = ((strlen($item['author-name'])) ? $item['author-name'] : $item['name']); $profile_avatar = ((strlen($item['author-avatar'])) ? $item['author-avatar'] : $item['thumb']); $profile_link = ((strlen($item['author-link'])) ? $item['author-link'] : $item['url']); @@ -130,6 +133,13 @@ function search_content(&$a) { } } + + if(! $r[0]['total']) { + notice('No results.'); + return $o; + } + + $o .= paginate($a); return $o; diff --git a/util/strings.php b/util/strings.php index 3d75e6757..8b58a6b7a 100644 --- a/util/strings.php +++ b/util/strings.php @@ -249,9 +249,12 @@ $a->strings['Delete conversation'] = 'Delete conversation'; $a->strings['Message not available.'] = 'Message not available.'; $a->strings['Delete message'] = 'Delete message'; $a->strings['Send Reply'] = 'Send Reply'; +$a->strings['Normal View'] = 'Normal View'; +$a->strings['New Item View'] = 'New Item View'; $a->strings['No such group'] = 'No such group'; $a->strings['Group is empty'] = 'Group is empty'; $a->strings['Group: '] = 'Group: '; +$a->strings['View in context'] = 'View in context'; $a->strings['Invalid request identifier.'] = 'Invalid request identifier.'; $a->strings['Discard'] = 'Discard'; $a->strings['Ignore'] = 'Ignore'; @@ -347,7 +350,6 @@ $a->strings['Register'] = 'Register'; $a->strings['Please login.'] = 'Please login.'; $a->strings['Registration revoked for '] = 'Registration revoked for '; $a->strings['Account approved.'] = 'Account approved.'; -$a->strings['View in context'] = 'View in context'; $a->strings['Passwords do not match. Password unchanged.'] = 'Passwords do not match. Password unchanged.'; $a->strings['Empty passwords are not allowed. Password unchanged.'] = 'Empty passwords are not allowed. Password unchanged.'; $a->strings['Password changed.'] = 'Password changed.'; diff --git a/view/theme/default/style.css b/view/theme/default/style.css index 0457850dc..e34b622c6 100644 --- a/view/theme/default/style.css +++ b/view/theme/default/style.css @@ -1989,3 +1989,10 @@ a.mail-list-link { #birthday-wrapper { margin-bottom: 20px; } + + +#network-new-link { + margin-top: 15px; + margin-bottom: 15px; +} + diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index ffe8b1df2..b00f24cc2 100644 --- a/view/theme/duepuntozero/style.css +++ b/view/theme/duepuntozero/style.css @@ -1873,3 +1873,10 @@ a.mail-list-link { #birthday-wrapper { margin-bottom: 20px; } + +#network-new-link { + margin-top: 15px; + margin-bottom: 15px; +} + + From d59585d89dc7541e57a3a5685b2835cd0904e533 Mon Sep 17 00:00:00 2001 From: Friendika Date: Wed, 19 Jan 2011 18:31:04 -0800 Subject: [PATCH 4/5] fix context links --- mod/network.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mod/network.php b/mod/network.php index e0636f0f8..d094febc6 100644 --- a/mod/network.php +++ b/mod/network.php @@ -154,7 +154,7 @@ function network_content(&$a, $update = 0) { if($nouveau) { $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, - `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`, + `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`, `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` FROM `item`, `contact` WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 @@ -242,7 +242,7 @@ function network_content(&$a, $update = 0) { '$owner_photo' => $owner_photo, '$owner_name' => $owner_name, '$drop' => $drop, - '$conv' => '' . t('View in context') . '' + '$conv' => '' . t('View in context') . '' )); } From 2ffe0d0b1d9589b6b37d8ade0114caef31339001 Mon Sep 17 00:00:00 2001 From: Friendika Date: Wed, 19 Jan 2011 19:51:34 -0800 Subject: [PATCH 5/5] do a better job of comparing same URLs. --- boot.php | 19 +++++++++++++++++++ mod/display.php | 4 ++-- mod/network.php | 6 +++--- mod/profile.php | 4 ++-- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/boot.php b/boot.php index d458b8647..05b33abd6 100644 --- a/boot.php +++ b/boot.php @@ -2191,3 +2191,22 @@ function get_birthdays() { }} +/** + * + * Compare two URLs to see if they are the same, but ignore + * slight but hopefully insignificant differences such as if one + * is https and the other isn't, or if one is www.something and + * the other isn't - and also ignore case differences. + * + * Return true if the URLs match, otherwise false. + * + */ + +if(! function_exists('link_compare')) { +function link_compare($a,$b) { + $a1 = str_replace(array('https:','//www.'), array('http:','//'), $a); + $b1 = str_replace(array('https:','//www.'), array('http:','//'), $b); + if(strcasecmp($a1,$b1) === 0) + return true; + return false; +}} diff --git a/mod/display.php b/mod/display.php index 0e5768838..de11ec35d 100644 --- a/mod/display.php +++ b/mod/display.php @@ -202,7 +202,7 @@ function display_content(&$a) { $template = $wallwall; $commentww = 'ww'; // If it is our contact, use a friendly redirect link - if(($item['owner-link'] == $item['url']) && ($item['network'] === 'dfrn')) { + if((link_compare($item['owner-link'],$item['url'])) && ($item['network'] === 'dfrn')) { $owner_url = $redirect_url; $osparkle = ' sparkle'; } @@ -211,7 +211,7 @@ function display_content(&$a) { } } - $diff_author = (($item['url'] !== $item['author-link']) ? true : false); + $diff_author = ((link_compare($item['url'],$item['author-link'])) ? false : true); $profile_name = (((strlen($item['author-name'])) && $diff_author) ? $item['author-name'] : $item['name']); $profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $item['thumb']); diff --git a/mod/network.php b/mod/network.php index d094febc6..aa42e2f52 100644 --- a/mod/network.php +++ b/mod/network.php @@ -303,7 +303,7 @@ function network_content(&$a, $update = 0) { $template = $wallwall; $commentww = 'ww'; // If it is our contact, use a friendly redirect link - if(($item['owner-link'] == $item['url']) + if((link_compare($item['owner-link'],$item['url'])) && ($item['network'] === 'dfrn')) { $owner_url = $redirect_url; $osparkle = ' sparkle'; @@ -350,7 +350,7 @@ function network_content(&$a, $update = 0) { // Post was remotely authored. - $diff_author = (($item['url'] !== $item['author-link']) ? true : false); + $diff_author = ((link_compare($item['url'],$item['author-link'])) ? false : true); $profile_name = (((strlen($item['author-name'])) && $diff_author) ? $item['author-name'] : $item['name']); $profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $thumb); @@ -361,7 +361,7 @@ function network_content(&$a, $update = 0) { // Can we use our special contact URL for this author? if(strlen($item['author-link'])) { - if($item['author-link'] == $item['url'] && ($item['network'] === 'dfrn') && (! $item['self'])) { + if((link_compare($item['author-link'],$item['url'])) && ($item['network'] === 'dfrn') && (! $item['self'])) { $profile_link = $redirect_url; $sparkle = ' sparkle'; } diff --git a/mod/profile.php b/mod/profile.php index bcd2b64e3..936379360 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -297,7 +297,7 @@ function profile_content(&$a, $update = 0) { $profile_url = $item['url']; - // This is my profile but I'm not the author of this post/comment. If it's somebody that's a fan or mutual friend, + // This is my profile page but I'm not the author of this post/comment. If it's somebody that's a fan or mutual friend, // I can go directly to their profile as an authenticated guest. if(local_user() && ($item['contact-uid'] == $_SESSION['uid']) @@ -314,7 +314,7 @@ function profile_content(&$a, $update = 0) { // local contact info at all. In this module you should never encounter a third-party author, but we still will do // the right thing if you ever do. - $diff_author = (($item['url'] !== $item['author-link']) ? true : false); + $diff_author = ((link_compare($item['url'],$item['author-link'])) ? false : true); $profile_name = (((strlen($item['author-name'])) && $diff_author) ? $item['author-name'] : $item['name']); $profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $item['thumb']);