]> source.dussan.org Git - nextcloud-server.git/commitdiff
apps/calendar: check if variables are set before using them
authorFlorian Pritz <bluewind@xinu.at>
Thu, 22 Sep 2011 15:05:56 +0000 (17:05 +0200)
committerFlorian Pritz <bluewind@xinu.at>
Sat, 24 Sep 2011 16:41:42 +0000 (18:41 +0200)
Signed-off-by: Florian Pritz <bluewind@xinu.at>
apps/calendar/templates/part.eventform.php

index 5b12407330ac46616c87a91a105198e7edd55040..5bb072cc23ba14f5930c0461da194358474a8324 100644 (file)
@@ -2,13 +2,13 @@
                <tr>
                        <th width="75px"><?php echo $l->t("Title");?>:</th>
                        <td>
-                       <input type="text" style="width:350px;" size="100" placeholder="<?php echo $l->t("Title of the Event");?>" value="<?php echo $_['title'] ?>" maxlength="100" name="title"/>
+                       <input type="text" style="width:350px;" size="100" placeholder="<?php echo $l->t("Title of the Event");?>" value="<?php echo isset($_['title']) ? $_['title'] : '' ?>" maxlength="100" name="title"/>
                        </td>
                </tr>
                <tr>
                        <th width="75px"><?php echo $l->t("Location");?>:</th>
                        <td>
-                       <input type="text" style="width:350px;" size="100" placeholder="<?php echo $l->t("Location of the Event");?>" value="<?php echo $_['location'] ?>" maxlength="100"  name="location" />
+                       <input type="text" style="width:350px;" size="100" placeholder="<?php echo $l->t("Location of the Event");?>" value="<?php echo isset($_['location']) ? $_['location'] : '' ?>" maxlength="100"  name="location" />
                        </td>
                </tr>
        </table>
@@ -19,6 +19,7 @@
                        <select id="category" name="categories[]" multiple="multiple" title="<?php echo $l->t("Select category") ?>">
                                <?php
                                foreach($_['category_options'] as $category){
+                                       if (!isset($_['categories'])) {$_['categories'] = array();}
                                        echo '<option value="' . $category . '"' . (in_array($category, $_['categories']) ? ' selected="selected"' : '') . '>' . $category . '</option>';
                                }
                                ?>
@@ -28,6 +29,7 @@
                        <select style="width:140px;" name="calendar">
                                <?php
                                foreach($_['calendar_options'] as $calendar){
+                                       if (!isset($_['calendar'])) {$_['calendar'] = false;}
                                        echo '<option value="' . $calendar['id'] . '"' . ($_['calendar'] == $calendar['id'] ? ' selected="selected"' : '') . '>' . $calendar['displayname'] . '</option>';
                                }
                                ?>
                        <td>
                        <select name="repeat" style="width:350px;">
                                <?php
-                               foreach($_['repeat_options'] as $id => $label){
-                                       echo '<option value="' . $id . '"' . ($_['repeat'] == $id ? ' selected="selected"' : '') . '>' . $label . '</option>';
+                               if (isset($_['repeat_options'])) {
+                                       foreach($_['repeat_options'] as $id => $label){
+                                               echo '<option value="' . $id . '"' . ($_['repeat'] == $id ? ' selected="selected"' : '') . '>' . $label . '</option>';
+                                       }
                                }
                                ?>
                        </select></td>
@@ -82,6 +86,6 @@
        <table>
                <tr>
                        <th width="75px" style="vertical-align: top;"><?php echo $l->t("Description");?>:</th>
-                       <td><textarea style="width:350px;height: 150px;" placeholder="<?php echo $l->t("Description of the Event");?>" name="description"><?php echo $_['description'] ?></textarea></td>
+                       <td><textarea style="width:350px;height: 150px;" placeholder="<?php echo $l->t("Description of the Event");?>" name="description"><?php echo isset($_['description']) ? $_['description'] : '' ?></textarea></td>
                </tr>
        </table>