]> git.mxchange.org Git - friendica.git/blobdiff - mod/wall_attach.php
Improve Addons documentation
[friendica.git] / mod / wall_attach.php
index 8116bbcf4edf47a5354265b3befeb0cad308e698..29c790843a7dd8ef4513b08c7fe835735a1ea6eb 100644 (file)
@@ -2,14 +2,15 @@
 /**
  * @file mod/wall_attach.php
  */
+
 use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
+use Friendica\Core\System;
 use Friendica\Database\DBM;
+use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Mimetype;
 
-require_once 'include/datetime.php';
-
 function wall_attach_post(App $a) {
 
        $r_json = (x($_GET,'response') && $_GET['response']=='json');
@@ -109,7 +110,7 @@ function wall_attach_post(App $a) {
        }
 
        if(($maxfilesize) && ($filesize > $maxfilesize)) {
-               $msg = sprintf(L10n::t('File exceeds size limit of %s'), formatBytes($maxfilesize));
+               $msg = L10n::t('File exceeds size limit of %s', formatBytes($maxfilesize));
                if ($r_json) {
                        echo json_encode(['error'=>$msg]);
                } else {
@@ -121,8 +122,8 @@ function wall_attach_post(App $a) {
 
        $filedata = @file_get_contents($src);
        $mimetype = Mimetype::getContentType($filename);
-       $hash = get_guid(64);
-       $created = datetime_convert();
+       $hash = System::createGUID(64);
+       $created = DateTimeFormat::utcNow();
 
        $fields = ['uid' => $page_owner_uid, 'hash' => $hash, 'filename' => $filename, 'filetype' => $mimetype,
                'filesize' => $filesize, 'data' => $filedata, 'created' => $created, 'edited' => $created,