aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/display.php11
-rw-r--r--mod/item.php6
-rw-r--r--mod/network.php17
-rw-r--r--mod/profile.php36
-rw-r--r--mod/settings.php7
5 files changed, 59 insertions, 18 deletions
diff --git a/mod/display.php b/mod/display.php
index fefef8ad6..84176d293 100644
--- a/mod/display.php
+++ b/mod/display.php
@@ -229,7 +229,14 @@ function display_content(&$a) {
$like = (($alike[$item['id']]) ? format_like($alike[$item['id']],$alike[$item['id'] . '-l'],'like',$item['id']) : '');
$dislike = (($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>';
+ }
$o .= replace_macros($template,array(
'$id' => $item['item_id'],
@@ -242,7 +249,7 @@ function display_content(&$a) {
'$body' => bbcode($item['body']),
'$ago' => relative_date($item['created']),
'$lock' => $lock,
- '$location' => (($item['location']) ? '<a target="map" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : ''),
+ '$location' => $location,
'$indent' => (($item['parent'] != $item['item_id']) ? ' comment' : ''),
'$owner_url' => $owner_url,
'$owner_photo' => $owner_photo,
diff --git a/mod/item.php b/mod/item.php
index 39865cdaf..4ebb1e978 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -57,6 +57,7 @@ function item_post(&$a) {
$title = notags(trim($_POST['title']));
$body = escape_tags(trim($_POST['body']));
$location = notags(trim($_POST['location']));
+ $coord = notags(trim($_POST['coord']));
$verb = notags(trim($_POST['verb']));
if(! strlen($body)) {
@@ -128,8 +129,8 @@ function item_post(&$a) {
$r = q("INSERT INTO `item` (`uid`,`type`,`wall`,`gravity`,`contact-id`,`owner-name`,`owner-link`,`owner-avatar`,
`author-name`, `author-link`, `author-avatar`, `created`,
- `edited`, `changed`, `uri`, `title`, `body`, `location`, `verb`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`)
- VALUES( %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' )",
+ `edited`, `changed`, `uri`, `title`, `body`, `location`, `coord`, `verb`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`)
+ VALUES( %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' )",
intval($profile_uid),
dbesc($post_type),
intval($wall),
@@ -148,6 +149,7 @@ function item_post(&$a) {
dbesc($title),
dbesc($body),
dbesc($location),
+ dbesc($coord),
dbesc($verb),
dbesc($str_contact_allow),
dbesc($str_group_allow),
diff --git a/mod/network.php b/mod/network.php
index 3a747eac9..97a82a705 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -28,9 +28,14 @@ function network_content(&$a, $update = 0) {
}
$_SESSION['return_url'] = $a->cmd;
+ $geotag = (($a->user['allow_location']) ? load_view_file('view/jot_geotag.tpl') : '');
+
$tpl = load_view_file('view/jot-header.tpl');
- $a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl()));
+ $a->page['htmlhead'] .= replace_macros($tpl, array(
+ '$baseurl' => $a->get_baseurl(),
+ '$geotag' => $geotag
+ ));
require_once('view/acl_selectors.php');
@@ -272,6 +277,14 @@ function network_content(&$a, $update = 0) {
$like = (($alike[$item['id']]) ? format_like($alike[$item['id']],$alike[$item['id'] . '-l'],'like',$item['id']) : '');
$dislike = (($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>';
+ }
// Build the HTML
@@ -286,7 +299,7 @@ function network_content(&$a, $update = 0) {
'$body' => bbcode($item['body']),
'$ago' => relative_date($item['created']),
'$lock' => $lock,
- '$location' => (($item['location']) ? '<a target="map" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : ''),
+ '$location' => $location,
'$indent' => (($item['parent'] != $item['item_id']) ? ' comment' : ''),
'$owner_url' => $owner_url,
'$owner_photo' => $owner_photo,
diff --git a/mod/profile.php b/mod/profile.php
index 8fa25cdbf..ed26237b6 100644
--- a/mod/profile.php
+++ b/mod/profile.php
@@ -118,6 +118,8 @@ function profile_content(&$a, $update = 0) {
}
}
+ $is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false);
+
if(! $update) {
if(x($_GET,'tab'))
$tab = notags(trim($_GET['tab']));
@@ -141,9 +143,17 @@ function profile_content(&$a, $update = 0) {
$celeb = ((($a->profile['page-flags'] == PAGE_SOAPBOX) || ($a->profile['page-flags'] == PAGE_COMMUNITY)) ? true : false);
if(can_write_wall($a,$a->profile['profile_uid'])) {
+
+
+ $geotag = (($is_owner && $a->profile['allow_location']) ? load_view_file('view/jot_geotag.tpl') : '');
+
$tpl = load_view_file('view/jot-header.tpl');
- $a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl()));
+ $a->page['htmlhead'] .= replace_macros($tpl, array(
+ '$baseurl' => $a->get_baseurl(),
+ '$geotag' => $geotag
+ ));
+
require_once('view/acl_selectors.php');
$tpl = load_view_file("view/jot.tpl");
@@ -153,12 +163,12 @@ function profile_content(&$a, $update = 0) {
$lockstate = 'unlock';
$o .= replace_macros($tpl,array(
'$baseurl' => $a->get_baseurl(),
- '$defloc' => (($_SESSION['uid'] == $a->profile['profile_uid']) ? $a->user['default-location'] : ''),
+ '$defloc' => (($is_owner) ? $a->user['default-location'] : ''),
'$return_path' => $a->cmd,
- '$visitor' => (($_SESSION['uid'] == $a->profile['profile_uid']) ? 'block' : 'none'),
+ '$visitor' => (($is_owner) ? 'block' : 'none'),
'$lockstate' => $lockstate,
'$bang' => '',
- '$acl' => (($_SESSION['uid'] == $a->profile['profile_uid']) ? populate_acl($a->user, $celeb) : ''),
+ '$acl' => (($is_owner) ? populate_acl($a->user, $celeb) : ''),
'$profile_uid' => $a->profile['profile_uid']
));
}
@@ -173,18 +183,15 @@ function profile_content(&$a, $update = 0) {
}
- // TODO alter registration and settings and profile to update contact table when names and photos change.
+ // Construct permissions
// default permissions - anonymous user
$sql_extra = " AND `allow_cid` = '' AND `allow_gid` = '' AND `deny_cid` = '' AND `deny_gid` = '' ";
-
-
-
// Profile owner - everything is visible
- if(local_user() && ($_SESSION['uid'] == $a->profile['profile_uid'])) {
+ if(is_owner) {
$sql_extra = '';
// Oh - while we're here... reset the Unseen messages
@@ -366,7 +373,14 @@ function profile_content(&$a, $update = 0) {
$like = (($alike[$item['id']]) ? format_like($alike[$item['id']],$alike[$item['id'] . '-l'],'like',$item['id']) : '');
$dislike = (($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>';
+ }
$o .= replace_macros($template,array(
'$id' => $item['item_id'],
@@ -378,7 +392,7 @@ function profile_content(&$a, $update = 0) {
'$body' => bbcode($item['body']),
'$ago' => relative_date($item['created']),
'$lock' => $lock,
- '$location' => (($item['location']) ? '<a target="map" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : ''),
+ '$location' => $location,
'$indent' => (($item['parent'] != $item['item_id']) ? ' comment' : ''),
'$drop' => $drop,
'$like' => $like,
diff --git a/mod/settings.php b/mod/settings.php
index b453fa825..863da44d5 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -54,6 +54,7 @@ function settings_post(&$a) {
$timezone = notags(trim($_POST['timezone']));
$defloc = notags(trim($_POST['defloc']));
+ $allow_location = (($_POST['allow_location'] == 1) ? 1: 0);
$publish = (($_POST['profile_in_directory'] == 1) ? 1: 0);
$net_publish = (($_POST['profile_in_netdirectory'] == 1) ? 1: 0);
$old_visibility = ((intval($_POST['visibility']) == 1) ? 1 : 0);
@@ -104,7 +105,7 @@ function settings_post(&$a) {
$str_group_deny = perms2str($_POST['group_deny']);
$str_contact_deny = perms2str($_POST['contact_deny']);
- $r = q("UPDATE `user` SET `username` = '%s', `email` = '%s', `timezone` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `notify-flags` = %d, `page-flags` = %d, `default-location` = '%s', `theme` = '%s' WHERE `uid` = %d LIMIT 1",
+ $r = q("UPDATE `user` SET `username` = '%s', `email` = '%s', `timezone` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `notify-flags` = %d, `page-flags` = %d, `default-location` = '%s', `allow_location` = %d, `theme` = '%s' WHERE `uid` = %d LIMIT 1",
dbesc($username),
dbesc($email),
dbesc($timezone),
@@ -115,6 +116,7 @@ function settings_post(&$a) {
intval($notify),
intval($page_flags),
dbesc($defloc),
+ intval($allow_location),
dbesc($theme),
intval(local_user())
);
@@ -208,6 +210,8 @@ function settings_content(&$a) {
else
$profile_in_net_dir = '';
+ $loc_checked = (($a->user['allow_location'] == 1) ? " checked=\"checked\" " : "");
+
$invisible = (((! $profile['publish']) && (! $profile['net-publish']))
? true : false);
@@ -259,6 +263,7 @@ function settings_content(&$a) {
'$timezone' => $timezone,
'$zoneselect' => select_timezone($timezone),
'$defloc' => $defloc,
+ '$loc_checked' => $loc_checked,
'$profile_in_dir' => $profile_in_dir,
'$profile_in_net_dir' => $profile_in_net_dir,
'$permissions' => t('Default Post Permissions'),