From 2c80f618766bb7fefbebca2098b5c4c85cebd028 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 4 Jun 2012 19:18:20 +0200 Subject: [PATCH] Fix problems when friendica is installed in a subpath; small CSS-Fixes --- dav/calendar.friendica.fnk.php | 9 +++++++- dav/common/calendar.fnk.php | 4 ++-- dav/common/wdcal_cal_source.inc.php | 5 ++-- dav/common/wdcal_cal_source_private.inc.php | 11 +++++---- dav/layout.fnk.php | 24 ++++++++++---------- dav/main.php | 14 +++++------- dav/wdcal/css/calendar.css | 6 +++-- dav/wdcal_cal_source_friendicaevents.inc.php | 9 +++++--- 8 files changed, 47 insertions(+), 35 deletions(-) diff --git a/dav/calendar.friendica.fnk.php b/dav/calendar.friendica.fnk.php index 38406e0b..43417fc9 100644 --- a/dav/calendar.friendica.fnk.php +++ b/dav/calendar.friendica.fnk.php @@ -1,8 +1,15 @@ get_baseurl()); +$path = ""; +if (strlen($uri["path"]) > 1) { + $path = $uri["path"] . "/"; +} + define("CALDAV_SQL_DB", ""); define("CALDAV_SQL_PREFIX", "dav_"); -define("CALDAV_URL_PREFIX", "dav/"); +define("CALDAV_URL_PREFIX", $path . "dav/"); define("CALDAV_NAMESPACE_PRIVATE", 1); define("CALDAV_NAMESPACE_FRIENDICA_NATIVE", 2); diff --git a/dav/common/calendar.fnk.php b/dav/common/calendar.fnk.php index 2d899b47..51b7f5e0 100644 --- a/dav/common/calendar.fnk.php +++ b/dav/common/calendar.fnk.php @@ -480,7 +480,7 @@ function wdcal_get_list_range_params($day, $weekstartday, $num_days, $type) /** * */ -function wdcal_print_feed() +function wdcal_print_feed($base_path = "") { $user_id = dav_compat_get_curr_user_id(); $cals = array(); @@ -538,7 +538,7 @@ function wdcal_print_feed() $ret['error'] = null; foreach ($cals as $c) { - $events = $c->listItemsByRange($date[0], $date[1]); + $events = $c->listItemsByRange($date[0], $date[1], $base_path); $ret["events"] = array_merge($ret["events"], $events); } diff --git a/dav/common/wdcal_cal_source.inc.php b/dav/common/wdcal_cal_source.inc.php index dafc2b5c..9db34022 100644 --- a/dav/common/wdcal_cal_source.inc.php +++ b/dav/common/wdcal_cal_source.inc.php @@ -113,9 +113,10 @@ abstract class AnimexxCalSource * @abstract * @param string $sd * @param string $ed + * @param string $base_path * @return array */ - public abstract function listItemsByRange($sd, $ed); + public abstract function listItemsByRange($sd, $ed, $base_path); /** @@ -134,4 +135,4 @@ abstract class AnimexxCalSource return null; } -} \ No newline at end of file +} diff --git a/dav/common/wdcal_cal_source_private.inc.php b/dav/common/wdcal_cal_source_private.inc.php index 46563389..cb5918e1 100644 --- a/dav/common/wdcal_cal_source_private.inc.php +++ b/dav/common/wdcal_cal_source_private.inc.php @@ -249,7 +249,7 @@ class AnimexxCalSourcePrivate extends AnimexxCalSource return $obj_id . ".ics"; } - private function jqcal2wdcal($row, $usr_id) { + private function jqcal2wdcal($row, $usr_id, $base_path) { $evo = new DBClass_friendica_jqcalendar($row); $not = q("SELECT COUNT(*) num FROM %s%snotifications WHERE `ical_uri` = '%s' AND `ical_recurr_uri` = '%s'", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, dbesc($row["ical_uri"]), $row["ical_recurr_uri"] @@ -274,8 +274,8 @@ class AnimexxCalSourcePrivate extends AnimexxCalSource "location" => $evo->Location, "attendees" => '', "has_notification" => ($not[0]["num"] > 0 ? 1 : 0), - "url_detail" => "/dav/wdcal/" . $evo->ical_uri . "/", - "url_edit" => "/dav/wdcal/" . $evo->ical_uri . "/edit/", + "url_detail" => $base_path . $evo->ical_uri . "/", + "url_edit" => $base_path . $evo->ical_uri . "/edit/", "special_type" => "", ); return $arr; @@ -284,9 +284,10 @@ class AnimexxCalSourcePrivate extends AnimexxCalSource /** * @param string $sd * @param string $ed + * @param string $base_path * @return array */ - public function listItemsByRange($sd, $ed) + public function listItemsByRange($sd, $ed, $base_path) { $usr_id = IntVal($this->calendarDb->uid); @@ -300,7 +301,7 @@ class AnimexxCalSourcePrivate extends AnimexxCalSource $usr_id, $this->getNamespace(), $this->namespace_id, dbesc($von), dbesc($bis)); $events = array(); - foreach ($evs as $row) $events[] = $this->jqcal2wdcal($row, $usr_id); + foreach ($evs as $row) $events[] = $this->jqcal2wdcal($row, $usr_id, $base_path); return $events; } diff --git a/dav/layout.fnk.php b/dav/layout.fnk.php index 10bf57ef..a712a09b 100644 --- a/dav/layout.fnk.php +++ b/dav/layout.fnk.php @@ -96,7 +96,7 @@ function wdcal_printCalendar($calendars, $calendar_preselected, $data_feed_url, $x .= '