aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/community.php4
-rw-r--r--mod/dfrn_poll.php8
-rw-r--r--mod/directory.php4
-rw-r--r--mod/display.php14
-rw-r--r--mod/home.php2
-rw-r--r--mod/item.php17
-rw-r--r--mod/login.php5
-rw-r--r--mod/parse_url.php27
-rw-r--r--mod/photos.php115
-rw-r--r--mod/profile.php14
-rw-r--r--mod/register.php2
-rw-r--r--mod/search.php5
-rw-r--r--mod/settings.php28
-rw-r--r--mod/tagger.php14
-rw-r--r--mod/wall_attach.php27
-rw-r--r--mod/wall_upload.php27
-rw-r--r--mod/zfinger.php6
17 files changed, 231 insertions, 88 deletions
diff --git a/mod/community.php b/mod/community.php
index 354f68528..4f6c3d3c9 100644
--- a/mod/community.php
+++ b/mod/community.php
@@ -1,8 +1,10 @@
<?php
function community_init(&$a) {
- if(! local_user())
+ if(! local_user()) {
unset($_SESSION['theme']);
+ unset($_SESSION['mobile-theme']);
+ }
}
diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php
index c26d893e1..89b72859a 100644
--- a/mod/dfrn_poll.php
+++ b/mod/dfrn_poll.php
@@ -87,6 +87,11 @@ function dfrn_poll_init(&$a) {
if((int) $xml->status == 1) {
$_SESSION['authenticated'] = 1;
+ if(! x($_SESSION,'remote'))
+ $_SESSION['remote'] = array();
+
+ $_SESSION['remote'][] = array('cid' => $r[0]['id'],'uid' => $r[0]['uid'],'url' => $r[0]['url']);
+
$_SESSION['visitor_id'] = $r[0]['id'];
$_SESSION['visitor_home'] = $r[0]['url'];
$_SESSION['visitor_handle'] = $r[0]['addr'];
@@ -516,6 +521,9 @@ function dfrn_poll_content(&$a) {
if(((int) $xml->status == 0) && ($xml->challenge == $hash) && ($xml->sec == $sec)) {
$_SESSION['authenticated'] = 1;
+ if(! x($_SESSION,'remote'))
+ $_SESSION['remote'] = array();
+ $_SESSION['remote'][] = array('cid' => $r[0]['id'],'uid' => $r[0]['uid'],'url' => $r[0]['url']);
$_SESSION['visitor_id'] = $r[0]['id'];
$_SESSION['visitor_home'] = $r[0]['url'];
$_SESSION['visitor_visiting'] = $r[0]['uid'];
diff --git a/mod/directory.php b/mod/directory.php
index 4e7626ed5..6054ad8fd 100644
--- a/mod/directory.php
+++ b/mod/directory.php
@@ -9,8 +9,10 @@ function directory_init(&$a) {
$a->page['aside'] .= findpeople_widget();
}
- else
+ else {
unset($_SESSION['theme']);
+ unset($_SESSION['mobile-theme']);
+ }
}
diff --git a/mod/display.php b/mod/display.php
index 7e3514cd3..8193ce377 100644
--- a/mod/display.php
+++ b/mod/display.php
@@ -35,8 +35,18 @@ function display_content(&$a) {
$contact = null;
$remote_contact = false;
- if(remote_user()) {
- $contact_id = $_SESSION['visitor_id'];
+ $contact_id = 0;
+
+ if(is_array($_SESSION['remote'])) {
+ foreach($_SESSION['remote'] as $v) {
+ if($v['uid'] == $a->profile['uid']) {
+ $contact_id = $v['cid'];
+ break;
+ }
+ }
+ }
+
+ if($contact_id) {
$groups = init_groups_visitor($contact_id);
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($contact_id),
diff --git a/mod/home.php b/mod/home.php
index 42669988e..b96e3f29f 100644
--- a/mod/home.php
+++ b/mod/home.php
@@ -19,6 +19,8 @@ function home_content(&$a) {
if(x($_SESSION,'theme'))
unset($_SESSION['theme']);
+ if(x($_SESSION,'mobile-theme'))
+ unset($_SESSION['mobile-theme']);
$o .= '<h1>' . ((x($a->config,'sitename')) ? sprintf( t("Welcome to %s") ,$a->config['sitename']) : "" ) . '</h1>';
if(file_exists('home.html'))
diff --git a/mod/item.php b/mod/item.php
index c7de5f304..12765cba3 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -280,6 +280,7 @@ function item_post(&$a) {
$author = null;
$self = false;
+ $contact_id = 0;
if((local_user()) && (local_user() == $profile_uid)) {
$self = true;
@@ -288,9 +289,19 @@ function item_post(&$a) {
);
}
elseif(remote_user()) {
- $r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
- intval(remote_user())
- );
+ if(is_array($_SESSION['remote'])) {
+ foreach($_SESSION['remote'] as $v) {
+ if($v['uid'] == $profile_uid) {
+ $contact_id = $v['cid'];
+ break;
+ }
+ }
+ }
+ if($contact_id) {
+ $r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
+ intval($contact_id)
+ );
+ }
}
if(count($r)) {
diff --git a/mod/login.php b/mod/login.php
index 10b4d3001..d09fc1868 100644
--- a/mod/login.php
+++ b/mod/login.php
@@ -3,8 +3,11 @@
function login_content(&$a) {
if(x($_SESSION,'theme'))
unset($_SESSION['theme']);
+ if(x($_SESSION,'mobile-theme'))
+ unset($_SESSION['mobile-theme']);
+
if(local_user())
goaway(z_root());
return login(($a->config['register_policy'] == REGISTER_CLOSED) ? false : true);
-} \ No newline at end of file
+}
diff --git a/mod/parse_url.php b/mod/parse_url.php
index ea05055f0..083a39b55 100644
--- a/mod/parse_url.php
+++ b/mod/parse_url.php
@@ -36,6 +36,9 @@ function completeurl($url, $scheme) {
if ($schemearr["port"] != "")
$complete .= ":".$schemearr["port"];
+ if(strpos($urlarr['path'],'/') !== 0)
+ $complete .= '/';
+
$complete .= $urlarr["path"];
if ($urlarr["query"] != "")
@@ -149,17 +152,17 @@ function parseurl_getsiteinfo($url) {
}
if ($siteinfo["image"] == "") {
- $list = $xpath->query("//img[@src]");
- foreach ($list as $node) {
- $attr = array();
- if ($node->attributes->length)
- foreach ($node->attributes as $attribute)
- $attr[$attribute->name] = $attribute->value;
+ $list = $xpath->query("//img[@src]");
+ foreach ($list as $node) {
+ $attr = array();
+ if ($node->attributes->length)
+ foreach ($node->attributes as $attribute)
+ $attr[$attribute->name] = $attribute->value;
$src = completeurl($attr["src"], $url);
- $photodata = getimagesize($src);
+ $photodata = @getimagesize($src);
- if (($photodata[0] > 150) and ($photodata[1] > 150)) {
+ if (($photodata) && ($photodata[0] > 150) and ($photodata[1] > 150)) {
if ($photodata[0] > 300) {
$photodata[1] = round($photodata[1] * (300 / $photodata[0]));
$photodata[0] = 300;
@@ -173,15 +176,15 @@ function parseurl_getsiteinfo($url) {
"height"=>$photodata[1]);
}
- }
- } else {
+ }
+ } else {
$src = completeurl($siteinfo["image"], $url);
unset($siteinfo["image"]);
- $photodata = getimagesize($src);
+ $photodata = @getimagesize($src);
- if (($photodata[0] > 10) and ($photodata[1] > 10))
+ if (($photodata) && ($photodata[0] > 10) and ($photodata[1] > 10))
$siteinfo["images"][] = array("src"=>$src,
"width"=>$photodata[0],
"height"=>$photodata[1]);
diff --git a/mod/photos.php b/mod/photos.php
index cfb78442c..94fdc4152 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -120,13 +120,25 @@ function photos_post(&$a) {
$can_post = true;
else {
if($community_page && remote_user()) {
- $r = q("SELECT `uid` FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 AND `id` = %d AND `uid` = %d LIMIT 1",
- intval(remote_user()),
- intval($page_owner_uid)
- );
- if(count($r)) {
- $can_post = true;
- $visitor = remote_user();
+ $cid = 0;
+ if(is_array($_SESSION['remote'])) {
+ foreach($_SESSION['remote'] as $v) {
+ if($v['uid'] == $page_owner_uid) {
+ $cid = $v['cid'];
+ break;
+ }
+ }
+ }
+ if($cid) {
+
+ $r = q("SELECT `uid` FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 AND `id` = %d AND `uid` = %d LIMIT 1",
+ intval($cid),
+ intval($page_owner_uid)
+ );
+ if(count($r)) {
+ $can_post = true;
+ $visitor = $cid;
+ }
}
}
}
@@ -887,6 +899,7 @@ function photos_content(&$a) {
$visitor = 0;
$contact = null;
$remote_contact = false;
+ $contact_id = 0;
$owner_uid = $a->data['user']['uid'];
@@ -896,15 +909,26 @@ function photos_content(&$a) {
$can_post = true;
else {
if($community_page && remote_user()) {
- $r = q("SELECT `uid` FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 AND `id` = %d AND `uid` = %d LIMIT 1",
- intval(remote_user()),
- intval($owner_uid)
- );
- if(count($r)) {
- $can_post = true;
- $contact = $r[0];
- $remote_contact = true;
- $visitor = remote_user();
+ if(is_array($_SESSION['remote'])) {
+ foreach($_SESSION['remote'] as $v) {
+ if($v['uid'] == $owner_uid) {
+ $contact_id = $v['cid'];
+ break;
+ }
+ }
+ }
+ if($contact_id) {
+
+ $r = q("SELECT `uid` FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 AND `id` = %d AND `uid` = %d LIMIT 1",
+ intval($contact_id),
+ intval($owner_uid)
+ );
+ if(count($r)) {
+ $can_post = true;
+ $contact = $r[0];
+ $remote_contact = true;
+ $visitor = $cid;
+ }
}
}
}
@@ -912,15 +936,25 @@ function photos_content(&$a) {
// perhaps they're visiting - but not a community page, so they wouldn't have write access
if(remote_user() && (! $visitor)) {
- $contact_id = $_SESSION['visitor_id'];
- $groups = init_groups_visitor($contact_id);
- $r = q("SELECT * FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 AND `id` = %d AND `uid` = %d LIMIT 1",
- intval(remote_user()),
- intval($owner_uid)
- );
- if(count($r)) {
- $contact = $r[0];
- $remote_contact = true;
+ $contact_id = 0;
+ if(is_array($_SESSION['remote'])) {
+ foreach($_SESSION['remote'] as $v) {
+ if($v['uid'] == $owner_uid) {
+ $contact_id = $v['cid'];
+ break;
+ }
+ }
+ }
+ if($contact_id) {
+ $groups = init_groups_visitor($contact_id);
+ $r = q("SELECT * FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 AND `id` = %d AND `uid` = %d LIMIT 1",
+ intval($contact_id),
+ intval($owner_uid)
+ );
+ if(count($r)) {
+ $contact = $r[0];
+ $remote_contact = true;
+ }
}
}
@@ -1038,8 +1072,13 @@ function photos_content(&$a) {
$a->set_pager_itemspage(20);
}
+ if($_GET['order'] === 'posted')
+ $order = 'ASC';
+ else
+ $order = 'DESC';
+
$r = q("SELECT `resource-id`, `id`, `filename`, type, max(`scale`) AS `scale`, `desc` FROM `photo` WHERE `uid` = %d AND `album` = '%s'
- AND `scale` <= 4 $sql_extra GROUP BY `resource-id` ORDER BY `created` DESC LIMIT %d , %d",
+ AND `scale` <= 4 $sql_extra GROUP BY `resource-id` ORDER BY `created` $order LIMIT %d , %d",
intval($owner_uid),
dbesc($album),
intval($a->pager['start']),
@@ -1073,10 +1112,17 @@ function photos_content(&$a) {
}
}
+ if($_GET['order'] === 'posted')
+ $o .= '<div class="photos-upload-link" ><a href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '" >' . t('Show Newest First') . '</a></div>';
+ else
+ $o .= '<div class="photos-upload-link" ><a href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '?f=&order=posted" >' . t('Show Oldest First') . '</a></div>';
+
+
if($can_post) {
$o .= '<div class="photos-upload-link" ><a href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/upload/' . bin2hex($album) . '" >' . t('Upload New Photos') . '</a></div>';
}
+
$tpl = get_markup_template('photo_album.tpl');
if(count($r))
$twist = 'rotright';
@@ -1091,7 +1137,8 @@ function photos_content(&$a) {
$o .= replace_macros($tpl,array(
'$id' => $rr['id'],
'$twist' => ' ' . $twist . rand(2,4),
- '$photolink' => $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $rr['resource-id'],
+ '$photolink' => $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $rr['resource-id']
+ . (($_GET['order'] === 'posted') ? '?f=&order=posted' : ''),
'$phototitle' => t('View Photo'),
'$imgsrc' => $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['scale'] . '.' .$ext,
'$imgalt' => template_escape($rr['filename']),
@@ -1136,8 +1183,14 @@ function photos_content(&$a) {
$prevlink = '';
$nextlink = '';
+ if($_GET['order'] === 'posted')
+ $order = 'ASC';
+ else
+ $order = 'DESC';
+
+
$prvnxt = q("SELECT `resource-id` FROM `photo` WHERE `album` = '%s' AND `uid` = %d AND `scale` = 0
- $sql_extra ORDER BY `created` DESC ",
+ $sql_extra ORDER BY `created` $order ",
dbesc($ph[0]['album']),
intval($owner_uid)
);
@@ -1155,8 +1208,8 @@ function photos_content(&$a) {
}
}
$edit_suffix = ((($cmd === 'edit') && ($can_post)) ? '/edit' : '');
- $prevlink = $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $prvnxt[$prv]['resource-id'] . $edit_suffix;
- $nextlink = $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $prvnxt[$nxt]['resource-id'] . $edit_suffix;
+ $prevlink = $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $prvnxt[$prv]['resource-id'] . $edit_suffix . (($_GET['order'] === 'posted') ? '?f=&order=posted' : '');
+ $nextlink = $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $prvnxt[$nxt]['resource-id'] . $edit_suffix . (($_GET['order'] === 'posted') ? '?f=&order=posted' : '');
}
@@ -1433,7 +1486,7 @@ function photos_content(&$a) {
$drop = '';
- if(($item['contact-id'] == remote_user()) || ($item['uid'] == local_user()))
+ if(($item['contact-id'] == $contact_id) || ($item['uid'] == local_user()))
$drop = replace_macros(get_markup_template('photo_drop.tpl'), array('$id' => $item['id'], '$delete' => t('Delete')));
diff --git a/mod/profile.php b/mod/profile.php
index a562b37cc..ee457c8b6 100644
--- a/mod/profile.php
+++ b/mod/profile.php
@@ -82,8 +82,18 @@ function profile_content(&$a, $update = 0) {
$contact = null;
$remote_contact = false;
- if(remote_user()) {
- $contact_id = $_SESSION['visitor_id'];
+ $contact_id = 0;
+
+ if(is_array($_SESSION['remote'])) {
+ foreach($_SESSION['remote'] as $v) {
+ if($v['uid'] == $a->profile['profile_uid']) {
+ $contact_id = $v['cid'];
+ break;
+ }
+ }
+ }
+
+ if($contact_id) {
$groups = init_groups_visitor($contact_id);
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($contact_id),
diff --git a/mod/register.php b/mod/register.php
index d48a7086d..6fbdde3ab 100644
--- a/mod/register.php
+++ b/mod/register.php
@@ -193,6 +193,8 @@ function register_content(&$a) {
if(x($_SESSION,'theme'))
unset($_SESSION['theme']);
+ if(x($_SESSION,'mobile-theme'))
+ unset($_SESSION['mobile-theme']);
$username = ((x($_POST,'username')) ? $_POST['username'] : ((x($_GET,'username')) ? $_GET['username'] : ''));
diff --git a/mod/search.php b/mod/search.php
index 5ba35d2b3..048ed80e1 100644
--- a/mod/search.php
+++ b/mod/search.php
@@ -54,8 +54,10 @@ function search_init(&$a) {
$a->page['aside'] .= search_saved_searches();
}
- else
+ else {
unset($_SESSION['theme']);
+ unset($_SESSION['mobile-theme']);
+ }
@@ -81,6 +83,7 @@ function search_content(&$a) {
require_once("include/bbcode.php");
require_once('include/security.php');
require_once('include/conversation.php');
+ require_once('include/items.php');
$o = '<div id="live-search"></div>' . "\r\n";
diff --git a/mod/settings.php b/mod/settings.php
index ca70c53cf..922a90467 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -156,17 +156,22 @@ function settings_post(&$a) {
check_form_security_token_redirectOnErr('/settings/display', 'settings_display');
$theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : $a->user['theme']);
+ $mobile_theme = ((x($_POST,'mobile_theme')) ? notags(trim($_POST['mobile_theme'])) : '');
$nosmile = ((x($_POST,'nosmile')) ? intval($_POST['nosmile']) : 0);
$browser_update = ((x($_POST,'browser_update')) ? intval($_POST['browser_update']) : 0);
$browser_update = $browser_update * 1000;
if($browser_update < 10000)
- $browser_update = 40000;
+ $browser_update = 10000;
$itemspage_network = ((x($_POST,'itemspage_network')) ? intval($_POST['itemspage_network']) : 40);
if($itemspage_network > 100)
- $itemspage_network = 40;
+ $itemspage_network = 100;
+ if($mobile_theme !== '') {
+ set_pconfig(local_user(),'system','mobile_theme',$mobile_theme);
+ }
+
set_pconfig(local_user(),'system','update_interval', $browser_update);
set_pconfig(local_user(),'system','itemspage_network', $itemspage_network);
set_pconfig(local_user(),'system','no_smilies',$nosmile);
@@ -411,10 +416,11 @@ function settings_post(&$a) {
}
- $_SESSION['theme'] = $theme;
+ //$_SESSION['theme'] = $theme;
if($email_changed && $a->config['register_policy'] == REGISTER_VERIFY) {
// FIXME - set to un-verified, blocked and redirect to logout
+ // Why? Are we verifying people or email addresses?
}
@@ -567,6 +573,9 @@ function settings_content(&$a) {
$default_theme = get_config('system','theme');
if(! $default_theme)
$default_theme = 'default';
+ $default_mobile_theme = get_config('system','mobile-theme');
+ if(! $mobile_default_theme)
+ $mobile_default_theme = 'none';
$allowed_themes_str = get_config('system','allowed_themes');
$allowed_themes_raw = explode(',',$allowed_themes_str);
@@ -578,19 +587,27 @@ function settings_content(&$a) {
$themes = array();
+ $mobile_themes = array("---" => t('No special theme for mobile devices'));
$files = glob('view/theme/*');
if($allowed_themes) {
foreach($allowed_themes as $th) {
$f = $th;
$is_experimental = file_exists('view/theme/' . $th . '/experimental');
$unsupported = file_exists('view/theme/' . $th . '/unsupported');
+ $is_mobile = file_exists('view/theme/' . $th . '/mobile');
if (!$is_experimental or ($is_experimental && (get_config('experimentals','exp_themes')==1 or get_config('experimentals','exp_themes')===false))){
$theme_name = (($is_experimental) ? sprintf("%s - \x28Experimental\x29", $f) : $f);
- $themes[$f]=$theme_name;
+ if($is_mobile) {
+ $mobile_themes[$f]=$theme_name;
+ }
+ else {
+ $themes[$f]=$theme_name;
+ }
}
}
}
$theme_selected = (!x($_SESSION,'theme')? $default_theme : $_SESSION['theme']);
+ $mobile_theme_selected = (!x($_SESSION,'mobile-theme')? $default_mobile_theme : $_SESSION['mobile-theme']);
$browser_update = intval(get_pconfig(local_user(), 'system','update_interval'));
$browser_update = (($browser_update == 0) ? 40 : $browser_update / 1000); // default if not set: 40 seconds
@@ -616,7 +633,8 @@ function settings_content(&$a) {
'$baseurl' => $a->get_baseurl(true),
'$uid' => local_user(),
- '$theme' => array('theme', t('Display Theme:'), $theme_selected, '', $themes),
+ '$theme' => array('theme', t('Display Theme:'), $theme_selected, '', $themes, 'preview'),
+ '$mobile_theme' => array('mobile_theme', t('Mobile Theme:'), $mobile_theme_selected, '', $mobile_themes, ''),
'$ajaxint' => array('browser_update', t("Update browser every xx seconds"), $browser_update, t('Minimum of 10 seconds, no maximum')),
'$itemspage_network' => array('itemspage_network', t("Number of items to display on the network page:"), $itemspage_network, t('Maximum of 100 items')),
'$nosmile' => array('nosmile', t("Don't show emoticons"), $nosmile, ''),
diff --git a/mod/tagger.php b/mod/tagger.php
index 0a477ddcd..653848765 100644
--- a/mod/tagger.php
+++ b/mod/tagger.php
@@ -47,17 +47,9 @@ function tagger_content(&$a) {
if(local_user() != $owner_uid)
return;
- if(remote_user()) {
- $r = q("select * from contact where id = %d AND `uid` = %d limit 1",
- intval(remote_user()),
- intval($item['uid'])
- );
- }
- else {
- $r = q("select * from contact where self = 1 and uid = %d limit 1",
- intval(local_user())
- );
- }
+ $r = q("select * from contact where self = 1 and uid = %d limit 1",
+ intval(local_user())
+ );
if(count($r))
$contact = $r[0];
else {
diff --git a/mod/wall_attach.php b/mod/wall_attach.php
index f179b3ca5..c23efc786 100644
--- a/mod/wall_attach.php
+++ b/mod/wall_attach.php
@@ -29,17 +29,28 @@ function wall_attach_post(&$a) {
$can_post = true;
else {
if($community_page && remote_user()) {
- $r = q("SELECT `uid` FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 AND `id` = %d AND `uid` = %d LIMIT 1",
- intval(remote_user()),
- intval($page_owner_uid)
- );
- if(count($r)) {
- $can_post = true;
- $visitor = remote_user();
+ $cid = 0;
+ if(is_array($_SESSION['remote'])) {
+ foreach($_SESSION['remote'] as $v) {
+ if($v['uid'] == $page_owner_uid) {
+ $cid = $v['cid'];
+ break;
+ }
+ }
+ }
+ if($cid) {
+
+ $r = q("SELECT `uid` FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 AND `id` = %d AND `uid` = %d LIMIT 1",
+ intval($cid),
+ intval($page_owner_uid)
+ );
+ if(count($r)) {
+ $can_post = true;
+ $visitor = $cid;
+ }
}
}
}
-
if(! $can_post) {
notice( t('Permission denied.') . EOL );
killme();
diff --git a/mod/wall_upload.php b/mod/wall_upload.php
index 07d97d17a..ee1bf3c14 100644
--- a/mod/wall_upload.php
+++ b/mod/wall_upload.php
@@ -37,14 +37,25 @@ function wall_upload_post(&$a) {
$can_post = true;
else {
if($community_page && remote_user()) {
- $r = q("SELECT `uid` FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 AND `id` = %d AND `uid` = %d LIMIT 1",
- intval(remote_user()),
- intval($page_owner_uid)
- );
- if(count($r)) {
- $can_post = true;
- $visitor = remote_user();
- $default_cid = $visitor;
+ $cid = 0;
+ if(is_array($_SESSION['remote'])) {
+ foreach($_SESSION['remote'] as $v) {
+ if($v['uid'] == $page_owner_uid) {
+ $cid = $v['cid'];
+ break;
+ }
+ }
+ }
+ if($cid) {
+
+ $r = q("SELECT `uid` FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 AND `id` = %d AND `uid` = %d LIMIT 1",
+ intval($cid),
+ intval($page_owner_uid)
+ );
+ if(count($r)) {
+ $can_post = true;
+ $visitor = $cid;
+ }
}
}
}
diff --git a/mod/zfinger.php b/mod/zfinger.php
index 550d613b5..66dcb16f6 100644
--- a/mod/zfinger.php
+++ b/mod/zfinger.php
@@ -3,6 +3,7 @@
function zfinger_init(&$a) {
require_once('include/zot.php');
+ require_once('include/crypto.php');
$ret = array('success' => false);
@@ -49,7 +50,7 @@ function zfinger_init(&$a) {
// Communication details
$ret['guid'] = $e['entity_global_id'];
- $ret['guid_sig'] = base64url_encode($e['entity_global_id'],$e['entity_prvkey']);
+ $ret['guid_sig'] = base64url_encode(rsa_sign($e['entity_global_id'],$e['entity_prvkey']));
$ret['key'] = $e['entity_pubkey'];
$ret['name'] = $e['entity_name'];
$ret['address'] = $e['entity_address'];
@@ -66,7 +67,8 @@ function zfinger_init(&$a) {
$ret['hubs'][] = array(
'primary' => (($hub['hubloc_flags'] & HUBLOC_FLAGS_PRIMARY) ? true : false),
'url' => $hub['hubloc_url'],
- 'url_sig' => base64url_encode($hub['hubloc_url'],$e['entity_prvkey']),
+ /// hmmm we probably shouldn't sign somebody else's hub. FIXME
+ 'url_sig' => base64url_encode(rsa_sign($hub['hubloc_url'],$e['entity_prvkey'])),
'callback' => $hub['hubloc_callback'],
'sitekey' => $hub['hubloc_sitekey']
);