Subversion Repository Public Repository

Nextrek

Diff Revisions 299 vs 300 for /Android/SmartCharging/endPoints/add_commento.php

Diff revisions: vs.
  @@ -1,4 +1,6 @@
1 1 <?php
2 + session_start();
3 +
2 4 header("Access-Control-Allow-Origin: *");
3 5 header('Content-Type: application/json; charset=UTF-8');
4 6
  @@ -30,10 +32,23 @@
30 32 $comment->voto = $params["voto"];
31 33 $comment->descrizione = $params["descrizione"];
32 34 $comment->data = $params["data"];
33 - $comment->imgs = $params["imgs"];
35 + //$comment->imgs = $params["imgs"];
34 36
35 37 $risposta = $comment_repo->addComment($comment);
36 38
39 + $commentImgs = array_key_exists("images", $_SESSION) ? $_SESSION["images"] : null;
40 +
41 + if ($risposta["return"] == 0) {
42 + foreach($commentImgs as $image) {
43 + rename("./images/temp/".session_id()."/".$image, "./images/".$image);
44 + }
45 + rmdir("./images/temp/".session_id()."/");
46 + }
47 +
48 + $comment_repo->addImages($risposta["id"], $commentImgs);
49 +
50 + unset($_SESSION["images"]);
51 +
37 52 }
38 53 catch(PDOException $e)
39 54 {