Exemplo n.º 1
0
<?php

/**
* ownCloud - media plugin
*
* @author Robin Appelman
* @copyright 2010 Robin Appelman icewind1991@gmail.com
* 
* 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 Lesser General Public 
* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
* 
*/
header('Content-type: text/html; charset=UTF-8');
//no apps or filesystem
$RUNTIME_NOAPPS = true;
$RUNTIME_NOSETUPFS = true;
OCP\JSON::checkAppEnabled('media');
$autoUpdate = (isset($_GET['autoupdate']) and $_GET['autoupdate'] == 'true');
OCP\Config::setUserValue(OCP\USER::getUser(), 'media', 'autoupdate', (int) $autoUpdate);
OCP\JSON::success(array('data' => $autoUpdate));
Exemplo n.º 2
0
 * This code is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License, version 3,
 * as published by the Free Software Foundation.
 *
 * This program 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, version 3,
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 *
 */
// Check user and app status
OCP\JSON::checkAdminUser();
OCP\JSON::checkAppEnabled('user_ldap');
OCP\JSON::callCheck();
$l = \OC::$server->getL10N('user_ldap');
if (!isset($_POST['action'])) {
    \OCP\JSON::error(array('message' => $l->t('No action specified')));
}
$action = (string) $_POST['action'];
if (!isset($_POST['ldap_serverconfig_chooser'])) {
    \OCP\JSON::error(array('message' => $l->t('No configuration specified')));
}
$prefix = (string) $_POST['ldap_serverconfig_chooser'];
$ldapWrapper = new \OCA\user_ldap\lib\LDAP();
$configuration = new \OCA\user_ldap\lib\Configuration($prefix);
$con = new \OCA\user_ldap\lib\Connection($ldapWrapper, '', null);
$con->setConfiguration($configuration->getConfiguration());
$con->ldapConfigurationActive = true;
Exemplo n.º 3
0
<?php

/**
 * Copyright (c) 2012 Thomas Tanghus <*****@*****.**>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
foreach ($_POST as $key => $element) {
    debug('_POST: ' . $key . '=>' . print_r($element, true));
}
function bailOut($msg)
{
    OCP\JSON::error(array('data' => array('message' => $msg)));
    OCP\Util::writeLog('contacts', 'ajax/categories/delete.php: ' . $msg, OCP\Util::DEBUG);
    exit;
}
function debug($msg)
{
    OCP\Util::writeLog('contacts', 'ajax/categories/delete.php: ' . $msg, OCP\Util::DEBUG);
}
$categories = isset($_POST['categories']) ? $_POST['categories'] : null;
if (is_null($categories)) {
    bailOut(OC_Contacts_App::$l10n->t('No categories selected for deletion.'));
}
debug(print_r($categories, true));
$addressbooks = OC_Contacts_Addressbook::all(OCP\USER::getUser());
if (count($addressbooks) == 0) {
    bailOut(OC_Contacts_App::$l10n->t('No address books found.'));
Exemplo n.º 4
0
<?php

// Init owncloud
// Check if we are a user
OCP\User::checkAdminUser();
OCP\JSON::checkAppEnabled('roundcube');
// CSRF checks
OCP\JSON::callCheck();
$l = new OC_L10N('roundcube');
$params = array('maildir', 'removeHeaderNav', 'removeControlNav', 'autoLogin', 'enableDebug', 'rcHost', 'rcPort', 'rcRefreshInterval', 'rcNoCronRefresh');
if (isset($_POST['appname']) && $_POST['appname'] == "roundcube") {
    foreach ($params as $param) {
        if (isset($_POST[$param])) {
            if ($param === 'removeHeaderNav') {
                OCP\Config::setAppValue('roundcube', 'removeHeaderNav', true);
            }
            if ($param === 'removeControlNav') {
                OCP\Config::setAppValue('roundcube', 'removeControlNav', true);
            }
            if ($param === 'autoLogin') {
                OCP\Config::setAppValue('roundcube', 'autoLogin', true);
            }
            if ($param === 'enableDebug') {
                OCP\Config::setAppValue('roundcube', 'enableDebug', true);
            }
            if ($param === 'rcNoCronRefresh') {
                OCP\Config::setAppValue('roundcube', 'rcNoCronRefresh', true);
            } else {
                if ($param === 'rcHost') {
                    if ($_POST[$param] == '' || strlen($_POST[$param]) > 3) {
                        OCP\Config::setAppValue('roundcube', $param, $_POST[$param]);
<?php

/**
 * Copyright (c) 2012 Georg Ehrke <ownclouddev at georgswebsite dot de>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');
OCP\JSON::callCheck();
$errarr = OC_Calendar_Object::validateRequest($_POST);
$event_id = -1;
if ($errarr) {
    //show validate errors
    OCP\JSON::error($errarr);
    exit;
} else {
    $cal = $_POST['calendar'];
    $vcalendar = OC_Calendar_Object::createVCalendarFromRequest($_POST);
    try {
        $event_id = OC_Calendar_Object::add($cal, $vcalendar->serialize());
    } catch (Exception $e) {
        OCP\JSON::error(array('message' => $e->getMessage()));
        exit;
    }
    OCP\JSON::success(array('event_id' => $event_id));
}
Exemplo n.º 6
0
        OC_Util::setupFS($fileOwner);
        // The token defines the target directory (security reasons)
        $path = \OC\Files\Filesystem::getPath($linkItem['file_source']);
        $view = new \OC\Files\View(\OC\Files\Filesystem::getView()->getAbsolutePath($path));
        $images = $view->searchByMime('image');
        $result = array();
        foreach ($images as $image) {
            $result[] = $token . $image['path'];
        }
        OCP\JSON::setContentTypeHeader();
        echo json_encode(array('images' => $result, 'users' => array(), 'displayNames' => array()));
        exit;
    }
}
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('gallery');
$images = \OCP\Files::searchByMime('image');
$user = \OCP\User::getUser();
$users = array();
$result = array();
foreach ($images as &$image) {
    // we show shared images another way
    if ($image->getStorage() instanceof \OC\Files\Storage\Shared) {
        $owner = $image['uid_owner'];
        $users[$owner] = $owner;
    } else {
        $owner = $user;
    }
    $path = $image['path'];
    if (strpos($path, DIRECTORY_SEPARATOR . ".")) {
        continue;
Exemplo n.º 7
0
<?php

// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
OCP\JSON::checkAppEnabled('bookmarks');
$l = new OC_l10n('bookmarks');
if (empty($_FILES)) {
    OCP\Util::writeLog('bookmarks', "No file provided for import", \OCP\Util::WARN);
    $error[] = $l->t('No file provided for import');
} elseif (isset($_FILES['bm_import'])) {
    $file = $_FILES['bm_import']['tmp_name'];
    if ($_FILES['bm_import']['type'] == 'text/html') {
        $error = OC_Bookmarks_Bookmarks::importFile($file);
        if (empty($errors)) {
            OCP\JSON::success();
            //force charset as not set by OC_JSON
            header('Content-Type: application/json; charset=utf-8');
            exit;
        }
    } else {
        $error[] = $l->t('Unsupported file type for import');
    }
}
OC_JSON::error(array('data' => $error));
//force charset as not set by OC_JSON
header('Content-Type: application/json; charset=utf-8');
exit;
Exemplo n.º 8
0
<?php

/**
* ownCloud - videos application
*
* @author Frank Karlitschek
* @copyright 2012 Frank Karlitschek frank@owncloud.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 Lesser General Public
* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
*
*/
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('videos');
session_write_close();
$file = $_GET['filepath'];
\OCP\Preview::show($file, 120, 120);
Exemplo n.º 9
0
<?php

OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
OCP\JSON::checkAppEnabled('search_lucene');
session_write_close();
//FIXME refactor db queries and logic into the lib folder
function index()
{
    if (isset($_GET['fileid'])) {
        $fileIds = array($_GET['fileid']);
    } else {
        $fileIds = OCA\Search_Lucene\Indexer::getUnindexed();
    }
    $eventSource = new OC_EventSource();
    $eventSource->send('count', count($fileIds));
    $skippedDirs = explode(';', OCP\Config::getUserValue(OCP\User::getUser(), 'search_lucene', 'skipped_dirs', '.git;.svn;.CVS;.bzr'));
    foreach ($fileIds as $id) {
        $skipped = false;
        $fileStatus = OCA\Search_Lucene\Status::fromFileId($id);
        try {
            //before we start mark the file as error so we know there was a problem when the php execution dies
            $fileStatus->markError();
            $path = OC\Files\Filesystem::getPath($id);
            $eventSource->send('indexing', $path);
            foreach ($skippedDirs as $skippedDir) {
                if (strpos($path, '/' . $skippedDir . '/') !== false || strrpos($path, '/' . $skippedDir) === strlen($path) - (strlen($skippedDir) + 1)) {
                    $result = $fileStatus->markSkipped();
                    $skipped = true;
                    break;
                }
Exemplo n.º 10
0
<?php

OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
OCP\JSON::checkAppEnabled('files_irods');
$source = $_GET['source'];
$f = \OC\Files\Filesystem::fopen($source, 'r');
$meta = stream_get_meta_data($f)['wrapper_data']->metadata;
$html = "<table id='metadata'>\n           <thead>\n             <tr>\n               <th>Key</th>\n               <th>Value</th>\n               <th>Units</th>\n               <th>Actions</th>\n             </tr>\n           </thead>\n           <tbody>";
foreach ($meta as $m) {
    $html .= sprintf("<tr><td class='editable' data-name='name' data-pk={$m->id}>%s</td>\n                    <td class='editable' data-name='value' data-pk={$m->id}>%s</td>\n                    <td class='editable' data-name='units' data-pk={$m->id}>%s</td>\n                    <td><button class='btn btn-danger remove-metadata' data-pk={$m->id}><i class='glyphicon glyphicon-remove'></i> Remove</button></td>\n                    </tr>", $m->name, $m->value, $m->units);
}
$html .= "</tbody></table>";
\OCP\JSON::success(array('data' => $html));
Exemplo n.º 11
0
<?php

OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled("notify");
// FIXME CSRF !!
if ($_SERVER["REQUEST_METHOD"] != 'POST') {
    OCP\JSON::error(array("message" => 'POST required for this action!'));
    exit;
}
try {
    $num = OC_Notify::deleteByUser();
    OCP\JSON::success(array("num" => $num));
} catch (Exception $e) {
    OCP\JSON::error(array("message" => $e->getMessage()));
}
exit;
Exemplo n.º 12
0
* 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 Lesser General Public
* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
*
*/
// some housekeeping
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('activity');
// read the next 30 items for the endless scrolling
// get the page that is requested. Needed for endless scrolling
$count = 30;
if (isset($_GET['page'])) {
    $page = intval($_GET['page']) - 1;
} else {
    $page = 0;
}
$activity = OCA\Activity\Data::read($page * $count, $count);
$nextpage = \OCP\Util::linkToAbsolute('activity', 'index.php', array('page' => $page + 2));
// show the next 30 entries
$tmpl = new \OCP\Template('activity', 'activities.part', '');
$tmpl->assign('activity', $activity);
if ($page == 0) {
    $tmpl->assign('nextpage', $nextpage);
Exemplo n.º 13
0
* 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 Lesser General Public 
* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
* 
*/
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('storagecharts2');
$l = new OC_L10N('storagecharts2');
// Update and save the new configuration
if (is_numeric($_POST['s']) && in_array($_POST['k'], array('hu_size', 'hu_size_hus', 'hu_ratio'))) {
    OC_DLStCharts::setUConfValue($_POST['k'], $_POST['s']);
    switch ($_POST['k']) {
        case 'hu_size':
            OCP\JSON::encodedPrint(array('r' => OC_DLStChartsLoader::loadChart('chisto_us', $l)));
            break;
        case 'hu_size_hus':
            OCP\JSON::encodedPrint(array('r' => OC_DLStChartsLoader::loadChart('clines_usse', $l)));
            break;
    }
} else {
    // default
    OCP\JSON::encodedPrint(array('r' => OC_DLStChartsLoader::loadChart('cpie_rfsus', $l)));
Exemplo n.º 14
0
/**
 * ownCloud - Impressionist & Impress App
 *
 * @author Raghu Nayyar & Frank Karlitschek
 * @copyright 2012 me@iraghu.com 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 Lesser General Public 
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */
require_once 'lib/impressionist.php';
// Check if we are a user
OCP\User::checkLoggedIn();
//Ajax Calls to check App enable.
OCP\JSON::checkAppEnabled('impressionist');
OCP\Util::addStyle('impressionist', 'style');
OCP\App::setActiveNavigationEntry('impressionist_index');
$list = \OCA_Impressionist\Storage::getPresentations();
$tmpl = new OCP\Template('impressionist', 'viewer', 'user');
$tmpl->assign('list', $list);
$tmpl->printPage();
<?php

/**
* ownCloud - bookmarks plugin
*
* @authors Dr.J.Akilandeswari, R.Ramki, R.Sasidharan, P.Suresh
* 
* 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 Lesser General Public 
* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
* 
*/
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
OCP\JSON::checkAppEnabled('collaboration');
if (isset($_POST['project'])) {
    OCP\JSON::success(array('project_status' => OC_Collaboration_Report::getProjectStatus($_POST['project'])));
    exit;
}
OC_JSON::error();
exit;
Exemplo n.º 16
0
<?php

/**
 * ownCloud - Impress App
 *
 * @author Frank Karlitschek
 * @copyright 2011 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 Lesser General Public 
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */
require_once 'lib/impress.php';
OCP\User::checkLoggedIn();
OCP\JSON::checkAppEnabled('impress');
OCP\Util::addStyle('impress', 'style');
OCP\App::setActiveNavigationEntry('impress_index');
$list = \OCA_Impress\Storage::getPresentations();
$tmpl = new OCP\Template('impress', 'presentations', 'user');
$tmpl->assign('list', $list);
$tmpl->printPage();
Exemplo n.º 17
0
<?php

/**
 * 2012 Frank Karlitschek frank@owncloud.org
 * This file is licensed under the Affero General Public License version 3 or later.
 * See the COPYING-README file.
 */
OCP\JSON::checkAppEnabled('external');
OCP\User::checkAdminUser();
OCP\JSON::callCheck();
$sites = array();
for ($i = 0; $i < sizeof($_POST['site_name']); $i++) {
    if (!empty($_POST['site_name'][$i]) && !empty($_POST['site_url'][$i])) {
        array_push($sites, array(strip_tags($_POST['site_name'][$i]), strip_tags($_POST['site_url'][$i])));
    }
}
$l = OC_L10N::get('external');
foreach ($sites as $site) {
    if (strpos($site[1], 'https://') === 0) {
        continue;
    }
    if (strpos($site[1], 'http://') === 0) {
        continue;
    }
    OC_JSON::error(array("data" => array("message" => $l->t('Please enter valid urls - they have to start with either http:// or https://'))));
    return;
}
if (sizeof($sites) == 0) {
    $appConfig = \OC::$server->getAppConfig();
    $appConfig->deleteKey('external', 'sites');
} else {
Exemplo n.º 18
0
<?php

/**
* ownCloud - firstrunwizard application
*
* @author Frank Karlitschek
* @copyright 2012 Frank Karlitschek frank@owncloud.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/>.
*
*/
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('firstrunwizard');
OCP\JSON::callCheck();
\OCA_FirstRunWizard\Config::disable();
Exemplo n.º 19
0
 * @return json: success/error state indicator
 * @return number: Total number of shortys in the list
 * @return json: Numeric array of all shortys, associative array of attributes as values for every single shorty contained
 * @author Christian Reiner
 */

// swallow any accidential output generated by php notices and stuff to preserve a clean JSON reply structure
OC_Shorty_Tools::ob_control ( TRUE );

//no apps or filesystem
$RUNTIME_NOSETUPFS = TRUE;

// Sanity checks
OCP\JSON::callCheck ( );
OCP\JSON::checkLoggedIn ( );
OCP\JSON::checkAppEnabled ( 'shorty' );

try
{
	// first remove any entries already marked as 'deleted'
	$query = OCP\DB::prepare ( OC_Shorty_Query::URL_REMOVE );
	$result = $query->execute(array(':user'=>OCP\User::getUser()));
	// now comes the real list selection
//   define ('PAGE_SIZE', 100);
//   $p_offset = OC_Shorty_Type::req_argument ( 'page', OC_Shorty_Type::INTEGER, FALSE) * PAGE_SIZE;
	// pre-sort list according to user preferences
	$p_sort = OC_Shorty_Type::$SORTING[OCP\Config::getUserValue(OCP\User::getUser(),'shorty','list-sort-code','cd')];
	$param = array (
		':user'   => OCP\User::getUser ( ),
		':sort'   => $p_sort,
// 		':offset' => $p_offset,
Exemplo n.º 20
0
<?php

/**
 * ownCloud - RainLoop mail plugin
 *
 * @author RainLoop Team
 * @copyright 2015 RainLoop Team
 *
 * https://github.com/RainLoop/rainloop-webmail/tree/master/build/owncloud
 */
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('rainloop');
OCP\JSON::callCheck();
$sEmail = '';
$sLogin = '';
if (isset($_POST['appname'], $_POST['rainloop-password'], $_POST['rainloop-email']) && 'rainloop' === $_POST['appname']) {
    $sUser = OCP\User::getUser();
    $sPostEmail = $_POST['rainloop-email'];
    OCP\Config::setUserValue($sUser, 'rainloop', 'rainloop-email', $sPostEmail);
    $sPass = $_POST['rainloop-password'];
    if ('******' !== $sPass && '' !== $sPass) {
        include_once OC_App::getAppPath('rainloop') . '/lib/RainLoopHelper.php';
        OCP\Config::setUserValue($sUser, 'rainloop', 'rainloop-password', OC_RainLoop_Helper::encodePassword($sPass, md5($sPostEmail)));
    }
    $sEmail = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-email', '');
} else {
    sleep(1);
    OC_JSON::error(array('Message' => 'Invalid argument(s)', 'Email' => $sEmail));
    return false;
}
sleep(1);
Exemplo n.º 21
0
 *
 * 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/>.
 * Displays <a href="http://opensource.org/licenses/AGPL-3.0">GNU AFFERO GENERAL PUBLIC LICENSE</a>
 * @license http://opensource.org/licenses/AGPL-3.0 GNU AFFERO GENERAL PUBLIC LICENSE
 *
 */
include_once "user_otp/lib/utils.php";
$l = OC_L10N::get('settings');
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('user_otp');
OCP\JSON::callCheck();
if ($_POST && $_POST["uid"] && OC_User::isAdminUser(OCP\User::getUser())) {
    OC_JSON::checkSubAdminUser();
    $uid = $_POST["uid"];
} else {
    $uid = OCP\User::getUser();
}
// Get data
$mOtp = new MultiOtpDb(OCP\Config::getAppValue('user_otp', 'EncryptionKey', 'DefaultCliEncryptionKey'));
$mOtp->EnableVerboseLog();
//$mOtp->SetDisplayLogOption(1);
if ($_POST && $_POST["otp_action"] === "delete_otp" && $mOtp->CheckUserExists($uid)) {
    if ($mOtp->DeleteUser($uid)) {
        OCP\JSON::success(array("data" => array("message" => $l->t("OTP Changed"))));
    } else {
Exemplo n.º 22
0
<?php

/**
 * ownCloud - Addressbook
 *
 * @author Jakob Sack
 * @copyright 2011 Jakob Sack mail@jakobsack.de
 *
 * 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/>.
 *
 */
// Init owncloud
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('tasks');
OCP\JSON::callCheck();
$id = $_POST['id'];
$task = OC_Calendar_App::getEventObject($id);
OC_Calendar_Object::delete($id);
OCP\JSON::success(array('data' => array('id' => $id)));
Exemplo n.º 23
0
 * @copyright 2012 Jakob Sack <*****@*****.**>
 *
 * 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/>.
 *
 */
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('mail');
$accounts = OCA_Mail\App::getFolders(OCP\User::getUser());
//
// TODO: error is listed within the accounts
//
if ($accounts['error']) {
    OCP\JSON::error(array('data' => array('message' => $accounts['error'])));
    exit;
}
$tmpl = new OCP\Template('mail', 'part.folders');
$tmpl->assign('accounts', $accounts);
$page = $tmpl->fetchPage();
OCP\JSON::success(array('data' => $page));
Exemplo n.º 24
0
<?php

/**
 * Copyright (c) 2012 Bart Visscher <*****@*****.**>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('user_openid_provider');
OCP\JSON::callCheck();
set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__ . '/../3rdparty');
$url = $_POST['url'];
$storage = new OC_OpenIdProviderStorage();
$storage->addSite('/?' . OCP\User::getUser(), $url, null);
OCP\JSON::success();
Exemplo n.º 25
0
* @author Bjoern Schiessle
* @copyright 2013 Bjoern Schiessle schiessle@owncloud.com
*
* 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/>.
*
*/
OCP\JSON::checkAppEnabled('files_versions');
//OCP\JSON::callCheck();
$file = $_GET['file'];
$revision = (int) $_GET['revision'];
list($uid, $filename) = OCA\Files_Versions\Storage::getUidAndFilename($file);
$versionName = '/' . $uid . '/files_versions/' . $filename . '.v' . $revision;
$view = new OC\Files\View('/');
$ftype = $view->getMimeType('/' . $uid . '/files/' . $filename);
header('Content-Type:' . $ftype);
OCP\Response::setContentDispositionHeader(basename($filename), 'attachment');
OCP\Response::disableCaching();
OCP\Response::setContentLengthHeader($view->filesize($versionName));
OC_Util::obEnd();
$view->readfile($versionName);
Exemplo n.º 26
0
<?php

/**
* ownCloud - News app
*
* @author Alessandro Cosentino
* Copyright (c) 2012 - Alessandro Cosentino <*****@*****.**>
*
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file
*
*/
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('news');
OCP\JSON::callCheck();
session_write_close();
$userid = OCP\USER::getUser();
$feedid = $_POST['feedid'];
$feedurl = $_POST['feedurl'];
$folderid = $_POST['folderid'];
$newfeed = OCA\News\Utils::fetch($feedurl);
$newfeedid = false;
if ($newfeed !== null) {
    $feedmapper = new OCA\News\FeedMapper();
    $newfeedid = $feedmapper->save($newfeed, $folderid);
}
$l = OC_L10N::get('news');
if (!$newfeedid) {
    OCP\JSON::error(array('data' => array('message' => $l->t('Error updating feed.'))));
    OCP\Util::writeLog('news', 'ajax/updatefeed.php: Error updating feed: ' . $_POST['feedid'], OCP\Util::ERROR);
Exemplo n.º 27
0
 * @license AGPL-3.0
 *
 * This code is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License, version 3,
 * as published by the Free Software Foundation.
 *
 * This program 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, version 3,
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 *
 */
OCP\JSON::checkAppEnabled('files_sharing');
\OC_User::setIncognitoMode(true);
$file = array_key_exists('file', $_GET) ? (string) $_GET['file'] : '';
$maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '32';
$maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '32';
$scalingUp = array_key_exists('scalingup', $_GET) ? (bool) $_GET['scalingup'] : true;
$token = array_key_exists('t', $_GET) ? (string) $_GET['t'] : '';
$keepAspect = array_key_exists('a', $_GET) ? true : false;
if ($token === '') {
    \OC_Response::setStatus(\OC_Response::STATUS_BAD_REQUEST);
    \OCP\Util::writeLog('core-preview', 'No token parameter was passed', \OCP\Util::DEBUG);
    exit;
}
$linkedItem = \OCP\Share::getShareByToken($token);
if ($linkedItem === false || $linkedItem['item_type'] !== 'file' && $linkedItem['item_type'] !== 'folder') {
    \OC_Response::setStatus(\OC_Response::STATUS_NOT_FOUND);
Exemplo n.º 28
0
* License along with this library.
* If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
 * @file ajax/preferences.php
 * @brief Ajax method to store one and query a personal preference
 * @author Christian Reiner
 */
$validPreferences = array('fluxx-status-H' => array('validate' => create_function('$v', 'return in_array($v,array("hidden","shown"));'), 'normalize' => create_function('$v,$d', 'return in_array($v,array("hidden","shown"))?$v:$d;')), 'fluxx-status-N' => array('validate' => create_function('$v', 'return in_array($v,array("hidden","shown"));'), 'normalize' => create_function('$v,$d', 'return in_array($v,array("hidden","shown"))?$v:$d;')), 'fluxx-position-H' => array('validate' => create_function('$v', 'return is_numeric($v) && ($v>=0);'), 'normalize' => create_function('$v,$d', 'return is_numeric($v) && ($v>=0)?floatval($v):floatval($d);')), 'fluxx-position-N' => array('validate' => create_function('$v', 'return is_numeric($v) && ($v>0);'), 'normalize' => create_function('$v,$d', 'return is_numeric($v) && ($v>=0)?floatval($v):floatval($d);')));
//no apps or filesystem
$RUNTIME_NOSETUPFS = true;
// Sanity checks
OCP\JSON::callCheck();
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('fluxx_compensator');
try {
    // test for valid key
    switch ($_SERVER['REQUEST_METHOD']) {
        case 'POST':
            // check if a valid key has been specified
            if (!array_key_exists('key', $_POST)) {
                throw new Exception("Missing key in ajax method.");
            }
            if (!array_key_exists($_POST['key'], $validPreferences)) {
                throw new Exception("Unknown key in ajax method.");
            }
            // check for a valid value
            if (!array_key_exists('value', $_POST)) {
                throw new Exception("Missing value in ajax method.");
            }
Exemplo n.º 29
0
<?php

set_include_path(get_include_path() . PATH_SEPARATOR . \OC_App::getAppPath('files_external') . '/3rdparty/google-api-php-client/src');
require_once 'Google_Client.php';
OCP\JSON::checkAppEnabled('files_external');
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
$l = \OC::$server->getL10N('files_external');
if (isset($_POST['client_id']) && isset($_POST['client_secret']) && isset($_POST['redirect'])) {
    $client = new Google_Client();
    $client->setClientId($_POST['client_id']);
    $client->setClientSecret($_POST['client_secret']);
    $client->setRedirectUri($_POST['redirect']);
    $client->setScopes(array('https://www.googleapis.com/auth/drive'));
    if (isset($_POST['step'])) {
        $step = $_POST['step'];
        if ($step == 1) {
            try {
                $authUrl = $client->createAuthUrl();
                OCP\JSON::success(array('data' => array('url' => $authUrl)));
            } catch (Exception $exception) {
                OCP\JSON::error(array('data' => array('message' => $l->t('Step 1 failed. Exception: %s', array($exception->getMessage())))));
            }
        } else {
            if ($step == 2 && isset($_POST['code'])) {
                try {
                    $token = $client->authenticate($_POST['code']);
                    OCP\JSON::success(array('data' => array('token' => $token)));
                } catch (Exception $exception) {
                    OCP\JSON::error(array('data' => array('message' => $l->t('Step 2 failed. Exception: %s', array($exception->getMessage())))));
                }
Exemplo n.º 30
0
* 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 Lesser General Public 
* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
* 
*/

$pr = $_POST['p'];

OCP\JSON::checkAppEnabled('ocdownloader');
OCP\JSON::checkLoggedIn();

$k = Array('e' => TRUE);
if(preg_match('/^pr_([0-9]{1,4})$/', $pr, $m)){
	$p = OC_ocDownloader::getProvider($m[1]);
	if(isset($p['pr_name'])){
		$k['e'] = FALSE;
		$k['n'] = strtolower($p['pr_name']);
	}
}

OCP\JSON::encodedPrint($k);