]> git.mxchange.org Git - friendica.git/blobdiff - mod/photos.php
Bump DB version
[friendica.git] / mod / photos.php
index 478c954aaad74aa433fba5852bbbdfe68950d1e7..3acd39b2af6311f144a1af9fc86a44b13cdaa556 100644 (file)
@@ -1,14 +1,14 @@
 <?php
-require_once('include/Photo.php');
-require_once('include/photos.php');
-require_once('include/items.php');
-require_once('include/acl_selectors.php');
-require_once('include/bbcode.php');
-require_once('include/security.php');
-require_once('include/redir.php');
-require_once('include/tags.php');
-require_once('include/threads.php');
-require_once('include/Probe.php');
+require_once 'include/Photo.php';
+require_once 'include/photos.php';
+require_once 'include/items.php';
+require_once 'include/acl_selectors.php';
+require_once 'include/bbcode.php';
+require_once 'include/security.php';
+require_once 'include/redir.php';
+require_once 'include/tags.php';
+require_once 'include/threads.php';
+require_once 'include/Probe.php';
 
 use \Friendica\Core\Config;
 
@@ -781,10 +781,10 @@ function photos_post(App $a) {
                $visible = 0;
        }
 
-       $str_group_allow   = perms2str(((is_array($_REQUEST['group_allow']))   ? $_REQUEST['group_allow']   : explode(',',$_REQUEST['group_allow'])));
-       $str_contact_allow = perms2str(((is_array($_REQUEST['contact_allow'])) ? $_REQUEST['contact_allow'] : explode(',',$_REQUEST['contact_allow'])));
-       $str_group_deny    = perms2str(((is_array($_REQUEST['group_deny']))    ? $_REQUEST['group_deny']    : explode(',',$_REQUEST['group_deny'])));
-       $str_contact_deny  = perms2str(((is_array($_REQUEST['contact_deny']))  ? $_REQUEST['contact_deny']  : explode(',',$_REQUEST['contact_deny'])));
+       $str_group_allow   = perms2str(((is_array($_REQUEST['group_allow']))   ? $_REQUEST['group_allow']   : explode(',', $_REQUEST['group_allow'])));
+       $str_contact_allow = perms2str(((is_array($_REQUEST['contact_allow'])) ? $_REQUEST['contact_allow'] : explode(',', $_REQUEST['contact_allow'])));
+       $str_group_deny    = perms2str(((is_array($_REQUEST['group_deny']))    ? $_REQUEST['group_deny']    : explode(',', $_REQUEST['group_deny'])));
+       $str_contact_deny  = perms2str(((is_array($_REQUEST['contact_deny']))  ? $_REQUEST['contact_deny']  : explode(',', $_REQUEST['contact_deny'])));
 
        $ret = array('src' => '', 'filename' => '', 'filesize' => 0, 'type' => '');
 
@@ -830,7 +830,7 @@ function photos_post(App $a) {
        $imagedata = @file_get_contents($src);
 
 
-       $limit = service_class_fetch($a->data['user']['uid'],'photo_upload_limit');
+       $limit = service_class_fetch($a->data['user']['uid'], 'photo_upload_limit');
 
        if ($limit) {
                $r = q("SELECT SUM(OCTET_LENGTH(`data`)) AS `total` FROM `photo` WHERE `uid` = %d AND `scale` = 0 AND `album` != 'Contact Photos'",
@@ -861,7 +861,7 @@ function photos_post(App $a) {
        $exif = $ph->orient($src);
        @unlink($src);
 
-       $max_length = get_config('system','max_image_length');
+       $max_length = get_config('system', 'max_image_length');
        if (! $max_length) {
                $max_length = MAX_IMAGE_LENGTH;
        }
@@ -1098,7 +1098,7 @@ function photos_content(App $a) {
 
        // tabs
        $is_owner = (local_user() && (local_user() == $owner_uid));
-       $o .= profile_tabs($a,$is_owner, $a->data['user']['nickname']);
+       $o .= profile_tabs($a, $is_owner, $a->data['user']['nickname']);
 
        /**
         * Display upload form
@@ -1142,7 +1142,7 @@ function photos_content(App $a) {
                ));
 
                $usage_message = '';
-               $limit = service_class_fetch($a->data['user']['uid'],'photo_upload_limit');
+               $limit = service_class_fetch($a->data['user']['uid'], 'photo_upload_limit');
                if ($limit !== false) {
 
                        $r = q("SELECT SUM(`datasize`) AS `total` FROM `photo` WHERE `uid` = %d AND `scale` = 0 AND `album` != 'Contact Photos'",
@@ -1271,11 +1271,8 @@ function photos_content(App $a) {
                                }
                        }
                } else {
-                       /// @TODO merge else+if into elseif and 2 into one?
-                       if (($album !== t('Profile Photos')) && ($album !== 'Contact Photos') && ($album !== t('Contact Photos'))) {
-                               if ($can_post) {
-                                       $edit = array(t('Edit Album'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '/edit');
-                               }
+                       if (($album !== t('Profile Photos')) && ($album !== 'Contact Photos') && ($album !== t('Contact Photos')) && $can_post) {
+                               $edit = array(t('Edit Album'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '/edit');
                        }
                }
 
@@ -1526,7 +1523,7 @@ function photos_content(App $a) {
                $tags = null;
 
                if (count($linked_items) && strlen($link_item['tag'])) {
-                       $arr = explode(',',$link_item['tag']);
+                       $arr = explode(',', $link_item['tag']);
                        // parse tags and add links
                        $tag_str = '';
                        foreach ($arr as $t) {
@@ -1584,9 +1581,9 @@ function photos_content(App $a) {
                                '$album' => array('albname', t('New album name'), $album_e,''),
                                '$caption' => array('desc', t('Caption'), $caption_e, ''),
                                '$tags' => array('newtag', t('Add a Tag'), "", t('Example: @bob, @Barbara_Jensen, @jim@example.com, #California, #camping')),
-                               '$rotate_none' => array('rotate',t('Do not rotate'),0,'', true),
-                               '$rotate_cw' => array('rotate',t('Rotate CW (right)'),1,''),
-                               '$rotate_ccw' => array('rotate',t('Rotate CCW (left)'),2,''),
+                               '$rotate_none' => array('rotate', t('Do not rotate'),0,'', true),
+                               '$rotate_cw' => array('rotate', t('Rotate CW (right)'),1,''),
+                               '$rotate_ccw' => array('rotate', t('Rotate CCW (left)'),2,''),
 
                                '$nickname' => $a->data['user']['nickname'],
                                '$resource_id' => $ph[0]['resource-id'],
@@ -1619,8 +1616,8 @@ function photos_content(App $a) {
 
                        $likebuttons = '';
 
-                       if ($can_post || can_write_wall($a,$owner_uid)) {
-                               $likebuttons = replace_macros($like_tpl,array(
+                       if ($can_post || can_write_wall($a, $owner_uid)) {
+                               $likebuttons = replace_macros($like_tpl, array(
                                        '$id' => $link_item['id'],
                                        '$likethis' => t("I like this \x28toggle\x29"),
                                        '$nolike' => (feature_enabled(local_user(), 'dislike') ? t("I don't like this \x28toggle\x29") : ''),
@@ -1631,27 +1628,24 @@ function photos_content(App $a) {
 
                        $comments = '';
                        if (! dbm::is_result($r)) {
-                               /// @TODO merge into one if() ?
-                               if ($can_post || can_write_wall($a,$owner_uid)) {
-                                       if ($link_item['last-child']) {
-                                               $comments .= replace_macros($cmnt_tpl,array(
-                                                       '$return_path' => '',
-                                                       '$jsreload' => $return_url,
-                                                       '$type' => 'wall-comment',
-                                                       '$id' => $link_item['id'],
-                                                       '$parent' => $link_item['id'],
-                                                       '$profile_uid' =>  $owner_uid,
-                                                       '$mylink' => $contact['url'],
-                                                       '$mytitle' => t('This is you'),
-                                                       '$myphoto' => $contact['thumb'],
-                                                       '$comment' => t('Comment'),
-                                                       '$submit' => t('Submit'),
-                                                       '$preview' => t('Preview'),
-                                                       '$sourceapp' => t($a->sourcename),
-                                                       '$ww' => '',
-                                                       '$rand_num' => random_digits(12)
-                                               ));
-                                       }
+                               if (($can_post || can_write_wall($a, $owner_uid)) && $link_item['last-child']) {
+                                       $comments .= replace_macros($cmnt_tpl, array(
+                                               '$return_path' => '',
+                                               '$jsreload' => $return_url,
+                                               '$type' => 'wall-comment',
+                                               '$id' => $link_item['id'],
+                                               '$parent' => $link_item['id'],
+                                               '$profile_uid' =>  $owner_uid,
+                                               '$mylink' => $contact['url'],
+                                               '$mytitle' => t('This is you'),
+                                               '$myphoto' => $contact['thumb'],
+                                               '$comment' => t('Comment'),
+                                               '$submit' => t('Submit'),
+                                               '$preview' => t('Preview'),
+                                               '$sourceapp' => t($a->sourcename),
+                                               '$ww' => '',
+                                               '$rand_num' => random_digits(12)
+                                       ));
                                }
                        }
 
@@ -1673,30 +1667,27 @@ function photos_content(App $a) {
                                        builtin_activity_puller($item, $conv_responses);
                                }
 
-                               $like    = ((x($conv_responses['like'],$link_item['uri'])) ? format_like($conv_responses['like'][$link_item['uri']],$conv_responses['like'][$link_item['uri'] . '-l'],'like',$link_item['id']) : '');
-                               $dislike = ((x($conv_responses['dislike'],$link_item['uri'])) ? format_like($conv_responses['dislike'][$link_item['uri']],$conv_responses['dislike'][$link_item['uri'] . '-l'],'dislike',$link_item['id']) : '');
-
-                               /// @TODO merge into one if() ?
-                               if ($can_post || can_write_wall($a,$owner_uid)) {
-                                       if ($link_item['last-child']) {
-                                               $comments .= replace_macros($cmnt_tpl,array(
-                                                       '$return_path' => '',
-                                                       '$jsreload' => $return_url,
-                                                       '$type' => 'wall-comment',
-                                                       '$id' => $link_item['id'],
-                                                       '$parent' => $link_item['id'],
-                                                       '$profile_uid' =>  $owner_uid,
-                                                       '$mylink' => $contact['url'],
-                                                       '$mytitle' => t('This is you'),
-                                                       '$myphoto' => $contact['thumb'],
-                                                       '$comment' => t('Comment'),
-                                                       '$submit' => t('Submit'),
-                                                       '$preview' => t('Preview'),
-                                                       '$sourceapp' => t($a->sourcename),
-                                                       '$ww' => '',
-                                                       '$rand_num' => random_digits(12)
-                                               ));
-                                       }
+                               $like    = ((x($conv_responses['like'], $link_item['uri'])) ? format_like($conv_responses['like'][$link_item['uri']], $conv_responses['like'][$link_item['uri'] . '-l'], 'like',$link_item['id']) : '');
+                               $dislike = ((x($conv_responses['dislike'], $link_item['uri'])) ? format_like($conv_responses['dislike'][$link_item['uri']], $conv_responses['dislike'][$link_item['uri'] . '-l'], 'dislike',$link_item['id']) : '');
+
+                               if (($can_post || can_write_wall($a, $owner_uid)) && $link_item['last-child']) {
+                                       $comments .= replace_macros($cmnt_tpl,array(
+                                               '$return_path' => '',
+                                               '$jsreload' => $return_url,
+                                               '$type' => 'wall-comment',
+                                               '$id' => $link_item['id'],
+                                               '$parent' => $link_item['id'],
+                                               '$profile_uid' =>  $owner_uid,
+                                               '$mylink' => $contact['url'],
+                                               '$mytitle' => t('This is you'),
+                                               '$myphoto' => $contact['thumb'],
+                                               '$comment' => t('Comment'),
+                                               '$submit' => t('Submit'),
+                                               '$preview' => t('Preview'),
+                                               '$sourceapp' => t($a->sourcename),
+                                               '$ww' => '',
+                                               '$rand_num' => random_digits(12)
+                                       ));
                                }
 
 
@@ -1759,27 +1750,24 @@ function photos_content(App $a) {
                                                '$comment' => $comment
                                        ));
 
-                                       /// @TODO merge into one if() ?
-                                       if ($can_post || can_write_wall($a, $owner_uid)) {
-                                               if ($item['last-child']) {
-                                                       $comments .= replace_macros($cmnt_tpl, array(
-                                                               '$return_path' => '',
-                                                               '$jsreload' => $return_url,
-                                                               '$type' => 'wall-comment',
-                                                               '$id' => $item['item_id'],
-                                                               '$parent' => $item['parent'],
-                                                               '$profile_uid' =>  $owner_uid,
-                                                               '$mylink' => $contact['url'],
-                                                               '$mytitle' => t('This is you'),
-                                                               '$myphoto' => $contact['thumb'],
-                                                               '$comment' => t('Comment'),
-                                                               '$submit' => t('Submit'),
-                                                               '$preview' => t('Preview'),
-                                                               '$sourceapp' => t($a->sourcename),
-                                                               '$ww' => '',
-                                                               '$rand_num' => random_digits(12)
-                                                       ));
-                                               }
+                                       if (($can_post || can_write_wall($a, $owner_uid)) && $item['last-child']) {
+                                               $comments .= replace_macros($cmnt_tpl, array(
+                                                       '$return_path' => '',
+                                                       '$jsreload' => $return_url,
+                                                       '$type' => 'wall-comment',
+                                                       '$id' => $item['item_id'],
+                                                       '$parent' => $item['parent'],
+                                                       '$profile_uid' =>  $owner_uid,
+                                                       '$mylink' => $contact['url'],
+                                                       '$mytitle' => t('This is you'),
+                                                       '$myphoto' => $contact['thumb'],
+                                                       '$comment' => t('Comment'),
+                                                       '$submit' => t('Submit'),
+                                                       '$preview' => t('Preview'),
+                                                       '$sourceapp' => t($a->sourcename),
+                                                       '$ww' => '',
+                                                       '$rand_num' => random_digits(12)
+                                               ));
                                        }
                                }
                        }
@@ -1789,9 +1777,10 @@ function photos_content(App $a) {
 
 
                $response_verbs = array('like');
-               if (feature_enabled($owner_uid,'dislike'))
+               if (feature_enabled($owner_uid, 'dislike')) {
                        $response_verbs[] = 'dislike';
-               $responses = get_responses($conv_responses,$response_verbs,'',$link_item);
+               }
+               $responses = get_responses($conv_responses,$response_verbs, '', $link_item);
 
                $photo_tpl = get_markup_template('photo_view.tpl');
 
@@ -1801,7 +1790,7 @@ function photos_content(App $a) {
                        $like_e = template_escape($like);
                        $dislike_e = template_escape($dislike);
                } else {
-                       $album_e = array($album_link,$ph[0]['album']);
+                       $album_e = array($album_link, $ph[0]['album']);
                        $tags_e = $tags;
                        $like_e = $like;
                        $dislike_e = $dislike;
@@ -1828,11 +1817,11 @@ function photos_content(App $a) {
                        '$paginate' => $paginate,
                ));
 
-               $a->page['htmlhead'] .= "\n".'<meta name="twitter:card" content="photo" />'."\n";
-               $a->page['htmlhead'] .= '<meta name="twitter:title" content="'.$photo["album"].'" />'."\n";
-               $a->page['htmlhead'] .= '<meta name="twitter:image" content="'.$photo["href"].'" />'."\n";
-               $a->page['htmlhead'] .= '<meta name="twitter:image:width" content="'.$photo["width"].'" />'."\n";
-               $a->page['htmlhead'] .= '<meta name="twitter:image:height" content="'.$photo["height"].'" />'."\n";
+               $a->page['htmlhead'] .= "\n" . '<meta name="twitter:card" content="photo" />' . "\n";
+               $a->page['htmlhead'] .= '<meta name="twitter:title" content="' . $photo["album"] . '" />' . "\n";
+               $a->page['htmlhead'] .= '<meta name="twitter:image" content="' . $photo["href"] . '" />' . "\n";
+               $a->page['htmlhead'] .= '<meta name="twitter:image:width" content="' . $photo["width"] . '" />' . "\n";
+               $a->page['htmlhead'] .= '<meta name="twitter:image:height" content="' . $photo["height"] . '" />' . "\n";
 
                return $o;
        }