apps/calendar: check if variables are set before using them

Signed-off-by: Florian Pritz <bluewind@xinu.at>
This commit is contained in:
Florian Pritz 2011-09-22 17:05:56 +02:00
parent f65d0e4f80
commit 6f3c118038
1 changed files with 9 additions and 5 deletions

View File

@ -2,13 +2,13 @@
<tr> <tr>
<th width="75px"><?php echo $l->t("Title");?>:</th> <th width="75px"><?php echo $l->t("Title");?>:</th>
<td> <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> </td>
</tr> </tr>
<tr> <tr>
<th width="75px"><?php echo $l->t("Location");?>:</th> <th width="75px"><?php echo $l->t("Location");?>:</th>
<td> <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> </td>
</tr> </tr>
</table> </table>
@ -19,6 +19,7 @@
<select id="category" name="categories[]" multiple="multiple" title="<?php echo $l->t("Select category") ?>"> <select id="category" name="categories[]" multiple="multiple" title="<?php echo $l->t("Select category") ?>">
<?php <?php
foreach($_['category_options'] as $category){ foreach($_['category_options'] as $category){
if (!isset($_['categories'])) {$_['categories'] = array();}
echo '<option value="' . $category . '"' . (in_array($category, $_['categories']) ? ' selected="selected"' : '') . '>' . $category . '</option>'; echo '<option value="' . $category . '"' . (in_array($category, $_['categories']) ? ' selected="selected"' : '') . '>' . $category . '</option>';
} }
?> ?>
@ -28,6 +29,7 @@
<select style="width:140px;" name="calendar"> <select style="width:140px;" name="calendar">
<?php <?php
foreach($_['calendar_options'] as $calendar){ foreach($_['calendar_options'] as $calendar){
if (!isset($_['calendar'])) {$_['calendar'] = false;}
echo '<option value="' . $calendar['id'] . '"' . ($_['calendar'] == $calendar['id'] ? ' selected="selected"' : '') . '>' . $calendar['displayname'] . '</option>'; echo '<option value="' . $calendar['id'] . '"' . ($_['calendar'] == $calendar['id'] ? ' selected="selected"' : '') . '>' . $calendar['displayname'] . '</option>';
} }
?> ?>
@ -64,9 +66,11 @@
<td> <td>
<select name="repeat" style="width:350px;"> <select name="repeat" style="width:350px;">
<?php <?php
if (isset($_['repeat_options'])) {
foreach($_['repeat_options'] as $id => $label){ foreach($_['repeat_options'] as $id => $label){
echo '<option value="' . $id . '"' . ($_['repeat'] == $id ? ' selected="selected"' : '') . '>' . $label . '</option>'; echo '<option value="' . $id . '"' . ($_['repeat'] == $id ? ' selected="selected"' : '') . '>' . $label . '</option>';
} }
}
?> ?>
</select></td> </select></td>
</tr>--> </tr>-->
@ -82,6 +86,6 @@
<table> <table>
<tr> <tr>
<th width="75px" style="vertical-align: top;"><?php echo $l->t("Description");?>:</th> <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> </tr>
</table> </table>