function display_groups($group_id) { global $Language; // show list of groups to edit. $query = "select * " . "from doc_groups " . "where group_id = '{$group_id}' " . "order by group_rank"; $result = db_query($query); if (db_numrows($result) < 1) { print "<p>" . $Language->getText('docman_doc_utils', 'error_nogroup'); } else { $title_arr = array(); $title_arr[] = $Language->getText('docman_doc_utils', 'group_id'); $title_arr[] = $Language->getText('docman_doc_utils', 'group_name'); $title_arr[] = $Language->getText('docman_doc_utils', 'rank'); $title_arr[] = $Language->getText('docman_doc_utils', 'permissions'); $title_arr[] = $Language->getText('docman_doc_utils', 'delete_ask'); echo html_build_list_table_top($title_arr); $i = 0; while ($row = db_fetch_array($result)) { $output = "<tr class=\"" . util_get_alt_row_color($i) . "\">" . '<td><b><a href="index.php?mode=groupedit&doc_group=' . $row['doc_group'] . '&group_id=' . $group_id . '">' . $row['doc_group'] . "</a></b></td>\n" . '<td> <a href="index.php?mode=groupedit&doc_group=' . $row['doc_group'] . "&group_id=" . $group_id . '">' . $row['groupname'] . "</td>\n" . "<td>" . $row['group_rank'] . "</td>" . "<td align='center'><FONT SIZE='-1'><a href='/docman/admin/editdocgrouppermissions.php?doc_group=" . $row['doc_group'] . "&group_id={$group_id}'>"; if (permission_exist('DOCGROUP_READ', $row['doc_group'])) { $output .= $Language->getText('docman_doc_utils', 'edit_perms'); } else { $output .= $Language->getText('docman_doc_utils', 'define_perms'); } $output .= "</a></font></td>" . '<td align="center"><a href="index.php?mode=groupdelete&doc_group=' . $row['doc_group'] . '&group_id=' . $group_id . '"><img src="' . util_get_image_theme("ic/trash.png") . '" border="0" onClick="return confirm(\'' . $Language->getText('docman_doc_utils', 'delete_confirm') . '\')"></A></td></tr>'; print "{$output}"; $i++; } echo '</table>'; } docman_footer($params); }
function main_page($group_id) { global $Language; docman_header_admin(array('title' => $Language->getText('docman_admin_index', 'title'))); echo '<h2>' . $Language->getText('docman_admin_index', 'header_doc_mgt') . '</h2>'; display_docs($group_id); docman_footer(array()); }
function main_page($group_id) { docman_header('Document Admin Page', 'Document Manager Admin', 'admin'); echo '<p><b>Pending Submissions:</b> <p>'; display_docs('3', $group_id); // doc_group 3 == pending echo '<p>'; echo '<b>Active Submissions:</b> <p>'; display_docs('1', $group_id); //doc_group 1 == active docman_footer($params); }
function display_groups($group_id) { // show list of groups to edit. $query = "select * " . "from doc_groups " . "where group_id = '{$group_id}'"; $result = db_query($query); if (db_numrows($result) < 1) { print "<p>No groups currently exist."; } else { $title_arr = array(); $title_arr[] = 'Group ID'; $title_arr[] = 'Group Name'; $title_arr[] = 'Controls'; echo html_build_list_table_top($title_arr); $i = 0; while ($row = db_fetch_array($result)) { $output = "<tr bgcolor=\"" . html_get_alt_row_color($i) . "\">" . "<td>" . $row['doc_group'] . "</td>\n" . "<td>" . $row['groupname'] . "</td>\n" . "<td>[ <a href=\"index.php?mode=groupdelete&doc_group=" . $row['doc_group'] . "&group_id=" . $group_id . "\">Delete</A> ] [ <a href=\"index.php?mode=groupedit&doc_group=" . $row['doc_group'] . "&group_id=" . $group_id . "\">Change Name</a> ]\n</td>" . "</tr>\n"; print "{$output}"; $i++; } echo '</table>'; } docman_footer($params); }
* */ require_once '../env.inc.php'; require_once $gfwww . 'include/pre.php'; require_once $gfwww . 'docman/include/doc_utils.php'; require_once $gfcommon . 'docman/Document.class.php'; $docid = getIntFromRequest('docid'); if ($docid) { $group_id = getIntFromRequest('group_id'); $g =& group_get_object($group_id); if (!$g || !is_object($g)) { exit_no_group(); } elseif ($g->isError()) { exit_error('Error', $g->getErrorMessage()); } $d = new Document($g, $docid); if (!$d || !is_object($d)) { exit_error('Document unavailable', 'Document is not available.'); } elseif ($d->isError()) { exit_error('Error', $d->getErrorMessage()); } docman_header($d->getName(), $d->getName()); printf(_('This document was moved to <a href="%1$s">this new location</a>'), util_make_url("/docman/view.php/{$group_id}/{$docid}")); docman_footer(array()); } else { exit_error(_('No document data'), _('No document to display - invalid or inactive document number.')); } // Local Variables: // mode: php // c-file-style: "bsd" // End:
if (permission_exist('DOCUMENT_READ', $docid)) { if (!permission_is_authorized('DOCUMENT_READ', $docid, user_getid(), $object_group_id)) { exit_error($Language->getText('global', 'perm_denied'), $Language->getText('global', 'error_perm_denied')); } } else { if (!permission_is_authorized('DOCGROUP_READ', $row['doc_group'], user_getid(), $object_group_id)) { exit_error($Language->getText('global', 'perm_denied'), $Language->getText('global', 'error_perm_denied')); } } if (user_isloggedin()) { //Insert a new entry in the doc_log table only for restricted documents $sql = "INSERT INTO doc_log(user_id,docid,time) " . "VALUES ('" . user_getid() . "','" . $docid . "','" . time() . "')"; $res_insert = db_query($sql); } // HTML or text files that were copy/pasted are displayed in a Codendi-formatted page. // Uploaded files are always displayed as-is. if (($row['filetype'] == 'text/html' || $row['filetype'] == 'text/plain') && $row['filesize'] == 0) { docman_header(array('title' => $row['title'], 'help' => 'DocumentManager.html')); if ($object_group_id != $from_group_id) { $group_name = util_get_group_name_from_id($object_group_id); print '<H3><span class="feedback">' . $Language->getText('docman_display_doc', 'warning_different_group', array($group_name)) . '</span></H3>'; } // Document data can now contain HTML tags but not php code print util_unconvert_htmlspecialchars($row['data']); docman_footer($params); } else { session_redirect("/docman/download.php?docid=" . $docid); } } else { exit_error($Language->getText('global', 'error'), $Language->getText('docman_display_doc', 'error_wrongid')); }