]> git.mxchange.org Git - friendica.git/blobdiff - mod/photos.php
use sha1 keys for friends as well
[friendica.git] / mod / photos.php
index a3aa69216284050557ac135e973f5f61b9b2e52d..f570d5b13ed376efec631788aba9ef599630caa7 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 
-require_once('Photo.php');
+require_once('include/Photo.php');
 require_once('include/items.php');
-require_once('view/acl_selectors.php');
+require_once('include/acl_selectors.php');
 require_once('include/bbcode.php');
 
 function photos_init(&$a) {
@@ -150,7 +150,7 @@ function photos_post(&$a) {
        }
 
        if(($a->argc > 1) && (x($_POST,'delete')) && ($_POST['delete'] == t('Delete Photo'))) {
-               $r = q("SELECT `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[1])
                );
@@ -312,9 +312,9 @@ function photos_post(&$a) {
                                                }
                                                if($profile) {
                                                        if(substr($notify,0,4) === 'cid:')
-                                                               $taginfo[] = array($newname,$profile,$notify,$r[0]);
+                                                               $taginfo[] = array($newname,$profile,$notify,$r[0],'@[url=' . str_replace(',','%2c',$profile) . ']' . $newname  . '[/url]');
                                                        else
-                                                               $taginfo[] = array($newname,$profile,$notify,null);
+                                                               $taginfo[] = array($newname,$profile,$notify,null,$str_tags .= '@[url=' . $profile . ']' . $newname     . '[/url]');
                                                        if(strlen($str_tags))
                                                                $str_tags .= ',';
                                                        $profile = str_replace(',','%2c',$profile);
@@ -384,6 +384,7 @@ function photos_post(&$a) {
                                        $arr['verb']          = ACTIVITY_TAG;
                                        $arr['object-type']   = ACTIVITY_OBJ_PERSON;
                                        $arr['target-type']   = ACTIVITY_OBJ_PHOTO;
+                                       $arr['tag']           = $tagged[4];
                                        $arr['inform']        = $tagged[2];
 
                                        $arr['body']          = '[url=' . $tagged[1] . ']' . $tagged[0] . '[/url]' . ' ' . t('was tagged in a') . ' ' . '[url=' . $a->get_baseurl() . '/photos/' . $contact_record['nickname'] . '/image/' . $p[0]['resource-id'] . ']' . t('photo') . '[/url]' . ' ' . t('by') . ' ' . '[url=' . $contact_record['url'] . ']' . $contact_record['name'] . '[/url]' ;
@@ -452,6 +453,14 @@ function photos_post(&$a) {
        $filename          = basename($_FILES['userfile']['name']);
        $filesize          = intval($_FILES['userfile']['size']);
 
+       $maximagesize = get_config('system','maximagesize');
+
+       if(($maximagesize) && ($filesize > $maximagesize)) {
+               notice( t('Image exceeds size limit of ') . $maximagesize . EOL);
+               @unlink($src);
+               return;
+       }
+
        $imagedata = @file_get_contents($src);
        $ph = new Photo($imagedata);
 
@@ -849,6 +858,8 @@ function photos_content(&$a) {
                                $tag_str .= bbcode($t);
                        } 
                        $o .= $tag_str . '</div>';
+                       if($cmd === 'edit')
+                               $o .= '<div id="tag-remove"><a href="' . $a->get_baseurl() . '/tagrm/' . $link_item['id'] . '">' . t('[Remove any tag]') . '</a></div>';
                }
 
 
@@ -987,7 +998,7 @@ function photos_content(&$a) {
 
                                        $drop = '';
 
-                                       if(($item['contact-id'] == $_SESSION['visitor_id']) || ($item['uid'] == local_user()))
+                                       if(($item['contact-id'] == remote_user()) || ($item['uid'] == local_user()))
                                                $drop = replace_macros(load_view_file('view/wall_item_drop.tpl'), array('$id' => $item['id']));
 
 
@@ -1024,7 +1035,7 @@ function photos_content(&$a) {
                $a->set_pager_total(count($r));
 
 
-       $r = q("SELECT `resource-id`, `id`, `filename`, `album`, max(`scale`) AS `scale` FROM `photo` 
+       $r = q("SELECT `resource-id`, `id`, `filename`, `album`, max(`scale`) AS `scale` FROM `photo`
                WHERE `uid` = %d AND `album` != '%s' 
                $sql_extra GROUP BY `resource-id` ORDER BY `created` DESC LIMIT %d , %d",
                intval($a->data['user']['uid']),
@@ -1049,7 +1060,7 @@ function photos_content(&$a) {
                                        . '/image/' . $rr['resource-id'],
                                '$phototitle' => t('View Photo'),
                                '$imgsrc' => $a->get_baseurl() . '/photo/' 
-                                       . $rr['resource-id'] . '-' . $rr['scale'] . '.jpg',
+                                       . $rr['resource-id'] . '-' . ((($rr['scale']) == 6) ? 4 : $rr['scale']) . '.jpg',
                                '$albumlink' => $a->get_baseurl() . '/photos/' 
                                        . $a->data['user']['nickname'] . '/album/' . bin2hex($rr['album']),
                                '$albumname' => $rr['album'],