diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/dfrn_notify.php | 4 | ||||
-rw-r--r-- | mod/item.php | 14 | ||||
-rw-r--r-- | mod/network.php | 21 | ||||
-rw-r--r-- | mod/photos.php | 11 | ||||
-rw-r--r-- | mod/profile.php | 11 | ||||
-rw-r--r-- | mod/webfinger.php | 24 |
6 files changed, 74 insertions, 11 deletions
diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index 5d6f2c371..12e7ff7ce 100644 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -420,7 +420,7 @@ function dfrn_notify_post(&$a) { '$url' => $datarray['author-link'], // full url for the site '$from' => $from, // name of the person sending the message '$body' => $msg['htmlversion'], // html version of the message - '$display' => $a->get_baseurl() . '/display/' . $importer['nick'] . '/' . $posted_id, + '$display' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $posted_id, )); // load the template for private message notifications @@ -433,7 +433,7 @@ function dfrn_notify_post(&$a) { '$url' => $datarray['author-link'], // full url for the site '$from' => $from, // name of the person sending the message '$body' => $msg['textversion'], // text version of the message - '$display' => $a->get_baseurl() . '/display/' . $importer['nick'] . '/' . $posted_id, + '$display' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $posted_id, )); // use the EmailNotification library to send the message diff --git a/mod/item.php b/mod/item.php index 82f33eaeb..b07f26e32 100644 --- a/mod/item.php +++ b/mod/item.php @@ -204,13 +204,25 @@ function item_post(&$a) { continue; $image_uri = substr($image,strrpos($image,'/') + 1); $image_uri = substr($image_uri,0, strpos($image_uri,'-')); + $srch = '<' . intval($profile_uid) . '>'; + $r = q("SELECT `id` FROM `photo` WHERE `allow_cid` = '%s' AND `allow_gid` = '' AND `deny_cid` = '' AND `deny_gid` = '' + AND `resource-id` = '%s' AND `uid` = %d LIMIT 1", + dbesc($srch), + dbesc($image_uri), + intval($profile_uid) + ); + if(! count($r)) + continue; + + $r = q("UPDATE `photo` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s' - WHERE `resource-id` = '%s' AND `album` = '%s' ", + WHERE `resource-id` = '%s' AND `uid` = %d AND `album` = '%s' ", dbesc($str_contact_allow), dbesc($str_group_allow), dbesc($str_contact_deny), dbesc($str_group_deny), dbesc($image_uri), + intval($profile_uid), dbesc( t('Wall Photos')) ); diff --git a/mod/network.php b/mod/network.php index f38fb8c21..75775ba50 100644 --- a/mod/network.php +++ b/mod/network.php @@ -12,10 +12,18 @@ function network_init(&$a) { if(! x($a->page,'aside')) $a->page['aside'] = ''; + $search = ((x($_GET,'search')) ? escape_tags($_GET['search']) : ''); + $srchurl = '/network' . ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : ''); + + + $a->page['aside'] .= search($search,'netsearch-box',$srchurl); + $a->page['aside'] .= '<div id="network-new-link">'; - if(($a->argc > 1 && $a->argv[1] === 'new') || ($a->argc > 2 && $a->argv[2] === 'new')) - $a->page['aside'] .= '<a href="' . $a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?cid=' . $_GET['cid'] : '') . '">' . t('Normal View') . '</a>'; + + + if(($a->argc > 1 && $a->argv[1] === 'new') || ($a->argc > 2 && $a->argv[2] === 'new') || x($_GET,'search')) + $a->page['aside'] .= '<a href="' . $a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : '') . '">' . t('Normal View') . '</a>'; else $a->page['aside'] .= '<a href="' . $a->get_baseurl() . '/' . $a->cmd . '/new' . ((x($_GET,'cid')) ? '/?cid=' . $_GET['cid'] : '') . '">' . t('New Item View') . '</a>'; @@ -55,6 +63,8 @@ function network_content(&$a, $update = 0) { } } + if(x($_GET,'search')) + $nouveau = true; if($cid) $def_acl = array('allow_cid' => '<' . intval($cid) . '>'); @@ -96,7 +106,8 @@ function network_content(&$a, $update = 0) { $o .= '<div id="live-network"></div>' . "\r\n"; $o .= "<script> var profile_uid = " . $_SESSION['uid'] . "; var netargs = '" . substr($a->cmd,8) - . ((x($_GET,'cid')) ? '/?cid=' . $_GET['cid'] : '') + . ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : '') + . ((x($_GET,'search')) ? '?search=' . $_GET['search'] : '') . "'; var profile_page = " . $a->pager['page'] . "; </script>\r\n"; } @@ -169,6 +180,10 @@ function network_content(&$a, $update = 0) { $sql_extra2 = (($nouveau) ? '' : " AND `item`.`parent` = `item`.`id` "); + if(x($_GET,'search')) + $sql_extra .= " AND `item`.`body` REGEXP '" . dbesc(escape_tags($_GET['search'])) . "' "; + + $r = q("SELECT COUNT(*) AS `total` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 diff --git a/mod/photos.php b/mod/photos.php index 89fef2ee8..71d00ed25 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -722,6 +722,8 @@ function photos_content(&$a) { $owner_uid = $a->data['user']['uid']; + + $community_page = (($a->data['user']['page-flags'] == PAGE_COMMUNITY) ? true : false); if((local_user()) && (local_user() == $owner_uid)) @@ -763,6 +765,15 @@ function photos_content(&$a) { } } + $r = q("SELECT `hidewall` FROM `profile` WHERE `uid` = %d AND `is-default` = 1 LIMIT 1", + intval($owner_uid) + ); + + if(count($r) && $r[0]['hidewall'] && (local_user() != $owner_uid) && (! $remote_contact)) { + notice( t('Access to this item is restricted.') . EOL); + return; + } + // default permissions - anonymous user $sql_extra = " AND `allow_cid` = '' AND `allow_gid` = '' AND `deny_cid` = '' AND `deny_gid` = '' "; diff --git a/mod/profile.php b/mod/profile.php index 8d46d6c5b..b80feab34 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -55,11 +55,6 @@ function profile_content(&$a, $update = 0) { return login(); } - if($a->profile['hidewall'] && (! local_user()) && (! remote_user())) { - notice( t('Access to this profile has been restricted.') . EOL); - return; - } - require_once("include/bbcode.php"); require_once('include/security.php'); require_once('include/conversation.php'); @@ -102,6 +97,12 @@ function profile_content(&$a, $update = 0) { } $is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false); + + if($a->profile['hidewall'] && (! $is_owner) && (! $remote_contact)) { + notice( t('Access to this profile has been restricted.') . EOL); + return; + } + if(! $update) { if(x($_GET,'tab')) diff --git a/mod/webfinger.php b/mod/webfinger.php new file mode 100644 index 000000000..dd6d72a13 --- /dev/null +++ b/mod/webfinger.php @@ -0,0 +1,24 @@ +<?php + + + +function webfinger_content(&$a) { + + $o .= '<h3>Webfinger Diagnostic</h3>'; + + $o .= '<form action="webfinger" method="get">'; + $o .= 'Lookup address: <input type="text" style="width: 250px;" name="addr" value="' . $_GET['addr'] .'" />'; + $o .= '<input type="submit" name="submit" value="Submit" /></form>'; + + $o .= '<br /><br />'; + + if(x($_GET,'addr')) { + $addr = $_GET['addr']; + if(strpos($addr,'@' !== false)) + $res = webfinger($addr); + else + $res = lrdd($addr); + $o .= str_replace("\n",'<br />',print_r($res,true)); + } + return $o; +}
\ No newline at end of file |