diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/directory.php | 6 | ||||
-rw-r--r-- | mod/match.php | 5 | ||||
-rw-r--r-- | mod/settings.php | 5 | ||||
-rw-r--r-- | mod/uexport.php | 72 |
4 files changed, 83 insertions, 5 deletions
diff --git a/mod/directory.php b/mod/directory.php index 825e2a375..72c30fb31 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -86,10 +86,10 @@ function directory_content(&$a) { } if(strlen($rr['dob'])) { if(($years = age($rr['dob'],$rr['timezone'],'')) != 0) - $details .= "<br />Age: $years" ; + $details .= '<br />' . t('Age: ') . $years ; } if(strlen($rr['gender'])) - $details .= '<br />Gender: ' . $rr['gender']; + $details .= '<br />' . t('Gender: ') . $rr['gender']; $entry = replace_macros($tpl,array( '$id' => $rr['id'], @@ -115,7 +115,7 @@ function directory_content(&$a) { } else - notice("No entries (some entries may be hidden)."); + notice( t("No entries \x28some entries may be hidden\x29.") . EOL); return $o; }
\ No newline at end of file diff --git a/mod/match.php b/mod/match.php index 7228529d7..092595a09 100644 --- a/mod/match.php +++ b/mod/match.php @@ -39,11 +39,12 @@ function match_content(&$a) { if(count($j->results)) { foreach($j->results as $jj) { $o .= '<div class="profile-match-wrapper"><div class="profile-match-photo">'; - $o .= '<a href="' . $jj->url . '">' . '<img src="' . $jj->photo . '" alt="' . $jj->name . '" /></a></div>'; + $o .= '<a href="' . $jj->url . '">' . '<img src="' . $jj->photo . '" alt="' . $jj->name . '" title="' . $jj->name . '[' . $jj->url . ']' . '" /></a></div>'; $o .= '<div class="profile-match-break"></div>'; - $o .= '<div class="profile-match-name"><a href="' . $jj->url . '">' . $jj->name . '</a></div>'; + $o .= '<div class="profile-match-name"><a href="' . $jj->url . '" title="' . $jj->name . '[' . $jj->url .']' . '">' . $jj->name . '</a></div>'; $o .= '<div class="profile-match-end"></div></div>'; } + $o .= '<div id="profile-match-wrapper-end"></div>'; } else { notice( t('No matches') . EOL); diff --git a/mod/settings.php b/mod/settings.php index 6a2733d7c..b20f4d11b 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -5,6 +5,7 @@ function settings_init(&$a) { if(local_user()) { profile_load($a,$a->user['nickname']); } + } @@ -341,9 +342,13 @@ function settings_content(&$a) { $celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false); + $uexport = '<div id="uexport-link"><a href="uexport" >' . t('Export Personal Data') . '</a></div>'; + + $o .= replace_macros($stpl,array( '$baseurl' => $a->get_baseurl(), '$oidhtml' => $oidhtml, + '$uexport' => $uexport, '$uid' => local_user(), '$username' => $username, '$openid' => $openid, diff --git a/mod/uexport.php b/mod/uexport.php new file mode 100644 index 000000000..96f062c41 --- /dev/null +++ b/mod/uexport.php @@ -0,0 +1,72 @@ +<?php + +function uexport_init(&$a) { + + if(! local_user()) + killme(); + + $user = array(); + $r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", + local_user() + ); + if(count($r)) { + foreach($r as $rr) + foreach($rr as $k => $v) + $user[$k] = $v; + + } + $contact = array(); + $r = q("SELECT * FROM `contact` WHERE `uid` = %d ", + intval(local_user()) + ); + if(count($r)) { + foreach($r as $rr) + foreach($rr as $k => $v) + $contact[][$k] = $v; + + } + + $profile = array(); + $r = q("SELECT * FROM `profile` WHERE `uid` = %d ", + intval(local_user()) + ); + if(count($r)) { + foreach($r as $rr) + foreach($rr as $k => $v) + $profile[][$k] = $v; + } + + $output = array('user' => $user, 'contact' => $contact, 'profile' => $profile ); + + header("Content-type: application/json"); + echo str_replace('\\/','/',json_encode($output)); + + $r = q("SELECT count(*) as `total` FROM `item` WHERE `uid` = %d ", + intval(local_user()) + ); + if(count($r)) + $total = $r[0]['total']; + + // chunk the output to avoid exhausting memory + + for($x = 0; $x < $total; $x += 500) { + $item = array(); + $r = q("SELECT * FROM `item` WHERE `uid` = %d LIMIT %d, %d", + intval(local_user()), + intval($x), + intval(500) + ); + if(count($r)) { + foreach($r as $rr) + foreach($rr as $k => $v) + $item[][$k] = $v; + } + + $output = array('item' => $item); + echo str_replace('\\/','/',json_encode($output)); + } + + + killme(); + +}
\ No newline at end of file |