Esempio n. 1
0
<?php

/**
 * ownCloud - impersonate
 *
 * This file is licensed under the Affero General Public License version 3 or
 * later. See the COPYING file.
 *
 * @author Jörn Friedrich Dreyer <*****@*****.**>
 * @copyright Jörn Friedrich Dreyer 2015
 */
use OCP\AppFramework\App;
$application = new App('impersonate');
$application->registerRoutes($this, ['routes' => [['name' => 'Settings#impersonate', 'url' => '/user', 'verb' => 'POST']]]);
Esempio n. 2
0
 /**
  * If a routes.php file returns an array, try to set up the application and
  * register the routes for the app. The application class will be chosen by
  * camelcasing the appname, e.g.: my_app will be turned into
  * \OCA\MyApp\AppInfo\Application. If that class does not exist, a default
  * App will be intialized. This makes it optional to ship an
  * appinfo/application.php by using the built in query resolver
  *
  * @param array $routes the application routes
  * @param string $appName the name of the app.
  */
 private function setupRoutes($routes, $appName)
 {
     if (is_array($routes)) {
         $appNameSpace = App::buildAppNamespace($appName);
         $applicationClassName = $appNameSpace . '\\AppInfo\\Application';
         if (class_exists($applicationClassName)) {
             $application = new $applicationClassName();
         } else {
             $application = new App($appName);
         }
         $application->registerRoutes($this, $routes);
     }
 }
Esempio n. 3
0
<?php

/**
 * @author Thomas Tanghus
 * @copyright 2013-2014 Thomas Tanghus (thomas@tanghus.net)
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */
namespace OCA\Contacts\AppInfo;

use OCA\Contacts\Dispatcher;
use OCP\AppFramework\App;
$app = new App('contacts');
$app->registerRoutes($this, ['routes' => [['name' => 'page#index', 'url' => '/', 'verb' => 'GET'], ['name' => 'settings#set', 'url' => 'preference/set', 'verb' => 'POST']]]);
//define the routes
$this->create('contacts_index', '/')->get()->action(function ($params) {
    \OC::$server->getSession()->close();
    $dispatcher = new Dispatcher($params);
    $dispatcher->dispatch('PageController', 'index');
});
$this->create('contacts_jsconfig', 'ajax/config.js')->actionInclude('contacts/js/config.php');
$this->create('contacts_address_books_for_user', 'addressbooks/')->get()->action(function ($params) {
    \OC::$server->getSession()->close();
    $dispatcher = new Dispatcher($params);
    $dispatcher->dispatch('AddressBookController', 'userAddressBooks');
});
$this->create('contacts_address_book_connectors', 'connectors/{backend}')->get()->action(function ($params) {
    \OC::$server->getSession()->close();
    $dispatcher = new Dispatcher($params);
    $dispatcher->dispatch('BackendController', 'getConnectors');