| 
									
										
										
										
											2013-10-01 19:34:08 +03:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * ownCloud - Documents App | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @author Victor Dubiniuk | 
					
						
							|  |  |  |  * @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This file is licensed under the Affero General Public License version 3 or | 
					
						
							|  |  |  |  * later. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace OCA\Documents; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | \OCP\JSON::callCheck(); | 
					
						
							|  |  |  | \OCP\JSON::checkLoggedIn(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-01 03:43:36 +02:00
										 |  |  | $l = \OC_L10N::get('documents'); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-10-01 19:34:08 +03:00
										 |  |  | $savePath = isset($_POST['savePath']) ? $_POST['savePath'] : null; | 
					
						
							|  |  |  | if (!is_null($savePath)){ | 
					
						
							|  |  |  | 	if (\OC\Files\Filesystem::file_exists($savePath) ===false ){ | 
					
						
							|  |  |  | 		if(!\OC\Files\Filesystem::mkdir($savePath)){ | 
					
						
							|  |  |  | 			\OCP\JSON::error( | 
					
						
							|  |  |  | 				array( | 
					
						
							| 
									
										
										
										
											2014-06-01 03:43:36 +02:00
										 |  |  | 					'data' => array('message'=> $l->t('An error occurred while changing directory.')) | 
					
						
							| 
									
										
										
										
											2013-10-01 19:34:08 +03:00
										 |  |  | 				) | 
					
						
							|  |  |  | 			); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	\OCP\Config::setUserValue(\OCP\User::getUser(), 'documents', 'save_path', $savePath); | 
					
						
							|  |  |  | 	\OCP\JSON::success( | 
					
						
							|  |  |  | 		array( | 
					
						
							| 
									
										
										
										
											2014-06-01 03:43:36 +02:00
										 |  |  | 			'data' => array('message'=> $l->t('Directory saved successfully.')) | 
					
						
							| 
									
										
										
										
											2013-10-01 19:34:08 +03:00
										 |  |  | 			) | 
					
						
							|  |  |  | 	); | 
					
						
							|  |  |  | 	exit(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-01 03:43:36 +02:00
										 |  |  | exit(); |