diff --git a/apps/calendar/appinfo/app.php b/apps/calendar/appinfo/app.php
index 06fb92577359c5175923747fa3f524238e8c333d..0c91bf8f135b01e004de13d07fe0e8c6d71581a1 100755
--- a/apps/calendar/appinfo/app.php
+++ b/apps/calendar/appinfo/app.php
@@ -24,4 +24,4 @@ OCP\App::addNavigationEntry( array(
 OCP\App::registerPersonal('calendar', 'settings');
 OC_Search::registerProvider('OC_Search_Provider_Calendar');
 OCP\CONFIG::setAppValue('core', 'remote_caldav', '/apps/calendar/appinfo/remote.php');
-OCP\CONFIG::setAppValue('core', 'public_calendar', '/apps/calendar/appinfo/share.php');
\ No newline at end of file
+OCP\CONFIG::setAppValue('core', 'public_calendar', '/apps/calendar/share.php');
\ No newline at end of file
diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js
index a16856938ce0b43cb893491e907a24d5fe1702dc..b3beb8d44cb9364aa730f4886622547c8c5460f4 100644
--- a/apps/calendar/js/calendar.js
+++ b/apps/calendar/js/calendar.js
@@ -517,7 +517,10 @@ Calendar={
 			},
 			share:function(id, idtype, sharewith, sharetype){
 				$.getJSON(OC.filePath('calendar', 'ajax/share', 'share.php'),{id:id, idtype:idtype, sharewith:sharewith, sharetype:sharetype}, function(data){
-
+					if(sharetype == 'public'){
+						$('#public_token').val(parent.location.protocol+'//'+location.host+OC.linkTo('', 'public.php')+'?service=calendar&t='+data.message);
+						$('#public_token').css('display', 'block');
+					}
 				});
 			},
 			unshare:function(id, idtype, sharewith, sharetype){
diff --git a/apps/calendar/share.php b/apps/calendar/share.php
index 1cc8a2ef15edd9708cc73f9ba3edc5fff45e3dd8..68c7d0ffae28013b156ff2af4249bb3cfc7e67a9 100644
--- a/apps/calendar/share.php
+++ b/apps/calendar/share.php
@@ -1,5 +1,4 @@
 <?php
-require_once('../../lib/base.php');
 $token = strip_tags($_GET['t']);
 $shared = OC_Calendar_Share::getElementByToken($token);
 $nl = "\n\r";
diff --git a/apps/calendar/templates/share.dropdown.php b/apps/calendar/templates/share.dropdown.php
index e0dabebf257426cdacc7591711f1f47382aedd8f..0796a880f1faeda97656bbc8398771d122c5a23f 100755
--- a/apps/calendar/templates/share.dropdown.php
+++ b/apps/calendar/templates/share.dropdown.php
@@ -73,5 +73,5 @@ echo OCP\html_select_options($allgroups, array());
 </ul>
 <div id="public">
 	<input type="checkbox" id="publish" <?php echo ($public['share'])?'checked="checked"':'' ?>><label for="publish"><?php echo $l->t('make public'); ?></label><br>
-	<input type="text" id="public_token" value="<?php echo OCP\Util::linkToAbsolute('apps/calendar', 'share.php?t=' . $public['share'], null, true) ; ?>" onmouseover="$('#public_token').select();" style="<?php echo (!$public['share'])?'display:none':'' ?>">
+	<input type="text" id="public_token" value="<?php echo OCP\Util::linkToAbsolute('', 'public.php?service=calendar&t=' . $public['share'], null, true) ; ?>" onmouseover="$('#public_token').select();" style="<?php echo (!$public['share'])?'display:none':'' ?>">
 </div>
\ No newline at end of file