public function setup() { App::checkAppEnabled('files_locking'); OC_User::clearBackends(); OC_User::useBackend(new OC_User_Dummy()); // Login OC_User::createUser('test', 'test'); $this->user = OC_User::getUser(); OC_User::setUserId('test'); $this->storage = $this->getTestStorage(); }
* 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\User::checkLoggedIn(); \OCP\App::checkAppEnabled('collaboration'); OCP\App::setActiveNavigationEntry('collaboration'); OCP\Util::addScript('collaboration', 'update_task'); OCP\Util::addScript('collaboration/3rdparty', 'jquery-ui-sliderAccess'); OCP\Util::addScript('collaboration/3rdparty', 'jquery-ui-timepicker-addon'); OCP\Util::addScript('collaboration/3rdparty', 'jquery-te'); OCP\Util::addStyle('collaboration/3rdparty', 'jquery-te'); OCP\Util::addStyle('collaboration/3rdparty', 'jquery-ui-timepicker-addon'); OCP\Util::addStyle('collaboration', 'content_header'); OCP\Util::addStyle('collaboration', 'tabs'); OCP\Util::addStyle('collaboration', 'update_task'); $l = OC_L10N::get('collaboration'); $tpl = new OCP\Template('collaboration', 'update_task', 'user'); $bol = OC_Collaboration_Project::isAdmin(); if ($bol == true) { if (isset($_POST['tid'])) {
<?php OCP\User::checkAdminUser(); \OCP\App::checkAppEnabled('shorten'); function setAdminVal() { if (isset($_POST['host'])) { OCP\Config::setAppValue('shorten', 'host', $_POST['host']); #echo "host:".$_POST['host']; } if (isset($_POST['api'])) { OCP\Config::setAppValue('shorten', 'api', $_POST['api']); #echo "api:".$_POST['api']; } if (isset($_POST['type'])) { OCP\Config::setAppValue('shorten', 'type', $_POST['type']); #echo "type:".$_POST['type']; } }
<?php namespace apps2_games; /** * @brief ownCloud Games Integration * @site http://oc-apps2.sourceforge.net/ * * @author Pierre Fauconnier * @copyright 2014 Pierre Fauconnier * @license CeCILL v2.1 - http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt */ // Main -> fired by ownCloud via appinfo/app.php \OCP\User::checkLoggedIn(); \OCP\App::checkAppEnabled(K_APP_NAME); \OCP\App::setActiveNavigationEntry(K_APP_NAME); // $myJSON =<<<EOJ [ {"id":"minesweeper" ,"js":"g/jsminesweeper/JsMinesweeper.html" ,"caption":"Mine Sweeper" ,"ico":"img/minesweeper.png" ,"title":"Minesweeper is a small naval warship designed to engage in minesweeping.<br>By using various mechanisms intended to counter the threat posed by naval mines, minesweepers keep waterways clear for shipping." },{"id":"titactoe" ,"js":"g/tictactoe/tictactoe.html" ,"caption":"Tic-Tac-Toe" ,"ico":"img/tictactoe.png" ,"title":"Tic-tac-toe (or Noughts and crosses, Xs and Os, Terni Lapilli) is a paper-and-pencil game for two players, X and O, who take turns marking the spaces in a 3\u00d73 grid.<br>The player who succeeds in placing three respective marks in a horizontal, vertical, or diagonal row wins the game." },{"id":"fiveInRow" ,"js":"g/fiveInRow/fir.html" ,"caption":"Five in Row" ,"ico":"img/FiR.jpg" ,"title":"Traditionally played with Go pieces (black and white stones) on a go board with 19\u00d719 intersections.<br>User plays first, then players alternate in placing a mark of their own on an empty place. The winner is the first player to get an unbroken row of five marks horizontally, vertically, or diagonally."
<?php /** * ownCloud - Files_Opds App * * @author Frank de Lange * @copyright 2014 Frank de Lange * * This file is licensed under the Affero General Public License version 3 or * later. */ namespace OCA\Files_Opds; \OCP\App::checkAppEnabled('files_opds'); /* Enable login through basic auth, using normal OC username/password * This is required because opds clients do not support the normal * OC login process */ if (Util::authenticateUser() === false) { Util::changeHttpStatus(401); exit; } \OCP\User::checkLoggedIn(); /* Refuse access if user disabled opds support */ if (Config::get('enable', 'false') === 'false') { Util::changeHttpStatus(403); exit; } /* id defaults to 'root' (meaning 'serve root feed') */ $id = isset($_GET['id']) ? $_GET['id'] : 'root'; /* if either pid or tid is set, serve preview image for id */
public function setup() { \OCP\App::checkAppEnabled('files_locking'); $this->fileLock = new Lock(__DIR__ . '/data/test.txt'); }
* later. See the COPYING file. * * @author Ben Curtis <*****@*****.**> * @copyright Ben Curtis 2015 */ namespace OCA\OwnNote\Controller; use \OCP\AppFramework\ApiController; use \OCP\AppFramework\Http\JSONResponse; use \OCP\AppFramework\Http\Response; use \OCP\AppFramework\Http; use \OCP\IRequest; \OCP\User::checkLoggedIn(); \OCP\App::checkAppEnabled('ownnote'); $FOLDER = "Notes"; class OwnnoteApiController extends ApiController { private $userId; public function __construct($appName, IRequest $request){ parent::__construct($appName, $request); } /** * @NoAdminRequired
* * 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\App::checkAppEnabled('activity'); $forceUserLogout = false; if (!\OCP\User::isLoggedIn()) { if (!isset($_GET['token']) || strlen($_GET['token']) !== 30) { // Token missing or invalid header('HTTP/1.0 404 Not Found'); exit; } $preferences = new \OC\Preferences(\OC_DB::getConnection()); $users = $preferences->getUsersForValue('activity', 'rsstoken', $_GET['token']); if (sizeof($users) !== 1) { // User not found header('HTTP/1.0 404 Not Found'); exit; } // Token found login as that user
<?php // Look up other security checks in the docs! \OCP\User::checkLoggedIn(); \OCP\App::checkAppEnabled('ocDashboard'); \OCP\App::setActiveNavigationEntry('ocDashboard'); OCP\Util::addscript('ocDashboard', 'ocDashboard'); OCP\Util::addscript('ocDashboard', 'ajaxService'); OCP\Util::addStyle('ocDashboard', 'ocDashboard'); $user = OCP\User::getUser(); $w = array(); OC::$CLASSPATH['ocdWidgets'] = 'ocDashboard/appinfo/widgetConfigs.php'; OC::$CLASSPATH['ocdFactory'] = 'ocDashboard/lib/factory.php'; foreach (ocdWidgets::$widgets as $widget) { // if widget is enabled if (OCP\Config::getUserValue($user, "ocDashboard", "ocDashboard_" . $widget['id']) == "yes") { $w[] = ocdFactory::getWidget($widget)->getData(); } } //if all deactivated if (empty($w)) { $l = new OC_L10N('ocDashboard'); $w[0]['error'] = "You can configure this site in your personal settings."; $w[0]['id'] = "none"; $w[0]['name'] = ""; $w[0]['status'] = "3"; $w[0]['interval'] = "0"; $w[0]['icon'] = ""; } $tpl = new OCP\Template("ocDashboard", "main", "user"); $tpl->assign('widgets', $w);
* oclife is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * oclife 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with oclife. If not, see <http://www.gnu.org/licenses/>. */ // Highlight current menu item OCP\App::setActiveNavigationEntry('oclife'); // Include what's needed by fancytree \OCP\Util::addStyle('oclife', 'ui.fancytree'); \OCP\Util::addScript('oclife', 'fancytree/jquery.fancytree-all'); // Following is needed by layout manager \OCP\Util::addScript('oclife', 'layout/jquery.sizes'); \OCP\Util::addScript('oclife', 'layout/jlayout.border'); \OCP\Util::addScript('oclife', 'layout/jquery.jlayout'); \OCP\Util::addScript('oclife', 'layout/layout'); // THEN execute what needed by us... \OCP\Util::addStyle('oclife', 'oclife'); \OCP\Util::addScript('oclife', 'oclife/oclife_tagstree'); // Look up other security checks in the docs! \OCP\User::checkLoggedIn(); \OCP\App::checkAppEnabled('oclife'); $tpl = new OCP\Template("oclife", "main", "user"); $tpl->printPage();
protected function setup() { parent::setUp(); \OCP\App::checkAppEnabled('files_locking'); $this->fileLock = new Lock(__DIR__ . '/data/test.txt'); }
<?php /** * ownCloud - ownpad_lite plugin * * @author Victor Dubiniuk * @copyright 2012 Victor Dubiniuk victor.dubiniuk@gmail.com * * This file is licensed under the Affero General Public License version 3 or * later. */ namespace OCA\ownpad_lite; // Check if we are a user \OCP\User::checkLoggedIn(); \OCP\App::checkAppEnabled(App::APP_ID); \OCP\Util::addStyle(App::APP_ID, 'style'); \OCP\Util::addScript(App::APP_ID, 'etherpad'); \OCP\App::setActiveNavigationEntry('ownpad_lite_index'); $tmpl = new \OCP\Template(App::APP_ID, "index", "user"); $tmpl->assign(App::CONFIG_ETHERPAD_URL, App::getServiceUrl()); $tmpl->assign(App::CONFIG_USERNAME, App::getUsername()); $tmpl->printPage();
protected function setup() { parent::setUp(); App::checkAppEnabled('files_locking'); $this->storage = $this->getTestStorage(); }
public static function initController() { \OCP\User::checkLoggedIn(); \OCP\App::checkAppEnabled('contacts'); \OCP\App::checkAppEnabled(self::APP_ID); }
<?php namespace OCA\PasswordPolicy; use OCA\PasswordPolicy\Service; use OCA\PasswordPolicy\Service\PasswordPolicyService; use OCP\AppFramework\App; use OCP\IContainer; \OCP\App::checkAppEnabled('passwordpolicy'); \OCP\User::checkAdminUser(); $tpl = new \OCP\Template("passwordpolicy", "admin"); $tpl->assign('msg', 'Password Policy Enforcement'); $ocConfig = \OC::$server->getConfig(); $service = new PasswordPolicyService($ocConfig, 'passwordpolicy'); // set defaults if ($service->getAppValue('minlength') == '') { $service->setAppValue('minlength', '15'); } if ($service->getAppValue('hasmixedcase') == '') { $service->setAppValue('hasmixedcase', 'true'); } if ($service->getAppValue('hasnumbers') == '') { $service->setAppValue('hasnumbers', 'true'); } if ($service->getAppValue('hasspecialchars') == '') { $service->setAppValue('hasspecialchars', 'true'); } if ($service->getAppValue('specialcharslist') == '') { $service->setAppValue('specialcharslist', '!@#$%^&*()'); } $minlength = $service->getAppValue('minlength');
<?php \OCP\User::checkLoggedIn(); \OCP\App::checkAppEnabled('pdflintview'); \OCP\App::setActiveNavigationEntry( 'pdflintview' ); \OCP\Util::addScript('pdflintview', 'ajaxaggregator'); ?>
<?php /** * ownCloud - accessstats * * This file is licensed under the Affero General Public License version 3 or * later. See the COPYING file. * * @author Nick Booth <*****@*****.**> * @copyright Nick Booth 2014 */ \OCP\App::checkAppEnabled('accessstats'); OC_Util::checkAdminUser(); \OCP\Util::addScript('accessstats', 'accessstats_admin'); $tpl = new OCP\Template("accessstats", "accessstats_admin"); $tpl->assign('title', "File Access Statistics Download"); return $tpl->fetchPage();
* 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/>. * */ /** * @file content.php * Content of the imprint as configured * @access public */ // Session checks // \OCP\User::checkLoggedIn(); \OCP\App::checkAppEnabled('imprint'); // prepare content if (FALSE === ($content = \OCP\Config::getAppValue('imprint', 'content', FALSE))) { $tmpl = new \OCP\Template('imprint', 'tmpl_dummy'); \OCP\Util::addStyle('imprint', 'reference'); } else { // detect type of stored content and process accordingly if (strlen($content) != strlen(strip_tags($content))) { $processed_content = $content; } else { $processed_content = sprintf("<pre>\n%s\n</pre>", $content); } // output processed content \OCP\Util::addStyle('imprint', 'content'); $tmpl = new \OCP\Template('imprint', 'tmpl_content'); $tmpl->assign('processed-content', $processed_content);
* later. See the COPYING file. * * @author ownCollab Team <*****@*****.**> * @copyright ownCollab Team 2015 */ namespace OCA\Owncollab\Controller; use OCA\Owncollab\Helper; use OCA\Owncollab\Db\Connect; use OCP\AppFramework\Http\RedirectResponse; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Controller; use OCP\IRequest; use OCP\IURLGenerator; \OCP\App::checkAppEnabled('owncollab'); class MainController extends Controller { /** @var string $userId * current auth user id */ private $userId; /** @var bool $isAdmin * true if current auth user consists into admin group */ private $isAdmin; /** @var \OC_L10N $l10n * languages translations */ private $l10n; /** @var Connect $connect * instance working with database */ private $connect; /** @var IURLGenerator */
<?php \OCP\User::checkLoggedIn(); \OCP\App::checkAppEnabled('fc_mail_attachments'); \OCP\Util::addscript('fc_mail_attachments', 'utils'); \OCP\Util::addscript('fc_mail_attachments', 'account'); //OCP\Util::addstyle('fc_mail_attachments', 'style'); $user = OCP\User::getUser(); $tmpl = new OCP\Template('fc_mail_attachments', 'settings'); $query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*fc_mail_attachments` WHERE user = ?'); $results = $query->execute(array($user))->fetchAll(); if (sizeof($results)) { $conf = $results[0]; $tmpl->assign('dir', $conf['dir']); $tmpl->assign('mail_host', $conf['mail_host']); $tmpl->assign('mail_port', $conf['mail_port']); $tmpl->assign('mail_security', $conf['mail_security']); $tmpl->assign('mail_user', $conf['mail_user']); } return $tmpl->fetchPage();
<?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; \OCP\User::checkLoggedIn(); \OCP\App::checkAppEnabled('contacts'); \OCP\App::checkAppEnabled('gsync'); $refreshToken = \OCP\Config::getUserValue(\OCP\User::getUser(), 'gsync', 'refresh_token', ''); if ($refreshToken) { $response = Request::getAccessTokenByRefreshToken($refreshToken); $respData = json_decode($response, true); App::log('Autosync session.' . $response, \OCP\Util::DEBUG); Contact::import(@$respData['access_token']); } exit;