git-svn-id: https://msi/svn/firstRepo/Service/branches/Manut_2.2.3@57 0f545695-f87b-41b6-9a03-7f16563b5454
This commit is contained in:
@@ -33,6 +33,34 @@ $app->get('/photo/thumbnail/:imageID(/:createImgTag)', function ($imageID, $crea
|
||||
$app->response->redirect($dropBoxObj->GetLink($folder . "/" . $imageFileName), 303);
|
||||
});
|
||||
|
||||
|
||||
$app->get('/photo/medium/:imageID(/:createImgTag)', function ($imageID, $createImgTag = 0) use ($app, $dirRicetteDropBox) {
|
||||
$mysqlconnetion = new MysqlClass;
|
||||
|
||||
$retObj = $mysqlconnetion->queryToObject("select type_format, id_ricette from immagini where id=" . $imageID, false);
|
||||
$mysqlconnetion->disconnetti();
|
||||
$ext = "";
|
||||
if ($retObj["type_format"] == "image/jpeg") {
|
||||
$ext = "jpeg";
|
||||
} else if ($retObj["type_format"] == "image/png") {
|
||||
$ext = "png";
|
||||
}
|
||||
|
||||
$folder = $dirRicetteDropBox . "/" . $retObj["id_ricette"];
|
||||
|
||||
$imageFileName = $imageID . "_medium_ricetta." . $ext;
|
||||
|
||||
$dropBoxObj = new myDropBox();
|
||||
|
||||
if ($createImgTag) {
|
||||
echo '<img src="';
|
||||
echo $dropBoxObj->GetLink($folder . "/" . $imageFileName);
|
||||
echo '"/>';
|
||||
}
|
||||
else
|
||||
$app->response->redirect($dropBoxObj->GetLink($folder . "/" . $imageFileName), 303);
|
||||
});
|
||||
|
||||
$app->get('/photo/:imageID(/:createImgTag)', function ($imageID, $createImgTag = 0) use ($app, $dirRicetteDropBox) {
|
||||
$mysqlconnetion = new MysqlClass;
|
||||
|
||||
@@ -58,4 +86,4 @@ $app->get('/photo/:imageID(/:createImgTag)', function ($imageID, $createImgTag =
|
||||
}
|
||||
else
|
||||
$app->response->redirect($dropBoxObj->GetLink($folder . "/" . $imageFileName), 303);
|
||||
});
|
||||
});
|
||||
|
||||
+2
-2
@@ -31,8 +31,8 @@ $app->hook('slim.before.router', function () use ($app, $allowedHost) {
|
||||
{
|
||||
$app->halt(403, "Request arrive from host not allowed " . $currentHostRequest );
|
||||
return;
|
||||
}*/
|
||||
|
||||
}
|
||||
*/
|
||||
if(isset($_SERVER['HTTP_ORIGIN']))
|
||||
header('Access-Control-Allow-Origin: ' . $_SERVER['HTTP_ORIGIN']);
|
||||
});
|
||||
|
||||
@@ -127,8 +127,38 @@ $app->post('/ricetta/body', function () use ($app) {
|
||||
$pos = $pos + 1;
|
||||
}
|
||||
|
||||
$retValue["ricettaID"] = $retNewID;
|
||||
$retValue["message"] = "Ricetta inserita con successo";
|
||||
} catch (Exception $e) {
|
||||
$retValue["result"] = false;
|
||||
$retValue["message"] = $e->getMessage();
|
||||
}
|
||||
|
||||
$mysqlconnetion->disconnetti();
|
||||
|
||||
returnJson($app, $callbackFn, $retValue);
|
||||
});
|
||||
|
||||
$app->delete('/ricetta/:itemID', function ($itemID) use ($app) {
|
||||
$callbackFn = $app->request()->get('callback');
|
||||
$retValue["result"] = true;
|
||||
$retValue["message"] = "";
|
||||
$mysqlconnetion = new MysqlClass;
|
||||
try {
|
||||
$queryDelete = "DELETE FROM immagini where id_ricette = " . $itemID;
|
||||
$mysqlconnetion->executeQuery($queryDelete);
|
||||
|
||||
$queryDelete = "DELETE FROM blocco_note where ricetta_id = " . $itemID;
|
||||
$mysqlconnetion->executeQuery($queryDelete);
|
||||
|
||||
$queryDelete = "DELETE FROM ingredienti where ID_RICETTE = " . $itemID;
|
||||
$mysqlconnetion->executeQuery($queryDelete);
|
||||
|
||||
$queryDelete = "DELETE FROM ricette where ID = " . $itemID;
|
||||
$mysqlconnetion->executeQuery($queryDelete);
|
||||
$retValue["message"] = "Ricetta cancellata con successo";
|
||||
} catch (Exception $e) {
|
||||
$retValue["result"] = false;
|
||||
$retValue["message"] = $e->getMessage();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user