$params=array(
htmlspecialchars_decode($_GET["url"]),
- OC_User::getUser()
+ OCP\USER::getUser()
);
$query = OC_DB::prepare("
AND url LIKE ?
");
-$params=array(OC_User::getUser(), htmlspecialchars_decode($_GET["url"]));
+$params=array(OCP\USER::getUser(), htmlspecialchars_decode($_GET["url"]));
$bookmarks = $query->execute($params);
header( "HTTP/1.1 204 No Content" );
$params=array(
htmlspecialchars_decode($url),
htmlspecialchars_decode($title),
- OC_User::getUser()
+ OCP\USER::getUser()
);
$query->execute($params);
//OCP\Util::writeLog('bookmarks', 'findBookmarks ' .$offset. ' '.$sqlSortColumn.' '. $filter.' '. $filterTagOnly ,OCP\Util::DEBUG);
$CONFIG_DBTYPE = OC_Config::getValue( 'dbtype', 'sqlite' );
- $params=array(OC_User::getUser());
+ $params=array(OCP\USER::getUser());
if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
$_gc_separator = ', \' \'';
OC_JSON::error(array('message'=>'empty'));
exit;
}
-$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
+$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser());
foreach($calendars as $cal){
if($cal['displayname'] == $_POST['name']){
OC_JSON::error(array('message'=>'namenotavailable'));
}
}
-$userid = OC_User::getUser();
+$userid = OCP\USER::getUser();
$calendarid = OC_Calendar_Calendar::addCalendar($userid, strip_tags($_POST['name']), 'VEVENT,VTODO,VJOURNAL', null, 0, $_POST['color']);
OC_Calendar_Calendar::setCalendarActive($calendarid, 1);
OC_JSON::error(array('message'=>'empty'));
exit;
}
-$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
+$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser());
foreach($calendars as $cal){
if($cal['displayname'] == $_POST['name'] && $cal['id'] != $_POST['id']){
OC_JSON::error(array('message'=>'namenotavailable'));
OCP\Util::writeLog('calendar','ajax/categories/rescan.php: '.$msg, OCP\Util::DEBUG);
}
-$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
+$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser());
if(count($calendars) == 0) {
bailOut(OC_Calendar_App::$l10n->t('No calendars found.'));
}
OC_JSON::error(array('message'=>'unexspected parameter: ' . $view));
exit;
}
-OC_Preferences::setValue(OC_USER::getUser(), 'calendar', 'currentview', $view);
+OC_Preferences::setValue(OCP\USER::getUser(), 'calendar', 'currentview', $view);
OC_JSON::success();
?>
$repeat['repeat'] = 'doesnotrepeat';
}
if($access == 'owner'){
- $calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
+ $calendar_options = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser());
}else{
$calendar_options = array(OC_Calendar_App::getCalendar($data['calendarid'], false));
}
$allday = $_POST['allday'];
if (!$end){
- $duration = OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'duration', '60');
+ $duration = OC_Preferences::getValue( OCP\USER::getUser(), 'calendar', 'duration', '60');
$end = $start + ($duration * 60);
}
$start = new DateTime('@'.$start);
$end = new DateTime('@'.$end);
-$timezone = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
+$timezone = OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
$start->setTimezone(new DateTimeZone($timezone));
$end->setTimezone(new DateTimeZone($timezone));
-$calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
+$calendar_options = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser());
$repeat_options = OC_Calendar_App::getRepeatOptions();
$repeat_end_options = OC_Calendar_App::getEndOptions();
$repeat_month_options = OC_Calendar_App::getMonthOptions();
}
$file = OC_Filesystem::file_get_contents($_POST['path'] . '/' . $_POST['file']);
if($_POST['method'] == 'new'){
- $id = OC_Calendar_Calendar::addCalendar(OC_User::getUser(), $_POST['calname']);
+ $id = OC_Calendar_Calendar::addCalendar(OCP\USER::getUser(), $_POST['calname']);
OC_Calendar_Calendar::setCalendarActive($id, 1);
}else{
$calendar = OC_Calendar_App::getCalendar($_POST['id']);
- if($calendar['userid'] != OC_USER::getUser()){
+ if($calendar['userid'] != OCP\USER::getUser()){
OC_JSON::error();
exit();
}
*/
OC_JSON::checkLoggedIn();
-$firstday = OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'firstday', 'mo');
+$firstday = OC_Preferences::getValue( OCP\USER::getUser(), 'calendar', 'firstday', 'mo');
OC_JSON::encodedPrint(array('firstday' => $firstday));
?>
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
-OC_JSON::success(array('detection' => OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezonedetection')));
\ No newline at end of file
+OC_JSON::success(array('detection' => OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timezonedetection')));
\ No newline at end of file
$timezone = OC_Geo::timezone($lat, $lng);
-if($timezone == OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone')){
+if($timezone == OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timezone')){
OC_JSON::success();
exit;
}
-OC_Preferences::setValue(OC_USER::getUser(), 'calendar', 'timezone', $timezone);
+OC_Preferences::setValue(OCP\USER::getUser(), 'calendar', 'timezone', $timezone);
$message = array('message'=> $l->t('New Timezone:') . $timezone);
OC_JSON::success($message);
?>
\ No newline at end of file
OC_JSON::checkLoggedIn();
if(isset($_POST["firstday"])){
- OC_Preferences::setValue(OC_User::getUser(), 'calendar', 'firstday', $_POST["firstday"]);
+ OC_Preferences::setValue(OCP\USER::getUser(), 'calendar', 'firstday', $_POST["firstday"]);
OC_JSON::success();
}else{
OC_JSON::error();
OC_JSON::checkLoggedIn();
if(isset($_POST["timeformat"])){
- OC_Preferences::setValue(OC_User::getUser(), 'calendar', 'timeformat', $_POST["timeformat"]);
+ OC_Preferences::setValue(OCP\USER::getUser(), 'calendar', 'timeformat', $_POST["timeformat"]);
OC_JSON::success();
}else{
OC_JSON::error();
// Get data
if( isset( $_POST['timezone'] ) ){
$timezone=$_POST['timezone'];
- OC_Preferences::setValue( OC_User::getUser(), 'calendar', 'timezone', $timezone );
+ OC_Preferences::setValue( OCP\USER::getUser(), 'calendar', 'timezone', $timezone );
OC_JSON::success(array('data' => array( 'message' => $l->t('Timezone changed') )));
}else{
OC_JSON::error(array('data' => array( 'message' => $l->t('Invalid request') )));
*/
OC_JSON::checkLoggedIn();
-$timeformat = OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'timeformat', "24");
+$timeformat = OC_Preferences::getValue( OCP\USER::getUser(), 'calendar', 'timeformat', "24");
OC_JSON::encodedPrint(array("timeformat" => $timeformat));
?>
OC_JSON::checkAppEnabled('calendar');
if(array_key_exists('timezonedetection', $_POST)){
if($_POST['timezonedetection'] == 'on'){
- OC_Preferences::setValue(OC_USER::getUser(), 'calendar', 'timezonedetection', 'true');
+ OC_Preferences::setValue(OCP\USER::getUser(), 'calendar', 'timezonedetection', 'true');
}else{
- OC_Preferences::setValue(OC_USER::getUser(), 'calendar', 'timezonedetection', 'false');
+ OC_Preferences::setValue(OCP\USER::getUser(), 'calendar', 'timezonedetection', 'false');
}
OC_JSON::success();
}else{
require_once('../../../../lib/base.php');
$id = strip_tags($_GET['id']);
$activation = strip_tags($_GET['activation']);
-OC_Calendar_Share::set_active(OC_User::getUser(), $id, $activation);
+OC_Calendar_Share::set_active(OCP\USER::getUser(), $id, $activation);
OC_JSON::success();
\ No newline at end of file
* See the COPYING-README file.
*/
-$user = OC_USER::getUser();
+$user = OCP\USER::getUser();
$calid = $_GET['calid'];
$calendar = OC_Calendar_Calendar::find($calid);
if($calendar['userid'] != $user){
OC_JSON::error(array('message'=>'group not found'));
exit;
}
-if($sharetype == 'user' && OC_User::getUser() == $sharewith){
+if($sharetype == 'user' && OCP\USER::getUser() == $sharewith){
OC_JSON::error(array('meesage'=>'you can not share with yourself'));
}
-$success = OC_Calendar_Share::share(OC_User::getUser(), $sharewith, $sharetype, $id, (($idtype=='calendar') ? OC_Calendar_Share::CALENDAR : OC_Calendar_Share::EVENT));
+$success = OC_Calendar_Share::share(OCP\USER::getUser(), $sharewith, $sharetype, $id, (($idtype=='calendar') ? OC_Calendar_Share::CALENDAR : OC_Calendar_Share::EVENT));
if($success){
if($sharetype == 'public'){
OC_JSON::success(array('message'=>$success));
OC_JSON::error(array('message'=>'group not found'));
exit;
}
-$success = OC_Calendar_Share::unshare(OC_User::getUser(), $sharewith, $sharetype, $id, (($idtype=='calendar') ? OC_Calendar_Share::CALENDAR : OC_Calendar_Share::EVENT));
+$success = OC_Calendar_Share::unshare(OCP\USER::getUser(), $sharewith, $sharetype, $id, (($idtype=='calendar') ? OC_Calendar_Share::CALENDAR : OC_Calendar_Share::EVENT));
if($success){
OC_JSON::success();
}else{
OC_Util::checkAppEnabled('calendar');
// Create default calendar ...
-$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), 1);
+$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser(), 1);
if( count($calendars) == 0){
- OC_Calendar_Calendar::addCalendar(OC_User::getUser(),'Default calendar');
- $calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), 1);
+ OC_Calendar_Calendar::addCalendar(OCP\USER::getUser(),'Default calendar');
+ $calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser(), 1);
}
$eventSources = array();
$categories = OC_Calendar_App::getCategoryOptions();
//Fix currentview for fullcalendar
-if(OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'currentview', 'month') == "oneweekview"){
- OC_Preferences::setValue(OC_USER::getUser(), "calendar", "currentview", "agendaWeek");
+if(OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "oneweekview"){
+ OC_Preferences::setValue(OCP\USER::getUser(), "calendar", "currentview", "agendaWeek");
}
-if(OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'currentview', 'month') == "onemonthview"){
- OC_Preferences::setValue(OC_USER::getUser(), "calendar", "currentview", "month");
+if(OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "onemonthview"){
+ OC_Preferences::setValue(OCP\USER::getUser(), "calendar", "currentview", "month");
}
-if(OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'currentview', 'month') == "listview"){
- OC_Preferences::setValue(OC_USER::getUser(), "calendar", "currentview", "list");
+if(OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "listview"){
+ OC_Preferences::setValue(OCP\USER::getUser(), "calendar", "currentview", "list");
}
OC_Util::addScript('3rdparty/fullcalendar', 'fullcalendar');
OCP\Util::addStyle('3rdparty/fullcalendar', 'fullcalendar');
OC_Util::addScript('3rdparty/timepicker', 'jquery.ui.timepicker');
OCP\Util::addStyle('3rdparty/timepicker', 'jquery.ui.timepicker');
-if(OC_Preferences::getValue(OC_USER::getUser(), "calendar", "timezone") == null || OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezonedetection') == 'true'){
+if(OC_Preferences::getValue(OCP\USER::getUser(), "calendar", "timezone") == null || OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timezonedetection') == 'true'){
OC_UTIL::addScript('calendar', 'geo');
}
OC_Util::addScript('calendar', 'calendar');
* This class manages our app actions
*/
OC_Calendar_App::$l10n = new OC_L10N('calendar');
-OC_Calendar_App::$tz = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
+OC_Calendar_App::$tz = OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
class OC_Calendar_App{
const CALENDAR = 'calendar';
const EVENT = 'event';
public static function getCalendar($id, $security = true, $shared = false){
$calendar = OC_Calendar_Calendar::find($id);
if($shared === true){
- if(OC_Calendar_Share::check_access(OC_User::getUser(), $id, OC_Calendar_Share::CALENDAR)){
+ if(OC_Calendar_Share::check_access(OCP\USER::getUser(), $id, OC_Calendar_Share::CALENDAR)){
return $calendar;
}
}
if($security === true){
- if($calendar['userid'] != OC_User::getUser()){
+ if($calendar['userid'] != OCP\USER::getUser()){
return false;
}
}
public static function getEventObject($id, $security = true, $shared = false){
$event = OC_Calendar_Object::find($id);
if($shared === true){
- if(OC_Calendar_Share::check_access(OC_User::getUser(), $id, OC_Calendar_Share::EVENT)){
+ if(OC_Calendar_Share::check_access(OCP\USER::getUser(), $id, OC_Calendar_Share::EVENT)){
return $event;
}
}
if($security === true){
$calendar = self::getCalendar($event['calendarid'], false);
- if($calendar['userid'] != OC_User::getUser()){
+ if($calendar['userid'] != OCP\USER::getUser()){
return false;
}
}
*/
public static function scanCategories($events = null) {
if (is_null($events)) {
- $calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
+ $calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser());
if(count($calendars) > 0) {
$events = array();
foreach($calendars as $calendar) {
public static function getaccess($id, $type){
if($type == self::CALENDAR){
$calendar = self::getCalendar($id, false, false);
- if($calendar['userid'] == OC_User::getUser()){
+ if($calendar['userid'] == OCP\USER::getUser()){
return 'owner';
}
- $isshared = OC_Calendar_Share::check_access(OC_User::getUser(), $id, OC_Calendar_Share::CALENDAR);
+ $isshared = OC_Calendar_Share::check_access(OCP\USER::getUser(), $id, OC_Calendar_Share::CALENDAR);
if($isshared){
- $writeaccess = OC_Calendar_Share::is_editing_allowed(OC_User::getUser(), $id, OC_Calendar_Share::CALENDAR);
+ $writeaccess = OC_Calendar_Share::is_editing_allowed(OCP\USER::getUser(), $id, OC_Calendar_Share::CALENDAR);
if($writeaccess){
return 'rw';
}else{
return false;
}
}elseif($type == self::EVENT){
- if(OC_Calendar_Object::getowner($id) == OC_User::getUser()){
+ if(OC_Calendar_Object::getowner($id) == OCP\USER::getUser()){
return 'owner';
}
- $isshared = OC_Calendar_Share::check_access(OC_User::getUser(), $id, OC_Calendar_Share::EVENT);
+ $isshared = OC_Calendar_Share::check_access(OCP\USER::getUser(), $id, OC_Calendar_Share::EVENT);
if($isshared){
- $writeaccess = OC_Calendar_Share::is_editing_allowed(OC_User::getUser(), $id, OC_Calendar_Share::EVENT);
+ $writeaccess = OC_Calendar_Share::is_editing_allowed(OCP\USER::getUser(), $id, OC_Calendar_Share::EVENT);
if($writeaccess){
return 'rw';
}else{
public static function getrequestedEvents($calendarid, $start, $end){
$events = array();
if($calendarid == 'shared_rw' || $_GET['calendar_id'] == 'shared_r'){
- $calendars = OC_Calendar_Share::allSharedwithuser(OC_USER::getUser(), OC_Calendar_Share::CALENDAR, 1, ($_GET['calendar_id'] == 'shared_rw')?'rw':'r');
+ $calendars = OC_Calendar_Share::allSharedwithuser(OCP\USER::getUser(), OC_Calendar_Share::CALENDAR, 1, ($_GET['calendar_id'] == 'shared_rw')?'rw':'r');
foreach($calendars as $calendar){
$calendarevents = OC_Calendar_Object::allInPeriod($calendar['calendarid'], $start, $end);
$events = array_merge($events, $calendarevents);
}
- $singleevents = OC_Calendar_Share::allSharedwithuser(OC_USER::getUser(), OC_Calendar_Share::EVENT, 1, ($_GET['calendar_id'] == 'shared_rw')?'rw':'r');
+ $singleevents = OC_Calendar_Share::allSharedwithuser(OCP\USER::getUser(), OC_Calendar_Share::EVENT, 1, ($_GET['calendar_id'] == 'shared_rw')?'rw':'r');
foreach($singleevents as $singleevent){
$event = OC_Calendar_Object::find($singleevent['eventid']);
$events[] = $event;
$vevent->setDateTime('DTSTART', $start, Sabre_VObject_Property_DateTime::DATE);
$vevent->setDateTime('DTEND', $end, Sabre_VObject_Property_DateTime::DATE);
}else{
- $timezone = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
+ $timezone = OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
$timezone = new DateTimeZone($timezone);
$start = new DateTime($from.' '.$fromtime, $timezone);
$end = new DateTime($to.' '.$totime, $timezone);
<?php
class OC_Search_Provider_Calendar extends OC_Search_Provider{
function search($query){
- $calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), 1);
+ $calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser(), 1);
if(count($calendars)==0 || !OC_App::isEnabled('calendar')){
//return false;
}
}else{
$searchquery[] = $query;
}
- $user_timezone = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
+ $user_timezone = OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
$l = new OC_l10n('calendar');
foreach($calendars as $calendar){
$objects = OC_Calendar_Object::all($calendar['id']);
*/
$tmpl = new OC_Template( 'calendar', 'settings');
-$timezone=OC_Preferences::getValue(OC_User::getUser(),'calendar','timezone','');
+$timezone=OC_Preferences::getValue(OCP\USER::getUser(),'calendar','timezone','');
$tmpl->assign('timezone',$timezone);
$tmpl->assign('timezones',DateTimeZone::listIdentifiers());
<script type='text/javascript'>
- var defaultView = '<?php echo OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'currentview', 'month') ?>';
+ var defaultView = '<?php echo OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') ?>';
var eventSources = <?php echo json_encode($_['eventSources']) ?>;
var categories = <?php echo json_encode($_['categories']); ?>;
var dayNames = <?php echo json_encode($l->tA(array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'))) ?>;
var dayNamesShort = <?php echo json_encode($l->tA(array('Sun.', 'Mon.', 'Tue.', 'Wed.', 'Thu.', 'Fri.', 'Sat.'))) ?>;
var monthNames = <?php echo json_encode($l->tA(array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'))) ?>;
var monthNamesShort = <?php echo json_encode($l->tA(array('Jan.', 'Feb.', 'Mar.', 'Apr.', 'May.', 'Jun.', 'Jul.', 'Aug.', 'Sep.', 'Oct.', 'Nov.', 'Dec.'))) ?>;
- var agendatime = '<?php echo ((int) OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timeformat', '24') == 24 ? 'HH:mm' : 'hh:mm tt'); ?>{ - <?php echo ((int) OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timeformat', '24') == 24 ? 'HH:mm' : 'hh:mm tt'); ?>}';
- var defaulttime = '<?php echo ((int) OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timeformat', '24') == 24 ? 'HH:mm' : 'hh:mm tt'); ?>';
+ var agendatime = '<?php echo ((int) OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timeformat', '24') == 24 ? 'HH:mm' : 'hh:mm tt'); ?>{ - <?php echo ((int) OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timeformat', '24') == 24 ? 'HH:mm' : 'hh:mm tt'); ?>}';
+ var defaulttime = '<?php echo ((int) OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timeformat', '24') == 24 ? 'HH:mm' : 'hh:mm tt'); ?>';
var allDayText = '<?php echo addslashes($l->t('All day')) ?>';
var newcalendar = '<?php echo addslashes($l->t('New Calendar')) ?>';
var missing_field = '<?php echo addslashes($l->t('Missing fields')) ?>';
var missing_field_startsbeforeends = '<?php echo addslashes($l->t('The event ends before it starts')) ?>';
var missing_field_dberror = '<?php echo addslashes($l->t('There was a database fail')) ?>';
var totalurl = '<?php echo OC_Helper::linkToAbsolute('calendar', 'caldav.php'); ?>/calendars';
- var firstDay = '<?php echo (OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'firstday', 'mo') == 'mo' ? '1' : '0'); ?>';
+ var firstDay = '<?php echo (OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'firstday', 'mo') == 'mo' ? '1' : '0'); ?>';
$(document).ready(function() {
<?php
if(array_key_exists('showevent', $_)){
<p><b><?php echo $l->t('Your calendars'); ?>:</b></p>
<table width="100%" style="border: 0;">
<?php
-$option_calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
+$option_calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser());
for($i = 0; $i < count($option_calendars); $i++){
echo "<tr>";
$tmpl = new OC_Template('calendar', 'part.choosecalendar.rowfields');
<p><b><?php echo $l->t('Shared calendars'); ?>: </b></p>
<table width="100%" style="border: 0;">
<?php
-$share = OC_Calendar_Share::allSharedwithuser(OC_User::getUser(), OC_Calendar_Share::CALENDAR);
+$share = OC_Calendar_Share::allSharedwithuser(OCP\USER::getUser(), OC_Calendar_Share::CALENDAR);
$count = count($share);
for($i = 0; $i < $count; $i++){
$share[$i]['calendar'] = OC_Calendar_App::getCalendar($share[$i]['calendarid'], false, false);
<?php
echo '<td width="20px"><input id="active_' . $_['calendar']['id'] . '" type="checkbox" onClick="Calendar.UI.Calendar.activation(this,' . $_['calendar']['id'] . ')"' . ($_['calendar']['active'] ? ' checked="checked"' : '') . '></td>';
-echo '<td id="' . OC_User::getUser() . '_' . $_['calendar']['id'] . '"><label for="active_' . $_['calendar']['id'] . '">' . $_['calendar']['displayname'] . '</label></td>';
-echo '<td width="20px"><a href="#" onclick="Calendar.UI.Share.dropdown(\'' . OC_User::getUser() . '\', \'' . $_['calendar']['id'] . '\');" title="' . $l->t("Share Calendar") . '" class="action"><img class="svg action" src="' . ((!$_['shared']) ? '../../core/img/actions/share.svg' : '../../core/img/actions/shared.svg') . '"></a></td>';
-echo '<td width="20px"><a href="#" onclick="Calendar.UI.showCalDAVUrl(\'' . OC_User::getUser() . '\', \'' . $_['calendar']['uri'] . '\');" title="' . $l->t("CalDav Link") . '" class="action"><img class="svg action" src="../../core/img/actions/public.svg"></a></td>';
+echo '<td id="' . OCP\USER::getUser() . '_' . $_['calendar']['id'] . '"><label for="active_' . $_['calendar']['id'] . '">' . $_['calendar']['displayname'] . '</label></td>';
+echo '<td width="20px"><a href="#" onclick="Calendar.UI.Share.dropdown(\'' . OCP\USER::getUser() . '\', \'' . $_['calendar']['id'] . '\');" title="' . $l->t("Share Calendar") . '" class="action"><img class="svg action" src="' . ((!$_['shared']) ? '../../core/img/actions/share.svg' : '../../core/img/actions/shared.svg') . '"></a></td>';
+echo '<td width="20px"><a href="#" onclick="Calendar.UI.showCalDAVUrl(\'' . OCP\USER::getUser() . '\', \'' . $_['calendar']['uri'] . '\');" title="' . $l->t("CalDav Link") . '" class="action"><img class="svg action" src="../../core/img/actions/public.svg"></a></td>';
echo '<td width="20px"><a href="export.php?calid=' . $_['calendar']['id'] . '" title="' . $l->t('Download') . '" class="action"><img class="svg action" src="../../core/img/actions/download.svg"></a></td>';
echo '<td width="20px"><a href="#" title="' . $l->t('Edit') . '" class="action" onclick="Calendar.UI.Calendar.edit(this, ' . $_['calendar']['id'] . ');"><img class="svg action" src="../../core/img/actions/rename.svg"></a></td>';
echo '<td width="20px"><a href="#" onclick="Calendar.UI.Calendar.deleteCalendar(\'' . $_['calendar']['id'] . '\');" title="' . $l->t('Delete') . '" class="action"><img class="svg action" src="../../core/img/actions/delete.svg"></a></td>';
\ No newline at end of file
<p style="text-align:center;"><b><?php echo $l->t('Please choose the calendar'); ?></b></p>
<select style="width:100%;" id="calendar" name="calendar">
<?php
-$calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
+$calendar_options = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser());
$calendar_options[] = array('id'=>'newcal', 'displayname'=>$l->t('create a new calendar'));
echo html_select_options($calendar_options, $calendar_options[0]['id'], array('value'=>'id', 'label'=>'displayname'));
?>
<select id="share_user" title="<?php echo $l->t('select users');?>" data-placeholder="<?php echo $l->t('select users'); ?>">
<option value=""></option>
<?php
-$allocusers = OC_User::getUsers();
+$allocusers = OCP\USER::getUsers();
$allusers = array();
foreach($allocusers as $ocuser){
$allusers[$ocuser] = $ocuser;
}
-unset($allusers[OC_User::getUser()]);
+unset($allusers[OCP\USER::getUser()]);
$allusers = array_flip($allusers);
echo html_select_options($allusers, array());
?>
debug(print_r($categories, true));
-$addressbooks = OC_Contacts_Addressbook::all(OC_User::getUser());
+$addressbooks = OC_Contacts_Addressbook::all(OCP\USER::getUser());
if(count($addressbooks) == 0) {
bailOut(OC_Contacts_App::$l10n->t('No address books found.'));
}
OCP\Util::writeLog('contacts','ajax/categories/rescan.php: '.$msg, OCP\Util::DEBUG);
}
-$addressbooks = OC_Contacts_Addressbook::all(OC_User::getUser());
+$addressbooks = OC_Contacts_Addressbook::all(OCP\USER::getUser());
if(count($addressbooks) == 0) {
bailOut(OC_Contacts_App::$l10n->t('No address books found.'));
}
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
-$ids = OC_Contacts_Addressbook::activeIds(OC_User::getUser());
+$ids = OC_Contacts_Addressbook::activeIds(OCP\USER::getUser());
$contacts = OC_Contacts_VCard::all($ids);
$tmpl = new OC_TEMPLATE("contacts", "part.contacts");
$tmpl->assign('contacts', $contacts);
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
-$userid = OC_User::getUser();
+$userid = OCP\USER::getUser();
$name = trim(strip_tags($_POST['name']));
if(!$name) {
OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Cannot add addressbook with an empty name.'))));
$tmpl->assign('name',$name);
$tmpl->assign('id',$id);
} else {
- $addressbooks = OC_Contacts_Addressbook::active(OC_User::getUser());
+ $addressbooks = OC_Contacts_Addressbook::active(OCP\USER::getUser());
$tmpl->assign('addressbooks', $addressbooks);
}
$tmpl->printpage();
}
error_log('File: '.$file);
if(isset($_POST['method']) && $_POST['method'] == 'new'){
- $id = OC_Contacts_Addressbook::add(OC_User::getUser(), $_POST['addressbookname']);
+ $id = OC_Contacts_Addressbook::add(OCP\USER::getUser(), $_POST['addressbookname']);
OC_Contacts_Addressbook::setActive($id, 1);
}else{
$id = $_POST['id'];
OC_Util::checkAppEnabled('contacts');
// Get active address books. This creates a default one if none exists.
-$ids = OC_Contacts_Addressbook::activeIds(OC_User::getUser());
+$ids = OC_Contacts_Addressbook::activeIds(OCP\USER::getUser());
$contacts = OC_Contacts_VCard::all($ids);
-$addressbooks = OC_Contacts_Addressbook::active(OC_User::getUser());
+$addressbooks = OC_Contacts_Addressbook::active(OCP\USER::getUser());
// Load the files we need
OC_App::setActiveNavigationEntry( 'contacts_index' );
*/
public static function activeIds($uid = null){
if(is_null($uid)){
- $uid = OC_User::getUser();
+ $uid = OCP\USER::getUser();
}
$prefbooks = OC_Preferences::getValue($uid,'contacts','openaddressbooks',null);
if(!$prefbooks){
$openaddressbooks = self::cleanArray($openaddressbooks, false);
sort($openaddressbooks, SORT_NUMERIC);
// FIXME: I alway end up with a ';' prepending when imploding the array..?
- OC_Preferences::setValue(OC_User::getUser(),'contacts','openaddressbooks',implode(';', $openaddressbooks));
+ OC_Preferences::setValue(OCP\USER::getUser(),'contacts','openaddressbooks',implode(';', $openaddressbooks));
return true;
}
public static function getAddressbook($id) {
$addressbook = OC_Contacts_Addressbook::find( $id );
- if( $addressbook === false || $addressbook['userid'] != OC_User::getUser()) {
+ if( $addressbook === false || $addressbook['userid'] != OCP\USER::getUser()) {
if ($addressbook === false) {
OCP\Util::writeLog('contacts', 'Addressbook not found: '. $id, OCP\Util::ERROR);
OC_JSON::error(array('data' => array( 'message' => self::$l10n->t('Addressbook not found.'))));
}
else {
- OCP\Util::writeLog('contacts', 'Addressbook('.$id.') is not from '.OC_User::getUser(), OCP\Util::ERROR);
+ OCP\Util::writeLog('contacts', 'Addressbook('.$id.') is not from '.OCP\USER::getUser(), OCP\Util::ERROR);
OC_JSON::error(array('data' => array( 'message' => self::$l10n->t('This is not your addressbook.'))));
}
exit();
*/
public static function scanCategories($vccontacts = null) {
if (is_null($vccontacts)) {
- $vcaddressbooks = OC_Contacts_Addressbook::all(OC_User::getUser());
+ $vcaddressbooks = OC_Contacts_Addressbook::all(OCP\USER::getUser());
if(count($vcaddressbooks) > 0) {
$vcaddressbookids = array();
foreach($vcaddressbooks as $vcaddressbook) {
static public function getCalenderSources($parameters) {
$base_url = OC_Helper::linkTo('calendar', 'ajax/events.php').'?calendar_id=';
- foreach(OC_Contacts_Addressbook::all(OC_User::getUser()) as $addressbook) {
+ foreach(OC_Contacts_Addressbook::all(OCP\USER::getUser()) as $addressbook) {
$parameters['sources'][] =
array(
'url' => $base_url.'birthday_'. $addressbook['id'],
<?php
class OC_Search_Provider_Contacts extends OC_Search_Provider{
function search($query){
- $addressbooks = OC_Contacts_Addressbook::all(OC_User::getUser(), 1);
+ $addressbooks = OC_Contacts_Addressbook::all(OCP\USER::getUser(), 1);
// if(count($calendars)==0 || !OC_App::isEnabled('contacts')){
// //return false;
// }
<script type='text/javascript'>
var totalurl = '<?php echo OC_Helper::linkToAbsolute('contacts', 'carddav.php'); ?>/addressbooks';
var categories = <?php echo json_encode($_['categories']); ?>;
- var lang = '<?php echo OC_Preferences::getValue(OC_User::getUser(), 'core', 'lang', 'en'); ?>';
+ var lang = '<?php echo OC_Preferences::getValue(OCP\USER::getUser(), 'core', 'lang', 'en'); ?>';
</script>
<!-- div id="controls">
<form>
<div id="chooseaddressbook_dialog" title="<?php echo $l->t("Configure Address Books"); ?>">
<table width="100%" style="border: 0;">
<?php
-$option_addressbooks = OC_Contacts_Addressbook::all(OC_User::getUser());
+$option_addressbooks = OC_Contacts_Addressbook::all(OCP\USER::getUser());
for($i = 0; $i < count($option_addressbooks); $i++){
echo "<tr>";
$tmpl = new OC_Template('contacts', 'part.chooseaddressbook.rowfields');
// FIXME: Make this readable.
echo "<td width=\"20px\"><input id=\"active_" . $_['addressbook']["id"] . "\" type=\"checkbox\" onClick=\"Contacts.UI.Addressbooks.activation(this, " . $_['addressbook']["id"] . ")\"" . (OC_Contacts_Addressbook::isActive($_['addressbook']["id"]) ? ' checked="checked"' : '') . "></td>";
echo "<td><label for=\"active_" . $_['addressbook']["id"] . "\">" . htmlspecialchars($_['addressbook']["displayname"]) . "</label></td>";
- echo "<td width=\"20px\"><a href=\"#\" onclick=\"Contacts.UI.showCardDAVUrl('" . OC_User::getUser() . "', '" . rawurlencode($_['addressbook']["uri"]) . "');\" title=\"" . $l->t("CardDav Link") . "\" class=\"action\"><img class=\"svg action\" src=\"../../core/img/actions/public.svg\"></a></td><td width=\"20px\"><a href=\"export.php?bookid=" . $_['addressbook']["id"] . "\" title=\"" . $l->t("Download") . "\" class=\"action\"><img class=\"svg action\" src=\"../../core/img/actions/download.svg\"></a></td><td width=\"20px\"><a href=\"#\" title=\"" . $l->t("Edit") . "\" class=\"action\" onclick=\"Contacts.UI.Addressbooks.editAddressbook(this, " . $_['addressbook']["id"] . ");\"><img class=\"svg action\" src=\"../../core/img/actions/rename.svg\"></a></td><td width=\"20px\"><a href=\"#\" onclick=\"Contacts.UI.Addressbooks.deleteAddressbook(this, '" . $_['addressbook']["id"] . "');\" title=\"" . $l->t("Delete") . "\" class=\"action\"><img class=\"svg action\" src=\"../../core/img/actions/delete.svg\"></a></td>";
+ echo "<td width=\"20px\"><a href=\"#\" onclick=\"Contacts.UI.showCardDAVUrl('" . OCP\USER::getUser() . "', '" . rawurlencode($_['addressbook']["uri"]) . "');\" title=\"" . $l->t("CardDav Link") . "\" class=\"action\"><img class=\"svg action\" src=\"../../core/img/actions/public.svg\"></a></td><td width=\"20px\"><a href=\"export.php?bookid=" . $_['addressbook']["id"] . "\" title=\"" . $l->t("Download") . "\" class=\"action\"><img class=\"svg action\" src=\"../../core/img/actions/download.svg\"></a></td><td width=\"20px\"><a href=\"#\" title=\"" . $l->t("Edit") . "\" class=\"action\" onclick=\"Contacts.UI.Addressbooks.editAddressbook(this, " . $_['addressbook']["id"] . ");\"><img class=\"svg action\" src=\"../../core/img/actions/rename.svg\"></a></td><td width=\"20px\"><a href=\"#\" onclick=\"Contacts.UI.Addressbooks.deleteAddressbook(this, '" . $_['addressbook']["id"] . "');\" title=\"" . $l->t("Delete") . "\" class=\"action\"><img class=\"svg action\" src=\"../../core/img/actions/delete.svg\"></a></td>";
<p style="text-align:center;"><b><?php echo $l->t('Please choose the addressbook'); ?></b>
<select style="width:100%;" id="contacts" name="contacts">
<?php
-$contacts_options = OC_Contacts_Addressbook::all(OC_User::getUser());
+$contacts_options = OC_Contacts_Addressbook::all(OCP\USER::getUser());
$contacts_options[] = array('id'=>'newaddressbook', 'displayname'=>$l->t('create a new addressbook'));
echo html_select_options($contacts_options, $contacts_options[0]['id'], array('value'=>'id', 'label'=>'displayname'));
?>
<td>
<select id="book" name="book" class="float">
<?php
- $contacts_options = OC_Contacts_Addressbook::all(OC_User::getUser());
+ $contacts_options = OC_Contacts_Addressbook::all(OCP\USER::getUser());
echo html_select_options($contacts_options, $contacts_options[0]['id'], array('value'=>'id', 'label'=>'displayname'));
?>
</select>
<dt><?php echo $l->t('Primary address (Kontact et al)'); ?></dt>
<dd><code><?php echo OC_Helper::linkToAbsolute('contacts', 'carddav.php'); ?>/</code></dd>
<dt><?php echo $l->t('iOS/OS X'); ?></dt>
- <dd><code><?php echo OC_Helper::linkToAbsolute('contacts', 'carddav.php'); ?>/principals/<?php echo OC_User::getUser(); ?></code>/</dd>
+ <dd><code><?php echo OC_Helper::linkToAbsolute('contacts', 'carddav.php'); ?>/principals/<?php echo OCP\USER::getUser(); ?></code>/</dd>
</dl>
Powered by <a href="http://geonames.org/" target="_blank">geonames.org webservice</a>
</fieldset>
public static function changekeypasscode($oldPassword, $newPassword) {
if(OCP\User::isLoggedIn()){
- $username=OC_USER::getUser();
+ $username=OCP\USER::getUser();
$view=new OC_FilesystemView('/'.$username);
// read old key
<?php
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('files_sharing');
-$user = OC_User::getUser();
+$user = OCP\USER::getUser();
// TODO translations
$subject = $user + ' ' + 'shared a file with you';
$link = $_POST['link'] + '&f=' + $_POST['f'];
OC_JSON::checkAppEnabled('files_sharing');
require_once(OC::$APPSROOT . '/apps/files_sharing/lib_share.php');
-$userDirectory = "/".OC_User::getUser()."/files";
+$userDirectory = "/".OCP\USER::getUser()."/files";
$source = $userDirectory.$_GET['source'];
$path = $source;
$users = array();
OC_JSON::checkAppEnabled('files_sharing');
require_once(OC::$APPSROOT . '/apps/files_sharing/lib_share.php');
-$source = "/".OC_User::getUser()."/files".$_GET['source'];
+$source = "/".OCP\USER::getUser()."/files".$_GET['source'];
$uid_shared_with = $_GET['uid_shared_with'];
$permissions = $_GET['permissions'];
OC_Share::setPermissions($source, $uid_shared_with, $permissions);
OC_JSON::checkAppEnabled('files_sharing');
require_once(OC::$APPSROOT . '/apps/files_sharing/lib_share.php');
-$userDirectory = "/".OC_User::getUser()."/files";
+$userDirectory = "/".OCP\USER::getUser()."/files";
$sources = explode(";", $_POST['sources']);
$uid_shared_with = $_POST['uid_shared_with'];
$permissions = $_POST['permissions'];
OC_JSON::checkAppEnabled('files_sharing');
require_once(OC::$APPSROOT . '/apps/files_sharing/lib_share.php');
-$source = "/".OC_User::getUser()."/files".$_GET['source'];
+$source = "/".OCP\USER::getUser()."/files".$_GET['source'];
$uid_shared_with = $_GET['uid_shared_with'];
OC_Share::unshare($source, $uid_shared_with);
$users = array();
$groups = array();
-$self = OC_User::getUser();
+$self = OCP\USER::getUser();
$userGroups = OC_Group::getUserGroups($self);
$users[] = "<optgroup label='Users'>";
$groups[] = "<optgroup label='Groups'>";
* @param $permissions The permissions, use the constants WRITE and DELETE
*/
public function __construct($source, $uid_shared_with, $permissions) {
- $uid_owner = OC_User::getUser();
+ $uid_owner = OCP\USER::getUser();
$query = OC_DB::prepare("INSERT INTO *PREFIX*sharing VALUES(?,?,?,?,?)");
if ($uid_shared_with == self::PUBLICLINK) {
$token = sha1("$uid_shared_with-$source");
}
$query->execute(array($uid_owner, $uid, $source, $target, $permissions));
// Add file to filesystem cache
- $userDirectory = "/".OC_User::getUser()."/files";
+ $userDirectory = "/".OCP\USER::getUser()."/files";
$data = OC_Filecache::get(substr($source, strlen($userDirectory)));
$parentQuery = OC_DB::prepare('SELECT id FROM *PREFIX*fscache WHERE path=?');
$parentResult = $parentQuery->execute(array($sharedFolder))->fetchRow();
$in .= ", '".$uid."@".$group."'";
}
} else {
- $uid = OC_User::getUser();
+ $uid = OCP\USER::getUser();
$in .= "'".$uid."'";
$groups = OC_Group::getUserGroups($uid);
foreach ($groups as $group) {
$source = $folders['source'].substr($oldTarget, strlen($folders['target']));
$item = self::getItem($folders['target']);
$query = OC_DB::prepare("INSERT INTO *PREFIX*sharing VALUES(?,?,?,?,?)");
- $query->execute(array($item[0]['uid_owner'], OC_User::getUser(), $source, $newTarget, $item[0]['permissions']));
+ $query->execute(array($item[0]['uid_owner'], OCP\USER::getUser(), $source, $newTarget, $item[0]['permissions']));
}
/**
public static function getItem($target) {
$target = self::cleanPath($target);
$query = OC_DB::prepare("SELECT uid_owner, source, permissions FROM *PREFIX*sharing WHERE target = ? AND uid_shared_with = ? LIMIT 1");
- return $query->execute(array($target, OC_User::getUser()))->fetchAll();
+ return $query->execute(array($target, OCP\USER::getUser()))->fetchAll();
}
/**
public static function getMySharedItem($source) {
$source = self::cleanPath($source);
$query = OC_DB::prepare("SELECT uid_shared_with, permissions FROM *PREFIX*sharing WHERE source = ? AND uid_owner = ?");
- $result = $query->execute(array($source, OC_User::getUser()))->fetchAll();
+ $result = $query->execute(array($source, OCP\USER::getUser()))->fetchAll();
if (count($result) > 0) {
return $result;
} else if ($originalSource = self::getSource($source)) {
- return $query->execute(array($originalSource, OC_User::getUser()))->fetchAll();
+ return $query->execute(array($originalSource, OCP\USER::getUser()))->fetchAll();
} else {
return false;
}
*/
public static function getMySharedItems() {
$query = OC_DB::prepare("SELECT uid_shared_with, source, permissions FROM *PREFIX*sharing WHERE uid_owner = ?");
- return $query->execute(array(OC_User::getUser()))->fetchAll();
+ return $query->execute(array(OCP\USER::getUser()))->fetchAll();
}
/**
public static function getTarget($source) {
$source = self::cleanPath($source);
$query = OC_DB::prepare("SELECT target FROM *PREFIX*sharing WHERE source = ? AND uid_owner = ? LIMIT 1");
- $result = $query->execute(array($source, OC_User::getUser()))->fetchAll();
+ $result = $query->execute(array($source, OCP\USER::getUser()))->fetchAll();
if (count($result) > 0) {
return $result[0]['target'];
} else {
*/
public static function getTokenFromSource($source) {
$query = OC_DB::prepare("SELECT target FROM *PREFIX*sharing WHERE source = ? AND uid_shared_with = ? AND uid_owner = ? LIMIT 1");
- $result = $query->execute(array($source, self::PUBLICLINK, OC_User::getUser()))->fetchAll();
+ $result = $query->execute(array($source, self::PUBLICLINK, OCP\USER::getUser()))->fetchAll();
if (count($result) > 0) {
return $result[0]['target'];
} else {
public static function setPermissions($source, $uid_shared_with, $permissions) {
$source = self::cleanPath($source);
$query = OC_DB::prepare("UPDATE *PREFIX*sharing SET permissions = ? WHERE SUBSTR(source, 1, ?) = ? AND uid_owner = ? AND uid_shared_with ".self::getUsersAndGroups($uid_shared_with));
- $query->execute(array($permissions, strlen($source), $source, OC_User::getUser()));
+ $query->execute(array($permissions, strlen($source), $source, OCP\USER::getUser()));
}
/**
public static function unshare($source, $uid_shared_with) {
$source = self::cleanPath($source);
$query = OC_DB::prepare("DELETE FROM *PREFIX*sharing WHERE SUBSTR(source, 1, ?) = ? AND uid_owner = ? AND uid_shared_with ".self::getUsersAndGroups($uid_shared_with));
- $query->execute(array(strlen($source), $source, OC_User::getUser()));
+ $query->execute(array(strlen($source), $source, OCP\USER::getUser()));
}
/**
* @param $arguments Array of arguments passed from OC_Hook
*/
public static function deleteItem($arguments) {
- $source = "/".OC_User::getUser()."/files".self::cleanPath($arguments['path']);
+ $source = "/".OCP\USER::getUser()."/files".self::cleanPath($arguments['path']);
if ($target = self::getTarget($source)) {
// Forward hook to notify of changes to target file
OC_Hook::emit("OC_Filesystem", "post_delete", array('path' => $target));
$query = OC_DB::prepare("DELETE FROM *PREFIX*sharing WHERE SUBSTR(source, 1, ?) = ? AND uid_owner = ?");
- $query->execute(array(strlen($source), $source, OC_User::getUser()));
+ $query->execute(array(strlen($source), $source, OCP\USER::getUser()));
}
}
* @param $arguments Array of arguments passed from OC_Hook
*/
public static function renameItem($arguments) {
- $oldSource = "/".OC_User::getUser()."/files".self::cleanPath($arguments['oldpath']);
- $newSource = "/".OC_User::getUser()."/files".self::cleanPath($arguments['newpath']);
+ $oldSource = "/".OCP\USER::getUser()."/files".self::cleanPath($arguments['oldpath']);
+ $newSource = "/".OCP\USER::getUser()."/files".self::cleanPath($arguments['newpath']);
$query = OC_DB::prepare("UPDATE *PREFIX*sharing SET source = REPLACE(source, ?, ?) WHERE uid_owner = ?");
- $query->execute(array($oldSource, $newSource, OC_User::getUser()));
+ $query->execute(array($oldSource, $newSource, OCP\USER::getUser()));
}
public static function updateItem($arguments) {
- $source = "/".OC_User::getUser()."/files".self::cleanPath($arguments['path']);
+ $source = "/".OCP\USER::getUser()."/files".self::cleanPath($arguments['path']);
if ($target = self::getTarget($source)) {
// Forward hook to notify of changes to target file
OC_Hook::emit("OC_Filesystem", "post_write", array('path' => $target));
if (OC_Filesystem::$loaded and !OC_Filesystem::is_dir('/Shared')) {
OC_Filesystem::mkdir('/Shared');
}
-OC_Filesystem::mount('OC_Filestorage_Shared',array('datadir'=>'/'.OC_User::getUser().'/files/Shared'),'/'.OC_User::getUser().'/files/Shared/');
+OC_Filesystem::mount('OC_Filestorage_Shared',array('datadir'=>'/'.OCP\USER::getUser().'/files/Shared'),'/'.OCP\USER::getUser().'/files/Shared/');
/**
* Convert target path to source path and pass the function call to the correct storage provider
OC_JSON::checkAppEnabled('files_versions');
require_once('../versions.php');
-$userDirectory = "/".OC_User::getUser()."/files";
+$userDirectory = "/".OCP\USER::getUser()."/files";
$source = $_GET['source'];
$source = strip_tags( $source );
OC_JSON::checkAppEnabled('files_versions');
require_once('../versions.php');
-$userDirectory = "/".OC_User::getUser()."/files";
+$userDirectory = "/".OCP\USER::getUser()."/files";
$source = $_GET['source'];
public static function init() {
if(\OC_Config::getValue('files_versions', Storage::DEFAULTENABLED)=='true') {
// create versions folder
- $foldername=\OC_Config::getValue('datadirectory').'/'. \OC_User::getUser() .'/'.\OC_Config::getValue('files_versionsfolder', Storage::DEFAULTFOLDER);
+ $foldername=\OC_Config::getValue('datadirectory').'/'. \OCP\USER::getUser() .'/'.\OC_Config::getValue('files_versionsfolder', Storage::DEFAULTFOLDER);
if(!is_dir($foldername)){
mkdir($foldername);
}
*/
public static function store($filename) {
if(\OC_Config::getValue('files_versions', Storage::DEFAULTENABLED)=='true') {
- $versionsfoldername=\OC_Config::getValue('datadirectory').'/'. \OC_User::getUser() .'/'.\OC_Config::getValue('files_versionsfolder', Storage::DEFAULTFOLDER);
- $filesfoldername=\OC_Config::getValue('datadirectory').'/'. \OC_User::getUser() .'/files';
+ $versionsfoldername=\OC_Config::getValue('datadirectory').'/'. \OCP\USER::getUser() .'/'.\OC_Config::getValue('files_versionsfolder', Storage::DEFAULTFOLDER);
+ $filesfoldername=\OC_Config::getValue('datadirectory').'/'. \OCP\USER::getUser() .'/files';
Storage::init();
// check if filename is a directory
if(\OC_Config::getValue('files_versions', Storage::DEFAULTENABLED)=='true') {
- $versionsfoldername=\OC_Config::getValue('datadirectory').'/'. \OC_User::getUser() .'/'.\OC_Config::getValue('files_versionsfolder', Storage::DEFAULTFOLDER);
+ $versionsfoldername=\OC_Config::getValue('datadirectory').'/'. \OCP\USER::getUser() .'/'.\OC_Config::getValue('files_versionsfolder', Storage::DEFAULTFOLDER);
- $filesfoldername=\OC_Config::getValue('datadirectory').'/'. \OC_User::getUser() .'/files';
+ $filesfoldername=\OC_Config::getValue('datadirectory').'/'. \OCP\USER::getUser() .'/files';
// rollback
if ( @copy($versionsfoldername.$filename.'.v'.$revision,$filesfoldername.$filename) ) {
*/
public static function isversioned($filename) {
if(\OC_Config::getValue('files_versions', Storage::DEFAULTENABLED)=='true') {
- $versionsfoldername=\OC_Config::getValue('datadirectory').'/'. \OC_User::getUser() .'/'.\OC_Config::getValue('files_versionsfolder', Storage::DEFAULTFOLDER);
+ $versionsfoldername=\OC_Config::getValue('datadirectory').'/'. \OCP\USER::getUser() .'/'.\OC_Config::getValue('files_versionsfolder', Storage::DEFAULTFOLDER);
// check for old versions
$matches=glob($versionsfoldername.$filename.'.v*');
*/
public static function getversions($filename,$count=0) {
if(\OC_Config::getValue('files_versions', Storage::DEFAULTENABLED)=='true') {
- $versionsfoldername=\OC_Config::getValue('datadirectory').'/'. \OC_User::getUser() .'/'.\OC_Config::getValue('files_versionsfolder', Storage::DEFAULTFOLDER);
+ $versionsfoldername=\OC_Config::getValue('datadirectory').'/'. \OCP\USER::getUser() .'/'.\OC_Config::getValue('files_versionsfolder', Storage::DEFAULTFOLDER);
$versions=array();
// fetch for old versions
public static function expire($filename) {
if(\OC_Config::getValue('files_versions', Storage::DEFAULTENABLED)=='true') {
- $versionsfoldername=\OC_Config::getValue('datadirectory').'/'. \OC_User::getUser() .'/'.\OC_Config::getValue('files_versionsfolder', Storage::DEFAULTFOLDER);
+ $versionsfoldername=\OC_Config::getValue('datadirectory').'/'. \OCP\USER::getUser() .'/'.\OC_Config::getValue('files_versionsfolder', Storage::DEFAULTFOLDER);
// check for old versions
$matches=glob($versionsfoldername.$filename.'.v*');
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('gallery');
-OC_Gallery_Album::create(OC_User::getUser(), $_GET['album_name']);
+OC_Gallery_Album::create(OCP\USER::getUser(), $_GET['album_name']);
OC_JSON::success(array('name' => $_GET['album_name']));
OC_JSON::checkAppEnabled('gallery');
function handleRename($oldname, $newname) {
- OC_Gallery_Album::rename($oldname, $newname, OC_User::getUser());
+ OC_Gallery_Album::rename($oldname, $newname, OCP\USER::getUser());
OC_Gallery_Album::changeThumbnailPath($oldname, $newname);
}
function handleRemove($name) {
- $album_id = OC_Gallery_Album::find(OC_User::getUser(), $name);
+ $album_id = OC_Gallery_Album::find(OCP\USER::getUser(), $name);
$album_id = $album_id->fetchRow();
$album_id = $album_id['album_id'];
- OC_Gallery_Album::remove(OC_User::getUser(), $name);
+ OC_Gallery_Album::remove(OCP\USER::getUser(), $name);
OC_Gallery_Photo::removeByAlbumId($album_id);
}
return;
}
- $current_root = OC_Preferences::getValue(OC_User::getUser(),'gallery', 'root', '/');
+ $current_root = OC_Preferences::getValue(OCP\USER::getUser(),'gallery', 'root', '/');
$root = trim($root);
$root = rtrim($root, '/').'/';
$rescan = $current_root==$root?'no':'yes';
- OC_Preferences::setValue(OC_User::getUser(), 'gallery', 'root', $root);
- OC_Preferences::setValue(OC_User::getUser(), 'gallery', 'order', $order);
+ OC_Preferences::setValue(OCP\USER::getUser(), 'gallery', 'root', $root);
+ OC_Preferences::setValue(OCP\USER::getUser(), 'gallery', 'order', $order);
OC_JSON::success(array('rescan' => $rescan));
}
function handleGetGallery($path) {
$a = array();
- $root = OC_Preferences::getValue(OC_User::getUser(),'gallery', 'root', '/');
+ $root = OC_Preferences::getValue(OCP\USER::getUser(),'gallery', 'root', '/');
$path = utf8_decode(rtrim($root.$path,'/'));
if($path == '') $path = '/';
$pathLen = strlen($path);
- $result = OC_Gallery_Album::find(OC_User::getUser(), null, $path);
+ $result = OC_Gallery_Album::find(OCP\USER::getUser(), null, $path);
$album_details = $result->fetchRow();
- $result = OC_Gallery_Album::find(OC_User::getUser(), null, null, $path);
+ $result = OC_Gallery_Album::find(OCP\USER::getUser(), null, null, $path);
while ($r = $result->fetchRow()) {
$album_name = $r['album_name'];
function handleShare($path, $share, $recursive) {
$recursive = $recursive == 'true' ? 1 : 0;
- $owner = OC_User::getUser();
- $root = OC_Preferences::getValue(OC_User::getUser(),'gallery', 'root', '/');
+ $owner = OCP\USER::getUser();
+ $root = OC_Preferences::getValue(OCP\USER::getUser(),'gallery', 'root', '/');
$path = utf8_decode(rtrim($root.$path,'/'));
if($path == '') $path = '/';
$r = OC_Gallery_Album::find($owner, null, $path);
class OC_GallerySearchProvider extends OC_Search_Provider{
function search($query){
$stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE uid_owner = ? AND album_name LIKE ?');
- $result = $stmt->execute(array(OC_User::getUser(),'%'.$query.'%'));
+ $result = $stmt->execute(array(OCP\USER::getUser(),'%'.$query.'%'));
$results=array();
while($row=$result->fetchRow()){
$results[]=new OC_Search_Result($row['album_name'],'',OC_Helper::linkTo('gallery', 'index.php').'?view='.$row['album_name'],'Galleries');
OC_Util::checkAppEnabled('gallery');
OC_App::setActiveNavigationEntry( 'gallery_index' );
-if (!file_exists(OC_Config::getValue("datadirectory").'/'. OC_User::getUser() .'/gallery')) {
- mkdir(OC_Config::getValue("datadirectory").'/'. OC_User::getUser() .'/gallery');
+if (!file_exists(OC_Config::getValue("datadirectory").'/'. OCP\USER::getUser() .'/gallery')) {
+ mkdir(OC_Config::getValue("datadirectory").'/'. OCP\USER::getUser() .'/gallery');
}
if (!isset($_GET['view'])) {
- $result = OC_Gallery_Album::find(OC_User::getUser());
+ $result = OC_Gallery_Album::find(OCP\USER::getUser());
$r = array();
while ($row = $result->fetchRow())
$tmpl->assign('r', $r);
$tmpl->printPage();
} else {
- $result = OC_Gallery_Photo::findForAlbum(OC_User::getUser(), $_GET['view']);
+ $result = OC_Gallery_Photo::findForAlbum(OCP\USER::getUser(), $_GET['view']);
$photos = array();
while ($p = $result->fetchRow())
}
public static function cleanup() {
- $albums = self::find(OC_User::getUser());
+ $albums = self::find(OCP\USER::getUser());
while ($r = $albums->fetchRow()) {
OC_Gallery_Photo::removeByAlbumId($r['album_id']);
- self::remove(OC_User::getUser(), $r['album_name']);
+ self::remove(OCP\USER::getUser(), $r['album_name']);
}
}
$path .= '%';
$sql = 'SELECT COUNT(*) as size FROM *PREFIX*gallery_photos photos, *PREFIX*gallery_albums albums WHERE photos.album_id = albums.album_id AND uid_owner = ? AND file_path LIKE ?';
$stmt = OC_DB::prepare($sql);
- $result = $stmt->execute(array(OC_User::getUser(), $path))->fetchRow();
+ $result = $stmt->execute(array(OCP\USER::getUser(), $path))->fetchRow();
return $result['size'];
}
}
$new_album_name = 'main';
OCP\Util::writeLog(self::$APP_TAG, 'Creating new album '.$new_album_name, OCP\Util::DEBUG);
- OC_Gallery_Album::create(OC_User::getUser(), $new_album_name, $path);
+ OC_Gallery_Album::create(OCP\USER::getUser(), $new_album_name, $path);
- return OC_Gallery_Album::find(OC_User::getUser(), null, $path);
+ return OC_Gallery_Album::find(OCP\USER::getUser(), null, $path);
}
public static function pathInRoot($path) {
- $root = OC_Preferences::getValue(OC_User::getUser(), 'gallery', 'root', '/');
+ $root = OC_Preferences::getValue(OCP\USER::getUser(), 'gallery', 'root', '/');
return substr($path, 0, strlen($path)>strlen($root)?strlen($root):strlen($path)) == $root;
}
if (!self::isPhoto($fullpath)) return;
- $a = OC_Gallery_Album::find(OC_User::getUser(), null, dirname($fullpath));
+ $a = OC_Gallery_Album::find(OCP\USER::getUser(), null, dirname($fullpath));
if (!($r = $a->fetchRow())) {
- OC_Gallery_Album::create(OC_User::getUser(), basename(dirname($fullpath)), dirname($fullpath));
- $a = OC_Gallery_Album::find(OC_User::getUser(), null, dirname($fullpath));
+ OC_Gallery_Album::create(OCP\USER::getUser(), basename(dirname($fullpath)), dirname($fullpath));
+ $a = OC_Gallery_Album::find(OCP\USER::getUser(), null, dirname($fullpath));
$r = $a->fetchRow();
}
$albumId = $r['album_id'];
$fullpath = rtrim(dirname($fullpath),'/').'/'.basename($fullpath);
if (OC_Filesystem::is_dir($fullpath)) {
- OC_Gallery_Album::remove(OC_User::getUser(), null, $fullpath);
+ OC_Gallery_Album::remove(OCP\USER::getUser(), null, $fullpath);
} elseif (self::isPhoto($fullpath)) {
- $a = OC_Gallery_Album::find(OC_User::getUser(), null, rtrim(dirname($fullpath),'/'));
+ $a = OC_Gallery_Album::find(OCP\USER::getUser(), null, rtrim(dirname($fullpath),'/'));
if (($r = $a->fetchRow())) {
OC_Gallery_Photo::removeByPath($fullpath, $r['album_id']);
- $p = OC_Gallery_Photo::findForAlbum(OC_User::getUser(), $r['album_name']);
+ $p = OC_Gallery_Photo::findForAlbum(OCP\USER::getUser(), $r['album_name']);
if (!($p->fetchRow())) {
- OC_Gallery_Album::remove(OC_User::getUser(), null, dirname($fullpath));
+ OC_Gallery_Album::remove(OCP\USER::getUser(), null, dirname($fullpath));
}
}
}
$oldpath = $params[OC_Filesystem::signal_param_oldpath];
$newpath = $params[OC_Filesystem::signal_param_newpath];
if (OC_Filesystem::is_dir($newpath.'/') && self::directoryContainsPhotos($newpath)) {
- OC_Gallery_Album::changePath($oldpath, $newpath, OC_User::getUser());
+ OC_Gallery_Album::changePath($oldpath, $newpath, OCP\USER::getUser());
} elseif (self::isPhoto($newpath)) {
$olddir = dirname($oldpath);
$newdir = dirname($newpath);
$oldAlbumId;
if ($olddir == $newdir) {
// album changing is not needed
- $albums = OC_Gallery_Album::find(OC_User::getUser(), null, $olddir);
+ $albums = OC_Gallery_Album::find(OCP\USER::getUser(), null, $olddir);
$album = $albums->fetchRow();
if (!$album) {
$albums = self::createAlbum($newdir);
}
$newAlbumId = $oldAlbumId = $album['album_id'];
} else {
- $newalbum = OC_Gallery_Album::find(OC_User::getUser(), null, $newdir);
- $oldalbum = OC_Gallery_Album::find(OC_User::getUser(), null, $olddir);
+ $newalbum = OC_Gallery_Album::find(OCP\USER::getUser(), null, $newdir);
+ $oldalbum = OC_Gallery_Album::find(OCP\USER::getUser(), null, $olddir);
if (!($newalbum = $newalbum->fetchRow())) {
$newalbum = self::createAlbum($newdir);
}
public static function getThumbnail($image_name, $owner = null) {
- if (!$owner) $owner = OC_User::getUser();
+ if (!$owner) $owner = OCP\USER::getUser();
$save_dir = OC_Config::getValue("datadirectory").'/'. $owner .'/gallery/';
$save_dir .= dirname($image_name). '/';
$image_path = $image_name;
}
public static function getGalleryRoot() {
- return OC_Preferences::getValue(OC_User::getUser(), 'gallery', 'root', '');
+ return OC_Preferences::getValue(OCP\USER::getUser(), 'gallery', 'root', '');
}
}
class OC_Gallery_Scanner {
public static function getGalleryRoot() {
- return OC_Preferences::getValue(OC_User::getUser(), 'gallery', 'root', '/');
+ return OC_Preferences::getValue(OCP\USER::getUser(), 'gallery', 'root', '/');
}
public static function getScanningRoot() {
return OC_Filesystem::getRoot().self::getGalleryRoot();
public static function scan($eventSource) {
$paths = self::findPaths();
$eventSource->send('count', count($paths)+1);
- $owner = OC_User::getUser();
+ $owner = OCP\USER::getUser();
foreach ($paths as $path) {
$name = self::createName($path);
$images = self::findFiles($path);
$image->destroy();
}
}
- imagepng($thumbnail, OC_Config::getValue("datadirectory").'/'. OC_User::getUser() .'/gallery/' . $albumName.'.png');
+ imagepng($thumbnail, OC_Config::getValue("datadirectory").'/'. OCP\USER::getUser() .'/gallery/' . $albumName.'.png');
imagedestroy($thumbnail);
}
$p = $paths[$i-1];
foreach ($a as $e) {
$p .= ($p == '/'?'':'/').$e;
- OC_Gallery_Album::create(OC_User::getUser(), $e, $p);
+ OC_Gallery_Album::create(OCP\USER::getUser(), $e, $p);
$arr = OC_FileCache::searchByMime('image','', OC_Filesystem::getRoot().$p);
$step = floor(count($arr)/10);
if ($step == 0) $step = 1;
OCP\Util::addStyle( 'files_imageviewer', 'jquery.fancybox-1.3.4' );
$l = OC_L10N::get('gallery');
?>
-<script type="text/javascript">var gallery_scanning_root='<? echo OC_Preferences::getValue(OC_User::getUser(), 'gallery', 'root', '/'); ?>'; var gallery_default_order = '<? echo OC_Preferences::getValue(OC_User::getUser(), 'gallery', 'order', 'ASC'); ?>';</script>
+<script type="text/javascript">var gallery_scanning_root='<? echo OC_Preferences::getValue(OCP\USER::getUser(), 'gallery', 'root', '/'); ?>'; var gallery_default_order = '<? echo OC_Preferences::getValue(OCP\USER::getUser(), 'gallery', 'order', 'ASC'); ?>';</script>
<div id="controls">
<div id="scan">
<div id="scanprogressbar"></div>
if(!isset($arguments['search'])){
$arguments['search']='';
}
-OC_MEDIA_COLLECTION::$uid=OC_User::getUser();
+OC_MEDIA_COLLECTION::$uid=OCP\USER::getUser();
if($arguments['action']){
switch($arguments['action']){
case 'delete':
$path=$arguments['path'];
OC_MEDIA_COLLECTION::deleteSongByPath($path);
- $paths=explode(PATH_SEPARATOR,OC_Preferences::getValue(OC_User::getUser(),'media','paths',''));
+ $paths=explode(PATH_SEPARATOR,OC_Preferences::getValue(OCP\USER::getUser(),'media','paths',''));
if(array_search($path,$paths)!==false){
unset($paths[array_search($path,$paths)]);
- OC_Preferences::setValue(OC_User::getUser(),'media','paths',implode(PATH_SEPARATOR,$paths));
+ OC_Preferences::setValue(OCP\USER::getUser(),'media','paths',implode(PATH_SEPARATOR,$paths));
}
case 'get_collection':
$data=array();
$autoUpdate=(isset($_GET['autoupdate']) and $_GET['autoupdate']=='true');
-OC_Preferences::setValue(OC_User::getUser(),'media','autoupdate',(integer)$autoUpdate);
+OC_Preferences::setValue(OCP\USER::getUser(),'media','autoupdate',(integer)$autoUpdate);
OC_JSON::success(array('data' => $autoUpdate));
?>
if($name=='' or $path==''){
return 0;
}
- $uid=OC_User::getUser();
+ $uid=OCP\USER::getUser();
//check if the song is already in the database
$songId=self::getSongId($name,$artist,$album);
if($songId!=0){
$categories=$v;
}
}
- $currUser = OC_User::getUser();
+ $currUser = OCP\USER::getUser();
if($currUser == $ownCloudUser) {
if(isset($_POST['allow'])) {
//TODO: check if this can be faked by editing the cookie in firebug!
}
public static function getAllTokens() {
- $user=OC_User::getUser();
+ $user=OCP\USER::getUser();
$query=OC_DB::prepare("SELECT token,appUrl,category FROM *PREFIX*authtoken WHERE user=? LIMIT 100");
$result=$query->execute(array($user));
$ret = array();
}
public static function deleteToken($token) {
- $user=OC_User::getUser();
+ $user=OCP\USER::getUser();
$query=OC_DB::prepare("DELETE FROM *PREFIX*authtoken WHERE token=? AND user=?");
$result=$query->execute(array($token,$user));
return 'unknown';//how can we see if any rows were affected?
}
private static function addToken($token, $appUrl, $categories){
- $user=OC_User::getUser();
+ $user=OCP\USER::getUser();
$query=OC_DB::prepare("INSERT INTO *PREFIX*authtoken (`token`,`appUrl`,`user`,`category`) VALUES(?,?,?,?)");
$result=$query->execute(array($token,$appUrl,$user,$categories));
}
public static function createCategories($appUrl, $categories) {
$token=uniqid();
- OC_Util::setupFS(OC_User::getUser());
+ OC_Util::setupFS(OCP\USER::getUser());
self::addToken($token, $appUrl, $categories);
foreach(explode(',', $categories) as $category) {
//TODO: input checking on $category
<?php
echo '<img src="../apps/remoteStorage/remoteStorage.png" style="width:16px"> '
.'<strong>'.$l->t('remoteStorage').'</strong> user address: '
- .OC_User::getUser().'@'.$_SERVER['SERVER_NAME']
+ .OCP\USER::getUser().'@'.$_SERVER['SERVER_NAME']
.' (<a href="http://unhosted.org/">more info</a>)';
?>
<p><em>Apps that currently have access to your ownCloud:</em></p>
OC_Util::checkAppEnabled('user_migrate');
// Which operation
if( $_GET['operation']=='create' ){
- $uid = !empty( $_POST['uid'] ) ? $_POST['uid'] : OC_User::getUser();
- if( $uid != OC_User::getUser() ){
+ $uid = !empty( $_POST['uid'] ) ? $_POST['uid'] : OCP\USER::getUser();
+ if( $uid != OCP\USER::getUser() ){
// Needs to be admin to export someone elses account
OC_JSON::error();
die();
<?php
$tmpl = new OC_Template( 'user_openid', 'settings');
-$identity=OC_Preferences::getValue(OC_User::getUser(),'user_openid','identity','');
+$identity=OC_Preferences::getValue(OCP\USER::getUser(),'user_openid','identity','');
$tmpl->assign('identity',$identity);
OC_Util::addScript('user_openid','settings');
<form id="openidform">
<fieldset class="personalblock">
<strong>OpenID</strong>
- <?php echo ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http').'://'.OC_Helper::serverHost().OC::$WEBROOT.'/?'; echo OC_User::getUser(); ?><br /><em><?php echo $l->t('you can authenticate to other sites with this address');?></em><br />
+ <?php echo ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http').'://'.OC_Helper::serverHost().OC::$WEBROOT.'/?'; echo OCP\USER::getUser(); ?><br /><em><?php echo $l->t('you can authenticate to other sites with this address');?></em><br />
<label for="identity"><?php echo $l->t('Authorized OpenID provider');?></label>
<input type="text" name="identity" id="identity" value="<?php echo $_['identity']; ?>" placeholder="<?php echo $l->t('Your address at Wordpress, Identi.ca, …');?>" /><span class="msg"></span>
</fieldset>