Example #1
0
<?php

/**
 * ownCloud - gsync plugin
 * 
 * @author Victor Dubiniuk
 * @copyright 2012-2013 Victor Dubiniuk victor.dubiniuk@gmail.com
 * 
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 */
namespace OCA_Gsync;

App::initController();
\OCP\Util::addScript(App::APP_ID, 'settings');
$info = \OCP\App::getAppInfo(App::APP_ID);
$tmpl = new \OCP\Template(App::APP_ID, 'settings');
$tmpl->assign(App::GOOGLE_CLIENT_ID, App::getClientId());
$tmpl->assign(App::GOOGLE_SECRET, App::getSecret());
$tmpl->assign(App::GOOGLE_REFRESH_TOKEN, App::getRefreshToken());
$tmpl->assign('gsync_redirect', App::getRedirectUri());
$tmpl->assign('app_version', @$info['version']);
return $tmpl->fetchPage();
Example #2
0
<?php

/**
 * ownCloud - gsync plugin
 * 
 * @author Victor Dubiniuk
 * @copyright 2012-2013 Victor Dubiniuk victor.dubiniuk@gmail.com
 * 
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 */
namespace OCA_Gsync;

App::initAjaxController();
// Get data
if (isset($_POST[App::GOOGLE_CLIENT_ID])) {
    App::setClientId($_POST[App::GOOGLE_CLIENT_ID]);
} elseif (isset($_POST[App::GOOGLE_SECRET])) {
    App::setSecret($_POST[App::GOOGLE_SECRET]);
} elseif (isset($_POST[App::GOOGLE_REFRESH_TOKEN])) {
    $token = App::getRefreshToken();
    Request::revokeRefreshToken($token);
    App::setRefreshToken('');
} else {
    \OCP\JSON::error(array("data" => array("message" => App::$l10n->t("Invalid request"))));
}
\OCP\JSON::success(array("data" => array("message" => App::$l10n->t("Saved"))));