// Check if we are a user
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('bookmarks');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('bookmarks');
require_once(OC::$APPSROOT . '/apps/bookmarks/bookmarksHelper.php');
$id = addBookmark($_GET['url'], $_GET['title'], $_GET['tags']);
-OC_JSON::success(array('data' => $id));
\ No newline at end of file
+OCP\JSON::success(array('data' => $id));
\ No newline at end of file
// Check if we are a user
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('bookmarks');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('bookmarks');
$params=array(
htmlspecialchars_decode($_GET["url"]),
$result = $query->execute();
// var_dump($params);
-OC_JSON::success(array('data' => array()));
+OCP\JSON::success(array('data' => array()));
// Check if we are a user
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('bookmarks');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('bookmarks');
$CONFIG_DBTYPE = OCP\Config::getSystemValue( "dbtype", "sqlite" );
if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
// Check if we are a user
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('bookmarks');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('bookmarks');
$query = OC_DB::prepare("
UPDATE *PREFIX*bookmarks
// Check if we are a user
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('bookmarks');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('bookmarks');
//Filter for tag?
$bookmarks = OC_Bookmarks_Bookmarks::findBookmarks($offset, $sqlSortColumn, $filterTag, true);
-OC_JSON::success(array('data' => $bookmarks));
+OCP\JSON::success(array('data' => $bookmarks));
*/
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('calendar');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('calendar');
$calendarid = $_POST['calendarid'];
$calendar = OC_Calendar_App::getCalendar($calendarid);//access check
OC_Calendar_Calendar::setCalendarActive($calendarid, $_POST['active']);
$calendar = OC_Calendar_App::getCalendar($calendarid);
-OC_JSON::success(array(
+OCP\JSON::success(array(
'active' => $calendar['active'],
'eventSource' => OC_Calendar_Calendar::getEventSourceInfo($calendar),
));
*/
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('calendar');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('calendar');
$cal = $_POST["calendarid"];
$calendar = OC_Calendar_App::getCalendar($cal);
$del = OC_Calendar_Calendar::deleteCalendar($cal);
if($del == true){
- OC_JSON::success();
+ OCP\JSON::success();
}else{
- OC_JSON::error(array('error'=>'dberror'));
+ OCP\JSON::error(array('error'=>'dberror'));
}
?>
*/
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('calendar');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('calendar');
$calendarcolor_options = OC_Calendar_Calendar::getCalendarColorOptions();
$calendar = OC_Calendar_App::getCalendar($_GET['calendarid']);
*/
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('calendar');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('calendar');
$calendarcolor_options = OC_Calendar_Calendar::getCalendarColorOptions();
$calendar = OC_Calendar_App::getCalendar($_GET['calendarid']);
*/
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('calendar');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('calendar');
$calendarcolor_options = OC_Calendar_Calendar::getCalendarColorOptions();
$calendar = array(
'id' => 'new',
// Check if we are a user
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('calendar');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('calendar');
if(trim($_POST['name']) == ''){
- OC_JSON::error(array('message'=>'empty'));
+ OCP\JSON::error(array('message'=>'empty'));
exit;
}
$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser());
foreach($calendars as $cal){
if($cal['displayname'] == $_POST['name']){
- OC_JSON::error(array('message'=>'namenotavailable'));
+ OCP\JSON::error(array('message'=>'namenotavailable'));
exit;
}
}
$calendar = OC_Calendar_Calendar::find($calendarid);
$tmpl = new OC_Template('calendar', 'part.choosecalendar.rowfields');
$tmpl->assign('calendar', $calendar);
-OC_JSON::success(array(
+OCP\JSON::success(array(
'page' => $tmpl->fetchPage(),
'eventSource' => OC_Calendar_Calendar::getEventSourceInfo($calendar),
));
$l10n = OC_L10N::get('calendar');
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('calendar');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('calendar');
$output = new OC_TEMPLATE("calendar", "part.choosecalendar");
$output -> printpage();
?>
// Check if we are a user
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('calendar');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('calendar');
if(trim($_POST['name']) == ''){
- OC_JSON::error(array('message'=>'empty'));
+ OCP\JSON::error(array('message'=>'empty'));
exit;
}
$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser());
foreach($calendars as $cal){
if($cal['displayname'] == $_POST['name'] && $cal['id'] != $_POST['id']){
- OC_JSON::error(array('message'=>'namenotavailable'));
+ OCP\JSON::error(array('message'=>'namenotavailable'));
exit;
}
}
$calendar = OC_Calendar_App::getCalendar($calendarid);
$tmpl = new OC_Template('calendar', 'part.choosecalendar.rowfields');
$tmpl->assign('calendar', $calendar);
-OC_JSON::success(array(
+OCP\JSON::success(array(
'page' => $tmpl->fetchPage(),
'eventSource' => OC_Calendar_Calendar::getEventSourceInfo($calendar),
));
*/
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('calendar');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('calendar');
foreach ($_POST as $key=>$element) {
debug('_POST: '.$key.'=>'.print_r($element, true));
}
function bailOut($msg) {
- OC_JSON::error(array('data' => array('message' => $msg)));
+ OCP\JSON::error(array('data' => array('message' => $msg)));
OCP\Util::writeLog('calendar','ajax/categories/rescan.php: '.$msg, OCP\Util::DEBUG);
exit();
}
OC_Calendar_App::scanCategories($events);
$categories = OC_Calendar_App::getCategoryOptions();
-OC_JSON::success(array('data' => array('categories'=>$categories)));
+OCP\JSON::success(array('data' => array('categories'=>$categories)));
* later.
* See the COPYING-README file.
*/
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('calendar');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('calendar');
$view = $_GET['v'];
switch($view){
case 'agendaWeek':
case 'list':
break;
default:
- OC_JSON::error(array('message'=>'unexspected parameter: ' . $view));
+ OCP\JSON::error(array('message'=>'unexspected parameter: ' . $view));
exit;
}
OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'currentview', $view);
-OC_JSON::success();
+OCP\JSON::success();
?>
*/
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('calendar');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('calendar');
$id = $_POST['id'];
$access = OC_Calendar_App::getaccess($id, OC_Calendar_App::EVENT);
if($access != 'owner' && $access != 'rw'){
- OC_JSON::error(array('message'=>'permission denied'));
+ OCP\JSON::error(array('message'=>'permission denied'));
exit;
}
$result = OC_Calendar_Object::delete($id);
-OC_JSON::success();
+OCP\JSON::success();
if(!OCP\User::isLoggedIn()) {
die('<script type="text/javascript">document.location = oc_webroot;</script>');
}
-OC_JSON::checkAppEnabled('calendar');
+OCP\JSON::checkAppEnabled('calendar');
$id = $_GET['id'];
$data = OC_Calendar_App::getEventObject($id, true, true);
if(!$data){
- OC_JSON::error(array('data' => array('message' => self::$l10n->t('Wrong calendar'))));
+ OCP\JSON::error(array('data' => array('message' => self::$l10n->t('Wrong calendar'))));
exit;
}
$access = OC_Calendar_App::getaccess($id, OC_Calendar_Share::EVENT);
*/
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('calendar');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('calendar');
$id = $_POST['id'];
$access = OC_Calendar_App::getaccess($id, OC_Calendar_App::EVENT);
if($access != 'owner' && $access != 'rw'){
- OC_JSON::error(array('message'=>'permission denied'));
+ OCP\JSON::error(array('message'=>'permission denied'));
exit;
}
$errarr = OC_Calendar_Object::validateRequest($_POST);
if($errarr){
//show validate errors
- OC_JSON::error($errarr);
+ OCP\JSON::error($errarr);
exit;
}else{
$data = OC_Calendar_App::getEventObject($id, false, false);
if ($data['calendarid'] != $cal) {
OC_Calendar_Object::moveToCalendar($id, $cal);
}
- OC_JSON::success();
+ OCP\JSON::success();
}
?>
* See the COPYING-README file.
*/
-OC_JSON::checkLoggedIn();
+OCP\JSON::checkLoggedIn();
$id = $_POST['id'];
$access = OC_Calendar_App::getaccess($id, OC_Calendar_App::EVENT);
if($access != 'owner' && $access != 'rw'){
- OC_JSON::error(array('message'=>'permission denied'));
+ OCP\JSON::error(array('message'=>'permission denied'));
exit;
}
$vcalendar = OC_Calendar_App::getVCalendar($id, false, false);
$result = OC_Calendar_Object::edit($id, $vcalendar->serialize());
$lastmodified = $vevent->__get('LAST-MODIFIED')->getDateTime();
-OC_JSON::success(array('lastmodified'=>(int)$lastmodified->format('U')));
+OCP\JSON::success(array('lastmodified'=>(int)$lastmodified->format('U')));
if(!OCP\User::isLoggedIn()) {
die('<script type="text/javascript">document.location = oc_webroot;</script>');
}
-OC_JSON::checkAppEnabled('calendar');
+OCP\JSON::checkAppEnabled('calendar');
if (!isset($_POST['start'])){
- OC_JSON::error();
+ OCP\JSON::error();
die;
}
$start = $_POST['start'];
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('calendar');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('calendar');
$errarr = OC_Calendar_Object::validateRequest($_POST);
if($errarr){
//show validate errors
- OC_JSON::error($errarr);
+ OCP\JSON::error($errarr);
exit;
}else{
$cal = $_POST['calendar'];
$vcalendar = OC_Calendar_Object::createVCalendarFromRequest($_POST);
$result = OC_Calendar_Object::add($cal, $vcalendar->serialize());
- OC_JSON::success();
+ OCP\JSON::success();
}
?>
* See the COPYING-README file.
*/
-OC_JSON::checkLoggedIn();
+OCP\JSON::checkLoggedIn();
$id = $_POST['id'];
$access = OC_Calendar_App::getaccess($id, OC_Calendar_App::EVENT);
if($access != 'owner' && $access != 'rw'){
- OC_JSON::error(array('message'=>'permission denied'));
+ OCP\JSON::error(array('message'=>'permission denied'));
exit;
}
OC_Calendar_Object::edit($id, $vcalendar->serialize());
$lastmodified = $vevent->__get('LAST-MODIFIED')->getDateTime();
-OC_JSON::success(array('lastmodified'=>(int)$lastmodified->format('U')));
+OCP\JSON::success(array('lastmodified'=>(int)$lastmodified->format('U')));
require_once('when/When.php');
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('calendar');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('calendar');
$start = (version_compare(PHP_VERSION, '5.3.0', '>='))?DateTime::createFromFormat('U', $_GET['start']):new DateTime('@' . $_GET['start']);
$end = (version_compare(PHP_VERSION, '5.3.0', '>='))?DateTime::createFromFormat('U', $_GET['end']):new DateTime('@' . $_GET['end']);
foreach($events as $event){
$output[] = OC_Calendar_App::generateEventOutput($event, $start, $end);
}
-OC_JSON::encodedPrint($output);
+OCP\JSON::encodedPrint($output);
?>
*/
-OC_JSON::checkLoggedIn();
+OCP\JSON::checkLoggedIn();
OCP\App::checkAppEnabled('calendar');
$tmpl = new OC_Template('calendar', 'part.import');
$tmpl->assign('path', $_POST['path']);
*/
//check for calendar rights or create new one
ob_start();
-OC_JSON::checkLoggedIn();
+OCP\JSON::checkLoggedIn();
OCP\App::checkAppEnabled('calendar');
$nl="\r\n";
$comps = array('VEVENT'=>true, 'VTODO'=>true, 'VJOURNAL'=>true);
}else{
$calendar = OC_Calendar_App::getCalendar($_POST['id']);
if($calendar['userid'] != OCP\USER::getUser()){
- OC_JSON::error();
+ OCP\JSON::error();
exit();
}
$id = $_POST['id'];
if(is_writable('import_tmp/')){
unlink($progressfile);
}
-OC_JSON::success();
+OCP\JSON::success();
* See the COPYING-README file.
*/
-OC_JSON::checkLoggedIn();
+OCP\JSON::checkLoggedIn();
$firstday = OCP\Config::getUserValue( OCP\USER::getUser(), 'calendar', 'firstday', 'mo');
-OC_JSON::encodedPrint(array('firstday' => $firstday));
+OCP\JSON::encodedPrint(array('firstday' => $firstday));
?>
* See the COPYING-README file.
*/
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('calendar');
-OC_JSON::success(array('detection' => OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezonedetection')));
\ No newline at end of file
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('calendar');
+OCP\JSON::success(array('detection' => OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezonedetection')));
\ No newline at end of file
*/
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('calendar');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('calendar');
$l = OC_L10N::get('calendar');
$timezone = OC_Geo::timezone($lat, $lng);
if($timezone == OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezone')){
- OC_JSON::success();
+ OCP\JSON::success();
exit;
}
OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'timezone', $timezone);
$message = array('message'=> $l->t('New Timezone:') . $timezone);
-OC_JSON::success($message);
+OCP\JSON::success($message);
?>
\ No newline at end of file
* See the COPYING-README file.
*/
-OC_JSON::checkLoggedIn();
+OCP\JSON::checkLoggedIn();
if(isset($_POST["firstday"])){
OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'firstday', $_POST["firstday"]);
- OC_JSON::success();
+ OCP\JSON::success();
}else{
- OC_JSON::error();
+ OCP\JSON::error();
}
?>
* See the COPYING-README file.
*/
-OC_JSON::checkLoggedIn();
+OCP\JSON::checkLoggedIn();
if(isset($_POST["timeformat"])){
OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'timeformat', $_POST["timeformat"]);
- OC_JSON::success();
+ OCP\JSON::success();
}else{
- OC_JSON::error();
+ OCP\JSON::error();
}
?>
$l=OC_L10N::get('calendar');
// Check if we are a user
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('calendar');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('calendar');
// Get data
if( isset( $_POST['timezone'] ) ){
$timezone=$_POST['timezone'];
OCP\Config::setUserValue( OCP\USER::getUser(), 'calendar', 'timezone', $timezone );
- OC_JSON::success(array('data' => array( 'message' => $l->t('Timezone changed') )));
+ OCP\JSON::success(array('data' => array( 'message' => $l->t('Timezone changed') )));
}else{
- OC_JSON::error(array('data' => array( 'message' => $l->t('Invalid request') )));
+ OCP\JSON::error(array('data' => array( 'message' => $l->t('Invalid request') )));
}
?>
* See the COPYING-README file.
*/
-OC_JSON::checkLoggedIn();
+OCP\JSON::checkLoggedIn();
$timeformat = OCP\Config::getUserValue( OCP\USER::getUser(), 'calendar', 'timeformat', "24");
-OC_JSON::encodedPrint(array("timeformat" => $timeformat));
+OCP\JSON::encodedPrint(array("timeformat" => $timeformat));
?>
* See the COPYING-README file.
*/
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('calendar');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('calendar');
if(array_key_exists('timezonedetection', $_POST)){
if($_POST['timezonedetection'] == 'on'){
OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'timezonedetection', 'true');
}else{
OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'timezonedetection', 'false');
}
- OC_JSON::success();
+ OCP\JSON::success();
}else{
- OC_JSON::error();
+ OCP\JSON::error();
}
\ No newline at end of file
$id = strip_tags($_GET['id']);
$activation = strip_tags($_GET['activation']);
OC_Calendar_Share::set_active(OCP\USER::getUser(), $id, $activation);
-OC_JSON::success();
\ No newline at end of file
+OCP\JSON::success();
\ No newline at end of file
case 'event':
break;
default:
- OC_JSON::error(array('message'=>'unexspected parameter'));
+ OCP\JSON::error(array('message'=>'unexspected parameter'));
exit;
}
$sharewith = $_GET['sharewith'];
case 'public':
break;
default:
- OC_JSON::error(array('message'=>'unexspected parameter'));
+ OCP\JSON::error(array('message'=>'unexspected parameter'));
exit;
}
if($sharetype == 'user' && !OCP\User::userExists($sharewith)){
- OC_JSON::error(array('message'=>'user not found'));
+ OCP\JSON::error(array('message'=>'user not found'));
exit;
}
if($sharetype == 'group' && !OC_Group::groupExists($sharewith)){
- OC_JSON::error(array('message'=>'group not found'));
+ OCP\JSON::error(array('message'=>'group not found'));
exit;
}
$success = OC_Calendar_Share::changepermission($sharewith, $sharetype, $id, $permission, (($idtype=='calendar') ? OC_Calendar_Share::CALENDAR : OC_Calendar_Share::EVENT));
-OC_JSON::success();
\ No newline at end of file
+OCP\JSON::success();
\ No newline at end of file
$calid = $_GET['calid'];
$calendar = OC_Calendar_Calendar::find($calid);
if($calendar['userid'] != $user){
- OC_JSON::error();
+ OCP\JSON::error();
exit;
}
$tmpl = new OC_Template('calendar', 'share.dropdown');
case 'event':
break;
default:
- OC_JSON::error(array('message'=>'unexspected parameter'));
+ OCP\JSON::error(array('message'=>'unexspected parameter'));
exit;
}
if($idtype == 'calendar' && !OC_Calendar_App::getCalendar($id)){
- OC_JSON::error(array('message'=>'permission denied'));
+ OCP\JSON::error(array('message'=>'permission denied'));
exit;
}
if($idtype == 'event' && !OC_Calendar_App::getEventObject($id)){
- OC_JSON::error(array('message'=>'permission denied'));
+ OCP\JSON::error(array('message'=>'permission denied'));
exit;
}
$sharewith = $_GET['sharewith'];
case 'public':
break;
default:
- OC_JSON::error(array('message'=>'unexspected parameter'));
+ OCP\JSON::error(array('message'=>'unexspected parameter'));
exit;
}
if($sharetype == 'user' && !OCP\User::userExists($sharewith)){
- OC_JSON::error(array('message'=>'user not found'));
+ OCP\JSON::error(array('message'=>'user not found'));
exit;
}
if($sharetype == 'group' && !OC_Group::groupExists($sharewith)){
- OC_JSON::error(array('message'=>'group not found'));
+ OCP\JSON::error(array('message'=>'group not found'));
exit;
}
if($sharetype == 'user' && OCP\USER::getUser() == $sharewith){
- OC_JSON::error(array('meesage'=>'you can not share with yourself'));
+ OCP\JSON::error(array('meesage'=>'you can not share with yourself'));
}
$success = OC_Calendar_Share::share(OCP\USER::getUser(), $sharewith, $sharetype, $id, (($idtype=='calendar') ? OC_Calendar_Share::CALENDAR : OC_Calendar_Share::EVENT));
if($success){
if($sharetype == 'public'){
- OC_JSON::success(array('message'=>$success));
+ OCP\JSON::success(array('message'=>$success));
}else{
- OC_JSON::success(array('message'=>'shared'));
+ OCP\JSON::success(array('message'=>'shared'));
}
}else{
- OC_JSON::error(array('message'=>'can not share'));
+ OCP\JSON::error(array('message'=>'can not share'));
exit;
}
\ No newline at end of file
case 'event':
break;
default:
- OC_JSON::error(array('message'=>'unexspected parameter'));
+ OCP\JSON::error(array('message'=>'unexspected parameter'));
exit;
}
$sharewith = $_GET['sharewith'];
case 'public':
break;
default:
- OC_JSON::error(array('message'=>'unexspected parameter'));
+ OCP\JSON::error(array('message'=>'unexspected parameter'));
exit;
}
if($sharetype == 'user' && !OCP\User::userExists($sharewith)){
- OC_JSON::error(array('message'=>'user not found'));
+ OCP\JSON::error(array('message'=>'user not found'));
exit;
}elseif($sharetype == 'group' && !OC_Group::groupExists($sharewith)){
- OC_JSON::error(array('message'=>'group not found'));
+ OCP\JSON::error(array('message'=>'group not found'));
exit;
}
$success = OC_Calendar_Share::unshare(OCP\USER::getUser(), $sharewith, $sharetype, $id, (($idtype=='calendar') ? OC_Calendar_Share::CALENDAR : OC_Calendar_Share::EVENT));
if($success){
- OC_JSON::success();
+ OCP\JSON::success();
}else{
- OC_JSON::error(array('message'=>'can not unshare'));
+ OCP\JSON::error(array('message'=>'can not unshare'));
exit;
}
\ No newline at end of file
public static function isNotModified($vevent, $lastmodified){
$last_modified = $vevent->__get('LAST-MODIFIED');
if($last_modified && $lastmodified != $last_modified->getDateTime()->format('U')){
- OC_JSON::error(array('modified'=>true));
+ OCP\JSON::error(array('modified'=>true));
exit;
}
return true;
*/
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('contacts');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('contacts');
$bookid = $_POST['bookid'];
$book = OC_Contacts_App::getAddressbook($bookid);// is owner access check
if(!OC_Contacts_Addressbook::setActive($bookid, $_POST['active'])) {
OCP\Util::writeLog('contacts','ajax/activation.php: Error activating addressbook: '.$bookid, OCP\Util::ERROR);
- OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Error (de)activating addressbook.'))));
+ OCP\JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Error (de)activating addressbook.'))));
exit();
}
-OC_JSON::success(array(
+OCP\JSON::success(array(
'active' => OC_Contacts_Addressbook::isActive($bookid),
'bookid' => $bookid,
'book' => $book,
*/
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('contacts');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('contacts');
$book = array(
'id' => 'new',
'displayname' => '',
// Init owncloud
function bailOut($msg) {
- OC_JSON::error(array('data' => array('message' => $msg)));
+ OCP\JSON::error(array('data' => array('message' => $msg)));
OCP\Util::writeLog('contacts','ajax/addcontact.php: '.$msg, OCP\Util::DEBUG);
exit();
}
}
// Check if we are a user
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('contacts');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('contacts');
foreach ($_POST as $key=>$element) {
debug('_POST: '.$key.'=>'.$element);
$id = OC_Contacts_VCard::add($aid,$vcard);
if(!$id) {
- OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('There was an error adding the contact.'))));
+ OCP\JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('There was an error adding the contact.'))));
OCP\Util::writeLog('contacts','ajax/addcontact.php: Recieved non-positive ID on adding card: '.$id, OCP\Util::ERROR);
exit();
}
-OC_JSON::success(array('data' => array( 'id' => $id )));
+OCP\JSON::success(array('data' => array( 'id' => $id )));
// Check if we are a user
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('contacts');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('contacts');
$id = isset($_POST['id'])?$_POST['id']:null;
$name = isset($_POST['name'])?$_POST['name']:null;
if(!is_array($value)){
$value = trim($value);
if(!$value && in_array($name, array('TEL', 'EMAIL', 'ORG', 'BDAY', 'NICKNAME', 'NOTE'))) {
- OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Cannot add empty property.'))));
+ OCP\JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Cannot add empty property.'))));
exit();
}
} elseif($name === 'ADR') { // only add if non-empty elements.
}
}
if($empty) {
- OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('At least one of the address fields has to be filled out.'))));
+ OCP\JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('At least one of the address fields has to be filled out.'))));
exit();
}
}
foreach($current as $item) {
$tmpvalue = (is_array($value)?implode(';', $value):$value);
if($tmpvalue == $item->value) {
- OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Trying to add duplicate property: ').$name.': '.$tmpvalue)));
+ OCP\JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Trying to add duplicate property: ').$name.': '.$tmpvalue)));
OCP\Util::writeLog('contacts','ajax/addproperty.php: Trying to add duplicate property: '.$name.': '.$tmpvalue, OCP\Util::DEBUG);
exit();
}
$checksum = md5($vcard->children[$line]->serialize());
if(!OC_Contacts_VCard::edit($id,$vcard)) {
- OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Error adding contact property.'))));
+ OCP\JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Error adding contact property.'))));
OCP\Util::writeLog('contacts','ajax/addproperty.php: Error updating contact property: '.$name, OCP\Util::ERROR);
exit();
}
-OC_JSON::success(array('data' => array( 'checksum' => $checksum )));
+OCP\JSON::success(array('data' => array( 'checksum' => $checksum )));
*/
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('contacts');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('contacts');
$id = isset($_GET['id'])?$_GET['id']:null;
if(is_null($id)) {
- OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('No ID provided'))));
+ OCP\JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('No ID provided'))));
exit();
}
$vcard = OC_Contacts_App::getContactVCard( $id );
//OCP\Util::writeLog('contacts','ajax/categories/checksumfor.php: '.$property->name, OCP\Util::DEBUG);
if($property->name == 'CATEGORIES') {
$checksum = md5($property->serialize());
- OC_JSON::success(array('data' => array('value'=>$property->value, 'checksum'=>$checksum)));
+ OCP\JSON::success(array('data' => array('value'=>$property->value, 'checksum'=>$checksum)));
exit();
}
}
-OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Error setting checksum.'))));
+OCP\JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Error setting checksum.'))));
?>
*/
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('contacts');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('contacts');
foreach ($_POST as $key=>$element) {
debug('_POST: '.$key.'=>'.print_r($element, true));
}
function bailOut($msg) {
- OC_JSON::error(array('data' => array('message' => $msg)));
+ OCP\JSON::error(array('data' => array('message' => $msg)));
OCP\Util::writeLog('contacts','ajax/categories/delete.php: '.$msg, OCP\Util::DEBUG);
exit();
}
$catman->delete($categories, $cards);
debug('After delete: '.print_r($catman->categories(), true));
OC_Contacts_VCard::updateDataByID($cards);
-OC_JSON::success(array('data' => array('categories'=>$catman->categories())));
+OCP\JSON::success(array('data' => array('categories'=>$catman->categories())));
?>
*/
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('contacts');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('contacts');
$categories = OC_Contacts_App::getCategories();
-OC_JSON::success(array('data' => array('categories'=>$categories)));
+OCP\JSON::success(array('data' => array('categories'=>$categories)));
?>
*/
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('contacts');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('contacts');
foreach ($_POST as $key=>$element) {
debug('_POST: '.$key.'=>'.print_r($element, true));
}
function bailOut($msg) {
- OC_JSON::error(array('data' => array('message' => $msg)));
+ OCP\JSON::error(array('data' => array('message' => $msg)));
OCP\Util::writeLog('contacts','ajax/categories/rescan.php: '.$msg, OCP\Util::DEBUG);
exit();
}
OC_Contacts_App::scanCategories($contacts);
$categories = OC_Contacts_App::getCategories();
-OC_JSON::success(array('data' => array('categories'=>$categories)));
+OCP\JSON::success(array('data' => array('categories'=>$categories)));
?>
*/
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('contacts');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('contacts');
$output = new OC_TEMPLATE("contacts", "part.chooseaddressbook");
$output -> printpage();
// Init owncloud
function bailOut($msg) {
- OC_JSON::error(array('data' => array('message' => $msg)));
+ OCP\JSON::error(array('data' => array('message' => $msg)));
OCP\Util::writeLog('contacts','ajax/contactdetails.php: '.$msg, OCP\Util::DEBUG);
exit();
}
// Check if we are a user
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('contacts');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('contacts');
$id = isset($_GET['id'])?$_GET['id']:null;
if(is_null($id)) {
}
$details['id'] = $id;
OC_Contacts_App::setLastModifiedHeader($vcard);
-OC_JSON::success(array('data' => $details));
+OCP\JSON::success(array('data' => $details));
*/
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('contacts');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('contacts');
$ids = OC_Contacts_Addressbook::activeIds(OCP\USER::getUser());
$contacts = OC_Contacts_VCard::all($ids);
$tmpl->assign('contacts', $contacts);
$page = $tmpl->fetchPage();
-OC_JSON::success(array('data' => array( 'page' => $page )));
+OCP\JSON::success(array('data' => array( 'page' => $page )));
?>
// Check if we are a user
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('contacts');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('contacts');
$userid = OCP\USER::getUser();
$name = trim(strip_tags($_POST['name']));
if(!$name) {
- OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Cannot add addressbook with an empty name.'))));
+ OCP\JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Cannot add addressbook with an empty name.'))));
OCP\Util::writeLog('contacts','ajax/createaddressbook.php: Cannot add addressbook with an empty name: '.strip_tags($_POST['name']), OCP\Util::ERROR);
exit();
}
$bookid = OC_Contacts_Addressbook::add($userid, $name, null);
if(!$bookid) {
- OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Error adding addressbook.'))));
+ OCP\JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Error adding addressbook.'))));
OCP\Util::writeLog('contacts','ajax/createaddressbook.php: Error adding addressbook: '.$_POST['name'], OCP\Util::ERROR);
exit();
}
if(!OC_Contacts_Addressbook::setActive($bookid, 1)) {
- OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Error activating addressbook.'))));
+ OCP\JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Error activating addressbook.'))));
OCP\Util::writeLog('contacts','ajax/createaddressbook.php: Error activating addressbook: '.$bookid, OCP\Util::ERROR);
//exit();
}
$addressbook = OC_Contacts_App::getAddressbook($bookid);
$tmpl = new OC_Template('contacts', 'part.chooseaddressbook.rowfields');
$tmpl->assign('addressbook', $addressbook);
-OC_JSON::success(array(
+OCP\JSON::success(array(
'page' => $tmpl->fetchPage(),
'addressbook' => $addressbook,
));
// Check if we are a user
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('contacts');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('contacts');
$tmp_path = $_GET['tmp_path'];
$id = $_GET['id'];
$tmpl->assign('id', $id);
$page = $tmpl->fetchPage();
-OC_JSON::success(array('data' => array( 'page' => $page )));
+OCP\JSON::success(array('data' => array( 'page' => $page )));
// Check if we are a user
// Firefox and Konqueror tries to download application/json for me. --Arthur
-OC_JSON::setContentTypeHeader('text/plain');
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('contacts');
+OCP\JSON::setContentTypeHeader('text/plain');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('contacts');
function bailOut($msg) {
- OC_JSON::error(array('data' => array('message' => $msg)));
+ OCP\JSON::error(array('data' => array('message' => $msg)));
OCP\Util::writeLog('contacts','ajax/currentphoto.php: '.$msg, OCP\Util::ERROR);
exit();
}
}
if($image->valid()) {
if($image->save($tmpfname)) {
- OC_JSON::success(array('data' => array('id'=>$_GET['id'], 'tmp'=>$tmpfname)));
+ OCP\JSON::success(array('data' => array('id'=>$_GET['id'], 'tmp'=>$tmpfname)));
exit();
} else {
bailOut(OC_Contacts_App::$l10n->t('Error saving temporary file.'));
// Check if we are a user
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('contacts');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('contacts');
//$id = $_GET['id'];
$id = $_POST['id'];
OC_Contacts_App::getAddressbook( $id ); // is owner access check
OC_Contacts_Addressbook::delete($id);
-OC_JSON::success(array('data' => array( 'id' => $id )));
+OCP\JSON::success(array('data' => array( 'id' => $id )));
*
*/
function bailOut($msg) {
- OC_JSON::error(array('data' => array('message' => $msg)));
+ OCP\JSON::error(array('data' => array('message' => $msg)));
OCP\Util::writeLog('contacts','ajax/saveproperty.php: '.$msg, OCP\Util::DEBUG);
exit();
}
// Check if we are a user
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('contacts');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('contacts');
$id = isset($_GET['id'])?$_GET['id']:null;
if(!$id) {
$card = OC_Contacts_App::getContactObject( $id );
OC_Contacts_VCard::delete($id);
-OC_JSON::success(array('data' => array( 'id' => $id )));
+OCP\JSON::success(array('data' => array( 'id' => $id )));
// Check if we are a user
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('contacts');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('contacts');
$id = $_GET['id'];
$checksum = $_GET['checksum'];
$vcard = OC_Contacts_App::getContactVCard( $id );
$line = OC_Contacts_App::getPropertyLineByChecksum($vcard, $checksum);
if(is_null($line)){
- OC_JSON::error(array('data' => array( 'message' => OC_Contacts_App::$l10n->t('Information about vCard is incorrect. Please reload the page.'))));
+ OCP\JSON::error(array('data' => array( 'message' => OC_Contacts_App::$l10n->t('Information about vCard is incorrect. Please reload the page.'))));
exit();
}
unset($vcard->children[$line]);
if(!OC_Contacts_VCard::edit($id,$vcard)) {
- OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Error deleting contact property.'))));
+ OCP\JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Error deleting contact property.'))));
OCP\Util::writeLog('contacts','ajax/deleteproperty.php: Error deleting contact property', OCP\Util::ERROR);
exit();
}
-OC_JSON::success(array('data' => array( 'id' => $id )));
+OCP\JSON::success(array('data' => array( 'id' => $id )));
*/
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('contacts');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('contacts');
$id = $_GET['id'];
$checksum = isset($_GET['checksum'])?$_GET['checksum']:'';
*/
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('contacts');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('contacts');
$addressbook = OC_Contacts_App::getAddressbook($_GET['bookid']);
$tmpl = new OC_Template("contacts", "part.editaddressbook");
$tmpl->assign('new', false);
*/
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('contacts');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('contacts');
function bailOut($msg) {
- OC_JSON::error(array('data' => array('message' => $msg)));
+ OCP\JSON::error(array('data' => array('message' => $msg)));
OCP\Util::writeLog('contacts','ajax/editname.php: '.$msg, OCP\Util::DEBUG);
exit();
}
*/
require_once('../../../lib/base.php');
-OC_JSON::checkLoggedIn();
+OCP\JSON::checkLoggedIn();
OCP\App::checkAppEnabled('contacts');
$upload_max_filesize = OCP\Util::computerFileSize(ini_get('upload_max_filesize'));
$post_max_size = OCP\Util::computerFileSize(ini_get('post_max_size'));
*/
-OC_JSON::checkLoggedIn();
+OCP\JSON::checkLoggedIn();
OCP\App::checkAppEnabled('contacts');
$tmpl = new OC_Template('contacts', 'part.import');
$tmpl->assign('path', $_POST['path']);
// Init owncloud
function bailOut($msg) {
- OC_JSON::error(array('data' => array('message' => $msg)));
+ OCP\JSON::error(array('data' => array('message' => $msg)));
OCP\Util::writeLog('contacts','ajax/loadcard.php: '.$msg, OCP\Util::DEBUG);
exit();
}
// }
// Check if we are a user
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('contacts');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('contacts');
$upload_max_filesize = OCP\Util::computerFileSize(ini_get('upload_max_filesize'));
$post_max_size = OCP\Util::computerFileSize(ini_get('post_max_size'));
$tmpl->assign('id','');
$page = $tmpl->fetchPage();
-OC_JSON::success(array('data' => array( 'page' => $page )));
+OCP\JSON::success(array('data' => array( 'page' => $page )));
*/
// Check if we are a user
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('contacts');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('contacts');
$tmpl = new OC_Template('contacts','part.no_contacts');
$page = $tmpl->fetchPage();
-OC_JSON::success(array('data' => array( 'page' => $page )));
+OCP\JSON::success(array('data' => array( 'page' => $page )));
// Init owncloud
// Check if we are a user
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('contacts');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('contacts');
// foreach ($_POST as $key=>$element) {
// OCP\Util::writeLog('contacts','ajax/savecrop.php: '.$key.'=>'.$element, OCP\Util::DEBUG);
// }
function bailOut($msg) {
- OC_JSON::error(array('data' => array('message' => $msg)));
+ OCP\JSON::error(array('data' => array('message' => $msg)));
OCP\Util::writeLog('contacts','ajax/loadphoto.php: '.$msg, OCP\Util::DEBUG);
exit();
}
$tmpl->assign('refresh', 1);
}
$page = $tmpl->fetchPage();
-OC_JSON::success(array('data' => array('page'=>$page, 'checksum'=>$checksum)));
+OCP\JSON::success(array('data' => array('page'=>$page, 'checksum'=>$checksum)));
?>
// Check if we are a user
// Firefox and Konqueror tries to download application/json for me. --Arthur
-OC_JSON::setContentTypeHeader('text/plain');
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('contacts');
+OCP\JSON::setContentTypeHeader('text/plain');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('contacts');
function bailOut($msg) {
- OC_JSON::error(array('data' => array('message' => $msg)));
+ OCP\JSON::error(array('data' => array('message' => $msg)));
OCP\Util::writeLog('contacts','ajax/oc_photo.php: '.$msg, OCP\Util::ERROR);
exit();
}
debug('Couldn\'t save correct image orientation: '.$tmpfname);
}
if($image->save($tmpfname)) {
- OC_JSON::success(array('data' => array('id'=>$_GET['id'], 'tmp'=>$tmpfname)));
+ OCP\JSON::success(array('data' => array('id'=>$_GET['id'], 'tmp'=>$tmpfname)));
exit();
} else {
bailOut('Couldn\'t save temporary image: '.$tmpfname);
OCP\Util::writeLog('contacts','ajax/savecrop.php: Huzzah!!!', OCP\Util::DEBUG);
// Check if we are a user
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('contacts');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('contacts');
// foreach ($_POST as $key=>$element) {
// OCP\Util::writeLog('contacts','ajax/savecrop.php: '.$key.'=>'.$element, OCP\Util::DEBUG);
// }
// Firefox and Konqueror tries to download application/json for me. --Arthur
-OC_JSON::setContentTypeHeader('text/plain');
+OCP\JSON::setContentTypeHeader('text/plain');
function bailOut($msg) {
- OC_JSON::error(array('data' => array('message' => $msg)));
+ OCP\JSON::error(array('data' => array('message' => $msg)));
OCP\Util::writeLog('contacts','ajax/savecrop.php: '.$msg, OCP\Util::DEBUG);
exit();
}
$tmpl->assign('width', $image->width());
$tmpl->assign('height', $image->height());
$page = $tmpl->fetchPage();
- OC_JSON::success(array('data' => array('page'=>$page, 'tmp'=>$tmpfname)));
+ OCP\JSON::success(array('data' => array('page'=>$page, 'tmp'=>$tmpfname)));
exit();
} else {
if(file_exists($tmpfname)) {
// Check if we are a user
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('contacts');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('contacts');
function bailOut($msg) {
- OC_JSON::error(array('data' => array('message' => $msg)));
+ OCP\JSON::error(array('data' => array('message' => $msg)));
OCP\Util::writeLog('contacts','ajax/saveproperty.php: '.$msg, OCP\Util::DEBUG);
exit();
}
exit();
}
-OC_JSON::success(array('data' => array( 'line' => $line, 'checksum' => $checksum, 'oldchecksum' => $_POST['checksum'] )));
+OCP\JSON::success(array('data' => array( 'line' => $line, 'checksum' => $checksum, 'oldchecksum' => $_POST['checksum'] )));
// Check if we are a user
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('contacts');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('contacts');
$bookid = $_POST['id'];
OC_Contacts_App::getAddressbook($bookid); // is owner access check
$name = trim(strip_tags($_POST['name']));
if(!$name) {
- OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Cannot update addressbook with an empty name.'))));
+ OCP\JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Cannot update addressbook with an empty name.'))));
OCP\Util::writeLog('contacts','ajax/updateaddressbook.php: Cannot update addressbook with an empty name: '.strip_tags($_POST['name']), OCP\Util::ERROR);
exit();
}
if(!OC_Contacts_Addressbook::edit($bookid, $name, null)) {
- OC_JSON::error(array('data' => array('message' => $l->t('Error updating addressbook.'))));
+ OCP\JSON::error(array('data' => array('message' => $l->t('Error updating addressbook.'))));
OCP\Util::writeLog('contacts','ajax/updateaddressbook.php: Error adding addressbook: ', OCP\Util::ERROR);
//exit();
}
if(!OC_Contacts_Addressbook::setActive($bookid, $_POST['active'])) {
- OC_JSON::error(array('data' => array('message' => $l->t('Error (de)activating addressbook.'))));
+ OCP\JSON::error(array('data' => array('message' => $l->t('Error (de)activating addressbook.'))));
OCP\Util::writeLog('contacts','ajax/updateaddressbook.php: Error (de)activating addressbook: '.$bookid, OCP\Util::ERROR);
//exit();
}
$addressbook = OC_Contacts_App::getAddressbook($bookid);
$tmpl = new OC_Template('contacts', 'part.chooseaddressbook.rowfields');
$tmpl->assign('addressbook', $addressbook);
-OC_JSON::success(array(
+OCP\JSON::success(array(
'page' => $tmpl->fetchPage(),
'addressbook' => $addressbook,
));
require_once('../../../lib/base.php');
// Check if we are a user
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('contacts');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('contacts');
function bailOut($msg) {
- OC_JSON::error(array('data' => array('message' => $msg)));
+ OCP\JSON::error(array('data' => array('message' => $msg)));
OCP\Util::writeLog('contacts','ajax/uploadimport.php: '.$msg, OCP\Util::ERROR);
exit();
}
if($fn) {
if($view->file_put_contents('/'.$tmpfile, file_get_contents('php://input'))) {
debug($fn.' uploaded');
- OC_JSON::success(array('data' => array('path'=>'', 'file'=>$tmpfile)));
+ OCP\JSON::success(array('data' => array('path'=>'', 'file'=>$tmpfile)));
exit();
} else {
bailOut(OC_Contacts_App::$l10n->t('Error uploading contacts to storage.'));
// File input transfers are handled here
if (!isset($_FILES['importfile'])) {
OCP\Util::writeLog('contacts','ajax/uploadphoto.php: No file was uploaded. Unknown error.', OCP\Util::DEBUG);
- OC_JSON::error(array('data' => array( 'message' => 'No file was uploaded. Unknown error' )));
+ OCP\JSON::error(array('data' => array( 'message' => 'No file was uploaded. Unknown error' )));
exit();
}
$error = $_FILES['importfile']['error'];
if(file_exists($file['tmp_name'])) {
if($view->file_put_contents('/'.$tmpfile, file_get_contents($file['tmp_name']))) {
debug($fn.' uploaded');
- OC_JSON::success(array('data' => array('path'=>'', 'file'=>$tmpfile)));
+ OCP\JSON::success(array('data' => array('path'=>'', 'file'=>$tmpfile)));
} else {
bailOut(OC_Contacts_App::$l10n->t('Error uploading contacts to storage.'));
}
// Check if we are a user
// Firefox and Konqueror tries to download application/json for me. --Arthur
-OC_JSON::setContentTypeHeader('text/plain');
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('contacts');
+OCP\JSON::setContentTypeHeader('text/plain');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('contacts');
function bailOut($msg) {
- OC_JSON::error(array('data' => array('message' => $msg)));
+ OCP\JSON::error(array('data' => array('message' => $msg)));
OCP\Util::writeLog('contacts','ajax/uploadphoto.php: '.$msg, OCP\Util::DEBUG);
exit();
}
// AJAX call
if (!isset($_GET['id'])) {
OCP\Util::writeLog('contacts','ajax/uploadphoto.php: No contact ID was submitted.', OCP\Util::DEBUG);
- OC_JSON::error(array('data' => array( 'message' => 'No contact ID was submitted.' )));
+ OCP\JSON::error(array('data' => array( 'message' => 'No contact ID was submitted.' )));
exit();
}
$id = $_GET['id'];
debug('Couldn\'t save correct image orientation: '.$tmpfname);
}
if($image->save($tmpfname)) {
- OC_JSON::success(array('data' => array('mime'=>$_SERVER['CONTENT_TYPE'], 'name'=>$fn, 'id'=>$id, 'tmp'=>$tmpfname)));
+ OCP\JSON::success(array('data' => array('mime'=>$_SERVER['CONTENT_TYPE'], 'name'=>$fn, 'id'=>$id, 'tmp'=>$tmpfname)));
exit();
} else {
bailOut('Couldn\'t save temporary image: '.$tmpfname);
if (!isset($_POST['id'])) {
OCP\Util::writeLog('contacts','ajax/uploadphoto.php: No contact ID was submitted.', OCP\Util::DEBUG);
- OC_JSON::error(array('data' => array( 'message' => 'No contact ID was submitted.' )));
+ OCP\JSON::error(array('data' => array( 'message' => 'No contact ID was submitted.' )));
exit();
}
if (!isset($_FILES['imagefile'])) {
OCP\Util::writeLog('contacts','ajax/uploadphoto.php: No file was uploaded. Unknown error.', OCP\Util::DEBUG);
- OC_JSON::error(array('data' => array( 'message' => 'No file was uploaded. Unknown error' )));
+ OCP\JSON::error(array('data' => array( 'message' => 'No file was uploaded. Unknown error' )));
exit();
}
$error = $_FILES['imagefile']['error'];
debug('Couldn\'t save correct image orientation: '.$tmpfname);
}
if($image->save($tmpfname)) {
- OC_JSON::success(array('data' => array('mime'=>$file['type'],'size'=>$file['size'],'name'=>$file['name'], 'id'=>$_POST['id'], 'tmp'=>$tmpfname)));
+ OCP\JSON::success(array('data' => array('mime'=>$file['type'],'size'=>$file['size'],'name'=>$file['name'], 'id'=>$_POST['id'], 'tmp'=>$tmpfname)));
exit();
} else {
bailOut('Couldn\'t save temporary image: '.$tmpfname);
//check for addressbooks rights or create new one
ob_start();
-OC_JSON::checkLoggedIn();
+OCP\JSON::checkLoggedIn();
OCP\App::checkAppEnabled('contacts');
$nl = "\n";
$progressfile = 'import_tmp/' . md5(session_id()) . '.txt';
$file = OC_Filesystem::file_get_contents($_POST['path'] . '/' . $_POST['file']);
}
if(!$file) {
- OC_JSON::error(array('message' => 'Import file was empty.'));
+ OCP\JSON::error(array('message' => 'Import file was empty.'));
exit();
}
error_log('File: '.$file);
OCP\Util::writeLog('contacts','Import: Error unlinking OC_FilesystemView ' . '/' . $_POST['file'], OCP\Util::ERROR);
}
}
-OC_JSON::success(array('data' => array('imported'=>$imported, 'failed'=>$failed)));
+OCP\JSON::success(array('data' => array('imported'=>$imported, 'failed'=>$failed)));
if( $addressbook === false || $addressbook['userid'] != OCP\USER::getUser()) {
if ($addressbook === false) {
OCP\Util::writeLog('contacts', 'Addressbook not found: '. $id, OCP\Util::ERROR);
- OC_JSON::error(array('data' => array( 'message' => self::$l10n->t('Addressbook not found.'))));
+ OCP\JSON::error(array('data' => array( 'message' => self::$l10n->t('Addressbook not found.'))));
}
else {
OCP\Util::writeLog('contacts', 'Addressbook('.$id.') is not from '.OCP\USER::getUser(), OCP\Util::ERROR);
- OC_JSON::error(array('data' => array( 'message' => self::$l10n->t('This is not your addressbook.'))));
+ OCP\JSON::error(array('data' => array( 'message' => self::$l10n->t('This is not your addressbook.'))));
}
exit();
}
$card = OC_Contacts_VCard::find( $id );
if( $card === false ) {
OCP\Util::writeLog('contacts', 'Contact could not be found: '.$id, OCP\Util::ERROR);
- OC_JSON::error(array('data' => array( 'message' => self::$l10n->t('Contact could not be found.').' '.$id)));
+ OCP\JSON::error(array('data' => array( 'message' => self::$l10n->t('Contact could not be found.').' '.$id)));
exit();
}
// Init owncloud
-OC_JSON::checkLoggedIn();
+OCP\JSON::checkLoggedIn();
//OCP\User::checkLoggedIn();
OCP\App::checkAppEnabled('contacts');
// Init owncloud
-OC_JSON::checkLoggedIn();
+OCP\JSON::checkLoggedIn();
// Get data
$query = $_GET['term'];
}
}
}
-OC_JSON::encodedPrint($files);
+OCP\JSON::encodedPrint($files);
?>
// Init owncloud
-OC_JSON::checkLoggedIn();
+OCP\JSON::checkLoggedIn();
// Get data
$dir = stripslashes($_GET["dir"]);
}
if($success) {
- OC_JSON::success(array("data" => array( "dir" => $dir, "files" => $files )));
+ OCP\JSON::success(array("data" => array( "dir" => $dir, "files" => $files )));
} else {
- OC_JSON::error(array("data" => array( "message" => "Could not delete:\n" . $filesWithError )));
+ OCP\JSON::error(array("data" => array( "message" => "Could not delete:\n" . $filesWithError )));
}
?>
// Init owncloud
-OC_JSON::checkLoggedIn();
+OCP\JSON::checkLoggedIn();
// Load the files
$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
$list->assign( "files", $files );
$data = array('files' => $list->fetchPage());
-OC_JSON::success(array('data' => $data));
+OCP\JSON::success(array('data' => $data));
?>
// Init owncloud
-OC_JSON::checkLoggedIn();
+OCP\JSON::checkLoggedIn();
// Get data
$dir = stripslashes($_GET["dir"]);
if(OC_Files::move($dir,$file,$target,$file)){
- OC_JSON::success(array("data" => array( "dir" => $dir, "files" => $file )));
+ OCP\JSON::success(array("data" => array( "dir" => $dir, "files" => $file )));
}else{
- OC_JSON::error(array("data" => array( "message" => "Could not move $file" )));
+ OCP\JSON::error(array("data" => array( "message" => "Could not move $file" )));
}
?>
// Init owncloud
-OC_JSON::checkLoggedIn();
+OCP\JSON::checkLoggedIn();
// Get the params
$dir = isset( $_POST['dir'] ) ? stripslashes($_POST['dir']) : '';
$source = isset( $_POST['source'] ) ? stripslashes($_POST['source']) : '';
if($filename == '') {
- OC_JSON::error(array("data" => array( "message" => "Empty Filename" )));
+ OCP\JSON::error(array("data" => array( "message" => "Empty Filename" )));
exit();
}
if($source){
if(substr($source,0,8)!='https://' and substr($source,0,7)!='http://'){
- OC_JSON::error(array("data" => array( "message" => "Not a valid source" )));
+ OCP\JSON::error(array("data" => array( "message" => "Not a valid source" )));
exit();
}
$sourceStream=fopen($source,'rb');
$result=OC_Filesystem::file_put_contents($target,$sourceStream);
if($result){
$mime=OC_Filesystem::getMimetype($target);
- OC_JSON::success(array("data" => array('mime'=>$mime)));
+ OCP\JSON::success(array("data" => array('mime'=>$mime)));
exit();
}else{
- OC_JSON::error(array("data" => array( "message" => "Error while downloading ".$source. ' to '.$target )));
+ OCP\JSON::error(array("data" => array( "message" => "Error while downloading ".$source. ' to '.$target )));
exit();
}
}
if($content){
OC_Filesystem::file_put_contents($dir.'/'.$filename,$content);
}
- OC_JSON::success(array("data" => array('content'=>$content)));
+ OCP\JSON::success(array("data" => array('content'=>$content)));
exit();
}
-OC_JSON::error(array("data" => array( "message" => "Error when creating the file" )));
+OCP\JSON::error(array("data" => array( "message" => "Error when creating the file" )));
// Init owncloud
-OC_JSON::checkLoggedIn();
+OCP\JSON::checkLoggedIn();
// Get the params
$dir = isset( $_POST['dir'] ) ? stripslashes($_POST['dir']) : '';
$foldername = isset( $_POST['foldername'] ) ? stripslashes($_POST['foldername']) : '';
if(trim($foldername) == '') {
- OC_JSON::error(array("data" => array( "message" => "Empty Foldername" )));
+ OCP\JSON::error(array("data" => array( "message" => "Empty Foldername" )));
exit();
}
if(OC_Files::newFile($dir, stripslashes($foldername), 'dir')) {
- OC_JSON::success(array("data" => array()));
+ OCP\JSON::success(array("data" => array()));
exit();
}
-OC_JSON::error(array("data" => array( "message" => "Error when creating the folder" )));
+OCP\JSON::error(array("data" => array( "message" => "Error when creating the folder" )));
require_once('lib/template.php');
-OC_JSON::checkLoggedIn();
+OCP\JSON::checkLoggedIn();
// Load the files
$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
$files[] = $i;
}
-OC_JSON::success(array('data' => $files));
+OCP\JSON::success(array('data' => $files));
?>
// Init owncloud
-OC_JSON::checkLoggedIn();
+OCP\JSON::checkLoggedIn();
// Get data
$dir = stripslashes($_GET["dir"]);
// Delete
if( OC_Files::move( $dir, $file, $dir, $newname )) {
- OC_JSON::success(array("data" => array( "dir" => $dir, "file" => $file, "newname" => $newname )));
+ OCP\JSON::success(array("data" => array( "dir" => $dir, "file" => $file, "newname" => $newname )));
}
else{
- OC_JSON::error(array("data" => array( "message" => "Unable to rename file" )));
+ OCP\JSON::error(array("data" => array( "message" => "Unable to rename file" )));
}
?>
OC_DB::commit();
$eventSource->send('success',true);
}else{
- OC_JSON::success(array('data'=>array('done'=>true)));
+ OCP\JSON::success(array('data'=>array('done'=>true)));
exit;
}
}else{
if($checkOnly){
- OC_JSON::success(array('data'=>array('done'=>false)));
+ OCP\JSON::success(array('data'=>array('done'=>false)));
exit;
}
if(isset($eventSource)){
// Firefox and Konqueror tries to download application/json for me. --Arthur
-OC_JSON::setContentTypeHeader('text/plain');
+OCP\JSON::setContentTypeHeader('text/plain');
-OC_JSON::checkLoggedIn();
+OCP\JSON::checkLoggedIn();
if (!isset($_FILES['files'])) {
- OC_JSON::error(array("data" => array( "message" => "No file was uploaded. Unknown error" )));
+ OCP\JSON::error(array("data" => array( "message" => "No file was uploaded. Unknown error" )));
exit();
}
foreach ($_FILES['files']['error'] as $error) {
UPLOAD_ERR_NO_TMP_DIR=>$l->t("Missing a temporary folder"),
UPLOAD_ERR_CANT_WRITE=>$l->t('Failed to write to disk'),
);
- OC_JSON::error(array("data" => array( "message" => $errors[$error] )));
+ OCP\JSON::error(array("data" => array( "message" => $errors[$error] )));
exit();
}
}
$totalSize+=$size;
}
if($totalSize>OC_Filesystem::free_space('/')){
- OC_JSON::error(array("data" => array( "message" => "Not enough space available" )));
+ OCP\JSON::error(array("data" => array( "message" => "Not enough space available" )));
exit();
}
$result[]=array( "status" => "success", 'mime'=>$meta['mimetype'],'size'=>$meta['size'],'name'=>basename($target));
}
}
- OC_JSON::encodedPrint($result);
+ OCP\JSON::encodedPrint($result);
exit();
}else{
$error='invalid dir';
}
-OC_JSON::error(array('data' => array('error' => $error, "file" => $fileName)));
+OCP\JSON::error(array('data' => array('error' => $error, "file" => $fileName)));
?>
<?php
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('files_sharing');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('files_sharing');
$user = OCP\USER::getUser();
// TODO translations
$subject = $user + ' ' + 'shared a file with you';
//$RUNTIME_NOAPPS = true;
-OC_JSON::checkAppEnabled('files_sharing');
+OCP\JSON::checkAppEnabled('files_sharing');
require_once(OC::$APPSROOT . '/apps/files_sharing/lib_share.php');
$userDirectory = "/".OCP\USER::getUser()."/files";
$source = dirname($source);
}
if (!empty($users)) {
- OC_JSON::encodedPrint($users);
+ OCP\JSON::encodedPrint($users);
}
//$RUNTIME_NOAPPS = true;
-OC_JSON::checkAppEnabled('files_sharing');
+OCP\JSON::checkAppEnabled('files_sharing');
require_once(OC::$APPSROOT . '/apps/files_sharing/lib_share.php');
$source = "/".OCP\USER::getUser()."/files".$_GET['source'];
//$RUNTIME_NOAPPS = true;
-OC_JSON::checkAppEnabled('files_sharing');
+OCP\JSON::checkAppEnabled('files_sharing');
require_once(OC::$APPSROOT . '/apps/files_sharing/lib_share.php');
$userDirectory = "/".OCP\USER::getUser()."/files";
<?php
-OC_JSON::checkAppEnabled('files_sharing');
-OC_JSON::checkAdminUser();
+OCP\JSON::checkAppEnabled('files_sharing');
+OCP\JSON::checkAdminUser();
if ($_POST['resharing'] == true) {
OCP\Config::setAppValue('files_sharing', 'resharing', 'yes');
} else {
//$RUNTIME_NOAPPS = true;
-OC_JSON::checkAppEnabled('files_sharing');
+OCP\JSON::checkAppEnabled('files_sharing');
require_once(OC::$APPSROOT . '/apps/files_sharing/lib_share.php');
$source = "/".OCP\USER::getUser()."/files".$_GET['source'];
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('files_sharing');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('files_sharing');
$users = array();
$groups = array();
$users[] = "</optgroup>";
$groups[] = "</optgroup>";
$users = array_merge($users, $groups);
-OC_JSON::encodedPrint($users);
+OCP\JSON::encodedPrint($users);
?>
<?php
$RUNTIME_NOSETUPFS=true; //don't setup the fs yet
-OC_JSON::checkAppEnabled('files_sharing');
+OCP\JSON::checkAppEnabled('files_sharing');
require_once 'lib_share.php';
//get the path of the shared file
// Check if we are a user
-OC_JSON::checkLoggedIn();
+OCP\JSON::checkLoggedIn();
// Set the session key for the file we are about to edit.
$dir = isset($_GET['dir']) ? $_GET['dir'] : '';
{
$mtime = OC_Filesystem::filemtime($path);
$filecontents = OC_Filesystem::file_get_contents($path);
- OC_JSON::success(array('data' => array('filecontents' => $filecontents, 'write' => 'true', 'mtime' => $mtime)));
+ OCP\JSON::success(array('data' => array('filecontents' => $filecontents, 'write' => 'true', 'mtime' => $mtime)));
}
else
{
$mtime = OC_Filesystem::filemtime($path);
$filecontents = OC_Filesystem::file_get_contents($path);
- OC_JSON::success(array('data' => array('filecontents' => $filecontents, 'write' => 'false', 'mtime' => $mtime)));
+ OCP\JSON::success(array('data' => array('filecontents' => $filecontents, 'write' => 'false', 'mtime' => $mtime)));
}
} else {
- OC_JSON::error(array('data' => array( 'message' => 'Invalid file path supplied.')));
+ OCP\JSON::error(array('data' => array( 'message' => 'Invalid file path supplied.')));
}
\ No newline at end of file
// Check if we are a user
-OC_JSON::checkLoggedIn();
+OCP\JSON::checkLoggedIn();
// Get the path from GET
$path = isset($_GEt['path']) ? $_GET['path'] : '';
$mtime = OC_Filesystem::filemtime($path);
if($mtime)
{
- OC_JSON::success(array('data' => array('path' => $path, 'mtime' => $mtime)));
+ OCP\JSON::success(array('data' => array('path' => $path, 'mtime' => $mtime)));
}
else
{
- OC_JSON::error();
+ OCP\JSON::error();
}
}
else
{
- OC_JSON::error();
+ OCP\JSON::error();
}
\ No newline at end of file
// Check if we are a user
-OC_JSON::checkLoggedIn();
+OCP\JSON::checkLoggedIn();
// Get paramteres
$filecontents = $_POST['filecontents'];
if($mtime != $filemtime)
{
// Then the file has changed since opening
- OC_JSON::error();
+ OCP\JSON::error();
OCP\Util::writeLog('files_texteditor',"File: ".$path." modified since opening.",OCP\Util::ERROR);
}
else
clearstatcache();
// Get new mtime
$newmtime = OC_Filesystem::filemtime($path);
- OC_JSON::success(array('data' => array('mtime' => $newmtime)));
+ OCP\JSON::success(array('data' => array('mtime' => $newmtime)));
}
else
{
// Not writeable!
- OC_JSON::error(array('data' => array( 'message' => 'Insufficient permissions')));
+ OCP\JSON::error(array('data' => array( 'message' => 'Insufficient permissions')));
OCP\Util::writeLog('files_texteditor',"User does not have permission to write to file: ".$path,OCP\Util::ERROR);
}
}
} else {
- OC_JSON::error(array('data' => array( 'message' => 'File path or mtime not supplied')));
+ OCP\JSON::error(array('data' => array( 'message' => 'File path or mtime not supplied')));
OCP\Util::writeLog('files_texteditor',"Invalid path supplied:".$path,OCP\Util::ERROR);
}
<?php
require_once('../../../lib/base.php');
-OC_JSON::checkAppEnabled('files_versions');
+OCP\JSON::checkAppEnabled('files_versions');
require_once('../versions.php');
$userDirectory = "/".OCP\USER::getUser()."/files";
$versionsSorted = array_reverse( $versionsFormatted );
if ( !empty( $versionsSorted ) ) {
- OC_JSON::encodedPrint($versionsSorted);
+ OCP\JSON::encodedPrint($versionsSorted);
}
}else{
// $source = dirname($source);
// }
// if (!empty($users)) {
-// OC_JSON::encodedPrint($users);
+// OCP\JSON::encodedPrint($users);
// }
<?php
require_once('../../../lib/base.php');
-OC_JSON::checkAppEnabled('files_versions');
+OCP\JSON::checkAppEnabled('files_versions');
require_once('../versions.php');
$userDirectory = "/".OCP\USER::getUser()."/files";
<?php
-OC_JSON::checkAppEnabled('files_versions');
-OC_JSON::checkAdminUser();
+OCP\JSON::checkAppEnabled('files_versions');
+OCP\JSON::checkAdminUser();
if (OCP\Config::getSystemValue('versions', 'true')=='true') {
OCP\Config::setSystemValue('versions', 'false');
} else {
*/
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('gallery');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('gallery');
OC_Gallery_Album::create(OCP\USER::getUser(), $_GET['album_name']);
-OC_JSON::success(array('name' => $_GET['album_name']));
+OCP\JSON::success(array('name' => $_GET['album_name']));
?>
header('Content-type: text/html; charset=UTF-8') ;
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('gallery');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('gallery');
function handleRename($oldname, $newname) {
OC_Gallery_Album::rename($oldname, $newname, OCP\USER::getUser());
if ($cleanup) OC_Gallery_Album::cleanup();
$pathlist = OC_Gallery_Scanner::find_paths();
sort($pathlist);
- OC_JSON::success(array('paths' => $pathlist));
+ OCP\JSON::success(array('paths' => $pathlist));
}
function handleStoreSettings($root, $order) {
if (!OC_Filesystem::file_exists($root)) {
- OC_JSON::error(array('cause' => 'No such file or directory'));
+ OCP\JSON::error(array('cause' => 'No such file or directory'));
return;
}
if (!OC_Filesystem::is_dir($root)) {
- OC_JSON::error(array('cause' => $root . ' is not a directory'));
+ OCP\JSON::error(array('cause' => $root . ' is not a directory'));
return;
}
$rescan = $current_root==$root?'no':'yes';
OCP\Config::setUserValue(OCP\USER::getUser(), 'gallery', 'root', $root);
OCP\Config::setUserValue(OCP\USER::getUser(), 'gallery', 'order', $order);
- OC_JSON::success(array('rescan' => $rescan));
+ OCP\JSON::success(array('rescan' => $rescan));
}
function handleGetGallery($path) {
$token = $row['token'];
}
- OC_JSON::success(array('albums'=>$a, 'photos'=>$p, 'shared' => $shared, 'recursive' => $recursive, 'token' => $token));
+ OCP\JSON::success(array('albums'=>$a, 'photos'=>$p, 'shared' => $shared, 'recursive' => $recursive, 'token' => $token));
}
function handleShare($path, $share, $recursive) {
if ($row = $r->fetchRow()) {
$albumId = $row['album_id'];
} else {
- OC_JSON::error(array('cause' => 'Couldn\'t find requested gallery'));
+ OCP\JSON::error(array('cause' => 'Couldn\'t find requested gallery'));
exit;
}
if ($share == false) {
OC_Gallery_Sharing::remove($albumId);
- OC_JSON::success(array('sharing' => false));
+ OCP\JSON::success(array('sharing' => false));
} else { // share, yeah \o/
$r = OC_Gallery_Sharing::getEntryByAlbumId($albumId);
if (($row = $r->fetchRow())) { // update entry
OC_Gallery_Sharing::updateSharingByToken($row['token'], $recursive);
- OC_JSON::success(array('sharing' => true, 'token' => $row['token'], 'recursive' => $recursive == 1 ? true : false ));
+ OCP\JSON::success(array('sharing' => true, 'token' => $row['token'], 'recursive' => $recursive == 1 ? true : false ));
} else { // and new sharing entry
$date = new DateTime();
$token = md5($owner . $date->getTimestamp());
OC_Gallery_Sharing::addShared($token, intval($albumId), $recursive);
- OC_JSON::success(array('sharing' => true, 'token' => $token, 'recursive' => $recursive == 1 ? true : false ));
+ OCP\JSON::success(array('sharing' => true, 'token' => $token, 'recursive' => $recursive == 1 ? true : false ));
}
}
}
switch($_GET['operation']) {
case 'rename':
handleRename($_GET['oldname'], $_GET['newname']);
- OC_JSON::success(array('newname' => $_GET['newname']));
+ OCP\JSON::success(array('newname' => $_GET['newname']));
break;
case 'remove':
handleRemove($_GET['name']);
- OC_JSON::success();
+ OCP\JSON::success();
break;
case 'get_covers':
handleGetThumbnails(urldecode($_GET['albumname']));
handleShare($_GET['path'], $_GET['share'] == 'true' ? true : false, $_GET['recursive']);
break;
default:
- OC_JSON::error(array('cause' => 'Unknown operation'));
+ OCP\JSON::error(array('cause' => 'Unknown operation'));
}
}
?>
if (!isset($_GET['token']) || !isset($_GET['operation'])) {
- OC_JSON::error(array('cause' => 'Not enought arguments'));
+ OCP\JSON::error(array('cause' => 'Not enought arguments'));
exit;
}
$token = $_GET['token'];
if (!OC_Gallery_Sharing::isTokenValid($token)) {
- OC_JSON::error(array('cause' => 'Given token is not valid'));
+ OCP\JSON::error(array('cause' => 'Given token is not valid'));
exit;
}
$photos[] = $row['file_path'];
}
- OC_JSON::success(array('albums' => $albums, 'photos' => $photos));
+ OCP\JSON::success(array('albums' => $albums, 'photos' => $photos));
}
function handleGetThumbnail($token, $imgpath) {
*/
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('gallery');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('gallery');
$img = $_GET['img'];
*
*/
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('gallery');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('gallery');
function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height, $tgtImg, $shift) {
//getting the image dimensions
header('Content-type: text/html; charset=UTF-8') ;
-OC_JSON::checkAppEnabled('media');
+OCP\JSON::checkAppEnabled('media');
require_once(OC::$APPSROOT . '/apps/media/lib_collection.php');
require_once(OC::$APPSROOT . '/apps/media/lib_scanner.php');
$data['artists']=OC_MEDIA_COLLECTION::getArtists();
$data['albums']=OC_MEDIA_COLLECTION::getAlbums();
$data['songs']=OC_MEDIA_COLLECTION::getSongs();
- OC_JSON::encodedPrint($data);
+ OCP\JSON::encodedPrint($data);
break;
case 'scan':
OC_DB::beginTransaction();
echo (OC_MEDIA_SCANNER::scanFile($arguments['path']))?'true':'false';
break;
case 'get_artists':
- OC_JSON::encodedPrint(OC_MEDIA_COLLECTION::getArtists($arguments['search']));
+ OCP\JSON::encodedPrint(OC_MEDIA_COLLECTION::getArtists($arguments['search']));
break;
case 'get_albums':
- OC_JSON::encodedPrint(OC_MEDIA_COLLECTION::getAlbums($arguments['artist'],$arguments['search']));
+ OCP\JSON::encodedPrint(OC_MEDIA_COLLECTION::getAlbums($arguments['artist'],$arguments['search']));
break;
case 'get_songs':
- OC_JSON::encodedPrint(OC_MEDIA_COLLECTION::getSongs($arguments['artist'],$arguments['album'],$arguments['search']));
+ OCP\JSON::encodedPrint(OC_MEDIA_COLLECTION::getSongs($arguments['artist'],$arguments['album'],$arguments['search']));
break;
case 'get_path_info':
if(OC_Filesystem::file_exists($arguments['path'])){
$song=OC_MEDIA_COLLECTION::getSong($songId);
$song['artist']=OC_MEDIA_COLLECTION::getArtistName($song['song_artist']);
$song['album']=OC_MEDIA_COLLECTION::getAlbumName($song['song_album']);
- OC_JSON::encodedPrint($song);
+ OCP\JSON::encodedPrint($song);
}
}
break;
$music=OC_FileCache::searchByMime('audio');
$ogg=OC_FileCache::searchByMime('application','ogg');
$music=array_merge($music,$ogg);
- OC_JSON::encodedPrint($music);
+ OCP\JSON::encodedPrint($music);
exit;
}
}
$RUNTIME_NOSETUPFS=true;
-OC_JSON::checkAppEnabled('media');
+OCP\JSON::checkAppEnabled('media');
$autoUpdate=(isset($_GET['autoupdate']) and $_GET['autoupdate']=='true');
OCP\Config::setUserValue(OCP\USER::getUser(),'media','autoupdate',(integer)$autoUpdate);
-OC_JSON::success(array('data' => $autoUpdate));
+OCP\JSON::success(array('data' => $autoUpdate));
?>
$_POST=$_GET; //debug
require_once('../inc.php');
-OC_JSON::checkAppEnabled('media');
+OCP\JSON::checkAppEnabled('media');
require_once(OC::$APPSROOT . '/apps/media/lib_collection.php');
$user=isset($_POST['user'])?$_POST['user']:'';
'score' => (float)1.0
);
}
-OC_JSON::encodedPrint($results);
+OCP\JSON::encodedPrint($results);
?>
// Check if we are a user
-OC_JSON::checkLoggedIn();
+OCP\JSON::checkLoggedIn();
OCP\App::checkAppEnabled('user_migrate');
// Which operation
if( $_GET['operation']=='create' ){
$uid = !empty( $_POST['uid'] ) ? $_POST['uid'] : OCP\USER::getUser();
if( $uid != OCP\USER::getUser() ){
// Needs to be admin to export someone elses account
- OC_JSON::error();
+ OCP\JSON::error();
die();
}
// Create the export zip
$response = json_decode( OC_Migrate::export( $uid ) );
if( !$response->success ){
// Error
- OC_JSON::error();
+ OCP\JSON::error();
die();
} else {
// Save path in session
$_SESSION['ocuserexportpath'] = $response->data;
}
- OC_JSON::success();
+ OCP\JSON::success();
die();
} else if( $_GET['operation']=='download' ){
// Download the export
$path = isset( $_SESSION['ocuserexportpath'] ) ? $_SESSION['ocuserexportpath'] : false;
if( !$path ){
- OC_JSON::error();
+ OCP\JSON::error();
}
header("Content-Type: application/zip");
header("Content-Disposition: attachment; filename=" . basename($path));
--- /dev/null
+<?php
+/**
+* ownCloud
+*
+* @author Frank Karlitschek
+* @copyright 2010 Frank Karlitschek karlitschek@kde.org
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+* License as published by the Free Software Foundation; either
+* version 3 of the License, or any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+*
+* You should have received a copy of the GNU Affero General Public
+* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+/**
+ * Public interface of ownCloud for apps to use.
+ * JSON Class
+ *
+ */
+
+// use OCP namespace for all classes that are considered public.
+// This means that they should be used by apps instead of the internal ownCloud classes
+namespace OCP;
+
+class JSON {
+
+
+
+ /**
+ * Encode and print $data in JSON format
+ */
+ public static function encodedPrint($data,$setContentType=true){
+ return(\OC_JSON::encodedPrint($data,$setContentType));
+ }
+
+ /**
+ * Check if the user is logged in, send json error msg if not
+ */
+ public static function checkLoggedIn(){
+ return(\OC_JSON::checkLoggedIn());
+ }
+
+
+
+ /**
+ * Send json success msg
+ */
+ public static function success($data = array()){
+ return(\OC_JSON::success($data));
+ }
+
+
+ /**
+ * Send json error msg
+ */
+ public static function error($data = array()){
+ return(\OC_JSON::error($data));
+ }
+
+
+ /**
+ * set Content-Type header to jsonrequest
+ */
+ public static function setContentTypeHeader($type='application/json'){
+ return(\OC_JSON::setContentTypeHeader($type));
+ }
+
+
+ /**
+ * Check if the app is enabled, send json error msg if not
+ */
+ public static function checkAppEnabled($app){
+ return(\OC_JSON::checkAppEnabled($app));
+ }
+
+
+ /**
+ * Check if the user is a admin, send json error msg if not
+ */
+ public static function checkAdminUser(){
+ return(\OC_JSON::checkAdminUser());
+ }
+
+}
+
+?>