示例#1
0
 /**
  * @brief Gets the VCard as an OC_VObject
  * @returns The card or null if the card could not be parsed.
  */
 public static function getContactVCard($id)
 {
     $card = self::getContactObject($id);
     $vcard = OC_VObject::parse($card['carddata']);
     // Try to fix cards with missing 'N' field from pre ownCloud 4. Hot damn, this is ugly...
     if (!is_null($vcard) && !$vcard->__isset('N')) {
         $version = OCP\App::getAppVersion('contacts');
         if ($version >= 5) {
             OCP\Util::writeLog('contacts', 'OC_Contacts_App::getContactVCard. Deprecated check for missing N field', OCP\Util::DEBUG);
         }
         OCP\Util::writeLog('contacts', 'getContactVCard, Missing N field', OCP\Util::DEBUG);
         if ($vcard->__isset('FN')) {
             OCP\Util::writeLog('contacts', 'getContactVCard, found FN field: ' . $vcard->__get('FN'), OCP\Util::DEBUG);
             $n = implode(';', array_reverse(array_slice(explode(' ', $vcard->__get('FN')), 0, 2))) . ';;;';
             $vcard->setString('N', $n);
             OC_Contacts_VCard::edit($id, $vcard);
         } else {
             // Else just add an empty 'N' field :-P
             $vcard->setString('N', 'Unknown;Name;;;');
         }
     }
     if (!is_null($vcard) && !isset($vcard->REV)) {
         $rev = new DateTime('@' . $card['lastmodified']);
         $vcard->setString('REV', $rev->format(DateTime::W3C));
     }
     return $vcard;
 }
示例#2
0
 /**
  * @brief exports an event and convert all times to UTC
  * @param integer $id id of the event
  * @return string
  */
 private static function event($id)
 {
     $event = OC_Calendar_Object::find($id);
     $return = "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:ownCloud Calendar " . OCP\App::getAppVersion('calendar') . "\nX-WR-CALNAME:" . $event['summary'] . "\n";
     $return .= self::generateEvent($event);
     $return .= "END:VCALENDAR";
     return $return;
 }
示例#3
0
 function search($query)
 {
     $calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser(), true);
     if (count($calendars) == 0 || !OCP\App::isEnabled('calendar')) {
         //return false;
     }
     $results = array();
     $searchquery = array();
     if (substr_count($query, ' ') > 0) {
         $searchquery = explode(' ', $query);
     } else {
         $searchquery[] = $query;
     }
     $user_timezone = OC_Calendar_App::getTimezone();
     $l = new OC_l10n('calendar');
     foreach ($calendars as $calendar) {
         $objects = OC_Calendar_Object::all($calendar['id']);
         foreach ($objects as $object) {
             if ($object['objecttype'] != 'VEVENT') {
                 continue;
             }
             if (substr_count(strtolower($object['summary']), strtolower($query)) > 0) {
                 $calendardata = OC_VObject::parse($object['calendardata']);
                 $vevent = $calendardata->VEVENT;
                 $dtstart = $vevent->DTSTART;
                 $dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
                 $start_dt = $dtstart->getDateTime();
                 $start_dt->setTimezone(new DateTimeZone($user_timezone));
                 $end_dt = $dtend->getDateTime();
                 $end_dt->setTimezone(new DateTimeZone($user_timezone));
                 if ($dtstart->getDateType() == Sabre\VObject\Property\DateTime::DATE) {
                     $end_dt->modify('-1 sec');
                     if ($start_dt->format('d.m.Y') != $end_dt->format('d.m.Y')) {
                         $info = $l->t('Date') . ': ' . $start_dt->format('d.m.Y') . ' - ' . $end_dt->format('d.m.Y');
                     } else {
                         $info = $l->t('Date') . ': ' . $start_dt->format('d.m.Y');
                     }
                 } else {
                     $info = $l->t('Date') . ': ' . $start_dt->format('d.m.y H:i') . ' - ' . $end_dt->format('d.m.y H:i');
                 }
                 $link = OCP\Util::linkTo('calendar', 'index.php') . '?showevent=' . urlencode($object['id']);
                 $results[] = new OC_Search_Result($object['summary'], $info, $link, (string) $l->t('Cal.'));
                 //$name,$text,$link,$type
             }
         }
     }
     return $results;
 }
示例#4
0
 function search($query)
 {
     if (!OCP\App::isEnabled('news')) {
         return array();
     }
     $feedMapper = new OCA\News\FeedMapper(OCP\USER::getUser());
     $results = array();
     if ($feedMapper->feedCount() > 0) {
         $allFeeds = $feedMapper->findAll();
         $l = new OC_l10n('news');
         foreach ($allFeeds as $feed) {
             if (substr_count(strtolower($feed['title']), strtolower($query)) > 0) {
                 $link = OCP\Util::linkTo('news', 'index.php') . '?feedid=' . urlencode($feed['id']);
                 $results[] = new OC_Search_Result($feed['title'], '', $link, (string) $l->t('News'));
             }
         }
     }
     return $results;
 }
示例#5
0
 function search($query)
 {
     $addressbooks = OC_Contacts_Addressbook::all(OCP\USER::getUser(), 1);
     if (count($addressbooks) == 0 || !OCP\App::isEnabled('contacts')) {
         return array();
     }
     $results = array();
     $l = new OC_l10n('contacts');
     foreach ($addressbooks as $addressbook) {
         $vcards = OC_Contacts_VCard::all($addressbook['id']);
         foreach ($vcards as $vcard) {
             if (substr_count(strtolower($vcard['fullname']), strtolower($query)) > 0) {
                 $link = OCP\Util::linkTo('contacts', 'index.php') . '&id=' . urlencode($vcard['id']);
                 $results[] = new OC_Search_Result($vcard['fullname'], '', $link, (string) $l->t('Contact'));
                 //$name,$text,$link,$type
             }
         }
     }
     return $results;
 }
示例#6
0
 /**
  * @brief Adds a card
  * @param integer $aid Addressbook id
  * @param OC_VObject $card  vCard file
  * @param string $uri the uri of the card, default based on the UID
  * @return insertid on success or null if no card.
  */
 public static function add($aid, OC_VObject $card, $uri = null, $isnew = false)
 {
     if (is_null($card)) {
         OCP\Util::writeLog('contacts', 'OC_Contacts_VCard::add. No vCard supplied', OCP\Util::ERROR);
         return null;
     }
     if (!$isnew) {
         OC_Contacts_App::loadCategoriesFromVCard($card);
         self::updateValuesFromAdd($aid, $card);
     }
     $card->setString('VERSION', '3.0');
     // Add product ID is missing.
     $prodid = trim($card->getAsString('PRODID'));
     if (!$prodid) {
         $appinfo = OCP\App::getAppInfo('contacts');
         $appversion = OCP\App::getAppVersion('contacts');
         $prodid = '-//ownCloud//NONSGML ' . $appinfo['name'] . ' ' . $appversion . '//EN';
         $card->setString('PRODID', $prodid);
     }
     $fn = $card->getAsString('FN');
     if (empty($fn)) {
         $fn = '';
     }
     if (!$uri) {
         $uid = $card->getAsString('UID');
         $uri = $uid . '.vcf';
     }
     $data = $card->serialize();
     $stmt = OCP\DB::prepare('INSERT INTO *PREFIX*contacts_cards (addressbookid,fullname,carddata,uri,lastmodified) VALUES(?,?,?,?,?)');
     $result = $stmt->execute(array($aid, $fn, $data, $uri, time()));
     $newid = OCP\DB::insertid('*PREFIX*contacts_cards');
     OC_Contacts_Addressbook::touch($aid);
     return $newid;
 }
示例#7
0
<?php

OC::$CLASSPATH['OCA\\Mail\\App'] = 'apps/mail/lib/mail.php';
OC::$CLASSPATH['OCA\\Mail\\Account'] = 'apps/mail/lib/account.php';
OC::$CLASSPATH['OCA\\Mail\\Mailbox'] = 'apps/mail/lib/mailbox.php';
OC::$CLASSPATH['OCA\\Mail\\Message'] = 'apps/mail/lib/message.php';
OC::$CLASSPATH['OC_Translation_Handler'] = 'apps/mail/lib/OC_Translation_Handler.php';
OCP\App::addNavigationEntry(array('id' => 'mail_index', 'order' => 1, 'href' => OCP\Util::linkTo('mail', 'index.php'), 'icon' => OCP\Util::imagePath('mail', 'icon.png'), 'name' => 'Mail'));
OCP\App::registerPersonal('mail', 'settings');
示例#8
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/>.
* 
*/
/*
### CONFIG ###
----------------------------------------------------- */
/* Allow that users can delete own posts, admin can delete all */
define('USER_CONVERSATIONS_CAN_DELETE', true);
/* Allow messages to a single user */
define('UC_SINGLE_USER_MSG', true);
/* FILE ATACHMENTS 
This is a beta feature with some known bugs. It could changed in a future release without backward compatibility! */
define('USER_CONVERSATIONS_ATTACHMENTS', true);
/* end of configration ------------------------------ */
// register model-file
OC::$CLASSPATH['OC_Conversations'] = 'conversations/lib/conversations.php';
// add update script to change the app-icon even when app is not active, TODO: find app-not-active function...!
OCP\Util::addscript('conversations', 'updateCheck');
// register HOOK change user group
OC_HOOK::connect('OC_User', 'post_addToGroup', 'OC_Conversations', 'changeUserGroup');
OC_HOOK::connect('OC_User', 'post_removeFromGroup', 'OC_Conversations', 'changeUserGroup');
$l = OC_L10N::get('conversations');
OCP\App::addNavigationEntry(array('id' => 'conversations', 'order' => 5, 'href' => OCP\Util::linkTo('conversations', 'index.php'), 'icon' => OCP\Util::imagePath('conversations', 'conversations.png'), 'name' => $l->t('Conversation')));
示例#9
0
文件: index.php 项目: noldmess/apps
<?php

/**
* ownCloud - eBook reader application
*
* @author Priyanka Menghani
* 
*/
OCP\User::checkLoggedIn();
OCP\App::checkAppEnabled('reader');
OCP\App::setActiveNavigationEntry('reader_index');
OCP\Util::addscript('reader', 'integrate');
OCP\Util::addscript('reader', 'pdf');
OCP\Util::addStyle('reader', 'reader');
// Get the current directory from window url.
$dir = empty($_GET['dir']) ? '/' : $_GET['dir'];
$tmpl = new OCP\Template('reader', 'index', 'user');
$tmpl->assign('dir', $dir);
$tmpl->printPage();
示例#10
0
* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
*
*/
OCP\User::checkAdminUser();
$htaccessWorking = getenv('htaccessWorking') == 'true';
$upload_max_filesize = OCP\Util::computerFileSize(ini_get('upload_max_filesize'));
$post_max_size = OCP\Util::computerFileSize(ini_get('post_max_size'));
$maxUploadFilesize = OCP\Util::humanFileSize(min($upload_max_filesize, $post_max_size));
if ($_POST && OC_Util::isCallRegistered()) {
    if (isset($_POST['maxUploadSize'])) {
        if (($setMaxSize = OC_Files::setUploadLimit(OCP\Util::computerFileSize($_POST['maxUploadSize']))) !== false) {
            $maxUploadFilesize = OCP\Util::humanFileSize($setMaxSize);
        }
    }
}
OCP\App::setActiveNavigationEntry("files_administration");
$htaccessWritable = is_writable(OC::$SERVERROOT . '/.htaccess');
$tmpl = new OCP\Template('files', 'admin');
/* 
* extended version
* + only users with permission can delete files(in the files app only)
* + file type restriction
*/
$filetyprestriction = \OC_Appconfig::getValue('core', 'filetyperes_enabled', 'no');
$allowed_types = \OC_Appconfig::getValue('core', 'allowed_filetypes', '');
$deleteGroupsList = \OC_Appconfig::getValue('core', 'delete', '');
$deleteGroupsList = explode(',', $deleteGroupsList);
$tmpl->assign('deleteGroupsList', implode('|', $deleteGroupsList));
$tmpl->assign('fileTypeRes', $filetyprestriction);
$tmpl->assign('allowed_filetypes', $allowed_types);
$tmpl->assign('uploadChangable', $htaccessWorking and $htaccessWritable);
示例#11
0
 private static function update_groups($uid, $groups, $protectedGroups = array(), $just_created = false)
 {
     if (!$just_created) {
         $old_groups = OC_Group::getUserGroups($uid);
         foreach ($old_groups as $group) {
             if (!in_array($group, $protectedGroups) && !in_array($group, $groups)) {
                 // This does not affect groups from user_group_admin
                 OC_Group::removeFromGroup($uid, $group);
                 OC_Log::write('saml', 'Removed "' . $uid . '" from the group "' . $group . '"', OC_Log::DEBUG);
             }
         }
     }
     foreach ($groups as $group) {
         if (preg_match('/[^a-zA-Z0-9 _\\.@\\-\\/]/', $group)) {
             OC_Log::write('saml', 'Invalid group "' . $group . '", allowed chars "a-zA-Z0-9" and "_.@-/" ', OC_Log::DEBUG);
         } else {
             if (!OC_Group::inGroup($uid, $group)) {
                 if (!OC_Group::groupExists($group)) {
                     if (OCP\App::isEnabled('user_group_admin')) {
                         OC_User_Group_Admin_Util::createHiddenGroup($group);
                     } else {
                         OC_Group::createGroup($group);
                     }
                     OC_Log::write('saml', 'New group created: ' . $group, OC_Log::DEBUG);
                 }
                 if (OCP\App::isEnabled('user_group_admin')) {
                     OC_User_Group_Admin_Util::addToGroup($uid, $group);
                 } else {
                     OC_Group::addToGroup($uid, $group);
                 }
                 OC_Log::write('saml', 'Added "' . $uid . '" to the group "' . $group . '"', OC_Log::DEBUG);
             }
         }
     }
 }
示例#12
0
文件: app.php 项目: anolisti/apps
* 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/>.
*
*/
if (OCP\App::isEnabled('user_saml')) {
    $ocVersion = implode('.', OCP\Util::getVersion());
    if (version_compare($ocVersion, '5.0', '<')) {
        if (!function_exists('p')) {
            function p($string)
            {
                print OC_Util::sanitizeHTML($string);
            }
        }
    }
    require_once 'user_saml/user_saml.php';
    OCP\App::registerAdmin('user_saml', 'settings');
    // register user backend
    OC_User::useBackend('SAML');
    OC::$CLASSPATH['OC_USER_SAML_Hooks'] = 'user_saml/lib/hooks.php';
    OCP\Util::connectHook('OC_User', 'post_login', 'OC_USER_SAML_Hooks', 'post_login');
    OCP\Util::connectHook('OC_User', 'logout', 'OC_USER_SAML_Hooks', 'logout');
    $forceLogin = OCP\Config::getAppValue('user_saml', 'saml_force_saml_login', false);
    if (isset($_GET['app']) && $_GET['app'] == 'user_saml' || !OCP\User::isLoggedIn() && $forceLogin && !isset($_GET['admin_login'])) {
        require_once 'user_saml/auth.php';
        if (!OC_User::login('', '')) {
            $error = true;
            OC_Log::write('saml', 'Error trying to authenticate the user', OC_Log::DEBUG);
        }
        if (isset($_GET["linktoapp"])) {
            $path = OC::$WEBROOT . '/?app=' . $_GET["linktoapp"];
            if (isset($_GET["linktoargs"])) {
示例#13
0
文件: index.php 项目: rosarion/core
OCP\Util::addscript('files', 'jquery-visibility');
OCP\Util::addscript('files', 'fileinfomodel');
OCP\Util::addscript('files', 'filesummary');
OCP\Util::addscript('files', 'breadcrumb');
OCP\Util::addscript('files', 'filelist');
OCP\Util::addscript('files', 'search');
\OCP\Util::addScript('files', 'favoritesfilelist');
\OCP\Util::addScript('files', 'tagsplugin');
\OCP\Util::addScript('files', 'favoritesplugin');
\OCP\Util::addScript('files', 'detailfileinfoview');
\OCP\Util::addScript('files', 'detailtabview');
\OCP\Util::addScript('files', 'mainfileinfodetailview');
\OCP\Util::addScript('files', 'detailsview');
\OCP\Util::addStyle('files', 'detailsView');
\OC_Util::addVendorScript('core', 'handlebars/handlebars');
OCP\App::setActiveNavigationEntry('files_index');
$l = \OC::$server->getL10N('files');
$isIE8 = false;
preg_match('/MSIE (.*?);/', $_SERVER['HTTP_USER_AGENT'], $matches);
if (count($matches) > 0 && $matches[1] <= 9) {
    $isIE8 = true;
}
// if IE8 and "?dir=path&view=someview" was specified, reformat the URL to use a hash like "#?dir=path&view=someview"
if ($isIE8 && (isset($_GET['dir']) || isset($_GET['view']))) {
    $hash = '#?';
    $dir = isset($_GET['dir']) ? $_GET['dir'] : '/';
    $view = isset($_GET['view']) ? $_GET['view'] : 'files';
    $hash = '#?dir=' . \OCP\Util::encodePath($dir);
    if ($view !== 'files') {
        $hash .= '&view=' . urlencode($view);
    }
示例#14
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/>.
 *
 */
// Check if we are a user
OCP\User::checkLoggedIn();
OCP\App::checkAppEnabled('roundcube');
OCP\Util::addStyle('roundcube', 'userSettings');
OCP\Util::addScript('roundcube', 'userSettings');
// fill template
$params = array();
$tmpl = new OCP\Template('roundcube', 'userSettings');
foreach ($params as $param) {
    $value = OCP\Config::getAppValue('roundcube', $param, '');
    $tmpl->assign($param, $value);
}
// workaround to detect OC version
$ocVersion = @reset(OCP\Util::getVersion());
$tmpl->assign('ocVersion', $ocVersion);
return $tmpl->fetchPage();
示例#15
0
//check if curl extension installed
if (!in_array('curl', get_loaded_extensions())) {
    return;
}
$userName = '';
if (strpos($_SERVER["REQUEST_URI"], '?') and !strpos($_SERVER["REQUEST_URI"], '=')) {
    if (strpos($_SERVER["REQUEST_URI"], '/?')) {
        $userName = substr($_SERVER["REQUEST_URI"], strpos($_SERVER["REQUEST_URI"], '/?') + 2);
    } elseif (strpos($_SERVER["REQUEST_URI"], '.php?')) {
        $userName = substr($_SERVER["REQUEST_URI"], strpos($_SERVER["REQUEST_URI"], '.php?') + 5);
    }
}
OCP\Util::addHeader('link', array('rel' => 'openid.server', 'href' => OCP\Util::linkToAbsolute("user_openid", "user.php") . '/' . $userName));
OCP\Util::addHeader('link', array('rel' => 'openid.delegate', 'href' => OCP\Util::linkToAbsolute("user_openid", "user.php") . '/' . $userName));
OCP\App::registerPersonal('user_openid', 'settings');
require_once 'apps/user_openid/user_openid.php';
//active the openid backend
OC_User::useBackend('openid');
//check for results from openid requests
if (isset($_GET['openid_mode']) and $_GET['openid_mode'] == 'id_res') {
    OCP\Util::writeLog('user_openid', 'openid retured', OCP\Util::DEBUG);
    $openid = new SimpleOpenID();
    $openid->SetIdentity($_GET['openid_identity']);
    $openid_validation_result = $openid->ValidateWithServer();
    if ($openid_validation_result == true) {
        // OK HERE KEY IS VALID
        OCP\Util::writeLog('user_openid', 'auth sucessfull', OCP\Util::DEBUG);
        $identity = $openid->GetIdentity();
        OCP\Util::writeLog('user_openid', 'auth as ' . $identity, OCP\Util::DEBUG);
        $user = OC_USER_OPENID::findUserForIdentity($identity);
示例#16
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
*
*/
OC::$CLASSPATH['OCA\\News\\StatusFlag'] = 'apps/news/lib/item.php';
OC::$CLASSPATH['OCA\\News\\Item'] = 'apps/news/lib/item.php';
OC::$CLASSPATH['OCA\\News\\Collection'] = 'apps/news/lib/collection.php';
OC::$CLASSPATH['OCA\\News\\Feed'] = 'apps/news/lib/feed.php';
OC::$CLASSPATH['OCA\\News\\Folder'] = 'apps/news/lib/folder.php';
OC::$CLASSPATH['OCA\\News\\FeedType'] = 'apps/news/lib/feedtypes.php';
OC::$CLASSPATH['OCA\\News\\FeedMapper'] = 'apps/news/lib/feedmapper.php';
OC::$CLASSPATH['OCA\\News\\ItemMapper'] = 'apps/news/lib/itemmapper.php';
OC::$CLASSPATH['OCA\\News\\FolderMapper'] = 'apps/news/lib/foldermapper.php';
OC::$CLASSPATH['OCA\\News\\Utils'] = 'apps/news/lib/utils.php';
OC::$CLASSPATH['OC_Search_Provider_News'] = 'apps/news/lib/search.php';
OC::$CLASSPATH['OCA\\News\\Backgroundjob'] = 'apps/news/lib/backgroundjob.php';
OCP\Backgroundjob::addRegularTask('OCA\\News\\Backgroundjob', 'run');
OC::$CLASSPATH['OCA\\News\\Share_Backend_News_Item'] = 'apps/news/lib/share/item.php';
OCP\App::addNavigationEntry(array('id' => 'news', 'order' => 74, 'href' => OC_Helper::linkTo('news', 'index.php'), 'icon' => OC_Helper::imagePath('news', 'icon.svg'), 'name' => OC_L10N::get('news')->t('News')));
OC_Search::registerProvider('OC_Search_Provider_News');
OCP\Share::registerBackend('news_item', 'OCA\\News\\Share_Backend_News_Item');
示例#17
0
<?php

/**
 * ownCloud - RainLoop mail plugin
 *
 * @author RainLoop Team
 * @copyright 2015 RainLoop Team
 *
 * https://github.com/RainLoop/owncloud
 */
OC::$CLASSPATH['OC_RainLoop_Helper'] = OC_App::getAppPath('rainloop') . '/lib/RainLoopHelper.php';
OCP\App::registerAdmin('rainloop', 'admin');
OCP\App::registerPersonal('rainloop', 'personal');
if (OCP\Config::getAppValue('rainloop', 'rainloop-autologin', false)) {
    OCP\Util::connectHook('OC_User', 'post_login', 'OC_RainLoop_Helper', 'login');
    OCP\Util::connectHook('OC_User', 'post_setPassword', 'OC_RainLoop_Helper', 'changePassword');
}
OCP\Util::connectHook('OC_User', 'logout', 'OC_RainLoop_Helper', 'logout');
OCP\Util::addScript('rainloop', 'rainloop');
OCP\App::addNavigationEntry(array('id' => 'rainloop_index', 'order' => 10, 'href' => OCP\Util::linkToRoute('rainloop_index'), 'icon' => OCP\Util::imagePath('rainloop', 'mail.png'), 'name' => 'Email'));
示例#18
0
文件: app.php 项目: noldmess/apps
<?php

/**
* ownCloud - facefinder
*
* @author Aaron Messner
* @copyright 2012 Aaron Messner aaron.messner@stuudent.uibk.ac.at
*
* 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\Share::registerBackend('photo', new OC_Share_Backend_Photo());
//$l = OC_L10N::get('gallery');
OCP\App::addNavigationEntry(array('id' => 'facefinder', 'order' => 20, 'href' => OCP\Util::linkTo('facefinder', 'index.php'), 'icon' => OCP\Util::imagePath('core', 'places/picture.svg'), 'name' => "FaceFinder"));
示例#19
0
<?php

require_once __DIR__ . '/bootstrap.php';
OCP\App::addNavigationEntry(array('id' => 'contacts_index', 'order' => 10, 'href' => OCP\Util::linkTo('contacts', 'index.php'), 'icon' => OCP\Util::imagePath('contacts', 'contacts.svg'), 'name' => OC_L10N::get('contacts')->t('Contacts')));
OCP\Util::addscript('contacts', 'loader');
OC_Search::registerProvider('OCA\\Contacts\\SearchProvider');
if (OCP\User::isLoggedIn()) {
    foreach (OCA\Contacts\Addressbook::all(OCP\USER::getUser()) as $addressbook) {
        OCP\Contacts::registerAddressBook(new OCA\Contacts\AddressbookProvider($addressbook['id']));
    }
}
示例#20
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 Affero General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
OCP\User::checkAdminUser();
OCP\App::checkAppEnabled('admin_migrate');
// Export?
if (isset($_POST['admin_export'])) {
    // Create the export zip
    $response = json_decode(OC_Migrate::export(null, $_POST['export_type']));
    if (!$response->success) {
        // Error
        die('error');
    } else {
        $path = $response->data;
        // Download it
        header("Content-Type: application/zip");
        header("Content-Disposition: attachment; filename=" . basename($path));
        header("Content-Length: " . filesize($path));
        @ob_end_clean();
        readfile($path);
示例#21
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/>.
 *
 */
require_once 'lib/external.php';
OCP\User::checkLoggedIn();
if (isset($_GET['id'])) {
    $id = $_GET['id'];
    $id = (int) $id;
    $sites = OC_External::getSites();
    if (sizeof($sites) >= $id) {
        $url = $sites[$id - 1][1];
        OCP\App::setActiveNavigationEntry('external_index' . $id);
        $tmpl = new OCP\Template('external', 'frame', 'user');
        //overwrite x-frame-options
        $tmpl->addHeader('X-Frame-Options', 'ALLOW-FROM *');
        $tmpl->assign('url', $url);
        $tmpl->printPage();
    }
}
示例#22
0
<?php

/**
 * Copyright (c) 2012 Georg Ehrke <*****@*****.**>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */
$data = $_POST['data'];
$data = explode(',', $data);
$data = end($data);
$data = base64_decode($data);
OCP\JSON::checkLoggedIn();
OCP\App::checkAppEnabled('calendar');
$import = new OC_Calendar_Import($data);
$import->setUserID(OCP\User::getUser());
$import->setTimeZone(OC_Calendar_App::$tz);
$import->disableProgressCache();
if (!$import->isValid()) {
    OCP\JSON::error();
    exit;
}
$newcalendarname = strip_tags($import->createCalendarName());
$newid = OC_Calendar_Calendar::addCalendar(OCP\User::getUser(), $newcalendarname, 'VEVENT,VTODO,VJOURNAL', null, 0, $import->createCalendarColor());
$import->setCalendarID($newid);
$import->import();
$count = $import->getCount();
if ($count == 0) {
    OC_Calendar_Calendar::deleteCalendar($newid);
    OCP\JSON::error(array('message' => OC_Calendar_App::$l10n->t('The file contained either no events or all events are already saved in your calendar.')));
} else {
示例#23
0
<?php

/**
 * Copyright (c) 2014 - Arno van Rossum <*****@*****.**>
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
OCP\App::checkAppEnabled('ocusagecharts');
OCP\App::setActiveNavigationEntry('ocusagecharts');
OCP\App::addNavigationEntry(array('id' => 'ocusagecharts', 'order' => 60, 'href' => \OCP\Util::linkToRoute('ocusagecharts.chart.frontpage'), 'icon' => OCP\Util::imagePath('ocusagecharts', 'iconchart.png'), 'name' => \OC_L10N::get('ocusagecharts')->t('ocUsageCharts')));
\OCP\Util::addStyle('ocusagecharts', 'style');
\OCP\Backgroundjob::registerJob('OCA\\ocUsageCharts\\Command\\UpdateChartsCommand');
示例#24
0
<?php

/**
 * 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/>.
 * 
 */
OCP\Util::addStyle('impressionist', 'style');
// Basic layout of the page.
OCP\App::addNavigationEntry(array('id' => 'impressionist_index', 'order' => 74, 'href' => OCP\Util::linkTo('impressionist', 'index.php'), 'icon' => OCP\Util::imagePath('impressionist', 'impress.png'), 'name' => 'Impressionist'));
示例#25
0
<?php

/**
 * Copyright (c) 2011-2012 Thomas Tanghus <*****@*****.**>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */
OCP\User::checkLoggedIn();
OCP\App::checkAppEnabled('contacts');
$bookid = isset($_GET['bookid']) ? $_GET['bookid'] : null;
$contactid = isset($_GET['contactid']) ? $_GET['contactid'] : null;
$selectedids = isset($_GET['selectedids']) ? $_GET['selectedids'] : null;
$nl = "\n";
if (!is_null($bookid)) {
    try {
        $addressbook = OCA\Contacts\Addressbook::find($bookid);
    } catch (Exception $e) {
        OCP\JSON::error(array('data' => array('message' => $e->getMessage())));
        exit;
    }
    header('Content-Type: text/directory');
    header('Content-Disposition: inline; filename=' . str_replace(' ', '_', $addressbook['displayname']) . '.vcf');
    $start = 0;
    $batchsize = OCP\Config::getUserValue(OCP\User::getUser(), 'contacts', 'export_batch_size', 20);
    while ($cardobjects = OCA\Contacts\VCard::all($bookid, $start, $batchsize, array('carddata'))) {
        foreach ($cardobjects as $card) {
            echo $card['carddata'] . $nl;
        }
        $start += $batchsize;
    }
示例#26
0
<?php

/**
 * Copyright (c) 2012 Robin Appelman <*****@*****.**>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */
OCP\User::checkLoggedIn();
OCP\App::checkAppEnabled('gallery');
OCP\App::setActiveNavigationEntry('gallery_index');
OCP\Util::addScript('gallery', 'gallery');
OCP\Util::addScript('gallery', 'thumbnail');
OCP\Util::addStyle('gallery', 'styles');
$tmpl = new OCP\Template('gallery', 'index', 'user');
$tmpl->printPage();
示例#27
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/>.
* 
*/
// Check if we are a user
OCP\User::checkLoggedIn();
OCP\App::checkAppEnabled('media');
require_once OC::$APPSROOT . '/apps/media/lib_collection.php';
require_once OC::$APPSROOT . '/apps/media/lib_scanner.php';
OCP\Util::addscript('media', 'player');
OCP\Util::addscript('media', 'music');
OCP\Util::addscript('media', 'playlist');
OCP\Util::addscript('media', 'collection');
OCP\Util::addscript('media', 'scanner');
OCP\Util::addscript('media', 'jquery.jplayer.min');
OCP\Util::addStyle('media', 'music');
OCP\App::setActiveNavigationEntry('media_index');
$tmpl = new OCP\Template('media', 'music', 'user');
$tmpl->printPage();
?>
 
示例#28
0
文件: app.php 项目: kenwi/core
 *
 */
OCP\App::registerAdmin('user_ldap', 'settings');
$helper = new \OCA\user_ldap\lib\Helper();
$configPrefixes = $helper->getServerConfigurationPrefixes(true);
$ldapWrapper = new OCA\user_ldap\lib\LDAP();
$ocConfig = \OC::$server->getConfig();
if (count($configPrefixes) === 1) {
    $dbc = \OC::$server->getDatabaseConnection();
    $userManager = new OCA\user_ldap\lib\user\Manager($ocConfig, new OCA\user_ldap\lib\FilesystemHelper(), new OCA\user_ldap\lib\LogWrapper(), \OC::$server->getAvatarManager(), new \OCP\Image(), $dbc);
    $connector = new OCA\user_ldap\lib\Connection($ldapWrapper, $configPrefixes[0]);
    $ldapAccess = new OCA\user_ldap\lib\Access($connector, $ldapWrapper, $userManager);
    $ldapAccess->setUserMapper(new OCA\User_LDAP\Mapping\UserMapping($dbc));
    $ldapAccess->setGroupMapper(new OCA\User_LDAP\Mapping\GroupMapping($dbc));
    $userBackend = new OCA\user_ldap\USER_LDAP($ldapAccess, $ocConfig);
    $groupBackend = new OCA\user_ldap\GROUP_LDAP($ldapAccess);
} else {
    if (count($configPrefixes) > 1) {
        $userBackend = new OCA\user_ldap\User_Proxy($configPrefixes, $ldapWrapper, $ocConfig);
        $groupBackend = new OCA\user_ldap\Group_Proxy($configPrefixes, $ldapWrapper);
    }
}
if (count($configPrefixes) > 0) {
    // register user backend
    OC_User::useBackend($userBackend);
    OC_Group::useBackend($groupBackend);
}
\OCP\Util::connectHook('\\OCA\\Files_Sharing\\API\\Server2Server', 'preLoginNameUsedAsUserName', '\\OCA\\user_ldap\\lib\\Helper', 'loginName2UserName');
if (OCP\App::isEnabled('user_webdavauth')) {
    OCP\Util::writeLog('user_ldap', 'user_ldap and user_webdavauth are incompatible. You may experience unexpected behaviour', OCP\Util::WARN);
}
示例#29
0
文件: app.php 项目: anolisti/apps
 * 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/>.
 *
 */
if (OCP\App::isEnabled('user_cas')) {
    include_once 'CAS.php';
    require_once 'user_cas/user_cas.php';
    OCP\App::registerAdmin('user_cas', 'settings');
    // register user backend
    OC_User::useBackend('CAS');
    OC::$CLASSPATH['OC_USER_CAS_Hooks'] = 'user_cas/lib/hooks.php';
    OCP\Util::connectHook('OC_User', 'post_createUser', 'OC_USER_CAS_Hooks', 'post_createUser');
    OCP\Util::connectHook('OC_User', 'post_login', 'OC_USER_CAS_Hooks', 'post_login');
    OCP\Util::connectHook('OC_User', 'logout', 'OC_USER_CAS_Hooks', 'logout');
    if (isset($_GET['app']) && $_GET['app'] == 'user_cas') {
        require_once 'user_cas/auth.php';
        if (!OC_User::login('', '')) {
            $error = true;
            OC_Log::write('cas', 'Error trying to authenticate the user', OC_Log::DEBUG);
        }
        if (isset($_SERVER["QUERY_STRING"]) && !empty($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != 'app=user_cas') {
            header('Location: ' . OC::$WEBROOT . '/?' . $_SERVER["QUERY_STRING"]);
            exit;
示例#30
0
文件: app.php 项目: hjimmy/owncloud
    // User related hooks
    OCA\Encryption\Helper::registerUserHooks();
    // Sharing related hooks
    OCA\Encryption\Helper::registerShareHooks();
    // Filesystem related hooks
    OCA\Encryption\Helper::registerFilesystemHooks();
    // App manager related hooks
    OCA\Encryption\Helper::registerAppHooks();
    if (!in_array('crypt', stream_get_wrappers())) {
        stream_wrapper_register('crypt', 'OCA\\Encryption\\Stream');
    }
    // check if we are logged in
    if (OCP\User::isLoggedIn()) {
        // ensure filesystem is loaded
        if (!\OC\Files\Filesystem::$loaded) {
            \OC_Util::setupFS();
        }
        $view = new OC_FilesystemView('/');
        $sessionReady = OCA\Encryption\Helper::checkRequirements();
        if ($sessionReady) {
            $session = new \OCA\Encryption\Session($view);
        }
    }
} else {
    // logout user if we are in maintenance to force re-login
    OCP\User::logout();
}
// Register settings scripts
OCP\App::registerAdmin('files_encryption', 'settings-admin');
OCP\App::registerPersonal('files_encryption', 'settings-personal');