X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fwall_attach.php;h=472a8073247e9a96d7150d50da9e6150a43367a7;hb=1b74650807279279836a0544f607166111d86050;hp=c9d13abef4df037b610828c9828e53a02f187dde;hpb=704aef67fb4f1f3b439acbd045f1e3197a1fd9bb;p=friendica.git diff --git a/mod/wall_attach.php b/mod/wall_attach.php index c9d13abef4..472a807324 100644 --- a/mod/wall_attach.php +++ b/mod/wall_attach.php @@ -1,9 +1,13 @@ t('Invalid request.'))); + echo json_encode(['error'=>t('Invalid request.')]); killme(); } return; @@ -24,7 +28,7 @@ function wall_attach_post(App $a) { } else { if ($r_json) { - echo json_encode(array('error'=>t('Invalid request.'))); + echo json_encode(['error'=>t('Invalid request.')]); killme(); } return; @@ -57,7 +61,7 @@ function wall_attach_post(App $a) { intval($contact_id), intval($page_owner_uid) ); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { $can_post = true; $visitor = $contact_id; } @@ -66,7 +70,7 @@ function wall_attach_post(App $a) { } if(! $can_post) { if ($r_json) { - echo json_encode(array('error'=>t('Permission denied.'))); + echo json_encode(['error'=>t('Permission denied.')]); killme(); } notice( t('Permission denied.') . EOL ); @@ -75,7 +79,7 @@ function wall_attach_post(App $a) { if(! x($_FILES,'userfile')) { if ($r_json) { - echo json_encode(array('error'=>t('Invalid request.'))); + echo json_encode(['error'=>t('Invalid request.')]); } killme(); } @@ -84,7 +88,7 @@ function wall_attach_post(App $a) { $filename = basename($_FILES['userfile']['name']); $filesize = intval($_FILES['userfile']['size']); - $maxfilesize = get_config('system','maxfilesize'); + $maxfilesize = Config::get('system','maxfilesize'); /* Found html code written in text field of form, * when trying to upload a file with filesize @@ -95,7 +99,7 @@ function wall_attach_post(App $a) { if($filesize <=0) { $msg = t('Sorry, maybe your upload is bigger than the PHP configuration allows') . EOL .(t('Or - did you try to upload an empty file?')); if ($r_json) { - echo json_encode(array('error'=>$msg)); + echo json_encode(['error'=>$msg]); } else { notice( $msg. EOL ); } @@ -106,7 +110,7 @@ function wall_attach_post(App $a) { if(($maxfilesize) && ($filesize > $maxfilesize)) { $msg = sprintf(t('File exceeds size limit of %s'), formatBytes($maxfilesize)); if ($r_json) { - echo json_encode(array('error'=>$msg)); + echo json_encode(['error'=>$msg]); } else { echo $msg. EOL ; } @@ -115,13 +119,13 @@ function wall_attach_post(App $a) { } $filedata = @file_get_contents($src); - $mimetype = z_mime_content_type($filename); + $mimetype = Mimetype::getContentType($filename); $hash = get_guid(64); $created = datetime_convert(); - $fields = array('uid' => $page_owner_uid, 'hash' => $hash, 'filename' => $filename, 'filetype' => $mimetype, + $fields = ['uid' => $page_owner_uid, 'hash' => $hash, 'filename' => $filename, 'filetype' => $mimetype, 'filesize' => $filesize, 'data' => $filedata, 'created' => $created, 'edited' => $created, - 'allow_cid' => '<' . $page_owner_cid . '>', 'allow_gid' => '','deny_cid' => '', 'deny_gid' => ''); + 'allow_cid' => '<' . $page_owner_cid . '>', 'allow_gid' => '','deny_cid' => '', 'deny_gid' => '']; $r = dba::insert('attach', $fields); @@ -130,7 +134,7 @@ function wall_attach_post(App $a) { if(! $r) { $msg = t('File upload failed.'); if ($r_json) { - echo json_encode(array('error'=>$msg)); + echo json_encode(['error'=>$msg]); } else { echo $msg. EOL ; } @@ -143,10 +147,10 @@ function wall_attach_post(App $a) { dbesc($hash) ); - if (! dbm::is_result($r)) { + if (! DBM::is_result($r)) { $msg = t('File upload failed.'); if ($r_json) { - echo json_encode(array('error'=>$msg)); + echo json_encode(['error'=>$msg]); } else { echo $msg. EOL ; } @@ -154,7 +158,7 @@ function wall_attach_post(App $a) { } if ($r_json) { - echo json_encode(array('ok'=>true)); + echo json_encode(['ok'=>true]); killme(); }