]> git.mxchange.org Git - friendica.git/blobdiff - mod/photos.php
use sha1 keys for friends as well
[friendica.git] / mod / photos.php
index 91642229d4b39e41593e5bc6f56952ac91f13206..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])
                );
@@ -453,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);
 
@@ -850,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>';
                }
 
 
@@ -988,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']));
 
 
@@ -1050,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'],