1212
1313namespace OCA \Maps \Controller ;
1414
15+ use OC \User \NoUserException ;
16+ use OCP \DB \Exception ;
17+ use OCP \Files \InvalidPathException ;
1518use OCP \Files \IRootFolder ;
19+ use OCP \Files \NotFoundException ;
20+ use OCP \Files \NotPermittedException ;
1621use OCP \IRequest ;
1722use OCP \AppFramework \Http \TemplateResponse ;
1823use OCP \AppFramework \Http \DataResponse ;
@@ -44,36 +49,55 @@ public function __construct($AppName,
4449 $ this ->root = $ root ;
4550 }
4651
47- /**
48- * @NoAdminRequired
49- * @NoCSRFRequired
52+ /**
53+ * @NoAdminRequired
54+ * @NoCSRFRequired
55+ * @param null $myMapId
56+ * @param null $respectNoMediaAndNoimage
57+ * @param null $hideImagesOnCustomMaps
58+ * @param null $hideImagesInMapsFolder
5059 * @return DataResponse
51- */
52- public function getPhotos ($ myMapId =null ): DataResponse {
60+ * @throws Exception
61+ * @throws NoUserException
62+ * @throws NotFoundException
63+ * @throws NotPermittedException
64+ */
65+ public function getPhotos ($ myMapId =null , $ respectNoMediaAndNoimage =null , $ hideImagesOnCustomMaps =null , $ hideImagesInMapsFolder =null ): DataResponse {
5366 $ userFolder = $ this ->root ->getUserFolder ($ this ->userId );
5467 if (is_null ($ myMapId ) || $ myMapId === "" ) {
55- $ result = $ this ->geophotoService ->getAll ($ this ->userId , $ userFolder );
68+ $ result = $ this ->geophotoService ->getAll ($ this ->userId , $ userFolder, $ respectNoMediaAndNoimage ?? true , $ hideImagesOnCustomMaps ?? false , $ hideImagesInMapsFolder ?? true );
5669 } else {
5770 $ folders = $ userFolder ->getById ($ myMapId );
5871 $ folder = array_shift ($ folders );
59- $ result = $ this ->geophotoService ->getAll ($ this ->userId , $ folder , true , false );
72+ $ result = $ this ->geophotoService ->getAll ($ this ->userId , $ folder , $ respectNoMediaAndNoimage ?? true , $ hideImagesOnCustomMaps ?? false , $ hideImagesInMapsFolder ?? false );
6073 }
6174 return new DataResponse ($ result );
6275 }
6376
6477 /**
6578 * @NoAdminRequired
6679 * @NoCSRFRequired
80+ * @param int|null $myMapId
81+ * @param string|null $timezone
82+ * @param int $limit
83+ * @param int $offset
84+ * @param null $respectNoMediaAndNoimage
85+ * @param null $hideImagesOnCustomMaps
86+ * @param null $hideImagesInMapsFolder
6787 * @return DataResponse
88+ * @throws Exception
89+ * @throws NoUserException
90+ * @throws NotFoundException
91+ * @throws NotPermittedException
6892 */
69- public function getNonLocalizedPhotos ($ myMapId =null , $ timezone =null ): DataResponse {
93+ public function getNonLocalizedPhotos (? int $ myMapId =null , ? string $ timezone= null , int $ limit = 250 , int $ offset = 0 , $ respectNoMediaAndNoimage = null , $ hideImagesOnCustomMaps = null , $ hideImagesInMapsFolder =null ): DataResponse {
7094 $ userFolder = $ this ->root ->getUserFolder ($ this ->userId );
7195 if (is_null ($ myMapId ) || $ myMapId === "" ) {
72- $ result = $ this ->geophotoService ->getNonLocalized ($ this ->userId , $ userFolder , true , true , $ timezone );
96+ $ result = $ this ->geophotoService ->getNonLocalized ($ this ->userId , $ userFolder , $ respectNoMediaAndNoimage ?? true , $ hideImagesOnCustomMaps ?? false , $ hideImagesInMapsFolder ?? true , $ timezone, $ limit , $ offset );
7397 } else {
7498 $ folders = $ userFolder ->getById ($ myMapId );
7599 $ folder = array_shift ($ folders );
76- $ result = $ this ->geophotoService ->getNonLocalized ($ this ->userId , $ folder , true , false , $ timezone );
100+ $ result = $ this ->geophotoService ->getNonLocalized ($ this ->userId , $ folder , $ respectNoMediaAndNoimage ?? true , $ hideImagesOnCustomMaps ?? false , $ hideImagesInMapsFolder ?? false , $ timezone, $ limit , $ offset );
77101 }
78102 return new DataResponse ($ result );
79103 }
@@ -85,14 +109,20 @@ public function getNonLocalizedPhotos($myMapId=null, $timezone=null): DataRespon
85109 * @param $lats
86110 * @param $lngs
87111 * @param bool $directory
112+ * @param null $myMapId
113+ * @param bool $relative
88114 * @return DataResponse
115+ * @throws NoUserException
116+ * @throws NotFoundException
117+ * @throws NotPermittedException
118+ * @throws InvalidPathException
89119 */
90- public function placePhotos ($ paths , $ lats , $ lngs , bool $ directory =false , $ myMapId =null , $ relative =false ): DataResponse {
120+ public function placePhotos ($ paths , $ lats , $ lngs , bool $ directory =false , $ myMapId =null , bool $ relative =false ): DataResponse {
91121 $ userFolder = $ this ->root ->getUserFolder ($ this ->userId );
92122 if (!is_null ($ myMapId ) and $ myMapId !== '' ) {
93123 // forbid folder placement in my-maps
94124 if ($ directory === 'true ' ) {
95- return 0 ;
125+ throw new NotPermittedException () ;
96126 }
97127 $ folders = $ userFolder ->getById ($ myMapId );
98128 $ folder = array_shift ($ folders );
0 commit comments