aboutsummaryrefslogtreecommitdiffstats
path: root/apps/calendar
diff options
context:
space:
mode:
authorGeorg Ehrke <dev@georgswebsite.de>2012-06-01 11:40:39 +0200
committerGeorg Ehrke <dev@georgswebsite.de>2012-06-01 11:40:39 +0200
commite75146a811e3320378ec0d35dd7ce39d8189a688 (patch)
treeaefc89d997a6d7d6b0c3273823dc483b6f9f0dd7 /apps/calendar
parent7a8e3226793aebdbd4bcf12ef6c7d020c8cd378d (diff)
parent83c6714c723a1e224f2477192ca88bd6144b76e7 (diff)
downloadnextcloud-server-e75146a811e3320378ec0d35dd7ce39d8189a688.tar.gz
nextcloud-server-e75146a811e3320378ec0d35dd7ce39d8189a688.zip
Merge branch 'master' into calendar_repeat
Diffstat (limited to 'apps/calendar')
-rw-r--r--apps/calendar/ajax/import/import.php39
-rw-r--r--apps/calendar/appinfo/app.php4
-rw-r--r--apps/calendar/templates/part.choosecalendar.rowfields.php2
-rw-r--r--apps/calendar/templates/part.choosecalendar.rowfields.shared.php2
4 files changed, 17 insertions, 30 deletions
diff --git a/apps/calendar/ajax/import/import.php b/apps/calendar/ajax/import/import.php
index 202af1eb46e..904c07c52e7 100644
--- a/apps/calendar/ajax/import/import.php
+++ b/apps/calendar/ajax/import/import.php
@@ -7,16 +7,23 @@
*/
//check for calendar rights or create new one
ob_start();
+
OCP\JSON::checkLoggedIn();
OCP\App::checkAppEnabled('calendar');
+
$nl="\r\n";
$comps = array('VEVENT'=>true, 'VTODO'=>true, 'VJOURNAL'=>true);
+
$progressfile = 'import_tmp/' . md5(session_id()) . '.txt';
-if(is_writable('import_tmp/')){
- $progressfopen = fopen($progressfile, 'w');
- fwrite($progressfopen, '10');
- fclose($progressfopen);
+
+function writeProgress($pct) {
+ if(is_writable('import_tmp/')){
+ $progressfopen = fopen($progressfile, 'w');
+ fwrite($progressfopen, $pct);
+ fclose($progressfopen);
+ }
}
+writeProgress('10');
$file = OC_Filesystem::file_get_contents($_POST['path'] . '/' . $_POST['file']);
if($_POST['method'] == 'new'){
$id = OC_Calendar_Calendar::addCalendar(OCP\USER::getUser(), $_POST['calname']);
@@ -29,20 +36,12 @@ if($_POST['method'] == 'new'){
}
$id = $_POST['id'];
}
-if(is_writable('import_tmp/')){
- $progressfopen = fopen($progressfile, 'w');
- fwrite($progressfopen, '20');
- fclose($progressfopen);
-}
+writeProgress('20');
// normalize the newlines
$file = str_replace(array("\r","\n\n"), array("\n","\n"), $file);
$lines = explode("\n", $file);
unset($file);
-if(is_writable('import_tmp/')){
- $progressfopen = fopen($progressfile, 'w');
- fwrite($progressfopen, '30');
- fclose($progressfopen);
-}
+writeProgress('30');
// analyze the file, group components by uid, and keep refs to originating calendar object
// $cals is array calendar objects, keys are 1st line# $cal, ie array( $cal => $caldata )
// $caldata is array( 'first' => 1st component line#, 'last' => last comp line#, 'end' => end line# )
@@ -86,11 +85,7 @@ foreach($lines as $line) {
$i++;
}
// import the calendar
-if(is_writable('import_tmp/')){
- $progressfopen = fopen($progressfile, 'w');
- fwrite($progressfopen, '60');
- fclose($progressfopen);
-}
+writeProgress('60');
foreach($uids as $uid) {
$prefix=$suffix=$content=array();
@@ -117,11 +112,7 @@ foreach($uids as $uid) {
}
}
// finished import
-if(is_writable('import_tmp/')){
- $progressfopen = fopen($progressfile, 'w');
- fwrite($progressfopen, '100');
- fclose($progressfopen);
-}
+writeProgress('100');
sleep(3);
if(is_writable('import_tmp/')){
unlink($progressfile);
diff --git a/apps/calendar/appinfo/app.php b/apps/calendar/appinfo/app.php
index 73480522eaf..253844c1f08 100644
--- a/apps/calendar/appinfo/app.php
+++ b/apps/calendar/appinfo/app.php
@@ -12,10 +12,6 @@ OCP\Util::connectHook('OC_User', 'post_deleteUser', 'OC_Calendar_Hooks', 'delete
OCP\Util::addscript('calendar','loader');
OCP\Util::addscript("3rdparty", "chosen/chosen.jquery.min");
OCP\Util::addStyle("3rdparty", "chosen/chosen");
-OCP\App::register( array(
- 'order' => 10,
- 'id' => 'calendar',
- 'name' => 'Calendar' ));
OCP\App::addNavigationEntry( array(
'id' => 'calendar_index',
'order' => 10,
diff --git a/apps/calendar/templates/part.choosecalendar.rowfields.php b/apps/calendar/templates/part.choosecalendar.rowfields.php
index 965523f847a..bad268897bf 100644
--- a/apps/calendar/templates/part.choosecalendar.rowfields.php
+++ b/apps/calendar/templates/part.choosecalendar.rowfields.php
@@ -1,6 +1,6 @@
<?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="' . OCP\USER::getUser() . '_' . $_['calendar']['id'] . '"><label for="active_' . $_['calendar']['id'] . '">' . $_['calendar']['displayname'] . '</label></td>';
+echo '<td id="' . OCP\USER::getUser() . '_' . $_['calendar']['id'] . '"><label for="active_' . $_['calendar']['id'] . '">' . htmlspecialchars($_['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']) ? OCP\Util::imagePath('core', 'actions/share.svg') : OCP\Util::imagePath('core', '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="'.OCP\Util::imagePath('core', 'actions/public.svg').'"></a></td>';
echo '<td width="20px"><a href="?app=calendar&getfile=export.php?calid=' . $_['calendar']['id'] . '" title="' . $l->t('Download') . '" class="action"><img class="svg action" src="'.OCP\Util::imagePath('core', 'actions/download.svg').'"></a></td>';
diff --git a/apps/calendar/templates/part.choosecalendar.rowfields.shared.php b/apps/calendar/templates/part.choosecalendar.rowfields.shared.php
index a23266da0c3..6a212858a21 100644
--- a/apps/calendar/templates/part.choosecalendar.rowfields.shared.php
+++ b/apps/calendar/templates/part.choosecalendar.rowfields.shared.php
@@ -1,4 +1,4 @@
<?php
echo '<td width="20px"><input id="active_' . $_['share']['owner'] . '_' . $_['share']['calendar']['id'] . '" type="checkbox" onClick="Calendar.UI.Share.activation(this,\'' . $_['share']['owner'] . '\',' . $_['share']['calendar']['id'] . ')"' . ($_['share']['active'] ? ' checked="checked"' : '') . '></td>';
-echo '<td><label for="active_' . $_['share']['owner'] . '_' . $_['share']['calendar']['id'] . '">' . $_['share']['calendar']['displayname'] . '</label></td>';
+echo '<td><label for="active_' . $_['share']['owner'] . '_' . $_['share']['calendar']['id'] . '">' . htmlspecialchars($_['share']['calendar']['displayname']) . '</label></td>';
echo '<td style="font-style: italic;">' . $l->t('shared with you by') . ' ' . $_['share']['owner'] . '</td>'; \ No newline at end of file