infrastructure for swat0 (#fsw)
This commit is contained in:
parent
36a77c6db2
commit
d8630dbdd8
|
@ -1023,7 +1023,7 @@ function atom_entry($item,$type,$author,$owner,$comment = false) {
|
|||
|
||||
$a = get_app();
|
||||
|
||||
$o = "<entry>\r\n";
|
||||
$o = "\r\n\r\n<entry>\r\n";
|
||||
|
||||
if(is_array($author))
|
||||
$o .= atom_author('author',$author['name'],$author['url'],80,80,$author['thumb']);
|
||||
|
@ -1033,7 +1033,7 @@ function atom_entry($item,$type,$author,$owner,$comment = false) {
|
|||
$o .= atom_author('dfrn:owner',$item['owner-name'],$item['owner-link'],80,80,$item['owner-avatar']);
|
||||
|
||||
if($item['parent'] != $item['id'])
|
||||
$o .= '<thr:in-reply-to ref="' . xmlify($item['parent-uri']) . '" />' . "\r\n";
|
||||
$o .= '<thr:in-reply-to ref="' . xmlify($item['parent-uri']) . '" type="text/html" href="' . xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id']) . '" />' . "\r\n";
|
||||
|
||||
$o .= '<id>' . xmlify($item['uri']) . '</id>' . "\r\n";
|
||||
$o .= '<title>' . xmlify($item['title']) . '</title>' . "\r\n";
|
||||
|
|
|
@ -119,13 +119,13 @@ function item_post(&$a) {
|
|||
$tags = get_tags($body);
|
||||
|
||||
|
||||
if($tags) {
|
||||
if(count($tags)) {
|
||||
foreach($tags as $tag) {
|
||||
if(strpos($tag,'@') === 0) {
|
||||
$name = substr($tag,1);
|
||||
if(strpos($name,'@')) {
|
||||
if((strpos($name,'@')) || (strpos($name,'http://'))) {
|
||||
$newname = $name;
|
||||
$links = @webfinger($name);
|
||||
$links = @lrdd($name);
|
||||
if(count($links)) {
|
||||
foreach($links as $link) {
|
||||
if($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page')
|
||||
|
|
131
mod/photos.php
131
mod/photos.php
|
@ -3,6 +3,7 @@
|
|||
require_once('Photo.php');
|
||||
require_once('include/items.php');
|
||||
require_once('view/acl_selectors.php');
|
||||
require_once('include/bbcode.php');
|
||||
|
||||
function photos_init(&$a) {
|
||||
|
||||
|
@ -179,19 +180,18 @@ function photos_post(&$a) {
|
|||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
if(($a->argc > 1) && ((x($_POST,'desc') !== false) || (x($_POST,'newtag') !== false))) {
|
||||
|
||||
|
||||
if(($a->argc > 1) && (x($_POST,'desc') !== false)) {
|
||||
$desc = notags(trim($_POST['desc']));
|
||||
$tags = notags(trim($_POST['tags']));
|
||||
$item_id = intval($_POST['item_id']);
|
||||
$desc = ((x($_POST,'desc')) ? notags(trim($_POST['desc'])) : '');
|
||||
$rawtags = ((x($_POST,'newtag')) ? notags(trim($_POST['newtag'])) : '');
|
||||
$item_id = ((x($_POST,'item_id')) ? intval($_POST['item_id']) : 0);
|
||||
$resource_id = $a->argv[1];
|
||||
|
||||
$p = q("SELECT * FROM `photo` WHERE `resource-id` = '%s' AND `uid` = %d ORDER BY `scale` DESC",
|
||||
dbesc($resource_id),
|
||||
intval(local_user())
|
||||
);
|
||||
if(count($r)) {
|
||||
if((count($p)) && ($p[0]['desc'] !== $desc)) {
|
||||
$r = q("UPDATE `photo` SET `desc` = '%s' WHERE `resource-id` = '%s' AND `uid` = %d",
|
||||
dbesc($desc),
|
||||
dbesc($resource_id),
|
||||
|
@ -200,10 +200,11 @@ function photos_post(&$a) {
|
|||
}
|
||||
if(! $item_id) {
|
||||
|
||||
// Create item container
|
||||
|
||||
$title = '';
|
||||
$basename = basename($filename);
|
||||
$uri = item_new_uri($a->get_hostname(),local_user());
|
||||
// Create item container
|
||||
|
||||
$arr = array();
|
||||
|
||||
|
@ -231,14 +232,100 @@ function photos_post(&$a) {
|
|||
|
||||
}
|
||||
|
||||
$r = q("UPDATE `item` SET `tag` = '%s', `edited` = '%s', `changed` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
dbesc($tags),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(datetime_convert()),
|
||||
intval($item_id),
|
||||
intval(local_user())
|
||||
);
|
||||
if($item_id) {
|
||||
$r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
intval($item_id),
|
||||
intval(local_user())
|
||||
);
|
||||
}
|
||||
if(count($r)) {
|
||||
$old_tag = $r[0]['tag'];
|
||||
$old_inform = $r[0]['inform'];
|
||||
}
|
||||
|
||||
if(strlen($rawtags)) {
|
||||
|
||||
$str_tags = '';
|
||||
$inform = '';
|
||||
|
||||
// if the new tag doesn't have a namespace specifier (@foo or #foo) give it a hashtag
|
||||
|
||||
$x = substr($rawtags,0,1);
|
||||
if($x !== '@' && $x !== '#')
|
||||
$rawtags = '#' . $rawtags;
|
||||
|
||||
$tags = get_tags($rawtags);
|
||||
|
||||
if(count($tags)) {
|
||||
foreach($tags as $tag) {
|
||||
if(strpos($tag,'@') === 0) {
|
||||
$name = substr($tag,1);
|
||||
if((strpos($name,'@')) || (strpos($name,'http://'))) {
|
||||
$newname = $name;
|
||||
$links = @lrdd($name);
|
||||
if(count($links)) {
|
||||
foreach($links as $link) {
|
||||
if($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page')
|
||||
$profile = $link['@attributes']['href'];
|
||||
if($link['@attributes']['rel'] === 'salmon') {
|
||||
if(strlen($inform))
|
||||
$inform .= ',';
|
||||
$inform .= 'url:' . str_replace(',','%2c',$link['@attributes']['href']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$newname = $name;
|
||||
if(strstr($name,'_')) {
|
||||
$newname = str_replace('_',' ',$name);
|
||||
$r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($newname),
|
||||
intval(local_user())
|
||||
);
|
||||
}
|
||||
else {
|
||||
$r = q("SELECT * FROM `contact` WHERE `nick` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($name),
|
||||
intval(local_user())
|
||||
);
|
||||
}
|
||||
if(count($r)) {
|
||||
$profile = $r[0]['url'];
|
||||
if(strlen($inform))
|
||||
$inform .= ',';
|
||||
$inform .= 'cid:' . $r[0]['id'];
|
||||
}
|
||||
}
|
||||
if($profile) {
|
||||
if(strlen($str_tags))
|
||||
$str_tags .= ',';
|
||||
$profile = str_replace(',','%2c',$profile);
|
||||
$str_tags .= '@[url=' . $profile . ']' . $newname . '[/url]';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$newtag = $old_tag;
|
||||
if(strlen($newtag) && strlen($str_tags))
|
||||
$newtag .= ',';
|
||||
$newtag .= $str_tags;
|
||||
|
||||
$newinform = $old_inform;
|
||||
if(strlen($newinform) && strlen($inform))
|
||||
$newinform .= ',';
|
||||
$newinform .= $inform;
|
||||
|
||||
$r = q("UPDATE `item` SET `tag` = '%s', `inform` = '%s', `edited` = '%s', `changed` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
dbesc($newtag),
|
||||
dbesc($newinform),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(datetime_convert()),
|
||||
intval($item_id),
|
||||
intval(local_user())
|
||||
);
|
||||
}
|
||||
goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
@ -656,9 +743,17 @@ function photos_content(&$a) {
|
|||
$o .= '<div id="photo-caption" >' . $ph[0]['desc'] . '</div>';
|
||||
|
||||
if(count($i1) && strlen($i1[0]['tag'])) {
|
||||
$arr = explode(',',$i1[0]['tag']);
|
||||
// parse tags and add links
|
||||
$o .= '<div id="in-this-photo-text">' . t('In this photo: ') . '</div>';
|
||||
$o .= '<div id="in-this-photo">' . $i1[0]['tag'] . '</div>';
|
||||
$o .= '<div id="in-this-photo-text">' . t('Tags: ') . '</div>';
|
||||
$o .= '<div id="in-this-photo">';
|
||||
$tag_str = '';
|
||||
foreach($arr as $t) {
|
||||
if(strlen($tag_str))
|
||||
$tag_str .= ', ';
|
||||
$tag_str .= bbcode($t);
|
||||
}
|
||||
$o .= $tag_str . '</div>';
|
||||
}
|
||||
|
||||
if($cmd === 'edit') {
|
||||
|
@ -668,8 +763,9 @@ function photos_content(&$a) {
|
|||
'$resource_id' => $ph[0]['resource-id'],
|
||||
'$capt_label' => t('Caption'),
|
||||
'$caption' => $ph[0]['desc'],
|
||||
'$tag_label' => t('Tags'),
|
||||
'$tag_label' => t('Add a Tag'),
|
||||
'$tags' => $i1[0]['tag'],
|
||||
'$help_tags' => t('Example: @bob, @Barbara_Jensen, @jim@example.com, #California, #camping'),
|
||||
'$item_id' => ((count($i1)) ? $i1[0]['id'] : 0),
|
||||
'$submit' => t('Submit'),
|
||||
'$delete' => t('Delete Photo')
|
||||
|
@ -678,7 +774,6 @@ function photos_content(&$a) {
|
|||
}
|
||||
|
||||
if(count($i1)) {
|
||||
// pull out how many people like the photo
|
||||
|
||||
$cmnt_tpl = load_view_file('view/comment_item.tpl');
|
||||
$tpl = load_view_file('view/photo_item.tpl');
|
||||
|
|
|
@ -18,6 +18,9 @@ $a->strings[' other people'] = ' other people';
|
|||
$a->strings[' like this.'] = ' like this.';
|
||||
$a->strings[' don\'t like this.'] = ' don\'t like this.';
|
||||
$a->strings["Invite Friends"] = "Invite Friends";
|
||||
$a->strings['Connect/Follow [profile address]'] = 'Connect/Follow [profile address]';
|
||||
$a->strings['Example: bob@example.com, http://example.com/barbara'] = 'Example: bob@example.com, http://example.com/barbara';
|
||||
$a->strings['Follow'] = 'Follow';
|
||||
$a->strings['Could not access contact record.'] = 'Could not access contact record.';
|
||||
$a->strings['Could not locate selected profile.'] = 'Could not locate selected profile.';
|
||||
$a->strings['Contact updated.'] = 'Contact updated.';
|
||||
|
@ -46,13 +49,13 @@ $a->strings['Find'] = 'Find';
|
|||
$a->strings['Visit '] = 'Visit ';
|
||||
$a->strings['\'s profile'] = '\'s profile';
|
||||
$a->strings['Edit contact'] = 'Edit contact';
|
||||
$a->strings['Profile not found.'] = 'Profile not found.';
|
||||
$a->strings['Response from remote site was not understood.'] = 'Response from remote site was not understood.';
|
||||
$a->strings['Unexpected response from remote site: '] = 'Unexpected response from remote site: ';
|
||||
$a->strings["Confirmation completed successfully."] = "Confirmation completed successfully.";
|
||||
$a->strings['Remote site reported: '] = 'Remote site reported: ';
|
||||
$a->strings["Temporary failure. Please wait and try again."] = "Temporary failure. Please wait and try again.";
|
||||
$a->strings["Introduction failed or was revoked."] = "Introduction failed or was revoked.";
|
||||
$a->strings['Contact Photos'] = 'Contact Photos';
|
||||
$a->strings['Unable to set contact photo.'] = 'Unable to set contact photo.';
|
||||
$a->strings['No user record found for '] = 'No user record found for ';
|
||||
$a->strings['Our site encryption key is apparently messed up.'] = 'Our site encryption key is apparently messed up.';
|
||||
|
@ -81,6 +84,7 @@ $a->strings['Profile unavailable.'] = 'Profile unavailable.';
|
|||
$a->strings["Invalid locator"] = "Invalid locator";
|
||||
$a->strings["Unable to resolve your name at the provided location."] = "Unable to resolve your name at the provided location.";
|
||||
$a->strings['You have already introduced yourself here.'] = 'You have already introduced yourself here.';
|
||||
$a->strings['Apparently you are already friends with .'] = 'Apparently you are already friends with .';
|
||||
$a->strings['Invalid profile URL.'] = 'Invalid profile URL.';
|
||||
$a->strings['Disallowed profile URL.'] = 'Disallowed profile URL.';
|
||||
$a->strings['Your introduction has been sent.'] = 'Your introduction has been sent.';
|
||||
|
@ -92,6 +96,9 @@ $a->strings['Item not found.'] = 'Item not found.';
|
|||
$a->strings['Private Message'] = 'Private Message';
|
||||
$a->strings['This is you'] = 'This is you';
|
||||
$a->strings['Item has been removed.'] = 'Item has been removed.';
|
||||
$a->strings['The profile address specified does not provide adequate information.'] = 'The profile address specified does not provide adequate information.';
|
||||
$a->strings['Unable to retrieve contact information.'] = 'Unable to retrieve contact information.';
|
||||
$a->strings['following'] = 'following';
|
||||
$a->strings['Group created.'] = 'Group created.';
|
||||
$a->strings['Could not create group.'] = 'Could not create group.';
|
||||
$a->strings['Group not found.'] = 'Group not found.';
|
||||
|
@ -132,6 +139,7 @@ $a->strings['doesn\'t like'] = 'doesn\'t like';
|
|||
$a->strings['\'s'] = '\'s';
|
||||
$a->strings['Visible to:'] = 'Visible to:';
|
||||
$a->strings['No recipient selected.'] = 'No recipient selected.';
|
||||
$a->strings['[no subject]'] = '[no subject]';
|
||||
$a->strings['Unable to locate contact information.'] = 'Unable to locate contact information.';
|
||||
$a->strings['Message sent.'] = 'Message sent.';
|
||||
$a->strings['Message could not be sent.'] = 'Message could not be sent.';
|
||||
|
@ -159,10 +167,14 @@ $a->strings['Discard'] = 'Discard';
|
|||
$a->strings['Ignore'] = 'Ignore';
|
||||
$a->strings['Show Ignored Requests'] = 'Show Ignored Requests';
|
||||
$a->strings['Hide Ignored Requests'] = 'Hide Ignored Requests';
|
||||
$a->strings['Claims to be known to you: '] = 'Claims to be known to you: ';
|
||||
$a->strings['yes'] = 'yes';
|
||||
$a->strings['no'] = 'no';
|
||||
$a->strings['Friend/Connect Request'] = 'Friend/Connect Request';
|
||||
$a->strings['New Follower'] = 'New Follower';
|
||||
$a->strings['No notifications.'] = 'No notifications.';
|
||||
$a->strings['Photo Albums'] = 'Photo Albums';
|
||||
$a->strings['Contact Photos'] = 'Contact Photos';
|
||||
$a->strings['Profile Photos'] = 'Profile Photos';
|
||||
$a->strings['Album not found.'] = 'Album not found.';
|
||||
$a->strings['Delete Album'] = 'Delete Album';
|
||||
|
@ -181,9 +193,10 @@ $a->strings['View Photo'] = 'View Photo';
|
|||
$a->strings['Photo not available'] = 'Photo not available';
|
||||
$a->strings['Edit photo'] = 'Edit photo';
|
||||
$a->strings['View Full Size'] = 'View Full Size';
|
||||
$a->strings['In this photo: '] = 'In this photo: ';
|
||||
$a->strings['Tags: '] = 'Tags: ';
|
||||
$a->strings['Caption'] = 'Caption';
|
||||
$a->strings['Tags'] = 'Tags';
|
||||
$a->strings['Add a Tag'] = 'Add a Tag';
|
||||
$a->strings['Example: @bob, @Barbara_Jensen, @jim@example.com, #California, #camping'] = 'Example: @bob, @Barbara_Jensen, @jim@example.com, #California, #camping';
|
||||
$a->strings['Recent Photos'] = 'Recent Photos';
|
||||
$a->strings['Upload New Photos'] = 'Upload New Photos';
|
||||
$a->strings['View Album'] = 'View Album';
|
||||
|
@ -194,7 +207,6 @@ $a->strings['Image size reduction [80] failed.'] = 'Image size reduction [80] fa
|
|||
$a->strings['Unable to process image'] = 'Unable to process image';
|
||||
$a->strings['Image uploaded successfully.'] = 'Image uploaded successfully.';
|
||||
$a->strings['Image size reduction [640] failed.'] = 'Image size reduction [640] failed.';
|
||||
$a->strings['Profile not found.'] = 'Profile not found.';
|
||||
$a->strings['Profile Name is required.'] = 'Profile Name is required.';
|
||||
$a->strings['Profile updated.'] = 'Profile updated.';
|
||||
$a->strings['Profile deleted.'] = 'Profile deleted.';
|
||||
|
@ -210,7 +222,6 @@ $a->strings[' Name too short.'] = ' Name too short.';
|
|||
$a->strings[' That doesn\'t appear to be your full name.'] = ' That doesn\'t appear to be your full name.';
|
||||
$a->strings[' Not valid email.'] = ' Not valid email.';
|
||||
$a->strings[' Your email domain is not among those allowed on this site.'] = ' Your email domain is not among those allowed on this site.';
|
||||
$a->strings[' Your email address is already registered on this system.'] = ' Your email address is already registered on this system.';
|
||||
$a->strings[' Nickname <strong>must</strong> start with a letter and contain only letters, numbers, dashes, or underscore.'] = ' Nickname <strong>must</strong> start with a letter and contain only letters, numbers, dashes, or underscore.';
|
||||
$a->strings[' Nickname is already registered. Please choose another.'] = ' Nickname is already registered. Please choose another.';
|
||||
$a->strings['An error occurred during registration. Please try again.'] = 'An error occurred during registration. Please try again.';
|
||||
|
@ -229,9 +240,8 @@ $a->strings['Passwords do not match. Password unchanged.'] = 'Passwords do not m
|
|||
$a->strings['Empty passwords are not allowed. Password unchanged.'] = 'Empty passwords are not allowed. Password unchanged.';
|
||||
$a->strings['Password changed.'] = 'Password changed.';
|
||||
$a->strings['Password update failed. Please try again.'] = 'Password update failed. Please try again.';
|
||||
$a->strings[' This email address is already registered.'] = ' This email address is already registered.';
|
||||
$a->strings['Settings updated.'] = 'Settings updated.';
|
||||
$a->strings['Profile is not published.'] = 'Profile is not published.';
|
||||
$a->strings['Profile is <strong>not published</strong>.'] = 'Profile is <strong>not published</strong>.';
|
||||
$a->strings['Default Post Permissions'] = 'Default Post Permissions';
|
||||
$a->strings['View Contacts'] = 'View Contacts';
|
||||
$a->strings['No contacts.'] = 'No contacts.';
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
<div id="photo-edit-caption-end"></div>
|
||||
|
||||
<label id="photo-edit-tags-label" for="photo-edit-tags-textarea" >$tag_label</label>
|
||||
<textarea name="tags" id="photo-edit-tags-textarea" rows="3" cols="64" >$tags</textarea>
|
||||
<label id="photo-edit-tags-label" for="photo-edit-newtag" >$tag_label</label>
|
||||
<input name="newtag" id="photo-edit-newtag" size="84" title="$help_tags" type="text" />
|
||||
<div id="photo-edit-tags-end"></div>
|
||||
|
||||
<input id="photo-edit-submit-button" type="submit" name="submit" value="$submit" />
|
||||
|
|
30
view/tag_slap.tpl
Normal file
30
view/tag_slap.tpl
Normal file
|
@ -0,0 +1,30 @@
|
|||
<entry>
|
||||
<author>
|
||||
<name>$name</name>
|
||||
<uri>$profile_page</uri>
|
||||
<link rel="photo" type="image/jpeg" media:width="80" media:height="80" href="$thumb" />
|
||||
<link rel="avatar" type="image/jpeg" media:width="80" media:height="80" href="$thumb" />
|
||||
</author>
|
||||
|
||||
<id>$item_id</id>
|
||||
<title>$title</title>
|
||||
<published>$published</published>
|
||||
<content type="$type" >$content</content>
|
||||
<link rel="mentioned" href="$accturi" />
|
||||
<as:actor>
|
||||
<as:object-type>http://activitystrea.ms/schema/1.0/person</as:object-type>
|
||||
<id>$profile_page</id>
|
||||
<title></title>
|
||||
<link rel="avatar" type="image/jpeg" media:width="175" media:height="175" href="$photo"/>
|
||||
<link rel="avatar" type="image/jpeg" media:width="80" media:height="80" href="$thumb"/>
|
||||
<poco:preferredUsername>$nick</poco:preferredUsername>
|
||||
<poco:displayName>$name</poco:displayName>
|
||||
</as:actor>
|
||||
<as:verb>$verb</as:verb>
|
||||
<as:object>
|
||||
<as:object-type></as:object-type>
|
||||
</as:object>
|
||||
<as:target>
|
||||
<as:object-type></as:object-type>
|
||||
</as:target>
|
||||
</entry>
|
|
@ -1680,9 +1680,9 @@ a.mail-list-link:hover {
|
|||
float: left;
|
||||
width: 150px;
|
||||
}
|
||||
#photo-edit-caption, #photo-edit-tags-textarea {
|
||||
#photo-edit-caption, #photo-edit-newtag {
|
||||
float: left;
|
||||
margin-bottom: 15px;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
#photo-edit-caption-end, #photo-edit-tags-end {
|
||||
|
@ -1692,6 +1692,9 @@ a.mail-list-link:hover {
|
|||
#photo-edit-delete-button {
|
||||
margin-left: 200px;
|
||||
}
|
||||
#photo-edit-end {
|
||||
margin-bottom: 35px;
|
||||
}
|
||||
#photo-caption {
|
||||
font-size: 110%;
|
||||
font-weight: bold;
|
||||
|
|
Loading…
Reference in a new issue