Skip to content

Commit

Permalink
Merge pull request #1152 from MaisonLogicielLibre/develop
Browse files Browse the repository at this point in the history
mise a jour
  • Loading branch information
willkoua committed May 17, 2016
2 parents 2bd6cd0 + b2e4ef3 commit aadd24f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Controller/PagesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -564,18 +564,17 @@ public function administration($img = null)
//gestion des images du carousel
$pathCar = WWW_ROOT . "img/carousel/";
$pathTV = WWW_ROOT . "img/tv/";

$request = $this->request;

if (is_file($pathCar . $img)) {
unlink($pathCar . $img);
}
if ($request->is('post') && !empty($request->data)) {
$image = $this->request->data['avatar_file'];
$hidden = $this->request->data('hidden');
$image = $request->data['avatar_file'];
$hidden = $request->data('hidden');
$fileName = $image['name'];
$dim = null;

print_r($image);
if (!empty($image['tmp_name']) && $image['type'] == 'image/png') {
$dim = getimagesize($image['tmp_name']);

Expand All @@ -584,7 +583,7 @@ public function administration($img = null)
move_uploaded_file($image['tmp_name'], $pathCar . $fileName);
}
if ($hidden == 'tv') {
if (preg_match("#tv[1-5]#", $fileName)) {
if (preg_match("#^tv[1-5]$#", $fileName)) {
move_uploaded_file($image['tmp_name'], $pathTV . $fileName);
} else {
$this->Flash->error(__('rename image file (tv[1,2,3,4 or 5])'), ['key' => 'er_tv']);
Expand Down

0 comments on commit aadd24f

Please sign in to comment.