Exemplo n.º 1
0
function get_tad_gallery_cate_option($of_csn = 0, $level = 0, $v = "", $chk_view = 1, $chk_up = 0, $this_csn = "", $no_self = "0")
{
    global $xoopsDB, $xoopsUser, $xoopsModule, $isAdmin;
    if ($xoopsUser) {
        $module_id = $xoopsModule->getVar('mid');
        $isAdmin = $xoopsUser->isAdmin($module_id);
    } else {
        $isAdmin = false;
    }
    $tadgallery = new tadgallery();
    $show_uid = isset($_SESSION['show_uid']) ? intval($_SESSION['show_uid']) : 0;
    if ($show_uid) {
        $tadgallery->set_show_uid($show_uid);
    }
    $cate_count = $tadgallery->get_tad_gallery_cate_count();
    //$left=$level*10;
    $level += 1;
    $syb = str_repeat("-", $level) . " ";
    $option = $of_csn ? "" : "<option value='0'>" . _MD_TADGAL_CATE_SELECT . "</option>";
    $sql = "select csn,title from " . $xoopsDB->prefix("tad_gallery_cate") . " where of_csn='{$of_csn}' order by sort";
    $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error());
    $ok_cat = $ok_up_cat = "";
    if ($chk_view) {
        $ok_cat = $tadgallery->chk_cate_power();
    }
    if ($chk_up) {
        $ok_up_cat = $tadgallery->chk_cate_power("upload");
    }
    while (list($csn, $title) = $xoopsDB->fetchRow($result)) {
        if ($chk_view and is_array($ok_cat)) {
            if (!in_array($csn, $ok_cat)) {
                continue;
            }
        }
        if ($chk_up and is_array($ok_up_cat)) {
            if (!in_array($csn, $ok_up_cat)) {
                continue;
            }
        }
        if ($no_self == '1' and $this_csn == $csn) {
            continue;
        }
        $selected = $v == $csn ? "selected" : "";
        $count = empty($cate_count[$csn]['file']) ? 0 : $cate_count[$csn]['file'];
        $option .= "<option value='{$csn}' {$selected}>{$syb}{$title}({$count})</option>";
        $option .= get_tad_gallery_cate_option($csn, $level, $v, $chk_view, $chk_up, $this_csn, $no_self);
    }
    return $option;
}
Exemplo n.º 2
0
<?php

/*-----------引入檔案區--------------*/
include_once "header.php";
include_once $GLOBALS['xoops']->path('/modules/system/include/functions.php');
$show_uid = system_CleanVars($_REQUEST, 'show_uid', 0, 'int');
$csn = system_CleanVars($_REQUEST, 'csn', 0, 'int');
$passwd = system_CleanVars($_REQUEST, 'passwd', '', 'string');
$tadgallery = new tadgallery();
if ($show_uid) {
    $tadgallery->set_show_uid($show_uid);
}
if (!empty($csn)) {
    $cate = $tadgallery->get_tad_gallery_cate($csn);
    if ($cate['show_mode'] == "waterfall") {
        $xoopsOption['template_main'] = "tadgallery_list_waterfall.html";
    } elseif ($cate['show_mode'] == "flickr") {
        $xoopsOption['template_main'] = "tadgallery_list_flickr.html";
    } elseif (isset($_REQUEST['op']) and $_REQUEST['op'] == "passwd_form") {
        $xoopsOption['template_main'] = "tadgallery_passwd_form.html";
    } else {
        $xoopsOption['template_main'] = "tadgallery_list_normal.html";
    }
} else {
    if ($xoopsModuleConfig['index_mode'] == "waterfall") {
        $xoopsOption['template_main'] = "tadgallery_list_waterfall.html";
    } elseif ($xoopsModuleConfig['index_mode'] == "flickr") {
        $xoopsOption['template_main'] = "tadgallery_list_flickr.html";
    } else {
        $xoopsOption['template_main'] = "tadgallery_list_normal.html";
    }