Improved use of isset()

This commit is contained in:
Tobias Reich 2014-03-18 22:46:52 +01:00
parent 24c91e47d4
commit 61bb527911
3 changed files with 22 additions and 22 deletions

View File

@ -24,11 +24,11 @@ switch ($_POST['function']) {
echo addAlbum($_POST['title']);
break;
case 'setAlbumTitle': if (isset($_POST['albumIDs'])&&isset($_POST['title']))
case 'setAlbumTitle': if (isset($_POST['albumIDs'], $_POST['title']))
echo setAlbumTitle($_POST['albumIDs'], $_POST['title']);
break;
case 'setAlbumDescription': if (isset($_POST['albumID'])&&isset($_POST['description']))
case 'setAlbumDescription': if (isset($_POST['albumID'], $_POST['description']))
echo setAlbumDescription($_POST['albumID'], $_POST['description']);
break;
@ -37,7 +37,7 @@ switch ($_POST['function']) {
echo setAlbumPublic($_POST['albumID'], $_POST['password']);
break;
case 'setAlbumPassword': if (isset($_POST['albumID'])&&isset($_POST['password']))
case 'setAlbumPassword': if (isset($_POST['albumID'], $_POST['password']))
echo setAlbumPassword($_POST['albumID'], $_POST['password']);
break;
@ -47,7 +47,7 @@ switch ($_POST['function']) {
// Photo Functions
case 'getPhoto': if (isset($_POST['photoID'])&&isset($_POST['albumID']))
case 'getPhoto': if (isset($_POST['photoID'], $_POST['albumID']))
echo json_encode(getPhoto($_POST['photoID'], $_POST['albumID']));
break;
@ -55,11 +55,11 @@ switch ($_POST['function']) {
echo deletePhoto($_POST['photoIDs']);
break;
case 'setPhotoAlbum': if (isset($_POST['photoIDs'])&&isset($_POST['albumID']))
case 'setPhotoAlbum': if (isset($_POST['photoIDs'], $_POST['albumID']))
echo setPhotoAlbum($_POST['photoIDs'], $_POST['albumID']);
break;
case 'setPhotoTitle': if (isset($_POST['photoIDs'])&&isset($_POST['title']))
case 'setPhotoTitle': if (isset($_POST['photoIDs'], $_POST['title']))
echo setPhotoTitle($_POST['photoIDs'], $_POST['title']);
break;
@ -67,25 +67,25 @@ switch ($_POST['function']) {
echo setPhotoStar($_POST['photoIDs']);
break;
case 'setPhotoPublic': if (isset($_POST['photoID'])&&isset($_POST['url']))
case 'setPhotoPublic': if (isset($_POST['photoID'], $_POST['url']))
echo setPhotoPublic($_POST['photoID'], $_POST['url']);
break;
case 'setPhotoDescription': if (isset($_POST['photoID'])&&isset($_POST['description']))
case 'setPhotoDescription': if (isset($_POST['photoID'], $_POST['description']))
echo setPhotoDescription($_POST['photoID'], $_POST['description']);
break;
case 'setPhotoTags': if (isset($_POST['photoIDs'])&&isset($_POST['tags']))
case 'setPhotoTags': if (isset($_POST['photoIDs'], $_POST['tags']))
echo setPhotoTags($_POST['photoIDs'], $_POST['tags']);
break;
// Add Functions
case 'upload': if (isset($_FILES)&&isset($_POST['albumID']))
case 'upload': if (isset($_FILES, $_POST['albumID']))
echo upload($_FILES, $_POST['albumID']);
break;
case 'importUrl': if (isset($_POST['url'])&&isset($_POST['albumID']))
case 'importUrl': if (isset($_POST['url'], $_POST['albumID']))
echo importUrl($_POST['url'], $_POST['albumID']);
break;
@ -104,7 +104,7 @@ switch ($_POST['function']) {
case 'init': echo json_encode(init('admin', $_POST['version']));
break;
case 'login': if (isset($_POST['user'])&&isset($_POST['password']))
case 'login': if (isset($_POST['user'], $_POST['password']))
echo login($_POST['user'], $_POST['password']);
break;
@ -113,12 +113,12 @@ switch ($_POST['function']) {
// Settings
case 'setLogin': if (isset($_POST['username'])&&isset($_POST['password']))
case 'setLogin': if (isset($_POST['username'], $_POST['password']))
if (!isset($_POST['oldPassword'])) $_POST['oldPassword'] = '';
echo setLogin($_POST['oldPassword'], $_POST['username'], $_POST['password']);
break;
case 'setSorting': if (isset($_POST['type'])&&isset($_POST['order']))
case 'setSorting': if (isset($_POST['type'], $_POST['order']))
echo setSorting($_POST['type'], $_POST['order']);
break;

View File

@ -16,7 +16,7 @@ switch ($_POST['function']) {
case 'getAlbums': echo json_encode(getAlbums(true));
break;
case 'getAlbum': if (isset($_POST['albumID'])&&isset($_POST['password'])) {
case 'getAlbum': if (isset($_POST['albumID'], $_POST['password'])) {
if (isAlbumPublic($_POST['albumID'])) {
// Album Public
if (checkAlbumPassword($_POST['albumID'], $_POST['password']))
@ -30,7 +30,7 @@ switch ($_POST['function']) {
}
break;
case 'checkAlbumAccess':if (isset($_POST['albumID'])&&isset($_POST['password'])) {
case 'checkAlbumAccess':if (isset($_POST['albumID'], $_POST['password'])) {
if (isAlbumPublic($_POST['albumID'])) {
// Album Public
if (checkAlbumPassword($_POST['albumID'], $_POST['password']))
@ -46,7 +46,7 @@ switch ($_POST['function']) {
// Photo Functions
case 'getPhoto': if (isset($_POST['photoID'])&&isset($_POST['albumID'])&&isset($_POST['password'])) {
case 'getPhoto': if (isset($_POST['photoID'], $_POST['albumID'], $_POST['password'])) {
if (isPhotoPublic($_POST['photoID'], $_POST['password']))
echo json_encode(getPhoto($_POST['photoID'], $_POST['albumID']));
else
@ -59,7 +59,7 @@ switch ($_POST['function']) {
case 'init': echo json_encode(init('public', $_POST['version']));
break;
case 'login': if (isset($_POST['user'])&&isset($_POST['password']))
case 'login': if (isset($_POST['user'], $_POST['password']))
echo login($_POST['user'], $_POST['password']);
break;
@ -67,7 +67,7 @@ switch ($_POST['function']) {
default: switch ($_GET['function']) {
case 'getFeed': if (isset($_GET['albumID'])&&isset($_GET['password'])) {
case 'getFeed': if (isset($_GET['albumID'], $_GET['password'])) {
// Album Feed
if (isAlbumPublic($_GET['albumID'])) {
@ -84,7 +84,7 @@ switch ($_POST['function']) {
}
break;
case 'getAlbumArchive': if (isset($_GET['albumID'])&&isset($_GET['password'])) {
case 'getAlbumArchive': if (isset($_GET['albumID'], $_GET['password'])) {
// Album Download
if (isAlbumPublic($_GET['albumID'])) {
@ -101,7 +101,7 @@ switch ($_POST['function']) {
}
break;
case 'getPhotoArchive': if (isset($_GET['photoID'])&&isset($_GET['password'])) {
case 'getPhotoArchive': if (isset($_GET['photoID'], $_GET['password'])) {
// Photo Download
if (isPhotoPublic($_GET['photoID'], $_GET['password']))

View File

@ -11,7 +11,7 @@ if (!defined('LYCHEE_ACCESS_INSTALLATION')) exit('Error: You are not allowed to
switch ($_POST['function']) {
case 'dbCreateConfig': if (isset($_POST['dbHost'])&&isset($_POST['dbUser'])&&isset($_POST['dbPassword'])&&isset($_POST['dbName'])&&isset($_POST['version']))
case 'dbCreateConfig': if (isset($_POST['dbHost'], $_POST['dbUser'], $_POST['dbPassword'], $_POST['dbName'], $_POST['version']))
echo dbCreateConfig($_POST['dbHost'], $_POST['dbUser'], $_POST['dbPassword'], $_POST['dbName'], $_POST['version']);
break;