]> git.mxchange.org Git - friendica.git/blobdiff - mod/photos.php
Fix incorrect Temporal reference after Item function move rebase
[friendica.git] / mod / photos.php
index a789ac64131df430cf68097d85c7ef3958d73e46..8b3dbdc759ae4294fda0bbeab81438e99d210cd4 100644 (file)
@@ -2,22 +2,26 @@
 /**
  * @file mod/photos.php
  */
+
 use Friendica\App;
 use Friendica\Content\Feature;
 use Friendica\Content\Nav;
 use Friendica\Core\Addon;
+use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
-use Friendica\Core\Config;
 use Friendica\Core\Worker;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\Group;
+use Friendica\Model\Item;
 use Friendica\Model\Photo;
 use Friendica\Model\Profile;
 use Friendica\Network\Probe;
 use Friendica\Object\Image;
 use Friendica\Protocol\DFRN;
+use Friendica\Util\DateTimeFormat;
+use Friendica\Util\Map;
 
 require_once 'include/items.php';
 require_once 'include/acl_selectors.php';
@@ -287,7 +291,7 @@ function photos_post(App $a)
                        if (DBM::is_result($r)) {
                                foreach ($r as $rr) {
                                        q("UPDATE `item` SET `deleted` = 1, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
-                                               dbesc(datetime_convert()),
+                                               dbesc(DateTimeFormat::utcNow()),
                                                dbesc($rr['parent-uri']),
                                                intval($page_owner_uid)
                                        );
@@ -360,8 +364,8 @@ function photos_post(App $a)
                        );
                        if (DBM::is_result($i)) {
                                q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
-                                       dbesc(datetime_convert()),
-                                       dbesc(datetime_convert()),
+                                       dbesc(DateTimeFormat::utcNow()),
+                                       dbesc(DateTimeFormat::utcNow()),
                                        dbesc($i[0]['uri']),
                                        intval($page_owner_uid)
                                );
@@ -398,7 +402,7 @@ function photos_post(App $a)
                $resource_id = $a->argv[2];
 
                if (!strlen($albname)) {
-                       $albname = datetime_convert('UTC',date_default_timezone_get(),'now', 'Y');
+                       $albname = DateTimeFormat::localNow('Y');
                }
 
                if (x($_POST,'rotate') !== false &&
@@ -519,7 +523,7 @@ function photos_post(App $a)
                                                . '[img]' . System::baseUrl() . '/photo/' . $p[0]['resource-id'] . '-' . $p[0]['scale'] . '.'. $ext . '[/img]'
                                                . '[/url]';
 
-                       $item_id = item_store($arr);
+                       $item_id = Item::insert($arr);
                }
 
                if ($item_id) {
@@ -645,8 +649,8 @@ function photos_post(App $a)
                        $r = q("UPDATE `item` SET `tag` = '%s', `inform` = '%s', `edited` = '%s', `changed` = '%s' WHERE `id` = %d AND `uid` = %d",
                                dbesc($newtag),
                                dbesc($newinform),
-                               dbesc(datetime_convert()),
-                               dbesc(datetime_convert()),
+                               dbesc(DateTimeFormat::utcNow()),
+                               dbesc(DateTimeFormat::utcNow()),
                                intval($item_id),
                                intval($page_owner_uid)
                        );
@@ -709,7 +713,7 @@ function photos_post(App $a)
                                                . System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . '</id>';
                                        $arr['target'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . '" />' . "\n" . '<link rel="preview" type="'.$p[0]['type'].'" href="' . System::baseUrl() . "/photo/" . $p[0]['resource-id'] . '-' . $best . '.' . $ext . '" />') . '</link></target>';
 
-                                       $item_id = item_store($arr);
+                                       $item_id = Item::insert($arr);
                                        if ($item_id) {
                                                Worker::add(PRIORITY_HIGH, "Notifier", "tag", $item_id);
                                        }
@@ -734,7 +738,7 @@ function photos_post(App $a)
                if (strlen($newalbum)) {
                        $album = $newalbum;
                } else {
-                       $album = datetime_convert('UTC',date_default_timezone_get(),'now', 'Y');
+                       $album = DateTimeFormat::localNow('Y');
                }
        }
 
@@ -931,7 +935,7 @@ function photos_post(App $a)
                                . '[img]' . System::baseUrl() . "/photo/{$photo_hash}-{$smallest}.".$Image->getExt() . '[/img]'
                                . '[/url]';
 
-       $item_id = item_store($arr);
+       $item_id = Item::insert($arr);
        // Update the photo albums cache
        Photo::clearAlbumCache($page_owner_uid);
 
@@ -1357,7 +1361,7 @@ function photos_content(App $a)
                $photo = [
                        'href' => 'photo/' . $hires['resource-id'] . '-' . $hires['scale'] . '.' . $phototypes[$hires['type']],
                        'title'=> L10n::t('View Full Size'),
-                       'src'  => 'photo/' . $lores['resource-id'] . '-' . $lores['scale'] . '.' . $phototypes[$lores['type']] . '?f=&_u=' . datetime_convert('','','','ymdhis'),
+                       'src'  => 'photo/' . $lores['resource-id'] . '-' . $lores['scale'] . '.' . $phototypes[$lores['type']] . '?f=&_u=' . DateTimeFormat::utcNow('ymdhis'),
                        'height' => $hires['height'],
                        'width' => $hires['width'],
                        'album' => $hires['album'],
@@ -1469,8 +1473,8 @@ function photos_content(App $a)
                                '$caption' => ['desc', L10n::t('Caption'), $caption_e, ''],
                                '$tags' => ['newtag', L10n::t('Add a Tag'), "", L10n::t('Example: @bob, @Barbara_Jensen, @jim@example.com, #California, #camping')],
                                '$rotate_none' => ['rotate', L10n::t('Do not rotate'),0,'', true],
-                               '$rotate_cw' => ['rotate', L10n::t('Rotate CW (right)'),1,''],
-                               '$rotate_ccw' => ['rotate', L10n::t('Rotate CCW (left)'),2,''],
+                               '$rotate_cw' => ['rotate', L10n::t("Rotate CW \x28right\x29"),1,''],
+                               '$rotate_ccw' => ['rotate', L10n::t("Rotate CCW \x28left\x29"),2,''],
 
                                '$nickname' => $a->data['user']['nickname'],
                                '$resource_id' => $ph[0]['resource-id'],