示例#1
0
require_once $_CONF['path_html'] . 'filemgmt/include/xoopstree.php';
require_once $_CONF['path_html'] . 'filemgmt/include/textsanitizer.php';
// Setup how many categories you want to show in the category row display
$numCategoriesPerRow = 2;
$numSubCategories2Show = 5;
if (SEC_hasRights('filemgmt.user') or $mydownloads_publicpriv == 1) {
    $p = new Template($_CONF['path'] . 'plugins/filemgmt/templates');
    $p->set_file(array('page' => 'filelisting.thtml', 'records' => 'filelisting_record.thtml', 'category' => 'filelisting_category.thtml'));
    $p->set_var('layout_url', $_CONF['layout_url']);
    $p->set_var('site_url', $_CONF['site_url']);
    $p->set_var('site_admin_url', $_CONF['site_admin_url']);
    $p->set_var('xhtml', XHTML);
    $p->set_var('target', $CONF_FM['ignore_target'] ? '' : 'target="_blank"');
    $myts = new MyTextSanitizer();
    $mytree = new XoopsTree($_DB_name, $_FM_TABLES['filemgmt_cat'], "cid", "pid");
    $mytree->setGroupAccessFilter($_GROUPS);
    $display = '';
    //@@@@@20090602update urlrewrite ---->
    //$lid = COM_applyFilter($_GET['id'],true);
    COM_setArgNames(array('id'));
    $lid = COM_applyFilter(COM_getArgument('id'), true);
    //@@@@@20090602update urlrewrite<-----
    if ($lid == 0) {
        // Check if the script is being called from the commentbar
        $lid = str_replace('fileid_', '', $_POST['id']);
    }
    $groupsql = filemgmt_buildAccessSql();
    $sql = "SELECT COUNT(*) FROM {$_FM_TABLES['filemgmt_filedetail']} a ";
    $sql .= "LEFT JOIN {$_FM_TABLES['filemgmt_cat']} b ON a.cid=b.cid ";
    $sql .= "WHERE a.lid='{$lid}' {$groupsql} AND a.status > 0";
    list($fileAccessCnt) = DB_fetchArray(DB_query($sql));