diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/contacts.php | 4 | ||||
-rw-r--r-- | mod/dfrn_poll.php | 2 | ||||
-rw-r--r-- | mod/directory.php | 2 | ||||
-rw-r--r-- | mod/network.php | 6 | ||||
-rw-r--r-- | mod/photos.php | 5 | ||||
-rw-r--r-- | mod/profile.php | 18 | ||||
-rw-r--r-- | mod/profiles.php | 63 | ||||
-rw-r--r-- | mod/redir.php | 8 |
8 files changed, 69 insertions, 39 deletions
diff --git a/mod/contacts.php b/mod/contacts.php index 45c0040c8..7baeb3e14 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -201,7 +201,7 @@ function contacts_content(&$a) { '$name' => $r[0]['name'], '$dir_icon' => $dir_icon, '$alt_text' => $alt_text, - '$url' => (($direction != DIRECTION_IN) ? "redir/{$r[0]['id']}" : $r[0]['url'] ) + '$url' => (($direction != DIRECTION_OUT) ? "redir/{$r[0]['id']}" : $r[0]['url'] ) )); @@ -296,7 +296,7 @@ function contacts_content(&$a) { '$dir_icon' => $dir_icon, '$thumb' => $rr['thumb'], '$name' => $rr['name'], - '$url' => (($direction != DIRECTION_IN) ? "redir/{$rr['id']}" : $rr['url'] ) + '$url' => (($direction != DIRECTION_OUT) ? "redir/{$rr['id']}" : $rr['url'] ) )); } $o .= '<div id="contact-edit-end"></div>'; diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php index d0b915acf..c627c2b41 100644 --- a/mod/dfrn_poll.php +++ b/mod/dfrn_poll.php @@ -25,7 +25,7 @@ function dfrn_poll_init(&$a) { $r = q("SELECT `contact`.*, `user`.`nickname` FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid` - WHERE `issued-id` = '%s' LIMIT 1", + WHERE `dfrn-id` = '%s' LIMIT 1", dbesc($dfrn_id)); if(count($r)) { $s = fetch_url($r[0]['poll'] . '?dfrn_id=' . $dfrn_id . '&type=profile-check'); diff --git a/mod/directory.php b/mod/directory.php index 8b7f34c41..9cce16760 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -9,6 +9,8 @@ function directory_content(&$a) { $tpl .= file_get_contents('view/directory_header.tpl'); + + $o .= replace_macros($tpl, array( '$search' => $search, '$finding' => (strlen($search) ? '<h4>' . t('Finding: ') . "'" . $search . "'" . '</h4>' : "") diff --git a/mod/network.php b/mod/network.php index 982c381f2..027248bdd 100644 --- a/mod/network.php +++ b/mod/network.php @@ -148,7 +148,8 @@ function network_content(&$a, $update = false) { $template = $wallwall; $commentww = 'ww'; // If it is our contact, use a friendly redirect link - if($item['owner-link'] == $item['url']) + if(($item['owner-link'] == $item['url']) && ($item['rel'] == DIRECTION_IN || $item['rel'] == DIRECTION_BOTH)) + $owner_url = $redirect_url; $owner_url = $redirect_url; } @@ -179,7 +180,7 @@ function network_content(&$a, $update = false) { - if(($item['contact-uid'] == $_SESSION['uid']) && (strlen($item['dfrn-id'])) && (! $item['self'] )) + if(($item['contact-uid'] == $_SESSION['uid']) && ($item['rel] == DIRECTION_IN || $item['rel'] == DIRECTION_BOTH) && (! $item['self'] )) $profile_url = $redirect_url; $photo = $item['photo']; @@ -211,6 +212,7 @@ function network_content(&$a, $update = false) { '$title' => $item['title'], '$body' => bbcode($item['body']), '$ago' => relative_date($item['created']), + '$location' => (($item['location']) ? '<a target="map" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : ''), '$indent' => (($item['parent'] != $item['item_id']) ? ' comment' : ''), '$owner_url' => $owner_url, '$owner_photo' => $owner_photo, diff --git a/mod/photos.php b/mod/photos.php index 3f8607575..81f3614b3 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -766,10 +766,9 @@ function photos_content(&$a) { $profile_url = $item['url']; - - if(local_user() && ($item['contact-uid'] == $_SESSION['uid']) && (strlen($item['dfrn-id'])) && (! $item['self'] )) + if(local_user() && ($item['contact-uid'] == $_SESSION['uid']) + && ($item['rel'] == DIRECTION_IN || $item['rel'] == DIRECTION_BOTH) && (! $item['self'] )) $profile_url = $redirect_url; - $profile_name = ((strlen($item['author-name'])) ? $item['author-name'] : $item['name']); $profile_avatar = ((strlen($item['author-avatar'])) ? $item['author-avatar'] : $item['thumb']); diff --git a/mod/profile.php b/mod/profile.php index 119b523a6..808ceedb8 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -64,9 +64,11 @@ function profile_init(&$a) { $profile = $a->argv[1]; } profile_load($a,$which,$profile); - $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $a->get_baseurl() . '/dfrn_poll/' . $which .'" />'; + $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $a->get_baseurl() . '/dfrn_poll/' . $which .'" />' . "\r\n" ; - $a->page['htmlhead'] .= "<meta name=\"dfrn-template\" content=\"" . $a->get_baseurl() . "/profile/%s" . "\" />\r\n"; + $a->page['htmlhead'] .= '<meta name="dfrn-template" content="' . $a->get_baseurl() . "/profile/%s" . '" />' . "\r\n" ; + $a->page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . (($a->profile['net-publish']) ? 'true' : 'false') . '" />' . "\r\n" ; + $dfrn_pages = array('request', 'confirm', 'notify', 'poll'); foreach($dfrn_pages as $dfrn) @@ -99,9 +101,11 @@ function profile_content(&$a, $update = false) { if(count($r)) $contact = $r[0]; } - if(local_user()) { - $contact_id = $_SESSION['cid']; - $contact = $a->contact; + else { + if(local_user()) { + $contact_id = $_SESSION['cid']; + $contact = $a->contact; + } } if($update) { @@ -261,7 +265,8 @@ function profile_content(&$a, $update = false) { // 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, // I can go directly to their profile as an authenticated guest. - if(local_user() && ($item['contact-uid'] == $_SESSION['uid']) && (strlen($item['dfrn-id'])) && (! $item['self'] )) + if(local_user() && ($item['contact-uid'] == $_SESSION['uid']) + && ($item['rel'] == DIRECTION_IN || $item['rel'] == DIRECTION_BOTH) && (! $item['self'] )) $profile_url = $redirect_url; // FIXME tryng to solve the mishmash of profile photos. @@ -294,6 +299,7 @@ function profile_content(&$a, $update = false) { '$title' => $item['title'], '$body' => bbcode($item['body']), '$ago' => relative_date($item['created']), + '$location' => (($item['location']) ? '<a target="map" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : ''), '$indent' => (($item['parent'] != $item['item_id']) ? ' comment' : ''), '$drop' => $drop, '$comment' => $comment diff --git a/mod/profiles.php b/mod/profiles.php index 850a4b8ce..71e037718 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -4,7 +4,7 @@ function profiles_post(&$a) { if(! local_user()) { - notice( "Permission denied." . EOL); + notice( t('Permission denied.') . EOL); return; } @@ -16,14 +16,14 @@ function profiles_post(&$a) { intval($_SESSION['uid']) ); if(! count($orig)) { - $_SESSION['sysmsg'] .= "Profile not found." . EOL; + notice( t('Profile not found.') . EOL); return; } $is_default = (($orig[0]['is-default']) ? 1 : 0); $profile_name = notags(trim($_POST['profile_name'])); if(! strlen($profile_name)) { - $a->$_SESSION['sysmsg'] .= "Profile Name is required." . EOL; + notify( t('Profile Name is required.') . EOL); return; } @@ -74,6 +74,9 @@ function profiles_post(&$a) { $education = escape_tags(trim($_POST['education'])); if(x($_POST,'profile_in_directory')) $publish = (($_POST['profile_in_directory'] == 1) ? 1: 0); + if(x($_POST,'profile_in_netdirectory')) + $net_publish = (($_POST['profile_in_netdirectory'] == 1) ? 1: 0); + $r = q("UPDATE `profile` SET `profile-name` = '%s', @@ -130,14 +133,15 @@ function profiles_post(&$a) { ); if($r) - $_SESSION['sysmsg'] .= "Profile updated." . EOL; + notice( t('Profile updated.') . EOL); if($is_default) { $r = q("UPDATE `profile` - SET `publish` = %d + SET `publish` = %d, `net-publish` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($publish), + intval($net_publish), intval($a->argv[1]), intval($_SESSION['uid']) @@ -149,11 +153,15 @@ function profiles_post(&$a) { intval($_SESSION['uid']) ); } - + if($is_default) { + // Update global directory in background + $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); + $url = $_SESSION['my_url']; + if($url && strlen(get_config('system','directory_submit_url'))) + proc_close(proc_open("\"$php_path\" \"include/directory.php\" \"$url\" &", + array(),$foo)); + } } - - - } @@ -161,7 +169,7 @@ function profiles_post(&$a) { function profiles_content(&$a) { if(! local_user()) { - $_SESSION['sysmsg'] .= "Unauthorised." . EOL; + notice( t('Permission denied.') . EOL); return; } @@ -171,7 +179,7 @@ function profiles_content(&$a) { intval($_SESSION['uid']) ); if(! count($r)) { - $_SESSION['sysmsg'] .= "Profile not found." . EOL; + notice( t('Profile not found.') . EOL); goaway($a->get_baseurl() . '/profiles'); return; // NOTREACHED } @@ -187,7 +195,7 @@ function profiles_content(&$a) { intval($a->argv[2]) ); if($r) - notice("Profile deleted." . EOL); + notice( t('Profile deleted.') . EOL); goaway($a->get_baseurl() . '/profiles'); return; // NOTREACHED @@ -203,7 +211,7 @@ function profiles_content(&$a) { intval($_SESSION['uid'])); $num_profiles = count($r0); - $name = "Profile-" . ($num_profiles + 1); + $name = t('Profile-') . ($num_profiles + 1); $r1 = q("SELECT `name`, `photo`, `thumb` FROM `profile` WHERE `uid` = %d AND `is-default` = 1 LIMIT 1", intval($_SESSION['uid'])); @@ -221,7 +229,7 @@ function profiles_content(&$a) { intval($_SESSION['uid']), dbesc($name) ); - $_SESSION['sysmsg'] .= "New profile created." . EOL; + notice( t('New profile created.') . EOL); if(count($r3) == 1) goaway($a->get_baseurl() . '/profiles/' . $r3[0]['id']); goaway($a->get_baseurl() . '/profiles'); @@ -233,13 +241,13 @@ function profiles_content(&$a) { intval($_SESSION['uid'])); $num_profiles = count($r0); - $name = "Profile-" . ($num_profiles + 1); + $name = t('Profile-') . ($num_profiles + 1); $r1 = q("SELECT * FROM `profile` WHERE `uid` = %d AND `id` = %d LIMIT 1", intval($_SESSION['uid']), intval($a->argv[2]) ); if(! count($r1)) { - notice("Profile unavailable to clone." . EOL); + notice( t('Profile unavailable to clone.') . EOL); return; } unset($r1[0]['id']); @@ -259,7 +267,7 @@ function profiles_content(&$a) { intval($_SESSION['uid']), dbesc($name) ); - $_SESSION['sysmsg'] .= "New profile created." . EOL; + notice( t('New profile created.') . EOL); if(count($r3) == 1) goaway($a->get_baseurl() . '/profiles/' . $r3[0]['id']); goaway($a->get_baseurl() . '/profiles'); @@ -273,7 +281,7 @@ function profiles_content(&$a) { intval($_SESSION['uid']) ); if(! count($r)) { - $_SESSION['sysmsg'] .= "Profile not found." . EOL; + notice( t('Profile not found.') . EOL); return; } @@ -289,6 +297,18 @@ function profiles_content(&$a) { '$no_selected' => (($r[0]['publish'] == 0) ? " checked=\"checked\" " : "") )); + if(strlen(get_config('system','directory_submit_url'))) { + $opt_tpl = file_get_contents("view/profile-in-netdir.tpl"); + + $profile_in_net_dir = replace_macros($opt_tpl,array( + '$yes_selected' => (($r[0]['net-publish']) ? " checked=\"checked\" " : ""), + '$no_selected' => (($r[0]['net-publish'] == 0) ? " checked=\"checked\" " : "") + )); + } + else + $profile_in_net_dir = ''; + + $opt_tpl = file_get_contents("view/profile-hide-friends.tpl"); $hide_friends = replace_macros($opt_tpl,array( '$yes_selected' => (($r[0]['hide-friends']) ? " checked=\"checked\" " : ""), @@ -310,7 +330,7 @@ function profiles_content(&$a) { '$baseurl' => $a->get_baseurl(), '$profile_id' => $r[0]['id'], '$profile_name' => $r[0]['profile-name'], - '$default' => (($is_default) ? "<p id=\"profile-edit-default-desc\">This is your <strong>public</strong> profile.<br />It <strong>may</strong> be visible to anybody using the internet.</p>" : ""), + '$default' => (($is_default) ? '<p id="profile-edit-default-desc">' . t('This is your <strong>public</strong> profile.<br />It <strong>may</strong> be visible to anybody using the internet.') . '</p>' : ""), '$name' => $r[0]['name'], '$dob' => dob($r[0]['dob']), '$hide_friends' => $hide_friends, @@ -319,7 +339,7 @@ function profiles_content(&$a) { '$region' => $r[0]['region'], '$postal_code' => $r[0]['postal-code'], '$country_name' => $r[0]['country-name'], - '$age' => ((intval($r[0]['dob'])) ? '(Age: '. age($r[0]['dob'],$a->user['timezone'],$a->user['timezone']) . ')' : ''), + '$age' => ((intval($r[0]['dob'])) ? '(' . t('Age: ') . age($r[0]['dob'],$a->user['timezone'],$a->user['timezone']) . ')' : ''), '$gender' => gender_selector($r[0]['gender']), '$marital' => marital_selector($r[0]['marital']), '$sexual' => sexpref_selector($r[0]['sexual']), @@ -336,7 +356,8 @@ function profiles_content(&$a) { '$work' => $r[0]['work'], '$education' => $r[0]['education'], '$contact' => $r[0]['contact'], - '$profile_in_dir' => (($is_default) ? $profile_in_dir : '') + '$profile_in_dir' => (($is_default) ? $profile_in_dir : ''), + '$profile_in_net_dir' => (($is_default) ? $profile_in_net_dir : '') )); return $o; diff --git a/mod/redir.php b/mod/redir.php index ee15a18d4..ea1aec6e9 100644 --- a/mod/redir.php +++ b/mod/redir.php @@ -4,7 +4,7 @@ function redir_init(&$a) { if((! local_user()) || (! ($a->argc == 2)) || (! intval($a->argv[1]))) goaway($a->get_baseurl()); - $r = q("SELECT `dfrn-id`, `poll` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", + $r = q("SELECT `issued-id`, `poll` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($a->argv[1]), intval($_SESSION['uid'])); if(! count($r)) @@ -12,9 +12,9 @@ function redir_init(&$a) { q("INSERT INTO `profile_check` ( `uid`, `dfrn_id`, `expire`) VALUES( %d, '%s', %d )", intval($_SESSION['uid']), - dbesc($r[0]['dfrn-id']), - intval(time() + 30)); - goaway ($r[0]['poll'] . '?dfrn_id=' . $r[0]['dfrn-id'] . '&type=profile'); + dbesc($r[0]['issued-id']), + intval(time() + 45)); + goaway ($r[0]['poll'] . '?dfrn_id=' . $r[0]['issued-id'] . '&type=profile'); |