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

30 lines
705 B
PHP

<?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();
}