function nexdocsrv_folderperms($cid) { global $_CONF, $_TABLES, $_FMCONF, $LANG_FM02, $LANG_nexfile, $actionurl; $tpl = new Template($_CONF['path_layout'] . 'nexfile'); $tpl->set_file(array('folderperms' => 'folderperms.thtml', 'perms_record' => 'folderperms_record.thtml')); $tpl->set_var('catid', $cid); $tpl->set_var('user_options', NXCOM_listUsers()); $tpl->set_var('group_options', nexdoc_getGroupOptions()); $sql = "SELECT accid,uid,grp_id,view,upload,upload_direct,upload_ver,approval,admin "; $sql .= "FROM {$_TABLES['nxfile_access']} WHERE uid > 0 AND catid = {$cid}"; $query = DB_query($sql); while (list($accid, $acc_uid, $acc_grpid, $acc_view, $acc_upload, $acc_uploaddirect, $acc_uploadver, $acc_approval, $acc_admin) = DB_fetchARRAY($query)) { $username = DB_getItem($_TABLES['users'], "username", "uid={$acc_uid}"); $view = $acc_view ? $LANG_FM02['YES'] : $LANG_FM02['NO']; $upload = $acc_upload ? $LANG_FM02['YES'] : $LANG_FM02['NO']; $uploaddir = $acc_uploaddirect ? $LANG_FM02['YES'] : $LANG_FM02['NO']; $uploadver = $acc_uploadver ? $LANG_FM02['YES'] : $LANG_FM02['NO']; $approve = $acc_approval ? $LANG_FM02['YES'] : $LANG_FM02['NO']; $admin = $acc_admin ? $LANG_FM02['YES'] : $LANG_FM02['NO']; $tpl->set_var(array('accid' => $accid, 'username' => $username, 'view_perm' => $view, 'upload_perm' => $upload, 'uploaddir_perm' => $uploaddir, 'uploadver_perm' => $uploadver, 'approve_perm' => $approve, 'admin_perm' => $admin)); $tpl->parse('user_perm_records', 'perms_record', true); } $sql = "SELECT accid,uid,grp_id,view,upload,upload_direct,upload_ver,approval,admin "; $sql .= "FROM {$_TABLES['nxfile_access']} WHERE grp_id > 0 AND catid = {$cid}"; $query = DB_query($sql); while (list($accid, $acc_grpd, $acc_grpid, $acc_view, $acc_upload, $acc_uploaddirect, $acc_uploadver, $acc_approval, $acc_admin) = DB_fetchARRAY($query)) { $groupname = DB_getItem($_TABLES['groups'], "grp_name", "grp_id={$acc_grpid}"); $view = $acc_view ? $LANG_FM02['YES'] : $LANG_FM02['NO']; $upload = $acc_upload ? $LANG_FM02['YES'] : $LANG_FM02['NO']; $uploaddir = $acc_uploaddirect ? $LANG_FM02['YES'] : $LANG_FM02['NO']; $uploadver = $acc_uploadver ? $LANG_FM02['YES'] : $LANG_FM02['NO']; $approve = $acc_approval ? $LANG_FM02['YES'] : $LANG_FM02['NO']; $admin = $acc_admin ? $LANG_FM02['YES'] : $LANG_FM02['NO']; $tpl->set_var(array('accid' => $accid, 'username' => $groupname, 'view_perm' => $view, 'upload_perm' => $upload, 'uploaddir_perm' => $uploaddir, 'uploadver_perm' => $uploadver, 'approve_perm' => $approve, 'admin_perm' => $admin)); $tpl->parse('group_perm_records', 'perms_record', true); } $tpl->parse('folder_perms_panel', 'folderperms'); return $tpl->finish($tpl->get_var('folder_perms_panel')); }
// Save in the form 'frmtoolbar' - will be used by AJAX and JS code } elseif (in_array($_POST['reportmode'], $validReportModes)) { $tpl->set_var('report_option', $_POST['reportmode']); } elseif ($cid > 0) { $tpl->set_var('report_option', ''); } else { $tpl->set_var('report_option', 'latestfiles'); } if (!empty($alertMsg)) { $tpl->set_var('show_alert', ''); $tpl->set_var('alert_message', $alertMsg); } else { $tpl->set_var('show_alert', 'none'); } $tpl->set_var('user_options', NXCOM_listUsers()); $tpl->set_var('group_options', nexdoc_getGroupOptions()); $tpl->set_var('newfolder_options', nexdoc_recursiveAccessOptions('admin')); $tpl->set_var('movefolder_options', nexdoc_recursiveAccessOptions(array('upload_dir'))); $tpl->set_var('newfile_category_options', nexdoc_recursiveAccessOptions(array('upload', 'upload_dir'))); $adminFolders = nexdoc_recursiveAccessOptions('admin'); if ($adminFolders != '') { $tpl->set_var('newfolder_options', $adminFolders); $tpl->parse('newfolder_dialog', 'newfolderdiv'); $tpl->parse('newfolder_menuitem', 'newfolderlink'); } $uploadFolders = nexdoc_recursiveAccessOptions(array('upload', 'upload_dir')); if ($uploadFolders != '') { $tpl->set_var('newfile_category_options', $uploadFolders); $tpl->parse('newfile_dialog', 'newfilediv'); $tpl->parse('newfile_menuitem', 'newfilelink'); }