public static function changekeypasscode($newpasscode)
 {
     if (OC_User::isLoggedIn()) {
         $username = OC_USER::getUser();
         // read old key
         $key = file_get_contents(OC_Config::getValue("datadirectory") . '/' . $username . '/encryption.key');
         // decrypt key with old passcode
         $key = OC_Crypt::decrypt($key, $_SESSION['user_password']);
         // encrypt again with new passcode
         $key = OC_Crypt::encrypt($key, $newpassword);
         // store the new key
         file_put_contents(OC_Config::getValue("datadirectory") . '/' . $username . '/encryption.key', $key);
         $_SESSION['user_password'] = $newpasscode;
     }
 }
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
// Init owncloud
require_once '../../lib/base.php';
OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('contacts');
$id = $_GET['id'];
$l10n = new OC_L10N('contacts');
$card = OC_Contacts_VCard::find($id);
if ($card === false) {
    echo $l10n->t('Contact could not be found.');
    exit;
}
$addressbook = OC_Contacts_Addressbook::find($card['addressbookid']);
if ($addressbook === false || $addressbook['userid'] != OC_USER::getUser()) {
    echo $l10n->t('This is not your contact.');
    // This is a weird error, why would it come up? (Better feedback for users?)
    exit;
}
$content = OC_Contacts_VCard::parse($card['carddata']);
// invalid vcard
if (is_null($content)) {
    echo $l10n->t('This card is not RFC compatible.');
    exit;
}
// Photo :-)
foreach ($content->children as $child) {
    if ($child->name == 'PHOTO') {
        $mime = 'image/jpeg';
        foreach ($child->parameters as $parameter) {
<?php

/**
 * Copyright (c) 2011 Bart Visscher <*****@*****.**>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */
require_once '../../../lib/base.php';
$l10n = new OC_L10N('calendar');
if (!OC_USER::isLoggedIn()) {
    die("<script type=\"text/javascript\">document.location = oc_webroot;</script>");
}
OC_JSON::checkAppEnabled('calendar');
$calendar = array('id' => 'new', 'displayname' => '', 'calendarcolor' => '');
$tmpl = new OC_Template('calendar', 'part.editcalendar');
$tmpl->assign('new', true);
$tmpl->assign('calendar', $calendar);
$tmpl->printPage();
 */
require_once "../../../lib/base.php";
if (!OC_USER::isLoggedIn()) {
    die("<script type=\"text/javascript\">document.location = oc_webroot;</script>");
}
OC_JSON::checkAppEnabled('calendar');
$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), 1);
$events = array();
$return = array('calendars' => array());
foreach ($calendars as $calendar) {
    $tmp = OC_Calendar_Object::all($calendar['id']);
    $events = array_merge($events, $tmp);
    $return['calendars'][$calendar['id']] = array('displayname' => $calendar['displayname'], 'color' => '#' . $calendar['calendarcolor']);
}
$select_year = $_GET["year"];
$user_timezone = OC_Preferences::getValue(OC_USER::getUser(), "calendar", "timezone", "Europe/London");
foreach ($events as $event) {
    if ($select_year != substr($event['startdate'], 0, 4)) {
        continue;
    }
    $object = Sabre_VObject_Reader::read($event['calendardata']);
    $vevent = $object->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));
    $year = $start_dt->format('Y');
    $month = $start_dt->format('n') - 1;
    // return is 0 based
示例#5
0
<ul>

<?php 
p(OC_USER::getUser());
use OCP\IConfig;
?>

	<li><a href="#">First level entry</a></li>
	<li>
		<a href="#">First level container</a>
		<ul>
			<li><a href="#">Second level entry</a></li>
			<li><a href="#">Second level entry</a></li>
		</ul>
	</li>
</ul>
 public static function updateVCalendarFromRequest($request, $vcalendar)
 {
     $title = $request["title"];
     $location = $request["location"];
     $categories = isset($request["categories"]) ? $request["categories"] : null;
     $allday = isset($request["allday"]);
     $from = $request["from"];
     $fromtime = $request["fromtime"];
     $to = $request["to"];
     $totime = $request["totime"];
     $description = $request["description"];
     //$repeat = $request["repeat"];
     /*switch($request["repeatfreq"]){
     			case "DAILY":
     				$repeatfreq = "DAILY";
     			case "WEEKLY":
     				$repeatfreq = "WEEKLY";
     			case "WEEKDAY":
     				$repeatfreq = "DAILY;BYDAY=MO,TU,WE,TH,FR"; //load weeksdayss from userconfig when weekdays are choosable
     			case "":
     				$repeatfreq = "";
     			case "":
     				$repeatfreq = "";
     			case "":
     				$repeatfreq = "";
     			default:
     				$repeat = "false";
     		}*/
     $repeat = "false";
     $now = new DateTime();
     $vevent = $vcalendar->VEVENT[0];
     $last_modified = new Sabre_VObject_Element_DateTime('LAST-MODIFIED');
     $last_modified->setDateTime($now, Sabre_VObject_Element_DateTime::UTC);
     $vevent->__set('LAST-MODIFIED', $last_modified);
     $dtstamp = new Sabre_VObject_Element_DateTime('DTSTAMP');
     $dtstamp->setDateTime($now, Sabre_VObject_Element_DateTime::UTC);
     $vevent->DTSTAMP = $dtstamp;
     $vevent->SUMMARY = $title;
     $dtstart = new Sabre_VObject_Element_DateTime('DTSTART');
     $dtend = new Sabre_VObject_Element_DateTime('DTEND');
     if ($allday) {
         $start = new DateTime($from);
         $end = new DateTime($to . ' +1 day');
         $dtstart->setDateTime($start, Sabre_VObject_Element_DateTime::DATE);
         $dtend->setDateTime($end, Sabre_VObject_Element_DateTime::DATE);
     } else {
         $timezone = OC_Preferences::getValue(OC_USER::getUser(), "calendar", "timezone", "Europe/London");
         $timezone = new DateTimeZone($timezone);
         $start = new DateTime($from . ' ' . $fromtime, $timezone);
         $end = new DateTime($to . ' ' . $totime, $timezone);
         $dtstart->setDateTime($start, Sabre_VObject_Element_DateTime::LOCALTZ);
         $dtend->setDateTime($end, Sabre_VObject_Element_DateTime::LOCALTZ);
     }
     $vevent->DTSTART = $dtstart;
     $vevent->DTEND = $dtend;
     unset($vevent->DURATION);
     if ($location != "") {
         $vevent->LOCATION = $location;
     } else {
         unset($vevent->LOCATION);
     }
     if ($description != "") {
         $vevent->DESCRIPTION = $description;
     } else {
         unset($vevent->DESCRIPTION);
     }
     if (!empty($categories)) {
         $vevent->CATEGORIES = join(',', $categories);
     } else {
         unset($vevent->CATEGORIES);
     }
     /*if($repeat == "true"){
     			$vevent->RRULE = $repeat;
     		}*/
     return $vcalendar;
 }
";
				Calendar.UI.more_before = String('<?php 
echo $l->t('More before {startdate}');
?>
');
				Calendar.UI.more_after = String('<?php 
echo $l->t('More after {enddate}');
?>
');
				Calendar.firstdayofweek = parseInt("<?php 
echo OC_Preferences::getValue(OC_User::getUser(), 'calendar', 'firstdayofweek', "1");
?>
");
				//use last view as default on the next
				Calendar.UI.setCurrentView("<?php 
echo OC_Preferences::getValue(OC_USER::getUser(), "calendar", "currentview", "onemonthview");
?>
");
				var totalurl = "<?php 
echo OC_Helper::linkTo('calendar', 'caldav.php', null, true) . '/calendars';
?>
";
				</script>
				<div id="sysbox"></div>
				<div id="controls">
					<div>
						<form>
							<div id="view">
								<!-- <input type="button" value="1 <?php 
echo $l->t('Day');
?>
示例#8
0
 /**
  * @brief Check if the password is correct
  * @param $uid The username
  * @param $password The password
  * @returns true/false
  *
  * Check if the password is correct without logging in the user
  */
 public static function checkPassword($uid, $password)
 {
     return \OC_USER::checkPassword($uid, $password);
 }
<?php

/**
 * Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */
require_once "../../../lib/base.php";
if (!OC_USER::isLoggedIn()) {
    die("<script type=\"text/javascript\">document.location = oc_webroot;</script>");
}
OC_JSON::checkAppEnabled('calendar');
$currentview = $_GET["v"];
OC_Preferences::setValue(OC_USER::getUser(), "calendar", "currentview", $currentview);
/**
 * ownCloud - Addressbook
 *
 * @author Jakob Sack
 * @copyright 2011 Jakob Sack mail@jakobsack.de
 *
 * 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/>.
 *
 */
// Init owncloud
require_once '../../../lib/base.php';
$l10n = new OC_L10N('contacts');
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
$addressbooks = OC_Contacts_Addressbook::all(OC_USER::getUser());
$tmpl = new OC_Template('contacts', 'part.addcardform');
$tmpl->assign('addressbooks', $addressbooks);
$page = $tmpl->fetchPage();
OC_JSON::success(array('data' => array('page' => $page)));