aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authormarijus <mario@localhost.localdomain>2014-02-04 16:19:35 +0100
committermarijus <mario@localhost.localdomain>2014-02-04 16:19:35 +0100
commit4253581733d4c6c7f0dce5c3ea7566c6af4af936 (patch)
tree1eadff45b06adcac3f93432beea63b7ccd7391ff /mod
parent2a9baa1f325b62541ad7a7b68e91455b104677bd (diff)
parent74298c44ae445125bfc2b13d20da91b9d349ce43 (diff)
downloadvolse-hubzilla-4253581733d4c6c7f0dce5c3ea7566c6af4af936.tar.gz
volse-hubzilla-4253581733d4c6c7f0dce5c3ea7566c6af4af936.tar.bz2
volse-hubzilla-4253581733d4c6c7f0dce5c3ea7566c6af4af936.zip
Merge branch 'master' of https://github.com/friendica/red
Diffstat (limited to 'mod')
-rw-r--r--mod/connections.php2
-rw-r--r--mod/connedit.php5
-rw-r--r--mod/item.php25
-rw-r--r--mod/page.php4
-rw-r--r--mod/photos.php26
5 files changed, 48 insertions, 14 deletions
diff --git a/mod/connections.php b/mod/connections.php
index 2119c69c7..3da9cec74 100644
--- a/mod/connections.php
+++ b/mod/connections.php
@@ -74,6 +74,7 @@ function connections_post(&$a) {
$abook_flags = $orig_record[0]['abook_flags'];
$new_friend = false;
+
if(($_REQUEST['pending']) && ($abook_flags & ABOOK_FLAG_PENDING)) {
$abook_flags = ( $abook_flags ^ ABOOK_FLAG_PENDING );
$new_friend = true;
@@ -88,6 +89,7 @@ function connections_post(&$a) {
intval($contact_id),
intval(local_user())
);
+
if($r)
info( t('Connection updated.') . EOL);
else
diff --git a/mod/connedit.php b/mod/connedit.php
index b7101fcab..3f507cc3b 100644
--- a/mod/connedit.php
+++ b/mod/connedit.php
@@ -32,7 +32,7 @@ function connedit_init(&$a) {
}
function connedit_post(&$a) {
-
+
if(! local_user())
return;
@@ -86,6 +86,8 @@ function connedit_post(&$a) {
$abook_flags = $orig_record[0]['abook_flags'];
$new_friend = false;
+
+
if(($_REQUEST['pending']) && ($abook_flags & ABOOK_FLAG_PENDING)) {
$abook_flags = ( $abook_flags ^ ABOOK_FLAG_PENDING );
$new_friend = true;
@@ -100,6 +102,7 @@ function connedit_post(&$a) {
intval($contact_id),
intval(local_user())
);
+
if($r)
info( t('Connection updated.') . EOL);
else
diff --git a/mod/item.php b/mod/item.php
index 6d421009b..68bb75897 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -887,13 +887,24 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag) {
$replaced = false;
$r = null;
- $termtype = ((strpos($tag,'#') === 0) ? TERM_HASHTAG : TERM_UNKNOWN);
- $termtype = ((strpos($tag,'@') === 0) ? TERM_MENTION : $termtype);
+
+ $termtype = ((strpos($tag,'#') === 0) ? TERM_HASHTAG : TERM_UNKNOWN);
+ $termtype = ((strpos($tag,'@') === 0) ? TERM_MENTION : $termtype);
+ $termtype = ((strpos($tag,'#^[') === 0) ? TERM_BOOKMARK : $termtype);
+
//is it a hash tag?
if(strpos($tag,'#') === 0) {
- // if the tag is replaced...
- if(strpos($tag,'[zrl=')) {
+ if(strpos($tag,'#^[') === 0) {
+ if(preg_match('/#\^\[(url|zrl)=(.*?)\](.*?)\[\/(url|zrl)\]/',$tag,$match)) {
+ $basetag = $match[3];
+ $url = $match[2];
+ $replaced = true;
+
+ }
+ }
+ // if the tag is already replaced...
+ elseif(strpos($tag,'[zrl=')) {
//...do nothing
return $replaced;
}
@@ -904,7 +915,7 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag) {
$body = str_replace($tag,$newtag,$body);
$replaced = true;
}
- else {
+ if(! $replaced) {
//base tag has the tags name only
$basetag = str_replace('_',' ',substr($tag,1));
//create text for link
@@ -961,7 +972,7 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag) {
$newname = str_replace('_',' ',$name);
//select someone from this user's contacts by name
- $r = q("SELECT * FROM abook left join xchan on abook_xchan - xchan_hash
+ $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash
WHERE xchan_name = '%s' AND abook_channel = %d LIMIT 1",
dbesc($newname),
intval($profile_uid)
@@ -969,7 +980,7 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag) {
if(! $r) {
//select someone by attag or nick and the name passed in
- $r = q("SELECT * FROM abook left join xchan on abook_xchan - xchan_hash
+ $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash
WHERE xchan_addr like ('%s') AND abook_channel = %d LIMIT 1",
dbesc($newname . '@%'),
intval($profile_uid)
diff --git a/mod/page.php b/mod/page.php
index 56592116f..df17dbf52 100644
--- a/mod/page.php
+++ b/mod/page.php
@@ -38,7 +38,7 @@ function page_content(&$a) {
$channel_address = argv(1);
$page_id = argv(2);
-dbg(1);
+
$u = q("select channel_id from channel where channel_address = '%s' limit 1",
dbesc($channel_address)
);
@@ -63,7 +63,7 @@ dbg(1);
dbesc($page_id),
intval(ITEM_WEBPAGE)
);
-dbg(0);
+
if(! $r) {
// Check again with no permissions clause to see if it is a permissions issue
diff --git a/mod/photos.php b/mod/photos.php
index c299fe778..6798cb002 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -763,7 +763,7 @@ function photos_content(&$a) {
/* Check again - this time without specifying permissions */
- $ph = q("SELECT `id` FROM `photo` WHERE `uid` = %d AND `resource_id` = '%s'
+ $ph = q("SELECT id FROM photo WHERE uid = %d AND resource_id = '%s'
and ( photo_flags = %d or photo_flags = %d )
LIMIT 1",
intval($owner_uid),
@@ -875,6 +875,9 @@ function photos_content(&$a) {
if($linked_items) {
+ xchan_query($linked_items);
+ $linked_items = fetch_post_tags($linked_items,true);
+
$link_item = $linked_items[0];
$r = q("select * from item where parent_mid = '%s'
@@ -890,6 +893,21 @@ function photos_content(&$a) {
$r = conv_sort($r,'commented');
}
+
+
+ $tags = array();
+ if($link_item['term']) {
+ $cnt = 0;
+ foreach($link_item['term'] as $t)
+ $tags[$cnt] = array(0 => format_term_for_display($t));
+ if($can_post && ($ph[0]['uid'] == $owner_uid)) {
+ $tags[$cnt][1] = 'tagrm?f=&item=' . $link_item['id'];
+ $tags[$cnt][2] = t('Remove');
+ }
+ $cnt ++;
+ }
+
+
if((local_user()) && (local_user() == $link_item['uid'])) {
q("UPDATE `item` SET item_flags = (item_flags ^ %d) WHERE parent = %d and uid = %d and (item_flags & %d)",
intval(ITEM_UNSEEN),
@@ -925,7 +943,6 @@ function photos_content(&$a) {
'capt_label' => t('Caption'),
'caption' => $caption_e,
'tag_label' => t('Add a Tag'),
- 'tags' => $link_item['tag'],
'permissions' => t('Permissions'),
'aclselect' => $aclselect_e,
'help_tags' => t('Example: @bob, @Barbara_Jensen, @jim@example.com, #California, #camping'),
@@ -1067,10 +1084,10 @@ function photos_content(&$a) {
}
$album_e = array($album_link,$ph[0]['album']);
- $tags_e = $tags;
$like_e = $like;
$dislike_e = $dislike;
+
$photo_tpl = get_markup_template('photo_view.tpl');
$o .= replace_macros($photo_tpl, array(
'$id' => $ph[0]['id'],
@@ -1081,7 +1098,8 @@ function photos_content(&$a) {
'$prevlink' => $prevlink,
'$nextlink' => $nextlink,
'$desc' => $ph[0]['description'],
- '$tags' => $tags_e,
+ '$tag_hdr' => t('In This Photo:'),
+ '$tags' => $tags,
'$edit' => $edit,
'$likebuttons' => $likebuttons,
'$like' => $like_e,