# HG changeset patch # User Matti Hamalainen # Date 1544612527 -7200 # Node ID f85870271f5105260f1c700fb5efd1421f74d34a # Parent 19dab8b0c34070bad266478d7e5e4f1db39ab879 Simplify mgGetNaviActive() a bit. diff -r 19dab8b0c340 -r f85870271f51 mgallery.php --- a/mgallery.php Wed Dec 12 12:40:57 2018 +0200 +++ b/mgallery.php Wed Dec 12 13:02:07 2018 +0200 @@ -211,15 +211,13 @@ } -function mgGetNaviActive(&$galIndex, $index, $delta, &$res, &$url, $entities) +function mgGetNaviActive(&$galIndex, $index, $delta, &$res, $entities) { global $galPath; $res = $index + $delta; + if ($res >= 0 && $res <= sizeof($galIndex) - 1) - { - $url = mgGetURL($galPath, $galIndex[$res], $entities); - return TRUE; - } + return mgGetURL($galPath, $galIndex[$res], $entities); else return FALSE; } @@ -244,9 +242,7 @@ function mgGetNaviControlImageBox(&$galIndex, $index, $class, $delta) { - if (!mgGetNaviActive($galIndex, $index, $delta, $res, $url, TRUE)) - $url = FALSE; - + $url = mgGetNaviActive($galIndex, $index, $delta, $res, TRUE); return mgGetNaviControlImage($galIndex, $res, $class, $url); } @@ -593,12 +589,12 @@ // Javascript navigation if ($ctrlFlags & MGF_JAVASCRIPT) { - $prevActive = mgGetNaviActive($galImagesIndex, $index, -1, $res, $prevURL, FALSE); - $nextActive = mgGetNaviActive($galImagesIndex, $index, 1, $res, $nextURL, FALSE); + $prevURL = mgGetNaviActive($galImagesIndex, $index, -1, $res, FALSE); + $nextURL = mgGetNaviActive($galImagesIndex, $index, 1, $res, FALSE); echo "