fixed #60: error msg after returning to mytop5 via browser-back

This commit is contained in:
following
2013-05-05 01:32:16 +02:00
parent 3dfe45a216
commit 19d1c3bfcb

View File

@ -22,13 +22,21 @@
$cache_id = isset($_REQUEST['cacheid']) ? $_REQUEST['cacheid']+0 : 0;
sql("DELETE FROM `cache_rating` WHERE `cache_id`='&1' AND `user_id`='&2'", $cache_id, $login->userid);
if (sql_affected_rows() == 0)
$tpl->error(ERROR_UNKNOWN);
$rs = sql("SELECT `caches`.`wp_oc` AS `wp`, `caches`.`name` AS `cachename` FROM `caches` WHERE `caches`.`cache_id`='&1'", $cache_id);
$deletedItem = sql_fetch_assoc($rs);
$tpl->assign('deleted', true);
$tpl->assign('deletedItem', $deletedItem);
sql_free_result($rs);
{
// will happen if
// 1. we delete a recommendation
// 2. we view another recommended cache
// 3. we return to mytop5 via browser "back" button
// -> ignore
}
else
{
$rs = sql("SELECT `caches`.`wp_oc` AS `wp`, `caches`.`name` AS `cachename` FROM `caches` WHERE `caches`.`cache_id`='&1'", $cache_id);
$deletedItem = sql_fetch_assoc($rs);
$tpl->assign('deleted', true);
$tpl->assign('deletedItem', $deletedItem);
sql_free_result($rs);
}
}
$rs = sql("SELECT `cache_rating`.`cache_id` AS `cacheid`, `caches`.`wp_oc` AS `wp`, `caches`.`name` AS `cachename`, `caches`.`type` AS `type`, `caches`.`status` AS `status`