function quicklinks($id, $baseUrl, $args, $listtype)
{
    global $Me, $Conf;
    $list = SessionList::active($listtype, $id);
    if (!$list) {
        return "";
    }
    $args["ls"] = null;
    $x = '<td class="quicklinks nw has_hotcrp_list" data-hotcrp-list="' . $list->listno . '">';
    if ($list->id_position > 0) {
        $x .= _one_quicklink($list->ids[$list->id_position - 1], $baseUrl, $args, $listtype, true);
    }
    if (@$list->description) {
        $x .= $list->id_position > 0 ? "&nbsp;&nbsp;" : "";
        if (@$list->url) {
            $x .= '<a id="quicklink_list" class="x" href="' . htmlspecialchars(Navigation::siteurl() . $list->url) . "\">" . $list->description . "</a>";
        } else {
            $x .= '<span id="quicklink_list">' . $list->description . '</span>';
        }
    }
    if (isset($list->ids[$list->id_position + 1])) {
        $x .= $list->id_position > 0 || @$list->description ? "&nbsp;&nbsp;" : "";
        $x .= _one_quicklink($list->ids[$list->id_position + 1], $baseUrl, $args, $listtype, false);
    }
    return $x . '</td>';
}
Example #2
0
function quicklinks($id, $baseUrl, $args, $listtype)
{
    global $Me, $Conf, $ConfSiteBase, $CurrentList;
    $list = false;
    $CurrentList = 0;
    if (isset($_REQUEST["ls"]) && ($listno = rcvtint($_REQUEST["ls"])) > 0 && isset($_SESSION["l"][$listno]) && substr(defval($_SESSION["l"][$listno], "listid", "p"), 0, 1) == $listtype) {
        $list = $_SESSION["l"][$listno];
        $CurrentList = $listno;
    } else {
        if (isset($_REQUEST["list"]) && $listtype == "p") {
            $l = $_REQUEST["list"];
            if (preg_match('/\\A[a-z]+\\z/', $l)) {
                $list = _tryNewList(array("t" => $l), $listtype);
            } else {
                if (preg_match('/\\A(all|s):(.*)\\z/s', $l, $m)) {
                    $list = _tryNewList(array("t" => $m[1], "q" => $m[2]), $listtype);
                } else {
                    $list = _tryNewList(array("q" => $l), $listtype);
                }
            }
        }
    }
    $k = false;
    if ($list) {
        $k = array_search($id, $list);
    }
    if ($k === false && !isset($_REQUEST["list"])) {
        $CurrentList = 0;
        $list = _tryNewList(array(), $listtype);
        $k = array_search($id, $list);
        if ($k === false && $Me->privChair) {
            $list = _tryNewList(array("t" => "all"), $listtype);
            $k = array_search($id, $list);
        }
        if ($k === false) {
            $list = false;
        }
    }
    if (!$list) {
        return "";
    }
    if ($CurrentList == 0) {
        $CurrentList = allocateListNumber($list["listid"]);
        $_SESSION["l"][$CurrentList] = $list;
    }
    $_SESSION["l"][$CurrentList]["timestamp"] = time();
    $urlrest = "&amp;ls=" . $CurrentList;
    foreach ($args as $what => $val) {
        $urlrest .= "&amp;" . urlencode($what) . "=" . urlencode($val);
    }
    $x = "";
    if ($k > 0) {
        $x .= _one_quicklink($list[$k - 1], $baseUrl, $urlrest, $listtype, true);
    }
    if (isset($list["description"])) {
        $x .= $k > 0 ? "&nbsp;&nbsp;" : "";
        if (defval($list, "url")) {
            $x .= "<a href=\"" . $ConfSiteBase . htmlspecialchars($list["url"]) . "\">" . $list["description"] . "</a>";
        } else {
            $x .= $list["description"];
        }
    }
    if (isset($list[$k + 1])) {
        $x .= $k > 0 || isset($list["description"]) ? "&nbsp;&nbsp;" : "";
        $x .= _one_quicklink($list[$k + 1], $baseUrl, $urlrest, $listtype, false);
    }
    return $x;
}