Esempio n. 1
0
function photoplog_list_categories(&$list_cats, $parentid = -1, $root_title = '', $include_not_available = 0, $spacer = '', $spacer_append = '--')
{
    global $vbulletin, $vbphrase;
    // ORDER BY parentid,displayorder,catid
    // now done by ALTER TABLE after change
    $categories = $vbulletin->db->query_read("SELECT catid, title, parentid\r\n\t\tFROM " . PHOTOPLOG_PREFIX . "photoplog_categories\r\n\t");
    $catids = array();
    $titles = array();
    $parentids = array();
    while ($category = $vbulletin->db->fetch_array($categories)) {
        if ($include_not_available || $category['catid'] > 0) {
            $catids[] = $category['catid'];
            $titles[] = $category['title'];
            $parentids[] = $category['parentid'];
        }
    }
    $vbulletin->db->free_result($categories);
    if ($include_not_available && !in_array(0, $catids)) {
        $catids[] = 0;
        $titles[] = $vbphrase['photoplog_not_available'];
        $parentids[] = -1;
    }
    photoplog_list_worker($list_cats, $parentid, $root_title, $spacer, $spacer_append, $catids, $titles, $parentids);
}
Esempio 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);
}