Esempio n. 1
0
        $print_book_url = XOOPS_URL . '/modules/docs/index.php?page=content&id=' . $section->id() . '&action=printbook';
        $print_section_url = XOOPS_URL . '/modules/docs/index.php?page=content&id=' . $section->id() . '&action=printsection';
    }
    // This options only works when pdfmyurl is enabled on topdf plugin
    $options = array('--filename' => $res->getVar('title') . '.pdf', '--header-left' => $res->getVar('title'), '--header-right' => $xoopsConfig['sitename'], '--header-line' => '1');
    header("Expires: Tue, 03 Jul 2001 06:00:00 GMT");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    header("Cache-Control: no-store, no-cache, must-revalidate");
    header("Cache-Control: post-check=0, pre-check=0", false);
    header("Pragma: no-cache");
    $plugin->create_pdf_url($all ? $print_book_url : $print_section_url, $res->getVar('title') . '.pdf', $options);
}
// Sección
$section = new RDSection($id, isset($res) ? $res : null);
if ($section->isNew()) {
    RDfunctions::error_404();
}
$res = new RDResource($section->getVar('id_res'));
//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;
Esempio n. 2
0
/**
* @desc Formulario para crear nueva sección
**/
function formSection($edit = 0)
{
    global $xoopsConfig, $xoopsUser, $xoopsModuleConfig, $id, $res;
    $res = rmc_server_var($_GET, 'id', $res);
    //Verifica si se proporcionó una publicación para la sección
    if ($res <= 0) {
        RDFunctions::error_404();
    }
    $res = new RDResource($res);
    if ($res->isNew()) {
        RDFunctions::error_404();
    }
    //Verificamos si es una publicación aprobada
    if (!$res->getVar('approved')) {
        redirect_header(RDURL, 2, __('Specified section does not exists!', 'docs'));
        die;
    }
    //Verificamos si el usuario tiene permisos de edicion
    if (!$xoopsUser->uid() == $res->getVar('owner') && !$res->isEditor($xoopsUser->uid()) && !$xoopsUser->isAdmin()) {
        redirect_header($section->permalink(), 1, __('Operation not allowed!', 'docs'));
        die;
    }
    if ($edit) {
        $id = rmc_server_var($_GET, 'id', $id);
        //Verifica si la sección es válida
        if ($id == '') {
            RDfunctions::error_404();
        }
        //Comprueba si la sección es existente
        $section = new RDSection($id);
        if ($section->isNew()) {
            RDFunctions::error_404();
        }
    }
    include 'header.php';
    include_once RMCPATH . '/class/form.class.php';
    define('RD_NO_FIGURES', 1);
    $rmc_config = RMFunctions::configs();
    $editor = new RMFormEditor('', 'content', '100%', '300px', $edit ? $section->getVar('content', $rmc_config['editor_type'] == 'tiny' ? 's' : 'e') : '', '', false);
    if ($rmc_config['editor_type'] == 'tiny') {
        $tiny = TinyEditor::getInstance();
        $tiny->configuration['content_css'] .= ',' . XOOPS_URL . '/modules/docs/css/figures.css';
        $tiny->add_config('theme_advanced_buttons1', 'rd_refs');
        $tiny->add_config('theme_advanced_buttons1', 'rd_figures');
        $tiny->add_config('theme_advanced_buttons1', 'rd_toc');
    }
    // Arbol de Secciones
    $sections = array();
    RDFunctions::sections_tree_index(0, 0, $res, '', '', false, $sections, false);
    // Breadcrumb
    RDFunctions::breadcrumb();
    $res_edit = RDFunctions::url() . ($xoopsModuleConfig['permalinks'] ? '/list/' . $res->id() . '/' : '?action=list&id=' . $res->id());
    RMBreadCrumb::get()->add_crumb($res->getVar('title'), $res_edit);
    if ($edit) {
        RMBreadCrumb::get()->add_crumb(sprintf(__('Editing "%s"', 'docs'), $section->getVar('title')));
    } else {
        RMBreadCrumb::get()->add_crumb(__('Create new section', 'docs'));
    }
    RMTemplate::get()->add_jquery(true);
    RMTemplate::get()->add_style('forms.css', 'docs');
    RMTemplate::get()->add_script(XOOPS_URL . '/modules/docs/include/js/scripts.php?file=metas.js');
    include RMEvents::get()->run_event('docs.template.formsections.front', RMTemplate::get()->get_template('rd_sec.php', 'module', 'docs'));
    include 'footer.php';
}