1
0
mirror of https://github.com/owncloud/bookmarks.git synced 2024-12-12 13:08:49 +01:00
OwncloudBookmarksOfficial/ajax/changescreen.php

30 lines
705 B
PHP
Raw Normal View History

<?php
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('bookmarks');
if(isset($_POST['view'])) {
$view = $_POST['view'];
switch($view){
case 'list':
case 'image';
break;
default:
OCP\JSON::error(array('message'=>'unexspected parameter: ' . $view));
exit;
}
OCP\Config::setUserValue(OCP\USER::getUser(), 'bookmarks', 'currentview', $view);
OCP\JSON::success();
}elseif(isset($_POST['sidebar'])) {
$view = $_POST['sidebar'];
switch($view){
case 'true':
case 'false';
break;
default:
OCP\JSON::error(array('message'=>'unexspected parameter: ' . $view));
exit;
}
OCP\Config::setUserValue(OCP\USER::getUser(), 'bookmarks', 'sidebar', $view);
OCP\JSON::success();
}