1
0

Attempt at fixing "sidebar crashes with php5 5.4.4-rc1" forum report (comment #393361).

This commit is contained in:
rWatcher 2012-06-22 13:15:14 -04:00
parent 7c5059c7c6
commit 4fe98e39b7
2 changed files with 6 additions and 3 deletions

View File

@ -37,6 +37,7 @@ class exif_gps_block_Core {
// a map of the current user. // a map of the current user.
if ($theme->item()) { if ($theme->item()) {
$album_id = ""; $album_id = "";
$user_name = "";
$item = $theme->item; $item = $theme->item;
if ($item->is_album()) { if ($item->is_album()) {
$album_id = $item->id; $album_id = $item->id;
@ -44,7 +45,9 @@ class exif_gps_block_Core {
$album_id = $item->parent_id; $album_id = $item->parent_id;
} }
$curr_user = ORM::factory("user")->where("id", "=", $item->owner_id)->find_all(); $curr_user = ORM::factory("user")->where("id", "=", $item->owner_id)->find_all();
$user_name = $curr_user[0]->full_name; if (count($curr_user) > 0) {
$user_name = $curr_user[0]->full_name;
}
// Make sure there are actually map-able items to display. // Make sure there are actually map-able items to display.
$album_items_count = ORM::factory("item", $album_id) $album_items_count = ORM::factory("item", $album_id)

View File

@ -1,9 +1,9 @@
<?php defined("SYSPATH") or die("No direct script access.") ?> <?php defined("SYSPATH") or die("No direct script access.") ?>
<ul> <ul>
<? if ($album_items > 0): ?> <? if (isset($album_items) && ($album_items > 0)): ?>
<li><a href="<?=url::site("exif_gps/map/album/" . $album_id) ?>"><?=t("Map this album"); ?></a></li> <li><a href="<?=url::site("exif_gps/map/album/" . $album_id) ?>"><?=t("Map this album"); ?></a></li>
<? endif ?> <? endif ?>
<? if ($user_items > 0): ?> <? if (isset($user_items) && ($user_items > 0)): ?>
<li><a href="<?=url::site("exif_gps/map/user/" . $user_id) ?>"><?=t("Map"); ?> <?=$user_name; ?><?=t("'s photos"); ?></a></li> <li><a href="<?=url::site("exif_gps/map/user/" . $user_id) ?>"><?=t("Map"); ?> <?=$user_name; ?><?=t("'s photos"); ?></a></li>
<? endif ?> <? endif ?>
</ul> </ul>