Blame view

sources/apps/documents/ajax/personal.php 896 Bytes
d1bafeea1   Kload   [fix] Upgrade to ...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  <?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();
6d9380f96   Cédric Dupont   Update sources OC...
17
  $l = \OC_L10N::get('documents');
d1bafeea1   Kload   [fix] Upgrade to ...
18
19
20
21
22
23
  $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(
6d9380f96   Cédric Dupont   Update sources OC...
24
  					'data' => array('message'=> $l->t('An error occurred while changing directory.'))
d1bafeea1   Kload   [fix] Upgrade to ...
25
26
27
28
29
30
31
  				)
  			);
  		}
  	}
  	\OCP\Config::setUserValue(\OCP\User::getUser(), 'documents', 'save_path', $savePath);
  	\OCP\JSON::success(
  		array(
6d9380f96   Cédric Dupont   Update sources OC...
32
  			'data' => array('message'=> $l->t('Directory saved successfully.'))
d1bafeea1   Kload   [fix] Upgrade to ...
33
34
35
36
  			)
  	);
  	exit();
  }
6d9380f96   Cédric Dupont   Update sources OC...
37
  exit();