Catch error when trying to upload empty or invalid avatar
This commit is contained in:
parent
6f8f5aff33
commit
ae39544e10
|
|
@ -33,8 +33,14 @@ class AvatarFileController extends BaseController
|
||||||
$this->checkCSRFParam();
|
$this->checkCSRFParam();
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
|
|
||||||
if (! $this->avatarFileModel->uploadImageFile($user['id'], $this->request->getFileInfo('avatar'))) {
|
if (! $this->request->getFileInfo('avatar')['name']) {
|
||||||
$this->flash->failure(t('Unable to upload files, check the permissions of your data folder.'));
|
$this->flash->failure(t('You must select a file to upload as your avatar!'));
|
||||||
|
} elseif (! $this->avatarFileModel->isAvatarImage($this->request->getFileInfo('avatar')['name'])) {
|
||||||
|
$this->flash->failure(t('The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)'));
|
||||||
|
} else {
|
||||||
|
if (! $this->avatarFileModel->uploadImageFile($user['id'], $this->request->getFileInfo('avatar'))) {
|
||||||
|
$this->flash->failure(t('Unable to upload files, check the permissions of your data folder.'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->renderResponse($user['id']);
|
$this->renderResponse($user['id']);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
// 'XBT - Bitcoin' => '',
|
// 'XBT - Bitcoin' => '',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
// 'XBT - Bitcoin' => '',
|
// 'XBT - Bitcoin' => '',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
'XBT - Bitcoin' => 'XBT - Bitcoin',
|
'XBT - Bitcoin' => 'XBT - Bitcoin',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
'XBT - Bitcoin' => 'XBT - Bitcoin',
|
'XBT - Bitcoin' => 'XBT - Bitcoin',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
'XBT - Bitcoin' => 'XBT - Bitcoin',
|
'XBT - Bitcoin' => 'XBT - Bitcoin',
|
||||||
|
'You must select a file to upload as your avatar!' => 'Sie müssen eine Datei auswählen, die als Avatar hochgeladen werden soll!',
|
||||||
|
'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => 'Die hochgeladene Datei ist kein gültiges Bild! (Nur *.gif, *.jpg, *.jpeg and *.png sind erlaubt!)',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
'XBT - Bitcoin' => 'XBT - Bitcoin',
|
'XBT - Bitcoin' => 'XBT - Bitcoin',
|
||||||
|
'You must select a file to upload as your avatar!' => 'Du musst eine Datei auswählen, die als Avatar hochgeladen werden soll!',
|
||||||
|
'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => 'Die hochgeladene Datei ist kein gültiges Bild! (Nur *.gif, *.jpg, *.jpeg and *.png sind erlaubt!)',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
// 'XBT - Bitcoin' => '',
|
// 'XBT - Bitcoin' => '',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
'XBT - Bitcoin' => 'XBT - Bitcoin',
|
'XBT - Bitcoin' => 'XBT - Bitcoin',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
'XBT - Bitcoin' => 'XBT - Bitcoin',
|
'XBT - Bitcoin' => 'XBT - Bitcoin',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
'XBT - Bitcoin' => 'XBT - بیت کوین',
|
'XBT - Bitcoin' => 'XBT - بیت کوین',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
// 'XBT - Bitcoin' => '',
|
// 'XBT - Bitcoin' => '',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
'Estimated vs actual time per column' => 'Temps estimé vs temps réel par colonne',
|
'Estimated vs actual time per column' => 'Temps estimé vs temps réel par colonne',
|
||||||
'HUF - Hungarian Forint' => 'HUF - Forint hongrois',
|
'HUF - Hungarian Forint' => 'HUF - Forint hongrois',
|
||||||
'XBT - Bitcoin' => 'XBT - Bitcoin',
|
'XBT - Bitcoin' => 'XBT - Bitcoin',
|
||||||
|
'You must select a file to upload as your avatar!' => 'Vous devez sélectionner un fichier à télécharger pour votre avatar !',
|
||||||
|
'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => 'Le fichier que vous avez téléchargé n\'est pas une image valide ! (Seuls * .gif, * .jpg, * .jpeg et * .png sont autorisés !)',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
// 'XBT - Bitcoin' => '',
|
// 'XBT - Bitcoin' => '',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
'HUF - Hungarian Forint' => 'HUF – magyar forint',
|
'HUF - Hungarian Forint' => 'HUF – magyar forint',
|
||||||
'XBT - Bitcoin' => 'XBT – Bitcoin',
|
'XBT - Bitcoin' => 'XBT – Bitcoin',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
'XBT - Bitcoin' => 'XBT - Bitcoin',
|
'XBT - Bitcoin' => 'XBT - Bitcoin',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
// 'XBT - Bitcoin' => '',
|
// 'XBT - Bitcoin' => '',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
'XBT - Bitcoin' => 'XBT - Bitcoin',
|
'XBT - Bitcoin' => 'XBT - Bitcoin',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
// 'XBT - Bitcoin' => '',
|
// 'XBT - Bitcoin' => '',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
'XBT - Bitcoin' => 'XBT - биткоин',
|
'XBT - Bitcoin' => 'XBT - биткоин',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
// 'XBT - Bitcoin' => '',
|
// 'XBT - Bitcoin' => '',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
// 'XBT - Bitcoin' => '',
|
// 'XBT - Bitcoin' => '',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
// 'XBT - Bitcoin' => '',
|
// 'XBT - Bitcoin' => '',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
'XBT - Bitcoin' => 'XBT - Bitcoin',
|
'XBT - Bitcoin' => 'XBT - Bitcoin',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
'XBT - Bitcoin' => 'XBT - Bitcoin',
|
'XBT - Bitcoin' => 'XBT - Bitcoin',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
'XBT - Bitcoin' => 'XBT - Bitcoin',
|
'XBT - Bitcoin' => 'XBT - Bitcoin',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
// 'XBT - Bitcoin' => '',
|
// 'XBT - Bitcoin' => '',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
'XBT - Bitcoin' => 'XBT - Биткоин',
|
'XBT - Bitcoin' => 'XBT - Биткоин',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
'XBT - Bitcoin' => 'XBT – Bitcoin',
|
'XBT - Bitcoin' => 'XBT – Bitcoin',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
'XBT - Bitcoin' => 'XBT - Bitkoin',
|
'XBT - Bitcoin' => 'XBT - Bitkoin',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
// 'XBT - Bitcoin' => '',
|
// 'XBT - Bitcoin' => '',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
// 'XBT - Bitcoin' => '',
|
// 'XBT - Bitcoin' => '',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
'XBT - Bitcoin' => 'XBT - Bitcoin',
|
'XBT - Bitcoin' => 'XBT - Bitcoin',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
'XBT - Bitcoin' => 'XBT – Біткоїн',
|
'XBT - Bitcoin' => 'XBT – Біткоїн',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
// 'XBT - Bitcoin' => '',
|
// 'XBT - Bitcoin' => '',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
'XBT - Bitcoin' => 'XBT - 比特币',
|
'XBT - Bitcoin' => 'XBT - 比特币',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1427,4 +1427,6 @@ return array(
|
||||||
// 'Estimated vs actual time per column' => '',
|
// 'Estimated vs actual time per column' => '',
|
||||||
// 'HUF - Hungarian Forint' => '',
|
// 'HUF - Hungarian Forint' => '',
|
||||||
// 'XBT - Bitcoin' => '',
|
// 'XBT - Bitcoin' => '',
|
||||||
|
// 'You must select a file to upload as your avatar!' => '',
|
||||||
|
// 'The file you uploaded is not a valid image! (Only *.gif, *.jpg, *.jpeg and *.png are allowed!)' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -136,4 +136,24 @@ class AvatarFileModel extends Base
|
||||||
{
|
{
|
||||||
return implode(DIRECTORY_SEPARATOR, array(self::PATH_PREFIX, $user_id, hash('sha1', $filename.time())));
|
return implode(DIRECTORY_SEPARATOR, array(self::PATH_PREFIX, $user_id, hash('sha1', $filename.time())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a filename is an image (file types that can be shown as avatar)
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param string $filename Filename
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isAvatarImage($filename)
|
||||||
|
{
|
||||||
|
switch (get_file_extension($filename)) {
|
||||||
|
case 'jpeg':
|
||||||
|
case 'jpg':
|
||||||
|
case 'png':
|
||||||
|
case 'gif':
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue