diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2012-08-03 12:21:49 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2012-08-03 12:21:49 +0200 |
commit | a0b2474019e33fa7737ce6d24e76be34dba52a2d (patch) | |
tree | add8eeffa18e659acaf173cd608f65e3d776c424 /apps/files_encryption/ajax/mode.php | |
parent | bed05f030280087ae73f78acd38c1b797f9776c0 (diff) | |
download | nextcloud-server-a0b2474019e33fa7737ce6d24e76be34dba52a2d.tar.gz nextcloud-server-a0b2474019e33fa7737ce6d24e76be34dba52a2d.zip |
code cleanup and TODOs added
Diffstat (limited to 'apps/files_encryption/ajax/mode.php')
-rw-r--r-- | apps/files_encryption/ajax/mode.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/apps/files_encryption/ajax/mode.php b/apps/files_encryption/ajax/mode.php new file mode 100644 index 00000000000..0515cdccb0a --- /dev/null +++ b/apps/files_encryption/ajax/mode.php @@ -0,0 +1,24 @@ +<?php +/**
+ * Copyright (c) 2012, Bjoern Schiessle <schiessle@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or later.
+ * See the COPYING-README file.
+ */ + +//TODO: Handle switch between client and server side encryption +
+OCP\JSON::checkAppEnabled('files_encryption');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::callCheck();
+ +$mode = $_POST['mode']; + +$query = \OC_DB::prepare( "SELECT mode FROM *PREFIX*encryption WHERE uid = ?" );
+$result = $query->execute(array(\OCP\User::getUser()));
+ +if ($result->fetchRow()){ + $query = OC_DB::prepare( 'UPDATE *PREFIX*encryption SET mode = ? WHERE uid = ?' ); +} else { + $query = OC_DB::prepare( 'INSERT INTO *PREFIX*encryption ( mode, uid ) VALUES( ?, ? )' ); +} +$query->execute(array($mode, \OCP\User::getUser()));
\ No newline at end of file |