function messages_nav_strip($tid, $pid, $length, $ppp)
{
    $webtag = get_webtag();
    if ($pid < 2 && $length < $ppp) {
        return;
    } else {
        if ($pid < 1) {
            $pid = 1;
        }
    }
    $c = 0;
    $spid = $pid % $ppp;
    if ($spid > 1) {
        if ($pid > 1) {
            $navbits[0] = "<a href=\"messages.php?webtag={$webtag}&amp;msg={$tid}.1\" target=\"_self\">" . mess_nav_range(1, $spid - 1) . "</a>";
        } else {
            $c = 0;
            $navbits[0] = mess_nav_range(1, $spid - 1);
        }
        $i = 1;
    } else {
        $i = 0;
    }
    while ($spid + ($ppp - 1) < $length) {
        if ($spid == $pid) {
            $c = $i;
            $navbits[$i] = mess_nav_range($spid, $spid + ($ppp - 1));
        } else {
            $navbits[$i] = "<a href=\"messages.php?webtag={$webtag}&amp;msg={$tid}." . ($spid == 0 ? 1 : $spid) . "\" target=\"_self\">" . mess_nav_range($spid == 0 ? 1 : $spid, $spid + ($ppp - 1)) . "</a>";
        }
        $spid += $ppp;
        $i++;
    }
    if ($spid <= $length) {
        if ($spid == $pid) {
            $c = $i;
            $navbits[$i] = mess_nav_range($spid, $length);
        } else {
            $navbits[$i] = "<a href=\"messages.php?webtag={$webtag}&amp;msg={$tid}.{$spid}\" target=\"_self\">" . mess_nav_range($spid, $length) . "</a>";
        }
    }
    $max = $i;
    $html = gettext("Show messages:");
    if ($length <= $ppp) {
        $html .= " <a href=\"messages.php?webtag={$webtag}&amp;msg={$tid}.1\" target=\"_self\">" . gettext("All") . "</a>\n";
    }
    for ($i = 0; $i <= $max; $i++) {
        if (isset($navbits[$i])) {
            if (abs($c - $i) < 4 || $i == 0 || $i == $max) {
                $html .= "\n&nbsp;" . $navbits[$i];
            } else {
                if (abs($c - $i) == 4) {
                    $html .= "\n&nbsp;&hellip;";
                }
            }
        }
    }
    unset($navbits);
    echo "            <table class=\"posthead\" width=\"100%\">\n";
    echo "              <tr>\n";
    echo "                <td align=\"center\">{$html}</td>\n";
    echo "              </tr>\n";
    echo "            </table>\n";
    echo "            <br />\n";
}
Beispiel #2
0
function light_messages_nav_strip($tid, $pid, $length, $ppp)
{
    $webtag = get_webtag();
    if ($pid < 2 && $length < $ppp) {
        return;
    } else {
        if ($pid < 1) {
            $pid = 1;
        }
    }
    $c = 0;
    $spid = $pid % $ppp;
    if ($spid > 1) {
        if ($pid > 1) {
            $navbits[0] = "<a href=\"lmessages.php?webtag={$webtag}&amp;msg={$tid}.1\">" . mess_nav_range(1, $spid - 1) . "</a>";
        } else {
            $c = 0;
            $navbits[0] = mess_nav_range(1, $spid - 1);
        }
        $i = 1;
    } else {
        $i = 0;
    }
    while ($spid + ($ppp - 1) < $length) {
        if ($spid == $pid) {
            $c = $i;
            $navbits[$i] = mess_nav_range($spid, $spid + ($ppp - 1));
        } else {
            $navbits[$i] = "<a href=\"lmessages.php?webtag={$webtag}&amp;msg={$tid}." . ($spid == 0 ? 1 : $spid) . "\">" . mess_nav_range($spid == 0 ? 1 : $spid, $spid + ($ppp - 1)) . "</a>";
        }
        $spid += $ppp;
        $i++;
    }
    if ($spid <= $length) {
        if ($spid == $pid) {
            $c = $i;
            $navbits[$i] = mess_nav_range($spid, $length);
        } else {
            $navbits[$i] = "<a href=\"lmessages.php?webtag={$webtag}&amp;msg={$tid}.{$spid}\">" . mess_nav_range($spid, $length) . "</a>";
        }
    }
    $max = $i;
    $html = "<span>" . gettext("Show messages") . ":</span>";
    if ($length <= $ppp) {
        $html .= " <a href=\"lmessages.php?webtag={$webtag}&amp;msg={$tid}.1\">" . gettext("All") . "</a>\n";
    }
    for ($i = 0; $i <= $max; $i++) {
        if (isset($navbits[$i])) {
            if (abs($c - $i) < 4 || $i == 0 || $i == $max) {
                $html .= "\n&nbsp;" . $navbits[$i];
            } else {
                if (abs($c - $i) == 4) {
                    $html .= "\n&nbsp;&hellip;";
                }
            }
        }
    }
    unset($navbits);
    echo "<div class=\"message_pagination\">{$html}</div>\n";
}