Usage of /display/(guid) as path instead of /display/(user)/(id)

Bugfix for adding tags to photos
This commit is contained in:
Michael Vogel 2014-07-22 00:36:20 +02:00
parent f920fa229b
commit ed1dce93d6
16 changed files with 216 additions and 144 deletions

View File

@ -268,10 +268,13 @@ define ( 'ACTIVITY_FAVORITE', NAMESPACE_ACTIVITY_SCHEMA . 'favorite' );
define ( 'ACTIVITY_POKE', NAMESPACE_ZOT . '/activity/poke' ); define ( 'ACTIVITY_POKE', NAMESPACE_ZOT . '/activity/poke' );
define ( 'ACTIVITY_MOOD', NAMESPACE_ZOT . '/activity/mood' ); define ( 'ACTIVITY_MOOD', NAMESPACE_ZOT . '/activity/mood' );
define ( 'ACTIVITY_OBJ_BOOKMARK', NAMESPACE_ACTIVITY_SCHEMA . 'bookmark' );
define ( 'ACTIVITY_OBJ_COMMENT', NAMESPACE_ACTIVITY_SCHEMA . 'comment' ); define ( 'ACTIVITY_OBJ_COMMENT', NAMESPACE_ACTIVITY_SCHEMA . 'comment' );
define ( 'ACTIVITY_OBJ_NOTE', NAMESPACE_ACTIVITY_SCHEMA . 'note' ); define ( 'ACTIVITY_OBJ_NOTE', NAMESPACE_ACTIVITY_SCHEMA . 'note' );
define ( 'ACTIVITY_OBJ_PERSON', NAMESPACE_ACTIVITY_SCHEMA . 'person' ); define ( 'ACTIVITY_OBJ_PERSON', NAMESPACE_ACTIVITY_SCHEMA . 'person' );
define ( 'ACTIVITY_OBJ_IMAGE', NAMESPACE_ACTIVITY_SCHEMA . 'image' );
define ( 'ACTIVITY_OBJ_PHOTO', NAMESPACE_ACTIVITY_SCHEMA . 'photo' ); define ( 'ACTIVITY_OBJ_PHOTO', NAMESPACE_ACTIVITY_SCHEMA . 'photo' );
define ( 'ACTIVITY_OBJ_VIDEO', NAMESPACE_ACTIVITY_SCHEMA . 'video' );
define ( 'ACTIVITY_OBJ_P_PHOTO', NAMESPACE_ACTIVITY_SCHEMA . 'profile-photo' ); define ( 'ACTIVITY_OBJ_P_PHOTO', NAMESPACE_ACTIVITY_SCHEMA . 'profile-photo' );
define ( 'ACTIVITY_OBJ_ALBUM', NAMESPACE_ACTIVITY_SCHEMA . 'photo-album' ); define ( 'ACTIVITY_OBJ_ALBUM', NAMESPACE_ACTIVITY_SCHEMA . 'photo-album' );
define ( 'ACTIVITY_OBJ_EVENT', NAMESPACE_ACTIVITY_SCHEMA . 'event' ); define ( 'ACTIVITY_OBJ_EVENT', NAMESPACE_ACTIVITY_SCHEMA . 'event' );
@ -1130,8 +1133,24 @@ if(! function_exists('check_plugins')) {
} }
} }
function get_guid($size=16) { function get_guid($size=16) {
$exists = true; // assume by default that we don't have a unique guid
do {
$prefix = "";
while (strlen($prefix) < ($size - 13))
$prefix .= mt_rand();
$s = substr(uniqid($prefix), -$size);
$r = q("select id from guid where guid = '%s' limit 1", dbesc($s));
if(! count($r))
$exists = false;
} while($exists);
q("insert into guid (guid) values ('%s') ", dbesc($s));
return $s;
}
/*function get_guid($size=16) {
$exists = true; // assume by default that we don't have a unique guid $exists = true; // assume by default that we don't have a unique guid
do { do {
$s = random_string($size); $s = random_string($size);
@ -1141,7 +1160,7 @@ function get_guid($size=16) {
} while($exists); } while($exists);
q("insert into guid ( guid ) values ( '%s' ) ", dbesc($s)); q("insert into guid ( guid ) values ( '%s' ) ", dbesc($s));
return $s; return $s;
} }*/
// wrapper for adding a login box. If $register == true provide a registration // wrapper for adding a login box. If $register == true provide a registration

View File

@ -1373,12 +1373,13 @@ function diaspora_comment($importer,$xml,$msg) {
$message_id = item_store($datarray); $message_id = item_store($datarray);
if($message_id) { //if($message_id) {
q("update item set plink = '%s' where id = %d", //q("update item set plink = '%s' where id = %d",
dbesc($a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $message_id), // //dbesc($a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $message_id),
intval($message_id) // dbesc($a->get_baseurl().'/display/'.$datarray['guid']),
); // intval($message_id)
} //);
//}
if(($parent_item['origin']) && (! $parent_author_signature)) { if(($parent_item['origin']) && (! $parent_author_signature)) {
q("insert into sign (`iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ", q("insert into sign (`iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ",
@ -1422,7 +1423,8 @@ function diaspora_comment($importer,$xml,$msg) {
'to_email' => $importer['email'], 'to_email' => $importer['email'],
'uid' => $importer['uid'], 'uid' => $importer['uid'],
'item' => $datarray, 'item' => $datarray,
'link' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $message_id, //'link' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $message_id,
'link' => $a->get_baseurl().'/display/'.$datarray['guid'],
'source_name' => $datarray['author-name'], 'source_name' => $datarray['author-name'],
'source_link' => $datarray['author-link'], 'source_link' => $datarray['author-link'],
'source_photo' => $datarray['author-avatar'], 'source_photo' => $datarray['author-avatar'],
@ -1957,7 +1959,8 @@ EOT;
$ulink = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]'; $ulink = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]';
$alink = '[url=' . $parent_item['author-link'] . ']' . $parent_item['author-name'] . '[/url]'; $alink = '[url=' . $parent_item['author-link'] . ']' . $parent_item['author-name'] . '[/url]';
$plink = '[url=' . $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $parent_item['id'] . ']' . $post_type . '[/url]'; //$plink = '[url=' . $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $parent_item['id'] . ']' . $post_type . '[/url]';
$plink = '[url='.$a->get_baseurl().'/display/'.$guid.']'.$post_type.'[/url]';
$arr['body'] = sprintf( $bodyverb, $ulink, $alink, $plink ); $arr['body'] = sprintf( $bodyverb, $ulink, $alink, $plink );
$arr['app'] = 'Diaspora'; $arr['app'] = 'Diaspora';
@ -1973,12 +1976,13 @@ EOT;
$message_id = item_store($arr); $message_id = item_store($arr);
if($message_id) { //if($message_id) {
q("update item set plink = '%s' where id = %d", // q("update item set plink = '%s' where id = %d",
dbesc($a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $message_id), // //dbesc($a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $message_id),
intval($message_id) // dbesc($a->get_baseurl().'/display/'.$guid),
); // intval($message_id)
} // );
//}
if(! $parent_author_signature) { if(! $parent_author_signature) {
q("insert into sign (`iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ", q("insert into sign (`iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ",

View File

@ -385,13 +385,18 @@ function event_store($arr) {
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", $r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
intval($arr['uid']) intval($arr['uid'])
); );
if(count($r)) //if(count($r))
$plink = $a->get_baseurl() . '/display/' . $r[0]['nickname'] . '/' . $item_id; // $plink = $a->get_baseurl() . '/display/' . $r[0]['nickname'] . '/' . $item_id;
if($item_id) { if($item_id) {
q("UPDATE `item` SET `plink` = '%s', `event-id` = %d WHERE `uid` = %d AND `id` = %d", //q("UPDATE `item` SET `plink` = '%s', `event-id` = %d WHERE `uid` = %d AND `id` = %d",
dbesc($plink), // dbesc($plink),
// intval($event['id']),
// intval($arr['uid']),
// intval($item_id)
//);
q("UPDATE `item` SET `event-id` = %d WHERE `uid` = %d AND `id` = %d",
intval($event['id']), intval($event['id']),
intval($arr['uid']), intval($arr['uid']),
intval($item_id) intval($item_id)

View File

@ -678,8 +678,10 @@ function get_atom_elements($feed, $item, $contact = array()) {
if($rawgeo) if($rawgeo)
$res['coord'] = unxmlify($rawgeo[0]['data']); $res['coord'] = unxmlify($rawgeo[0]['data']);
if ($contact["network"] == NETWORK_FEED) if ($contact["network"] == NETWORK_FEED) {
$res['verb'] = ACTIVITY_POST; $res['verb'] = ACTIVITY_POST;
$res['object-type'] = ACTIVITY_OBJ_NOTE;
}
$rawverb = $item->get_item_tags(NAMESPACE_ACTIVITY, 'verb'); $rawverb = $item->get_item_tags(NAMESPACE_ACTIVITY, 'verb');
@ -866,6 +868,7 @@ function get_atom_elements($feed, $item, $contact = array()) {
if (isset($contact["network"]) AND ($contact["network"] == NETWORK_FEED) AND $contact['fetch_further_information']) { if (isset($contact["network"]) AND ($contact["network"] == NETWORK_FEED) AND $contact['fetch_further_information']) {
$res["body"] = $res["title"].add_page_info($res['plink']); $res["body"] = $res["title"].add_page_info($res['plink']);
$res["title"] = ""; $res["title"] = "";
$res["object-type"] = ACTIVITY_OBJ_BOOKMARK;
} elseif (isset($contact["network"]) AND ($contact["network"] == NETWORK_OSTATUS)) } elseif (isset($contact["network"]) AND ($contact["network"] == NETWORK_OSTATUS))
$res["body"] = add_page_info_to_body($res["body"]); $res["body"] = add_page_info_to_body($res["body"]);
elseif (isset($contact["network"]) AND ($contact["network"] == NETWORK_FEED) AND strstr($res['plink'], ".app.net/")) { elseif (isset($contact["network"]) AND ($contact["network"] == NETWORK_FEED) AND strstr($res['plink'], ".app.net/")) {
@ -1093,9 +1096,14 @@ function item_store($arr,$force_parent = false) {
$arr['attach'] = ((x($arr,'attach')) ? notags(trim($arr['attach'])) : ''); $arr['attach'] = ((x($arr,'attach')) ? notags(trim($arr['attach'])) : '');
$arr['app'] = ((x($arr,'app')) ? notags(trim($arr['app'])) : ''); $arr['app'] = ((x($arr,'app')) ? notags(trim($arr['app'])) : '');
$arr['origin'] = ((x($arr,'origin')) ? intval($arr['origin']) : 0 ); $arr['origin'] = ((x($arr,'origin')) ? intval($arr['origin']) : 0 );
$arr['guid'] = ((x($arr,'guid')) ? notags(trim($arr['guid'])) : get_guid()); $arr['guid'] = ((x($arr,'guid')) ? notags(trim($arr['guid'])) : get_guid(30));
$arr['network'] = ((x($arr,'network')) ? trim($arr['network']) : ''); $arr['network'] = ((x($arr,'network')) ? trim($arr['network']) : '');
if ($arr['plink'] == "") {
$a = get_app();
$arr['plink'] = $a->get_baseurl().'/display/'.$arr['guid'];
}
if ($arr['network'] == "") { if ($arr['network'] == "") {
$r = q("SELECT `network` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", $r = q("SELECT `network` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($arr['contact-id']), intval($arr['contact-id']),
@ -1274,7 +1282,8 @@ function item_store($arr,$force_parent = false) {
'to_email' => $u[0]['email'], 'to_email' => $u[0]['email'],
'uid' => $u[0]['uid'], 'uid' => $u[0]['uid'],
'item' => $item[0], 'item' => $item[0],
'link' => $a->get_baseurl().'/display/'.$u[0]['nickname'].'/'.$current_post, //'link' => $a->get_baseurl().'/display/'.$u[0]['nickname'].'/'.$current_post,
'link' => $a->get_baseurl().'/display/'.$arr['guid'],
'source_name' => $item[0]['author-name'], 'source_name' => $item[0]['author-name'],
'source_link' => $item[0]['author-link'], 'source_link' => $item[0]['author-link'],
'source_photo' => $item[0]['author-avatar'], 'source_photo' => $item[0]['author-avatar'],
@ -1395,6 +1404,15 @@ function item_store($arr,$force_parent = false) {
return $current_post; return $current_post;
} }
function get_item_guid($id) {
$r = q("SELECT `guid` FROM `item` WHERE `id` = %d LIMIT 1", intval($id));
if (count($r))
return($r[0]["guid"]);
else
return("");
}
// return - test // return - test
function get_item_contact($item,$contacts) { function get_item_contact($item,$contacts) {
if(! count($contacts) || (! is_array($item))) if(! count($contacts) || (! is_array($item)))
@ -1494,7 +1512,8 @@ function tag_deliver($uid,$item_id) {
'to_email' => $u[0]['email'], 'to_email' => $u[0]['email'],
'uid' => $u[0]['uid'], 'uid' => $u[0]['uid'],
'item' => $item, 'item' => $item,
'link' => $a->get_baseurl() . '/display/' . $u[0]['nickname'] . '/' . $item['id'], //'link' => $a->get_baseurl() . '/display/' . $u[0]['nickname'] . '/' . $item['id'],
'link' => $a->get_baseurl() . '/display/'.get_item_guid($item['id']),
'source_name' => $item['author-name'], 'source_name' => $item['author-name'],
'source_link' => $item['author-link'], 'source_link' => $item['author-link'],
'source_photo' => $photo, 'source_photo' => $photo,
@ -3309,7 +3328,8 @@ function local_delivery($importer,$data) {
'to_email' => $importer['email'], 'to_email' => $importer['email'],
'uid' => $importer['importer_uid'], 'uid' => $importer['importer_uid'],
'item' => $datarray, 'item' => $datarray,
'link' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $posted_id, //'link' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $posted_id,
'link' => $a->get_baseurl().'/display/'.get_item_guid($posted_id),
'source_name' => stripslashes($datarray['author-name']), 'source_name' => stripslashes($datarray['author-name']),
'source_link' => $datarray['author-link'], 'source_link' => $datarray['author-link'],
'source_photo' => ((link_compare($datarray['author-link'],$importer['url'])) 'source_photo' => ((link_compare($datarray['author-link'],$importer['url']))
@ -3473,7 +3493,8 @@ function local_delivery($importer,$data) {
'to_email' => $importer['email'], 'to_email' => $importer['email'],
'uid' => $importer['importer_uid'], 'uid' => $importer['importer_uid'],
'item' => $datarray, 'item' => $datarray,
'link' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $posted_id, //'link' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $posted_id,
'link' => $a->get_baseurl().'/display/'.get_item_guid($posted_id),
'source_name' => stripslashes($datarray['author-name']), 'source_name' => stripslashes($datarray['author-name']),
'source_link' => $datarray['author-link'], 'source_link' => $datarray['author-link'],
'source_photo' => ((link_compare($datarray['author-link'],$importer['url'])) 'source_photo' => ((link_compare($datarray['author-link'],$importer['url']))
@ -3626,7 +3647,8 @@ function local_delivery($importer,$data) {
'to_email' => $importer['email'], 'to_email' => $importer['email'],
'uid' => $importer['importer_uid'], 'uid' => $importer['importer_uid'],
'item' => $datarray, 'item' => $datarray,
'link' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $posted_id, //'link' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $posted_id,
'link' => $a->get_baseurl().'/display/'.get_item_guid($posted_id),
'source_name' => stripslashes($datarray['author-name']), 'source_name' => stripslashes($datarray['author-name']),
'source_link' => $datarray['author-link'], 'source_link' => $datarray['author-link'],
'source_photo' => ((link_compare($datarray['author-link'],$importer['url'])) 'source_photo' => ((link_compare($datarray['author-link'],$importer['url']))
@ -3717,7 +3739,8 @@ function new_follower($importer,$contact,$datarray,$item,$sharing = false) {
group_add_member($r[0]['uid'],'',$contact_record['id'],$r[0]['def_gid']); group_add_member($r[0]['uid'],'',$contact_record['id'],$r[0]['def_gid']);
} }
if(($r[0]['notify-flags'] & NOTIFY_INTRO) && ($r[0]['page-flags'] == PAGE_NORMAL)) { if(($r[0]['notify-flags'] & NOTIFY_INTRO) &&
(($r[0]['page-flags'] == PAGE_NORMAL) OR ($r[0]['page-flags'] == PAGE_SOAPBOX))) {
$email_tpl = get_intltext_template('follow_notify_eml.tpl'); $email_tpl = get_intltext_template('follow_notify_eml.tpl');
$email = replace_macros($email_tpl, array( $email = replace_macros($email_tpl, array(
'$requestor' => ((strlen($name)) ? $name : t('[Name Withheld]')), '$requestor' => ((strlen($name)) ? $name : t('[Name Withheld]')),

View File

@ -148,7 +148,7 @@ function nav_info(&$a) {
/* only show friend requests for normal pages. Other page types have automatic friendship. */ /* only show friend requests for normal pages. Other page types have automatic friendship. */
if($_SESSION['page_flags'] == PAGE_NORMAL || $_SESSION['page_flags'] == PAGE_PRVGROUP) { if($_SESSION['page_flags'] == PAGE_NORMAL || $_SESSION['page_flags'] == PAGE_SOAPBOX || $_SESSION['page_flags'] == PAGE_PRVGROUP) {
$nav['introductions'] = array('notifications/intros', t('Introductions'), "", t('Friend Requests')); $nav['introductions'] = array('notifications/intros', t('Introductions'), "", t('Friend Requests'));
$nav['notifications'] = array('notifications', t('Notifications'), "", t('Notifications')); $nav['notifications'] = array('notifications', t('Notifications'), "", t('Notifications'));
$nav['notifications']['all']=array('notifications/system', t('See all notifications'), "", ""); $nav['notifications']['all']=array('notifications/system', t('See all notifications'), "", "");
@ -166,12 +166,12 @@ function nav_info(&$a) {
} }
$nav['delegations'] = Array('delegate', t('Delegations'), "", t('Delegate Page Management')); $nav['delegations'] = Array('delegate', t('Delegations'), "", t('Delegate Page Management'));
$nav['settings'] = array('settings', t('Settings'),"", t('Account settings')); $nav['settings'] = array('settings', t('Settings'),"", t('Account settings'));
if(feature_enabled(local_user(),'multi_profiles')) if(feature_enabled(local_user(),'multi_profiles'))
$nav['profiles'] = array('profiles', t('Profiles'),"", t('Manage/Edit Profiles')); $nav['profiles'] = array('profiles', t('Profiles'),"", t('Manage/Edit Profiles'));
$nav['contacts'] = array('contacts', t('Contacts'),"", t('Manage/edit friends and contacts')); $nav['contacts'] = array('contacts', t('Contacts'),"", t('Manage/edit friends and contacts'));
} }

View File

@ -331,6 +331,7 @@ function onepoll_run(&$argv, &$argc){
$datarray = array(); $datarray = array();
$datarray['verb'] = ACTIVITY_POST; $datarray['verb'] = ACTIVITY_POST;
$datarray['object-type'] = ACTIVITY_OBJ_NOTE;
// $meta = email_msg_meta($mbox,$msg_uid); // $meta = email_msg_meta($mbox,$msg_uid);
// $headers = email_msg_headers($mbox,$msg_uid); // $headers = email_msg_headers($mbox,$msg_uid);

View File

@ -493,7 +493,8 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
'like' => '', 'like' => '',
'dislike' => '', 'dislike' => '',
'comment' => '', 'comment' => '',
'conv' => (($preview) ? '' : array('href'=> $a->get_baseurl($ssl_state) . '/display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context'))), //'conv' => (($preview) ? '' : array('href'=> $a->get_baseurl($ssl_state) . '/display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context'))),
'conv' => (($preview) ? '' : array('href'=> $a->get_baseurl($ssl_state).'/display/'.$item['guid'], 'title'=> t('View in context'))),
'previewing' => $previewing, 'previewing' => $previewing,
'wait' => t('Please wait'), 'wait' => t('Please wait'),
); );

View File

@ -203,9 +203,9 @@ function item_post(&$a) {
$private = $orig_post['private']; $private = $orig_post['private'];
$pubmail_enable = $orig_post['pubmail']; $pubmail_enable = $orig_post['pubmail'];
$network = $orig_post['network']; $network = $orig_post['network'];
$guid = $orig_post['guid'];
} } else {
else {
// if coming from the API and no privacy settings are set, // if coming from the API and no privacy settings are set,
// use the user default permissions - as they won't have // use the user default permissions - as they won't have
@ -238,6 +238,7 @@ function item_post(&$a) {
$emailcc = notags(trim($_REQUEST['emailcc'])); $emailcc = notags(trim($_REQUEST['emailcc']));
$body = escape_tags(trim($_REQUEST['body'])); $body = escape_tags(trim($_REQUEST['body']));
$network = notags(trim($_REQUEST['network'])); $network = notags(trim($_REQUEST['network']));
$guid = get_guid(32);
$naked_body = preg_replace('/\[(.+?)\]/','',$body); $naked_body = preg_replace('/\[(.+?)\]/','',$body);
@ -629,6 +630,7 @@ function item_post(&$a) {
$datarray['commented'] = datetime_convert(); $datarray['commented'] = datetime_convert();
$datarray['received'] = datetime_convert(); $datarray['received'] = datetime_convert();
$datarray['changed'] = datetime_convert(); $datarray['changed'] = datetime_convert();
$datarray['guid'] = $guid;
$datarray['uri'] = $uri; $datarray['uri'] = $uri;
$datarray['title'] = $title; $datarray['title'] = $title;
$datarray['body'] = $body; $datarray['body'] = $body;
@ -664,8 +666,6 @@ function item_post(&$a) {
if($orig_post) if($orig_post)
$datarray['edit'] = true; $datarray['edit'] = true;
else
$datarray['guid'] = get_guid();
// preview mode - prepare the body for display and send it via json // preview mode - prepare the body for display and send it via json
@ -823,7 +823,8 @@ function item_post(&$a) {
'to_email' => $user['email'], 'to_email' => $user['email'],
'uid' => $user['uid'], 'uid' => $user['uid'],
'item' => $datarray, 'item' => $datarray,
'link' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id, //'link' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id,
'link' => $a->get_baseurl().'/display/'.$datarray['guid'],
'source_name' => $datarray['author-name'], 'source_name' => $datarray['author-name'],
'source_link' => $datarray['author-link'], 'source_link' => $datarray['author-link'],
'source_photo' => $datarray['author-avatar'], 'source_photo' => $datarray['author-avatar'],
@ -851,7 +852,8 @@ function item_post(&$a) {
'to_email' => $user['email'], 'to_email' => $user['email'],
'uid' => $user['uid'], 'uid' => $user['uid'],
'item' => $datarray, 'item' => $datarray,
'link' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id, //'link' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id,
'link' => $a->get_baseurl().'/display/'.$datarray['guid'],
'source_name' => $datarray['author-name'], 'source_name' => $datarray['author-name'],
'source_link' => $datarray['author-link'], 'source_link' => $datarray['author-link'],
'source_photo' => $datarray['author-avatar'], 'source_photo' => $datarray['author-avatar'],
@ -870,7 +872,8 @@ function item_post(&$a) {
WHERE `id` = %d", WHERE `id` = %d",
intval($parent), intval($parent),
dbesc(($parent == $post_id) ? $uri : $parent_item['uri']), dbesc(($parent == $post_id) ? $uri : $parent_item['uri']),
dbesc($a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id), //dbesc($a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id),
dbesc($a->get_baseurl().'/display/'.$datarray['guid']),
dbesc(datetime_convert()), dbesc(datetime_convert()),
intval($post_id) intval($post_id)
); );
@ -903,7 +906,8 @@ function item_post(&$a) {
update_thread($parent); update_thread($parent);
$datarray['id'] = $post_id; $datarray['id'] = $post_id;
$datarray['plink'] = $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id; //$datarray['plink'] = $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id;
$datarray['plink'] = $a->get_baseurl().'/display/'.$datarray['guid'];
call_hooks('post_local_end', $datarray); call_hooks('post_local_end', $datarray);

View File

@ -121,7 +121,7 @@ function notifications_content(&$a) {
$notif_content .= '<a href="' . ((strlen($sql_extra)) ? 'notifications/intros/all' : 'notifications/intros' ) . '" id="notifications-show-hide-link" >' $notif_content .= '<a href="' . ((strlen($sql_extra)) ? 'notifications/intros/all' : 'notifications/intros' ) . '" id="notifications-show-hide-link" >'
. ((strlen($sql_extra)) ? t('Show Ignored Requests') : t('Hide Ignored Requests')) . '</a></div>' . "\r\n"; . ((strlen($sql_extra)) ? t('Show Ignored Requests') : t('Hide Ignored Requests')) . '</a></div>' . "\r\n";
$r = q("SELECT COUNT(*) AS `total` FROM `intro` $r = q("SELECT COUNT(*) AS `total` FROM `intro`
WHERE `intro`.`uid` = %d $sql_extra AND `intro`.`blocked` = 0 ", WHERE `intro`.`uid` = %d $sql_extra AND `intro`.`blocked` = 0 ",
intval($_SESSION['uid']) intval($_SESSION['uid'])
); );
@ -229,59 +229,62 @@ function notifications_content(&$a) {
$notif_tpl = get_markup_template('notifications.tpl'); $notif_tpl = get_markup_template('notifications.tpl');
$r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`, $r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`,
`item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object` as `object`, `item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object` as `object`,
`pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink` `pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink`, `pitem`.`guid` as `pguid`
FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent` FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent`
WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND `pitem`.`parent` != 0 AND WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND `pitem`.`parent` != 0 AND
`item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 0 ORDER BY `item`.`created` DESC" , `item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 0 ORDER BY `item`.`created` DESC" ,
intval(local_user()) intval(local_user())
); );
$tpl_item_likes = get_markup_template('notifications_likes_item.tpl'); $tpl_item_likes = get_markup_template('notifications_likes_item.tpl');
$tpl_item_dislikes = get_markup_template('notifications_dislikes_item.tpl'); $tpl_item_dislikes = get_markup_template('notifications_dislikes_item.tpl');
$tpl_item_friends = get_markup_template('notifications_friends_item.tpl'); $tpl_item_friends = get_markup_template('notifications_friends_item.tpl');
$tpl_item_comments = get_markup_template('notifications_comments_item.tpl'); $tpl_item_comments = get_markup_template('notifications_comments_item.tpl');
$tpl_item_posts = get_markup_template('notifications_posts_item.tpl'); $tpl_item_posts = get_markup_template('notifications_posts_item.tpl');
$notif_content = ''; $notif_content = '';
if ($r) { if ($r) {
foreach ($r as $it) { foreach ($r as $it) {
switch($it['verb']){ switch($it['verb']){
case ACTIVITY_LIKE: case ACTIVITY_LIKE:
$notif_content .= replace_macros($tpl_item_likes,array( $notif_content .= replace_macros($tpl_item_likes,array(
'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'], //'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']), '$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
)); ));
break; break;
case ACTIVITY_DISLIKE: case ACTIVITY_DISLIKE:
$notif_content .= replace_macros($tpl_item_dislikes,array( $notif_content .= replace_macros($tpl_item_dislikes,array(
'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'], //'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']), '$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
)); ));
break; break;
case ACTIVITY_FRIEND: case ACTIVITY_FRIEND:
$xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">"; $xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
$obj = parse_xml_string($xmlhead.$it['object']); $obj = parse_xml_string($xmlhead.$it['object']);
$it['fname'] = $obj->title; $it['fname'] = $obj->title;
$notif_content .= replace_macros($tpl_item_friends,array( $notif_content .= replace_macros($tpl_item_friends,array(
'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'], //'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']), '$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
)); ));
break; break;
default: default:
$item_text = (($it['id'] == $it['parent']) $item_text = (($it['id'] == $it['parent'])
? sprintf( t("%s created a new post"), $it['author-name']) ? sprintf( t("%s created a new post"), $it['author-name'])
@ -289,36 +292,37 @@ function notifications_content(&$a) {
$tpl = (($it['id'] == $it['parent']) ? $tpl_item_posts : $tpl_item_comments); $tpl = (($it['id'] == $it['parent']) ? $tpl_item_posts : $tpl_item_comments);
$notif_content .= replace_macros($tpl,array( $notif_content .= replace_macros($tpl,array(
'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'], //'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => $item_text, '$item_text' => $item_text,
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
)); ));
} }
} }
} else { } else {
$notif_content = t('No more network notifications.'); $notif_content = t('No more network notifications.');
} }
$o .= replace_macros($notif_tpl, array( $o .= replace_macros($notif_tpl, array(
'$notif_header' => t('Network Notifications'), '$notif_header' => t('Network Notifications'),
'$tabs' => $tabs, '$tabs' => $tabs,
'$notif_content' => $notif_content, '$notif_content' => $notif_content,
)); ));
} else if (($a->argc > 1) && ($a->argv[1] == 'system')) { } else if (($a->argc > 1) && ($a->argv[1] == 'system')) {
$notif_tpl = get_markup_template('notifications.tpl'); $notif_tpl = get_markup_template('notifications.tpl');
$not_tpl = get_markup_template('notify.tpl'); $not_tpl = get_markup_template('notify.tpl');
require_once('include/bbcode.php'); require_once('include/bbcode.php');
$r = q("SELECT * from notify where uid = %d and seen = 0 order by date desc", $r = q("SELECT * from notify where uid = %d and seen = 0 order by date desc",
intval(local_user()) intval(local_user())
); );
if (count($r) > 0) { if (count($r) > 0) {
foreach ($r as $it) { foreach ($r as $it) {
$notif_content .= replace_macros($not_tpl,array( $notif_content .= replace_macros($not_tpl,array(
@ -331,7 +335,7 @@ function notifications_content(&$a) {
} else { } else {
$notif_content .= t('No more system notifications.'); $notif_content .= t('No more system notifications.');
} }
$o .= replace_macros($notif_tpl, array( $o .= replace_macros($notif_tpl, array(
'$notif_header' => t('System Notifications'), '$notif_header' => t('System Notifications'),
'$tabs' => $tabs, '$tabs' => $tabs,
@ -339,9 +343,9 @@ function notifications_content(&$a) {
)); ));
} else if (($a->argc > 1) && ($a->argv[1] == 'personal')) { } else if (($a->argc > 1) && ($a->argv[1] == 'personal')) {
$notif_tpl = get_markup_template('notifications.tpl'); $notif_tpl = get_markup_template('notifications.tpl');
$myurl = $a->get_baseurl(true) . '/profile/'. $a->user['nickname']; $myurl = $a->get_baseurl(true) . '/profile/'. $a->user['nickname'];
$myurl = substr($myurl,strpos($myurl,'://')+3); $myurl = substr($myurl,strpos($myurl,'://')+3);
$myurl = str_replace(array('www.','.'),array('','\\.'),$myurl); $myurl = str_replace(array('www.','.'),array('','\\.'),$myurl);
@ -353,60 +357,63 @@ function notifications_content(&$a) {
); );
$r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`, $r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`,
`item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object` as `object`, `item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object` as `object`,
`pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink` `pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink`, `pitem`.`guid` as `pguid`
FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent` FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent`
WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1
$sql_extra $sql_extra
AND `item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 0 ORDER BY `item`.`created` DESC" , AND `item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 0 ORDER BY `item`.`created` DESC" ,
intval(local_user()) intval(local_user())
); );
$tpl_item_likes = get_markup_template('notifications_likes_item.tpl'); $tpl_item_likes = get_markup_template('notifications_likes_item.tpl');
$tpl_item_dislikes = get_markup_template('notifications_dislikes_item.tpl'); $tpl_item_dislikes = get_markup_template('notifications_dislikes_item.tpl');
$tpl_item_friends = get_markup_template('notifications_friends_item.tpl'); $tpl_item_friends = get_markup_template('notifications_friends_item.tpl');
$tpl_item_comments = get_markup_template('notifications_comments_item.tpl'); $tpl_item_comments = get_markup_template('notifications_comments_item.tpl');
$tpl_item_posts = get_markup_template('notifications_posts_item.tpl'); $tpl_item_posts = get_markup_template('notifications_posts_item.tpl');
$notif_content = ''; $notif_content = '';
if (count($r) > 0) { if (count($r) > 0) {
foreach ($r as $it) { foreach ($r as $it) {
switch($it['verb']){ switch($it['verb']){
case ACTIVITY_LIKE: case ACTIVITY_LIKE:
$notif_content .= replace_macros($tpl_item_likes,array( $notif_content .= replace_macros($tpl_item_likes,array(
'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'], //'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']), '$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
)); ));
break; break;
case ACTIVITY_DISLIKE: case ACTIVITY_DISLIKE:
$notif_content .= replace_macros($tpl_item_dislikes,array( $notif_content .= replace_macros($tpl_item_dislikes,array(
'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'], //'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']), '$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
)); ));
break; break;
case ACTIVITY_FRIEND: case ACTIVITY_FRIEND:
$xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">"; $xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
$obj = parse_xml_string($xmlhead.$it['object']); $obj = parse_xml_string($xmlhead.$it['object']);
$it['fname'] = $obj->title; $it['fname'] = $obj->title;
$notif_content .= replace_macros($tpl_item_friends,array( $notif_content .= replace_macros($tpl_item_friends,array(
'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'], //'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']), '$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
)); ));
break; break;
default: default:
$item_text = (($it['id'] == $it['parent']) $item_text = (($it['id'] == $it['parent'])
? sprintf( t("%s created a new post"), $it['author-name']) ? sprintf( t("%s created a new post"), $it['author-name'])
@ -414,57 +421,59 @@ function notifications_content(&$a) {
$tpl = (($it['id'] == $it['parent']) ? $tpl_item_posts : $tpl_item_comments); $tpl = (($it['id'] == $it['parent']) ? $tpl_item_posts : $tpl_item_comments);
$notif_content .= replace_macros($tpl,array( $notif_content .= replace_macros($tpl,array(
'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'], //'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => $item_text, '$item_text' => $item_text,
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
)); ));
} }
} }
} else { } else {
$notif_content = t('No more personal notifications.'); $notif_content = t('No more personal notifications.');
} }
$o .= replace_macros($notif_tpl, array( $o .= replace_macros($notif_tpl, array(
'$notif_header' => t('Personal Notifications'), '$notif_header' => t('Personal Notifications'),
'$tabs' => $tabs, '$tabs' => $tabs,
'$notif_content' => $notif_content, '$notif_content' => $notif_content,
)); ));
} else if (($a->argc > 1) && ($a->argv[1] == 'home')) { } else if (($a->argc > 1) && ($a->argv[1] == 'home')) {
$notif_tpl = get_markup_template('notifications.tpl'); $notif_tpl = get_markup_template('notifications.tpl');
$r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`, $r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`,
`item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object` as `object`, `item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object` as `object`,
`pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink` `pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink`, `pitem`.`guid` as `pguid`
FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent` FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent`
WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND
`item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 1 ORDER BY `item`.`created` DESC", `item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 1 ORDER BY `item`.`created` DESC",
intval(local_user()) intval(local_user())
); );
$tpl_item_likes = get_markup_template('notifications_likes_item.tpl'); $tpl_item_likes = get_markup_template('notifications_likes_item.tpl');
$tpl_item_dislikes = get_markup_template('notifications_dislikes_item.tpl'); $tpl_item_dislikes = get_markup_template('notifications_dislikes_item.tpl');
$tpl_item_friends = get_markup_template('notifications_friends_item.tpl'); $tpl_item_friends = get_markup_template('notifications_friends_item.tpl');
$tpl_item_comments = get_markup_template('notifications_comments_item.tpl'); $tpl_item_comments = get_markup_template('notifications_comments_item.tpl');
$notif_content = ''; $notif_content = '';
if (count($r) > 0) { if (count($r) > 0) {
foreach ($r as $it) { foreach ($r as $it) {
switch($it['verb']){ switch($it['verb']){
case ACTIVITY_LIKE: case ACTIVITY_LIKE:
$notif_content .= replace_macros($tpl_item_likes,array( $notif_content .= replace_macros($tpl_item_likes,array(
'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'], //'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']), '$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
@ -473,7 +482,8 @@ function notifications_content(&$a) {
break; break;
case ACTIVITY_DISLIKE: case ACTIVITY_DISLIKE:
$notif_content .= replace_macros($tpl_item_dislikes,array( $notif_content .= replace_macros($tpl_item_dislikes,array(
'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'], //'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']), '$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
@ -481,13 +491,14 @@ function notifications_content(&$a) {
break; break;
case ACTIVITY_FRIEND: case ACTIVITY_FRIEND:
$xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">"; $xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
$obj = parse_xml_string($xmlhead.$it['object']); $obj = parse_xml_string($xmlhead.$it['object']);
$it['fname'] = $obj->title; $it['fname'] = $obj->title;
$notif_content .= replace_macros($tpl_item_friends,array( $notif_content .= replace_macros($tpl_item_friends,array(
'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'], //'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']), '$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
@ -496,18 +507,19 @@ function notifications_content(&$a) {
break; break;
default: default:
$notif_content .= replace_macros($tpl_item_comments,array( $notif_content .= replace_macros($tpl_item_comments,array(
'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'], //'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
'$item_image' => $it['author-avatar'], '$item_image' => $it['author-avatar'],
'$item_text' => sprintf( t("%s commented on %s's post"), $it['author-name'], $it['pname']), '$item_text' => sprintf( t("%s commented on %s's post"), $it['author-name'], $it['pname']),
'$item_when' => relative_date($it['created']) '$item_when' => relative_date($it['created'])
)); ));
} }
} }
} else { } else {
$notif_content = t('No more home notifications.'); $notif_content = t('No more home notifications.');
} }
$o .= replace_macros($notif_tpl, array( $o .= replace_macros($notif_tpl, array(
'$notif_header' => t('Home Notifications'), '$notif_header' => t('Home Notifications'),
'$tabs' => $tabs, '$tabs' => $tabs,

View File

@ -341,7 +341,6 @@ function photos_post(&$a) {
if(($a->argc > 2) && ((x($_POST,'desc') !== false) || (x($_POST,'newtag') !== false)) || (x($_POST,'albname') !== false)) { if(($a->argc > 2) && ((x($_POST,'desc') !== false) || (x($_POST,'newtag') !== false)) || (x($_POST,'albname') !== false)) {
$desc = ((x($_POST,'desc')) ? notags(trim($_POST['desc'])) : ''); $desc = ((x($_POST,'desc')) ? notags(trim($_POST['desc'])) : '');
$rawtags = ((x($_POST,'newtag')) ? notags(trim($_POST['newtag'])) : ''); $rawtags = ((x($_POST,'newtag')) ? notags(trim($_POST['newtag'])) : '');
$item_id = ((x($_POST,'item_id')) ? intval($_POST['item_id']) : 0); $item_id = ((x($_POST,'item_id')) ? intval($_POST['item_id']) : 0);
@ -436,19 +435,19 @@ function photos_post(&$a) {
$visibility = 0; $visibility = 0;
if($p[0]['desc'] !== $desc || strlen($rawtags)) if($p[0]['desc'] !== $desc || strlen($rawtags))
$visibility = 1; $visibility = 1;
if(! $item_id) { if(! $item_id) {
// Create item container // Create item container
$title = ''; $title = '';
$uri = item_new_uri($a->get_hostname(),$page_owner_uid); $uri = item_new_uri($a->get_hostname(),$page_owner_uid);
$arr = array(); $arr = array();
$arr['uid'] = $page_owner_uid; $arr['uid'] = $page_owner_uid;
$arr['uri'] = $uri; $arr['uri'] = $uri;
$arr['parent-uri'] = $uri; $arr['parent-uri'] = $uri;
$arr['type'] = 'photo'; $arr['type'] = 'photo';
$arr['wall'] = 1; $arr['wall'] = 1;
$arr['resource-id'] = $p[0]['resource-id']; $arr['resource-id'] = $p[0]['resource-id'];
@ -586,14 +585,17 @@ function photos_post(&$a) {
if(strlen($str_tags)) if(strlen($str_tags))
$str_tags .= ','; $str_tags .= ',';
$profile = str_replace(',','%2c',$profile); $profile = str_replace(',','%2c',$profile);
$str_tags .= '@[url=' . $profile . ']' . $newname . '[/url]'; $str_tags .= '@[url='.$profile.']'.$newname.'[/url]';
} }
} elseif (strpos($tag,'#') === 0) {
$tagname = substr($tag, 1);
$str_tags .= '#[url='.$a->get_baseurl()."/search?tag=".$tagname.']'.$tagname.'[/url]';
} }
} }
} }
$newtag = $old_tag; $newtag = $old_tag;
if(strlen($newtag) && strlen($str_tags)) if(strlen($newtag) && strlen($str_tags))
$newtag .= ','; $newtag .= ',';
$newtag .= $str_tags; $newtag .= $str_tags;
@ -672,11 +674,11 @@ function photos_post(&$a) {
$item_id = item_store($arr); $item_id = item_store($arr);
if($item_id) { if($item_id) {
q("UPDATE `item` SET `plink` = '%s' WHERE `uid` = %d AND `id` = %d", //q("UPDATE `item` SET `plink` = '%s' WHERE `uid` = %d AND `id` = %d",
dbesc($a->get_baseurl() . '/display/' . $owner_record['nickname'] . '/' . $item_id), // dbesc($a->get_baseurl() . '/display/' . $owner_record['nickname'] . '/' . $item_id),
intval($page_owner_uid), // intval($page_owner_uid),
intval($item_id) // intval($item_id)
); //);
proc_run('php',"include/notifier.php","tag","$item_id"); proc_run('php',"include/notifier.php","tag","$item_id");
} }
@ -880,13 +882,13 @@ function photos_post(&$a) {
$item_id = item_store($arr); $item_id = item_store($arr);
if($item_id) { //if($item_id) {
q("UPDATE `item` SET `plink` = '%s' WHERE `uid` = %d AND `id` = %d", // q("UPDATE `item` SET `plink` = '%s' WHERE `uid` = %d AND `id` = %d",
dbesc($a->get_baseurl() . '/display/' . $owner_record['nickname'] . '/' . $item_id), // dbesc($a->get_baseurl() . '/display/' . $owner_record['nickname'] . '/' . $item_id),
intval($page_owner_uid), // intval($page_owner_uid),
intval($item_id) // intval($item_id)
); // );
} //}
if($visible) if($visible)
proc_run('php', "include/notifier.php", 'wall-new', $item_id); proc_run('php', "include/notifier.php", 'wall-new', $item_id);

View File

@ -111,11 +111,11 @@ function poke_init(&$a) {
$item_id = item_store($arr); $item_id = item_store($arr);
if($item_id) { if($item_id) {
q("UPDATE `item` SET `plink` = '%s' WHERE `uid` = %d AND `id` = %d", //q("UPDATE `item` SET `plink` = '%s' WHERE `uid` = %d AND `id` = %d",
dbesc($a->get_baseurl() . '/display/' . $poster['nickname'] . '/' . $item_id), // dbesc($a->get_baseurl() . '/display/' . $poster['nickname'] . '/' . $item_id),
intval($uid), // intval($uid),
intval($item_id) // intval($item_id)
); //);
proc_run('php',"include/notifier.php","tag","$item_id"); proc_run('php',"include/notifier.php","tag","$item_id");
} }

View File

@ -558,10 +558,10 @@ function profile_activity($changed, $value) {
if($i) { if($i) {
// give it a permanent link // give it a permanent link
q("update item set plink = '%s' where id = %d", //q("update item set plink = '%s' where id = %d",
dbesc($a->get_baseurl() . '/display/' . $a->user['nickname'] . '/' . $i), // dbesc($a->get_baseurl() . '/display/' . $a->user['nickname'] . '/' . $i),
intval($i) // intval($i)
); //);
proc_run('php',"include/notifier.php","activity","$i"); proc_run('php',"include/notifier.php","activity","$i");

View File

@ -970,15 +970,15 @@ function settings_content(&$a) {
($a->user['page-flags'] == PAGE_NORMAL)), ($a->user['page-flags'] == PAGE_NORMAL)),
'$page_soapbox' => array('page-flags', t('Soapbox Page'), PAGE_SOAPBOX, '$page_soapbox' => array('page-flags', t('Soapbox Page'), PAGE_SOAPBOX,
t('Automatically approve all connection/friend requests as read-only fans'), t('Automatically approve all connection/friend requests as read-only fans'),
($a->user['page-flags'] == PAGE_SOAPBOX)), ($a->user['page-flags'] == PAGE_SOAPBOX)),
'$page_community' => array('page-flags', t('Community Forum/Celebrity Account'), PAGE_COMMUNITY, '$page_community' => array('page-flags', t('Community Forum/Celebrity Account'), PAGE_COMMUNITY,
t('Automatically approve all connection/friend requests as read-write fans'), t('Automatically approve all connection/friend requests as read-write fans'),
($a->user['page-flags'] == PAGE_COMMUNITY)), ($a->user['page-flags'] == PAGE_COMMUNITY)),
'$page_freelove' => array('page-flags', t('Automatic Friend Page'), PAGE_FREELOVE, '$page_freelove' => array('page-flags', t('Automatic Friend Page'), PAGE_FREELOVE,
t('Automatically approve all connection/friend requests as friends'), t('Automatically approve all connection/friend requests as friends'),
($a->user['page-flags'] == PAGE_FREELOVE)), ($a->user['page-flags'] == PAGE_FREELOVE)),
'$page_prvgroup' => array('page-flags', t('Private Forum [Experimental]'), PAGE_PRVGROUP, '$page_prvgroup' => array('page-flags', t('Private Forum [Experimental]'), PAGE_PRVGROUP,

View File

@ -138,10 +138,10 @@ EOT;
$post_id = item_store($arr); $post_id = item_store($arr);
q("UPDATE `item` set plink = '%s' where id = %d", // q("UPDATE `item` set plink = '%s' where id = %d",
dbesc($a->get_baseurl() . '/display/' . $owner_nick . '/' . $post_id), // dbesc($a->get_baseurl() . '/display/' . $owner_nick . '/' . $post_id),
intval($post_id) // intval($post_id)
); // );
if(! $item['visible']) { if(! $item['visible']) {

View File

@ -45,7 +45,7 @@ class Item extends BaseObject {
} }
} }
} }
$this->writable = ($this->get_data_value('writable') || $this->get_data_value('self')); $this->writable = ($this->get_data_value('writable') || $this->get_data_value('self'));
$ssl_state = ((local_user()) ? true : false); $ssl_state = ((local_user()) ? true : false);
@ -304,6 +304,7 @@ class Item extends BaseObject {
'body' => $body_e, 'body' => $body_e,
'text' => $text_e, 'text' => $text_e,
'id' => $this->get_id(), 'id' => $this->get_id(),
'guid' => $item['guid'],
'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])), 'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])),
'olinktitle' => sprintf( t('View %s\'s profile @ %s'), $this->get_owner_name(), ((strlen($item['owner-link'])) ? $item['owner-link'] : $item['url'])), 'olinktitle' => sprintf( t('View %s\'s profile @ %s'), $this->get_owner_name(), ((strlen($item['owner-link'])) ? $item['owner-link'] : $item['url'])),
'to' => t('to'), 'to' => t('to'),
@ -396,7 +397,7 @@ class Item extends BaseObject {
return $result; return $result;
} }
public function get_id() { public function get_id() {
return $this->get_data_value('id'); return $this->get_data_value('id');
} }
@ -427,7 +428,7 @@ class Item extends BaseObject {
if(activity_match($item->get_data_value('verb'),ACTIVITY_LIKE) || activity_match($item->get_data_value('verb'),ACTIVITY_DISLIKE)) { if(activity_match($item->get_data_value('verb'),ACTIVITY_LIKE) || activity_match($item->get_data_value('verb'),ACTIVITY_DISLIKE)) {
return false; return false;
} }
$item->set_parent($this); $item->set_parent($this);
$this->children[] = $item; $this->children[] = $item;
return end($this->children); return end($this->children);

View File

@ -32,7 +32,7 @@
<img id="like-rotator-{{$item.id}}" class="like-rotator" src="images/rotator.gif" alt="{{$item.wait}}" title="{{$item.wait}}" style="display: none;" /> <img id="like-rotator-{{$item.id}}" class="like-rotator" src="images/rotator.gif" alt="{{$item.wait}}" title="{{$item.wait}}" style="display: none;" />
</div> </div>
<div class="wall-item-container {{$item.indent}} {{$item.shiny}} {{$item.network}}" id="item-{{$item.id}}"> <div class="wall-item-container {{$item.indent}} {{$item.shiny}} {{$item.network}}" id="item-{{$item.guid}}">
<div class="wall-item-item"> <div class="wall-item-item">
<div class="wall-item-info"> <div class="wall-item-info">
<div class="contact-photo-wrapper mframe{{if $item.owner_url}} wwfrom{{/if}}" <div class="contact-photo-wrapper mframe{{if $item.owner_url}} wwfrom{{/if}}"