ported getUser

This commit is contained in:
Frank Karlitschek 2012-05-01 18:50:31 +02:00
parent dc7cdda5cc
commit 70cea18cce
80 changed files with 183 additions and 183 deletions

2
apps/bookmarks/ajax/delBookmark.php Normal file → Executable file
View File

@ -32,7 +32,7 @@ OC_JSON::checkAppEnabled('bookmarks');
$params=array(
htmlspecialchars_decode($_GET["url"]),
OC_User::getUser()
OCP\USER::getUser()
);
$query = OC_DB::prepare("

2
apps/bookmarks/ajax/recordClick.php Normal file → Executable file
View File

@ -37,7 +37,7 @@ $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" );

2
apps/bookmarks/bookmarksHelper.php Normal file → Executable file
View File

@ -101,7 +101,7 @@ function addBookmark($url, $title, $tags='') {
$params=array(
htmlspecialchars_decode($url),
htmlspecialchars_decode($title),
OC_User::getUser()
OCP\USER::getUser()
);
$query->execute($params);

View File

@ -37,7 +37,7 @@ class OC_Bookmarks_Bookmarks{
//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 = ', \' \'';

4
apps/calendar/ajax/calendar/new.php Normal file → Executable file
View File

@ -16,7 +16,7 @@ if(trim($_POST['name']) == ''){
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'));
@ -24,7 +24,7 @@ foreach($calendars as $cal){
}
}
$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);

2
apps/calendar/ajax/calendar/update.php Normal file → Executable file
View File

@ -16,7 +16,7 @@ if(trim($_POST['name']) == ''){
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'));

View File

@ -23,7 +23,7 @@ function debug($msg) {
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.'));
}

2
apps/calendar/ajax/changeview.php Normal file → Executable file
View File

@ -17,6 +17,6 @@ switch($view){
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();
?>

2
apps/calendar/ajax/event/edit.form.php Normal file → Executable file
View File

@ -189,7 +189,7 @@ if($data['repeating'] == 1){
$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));
}

6
apps/calendar/ajax/event/new.form.php Normal file → Executable file
View File

@ -22,16 +22,16 @@ $end = $_POST['end'];
$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();

4
apps/calendar/ajax/import/import.php Normal file → Executable file
View File

@ -19,11 +19,11 @@ if(is_writable('import_tmp/')){
}
$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();
}

2
apps/calendar/ajax/settings/getfirstday.php Normal file → Executable file
View File

@ -7,6 +7,6 @@
*/
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));
?>

2
apps/calendar/ajax/settings/gettimezonedetection.php Normal file → Executable file
View File

@ -8,4 +8,4 @@
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
OC_JSON::success(array('detection' => OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezonedetection')));
OC_JSON::success(array('detection' => OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timezonedetection')));

4
apps/calendar/ajax/settings/guesstimezone.php Normal file → Executable file
View File

@ -17,11 +17,11 @@ $lng = $_GET['long'];
$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);
?>

2
apps/calendar/ajax/settings/setfirstday.php Normal file → Executable file
View File

@ -8,7 +8,7 @@
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();

2
apps/calendar/ajax/settings/settimeformat.php Normal file → Executable file
View File

@ -8,7 +8,7 @@
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();

2
apps/calendar/ajax/settings/settimezone.php Normal file → Executable file
View File

@ -18,7 +18,7 @@ OC_JSON::checkAppEnabled('calendar');
// 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') )));

2
apps/calendar/ajax/settings/timeformat.php Normal file → Executable file
View File

@ -7,6 +7,6 @@
*/
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));
?>

4
apps/calendar/ajax/settings/timezonedetection.php Normal file → Executable file
View File

@ -10,9 +10,9 @@ OC_JSON::checkLoggedIn();
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{

2
apps/calendar/ajax/share/activation.php Normal file → Executable file
View File

@ -8,5 +8,5 @@
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();

2
apps/calendar/ajax/share/dropdown.php Normal file → Executable file
View File

@ -6,7 +6,7 @@
* 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){

4
apps/calendar/ajax/share/share.php Normal file → Executable file
View File

@ -43,10 +43,10 @@ if($sharetype == 'group' && !OC_Group::groupExists($sharewith)){
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));

2
apps/calendar/ajax/share/unshare.php Normal file → Executable file
View File

@ -34,7 +34,7 @@ if($sharetype == 'user' && !OC_User::userExists($sharewith)){
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{

20
apps/calendar/index.php Normal file → Executable file
View File

@ -11,10 +11,10 @@ OC_Util::checkLoggedIn();
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();
@ -29,21 +29,21 @@ OC_Hook::emit('OC_Calendar', 'getSources', array('sources' => &$eventSources));
$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');

28
apps/calendar/lib/app.php Normal file → Executable file
View File

@ -9,7 +9,7 @@
* 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';
@ -38,12 +38,12 @@ class OC_Calendar_App{
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;
}
}
@ -63,13 +63,13 @@ class OC_Calendar_App{
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;
}
}
@ -164,7 +164,7 @@ class OC_Calendar_App{
*/
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) {
@ -278,12 +278,12 @@ class OC_Calendar_App{
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{
@ -293,12 +293,12 @@ class OC_Calendar_App{
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{
@ -320,12 +320,12 @@ class OC_Calendar_App{
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;

2
apps/calendar/lib/object.php Normal file → Executable file
View File

@ -761,7 +761,7 @@ class OC_Calendar_Object{
$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);

4
apps/calendar/lib/search.php Normal file → Executable file
View File

@ -1,7 +1,7 @@
<?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;
}
@ -12,7 +12,7 @@ class OC_Search_Provider_Calendar extends OC_Search_Provider{
}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']);

2
apps/calendar/settings.php Normal file → Executable file
View File

@ -7,7 +7,7 @@
*/
$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());

8
apps/calendar/templates/calendar.php Normal file → Executable file
View File

@ -1,13 +1,13 @@
<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')) ?>';
@ -20,7 +20,7 @@
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', $_)){

4
apps/calendar/templates/part.choosecalendar.php Normal file → Executable file
View File

@ -2,7 +2,7 @@
<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');
@ -31,7 +31,7 @@ for($i = 0; $i < count($option_calendars); $i++){
<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);

View File

@ -1,8 +1,8 @@
<?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>';

2
apps/calendar/templates/part.import.php Normal file → Executable file
View File

@ -6,7 +6,7 @@
<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'));
?>

4
apps/calendar/templates/share.dropdown.php Normal file → Executable file
View File

@ -21,12 +21,12 @@ foreach($sharedelements as $sharedelement){
<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());
?>

View File

@ -31,7 +31,7 @@ if(is_null($categories)) {
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.'));
}

View File

@ -23,7 +23,7 @@ function debug($msg) {
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.'));
}

2
apps/contacts/ajax/contacts.php Normal file → Executable file
View File

@ -10,7 +10,7 @@
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);

View File

@ -12,7 +12,7 @@
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.'))));

View File

@ -33,7 +33,7 @@ if($id) {
$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();

View File

@ -30,7 +30,7 @@ if(!$file) {
}
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'];

4
apps/contacts/index.php Normal file → Executable file
View File

@ -13,10 +13,10 @@ OC_Util::checkLoggedIn();
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' );

View File

@ -166,7 +166,7 @@ class OC_Contacts_Addressbook{
*/
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){
@ -235,7 +235,7 @@ class OC_Contacts_Addressbook{
$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;
}

View File

@ -17,13 +17,13 @@ class OC_Contacts_App {
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();
@ -145,7 +145,7 @@ class OC_Contacts_App {
*/
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) {

2
apps/contacts/lib/hooks.php Normal file → Executable file
View File

@ -41,7 +41,7 @@ class OC_Contacts_Hooks{
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'],

2
apps/contacts/lib/search.php Normal file → Executable file
View File

@ -1,7 +1,7 @@
<?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;
// }

2
apps/contacts/templates/index.php Normal file → Executable file
View File

@ -1,7 +1,7 @@
<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>

2
apps/contacts/templates/part.chooseaddressbook.php Normal file → Executable file
View File

@ -1,7 +1,7 @@
<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');

View File

@ -2,4 +2,4 @@
// 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>";

2
apps/contacts/templates/part.import.php Normal file → Executable file
View File

@ -6,7 +6,7 @@
<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'));
?>

2
apps/contacts/templates/part.importaddressbook.php Normal file → Executable file
View File

@ -13,7 +13,7 @@
<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>

2
apps/contacts/templates/settings.php Normal file → Executable file
View File

@ -6,7 +6,7 @@
<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>

2
apps/files_encryption/lib/crypt.php Normal file → Executable file
View File

@ -92,7 +92,7 @@ class OC_Crypt {
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

2
apps/files_sharing/ajax/email.php Normal file → Executable file
View File

@ -1,7 +1,7 @@
<?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'];

2
apps/files_sharing/ajax/getitem.php Normal file → Executable file
View File

@ -5,7 +5,7 @@
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();

2
apps/files_sharing/ajax/setpermissions.php Normal file → Executable file
View File

@ -5,7 +5,7 @@
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);

View File

@ -5,7 +5,7 @@
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'];

2
apps/files_sharing/ajax/unshare.php Normal file → Executable file
View File

@ -5,7 +5,7 @@
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);

2
apps/files_sharing/ajax/userautocomplete.php Normal file → Executable file
View File

@ -8,7 +8,7 @@ OC_JSON::checkAppEnabled('files_sharing');
$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'>";

View File

@ -39,7 +39,7 @@ class OC_Share {
* @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");
@ -99,7 +99,7 @@ class OC_Share {
}
$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();
@ -145,7 +145,7 @@ class OC_Share {
$in .= ", '".$uid."@".$group."'";
}
} else {
$uid = OC_User::getUser();
$uid = OCP\USER::getUser();
$in .= "'".$uid."'";
$groups = OC_Group::getUserGroups($uid);
foreach ($groups as $group) {
@ -170,7 +170,7 @@ class OC_Share {
$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']));
}
/**
@ -181,7 +181,7 @@ class OC_Share {
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();
}
/**
@ -192,11 +192,11 @@ class OC_Share {
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;
}
@ -208,7 +208,7 @@ class OC_Share {
*/
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();
}
/**
@ -282,7 +282,7 @@ class OC_Share {
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 {
@ -331,7 +331,7 @@ class OC_Share {
*/
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 {
@ -366,7 +366,7 @@ class OC_Share {
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()));
}
/**
@ -380,7 +380,7 @@ class OC_Share {
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()));
}
/**
@ -407,12 +407,12 @@ class OC_Share {
* @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()));
}
}
@ -422,14 +422,14 @@ class OC_Share {
* @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));

2
apps/files_sharing/sharedstorage.php Normal file → Executable file
View File

@ -25,7 +25,7 @@ require_once( 'lib_share.php' );
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

2
apps/files_versions/ajax/getVersions.php Normal file → Executable file
View File

@ -4,7 +4,7 @@ require_once('../../../lib/base.php');
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 );

2
apps/files_versions/ajax/rollbackVersion.php Normal file → Executable file
View File

@ -4,7 +4,7 @@ require_once('../../../lib/base.php');
OC_JSON::checkAppEnabled('files_versions');
require_once('../versions.php');
$userDirectory = "/".OC_User::getUser()."/files";
$userDirectory = "/".OCP\USER::getUser()."/files";
$source = $_GET['source'];

16
apps/files_versions/versions.php Normal file → Executable file
View File

@ -44,7 +44,7 @@ class Storage {
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);
}
@ -69,8 +69,8 @@ class Storage {
*/
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
@ -124,9 +124,9 @@ class Storage {
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) ) {
@ -148,7 +148,7 @@ class Storage {
*/
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*');
@ -169,7 +169,7 @@ class Storage {
*/
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
@ -201,7 +201,7 @@ class Storage {
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*');

2
apps/gallery/ajax/createAlbum.php Normal file → Executable file
View File

@ -25,7 +25,7 @@
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']));

22
apps/gallery/ajax/galleryOp.php Normal file → Executable file
View File

@ -28,15 +28,15 @@ OC_JSON::checkLoggedIn();
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);
}
@ -74,25 +74,25 @@ function handleStoreSettings($root, $order) {
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'];
@ -126,8 +126,8 @@ function handleGetGallery($path) {
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);

2
apps/gallery/appinfo/app.php Normal file → Executable file
View File

@ -44,7 +44,7 @@ OC_App::addNavigationEntry( array(
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');

8
apps/gallery/index.php Normal file → Executable file
View File

@ -27,12 +27,12 @@ OC_Util::checkLoggedIn();
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())
@ -42,7 +42,7 @@ if (!isset($_GET['view'])) {
$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())

6
apps/gallery/lib/album.php Normal file → Executable file
View File

@ -30,10 +30,10 @@ class OC_Gallery_Album {
}
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']);
}
}
@ -108,7 +108,7 @@ class OC_Gallery_Album {
$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'];
}
}

View File

@ -53,13 +53,13 @@ class OC_Gallery_Hooks_Handlers {
$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;
}
@ -69,10 +69,10 @@ class OC_Gallery_Hooks_Handlers {
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'];
@ -86,14 +86,14 @@ class OC_Gallery_Hooks_Handlers {
$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));
}
}
}
@ -103,7 +103,7 @@ class OC_Gallery_Hooks_Handlers {
$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);
@ -116,7 +116,7 @@ class OC_Gallery_Hooks_Handlers {
$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);
@ -124,8 +124,8 @@ class OC_Gallery_Hooks_Handlers {
}
$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);

4
apps/gallery/lib/photo.php Normal file → Executable file
View File

@ -67,7 +67,7 @@ class OC_Gallery_Photo {
}
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;
@ -98,6 +98,6 @@ class OC_Gallery_Photo {
}
public static function getGalleryRoot() {
return OC_Preferences::getValue(OC_User::getUser(), 'gallery', 'root', '');
return OC_Preferences::getValue(OCP\USER::getUser(), 'gallery', 'root', '');
}
}

8
apps/gallery/lib/scanner.php Normal file → Executable file
View File

@ -24,7 +24,7 @@
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();
@ -43,7 +43,7 @@ class OC_Gallery_Scanner {
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);
@ -81,7 +81,7 @@ class OC_Gallery_Scanner {
$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);
}
@ -96,7 +96,7 @@ class OC_Gallery_Scanner {
$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;

2
apps/gallery/templates/index.php Normal file → Executable file
View File

@ -9,7 +9,7 @@ OC_Util::addScript('files_imageviewer', 'jquery.fancybox-1.3.4.pack');
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>

6
apps/media/ajax/api.php Normal file → Executable file
View File

@ -48,16 +48,16 @@ if(!isset($arguments['album'])){
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();

2
apps/media/ajax/autoupdate.php Normal file → Executable file
View File

@ -32,7 +32,7 @@ OC_JSON::checkAppEnabled('media');
$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));
?>

2
apps/media/lib_collection.php Normal file → Executable file
View File

@ -261,7 +261,7 @@ class OC_MEDIA_COLLECTION{
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){

2
apps/remoteStorage/auth.php Normal file → Executable file
View File

@ -56,7 +56,7 @@ if(count($pathParts) == 2 && $pathParts[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!

8
apps/remoteStorage/lib_remoteStorage.php Normal file → Executable file
View File

@ -14,7 +14,7 @@ class OC_remoteStorage {
}
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();
@ -28,19 +28,19 @@ class OC_remoteStorage {
}
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

2
apps/remoteStorage/templates/settings.php Normal file → Executable file
View File

@ -2,7 +2,7 @@
<?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>

4
apps/user_migrate/ajax/export.php Normal file → Executable file
View File

@ -28,8 +28,8 @@ OC_JSON::checkLoggedIn();
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();

2
apps/user_openid/settings.php Normal file → Executable file
View File

@ -1,7 +1,7 @@
<?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');

2
apps/user_openid/templates/settings.php Normal file → Executable file
View File

@ -1,7 +1,7 @@
<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, &hellip;');?>" /><span class="msg"></span>
</fieldset>