diff options
author | Olivier Migeot <olivier@migeot.org> | 2011-04-12 13:55:43 +0200 |
---|---|---|
committer | Olivier Migeot <olivier@migeot.org> | 2011-04-12 13:55:43 +0200 |
commit | 85f709320b588f3231875d097217bd9abd223c9f (patch) | |
tree | 988f92ae345657ece74dbcc9dd0d8f17d41f20a5 /mod | |
parent | 294577a48b2d6356dd7695716ea0379bf3a087df (diff) | |
parent | 6da84027afa18633ac5d5dacce99bb244be2aa7b (diff) | |
download | volse-hubzilla-85f709320b588f3231875d097217bd9abd223c9f.tar.gz volse-hubzilla-85f709320b588f3231875d097217bd9abd223c9f.tar.bz2 volse-hubzilla-85f709320b588f3231875d097217bd9abd223c9f.zip |
Merge remote branch 'mike/master'
Diffstat (limited to 'mod')
-rw-r--r-- | mod/contacts.php | 8 | ||||
-rw-r--r-- | mod/dfrn_confirm.php | 5 | ||||
-rw-r--r-- | mod/dfrn_notify.php | 16 | ||||
-rw-r--r-- | mod/dfrn_poll.php | 23 | ||||
-rw-r--r-- | mod/display.php | 194 | ||||
-rw-r--r-- | mod/follow.php | 10 | ||||
-rw-r--r-- | mod/group.php | 15 | ||||
-rw-r--r-- | mod/install.php | 10 | ||||
-rw-r--r-- | mod/lostpass.php | 7 | ||||
-rw-r--r-- | mod/network.php | 344 | ||||
-rw-r--r-- | mod/notifications.php | 14 | ||||
-rw-r--r-- | mod/opensearch.php | 18 | ||||
-rw-r--r-- | mod/parse_url.php | 6 | ||||
-rw-r--r-- | mod/photos.php | 19 | ||||
-rw-r--r-- | mod/profile.php | 211 | ||||
-rw-r--r-- | mod/profile_photo.php | 6 | ||||
-rw-r--r-- | mod/profiles.php | 50 | ||||
-rw-r--r-- | mod/search.php | 68 | ||||
-rw-r--r-- | mod/settings.php | 60 | ||||
-rw-r--r-- | mod/share.php | 4 |
20 files changed, 249 insertions, 839 deletions
diff --git a/mod/contacts.php b/mod/contacts.php index 4d5311b69..834b1c63d 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -261,6 +261,14 @@ function contacts_content(&$a) { $o .= replace_macros($tpl,array( '$header' => t('Contact Editor'), + '$submit' => t('Submit'), + '$lbl_vis1' => t('Profile Visibility'), + '$lbl_vis2' => sprintf( t('Please choose the profile you would like to display to %s when viewing your profile securely.'), $r[0]['name']), + '$lbl_info1' => t('Contact Information / Notes'), + '$lbl_rep1' => t('Online Reputation'), + '$lbl_rep2' => t('Occasionally your friends may wish to inquire about this person\'s online legitimacy.'), + '$lbl_rep3' => t('You may help them choose whether or not to interact with this person by providing a <em>reputation</em> to guide them.'), + '$lbl_rep4' => t('Please take a moment to elaborate on this selection if you feel it could be helpful to others.'), '$visit' => t('Visit $name\'s profile'), '$blockunblock' => t('Block/Unblock contact'), '$ignorecont' => t('Ignore contact'), diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php index 2db745d25..02437ec36 100644 --- a/mod/dfrn_confirm.php +++ b/mod/dfrn_confirm.php @@ -434,6 +434,11 @@ function dfrn_confirm_post(&$a,$handsfree = null) { $arr['object'] .= '</link></object>' . "\n"; $arr['last-child'] = 1; + $arr['allow_cid'] = $user[0]['allow_cid']; + $arr['allow_gid'] = $user[0]['allow_gid']; + $arr['deny_cid'] = $user[0]['deny_cid']; + $arr['deny_gid'] = $user[0]['deny_gid']; + $i = item_store($arr); if($i) proc_run('php',"include/notifier.php","activity","$i"); diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index cd67df1d7..f6f68d348 100644 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -10,6 +10,12 @@ function dfrn_notify_post(&$a) { $data = ((x($_POST,'data')) ? $_POST['data'] : ''); $key = ((x($_POST,'key')) ? $_POST['key'] : ''); $dissolve = ((x($_POST,'dissolve')) ? intval($_POST['dissolve']) : 0); + $perm = ((x($_POST,'perm')) ? notags(trim($_POST['perm'])) : 'r'); + + $writable = (-1); + if($dfrn_version >= 2.21) { + $writable = (($perm === 'rw') ? 1 : 0); + } $direction = (-1); if(strpos($dfrn_id,':') == 1) { @@ -74,6 +80,14 @@ function dfrn_notify_post(&$a) { $importer = $r[0]; + if(($writable != (-1)) && ($writable != $importer['writable'])) { + q("UPDATE `contact` SET `writable` = %d WHERE `id` = %d LIMIT 1", + intval($writable), + intval($importer['id']) + ); + $importer['writable'] = $writable; + } + logger('dfrn_notify: received notify from ' . $importer['name'] . ' for ' . $importer['username']); logger('dfrn_notify: data: ' . $data, LOGGER_DATA); @@ -118,8 +132,6 @@ function dfrn_notify_post(&$a) { } - - if($importer['readonly']) { // We aren't receiving stuff from this person. But we will quietly ignore them // rather than a blatant "go away" message. diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php index 2ccfadd03..2da1a30fa 100644 --- a/mod/dfrn_poll.php +++ b/mod/dfrn_poll.php @@ -16,6 +16,7 @@ function dfrn_poll_init(&$a) { $challenge = ((x($_GET,'challenge')) ? $_GET['challenge'] : ''); $sec = ((x($_GET,'sec')) ? $_GET['sec'] : ''); $dfrn_version = ((x($_GET,'dfrn_version')) ? (float) $_GET['dfrn_version'] : 2.0); + $perm = ((x($_GET,'perm')) ? $_GET['perm'] : 'r'); $direction = (-1); @@ -183,8 +184,9 @@ function dfrn_poll_post(&$a) { $challenge = ((x($_POST,'challenge')) ? $_POST['challenge'] : ''); $url = ((x($_POST,'url')) ? $_POST['url'] : ''); $sec = ((x($_POST,'sec')) ? $_POST['sec'] : ''); - $ptype = ((x($_POST,'type')) ? $_POST['type'] : ''); + $ptype = ((x($_POST,'type')) ? $_POST['type'] : ''); $dfrn_version = ((x($_POST,'dfrn_version')) ? (float) $_POST['dfrn_version'] : 2.0); + $perm = ((x($_POST,'perm')) ? $_POST['perm'] : 'r'); if($ptype === 'profile-check') { @@ -295,6 +297,7 @@ function dfrn_poll_post(&$a) { if(! count($r)) killme(); + $contact = $r[0]; $owner_uid = $r[0]['uid']; $contact_id = $r[0]['id']; @@ -328,6 +331,23 @@ function dfrn_poll_post(&$a) { // NOTREACHED } else { + + // Update the writable flag if it changed + logger('dfrn_poll: post request feed: ' . print_r($_POST,true),LOGGER_DATA); + if($dfrn_version >= 2.21) { + if($perm === 'rw') + $writable = 1; + else + $writable = 0; + + if($writable != $contact['writable']) { + q("UPDATE `contact` SET `writable` = %d WHERE `id` = %d LIMIT 1", + intval($writable), + intval($contact_id) + ); + } + } + header("Content-type: application/atom+xml"); $o = get_feed_for($a,$dfrn_id, $a->argv[1], $last_update, $direction); echo $o; @@ -344,6 +364,7 @@ function dfrn_poll_content(&$a) { $destination_url = ((x($_GET,'destination_url')) ? $_GET['destination_url'] : ''); $sec = ((x($_GET,'sec')) ? $_GET['sec'] : ''); $dfrn_version = ((x($_GET,'dfrn_version')) ? (float) $_GET['dfrn_version'] : 2.0); + $perm = ((x($_GET,'perm')) ? $_GET['perm'] : 'r'); $direction = (-1); if(strpos($dfrn_id,':') == 1) { diff --git a/mod/display.php b/mod/display.php index f74137e0e..da4566dc4 100644 --- a/mod/display.php +++ b/mod/display.php @@ -22,9 +22,6 @@ function display_content(&$a) { $groups = array(); - $tab = 'posts'; - - $contact = null; $remote_contact = false; @@ -48,6 +45,11 @@ function display_content(&$a) { } } + $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1", + intval($a->profile['uid']) + ); + if(count($r)) + $a->page_contact = $r[0]; $sql_extra = " AND `allow_cid` = '' @@ -88,7 +90,7 @@ function display_content(&$a) { $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, - `contact`.`network`, `contact`.`thumb`, `contact`.`self`, + `contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`, `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 @@ -102,17 +104,6 @@ function display_content(&$a) { ); - - $cmnt_tpl = load_view_file('view/comment_item.tpl'); - $like_tpl = load_view_file('view/like_noshare.tpl'); - $tpl = load_view_file('view/wall_item.tpl'); - $wallwall = load_view_file('view/wallwall_item.tpl'); - - $return_url = $_SESSION['return_url'] = $a->cmd; - - $alike = array(); - $dlike = array(); - if(count($r)) { if((local_user()) && (local_user() == $a->profile['uid'])) { @@ -122,179 +113,10 @@ function display_content(&$a) { ); } - foreach($r as $item) { - like_puller($a,$item,$alike,'like'); - like_puller($a,$item,$dlike,'dislike'); - } - - $author_contacts = extract_item_authors($r,$a->profile['uid']); - - foreach($r as $item) { - - $template = $tpl; - - $comment = ''; - $owner_url = ''; - $owner_photo = ''; - $owner_name = ''; - - $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ; - - if(((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE))) - && ($item['id'] != $item['parent'])) - continue; - - $lock = ((($item['private']) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) - || strlen($item['deny_cid']) || strlen($item['deny_gid'])))) - ? '<div class="wall-item-lock"><img src="images/lock_icon.gif" class="lockview" alt="' . t('Private Message') . '" onclick="lockview(event,' . $item['id'] . ');" /></div>' - : '<div class="wall-item-lock"></div>'); - - if(can_write_wall($a,$a->profile['uid'])) { - if($item['id'] == $item['parent']) { - $likebuttons = replace_macros($like_tpl,array( - '$id' => $item['id'], - '$likethis' => t("I like this \x28toggle\x29"), - '$nolike' => t("I don't like this \x28toggle\x29"), - '$share' => t('Share'), - '$wait' => t('Please wait') - )); - } - if($item['last-child']) { - $comment = replace_macros($cmnt_tpl,array( - '$return_path' => '', - '$jsreload' => $_SESSION['return_url'], - '$type' => 'wall-comment', - '$id' => $item['item_id'], - '$parent' => $item['parent'], - '$profile_uid' => $a->profile['uid'], - '$mylink' => $contact['url'], - '$mytitle' => t('This is you'), - '$myphoto' => $contact['thumb'], - '$ww' => '' - )); - } - } - - - $profile_url = $item['url']; - $sparkle = ''; - - - // Top-level wall post not written by the wall owner (wall-to-wall) - // First figure out who owns it. - - $osparkle = ''; + require_once('include/conversation.php'); - if(($item['parent'] == $item['item_id']) && (! $item['self'])) { - - if($item['type'] === 'wall') { - // I do. Put me on the left of the wall-to-wall notice. - $owner_url = $a->contact['url']; - $owner_photo = $a->contact['thumb']; - $owner_name = $a->contact['name']; - $template = $wallwall; - $commentww = 'ww'; - } - if($item['type'] === 'remote' && ($item['owner-link'] != $item['author-link'])) { - // Could be anybody. - $owner_url = $item['owner-link']; - $owner_photo = $item['owner-avatar']; - $owner_name = $item['owner-name']; - $template = $wallwall; - $commentww = 'ww'; - // If it is our contact, use a friendly redirect link - if((link_compare($item['owner-link'],$item['url'])) && ($item['network'] === 'dfrn')) { - $owner_url = $redirect_url; - $osparkle = ' sparkle'; - } + $o .= conversation($a,$r,'display', 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']); - - $edpost = ''; - if((local_user()) && ($item['uid'] == local_user()) && ($item['id'] == $item['parent']) && (intval($item['wall']) == 1)) - $edpost = '<a class="editpost" href="' . $a->get_baseurl() . '/editpost/' . $item['id'] . '" title="' . t('Edit') . '"><img src="images/pencil.gif" /></a>'; - // Can we use our special contact URL for this author? - - if(strlen($item['author-link'])) { - $profile_link = $item['author-link']; - if(link_compare($item['author-link'],$item['url']) && ($item['network'] === 'dfrn') && (! $item['self'])) { - $profile_link = $redirect_url; - $sparkle = ' sparkle'; - } - elseif(isset($author_contacts[$item['author-link']])) { - $profile_link = $a->get_baseurl() . '/redir/' . $author_contacts[$item['author-link']]; - $sparkle = ' sparkle'; - } - } - - if(($item['contact-id'] == remote_user()) || ($item['uid'] == local_user())) - $drop = replace_macros(load_view_file('view/wall_item_drop.tpl'), array('$id' => $item['id'], '$delete' => t('Delete'))); - else - $drop = replace_macros(load_view_file('view/wall_fake_drop.tpl'), array('$id' => $item['id'])); - - $like = ((isset($alike[$item['id']])) ? format_like($alike[$item['id']],$alike[$item['id'] . '-l'],'like',$item['id']) : ''); - $dislike = ((isset($dlike[$item['id']])) ? format_like($dlike[$item['id']],$dlike[$item['id'] . '-l'],'dislike',$item['id']) : ''); - - $location = (($item['location']) ? '<a target="map" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : ''); - $coord = (($item['coord']) ? '<a target="map" href="http://maps.google.com/?q=' . urlencode($item['coord']) . '">' . $item['coord'] . '</a>' : ''); - if($coord) { - if($location) - $location .= '<br /><span class="smalltext">(' . $coord . ')</span>'; - else - $location = '<span class="smalltext">' . $coord . '</span>'; - } - - $indent = (($item['parent'] != $item['item_id']) ? ' comment' : ''); - - if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0) - $indent .= ' shiny'; - - - $tmp_item = replace_macros($template,array( - '$id' => $item['item_id'], - '$linktitle' => t('View $name\'s profile'), - '$olinktitle' => t('View $owner_name\'s profile'), - '$to' => t('to'), - '$wall' => t('Wall-to-Wall'), - '$vwall' => t('via Wall-To-Wall:'), - '$item_photo_menu' => item_photo_menu($item), - '$profile_url' => $profile_link, - '$name' => $profile_name, - '$sparkle' => $sparkle, - '$osparkle' => $osparkle, - '$thumb' => $profile_avatar, - '$title' => $item['title'], - '$body' => smilies(bbcode($item['body'])), - '$ago' => relative_date($item['created']), - '$lock' => $lock, - '$location' => $location, - '$indent' => $indent, - '$owner_url' => $owner_url, - '$owner_photo' => $owner_photo, - '$owner_name' => $owner_name, - '$plink' => get_plink($item), - '$edpost' => $edpost, - '$drop' => $drop, - '$vote' => $likebuttons, - '$like' => $like, - '$dislike' => $dislike, - '$comment' => $comment - )); - - $arr = array('item' => $item, 'output' => $tmp_item); - call_hooks('display_item', $arr); - - $o .= $arr['output']; - - - } } else { $r = q("SELECT `id` FROM `item` WHERE `id` = '%s' OR `uri` = '%s' LIMIT 1", diff --git a/mod/follow.php b/mod/follow.php index f30ecdc92..04858ce52 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -195,6 +195,9 @@ function follow_post(&$a) { if(! x($vcard,'photo')) $vcard['photo'] = $a->get_baseurl() . '/images/default-profile.jpg' ; + + $writeable = ((($network === 'stat') && ($notify)) ? 1 : 0); + // check if we already have a contact // the poll url is more reliable than the profile url, as we may have // indirect links or webfinger links @@ -217,8 +220,8 @@ function follow_post(&$a) { else { // create contact record $r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `alias`, `notify`, `poll`, `name`, `nick`, `photo`, `network`, `rel`, `priority`, - `blocked`, `readonly`, `pending` ) - VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, 0, 0, 0 ) ", + `writable`, `blocked`, `readonly`, `pending` ) + VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, 0, 0, 0 ) ", intval(local_user()), dbesc(datetime_convert()), dbesc($profile), @@ -230,7 +233,8 @@ function follow_post(&$a) { dbesc($vcard['photo']), dbesc($network), intval(REL_FAN), - intval($priority) + intval($priority), + intval($writable) ); } diff --git a/mod/group.php b/mod/group.php index 3ee14dd85..591c93627 100644 --- a/mod/group.php +++ b/mod/group.php @@ -128,11 +128,11 @@ function group_content(&$a) { goaway($a->get_baseurl() . '/contacts'); } $group = $r[0]; - $ret = group_get_members($group['id']); + $members = group_get_members($group['id']); $preselected = array(); - if(count($ret)) { - foreach($ret as $p) - $preselected[] = $p['id']; + if(count($members)) { + foreach($members as $member) + $preselected[] = $member['id']; } $drop_tpl = load_view_file('view/group_drop.tpl'); @@ -156,6 +156,13 @@ function group_content(&$a) { )); } + + $o .= '<div id="group-members">'; + foreach($members as $member) { + $o .= micropro($member,true,'mpgroup'); + } + $o .= '</div><div id="group-members-end"></div>'; + return $o; }
\ No newline at end of file diff --git a/mod/install.php b/mod/install.php index 5c508e4f2..740df6ca9 100644 --- a/mod/install.php +++ b/mod/install.php @@ -118,6 +118,16 @@ function install_content(&$a) { $tpl = load_view_file('view/install_db.tpl'); $o .= replace_macros($tpl, array( + '$lbl_01' => t('Friendika Social Network'), + '$lbl_02' => t('Installation'), + '$lbl_03' => t('In order to install Friendika we need to know how to contact your database.'), + '$lbl_04' => t('Please contact your hosting provider or site administrator if you have questions about these settings.'), + '$lbl_05' => t('The database you specify below must already exist. If it does not, please create it before continuing.'), + '$lbl_06' => t('Database Server Name'), + '$lbl_07' => t('Database Login Name'), + '$lbl_08' => t('Database Login Password'), + '$lbl_09' => t('Database Name'), + '$lbl_10' => t('Please select a default timezone for your website'), '$baseurl' => $a->get_baseurl(), '$tzselect' => ((x($_POST,'timezone')) ? select_timezone($_POST['timezone']) : select_timezone()), '$submit' => t('Submit'), diff --git a/mod/lostpass.php b/mod/lostpass.php index 335a1f512..c46a57e6a 100644 --- a/mod/lostpass.php +++ b/mod/lostpass.php @@ -71,8 +71,15 @@ function lostpass_content(&$a) { if($r) { $tpl = load_view_file('view/pwdreset.tpl'); $o .= replace_macros($tpl,array( + '$lbl1' => t('Password Reset'), + '$lbl2' => t('Your password has been reset as requested.'), + '$lbl3' => t('Your new password is'), + '$lbl4' => t('Save or copy your new password - and then'), + '$lbl5' => '<a href="' . $a->get_baseurl() . '">' . t('click here to login') . '</a>.', + '$lbl6' => t('Your password may be changed from the <em>Settings</em> page after successful login.'), '$newpass' => $new_password, '$baseurl' => $a->get_baseurl() + )); notice("Your password has been reset." . EOL); diff --git a/mod/network.php b/mod/network.php index 42c6c0c29..1b5ea5d65 100644 --- a/mod/network.php +++ b/mod/network.php @@ -32,8 +32,6 @@ function network_content(&$a, $update = 0) { $o = ''; - require_once("include/bbcode.php"); - $contact_id = $a->cid; $group = 0; @@ -204,7 +202,7 @@ function network_content(&$a, $update = 0) { // "New Item View" - show all items unthreaded in reverse created date order $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, - `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, + `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, `contact`.`writable`, `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`, `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` FROM `item`, `contact` @@ -248,7 +246,7 @@ function network_content(&$a, $update = 0) { $parents_str = implode(', ', $parents_arr); $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, - `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, + `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, `contact`.`writable`, `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` @@ -264,345 +262,17 @@ function network_content(&$a, $update = 0) { } } - // find all the authors involved in remote conversations - // We will use a local profile photo if they are one of our contacts - // otherwise we have to get the photo from the item owner's site - - $author_contacts = extract_item_authors($r,local_user()); - - $cmnt_tpl = load_view_file('view/comment_item.tpl'); - $like_tpl = load_view_file('view/like.tpl'); - $noshare_tpl = load_view_file('view/like_noshare.tpl'); - $tpl = load_view_file('view/wall_item.tpl'); - $wallwall = load_view_file('view/wallwall_item.tpl'); - - $alike = array(); - $dlike = array(); - - if(count($r)) { - - if($nouveau) { - - // "New Item View" - just loop through the items and format them minimally for display - - $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']); - - $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ; - - if(strlen($item['author-link'])) { - if(link_compare($item['author-link'],$item['url']) && ($item['network'] === 'dfrn') && (! $item['self'])) { - $profile_link = $redirect_url; - $sparkle = ' sparkle'; - } - elseif(isset($author_contacts[$item['author-link']])) { - $profile_link = $a->get_baseurl() . '/redir/' . $author_contacts[$item['author-link']]; - $sparkle = ' sparkle'; - } - } - - $location = (($item['location']) ? '<a target="map" title="' . $item['location'] . '" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : ''); - $coord = (($item['coord']) ? '<a target="map" title="' . $item['coord'] . '" href="http://maps.google.com/?q=' . urlencode($item['coord']) . '">' . $item['coord'] . '</a>' : ''); - if($coord) { - if($location) - $location .= '<br /><span class="smalltext">(' . $coord . ')</span>'; - else - $location = '<span class="smalltext">' . $coord . '</span>'; - } - - $drop = replace_macros($droptpl,array('$id' => $item['id'])); - $lock = '<div class="wall-item-lock"></div>'; - - $o .= replace_macros($tpl,array( - '$id' => $item['item_id'], - '$linktitle' => t('View $name\'s profile'), - '$profile_url' => $profile_link, - '$item_photo_menu' => item_photo_menu($item), - '$name' => $profile_name, - '$sparkle' => $sparkle, - '$lock' => $lock, - '$thumb' => $profile_avatar, - '$title' => $item['title'], - '$body' => smilies(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' => '<a href="' . $a->get_baseurl() . '/display/' . $a->user['nickname'] . '/' . $item['id'] . '">' . t('View in context') . '</a>' - )); - - } - $o .= paginate($a); - - return $o; - - } - - // Normal View - - - // Figure out how many comments each parent has - // (Comments all have gravity of 6) - // Store the result in the $comments array - - $comments = array(); - foreach($r as $rr) { - if(intval($rr['gravity']) == 6) { - if(! x($comments,$rr['parent'])) - $comments[$rr['parent']] = 1; - else - $comments[$rr['parent']] += 1; - } - } - - // map all the like/dislike activities for each parent item - // Store these in the $alike and $dlike arrays - - foreach($r as $item) { - like_puller($a,$item,$alike,'like'); - like_puller($a,$item,$dlike,'dislike'); - } - - $comments_collapsed = false; - $blowhard = 0; - $blowhard_count = 0; - - foreach($r as $item) { - - $comment = ''; - $template = $tpl; - $commentww = ''; - $sparkle = ''; - $owner_url = $owner_photo = $owner_name = ''; - - - // We've already parsed out like/dislike for special treatment. We can ignore them now - - if(((activity_match($item['verb'],ACTIVITY_LIKE)) - || (activity_match($item['verb'],ACTIVITY_DISLIKE))) - && ($item['id'] != $item['parent'])) - continue; - - // Take care of author collapsing and comment collapsing - // If a single author has more than 3 consecutive top-level posts, squash the remaining ones. - // If there are more than two comments, squash all but the last 2. - - if($item['id'] == $item['parent']) { - if($blowhard == $item['cid'] && (! $item['self'])) { - $blowhard_count ++; - if($blowhard_count == 3) { - $o .= '<div class="icollapse-wrapper fakelink" id="icollapse-wrapper-' . $item['parent'] . '" onclick="openClose(' . '\'icollapse-' . $item['parent'] . '\');" >' . t('See more posts like this') . '</div>' . '<div class="icollapse" id="icollapse-' . $item['parent'] . '" style="display: none;" >'; - } - } - else { - $blowhard = $item['cid']; - if($blowhard_count >= 3) - $o .= '</div>'; - $blowhard_count = 0; - } - - $comments_seen = 0; - $comments_collapsed = false; - } - else - $comments_seen ++; - + // Set this so that the conversation function can find out contact info for our wall-wall items + $a->page_contact = $a->contact; - if(($comments[$item['parent']] > 2) && ($comments_seen <= ($comments[$item['parent']] - 2)) && ($item['gravity'] == 6)) { - if(! $comments_collapsed) { - $o .= '<div class="ccollapse-wrapper fakelink" id="ccollapse-wrapper-' . $item['parent'] . '" onclick="openClose(' . '\'ccollapse-' . $item['parent'] . '\');" >' . sprintf( t('See all %d comments'), $comments[$item['parent']]) . '</div>'; - $o .= '<div class="ccollapse" id="ccollapse-' . $item['parent'] . '" style="display: none;" >'; - $comments_collapsed = true; - } - } - if(($comments[$item['parent']] > 2) && ($comments_seen == ($comments[$item['parent']] - 1))) { - $o .= '</div>'; - } - - - - $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ; - - $lock = ((($item['private']) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) - || strlen($item['deny_cid']) || strlen($item['deny_gid'])))) - ? '<div class="wall-item-lock"><img src="images/lock_icon.gif" class="lockview" alt="' . t('Private Message') . '" onclick="lockview(event,' . $item['id'] . ');" /></div>' - : '<div class="wall-item-lock"></div>'); - - - // Top-level wall post not written by the wall owner (wall-to-wall) - // First figure out who owns it. - - $osparkle = ''; - - if(($item['parent'] == $item['item_id']) && (! $item['self'])) { - - if($item['type'] === 'wall') { - // I do. Put me on the left of the wall-to-wall notice. - $owner_url = $a->contact['url']; - $owner_photo = $a->contact['thumb']; - $owner_name = $a->contact['name']; - $template = $wallwall; - $commentww = 'ww'; - } - if(($item['type'] === 'remote') && (strlen($item['owner-link'])) && ($item['owner-link'] != $item['author-link'])) { - // Could be anybody. - $owner_url = $item['owner-link']; - $owner_photo = $item['owner-avatar']; - $owner_name = $item['owner-name']; - $template = $wallwall; - $commentww = 'ww'; - // If it is our contact, use a friendly redirect link - if((link_compare($item['owner-link'],$item['url'])) - && ($item['network'] === 'dfrn')) { - $owner_url = $redirect_url; - $osparkle = ' sparkle'; - } - } - } - - if($update) - $return_url = $_SESSION['return_url']; - else - $return_url = $_SESSION['return_url'] = $a->cmd; - - $likebuttons = ''; - if($item['id'] == $item['parent']) { - $likebuttons = replace_macros((($item['private']) ? $noshare_tpl : $like_tpl),array( - '$id' => $item['id'], - '$likethis' => t("I like this \x28toggle\x29"), - '$nolike' => t("I don't like this \x28toggle\x29"), - '$share' => t('Share'), - '$wait' => t('Please wait') - )); - } - - if($item['last-child']) { - $comment = replace_macros($cmnt_tpl,array( - '$return_path' => '', - '$jsreload' => '', // $_SESSION['return_url'], - '$type' => 'net-comment', - '$id' => $item['item_id'], - '$parent' => $item['parent'], - '$profile_uid' => $_SESSION['uid'], - '$mylink' => $a->contact['url'], - '$mytitle' => t('This is you'), - '$myphoto' => $a->contact['thumb'], - '$ww' => $commentww - )); - } - - $edpost = ''; - if(($item['id'] == $item['parent']) && (intval($item['wall']) == 1)) - $edpost = '<a class="editpost" href="' . $a->get_baseurl() . '/editpost/' . $item['id'] . '" title="' . t('Edit') . '"><img src="images/pencil.gif" /></a>'; - $drop = replace_macros(load_view_file('view/wall_item_drop.tpl'), array('$id' => $item['id'], '$delete' => t('Delete'))); + $mode = (($nouveau) ? 'network-new' : 'network'); - $photo = $item['photo']; - $thumb = $item['thumb']; + require_once('include/conversation.php'); - // Post was remotely authored. - - $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); - - if(strlen($item['author-link'])) { - $profile_link = $item['author-link']; - if(link_compare($item['author-link'],$item['url']) && ($item['network'] === 'dfrn') && (! $item['self'])) { - $profile_link = $redirect_url; - $sparkle = ' sparkle'; - } - elseif(isset($author_contacts[$item['author-link']])) { - $profile_link = $a->get_baseurl() . '/redir/' . $author_contacts[$item['author-link']]; - $sparkle = ' sparkle'; - } - } - else - $profile_link = $item['url']; - - $like = ((x($alike,$item['id'])) ? format_like($alike[$item['id']],$alike[$item['id'] . '-l'],'like',$item['id']) : ''); - $dislike = ((x($dlike,$item['id'])) ? format_like($dlike[$item['id']],$dlike[$item['id'] . '-l'],'dislike',$item['id']) : ''); - - $location = (($item['location']) ? '<a target="map" title="' . $item['location'] . '" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : ''); - $coord = (($item['coord']) ? '<a target="map" title="' . $item['coord'] . '" href="http://maps.google.com/?q=' . urlencode($item['coord']) . '">' . $item['coord'] . '</a>' : ''); - if($coord) { - if($location) - $location .= '<br /><span class="smalltext">(' . $coord . ')</span>'; - else - $location = '<span class="smalltext">' . $coord . '</span>'; - } - - $indent = (($item['parent'] != $item['item_id']) ? ' comment' : ''); - - if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0) - $indent .= ' shiny'; - - - - // Build the HTML - - $tmp_item = replace_macros($template,array( - '$id' => $item['item_id'], - '$linktitle' => t('View $name\'s profile'), - '$olinktitle' => t('View $owner_name\'s profile'), - '$to' => t('to'), - '$wall' => t('Wall-to-Wall'), - '$vwall' => t('via Wall-To-Wall:'), - '$profile_url' => $profile_link, - '$item_photo_menu' => item_photo_menu($item), - '$name' => $profile_name, - '$thumb' => $profile_avatar, - '$osparkle' => $osparkle, - '$sparkle' => $sparkle, - '$title' => $item['title'], - '$body' => smilies(bbcode($item['body'])), - '$ago' => relative_date($item['created']), - '$lock' => $lock, - '$location' => $location, - '$indent' => $indent, - '$owner_url' => $owner_url, - '$owner_photo' => $owner_photo, - '$owner_name' => $owner_name, - '$plink' => get_plink($item), - '$edpost' => $edpost, - '$drop' => $drop, - '$vote' => $likebuttons, - '$like' => $like, - '$dislike' => $dislike, - '$comment' => $comment - )); - - $arr = array('item' => $item, 'output' => $tmp_item); - call_hooks('display_item', $arr); - - $o .= $arr['output']; - - } - } + $o .= conversation($a,$r,$mode,$update); if(! $update) { - // if author collapsing is in force but didn't get closed, close it off now. - - if($blowhard_count >= 3) - $o .= '</div>'; - - $o .= paginate($a); $o .= '<div class="cc-license">' . t('Shared content is covered by the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license.') . '</div>'; } diff --git a/mod/notifications.php b/mod/notifications.php index ed0831aab..c3f8449ed 100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -147,17 +147,13 @@ function notifications_content(&$a) { LEFT JOIN `contact` ON `register`.`uid` = `contact`.`uid` LEFT JOIN `user` ON `register`.`uid` = `user`.`uid`;"); if(($r !== false) && (count($r))) { - $tpl = load_view_file("view/registrations.tpl"); + $o .= '<ul>'; foreach($r as $rr) { - $o .= "<ul>"; - $o .= replace_macros($tpl, array( - '$fullname' => $rr['name'], - '$email' => $rr['email'], - '$approvelink' => "regmod/allow/".$rr['hash'], - '$denylink' => "regmod/deny/".$rr['hash'], - )); - $o .= "</ul>"; + $o .= '<li>' . sprintf('%s (%s) : ', $rr['name'],$rr['email']) + . '<a href="regmod/allow/' . $rr['hash'] .'">' . t('Approve') + . '</a> - <href="regmod/deny/' . $rr['hash'] . '">' . t('Deny') . '</a></li>' . "\r\n"; } + $o .= "</ul>"; } else notice( t('No registrations.') . EOL); diff --git a/mod/opensearch.php b/mod/opensearch.php new file mode 100644 index 000000000..69afba75c --- /dev/null +++ b/mod/opensearch.php @@ -0,0 +1,18 @@ +<?php + function opensearch_content(&$a) { + + $tpl = load_view_file('view/opensearch.tpl'); + + header("Content-type: application/opensearchdescription+xml"); + + $o = replace_macros($tpl, array( + '$baseurl' => $a->get_baseurl(), + '$nodename' => $a->get_hostname(), + )); + + echo $o; + + killme(); + + } +?>
\ No newline at end of file diff --git a/mod/parse_url.php b/mod/parse_url.php index b3b42b6cb..a65215ca1 100644 --- a/mod/parse_url.php +++ b/mod/parse_url.php @@ -5,7 +5,11 @@ require_once('library/HTML5/Parser.php'); function parse_url_content(&$a) { - $url = trim($_GET['url']); + logger('parse_url: ' . $_GET['url']); + + $url = trim(hex2bin($_GET['url'])); + + logger('parse_url: ' . $url); $text = null; diff --git a/mod/photos.php b/mod/photos.php index 061542c75..757b4685d 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1105,6 +1105,8 @@ function photos_content(&$a) { '$mylink' => $contact['url'], '$mytitle' => t('This is you'), '$myphoto' => $contact['thumb'], + '$comment' => t('Comment'), + '$submit' => t('Submit'), '$ww' => '' )); } @@ -1257,17 +1259,14 @@ function photos_content(&$a) { if(count($r)) { foreach($r as $rr) { $o .= replace_macros($tpl,array( - '$id' => $rr['id'], - '$photolink' => $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] - . '/image/' . $rr['resource-id'], + '$id' => $rr['id'], + '$photolink' => $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $rr['resource-id'], '$phototitle' => t('View Photo'), - '$imgsrc' => $a->get_baseurl() . '/photo/' - . $rr['resource-id'] . '-' . ((($rr['scale']) == 6) ? 4 : $rr['scale']) . '.jpg', - '$albumlink' => $a->get_baseurl() . '/photos/' - . $a->data['user']['nickname'] . '/album/' . bin2hex($rr['album']), - '$albumname' => $rr['album'], - '$albumalt' => t('View Album'), - '$imgalt' => $rr['filename'] + '$imgsrc' => $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . ((($rr['scale']) == 6) ? 4 : $rr['scale']) . '.jpg', + '$albumlink' => $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($rr['album']), + '$albumname' => $rr['album'], + '$albumalt' => t('View Album'), + '$imgalt' => $rr['filename'] )); } diff --git a/mod/profile.php b/mod/profile.php index b421591f6..0a044069a 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -106,16 +106,9 @@ function profile_content(&$a, $update = 0) { if($tab === 'profile') { - $profile_lang = get_config('system','language'); - if(! $profile_lang) - $profile_lang = 'en'; - if(file_exists("view/$profile_lang/profile_advanced.php")) - require_once("view/$profile_lang/profile_advanced.php"); - else - require_once('view/profile_advanced.php'); - + require_once('include/profile_advanced.php'); + $o .= advanced_profile($a); call_hooks('profile_advanced',$o); - return $o; } @@ -279,7 +272,7 @@ function profile_content(&$a, $update = 0) { $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`network`, `contact`.`rel`, - `contact`.`thumb`, `contact`.`self`, + `contact`.`thumb`, `contact`.`self`, `contact`.`writable`, `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 @@ -295,203 +288,17 @@ function profile_content(&$a, $update = 0) { if($is_owner && ! $update) $o .= get_birthdays(); - $cmnt_tpl = load_view_file('view/comment_item.tpl'); - - $like_tpl = load_view_file('view/like.tpl'); - $noshare_tpl = load_view_file('view/like_noshare.tpl'); - - $tpl = load_view_file('view/wall_item.tpl'); - - $droptpl = load_view_file('view/wall_item_drop.tpl'); - $fakedrop = load_view_file('view/wall_fake_drop.tpl'); - - if($update) - $return_url = $_SESSION['return_url']; - else - $return_url = $_SESSION['return_url'] = $a->cmd; - - $alike = array(); - $dlike = array(); - - if($r !== false && count($r)) { - - $comments = array(); - foreach($r as $rr) { - if(intval($rr['gravity']) == 6) { - if(! x($comments,$rr['parent'])) - $comments[$rr['parent']] = 1; - else - $comments[$rr['parent']] += 1; - } - } - - foreach($r as $item) { - like_puller($a,$item,$alike,'like'); - like_puller($a,$item,$dlike,'dislike'); - } - - $comments_collapsed = false; - foreach($r as $item) { + require_once('include/conversation.php'); - $sparkle = ''; - $comment = ''; - $likebuttons = ''; + $o .= conversation($a,$r,'profile',$update); - $template = $tpl; - - $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ; - if(((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE))) - && ($item['id'] != $item['parent'])) - continue; - - if($item['id'] == $item['parent']) { - $comments_seen = 0; - $comments_collapsed = false; - } - else - $comments_seen ++; - - - if(($comments[$item['parent']] > 2) && ($comments_seen <= ($comments[$item['parent']] - 2)) && ($item['gravity'] == 6)) { - if(! $comments_collapsed) { - $o .= '<div class="ccollapse-wrapper fakelink" id="ccollapse-wrapper-' . $item['parent'] . '" onclick="openClose(' . '\'ccollapse-' . $item['parent'] . '\');" >' . sprintf( t('See all %d comments'), $comments[$item['parent']]) . '</div>'; - $o .= '<div class="ccollapse" id="ccollapse-' . $item['parent'] . '" style="display: none;" >'; - $comments_collapsed = true; - } - } - if(($comments[$item['parent']] > 2) && ($comments_seen == ($comments[$item['parent']] - 1))) { - $o .= '</div></div>'; - } - - $lock = ((($item['private']) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) - || strlen($item['deny_cid']) || strlen($item['deny_gid'])))) - ? '<div class="wall-item-lock"><img src="images/lock_icon.gif" class="lockview" alt="' . t('Private Message') . '" onclick="lockview(event,' . $item['id'] . ');" /></div>' - : '<div class="wall-item-lock"></div>'); - - if(can_write_wall($a,$a->profile['profile_uid'])) { - if($item['id'] == $item['parent']) { - $likebuttons = replace_macros((($item['private']) ? $noshare_tpl : $like_tpl),array( - '$id' => $item['id'], - '$likethis' => t("I like this \x28toggle\x29"), - '$nolike' => t("I don't like this \x28toggle\x29"), - '$share' => t('Share'), - '$wait' => t('Please wait') - )); - } - if($item['last-child']) { - $comment = replace_macros($cmnt_tpl,array( - '$return_path' => '', - '$jsreload' => '', // $_SESSION['return_url'], - '$type' => 'wall-comment', - '$id' => $item['item_id'], - '$parent' => $item['parent'], - '$profile_uid' => $a->profile['profile_uid'], - '$mylink' => $contact['url'], - '$mytitle' => t('This is you'), - '$myphoto' => $contact['thumb'], - '$ww' => '' - )); - } - } - - - $profile_url = $item['url']; - - // 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'] == local_user()) - && ($item['network'] === 'dfrn') && (! $item['self'] )) { - $profile_url = $redirect_url; - $sparkle = ' sparkle'; - } - else - $sparkle = ''; - - - $edpost = ''; - if((local_user()) && ($a->profile['profile_uid'] == local_user()) && ($item['id'] == $item['parent']) && (intval($item['wall']) == 1)) - $edpost = '<a class="editpost" href="' . $a->get_baseurl() . '/editpost/' . $item['id'] . '" title="' . t('Edit') . '"><img src="images/pencil.gif" /></a>'; - - - // We would prefer to use our own avatar link for this item because the one in the author-avatar might reference a - // remote site (which could be down). We will use author-avatar if we haven't got something stored locally. - // We use this same logic block in mod/network.php to determine it this is a third party post and we don't have any - // 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 = ((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']); - - $profile_link = $profile_url; - - $drop = ''; - $dropping = false; - - if(($item['contact-id'] == remote_user()) || ($item['uid'] == local_user())) - $dropping = true; - - $drop = replace_macros((($dropping)? $droptpl : $fakedrop), array('$id' => $item['id'], '$delete' => t('Delete'))); - - - $like = ((isset($alike[$item['id']])) ? format_like($alike[$item['id']],$alike[$item['id'] . '-l'],'like',$item['id']) : ''); - $dislike = ((isset($dlike[$item['id']])) ? format_like($dlike[$item['id']],$dlike[$item['id'] . '-l'],'dislike',$item['id']) : ''); - $location = (($item['location']) ? '<a target="map" title="' . $item['location'] . '" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : ''); - $coord = (($item['coord']) ? '<a target="map" title="' . $item['coord'] . '" href="http://maps.google.com/?q=' . urlencode($item['coord']) . '">' . $item['coord'] . '</a>' : ''); - if($coord) { - if($location) - $location .= '<br /><span class="smalltext">(' . $coord . ')</span>'; - else - $location = '<span class="smalltext">' . $coord . '</span>'; - } - - $indent = (($item['parent'] != $item['item_id']) ? ' comment' : ''); - - if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0) - $indent .= ' shiny'; - - - $tmp_item = replace_macros($template,array( - '$id' => $item['item_id'], - '$linktitle' => t('View $name\'s profile'), - '$profile_url' => $profile_link, - '$item_photo_menu' => item_photo_menu($item), - '$name' => $profile_name, - '$thumb' => $profile_avatar, - '$sparkle' => $sparkle, - '$title' => $item['title'], - '$body' => smilies(bbcode($item['body'])), - '$ago' => relative_date($item['created']), - '$lock' => $lock, - '$location' => $location, - '$indent' => $indent, - '$plink' => get_plink($item), - '$edpost' => $edpost, - '$drop' => $drop, - '$like' => $like, - '$vote' => $likebuttons, - '$dislike' => $dislike, - '$comment' => $comment - )); - - $arr = array('item' => $item, 'output' => $tmp_item); - call_hooks('display_item', $arr); - - $o .= $arr['output']; - - } - } - - if($update) { - return $o; - } + if(! $update) { - $o .= paginate($a); - $o .= '<div class="cc-license">' . t('Shared content is covered by the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license.') . '</div>'; + $o .= paginate($a); + $o .= '<div class="cc-license">' . t('Shared content is covered by the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license.') . '</div>'; + } return $o; } diff --git a/mod/profile_photo.php b/mod/profile_photo.php index 48805fbdd..fe4da3baf 100644 --- a/mod/profile_photo.php +++ b/mod/profile_photo.php @@ -184,7 +184,11 @@ function profile_photo_content(&$a) { $tpl = load_view_file('view/profile_photo.tpl'); $o .= replace_macros($tpl,array( - '$user' => $a->user['nickname'] + '$user' => $a->user['nickname'], + '$lbl_upfile' => t('Upload File:'), + '$title' => t('Upload Profile Photo'), + '$submit' => t('Upload'), + '$select' => sprintf('%s %s', t('or'), '<a href="'. $a->get_baseurl() . '/photos/' . $a->user['nickname'] . '">' . t('select a photo from your photo albums') . '</a>') )); return $o; diff --git a/mod/profiles.php b/mod/profiles.php index 434f58adf..4802f21aa 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -351,6 +351,9 @@ function profiles_content(&$a) { $opt_tpl = load_view_file("view/profile-hide-friends.tpl"); $hide_friends = replace_macros($opt_tpl,array( + '$desc' => t('Hide my contact/friend list from viewers of this profile?'), + '$yes_str' => t('Yes'), + '$no_str' => t('No'), '$yes_selected' => (($r[0]['hide-friends']) ? " checked=\"checked\" " : ""), '$no_selected' => (($r[0]['hide-friends'] == 0) ? " checked=\"checked\" " : "") )); @@ -363,6 +366,44 @@ function profiles_content(&$a) { $is_default = (($r[0]['is-default']) ? 1 : 0); $tpl = load_view_file("view/profile_edit.tpl"); $o .= replace_macros($tpl,array( + '$banner' => t('Edit Profile Details'), + '$submit' => t('Submit'), + '$viewprof' => t('View this profile'), + '$cr_prof' => t('Create a new profile using these settings'), + '$cl_prof' => t('Clone this profile'), + '$del_prof' => t('Delete this profile'), + '$lbl_profname' => t('Profile Name:'), + '$lbl_fullname' => t('Your Full Name:'), + '$lbl_title' => t('Title/Description:'), + '$lbl_gender' => t('Your Gender:'), + '$lbl_bd' => t("Birthday \x28y/m/d\x29:"), + '$lbl_address' => t('Street Address:'), + '$lbl_city' => t('Locality/City:'), + '$lbl_zip' => t('Postal/Zip Code:'), + '$lbl_country' => t('Country:'), + '$lbl_region' => t('Region/State:'), + '$lbl_marital' => t('<span class="heart">♥</span> Marital Status:'), + '$lbl_with' => t("Who: \x28if applicable\x29"), + '$lbl_ex1' => t('Examples: cathy123, Cathy Williams, cathy@example.com'), + '$lbl_sexual' => t('Sexual Preference:'), + '$lbl_homepage' => t('Homepage URL:'), + '$lbl_politic' => t('Political Views:'), + '$lbl_religion' => t('Religious Views:'), + '$lbl_pubkey' => t('Public Keywords:'), + '$lbl_prvkey' => t('Private Keywords:'), + '$lbl_ex2' => t('Example: fishing photography software'), + '$lbl_pubdsc' => t("\x28Used for suggesting potential friends, can be seen by others\x29"), + '$lbl_prvdsc' => t("\x28Used for searching profiles, never shown to others\x29"), + '$lbl_about' => t('Tell us about yourself...'), + '$lbl_hobbies' => t('Hobbies/Interests'), + '$lbl_social' => t('Contact information and Social Networks'), + '$lbl_music' => t('Musical interests'), + '$lbl_book' => t('Books, literature'), + '$lbl_tv' => t('Television'), + '$lbl_film' => t('Film/dance/culture/entertainment'), + '$lbl_love' => t('Love/romance'), + '$lbl_work' => t('Work/employment'), + '$lbl_school' => t('School/education'), '$disabled' => (($is_default) ? 'onclick="return false;" style="color: #BBBBFF;"' : ''), '$baseurl' => $a->get_baseurl(), '$profile_id' => $r[0]['id'], @@ -410,7 +451,14 @@ function profiles_content(&$a) { local_user()); if(count($r)) { - $o .= load_view_file('view/profile_listing_header.tpl'); + $tpl_header = load_view_file('view/profile_listing_header.tpl'); + $o .= replace_macros($tpl_header,array( + '$header' => t('Profiles'), + '$chg_photo' => t('Change profile photo'), + '$cr_new' => t('Create New Profile') + )); + + $tpl_default = load_view_file('view/profile_entry_default.tpl'); $tpl = load_view_file('view/profile_entry.tpl'); diff --git a/mod/search.php b/mod/search.php index b53bd45c0..23b2ddb7e 100644 --- a/mod/search.php +++ b/mod/search.php @@ -65,7 +65,7 @@ function search_content(&$a) { $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, - `contact`.`network`, `contact`.`thumb`, `contact`.`self`, + `contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`, `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`, `user`.`nickname` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` @@ -80,68 +80,10 @@ function search_content(&$a) { dbesc($search) ); - $tpl = load_view_file('view/search_item.tpl'); - $droptpl = load_view_file('view/wall_fake_drop.tpl'); - - $return_url = $_SESSION['return_url'] = $a->cmd; - - if(count($r)) { - - foreach($r as $item) { - - $total = 0; - $comment = ''; - $owner_url = ''; - $owner_photo = ''; - $owner_name = ''; - $sparkle = ''; - - if(((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE))) - && ($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']); - - - $location = (($item['location']) ? '<a target="map" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : ''); - $coord = (($item['coord']) ? '<a target="map" href="http://maps.google.com/?q=' . urlencode($item['coord']) . '">' . $item['coord'] . '</a>' : ''); - if($coord) { - if($location) - $location .= '<br /><span class="smalltext">(' . $coord . ')</span>'; - else - $location = '<span class="smalltext">' . $coord . '</span>'; - } - - $drop = replace_macros($droptpl,array('$id' => $item['id'])); - $lock = '<div class="wall-item-lock"></div>'; - - $o .= replace_macros($tpl,array( - '$id' => $item['item_id'], - '$linktitle' => t('View $name\'s profile'), - '$profile_url' => $profile_link, - '$item_photo_menu' => item_photo_menu($item), - '$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' => '<a href="' . $a->get_baseurl() . '/display/' . $item['nickname'] . '/' . $item['id'] . '">' . t('View in context') . '</a>' - )); - - } - } + + require_once('include/conversation.php'); + + $o .= conversation($a,$r,'search',false); $o .= paginate($a); diff --git a/mod/settings.php b/mod/settings.php index 72b627d41..5f88d95fb 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -285,6 +285,9 @@ function settings_content(&$a) { else { $opt_tpl = load_view_file("view/profile-in-directory.tpl"); $profile_in_dir = replace_macros($opt_tpl,array( + '$desc' => t('Publish your default profile in site directory?'), + '$yes_str' => t('Yes'), + '$no_str' => t('No'), '$yes_selected' => (($profile['publish']) ? " checked=\"checked\" " : ""), '$no_selected' => (($profile['publish'] == 0) ? " checked=\"checked\" " : "") )); @@ -294,6 +297,9 @@ function settings_content(&$a) { $opt_tpl = load_view_file("view/profile-in-netdir.tpl"); $profile_in_net_dir = replace_macros($opt_tpl,array( + '$desc' => t('Publish your default profile in global social directory?'), + '$yes_str' => t('Yes'), + '$no_str' => t('No'), '$yes_selected' => (($profile['net-publish']) ? " checked=\"checked\" " : ""), '$no_selected' => (($profile['net-publish'] == 0) ? " checked=\"checked\" " : "") )); @@ -309,18 +315,7 @@ function settings_content(&$a) { if($invisible) notice( t('Profile is <strong>not published</strong>.') . EOL ); - $nickname_block = load_view_file("view/settings_nick_set.tpl"); - $nickname_subdir = ''; - if(strlen($a->get_path())) { - $subdir_tpl = load_view_file('view/settings_nick_subdir.tpl'); - $nickname_subdir = replace_macros($subdir_tpl, array( - '$baseurl' => $a->get_baseurl(), - '$nickname' => $nickname, - '$hostname' => $a->get_hostname() - )); - } - $theme_selector = '<select name="theme" id="theme-select" >'; $files = glob('view/theme/*'); @@ -338,13 +333,16 @@ function settings_content(&$a) { } $theme_selector .= '</select>'; + $subdir = ((strlen($a->get_path())) ? '<br />' . t('or') . ' ' . $a->get_baseurl() . '/profile/' . $nickname : ''); - $nickname_block = replace_macros($nickname_block,array( + $tpl_addr = load_view_file("view/settings_nick_set.tpl"); + + $prof_addr = replace_macros($tpl_addr,array( + '$desc' => t('Your profile address is'), '$nickname' => $nickname, - '$uid' => local_user(), - '$subdir' => $nickname_subdir, - '$basepath' => $a->get_hostname(), - '$baseurl' => $a->get_baseurl())); + '$subdir' => $subdir, + '$basepath' => $a->get_hostname() + )); $stpl = load_view_file('view/settings.tpl'); @@ -354,6 +352,34 @@ function settings_content(&$a) { $o .= replace_macros($stpl,array( + '$ptitle' => t('Account Settings'), + '$lbl_plug' => t('Plugin Settings'), + '$lbl_basic' => t('Basic Settings'), + '$lbl_fn' => t('Full Name:'), + '$lbl_email' => t('Email Address:'), + '$lbl_tz' => t('Your Timezone:'), + '$lbl_loc1' => t('Default Post Location:'), + '$lbl_loc2' => t('Use Browser Location:'), + '$lbl_theme' => t('Display Theme:'), + '$submit' => t('Submit'), + '$lbl_prv' => t('Security and Privacy Settings'), + '$lbl_maxreq' => t('Maximum Friend Requests/Day:'), + '$lbl_maxrdesc' => t("\x28to prevent spam abuse\x29"), + '$lbl_rempost' => t('Allow friends to post to your profile page:'), + '$lbl_exp1' => t("Automatically expire \x28delete\x29 posts older than"), + '$lbl_exp2' => t('days'), + '$lbl_not1' => t('Notification Settings'), + '$lbl_not2' => t('Send a notification email when:'), + '$lbl_not3' => t('You receive an introduction'), + '$lbl_not4' => t('Your introductions are confirmed'), + '$lbl_not5' => t('Someone writes on your profile wall'), + '$lbl_not6' => t('Someone writes a followup comment'), + '$lbl_not7' => t('You receive a private message'), + '$lbl_pass1' => t('Password Settings'), + '$lbl_pass2' => t('Leave password fields blank unless changing'), + '$lbl_pass3' => t('New Password:'), + '$lbl_pass4' => t('Confirm:'), + '$lbl_advn' => t('Advanced Page Settings'), '$baseurl' => $a->get_baseurl(), '$oidhtml' => $oidhtml, '$uexport' => $uexport, @@ -361,7 +387,7 @@ function settings_content(&$a) { '$username' => $username, '$openid' => $openid, '$email' => $email, - '$nickname_block' => $nickname_block, + '$nickname_block' => $prof_addr, '$timezone' => $timezone, '$zoneselect' => select_timezone($timezone), '$defloc' => $defloc, diff --git a/mod/share.php b/mod/share.php index 8a8229e8a..f355a842a 100644 --- a/mod/share.php +++ b/mod/share.php @@ -17,7 +17,7 @@ function share_init(&$a) { $o = ''; $o .= '♲ <a href="' . $r[0]['author-link'] . '">' . $r[0]['author-name'] . '</a><br />'; - $o .= prepare_body($r[0]); + $o .= bbcode($r[0]['body'], true); echo $o . '<br />'; killme(); -}
\ No newline at end of file +} |