Hi all,<br><br>I've found an issue with the Calendar Timezone selection under User Settings. There are no Australian Timezones in the list.<br><br>I did some digging in the code and I found the issue is in this file:<br>
/apps/calendar/templates/settings.php<br><br>Starting at line 18:<br><br> foreach($_['timezones'] as $timezone):<br> if ( preg_match( '/^(America|Antartica|Arctic|Asia|Atlantic|Europe|Indian|Pacific)\//', $timezone ) ):<br>
$ex=explode('/', $timezone, 2);//obtain continent,city<br> if ($continent!=$ex[0]):<br> if ($continent!="") echo '</optgroup>';<br>
echo '<optgroup label="'.$ex[0].'">';<br> endif;<br> $city=$ex[1];<br> $continent=$ex[0];<br>
echo '<option value="'.$timezone.'"'.($_['timezone'] == $timezone?' selected="selected"':'').'>'.$city.'</option>';<br>
endif;<br> endforeach;?><br><br>The list of continents being shown is hard-coded, and Australia isn't on the list.<br>Adding 'Australia' into that list of continents fixes the issue, but I am wondering why is that list hard-coded at all?<br>
I assume the only reason to check for those words is to ensure we have the format: "Continent/City".<br><br>The two solutions to this problem, which aren't simply adding Australia to the list, that I can think of are:<br>
<br>1) Replace the preg_match() IF condition with a strpos() condition to check for the '/'. It will ensure that only timezones in the right format are shown without having to hardcode them all.<br><br> REPLACE <br>
if ( preg_match( '/^(America|Antartica|Arctic|Asia|Atlantic|Europe|Indian|Pacific)\//', $timezone ) ): <br> <br> WITH<br> if (strpos($timezone, "/")):<br><br>2) Or we can get smarter and manually put all timezones without a Continent into an 'Other' category.<br>
<br> REPLACE <br>
if ( preg_match( '/^(America|Antartica|Arctic|Asia|Atlantic|Europe|Indian|Pacific)\//', $timezone ) ): <br> $ex=explode('/', $timezone, 2);//obtain continent,city<br>
if ($continent!=$ex[0]):<br> if ($continent!="") echo '</optgroup>';<br> echo '<optgroup label="'.$ex[0].'">';<br>
endif;<br> $city=$ex[1];<br> $continent=$ex[0];<br> echo '<option value="'.$timezone.'"'.($_['timezone'] == $timezone?' selected="selected"':'').'>'.$city.'</option>';<br>
endif;<br><br> WITH<br> $ex=explode('/', $timezone, 2);//obtain continent,city<br><br> if (!isset($ex[1])) {<br> $ex[1] = $ex[0];<br> $ex[0] = "Other";<br>
}<br><br> if ($continent!=$ex[0]):<br> if ($continent!="") echo '</optgroup>';<br> echo '<optgroup label="'.$ex[0].'">';<br>
endif;<br> $city=$ex[1];<br> $continent=$ex[0];<br> echo '<option value="'.$timezone.'"'.($_['timezone'] == $timezone?' selected="selected"':'').'>'.$city.'</option>';<br>
<br><br>I've never used Gitorious, and I'm pretty new to Git, so I don't know how I'd go about signing up to make these changes myself...<br>I'm happy to learn if anyone wants to teach me :)<br><br>Thanks,<br>
~Stephen<br clear="all"><br>-- <br>Stephen Rees-Carter ~ Valorin<br><a href="http://stephen.rees-carter.net/" target="_blank">http://stephen.rees-carter.net/</a><br>