Example #1
0
//Verificamos si es una publicaciĆ³n aprobada
if ($res->isNew()) {
    RDFunctions::error_404();
}
// Check if section is a top parent
if ($section->getVar('parent') > 0) {
    $top = RDfunctions::super_parent($section->getVar('parent'));
    header('location: ' . html_entity_decode($top->permalink()) . '#' . $section->getVar('nameid'));
    die;
}
if (!$res->getVar('approved')) {
    redirect_header(RDURL, 0, __('This content is not available!', 'docs'));
    die;
}
// Comprobamos permisos
if (!$res->isAllowed($xoopsUser ? $xoopsUser->groups() : XOOPS_GROUP_ANONYMOUS)) {
    redirect_header(RDURL, 0, __('You are not allowed to read this content!', 'docs'));
    die;
}
// Select correct operation
$action = rmc_server_var($_GET, 'action', '');
switch ($action) {
    case 'printbook':
        rd_section_forprint(1);
        die;
    case 'printsection':
        rd_section_forprint(0);
        die;
    case 'pdfbook':
        rd_section_forpdf(1);
        break;
Example #2
0
$res = new RDResource($id);
if ($res->isNew()) {
    // Error 404 - When resrouce does not exists
    RDFunctions::error_404();
}
if ($res->getVar('single')) {
    define('RD_LOCATION', 'resource_content');
}
include 'header.php';
//Verificamos si la publicacion esta aprobada
if (!$res->getVar('approved')) {
    redirect_header(RDURL, 1, __('Sorry, this Document does not exists!', 'docs'));
    die;
}
//Verifica si el usuario cuenta con permisos para ver la publicaciĆ³n
$allowed = $res->isAllowed($xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS);
if (!$allowed && !$res->getVar('show_index')) {
    redirect_header(RDURL, 2, __('Sorry, you are not authorized to view this Document', 'docs'));
    die;
}
if (!$allowed && !$res->getVar('quick')) {
    redirect_header(RDURL, 2, __('Sorry, you are not authorized to view this Document', 'docs'));
    die;
}
RDFunctions::breadcrumb();
RMBreadCrumb::get()->add_crumb($res->getVar('title'), $res->permalink());
// Check if we must show all content for Document
if ($res->getVar('single')) {
    if (!$allowed) {
        RDfunctions::error_404();
    }