Coding standards

This commit is contained in:
Romain Neutron
2012-01-31 18:35:27 +01:00
parent dcb4933438
commit 99a344774f
110 changed files with 668 additions and 536 deletions

View File

@@ -68,4 +68,4 @@ class Controller_Admin_Fields implements ControllerProviderInterface
return $controllers;
}
}
}

View File

@@ -54,7 +54,7 @@ class Controller_Admin_Publications implements ControllerProviderInterface
$request = $app['request'];
$feed = Feed_Adapter::create($appbox, $user, $request->get('title'), $request->get('subtitle'));
if($request->get('public') == '1')
$feed->set_public (true);
elseif ($request->get('base_id'))
@@ -93,6 +93,7 @@ class Controller_Admin_Publications implements ControllerProviderInterface
$user = User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox);
if (!$feed->is_owner($user))
return $app->redirect('/admin/publications/feed/' . $id . '/?error=' . _('You are not the owner of this feed, you can not edit it'));
$request = $app['request'];
@@ -121,23 +122,29 @@ class Controller_Admin_Publications implements ControllerProviderInterface
$user = User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox);
if (!$feed->is_owner($user))
return new Response('ERROR:you are not allowed');
if ($_FILES['Filedata']['error'] !== 0)
return new Response('ERROR:error while upload');
$file = new system_file($_FILES['Filedata']['tmp_name']);
if (!in_array($file->get_mime(), array('image/jpeg', 'image/jpg', 'image/gif')))
return new Response('ERROR:bad filetype');
if ($file->getSize() > 200000)
return new Response('ERROR:file too large');
$datas = $file->get_technical_datas();
if (!isset($datas[system_file::TC_DATAS_WIDTH]) || !isset($datas[system_file::TC_DATAS_HEIGHT]))
return new Response('ERROR:file is not square');
if ($datas[system_file::TC_DATAS_WIDTH] != $datas[system_file::TC_DATAS_HEIGHT])
return new Response('ERROR:file is not square');
$feed->set_icon($file);

View File

@@ -260,7 +260,7 @@ class Controller_Admin_Users implements ControllerProviderInterface
$response = new Response($CSVDatas, 200, array('Content-Type' => 'text/plain'));
$response->headers->set('Content-Disposition', 'attachment; filename=export.txt');
return $response;
}
);