Nextrek
Diff Revisions
506
vs
507
for /Android/SmartCharging/endPoints/registrazione_locale.php
|
@@ -4,10 +4,12 @@ |
4 |
4 |
|
header("Access-Control-Allow-Origin: *"); |
5 |
5 |
|
header('Content-Type: application/json; charset=UTF-8'); |
6 |
6 |
|
|
7 |
|
- |
require_once("UserRepository.php"); |
8 |
|
- |
require_once("User.php"); |
9 |
|
- |
require_once("LocalRepository.php"); |
10 |
|
- |
require_once("Local.php"); |
|
7 |
+ |
require_once("constants.php"); |
|
8 |
+ |
|
|
9 |
+ |
require_once("repositories/UserRepository.php"); |
|
10 |
+ |
require_once("classes/User.php"); |
|
11 |
+ |
require_once("repositories/LocalRepository.php"); |
|
12 |
+ |
require_once("classes/Local.php"); |
11 |
13 |
|
|
12 |
14 |
|
require_once("utilities.php"); |
13 |
15 |
|
|
|
@@ -50,7 +52,7 @@ |
50 |
52 |
|
|
51 |
53 |
|
if ($params["avatar"] != "") { |
52 |
54 |
|
$imgExtention = substr(strrchr($params["avatar"],'.'),1); |
53 |
|
- |
$risposta["avatar_path"] = "./avatar/".sha1($strToHash)."-".strval(time()).".".$imgExtention; |
|
55 |
+ |
$risposta["avatar_name"] = uniqid().".".$imgExtention; |
54 |
56 |
|
} |
55 |
57 |
|
|
56 |
58 |
|
if ($statusUser["return"]!=0) { |
|
@@ -66,8 +68,9 @@ |
66 |
68 |
|
$local->descrizione = $params["descrizione"]; |
67 |
69 |
|
$local->tipologia = $params["tipologia"]; |
68 |
70 |
|
//$local->imgs = $params["imgs"]; |
69 |
|
- |
$local->lat = array_key_exists("lat", $params)? $params["lat"] : null; |
70 |
|
- |
$local->lon = array_key_exists("lon", $params)? $params["lon"] : null; |
|
71 |
+ |
$local->lat = array_key_exists("lat", $params) ? $params["lat"] : null; |
|
72 |
+ |
$local->lon = array_key_exists("lon", $params) ? $params["lon"] : null; |
|
73 |
+ |
$local->indirizzo = array_key_exists("indirizzo", $params) ? $params["indirizzo"] : null; |
71 |
74 |
|
|
72 |
75 |
|
$statusLocal = $local_repo->registerLocal($local); |
73 |
76 |
|
$risposta["local_id"] = $statusLocal["local_id"]; |
|
@@ -78,10 +81,10 @@ |
78 |
81 |
|
|
79 |
82 |
|
if ($risposta["return"] == 0 && count($localImgs)>0) { |
80 |
83 |
|
foreach($localImgs as $image) { |
81 |
|
- |
rename("./images/temp/".$image, "./images/".$image); |
|
84 |
+ |
rename($_SERVER['DOCUMENT_ROOT'].TEMP_IMAGES_PATH.session_id()."/".$image, $_SERVER['DOCUMENT_ROOT'].IMAGES_PATH.$image); |
82 |
85 |
|
} |
83 |
86 |
|
//rmdir("./images/temp/".session_id()."/"); |
84 |
|
- |
//deleteDirectory("./images/temp/".session_id()."/"); |
|
87 |
+ |
deleteDirectory($_SERVER['DOCUMENT_ROOT'].TEMP_IMAGES_PATH.session_id()."/"); |
85 |
88 |
|
$local_repo->addImages($risposta["local_id"], $localImgs); |
86 |
89 |
|
} |
87 |
90 |
|
|