aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-10-01 18:02:11 -0700
committerfriendica <info@friendica.com>2012-10-01 18:02:11 -0700
commit846a9813b23911ae2a87d87fb6fd9f188ed84dc0 (patch)
treea8a78b379cc8f4e25812c5b2cac603c86b6b1472 /mod
parentd261fe271fdee747244c76f7ba4679b8372a2e8c (diff)
downloadvolse-hubzilla-846a9813b23911ae2a87d87fb6fd9f188ed84dc0.tar.gz
volse-hubzilla-846a9813b23911ae2a87d87fb6fd9f188ed84dc0.tar.bz2
volse-hubzilla-846a9813b23911ae2a87d87fb6fd9f188ed84dc0.zip
here's where the heavy lifting begins - everything is likely to be broken for quite some time as we add location and db independence to items and conversations and work through the rest of the permissions and how to federate the buggers.
Diffstat (limited to 'mod')
-rw-r--r--mod/fbrowser.php8
-rwxr-xr-xmod/install.php2
-rw-r--r--mod/item.php35
-rwxr-xr-xmod/like.php8
-rw-r--r--mod/lockview.php10
-rw-r--r--mod/photo.php6
-rw-r--r--mod/photos.php118
-rw-r--r--mod/ping.php3
-rw-r--r--mod/profile_photo.php20
-rw-r--r--mod/profiles.php13
-rwxr-xr-xmod/subthread.php160
-rw-r--r--mod/tagger.php4
12 files changed, 298 insertions, 89 deletions
diff --git a/mod/fbrowser.php b/mod/fbrowser.php
index 3f034226e..cdcde4b17 100644
--- a/mod/fbrowser.php
+++ b/mod/fbrowser.php
@@ -45,9 +45,9 @@ function fbrowser_content($a){
$path[]=array($a->get_baseurl()."/fbrowser/image/".$a->argv[2]."/", $album);
}
- $r = q("SELECT `resource-id`, `id`, `filename`, type, min(`scale`) AS `hiq`,max(`scale`) AS `loq`, `desc`
+ $r = q("SELECT `resource_id`, `id`, `filename`, type, min(`scale`) AS `hiq`,max(`scale`) AS `loq`, `desc`
FROM `photo` WHERE `uid` = %d $sql_extra
- GROUP BY `resource-id` $sql_extra2",
+ GROUP BY `resource_id` $sql_extra2",
intval(local_user())
);
@@ -56,9 +56,9 @@ function fbrowser_content($a){
$types = Photo::supportedTypes();
$ext = $types[$rr['type']];
return array(
- $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['hiq'] . '.' .$ext,
+ $a->get_baseurl() . '/photo/' . $rr['resource_id'] . '-' . $rr['hiq'] . '.' .$ext,
template_escape($rr['filename']),
- $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['loq'] . '.'. $ext
+ $a->get_baseurl() . '/photo/' . $rr['resource_id'] . '-' . $rr['loq'] . '.'. $ext
);
}
$files = array_map("files1", $r);
diff --git a/mod/install.php b/mod/install.php
index d2560f8eb..722b1f342 100755
--- a/mod/install.php
+++ b/mod/install.php
@@ -487,7 +487,7 @@ function what_next() {
."<p>".t('IMPORTANT: You will need to [manually] setup a scheduled task for the poller.')
.t('Please see the file "INSTALL.txt".')
."</p><p>"
- .t("Go to your new Friendica node <a href='$baseurl/register'>registration page</a> and register as new user. Remember to use the same email you have entered as administrator email. This will allow you to enter the site admin panel.")
+ .t("Go to your new Friendica node <a href='$baseurl/zregister'>registration page</a> and register as new user. Remember to use the same email you have entered as administrator email. This will allow you to enter the site admin panel.")
."</p>";
}
diff --git a/mod/item.php b/mod/item.php
index 1db18cc85..b135a4b3a 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -360,7 +360,7 @@ function item_post(&$a) {
$srch = '<' . intval($contact_id) . '>';
$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",
+ AND `resource_id` = '%s' AND `uid` = %d LIMIT 1",
dbesc($srch),
dbesc($image_uri),
intval($profile_uid)
@@ -371,7 +371,7 @@ function item_post(&$a) {
$r = q("UPDATE `photo` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s'
- WHERE `resource-id` = '%s' AND `uid` = %d 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),
@@ -540,7 +540,7 @@ function item_post(&$a) {
$uri = item_new_uri($a->get_hostname(),$profile_uid);
- // Fallback so that we alway have a thr-parent
+ // Fallback so that we alway have a thr_parent
if(!$thr_parent)
$thr_parent = $uri;
@@ -577,7 +577,7 @@ function item_post(&$a) {
$datarray['deny_gid'] = $str_group_deny;
$datarray['private'] = $private;
$datarray['attach'] = $attachments;
- $datarray['thr-parent'] = $thr_parent;
+ $datarray['thr_parent'] = $thr_parent;
$datarray['postopts'] = '';
$datarray['origin'] = $origin;
$datarray['moderated'] = $allow_moderated;
@@ -672,7 +672,7 @@ function item_post(&$a) {
$r = q("INSERT INTO `item` (`uid`,`type`,`wall`,`gravity`,`contact-id`,`owner-name`,`owner-link`,`owner-avatar`,
- `author-name`, `author-link`, `author-avatar`, `created`, `edited`, `commented`, `received`, `changed`, `uri`, `thr-parent`, `title`, `body`, `app`, `lang`, `location`, `coord`,
+ `author-name`, `author-link`, `author-avatar`, `created`, `edited`, `commented`, `received`, `changed`, `uri`, `thr_parent`, `title`, `body`, `app`, `lang`, `location`, `coord`,
`inform`, `verb`, `postopts`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `attach`,`origin`, `moderated`)
VALUES( %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, '%s', %d, %d )",
intval($datarray['uid']),
@@ -692,7 +692,7 @@ function item_post(&$a) {
dbesc($datarray['received']),
dbesc($datarray['changed']),
dbesc($datarray['uri']),
- dbesc($datarray['thr-parent']),
+ dbesc($datarray['thr_parent']),
dbesc($datarray['title']),
dbesc($datarray['body']),
dbesc($datarray['app']),
@@ -979,7 +979,26 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) {
intval($tagcid),
intval($profile_uid)
);
- } elseif(strstr($name,'_') || strstr($name,' ')) { //no id
+ }
+ else {
+ $newname = str_replace('_',' ',$name);
+
+ //select someone from this user's contacts by name
+ $r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
+ dbesc($newname),
+ intval($profile_uid)
+ );
+
+ if(! $r) {
+ //select someone by attag or nick and the name passed in
+ $r = q("SELECT * FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1",
+ dbesc($name),
+ dbesc($name),
+ intval($profile_uid)
+ );
+ }
+ }
+/* } elseif(strstr($name,'_') || strstr($name,' ')) { //no id
//get the real name
$newname = str_replace('_',' ',$name);
//select someone from this user's contacts by name
@@ -994,7 +1013,7 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) {
dbesc($name),
intval($profile_uid)
);
- }
+ }*/
//$r is set, if someone could be selected
if(count($r)) {
$profile = $r[0]['url'];
diff --git a/mod/like.php b/mod/like.php
index 13b56ec98..7ee9c3cb0 100755
--- a/mod/like.php
+++ b/mod/like.php
@@ -106,7 +106,7 @@ function like_content(&$a) {
$r = q("SELECT * FROM `item` WHERE `verb` = '%s' AND `deleted` = 0
- AND `contact-id` = %d AND ( `parent` = '%s' OR `parent_uri` = '%s' OR `thr-parent` = '%s') LIMIT 1",
+ AND `contact-id` = %d AND ( `parent` = '%s' OR `parent_uri` = '%s' OR `thr_parent` = '%s') LIMIT 1",
dbesc($activity),
intval($contact['id']),
dbesc($item_id),
@@ -129,8 +129,8 @@ function like_content(&$a) {
$uri = item_new_uri($a->get_hostname(),$owner_uid);
- $post_type = (($item['resource-id']) ? t('photo') : t('status'));
- $objtype = (($item['resource-id']) ? ACTIVITY_OBJ_PHOTO : ACTIVITY_OBJ_NOTE );
+ $post_type = (($item['resource_id']) ? t('photo') : t('status'));
+ $objtype = (($item['resource_id']) ? ACTIVITY_OBJ_PHOTO : ACTIVITY_OBJ_NOTE );
$link = xmlify('<link rel="alternate" type="text/html" href="' . $a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . '" />' . "\n") ;
$body = $item['body'];
@@ -164,7 +164,7 @@ EOT;
$arr['gravity'] = GRAVITY_LIKE;
$arr['parent'] = $item['id'];
$arr['parent_uri'] = $item['uri'];
- $arr['thr-parent'] = $item['uri'];
+ $arr['thr_parent'] = $item['uri'];
$arr['owner-name'] = $remote_owner['name'];
$arr['owner-link'] = $remote_owner['url'];
$arr['owner-avatar'] = $remote_owner['thumb'];
diff --git a/mod/lockview.php b/mod/lockview.php
index a832629f1..0307103f8 100644
--- a/mod/lockview.php
+++ b/mod/lockview.php
@@ -28,11 +28,6 @@ function lockview_content(&$a) {
killme();
- $allowed_users = expand_acl($item['allow_cid']);
- $allowed_groups = expand_acl($item['allow_gid']);
- $deny_users = expand_acl($item['deny_cid']);
- $deny_groups = expand_acl($item['deny_gid']);
-
if(($item['private'] == 1) && (! strlen($item['allow_cid'])) && (! strlen($item['allow_gid']))
&& (! strlen($item['deny_cid'])) && (! strlen($item['deny_gid']))) {
@@ -40,6 +35,11 @@ function lockview_content(&$a) {
killme();
}
+ $allowed_users = expand_acl($item['allow_cid']);
+ $allowed_groups = expand_acl($item['allow_gid']);
+ $deny_users = expand_acl($item['deny_cid']);
+ $deny_groups = expand_acl($item['deny_gid']);
+
$o = t('Visible to:') . '<br />';
$l = array();
diff --git a/mod/photo.php b/mod/photo.php
index 0c6425bd5..94354af24 100644
--- a/mod/photo.php
+++ b/mod/photo.php
@@ -83,7 +83,7 @@ function photo_init(&$a) {
$photo = substr($photo,0,-2);
}
- $r = q("SELECT `uid` FROM `photo` WHERE `resource-id` = '%s' AND `scale` = %d LIMIT 1",
+ $r = q("SELECT `uid` FROM `photo` WHERE `resource_id` = '%s' AND `scale` = %d LIMIT 1",
dbesc($photo),
intval($resolution)
);
@@ -93,7 +93,7 @@ function photo_init(&$a) {
// Now we'll see if we can access the photo
- $r = q("SELECT * FROM `photo` WHERE `resource-id` = '%s' AND `scale` = %d $sql_extra LIMIT 1",
+ $r = q("SELECT * FROM `photo` WHERE `resource_id` = '%s' AND `scale` = %d $sql_extra LIMIT 1",
dbesc($photo),
intval($resolution)
);
@@ -112,7 +112,7 @@ function photo_init(&$a) {
// they won't have the photo link, so there's a reasonable chance that the person
// might be able to obtain permission to view it.
- $r = q("SELECT * FROM `photo` WHERE `resource-id` = '%s' AND `scale` = %d LIMIT 1",
+ $r = q("SELECT * FROM `photo` WHERE `resource_id` = '%s' AND `scale` = %d LIMIT 1",
dbesc($photo),
intval($resolution)
);
diff --git a/mod/photos.php b/mod/photos.php
index 94fdc4152..25e04d79c 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -27,7 +27,7 @@ function photos_init(&$a) {
$sql_extra = permissions_sql($a->data['user']['uid']);
- $albums = q("SELECT distinct(`album`) AS `album` FROM `photo` WHERE `uid` = %d $sql_extra ",
+ $albums = q("SELECT distinct(`album`) AS `album` FROM `photo` WHERE `uid` = %d $sql_extra order by created desc",
intval($a->data['user']['uid'])
);
@@ -200,14 +200,14 @@ function photos_post(&$a) {
// get the list of photos we are about to delete
if($visitor) {
- $r = q("SELECT distinct(`resource-id`) as `rid` FROM `photo` WHERE `contact-id` = %d AND `uid` = %d AND `album` = '%s'",
+ $r = q("SELECT distinct(`resource_id`) as `rid` FROM `photo` WHERE `contact-id` = %d AND `uid` = %d AND `album` = '%s'",
intval($visitor),
intval($page_owner_uid),
dbesc($album)
);
}
else {
- $r = q("SELECT distinct(`resource-id`) as `rid` FROM `photo` WHERE `uid` = %d AND `album` = '%s'",
+ $r = q("SELECT distinct(`resource_id`) as `rid` FROM `photo` WHERE `uid` = %d AND `album` = '%s'",
intval(local_user()),
dbesc($album)
);
@@ -226,13 +226,13 @@ function photos_post(&$a) {
// remove the associated photos
- q("DELETE FROM `photo` WHERE `resource-id` IN ( $str_res ) AND `uid` = %d",
+ q("DELETE FROM `photo` WHERE `resource_id` IN ( $str_res ) AND `uid` = %d",
intval($page_owner_uid)
);
// find and delete the corresponding item with all the comments and likes/dislikes
- $r = q("SELECT `parent_uri` FROM `item` WHERE `resource-id` IN ( $str_res ) AND `uid` = %d",
+ $r = q("SELECT `parent_uri` FROM `item` WHERE `resource_id` IN ( $str_res ) AND `uid` = %d",
intval($page_owner_uid)
);
if(count($r)) {
@@ -261,25 +261,25 @@ function photos_post(&$a) {
// same as above but remove single photo
if($visitor) {
- $r = q("SELECT `id`, `resource-id` FROM `photo` WHERE `contact-id` = %d AND `uid` = %d AND `resource-id` = '%s' LIMIT 1",
+ $r = q("SELECT `id`, `resource_id` FROM `photo` WHERE `contact-id` = %d AND `uid` = %d AND `resource_id` = '%s' LIMIT 1",
intval($visitor),
intval($page_owner_uid),
dbesc($a->argv[2])
);
}
else {
- $r = q("SELECT `id`, `resource-id` FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s' LIMIT 1",
+ $r = q("SELECT `id`, `resource_id` FROM `photo` WHERE `uid` = %d AND `resource_id` = '%s' LIMIT 1",
intval(local_user()),
dbesc($a->argv[2])
);
}
if(count($r)) {
- q("DELETE FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s'",
+ q("DELETE FROM `photo` WHERE `uid` = %d AND `resource_id` = '%s'",
intval($page_owner_uid),
- dbesc($r[0]['resource-id'])
+ dbesc($r[0]['resource_id'])
);
- $i = q("SELECT * FROM `item` WHERE `resource-id` = '%s' AND `uid` = %d LIMIT 1",
- dbesc($r[0]['resource-id']),
+ $i = q("SELECT * FROM `item` WHERE `resource_id` = '%s' AND `uid` = %d LIMIT 1",
+ dbesc($r[0]['resource_id']),
intval($page_owner_uid)
);
if(count($i)) {
@@ -324,7 +324,7 @@ function photos_post(&$a) {
( (intval($_POST['rotate']) == 1) || (intval($_POST['rotate']) == 2) )) {
logger('rotate');
- $r = q("select * from photo where `resource-id` = '%s' and uid = %d and scale = 0 limit 1",
+ $r = q("select * from photo where `resource_id` = '%s' and uid = %d and scale = 0 limit 1",
dbesc($resource_id),
intval($page_owner_uid)
);
@@ -337,7 +337,7 @@ function photos_post(&$a) {
$width = $ph->getWidth();
$height = $ph->getHeight();
- $x = q("update photo set data = '%s', height = %d, width = %d where `resource-id` = '%s' and uid = %d and scale = 0 limit 1",
+ $x = q("update photo set data = '%s', height = %d, width = %d where `resource_id` = '%s' and uid = %d and scale = 0 limit 1",
dbesc($ph->imageString()),
intval($height),
intval($width),
@@ -350,7 +350,7 @@ function photos_post(&$a) {
$width = $ph->getWidth();
$height = $ph->getHeight();
- $x = q("update photo set data = '%s', height = %d, width = %d where `resource-id` = '%s' and uid = %d and scale = 1 limit 1",
+ $x = q("update photo set data = '%s', height = %d, width = %d where `resource_id` = '%s' and uid = %d and scale = 1 limit 1",
dbesc($ph->imageString()),
intval($height),
intval($width),
@@ -364,7 +364,7 @@ function photos_post(&$a) {
$width = $ph->getWidth();
$height = $ph->getHeight();
- $x = q("update photo set data = '%s', height = %d, width = %d where `resource-id` = '%s' and uid = %d and scale = 2 limit 1",
+ $x = q("update photo set data = '%s', height = %d, width = %d where `resource_id` = '%s' and uid = %d and scale = 2 limit 1",
dbesc($ph->imageString()),
intval($height),
intval($width),
@@ -376,13 +376,13 @@ function photos_post(&$a) {
}
}
- $p = q("SELECT * FROM `photo` WHERE `resource-id` = '%s' AND `uid` = %d ORDER BY `scale` DESC",
+ $p = q("SELECT * FROM `photo` WHERE `resource_id` = '%s' AND `uid` = %d ORDER BY `scale` DESC",
dbesc($resource_id),
intval($page_owner_uid)
);
if(count($p)) {
$ext = $phototypes[$p[0]['type']];
- $r = q("UPDATE `photo` SET `desc` = '%s', `album` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s' WHERE `resource-id` = '%s' AND `uid` = %d",
+ $r = q("UPDATE `photo` SET `desc` = '%s', `album` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s' WHERE `resource_id` = '%s' AND `uid` = %d",
dbesc($desc),
dbesc($albname),
dbesc($str_contact_allow),
@@ -414,7 +414,7 @@ function photos_post(&$a) {
$arr['parent_uri'] = $uri;
$arr['type'] = 'photo';
$arr['wall'] = 1;
- $arr['resource-id'] = $p[0]['resource-id'];
+ $arr['resource_id'] = $p[0]['resource_id'];
$arr['contact-id'] = $owner_record['id'];
$arr['owner-name'] = $owner_record['name'];
$arr['owner-link'] = $owner_record['url'];
@@ -430,8 +430,8 @@ function photos_post(&$a) {
$arr['visible'] = $visibility;
$arr['origin'] = 1;
- $arr['body'] = '[url=' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $p[0]['resource-id'] . ']'
- . '[img]' . $a->get_baseurl() . '/photo/' . $p[0]['resource-id'] . '-' . $p[0]['scale'] . '.'. $ext . '[/img]'
+ $arr['body'] = '[url=' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $p[0]['resource_id'] . ']'
+ . '[img]' . $a->get_baseurl() . '/photo/' . $p[0]['resource_id'] . '-' . $p[0]['scale'] . '.'. $ext . '[/img]'
. '[/url]';
$item_id = item_store($arr);
@@ -499,7 +499,25 @@ function photos_post(&$a) {
intval($profile_uid)
);
}
- elseif(strstr($name,'_') || strstr($name,' ')) {
+ else {
+ $newname = str_replace('_',' ',$name);
+
+ //select someone from this user's contacts by name
+ $r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
+ dbesc($newname),
+ intval($page_owner_uid)
+ );
+
+ if(! $r) {
+ //select someone by attag or nick and the name passed in
+ $r = q("SELECT * FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1",
+ dbesc($name),
+ dbesc($name),
+ intval($page_owner_uid)
+ );
+ }
+ }
+/* elseif(strstr($name,'_') || strstr($name,' ')) {
$newname = str_replace('_',' ',$name);
$r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
dbesc($newname),
@@ -512,7 +530,7 @@ function photos_post(&$a) {
dbesc($name),
intval($page_owner_uid)
);
- }
+ }*/
if(count($r)) {
$newname = $r[0]['name'];
$profile = $r[0]['url'];
@@ -598,8 +616,8 @@ function photos_post(&$a) {
$arr['tag'] = $tagged[4];
$arr['inform'] = $tagged[2];
$arr['origin'] = 1;
- $arr['body'] = '[url=' . $tagged[1] . ']' . $tagged[0] . '[/url]' . ' ' . t('was tagged in a') . ' ' . '[url=' . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . ']' . t('photo') . '[/url]' . ' ' . t('by') . ' ' . '[url=' . $owner_record['url'] . ']' . $owner_record['name'] . '[/url]' ;
- $arr['body'] .= "\n\n" . '[url=' . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . ']' . '[img]' . $a->get_baseurl() . "/photo/" . $p[0]['resource-id'] . '-' . $best . '.' . $ext . '[/img][/url]' . "\n" ;
+ $arr['body'] = '[url=' . $tagged[1] . ']' . $tagged[0] . '[/url]' . ' ' . t('was tagged in a') . ' ' . '[url=' . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource_id'] . ']' . t('photo') . '[/url]' . ' ' . t('by') . ' ' . '[url=' . $owner_record['url'] . ']' . $owner_record['name'] . '[/url]' ;
+ $arr['body'] .= "\n\n" . '[url=' . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource_id'] . ']' . '[img]' . $a->get_baseurl() . "/photo/" . $p[0]['resource_id'] . '-' . $best . '.' . $ext . '[/img][/url]' . "\n" ;
$arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $tagged[0] . '</title><id>' . $tagged[1] . '/' . $tagged[0] . '</id>';
$arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $tagged[1] . '" />' . "\n");
@@ -608,8 +626,8 @@ function photos_post(&$a) {
$arr['object'] .= '</link></object>' . "\n";
$arr['target'] = '<target><type>' . ACTIVITY_OBJ_PHOTO . '</type><title>' . $p[0]['desc'] . '</title><id>'
- . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . '</id>';
- $arr['target'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . '" />' . "\n" . '<link rel="preview" type="'.$p[0]['type'].'" href="' . $a->get_baseurl() . "/photo/" . $p[0]['resource-id'] . '-' . $best . '.' . $ext . '" />') . '</link></target>';
+ . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource_id'] . '</id>';
+ $arr['target'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource_id'] . '" />' . "\n" . '<link rel="preview" type="'.$p[0]['type'].'" href="' . $a->get_baseurl() . "/photo/" . $p[0]['resource_id'] . '-' . $best . '.' . $ext . '" />') . '</link></target>';
$item_id = item_store($arr);
if($item_id) {
@@ -798,7 +816,7 @@ function photos_post(&$a) {
$arr['parent_uri'] = $uri;
$arr['type'] = 'photo';
$arr['wall'] = 1;
- $arr['resource-id'] = $photo_hash;
+ $arr['resource_id'] = $photo_hash;
$arr['contact-id'] = $owner_record['id'];
$arr['owner-name'] = $owner_record['name'];
$arr['owner-link'] = $owner_record['url'];
@@ -1062,8 +1080,8 @@ function photos_content(&$a) {
$album = hex2bin($datum);
- $r = q("SELECT `resource-id`, max(`scale`) AS `scale` FROM `photo` WHERE `uid` = %d AND `album` = '%s'
- AND `scale` <= 4 $sql_extra GROUP BY `resource-id`",
+ $r = q("SELECT `resource_id`, max(`scale`) AS `scale` FROM `photo` WHERE `uid` = %d AND `album` = '%s'
+ AND `scale` <= 4 $sql_extra GROUP BY `resource_id`",
intval($owner_uid),
dbesc($album)
);
@@ -1077,8 +1095,8 @@ function photos_content(&$a) {
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` $order LIMIT %d , %d",
+ $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` $order LIMIT %d , %d",
intval($owner_uid),
dbesc($album),
intval($a->pager['start']),
@@ -1137,10 +1155,10 @@ 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,
+ '$imgsrc' => $a->get_baseurl() . '/photo/' . $rr['resource_id'] . '-' . $rr['scale'] . '.' .$ext,
'$imgalt' => template_escape($rr['filename']),
'$desc'=> template_escape($rr['desc'])
));
@@ -1161,14 +1179,14 @@ function photos_content(&$a) {
//$o = '';
// fetch image, item containing image, then comments
- $ph = q("SELECT * FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s'
+ $ph = q("SELECT * FROM `photo` WHERE `uid` = %d AND `resource_id` = '%s'
$sql_extra ORDER BY `scale` ASC ",
intval($owner_uid),
dbesc($datum)
);
if(! count($ph)) {
- $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'
LIMIT 1",
intval($owner_uid),
dbesc($datum)
@@ -1189,7 +1207,7 @@ function photos_content(&$a) {
$order = 'DESC';
- $prvnxt = q("SELECT `resource-id` FROM `photo` WHERE `album` = '%s' AND `uid` = %d AND `scale` = 0
+ $prvnxt = q("SELECT `resource_id` FROM `photo` WHERE `album` = '%s' AND `uid` = %d AND `scale` = 0
$sql_extra ORDER BY `created` $order ",
dbesc($ph[0]['album']),
intval($owner_uid)
@@ -1197,7 +1215,7 @@ function photos_content(&$a) {
if(count($prvnxt)) {
for($z = 0; $z < count($prvnxt); $z++) {
- if($prvnxt[$z]['resource-id'] == $ph[0]['resource-id']) {
+ if($prvnxt[$z]['resource_id'] == $ph[0]['resource_id']) {
$prv = $z - 1;
$nxt = $z + 1;
if($prv < 0)
@@ -1208,8 +1226,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 . (($_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' : '');
+ $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' : '');
}
@@ -1233,7 +1251,7 @@ function photos_content(&$a) {
if($can_post && ($ph[0]['uid'] == $owner_uid)) {
$tools = array(
'edit' => array($a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $datum . (($cmd === 'edit') ? '' : '/edit'), (($cmd === 'edit') ? t('View photo') : t('Edit photo'))),
- 'profile'=>array($a->get_baseurl() . '/profile_photo/use/'.$ph[0]['resource-id'], t('Use as profile photo')),
+ 'profile'=>array($a->get_baseurl() . '/profile_photo/use/'.$ph[0]['resource_id'], t('Use as profile photo')),
);
// lock
@@ -1260,9 +1278,9 @@ function photos_content(&$a) {
$prevlink = array($prevlink, '<div class="icon prev"></div>') ;
$photo = array(
- 'href' => $a->get_baseurl() . '/photo/' . $hires['resource-id'] . '-' . $hires['scale'] . '.' . $phototypes[$hires['type']],
+ 'href' => $a->get_baseurl() . '/photo/' . $hires['resource_id'] . '-' . $hires['scale'] . '.' . $phototypes[$hires['type']],
'title'=> t('View Full Size'),
- 'src' => $a->get_baseurl() . '/photo/' . $lores['resource-id'] . '-' . $lores['scale'] . '.' . $phototypes[$lores['type']] . '?f=&_u=' . datetime_convert('','','','ymdhis')
+ 'src' => $a->get_baseurl() . '/photo/' . $lores['resource_id'] . '-' . $lores['scale'] . '.' . $phototypes[$lores['type']] . '?f=&_u=' . datetime_convert('','','','ymdhis')
);
if($nextlink)
@@ -1271,7 +1289,7 @@ function photos_content(&$a) {
// Do we have an item for this photo?
- $linked_items = q("SELECT * FROM `item` WHERE `resource-id` = '%s' $sql_extra LIMIT 1",
+ $linked_items = q("SELECT * FROM `item` WHERE `resource_id` = '%s' $sql_extra LIMIT 1",
dbesc($datum)
);
if(count($linked_items)) {
@@ -1347,7 +1365,7 @@ function photos_content(&$a) {
'$album' => template_escape($ph[0]['album']),
'$newalbum' => t('New album name'),
'$nickname' => $a->data['user']['nickname'],
- '$resource_id' => $ph[0]['resource-id'],
+ '$resource_id' => $ph[0]['resource_id'],
'$capt_label' => t('Caption'),
'$caption' => template_escape($ph[0]['desc']),
'$tag_label' => t('Add a Tag'),
@@ -1534,8 +1552,8 @@ function photos_content(&$a) {
// Default - show recent photos with upload link (if applicable)
//$o = '';
- $r = q("SELECT `resource-id`, max(`scale`) AS `scale` FROM `photo` WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s'
- $sql_extra GROUP BY `resource-id`",
+ $r = q("SELECT `resource_id`, max(`scale`) AS `scale` FROM `photo` WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s'
+ $sql_extra GROUP BY `resource_id`",
intval($a->data['user']['uid']),
dbesc('Contact Photos'),
dbesc( t('Contact Photos'))
@@ -1545,9 +1563,9 @@ function photos_content(&$a) {
$a->set_pager_itemspage(20);
}
- $r = q("SELECT `resource-id`, `id`, `filename`, type, `album`, max(`scale`) AS `scale` FROM `photo`
+ $r = q("SELECT `resource_id`, `id`, `filename`, type, `album`, max(`scale`) AS `scale` FROM `photo`
WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s'
- $sql_extra GROUP BY `resource-id` ORDER BY `created` DESC LIMIT %d , %d",
+ $sql_extra GROUP BY `resource_id` ORDER BY `created` DESC LIMIT %d , %d",
intval($a->data['user']['uid']),
dbesc('Contact Photos'),
dbesc( t('Contact Photos')),
@@ -1570,9 +1588,9 @@ function photos_content(&$a) {
$photos[] = array(
'id' => $rr['id'],
'twist' => ' ' . $twist . rand(2,4),
- 'link' => $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $rr['resource-id'],
+ 'link' => $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $rr['resource_id'],
'title' => t('View Photo'),
- 'src' => $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . ((($rr['scale']) == 6) ? 4 : $rr['scale']) . '.' . $ext,
+ 'src' => $a->get_baseurl() . '/photo/' . $rr['resource_id'] . '-' . ((($rr['scale']) == 6) ? 4 : $rr['scale']) . '.' . $ext,
'alt' => template_escape($rr['filename']),
'album' => array(
'link' => $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($rr['album']),
diff --git a/mod/ping.php b/mod/ping.php
index 21f36a163..c9c9b5ecf 100644
--- a/mod/ping.php
+++ b/mod/ping.php
@@ -111,7 +111,8 @@ function ping_init(&$a) {
if(count($r)) {
- call_hooks('network_ping', array('items' => $r));
+ $arr = array('items' => $r);
+ call_hooks('network_ping', $arr);
foreach ($r as $it) {
if($it['wall'])
diff --git a/mod/profile_photo.php b/mod/profile_photo.php
index 3bde6a99d..03bcae4c4 100644
--- a/mod/profile_photo.php
+++ b/mod/profile_photo.php
@@ -59,7 +59,7 @@ function profile_photo_post(&$a) {
$srcW = $_POST['xfinal'] - $srcX;
$srcH = $_POST['yfinal'] - $srcY;
- $r = q("SELECT * FROM `photo` WHERE `resource-id` = '%s' AND `uid` = %d AND `scale` = %d LIMIT 1",
+ $r = q("SELECT * FROM `photo` WHERE `resource_id` = '%s' AND `uid` = %d AND `scale` = %d LIMIT 1",
dbesc($image_id),
dbesc(local_user()),
intval($scale));
@@ -72,21 +72,21 @@ function profile_photo_post(&$a) {
if($im->is_valid()) {
$im->cropImage(175,$srcX,$srcY,$srcW,$srcH);
- $r = $im->store(local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 4, $is_default_profile);
+ $r = $im->store(local_user(), 0, $base_image['resource_id'],$base_image['filename'], t('Profile Photos'), 4, $is_default_profile);
if($r === false)
notice ( sprintf(t('Image size reduction [%s] failed.'),"175") . EOL );
$im->scaleImage(80);
- $r = $im->store(local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 5, $is_default_profile);
+ $r = $im->store(local_user(), 0, $base_image['resource_id'],$base_image['filename'], t('Profile Photos'), 5, $is_default_profile);
if($r === false)
notice( sprintf(t('Image size reduction [%s] failed.'),"80") . EOL );
$im->scaleImage(48);
- $r = $im->store(local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 6, $is_default_profile);
+ $r = $im->store(local_user(), 0, $base_image['resource_id'],$base_image['filename'], t('Profile Photos'), 6, $is_default_profile);
if($r === false)
notice( sprintf(t('Image size reduction [%s] failed.'),"48") . EOL );
@@ -94,15 +94,15 @@ function profile_photo_post(&$a) {
// If setting for the default profile, unset the profile photo flag from any other photos I own
if($is_default_profile) {
- $r = q("UPDATE `photo` SET `profile` = 0 WHERE `profile` = 1 AND `resource-id` != '%s' AND `uid` = %d",
- dbesc($base_image['resource-id']),
+ $r = q("UPDATE `photo` SET `profile` = 0 WHERE `profile` = 1 AND `resource_id` != '%s' AND `uid` = %d",
+ dbesc($base_image['resource_id']),
intval(local_user())
);
}
else {
$r = q("update profile set photo = '%s', thumb = '%s' where id = %d and uid = %d limit 1",
- dbesc($a->get_baseurl() . '/photo/' . $base_image['resource-id'] . '-4'),
- dbesc($a->get_baseurl() . '/photo/' . $base_image['resource-id'] . '-5'),
+ dbesc($a->get_baseurl() . '/photo/' . $base_image['resource_id'] . '-4'),
+ dbesc($a->get_baseurl() . '/photo/' . $base_image['resource_id'] . '-5'),
intval($_REQUEST['profile']),
intval(local_user())
);
@@ -183,7 +183,7 @@ function profile_photo_content(&$a) {
$resource_id = $a->argv[2];
//die(":".local_user());
- $r=q("SELECT * FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s' ORDER BY `scale` ASC",
+ $r=q("SELECT * FROM `photo` WHERE `uid` = %d AND `resource_id` = '%s' ORDER BY `scale` ASC",
intval(local_user()),
dbesc($resource_id)
);
@@ -203,7 +203,7 @@ function profile_photo_content(&$a) {
$r=q("UPDATE `photo` SET `profile`=0 WHERE `profile`=1 AND `uid`=%d",
intval(local_user()));
- $r=q("UPDATE `photo` SET `profile`=1 WHERE `uid` = %d AND `resource-id` = '%s'",
+ $r=q("UPDATE `photo` SET `profile`=1 WHERE `uid` = %d AND `resource_id` = '%s'",
intval(local_user()),
dbesc($resource_id)
);
diff --git a/mod/profiles.php b/mod/profiles.php
index 8a146d6a8..8679f3026 100644
--- a/mod/profiles.php
+++ b/mod/profiles.php
@@ -96,7 +96,7 @@ function profiles_post(&$a) {
}
else {
$newname = $lookup;
- if(strstr($lookup,' ')) {
+/* if(strstr($lookup,' ')) {
$r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
dbesc($newname),
intval(local_user())
@@ -107,6 +107,17 @@ function profiles_post(&$a) {
dbesc($lookup),
intval(local_user())
);
+ }*/
+
+ $r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
+ dbesc($newname),
+ intval(local_user())
+ );
+ if(! $r) {
+ $r = q("SELECT * FROM `contact` WHERE `nick` = '%s' AND `uid` = %d LIMIT 1",
+ dbesc($lookup),
+ intval(local_user())
+ );
}
if(count($r)) {
$prf = $r[0]['url'];
diff --git a/mod/subthread.php b/mod/subthread.php
new file mode 100755
index 000000000..b6e8c476a
--- /dev/null
+++ b/mod/subthread.php
@@ -0,0 +1,160 @@
+<?php
+
+require_once('include/security.php');
+require_once('include/bbcode.php');
+require_once('include/items.php');
+
+
+function subthread_content(&$a) {
+
+ if(! local_user() && ! remote_user()) {
+ return;
+ }
+
+ $activity = ACTIVITY_FOLLOW;
+
+ $item_id = (($a->argc > 1) ? notags(trim($a->argv[1])) : 0);
+
+ $r = q("SELECT * FROM `item` WHERE `parent` = '%s' OR `parent-uri` = '%s' and parent = id LIMIT 1",
+ dbesc($item_id),
+ dbesc($item_id)
+ );
+
+ if(! $item_id || (! count($r))) {
+ logger('subthread: no item ' . $item_id);
+ return;
+ }
+
+ $item = $r[0];
+
+ $owner_uid = $item['uid'];
+
+ if(! can_write_wall($a,$owner_uid)) {
+ return;
+ }
+
+ $remote_owner = null;
+
+ if(! $item['wall']) {
+ // The top level post may have been written by somebody on another system
+ $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ intval($item['contact-id']),
+ intval($item['uid'])
+ );
+ if(! count($r))
+ return;
+ if(! $r[0]['self'])
+ $remote_owner = $r[0];
+ }
+
+ // this represents the post owner on this system.
+
+ $r = q("SELECT `contact`.*, `user`.`nickname` FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid`
+ WHERE `contact`.`self` = 1 AND `contact`.`uid` = %d LIMIT 1",
+ intval($owner_uid)
+ );
+ if(count($r))
+ $owner = $r[0];
+
+ if(! $owner) {
+ logger('like: no owner');
+ return;
+ }
+
+ if(! $remote_owner)
+ $remote_owner = $owner;
+
+
+ // This represents the person posting
+
+ if((local_user()) && (local_user() == $owner_uid)) {
+ $contact = $owner;
+ }
+ else {
+ $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ intval($_SESSION['visitor_id']),
+ intval($owner_uid)
+ );
+ if(count($r))
+ $contact = $r[0];
+ }
+ if(! $contact) {
+ return;
+ }
+
+ $uri = item_new_uri($a->get_hostname(),$owner_uid);
+
+ $post_type = (($item['resource_id']) ? t('photo') : t('status'));
+ $objtype = (($item['resource_id']) ? ACTIVITY_OBJ_PHOTO : ACTIVITY_OBJ_NOTE );
+ $link = xmlify('<link rel="alternate" type="text/html" href="' . $a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . '" />' . "\n") ;
+ $body = $item['body'];
+
+ $obj = <<< EOT
+
+ <object>
+ <type>$objtype</type>
+ <local>1</local>
+ <id>{$item['uri']}</id>
+ <link>$link</link>
+ <title></title>
+ <content>$body</content>
+ </object>
+EOT;
+ $bodyverb = t('%1$s is following %2$s\'s %3$s');
+
+ if(! isset($bodyverb))
+ return;
+
+ $arr = array();
+
+ $arr['uri'] = $uri;
+ $arr['uid'] = $owner_uid;
+ $arr['contact-id'] = $contact['id'];
+ $arr['type'] = 'activity';
+ $arr['wall'] = $item['wall'];
+ $arr['origin'] = 1;
+ $arr['gravity'] = GRAVITY_LIKE;
+ $arr['parent'] = $item['id'];
+ $arr['parent-uri'] = $item['uri'];
+ $arr['thr_parent'] = $item['uri'];
+ $arr['owner-name'] = $remote_owner['name'];
+ $arr['owner-link'] = $remote_owner['url'];
+ $arr['owner-avatar'] = $remote_owner['thumb'];
+ $arr['author-name'] = $contact['name'];
+ $arr['author-link'] = $contact['url'];
+ $arr['author-avatar'] = $contact['thumb'];
+
+ $ulink = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]';
+ $alink = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
+ $plink = '[url=' . $a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . ']' . $post_type . '[/url]';
+ $arr['body'] = sprintf( $bodyverb, $ulink, $alink, $plink );
+
+ $arr['verb'] = $activity;
+ $arr['object-type'] = $objtype;
+ $arr['object'] = $obj;
+ $arr['allow_cid'] = $item['allow_cid'];
+ $arr['allow_gid'] = $item['allow_gid'];
+ $arr['deny_cid'] = $item['deny_cid'];
+ $arr['deny_gid'] = $item['deny_gid'];
+ $arr['visible'] = 1;
+ $arr['unseen'] = 1;
+ $arr['last-child'] = 0;
+
+ $post_id = item_store($arr);
+
+ if(! $item['visible']) {
+ $r = q("UPDATE `item` SET `visible` = 1 WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ intval($item['id']),
+ intval($owner_uid)
+ );
+ }
+
+ $arr['id'] = $post_id;
+
+ call_hooks('post_local_end', $arr);
+
+ killme();
+
+}
+
+
diff --git a/mod/tagger.php b/mod/tagger.php
index 653848765..bf05d2e4c 100644
--- a/mod/tagger.php
+++ b/mod/tagger.php
@@ -59,8 +59,8 @@ function tagger_content(&$a) {
$uri = item_new_uri($a->get_hostname(),$owner_uid);
$xterm = xmlify($term);
- $post_type = (($item['resource-id']) ? t('photo') : t('status'));
- $targettype = (($item['resource-id']) ? ACTIVITY_OBJ_PHOTO : ACTIVITY_OBJ_NOTE );
+ $post_type = (($item['resource_id']) ? t('photo') : t('status'));
+ $targettype = (($item['resource_id']) ? ACTIVITY_OBJ_PHOTO : ACTIVITY_OBJ_NOTE );
$link = xmlify('<link rel="alternate" type="text/html" href="'
. $a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . '" />' . "\n") ;