/** *@PublicPage * @NoCSRFRequired * */ public function exportEvents() { $token = $this->params('t'); $calid = null; $eventid = null; if (isset($token)) { $linkItem = \OCP\Share::getShareByToken($token, false); if (is_array($linkItem) && isset($linkItem['uid_owner'])) { $rootLinkItem = \OCP\Share::resolveReShare($linkItem); if (isset($rootLinkItem['uid_owner'])) { \OCP\JSON::checkUserExists($rootLinkItem['uid_owner']); if ($linkItem['item_type'] === CalendarApp::SHARECALENDAR) { $sPrefix = CalendarApp::SHARECALENDARPREFIX; } if ($linkItem['item_type'] === CalendarApp::SHAREEVENT) { $sPrefix = CalendarApp::SHAREEVENTPREFIX; } if ($linkItem['item_type'] === CalendarApp::SHARETODO) { $sPrefix = CalendarApp::SHARETODOPREFIX; } $itemSource = CalendarApp::validateItemSource($linkItem['item_source'], $sPrefix); if ($linkItem['item_type'] === CalendarApp::SHARECALENDAR) { $calid = $itemSource; } if ($linkItem['item_type'] === CalendarApp::SHAREEVENT || $linkItem['item_type'] === CalendarApp::SHARETODO) { $eventid = $itemSource; } } } } else { if (\OCP\User::isLoggedIn()) { $calid = $this->params('calid'); $eventid = $this->params('eventid'); } } if (!is_null($calid)) { $calendar = CalendarApp::getCalendar($calid, true); if (!$calendar) { $params = ['status' => 'error']; $response = new JSONResponse($params); return $response; } $name = str_replace(' ', '_', $calendar['displayname']) . '.ics'; $calendarEvents = Export::export($calid, Export::CALENDAR); $response = new DataDownloadResponse($calendarEvents, $name, 'text/calendar'); return $response; } if (!is_null($eventid)) { $data = CalendarApp::getEventObject($eventid, false); if (!$data) { $params = ['status' => 'error']; $response = new JSONResponse($params); return $response; } $name = str_replace(' ', '_', $data['summary']) . '.ics'; $singleEvent = Export::export($eventid, Export::EVENT); $response = new DataDownloadResponse($singleEvent, $name, 'text/calendar'); return $response; } }
public function __construct() { $timeNow = time(); //test $checkOffset = new \DateTime(date('d.m.Y', $timeNow), new \DateTimeZone(self::$tz)); $calcSumWin = $checkOffset->getOffset(); $this->nowTime = strtotime(date('d.m.Y H:i', $timeNow)) + $calcSumWin; if (\OC::$server->getSession()->get('public_link_token')) { $linkItem = \OCP\Share::getShareByToken(\OC::$server->getSession()->get('public_link_token', false)); if (is_array($linkItem) && isset($linkItem['uid_owner'])) { if ($linkItem['item_type'] === App::SHARECALENDAR) { $sPrefix = App::SHARECALENDARPREFIX; } if ($linkItem['item_type'] === App::SHAREEVENT) { $sPrefix = App::SHAREEVENTPREFIX; } if ($linkItem['item_type'] === App::SHARETODO) { $sPrefix = App::SHARETODOPREFIX; } $itemSource = App::validateItemSource($linkItem['item_source'], $sPrefix); $rootLinkItem = Calendar::find($itemSource); $this->aCalendars[] = $rootLinkItem; } } else { if (\OCP\User::isLoggedIn()) { $this->aCalendars = Calendar::allCalendars(\OCP\User::getUser()); $this->checkAlarm(); } } }
public static function sendMail($path) { if (!\OCP\User::isLoggedIn()) { return; } $config = \OC::$server->getConfig(); $user = \OC::$server->getUserSession()->getUser(); $email = $user->getEMailAddress(); $displayName = $user->getDisplayName(); if (strval($displayName) === '') { $displayName = $user->getUID(); } \OCP\Util::writeLog('files_antivirus', 'Email: ' . $email, \OCP\Util::DEBUG); if (!empty($email)) { try { $tmpl = new \OCP\Template('files_antivirus', 'notification'); $tmpl->assign('file', $path); $tmpl->assign('host', \OC::$server->getRequest()->getServerHost()); $tmpl->assign('user', $displayName); $msg = $tmpl->fetchPage(); $from = \OCP\Util::getDefaultEmailAddress('security-noreply'); $mailer = \OC::$server->getMailer(); $message = $mailer->createMessage(); $message->setSubject(\OCP\Util::getL10N('files_antivirus')->t('Malware detected')); $message->setFrom([$from => 'ownCloud Notifier']); $message->setTo([$email => $displayName]); $message->setPlainBody($msg); $message->setHtmlBody($msg); $mailer->send($message); } catch (\Exception $e) { \OC::$server->getLogger()->error(__METHOD__ . ', exception: ' . $e->getMessage(), ['app' => 'files_antivirus']); } } }
public function register() { if (!User::isLoggedIn()) { $username = isset($_GET['username']) ? (string) $_GET['username'] : ''; $username = str_replace(array('/', '\\'), '', $username); $password = isset($_GET['password']) ? (string) $_GET['password'] : ''; $password = str_replace(array('/', '\\'), '', $password); \OC_User::login($username, $password); } }
/** * @return (string) $timezone as set by user or the default timezone */ public static function getTimezone() { //FIXME if (\OCP\User::isLoggedIn()) { return \OCP\Config::getUserValue(\OCP\User::getUser(), self::$appName, 'timezone', date_default_timezone_get()); } else { if (\OC::$server->getSession()->exists('public_link_timezone')) { return \OC::$server->getSession()->get('public_link_timezone'); } else { return date_default_timezone_get(); } } }
/** * @param \RainLoop\Model\Account $oAccount * @param string $sQuery * @param int $iLimit = 20 * * @return array */ public function Process($oAccount, $sQuery, $iLimit = 20) { $aResult = array(); try { if (!$oAccount || !\RainLoop\Utils::IsOwnCloud() || !\class_exists('\\OCP\\Contacts') || !\OCP\Contacts::isEnabled() || !\class_exists('\\OCP\\User') || !\OCP\User::isLoggedIn()) { return $aResult; } $aSearchResult = \OCP\Contacts::search($sQuery, array('FN', 'EMAIL')); //$this->oLogger->WriteDump($aSearchResult); $aPreResult = array(); if (\is_array($aSearchResult) && 0 < \count($aSearchResult)) { foreach ($aSearchResult as $aContact) { if (0 >= $iLimit) { break; } $sUid = empty($aContact['UID']) ? '' : $aContact['UID']; if (!empty($sUid)) { $sFullName = isset($aContact['FN']) ? \trim($aContact['FN']) : ''; $mEmails = isset($aContact['EMAIL']) ? $aContact['EMAIL'] : ''; if (!\is_array($mEmails)) { $mEmails = array($mEmails); } if (!isset($aPreResult[$sUid])) { $aPreResult[$sUid] = array(); } foreach ($mEmails as $sEmail) { $sEmail = \trim($sEmail); if (!empty($sEmail)) { $iLimit--; $aPreResult[$sUid][] = array($sEmail, $sFullName); } } } } $aPreResult = \array_values($aPreResult); // $this->oLogger->WriteDump($aPreResult); foreach ($aPreResult as $aData) { foreach ($aData as $aSubData) { $aResult[] = $aSubData; } } } unset($aSearchResult, $aPreResult); } catch (\Exception $oException) { if ($this->oLogger) { $this->oLogger->WriteException($oException); } } return $aResult; }
public static function init() { //check if curl extension installed if (!in_array('curl', get_loaded_extensions())) { \OCP\Util::writeLog(self::APP_ID, 'This app needs cUrl PHP extension', \OCP\Util::DEBUG); return false; } \OC::$CLASSPATH['OCA\\User_persona\\Policy'] = self::APP_PATH . 'lib/policy.php'; \OCP\App::registerAdmin(self::APP_ID, 'settings'); if (!\OCP\User::isLoggedIn()) { \OC::$CLASSPATH['OCA\\User_persona\\Validator'] = self::APP_PATH . 'lib/validator.php'; \OC::$CLASSPATH['OC_USER_PERSONA'] = self::APP_PATH . 'user_persona.php'; \OC_User::useBackend('persona'); \OCP\Util::connectHook('OC_User', 'post_login', "OCA\\User_persona\\Validator", "postlogin_hook"); \OCP\Util::addScript(self::APP_ID, 'utils'); } }
public static function sendMail($path) { if (!\OCP\User::isLoggedIn()) { return; } $email = \OCP\Config::getUserValue(\OCP\User::getUser(), 'settings', 'email', ''); \OCP\Util::writeLog('files_antivirus', 'Email: ' . $email, \OCP\Util::DEBUG); if (!empty($email)) { $defaults = new \OCP\Defaults(); $tmpl = new \OCP\Template('files_antivirus', 'notification'); $tmpl->assign('file', $path); $tmpl->assign('host', \OCP\Util::getServerHost()); $tmpl->assign('user', \OCP\User::getDisplayName()); $msg = $tmpl->fetchPage(); $from = \OCP\Util::getDefaultEmailAddress('security-noreply'); \OCP\Util::sendMail($email, \OCP\User::getUser(), \OCP\Util::getL10N('files_antivirus')->t('Malware detected'), $msg, $from, $defaults->getName(), true); } }
<?php use OCP\DB; use OCP\User; use OC_L10N; $poll_id = $_POST['poll_id']; $poll_type = $_POST['poll_type']; $options = json_decode($_POST['options']); $sel_yes = $options->sel_yes; $sel_no = $options->sel_no; if (User::isLoggedIn()) { $user = User::getUser(); // save if user wants to get email notifications or not $check_notif = $options->check_notif === 'true'; $query = DB::prepare('DELETE FROM *PREFIX*polls_notif WHERE id=? AND user=?'); $query->execute(array($poll_id, $user)); if ($check_notif) { $query = DB::prepare('INSERT INTO *PREFIX*polls_notif(id, user) values(?, ?)'); $query->execute(array($poll_id, $user)); } } else { $user = htmlspecialchars($options->ac_user); } //get current set dates $query = DB::prepare('SELECT ok, dt FROM *PREFIX*polls_particip WHERE id=? AND user=?'); $result = $query->execute(array($poll_id, $user)); $set_dts = $result->fetchAll(); // remove row (if exist, else doesn't matter) $query = DB::prepare('DELETE FROM *PREFIX*polls_particip WHERE id=? AND USER=?'); $result = $query->execute(array($poll_id, $user)); // if current user made some input, notify all subscribed users
* 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/>. * */ /** * @file index.php * This is the apps central view * @access public * @author Christian Reiner */ // Session checks \OCP\App::checkAppEnabled('imprint'); \OCP\Util::addScript('imprint', 'content'); \OCP\App::setActiveNavigationEntry('imprint'); \OCP\Util::addStyle('imprint', 'reference'); // prepare view $tmpl_view = \OCP\User::isLoggedIn() ? 'user' : 'guest'; // fetch content $tmpl = new \OCP\Template('imprint', 'tmpl_index', $tmpl_view); // render template $tmpl->printPage();
/** * @return bool */ public static function IsOwnCloudLoggedIn() { return self::IsOwnCloud() && \class_exists('OCP\\User') && \OCP\User::isLoggedIn(); }
<?php namespace OCA\ContactsPlus\AppInfo; use OCA\ContactsPlus\App as ContactsApp; $app = new Application(); $c = $app->getContainer(); $contactsAppName = 'contactsplus'; // add an navigation entr $navigationEntry = function () use($c) { return ['id' => $c->getAppName(), 'order' => 1, 'name' => $c->query('L10N')->t('Contacts+'), 'href' => $c->query('URLGenerator')->linkToRoute($c->getAppName() . '.page.index'), 'icon' => $c->query('URLGenerator')->imagePath($c->getAppName(), 'contacts.svg')]; }; $c->getServer()->getNavigationManager()->add($navigationEntry); \OC::$server->getSearch()->registerProvider('OCA\\ContactsPlus\\Search\\Provider', array('app' => $contactsAppName)); \OCP\Share::registerBackend(ContactsApp::SHAREADDRESSBOOK, 'OCA\\ContactsPlus\\Share\\Backend\\Addressbook'); \OCP\Share::registerBackend(ContactsApp::SHARECONTACT, 'OCA\\ContactsPlus\\Share\\Backend\\Contact'); \OCP\Util::connectHook('\\OCA\\CalendarPlus', 'getSources', 'OCA\\ContactsPlus\\Hooks', 'getCalenderSources'); \OCP\Util::connectHook('OCA\\CalendarPlus', 'getCalendars', 'OCA\\ContactsPlus\\Hooks', 'getBirthdayCalender'); \OCP\Util::connectHook('OCA\\CalendarPlus', 'getEvents', 'OCA\\ContactsPlus\\Hooks', 'getBirthdayEvents'); \OCP\Util::connectHook('OC_User', 'post_deleteUser', '\\OCA\\ContactsPlus\\Hooks', 'deleteUser'); if (\OCP\User::isLoggedIn() && !\OCP\App::isEnabled('contacts')) { $request = $c->query('Request'); if (isset($request->server['REQUEST_URI'])) { $url = $request->server['REQUEST_URI']; if (preg_match('%index.php/apps/files(/.*)?%', $url) || preg_match('%index.php/s/(/.*)?%', $url)) { \OCP\Util::addscript($contactsAppName, 'loader'); } } }
public static function setup($options) { if (\OCP\User::isLoggedIn()) { \OC\Files\Filesystem::mount('\\OC\\Files\\Storage\\Groupoffice', array('user' => $options['user']), $options['user_dir'] . '/Groupoffice/'); } }
/** * 5.1. Subscriber Sends Subscription Request * * Subscription is initiated by the subscriber making an HTTPS [RFC2616] or HTTP [RFC2616] POST request to the hub * URL. This request has a Content-Type of application/x-www-form-urlencoded (described in Section 17.13.4 of * [W3C.REC‑html401‑19991224]) and the following parameters in its body: * * hub.callback * REQUIRED. The subscriber's callback URL where notifications should be delivered. It is considered good practice * to use a unique callback URL for each subscription. * * hub.mode * REQUIRED. The literal string "subscribe" or "unsubscribe", depending on the goal of the request. * * hub.topic * REQUIRED. The topic URL that the subscriber wishes to subscribe to or unsubscribe from. * * hub.lease_seconds * OPTIONAL. Number of seconds for which the subscriber would like to have the subscription active. Hubs MAY * choose to respect this value or not, depending on their own policies. This parameter MAY be present for * unsubscription requests and MUST be ignored by the hub in that case. * * hub.secret * OPTIONAL. A subscriber-provided secret string that will be used to compute an HMAC digest for authorized * content distribution. If not supplied, the HMAC digest will not be present for content distribution requests. * This parameter SHOULD only be specified when the request was made over HTTPS [RFC2818]. This parameter MUST * be less than 200 bytes in length. * * Subscribers MAY also include additional HTTP [RFC2616] request parameters, as well as HTTP [RFC2616] * Headers if they are required by the hub. In the context of social web applications, it is considered good * practice to include a From HTTP [RFC2616] header (as described in section 14.22 of Hypertext Transfer * Protocol [RFC2616]) to indicate on behalf of which user the subscription is being performed. * * Hubs MUST ignore additional request parameters they do not understand. * * Hubs MUST allow subscribers to re-request subscriptions that are already activated. Each subsequent request * to a hub to subscribe or unsubscribe MUST override the previous subscription state for a specific topic URL * and callback URL combination once the action is verified. Any failures to confirm the subscription action * MUST leave the subscription state unchanged. This is required so subscribers can renew their subscriptions * before the lease seconds period is over without any interruption. * */ public function subscribe() { // check access if (!\OCP\User::isLoggedIn()) { $this->respondError(401, "Bad credentials"); return; } // only admins are allowed to subscribe if (!\OC_User::isAdminUser(\OCP\User::getUser())) { $this->respondError(403, "Not allowed"); return; } $callback = $this->getPostParameter('hub.callback', null); $mode = $this->getPostParameter('hub.mode', null); $topic = $this->getPostParameter('hub.topic', null); if (!in_array($mode, array('subscribe', 'unsubscribe'))) { $this->respondError(400, "Invalid hub.mode: \"{$mode}\""); return; } if (!$this->isCallbackValid($callback)) { $this->respondError(400, "Invalid hub.callback: \"{$callback}\""); return; } // validate topic $globalTopics = array(Publisher::TOPIC_QUOTA, Publisher::TOPIC_FS_CHANGE); if (!in_array($topic, $globalTopics)) { $this->respondError(400, "Invalid hub.topic: \"{$topic}\""); return; } if ($mode === 'subscribe') { if (!$this->subscriptions->alreadySubscribed($callback, $topic)) { $this->subscriptions->add($callback, $topic); } } else { $this->subscriptions->delete($callback, $topic); } $this->respond(204, null); }
namespace OCA\CalendarPlus\AppInfo; $app = new Application(); $c = $app->getContainer(); $appName = (string) $c->getAppName(); // add an navigation entry $navigationEntry = function () use($c) { return ['id' => $c->getAppName(), 'order' => 1, 'name' => $c->query('L10N')->t('Calendar+'), 'href' => $c->query('URLGenerator')->linkToRoute($c->getAppName() . '.page.index'), 'icon' => $c->query('URLGenerator')->imagePath($c->getAppName(), 'calendar.svg')]; }; $c->getServer()->getNavigationManager()->add($navigationEntry); //upcoming version search for 8.2 perhaps patch https://github.com/owncloud/core/pull/17339/files //\OC::$server->getSearch()->registerProvider('OCA\CalendarPlus\Search\Provider', array('app' =>$appName,'apps' =>array('tasksplus'))); \OC::$server->getSearch()->registerProvider('OCA\\CalendarPlus\\Search\\Provider', array('app' => $appName)); if (\OC::$server->getAppManager()->isEnabledForUser('activity')) { \OC::$server->getActivityManager()->registerExtension(function () { return new \OCA\CalendarPlus\Activity(); }); } \OCA\CalendarPlus\Hooks::register(); \OCP\Util::addScript($appName, 'alarm'); if (\OCP\User::isLoggedIn() && !\OCP\App::isEnabled('calendar')) { $request = $c->query('Request'); if (isset($request->server['REQUEST_URI'])) { $url = $request->server['REQUEST_URI']; if (preg_match('%index.php/apps/files(/.*)?%', $url) || preg_match('%index.php/s/(/.*)?%', $url)) { \OCP\Util::addScript($appName, 'loaderimport'); \OCP\Util::addStyle($appName, '3rdparty/colorPicker'); \OCP\Util::addscript($appName, '3rdparty/jquery.colorPicker'); } } }
/** * Checks if the current user is logged in * @return bool true if logged in */ public function isLoggedIn() { return \OCP\User::isLoggedIn(); }
public static function setup($options) { if (!\OCP\User::isLoggedIn() || \OCP\User::getUser() != $options['user'] || \OCP\Share::getItemsSharedWith('file')) { $user_dir = $options['user_dir']; \OC\Files\Filesystem::mount('\\OC\\Files\\Storage\\Shared', array('sharedFolder' => '/Shared'), $user_dir . '/Shared/'); } }
<?php /** * ownCloud - firstrunwizard App * * @author Frank Karlitschek * @copyright 2012 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/>. * */ OC::$CLASSPATH['OCA_FirstRunWizard\\Config'] = 'firstrunwizard/lib/firstrunwizard.php'; OCP\Util::addStyle('firstrunwizard', 'colorbox'); OCP\Util::addScript('firstrunwizard', 'jquery.colorbox'); OCP\Util::addScript('firstrunwizard', 'firstrunwizard'); OCP\Util::addStyle('firstrunwizard', 'firstrunwizard'); if (\OCP\User::isLoggedIn() and \OCA_FirstRunWizard\Config::isenabled()) { OCP\Util::addScript('firstrunwizard', 'activate'); }
protected function getSharingOps() { $where = 'AND `file_source`=?'; $values = array($this->fileId); if (\OCP\User::isLoggedIn()) { $where .= ' AND ((`share_type`=' . \OCP\Share::SHARE_TYPE_USER . ' AND `share_with`=?) OR `share_type`=' . \OCP\Share::SHARE_TYPE_LINK . ')'; $values[] = \OCP\User::getUser(); } else { $where .= ' AND (`share_type`=' . \OCP\Share::SHARE_TYPE_LINK . ')'; } $query = \OC_DB::prepare('SELECT `*PREFIX*share`.`id`, `item_type`, `*PREFIX*share`.`parent`, `uid_owner`, ' . '`share_type`, `share_with`, `file_source`, `path`, `file_target`, ' . '`*PREFIX*share`.`permissions`, `expiration`, `storage`, `*PREFIX*filecache`.`parent` as `file_parent`, ' . '`name`, `mtime`, `mimetype`, `mimepart`, `size`, `encrypted`, `etag`' . 'FROM `*PREFIX*share` INNER JOIN `*PREFIX*filecache` ON `file_source` = `*PREFIX*filecache`.`fileid` WHERE `item_type` = \'file\' ' . $where); $result = $query->execute($values); $shares = $result->fetchAll(); $origins = array(); if (is_array($shares)) { foreach ($shares as $share) { $origin = \OCP\Share::resolveReShare($share); if (!isset($origin['path']) && isset($origin['file_target'])) { $origin['path'] = 'files/' . $origin['file_target']; } $origins[] = $origin; } } return $origins; }
<?php use OCP\DB; use OCP\User; use OCP\Util; // coming directly to vote (link) if (isset($_GET) && isset($_GET['poll_id'])) { // check if poll is public / user registered $query = DB::prepare('select access from *PREFIX*polls_events where id=?'); $result = $query->execute(array($_GET['poll_id'])); $row = $result->fetchRow(); $access = $row['access']; // if !public and !loggedIn go to login page if (strcmp($access, 'public') && !OCP\User::isLoggedIn()) { OCP\User::checkLoggedIn(); } // check if user has access to this poll if (!userHasAccess($_GET['poll_id'])) { include 'error_no_poll.php'; return; } unset($_POST); $_POST['j'] = "vote"; $_POST['poll_id'] = $_GET['poll_id']; unset($_GET); } if (isset($_POST) && isset($_POST['j'])) { //echo '<pre>POST: '; print_r($_POST); echo '</pre>'; $post_j = $_POST['j']; // vote: build vote page; finish: save "vote" - both available w/o login if ($post_j !== 'vote' && $post_j !== 'finish') {
function userHasAccess($poll_id) { $query = DB::prepare('select * from *PREFIX*polls_events where id=?'); $result = $query->execute(array($poll_id)); $row = $result->fetchRow(); if ($row) { $access = $row['access']; $owner = $row['owner']; } else { return false; } if ($access === 'public') { return true; } if ($access === 'hidden') { return true; } if (!User::isLoggedIn()) { return false; } if ($access === 'registered') { return true; } if ($owner === User::getUser()) { return true; } $user_groups = OC_Group::getUserGroups(User::getUser()); $arr = explode(';', $access); foreach ($arr as $item) { if (strpos($item, 'group_') === 0) { $grp = substr($item, 6); foreach ($user_groups as $user_group) { if ($user_group === $grp) { return true; } } } else { if (strpos($item, 'user_') === 0) { $usr = substr($item, 5); if ($usr === User::getUser()) { return true; } } } } return false; }
public static function setup($options) { $shares = \OCP\Share::getItemsSharedWith('file'); $manager = Filesystem::getMountManager(); $loader = Filesystem::getLoader(); if (!\OCP\User::isLoggedIn() || \OCP\User::getUser() != $options['user'] || $shares) { foreach ($shares as $share) { // don't mount shares where we have no permissions if ($share['permissions'] > 0) { $mount = new SharedMount('\\OC\\Files\\Storage\\Shared', $options['user_dir'] . '/' . $share['file_target'], array('share' => $share), $loader); $manager->addMount($mount); } } } }
/** * @PublicPage * @NoCSRFRequired * @UseSession */ public function getReminderEvents() { $EvSource = $this->params('EvSource'); $ALARMDATA = new Alarm(); $resultRefresh = ''; if (isset($EvSource) && $EvSource !== '') { $ALARMDATA->setEventSources($EvSource); $resultRefresh = $ALARMDATA->checkAutoRefresh(); if ($resultRefresh === false) { $resultRefresh = 'onlyTimeLine'; } } else { $resultRefresh = 'onlyTimeLine'; } $result = ''; if (\OCP\User::isLoggedIn()) { $ALARMDATA->checkAlarm(); $result = $ALARMDATA->getAlarms(); } if (count($result) > 0 || $resultRefresh !== '') { $params = ['data' => $result, 'refresh' => $resultRefresh]; $response = new JSONResponse(); $response->setData($params); return $response; } }
* 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 \OC_User::setUserId(array_shift($users)); $forceUserLogout = true;
<?php /** * ownCloud - User Set Password * * @author Patrick Paysant <*****@*****.**> * @copyright 2015 CNRS DSI * @license This file is licensed under the Affero General Public License version 3 or later. See the COPYING file. */ namespace OCA\User_Set_Password; use OCA\User_Set_Password\App\User_Set_Password; use OCA\User_Set_Password\Lib\Helper; $app = new User_Set_Password(); $c = $app->getContainer(); /** * Load js and css */ \OCP\Util::addStyle($c->query('AppName'), 'colorbox'); \OCP\Util::addScript($c->query('AppName'), 'jquery.colorbox'); \OCP\Util::addscript($c->query('AppName'), 'setpassword'); \OCP\Util::addStyle($c->query('AppName'), 'setpassword'); if (\OCP\User::isLoggedIn() and Helper::isEnabled()) { \OC_Util::addScript('3rdparty', 'strengthify/jquery.strengthify'); \OC_Util::addStyle('3rdparty', 'strengthify/strengthify'); \OC_Util::addScript('3rdparty', 'chosen/chosen.jquery.min'); \OC_Util::addStyle('3rdparty', 'chosen/chosen'); \OCP\Util::addScript($c->query('AppName'), 'activate'); }