Exemplo n.º 1
0
function photoplog_child_list(&$list_children, &$list_parents, $catid = -1, $levels = -1)
{
    global $vbulletin;
    $categories = $vbulletin->db->query_read("SELECT catid, parentid\r\n\t\tFROM " . PHOTOPLOG_PREFIX . "photoplog_categories\r\n\t");
    $catids = array();
    $parids = array();
    while ($category = $vbulletin->db->fetch_array($categories)) {
        $catids[] = $category['catid'];
        $parids[] = $category['parentid'];
    }
    $vbulletin->db->free_result($categories);
    if (!in_array(0, $catids)) {
        $catids[] = 0;
        $parids[] = -1;
    }
    photoplog_child_worker($list_children, $list_parents, $catid, $catids, $parids, $levels);
}
Exemplo n.º 2
0
function photoplog_child_list_v2(&$list_imm, &$list_all, &$list_cats)
{
    global $vbulletin;
    // ORDER BY parentid,displayorder,catid
    // now done by ALTER TABLE after change
    $categories = $vbulletin->db->query_read("SELECT catid, parentid, title\r\n\t\tFROM " . PHOTOPLOG_PREFIX . "photoplog_categories\r\n\t");
    $catids = array();
    $titles = array();
    $parentids = array();
    while ($category = $vbulletin->db->fetch_array($categories)) {
        $catid = intval($category['catid']);
        $parid = intval($category['parentid']);
        $list_imm[$parid][] = $catid;
        if (!isset($list_imm[$catid])) {
            $list_imm[$catid] = array();
        }
        $catids[] = $catid;
        $titles[] = strval($category['title']);
        $parentids[] = $parid;
    }
    $vbulletin->db->free_result($categories);
    photoplog_child_worker($list_imm, $list_all);
    photoplog_list_worker($list_cats, -1, '', $catids, $titles, $parentids);
}