Пример #1
0
 /**
  * Creates the BreadCrumb bar with basic options
  */
 public function breadcrumb()
 {
     global $xoopsModule;
     // Breadcrumb
     $bc = RMBreadCrumb::get();
     $bc->add_crumb(__('Home Page', 'docs'), XOOPS_URL);
     $bc->add_crumb($xoopsModule->name(), RDFunctions::url());
 }
Пример #2
0
// --------------------------------------------------------------
// RapidDocs
// Documentation system for Xoops.
// Author: Eduardo Cortés <*****@*****.**>
// Email: i.bitcero@gmail.com
// License: GPL 2.0
// --------------------------------------------------------------
require '../../mainfile.php';
define('INCLUDED_INDEX', 1);
/**
* This file redirects all petions directly to his content
*/
if ($xoopsModuleConfig['permalinks']) {
    $url = RMFunctions::current_url();
    if (FALSE !== strpos($url, XOOPS_URL . '/modules/docs')) {
        header('location: ' . RDFunctions::url());
        die;
    }
    // If friendly urls are activated
    $path = str_replace(XOOPS_URL, '', RMFunctions::current_url());
    $path = str_replace($xoopsModuleConfig['htpath'], '', $path);
    $path = trim($path, '/');
    if ($xoopsModuleConfig['subdomain'] != '') {
        $path = str_replace(rtrim($xoopsModuleConfig['subdomain'], '/'), '', $path);
        $path = trim($path, '/');
    }
    $params = explode("/", $path);
} else {
    // If friendly urls are disabled
    $path = parse_url(RMFunctions::current_url());
    if (isset($path['query'])) {
Пример #3
0
function rd_section_forpdf($all = 0)
{
    global $section, $res, $xoopsConfig, $xoopsModuleConfig;
    $plugin = RMFunctions::load_plugin('topdf');
    if ($xoopsModuleConfig['permalinks']) {
        $print_book_url = RDFunctions::url() . '/printbook/' . $section->id() . '/';
        $print_section_url = RDFunctions::url() . '/printsection/' . $section->id() . '/';
    } else {
        $print_book_url = XOOPS_URL . '/modules/docs/index.php?page=content&amp;id=' . $section->id() . '&amp;action=printbook';
        $print_section_url = XOOPS_URL . '/modules/docs/index.php?page=content&amp;id=' . $section->id() . '&amp;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);
}
Пример #4
0
/**
* @desc Modifica el orden de las secciones
**/
function changeOrderSections()
{
    global $xoopsSecurity, $xoopsModuleConfig;
    $orders = rmc_server_var($_POST, 'orders', array());
    $id = rmc_server_var($_POST, 'id', 0);
    if ($xoopsModuleConfig['permalinks']) {
        $url_ret = RDfunctions::url() . '/list/' . $id . '/';
    } else {
        $url_ret = RDFunctions::url() . '?page=edit&action=list&id=' . $id;
    }
    if (!$xoopsSecurity->check()) {
        redirect_header($url_ret, 0, __('Session token expired!', 'docs'));
        die;
    }
    if (!is_array($orders) || empty($orders)) {
        redirect_header($url_ret, 1, __('Sorry, the data provided contains some errors!', 'docs'), 1);
        die;
    }
    $errors = '';
    foreach ($orders as $k => $v) {
        if ($k <= 0) {
            continue;
        }
        //Comprueba si la sección es existente
        $sec = new RDSection($k);
        if ($sec->isNew()) {
            continue;
        }
        $sec->setVar('order', $v);
        if (!$sec->save()) {
            $errors .= sprintf(__('Order could not be saved for section %s', 'docs'), $sec->getVar('title')) . '<br />';
        }
    }
    if ($errors != '') {
        redirect_header($url_ret, 1, __('Errors ocurred while trying to update orders') . '<br />' . $errors);
    } else {
        redirect_header($url_ret, 0, __('Sections updated successfully!', 'docs'));
    }
}
Пример #5
0
/**
* @desc Almacena información perteneciente a una publicación
**/
function savePublish()
{
    global $xoopsSecurity, $xoopsModuleConfig, $xoopsUser, $xoopsConfig;
    $config_handler =& xoops_gethandler('config');
    $xconfig = $config_handler->getConfigsByCat(XOOPS_CONF_MAILER);
    foreach ($_POST as $k => $v) {
        ${$k} = $v;
    }
    if ($xoopsModuleConfig['permalinks']) {
        $purl = RDFunctions::url() . '/publish/';
    } else {
        $purl = RDFunctions::url() . '?page=publish&action=publish';
    }
    if (!$xoopsSecurity->check()) {
        redirect_header($prul, 1, __('Session token expired!', 'docs'));
        die;
    }
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    //Comprueba que el título de publicación no exista
    $sql = "SELECT COUNT(*) FROM " . $db->prefix('rd_resources') . " WHERE title='{$title}' ";
    list($num) = $db->fetchRow($db->queryF($sql));
    if ($num > 0) {
        redirect_header($purl, 1, __('Already exists a Document with same name!', 'docs'));
        die;
    }
    $res = new RDResource();
    //Genera $nameid Nombre identificador
    $found = false;
    $i = 0;
    do {
        $nameid = TextCleaner::getInstance()->sweetstring($title) . ($found ? $i : '');
        $sql = "SELECT COUNT(*) FROM " . $db->prefix('rd_resources') . " WHERE nameid = '{$nameid}'";
        list($num) = $db->fetchRow($db->queryF($sql));
        if ($num > 0) {
            $found = true;
            $i++;
        } else {
            $found = false;
        }
    } while ($found == true);
    $res->setVar('title', $title);
    $res->setVar('description', $desc);
    $res->setVar('created', time());
    $res->setVar('modified', time());
    $res->setVar('editors', $editors);
    $res->setVar('groups', $groups);
    $res->setVar('public', 1);
    $res->setVar('quick', $quick);
    $res->setVar('nameid', $nameid);
    $res->setVar('owner', $xoopsUser->uid());
    $res->setVar('owname', $xoopsUser->uname());
    $res->setVar('approved', $xoopsModuleConfig['approved']);
    $res->setVar('single', $single);
    if (!$res->save()) {
        redirect_header($prul, 1, __('Document could not be created!', 'docs'));
    } else {
        //Si no se aprobó la publicación enviamos correo al administrador
        if (!$xoopsModuleConfig['approved']) {
            $mailer = new RMMailer('text/plain');
            $mailer->add_user($xconfig['from'], $xconfig['fromname'], 'to');
            $mailer->set_subject(__('New Document created at RapidDocs is waiting for approval', 'rmcommon'));
            $mailer->assign('to_name', $xconfig['fromname']);
            $mailer->assign('link_to_resource', XOOPS_URL . '/modules/docs/admin/resources.php?action=edit&id=' . $res->id());
            $mailer->template(RMTemplate::get()->get_template('mail/resource_for_approval.php', 'module', 'docs'));
            if (!$mailer->send()) {
                redirect_header(RDFunctions::url(), 1, __('Your Document has been created, however the email to administrator could no be sent.', 'docs'));
                die;
            }
            redirect_header(RDFunctions::url(), 1, __('Your Document has been created and is pending for approval. We will sent an email when you can access to it and add content.', 'docs'));
            die;
        }
        if ($xoopsModuleConfig['permalinks']) {
            $purl = RDFunctions::url() . '/list/' . $res->id() . '/';
        } else {
            $purl = RDFunctions::url() . '?page=edit&action=list&id=' . $res->id();
        }
        redirect_header($purl, 1, __('Document created successfully!', 'docs'));
        die;
    }
}
Пример #6
0
<?php

// $Id$
// --------------------------------------------------------------
// RapidDocs
// Documentation system for Xoops.
// Author: Eduardo Cortés <*****@*****.**>
// Email: i.bitcero@gmail.com
// License: GPL 2.0
// --------------------------------------------------------------
include XOOPS_ROOT_PATH . '/header.php';
$mc =& $xoopsModuleConfig;
//include_once 'include/functions.php';
define('RDURL', RDFunctions::url());
define('RDPATH', XOOPS_ROOT_PATH . '/modules/docs');
$xoopsTpl->assign('rdurl', RDURL);
RMTemplate::get()->add_style('docs.css', 'docs');
Пример #7
0
 public function editlink()
 {
     $config = RMUtilities::module_config('docs');
     if ($config['permalinks']) {
         $link = RDFunctions::url() . '/edit/' . $this->id() . '/' . $this->getVar('id_res');
     } else {
         $link = RDFunctions::url() . '?page=edit&id=' . $this->id() . '&res=' . $this->getVar('id_res');
     }
     return $link;
 }
Пример #8
0
         * @todo Generate friendly links
         */
        if (RMFunctions::plugin_installed('topdf')) {
            $pdf_book_url = ($xoopsModuleConfig['subdomain'] != '' ? $xoopsModuleConfig['subdomain'] : XOOPS_URL) . $xoopsModuleConfig['htpath'] . '/pdfbook/' . $toc[0]['id'] . '/';
        }
        $print_book_url = ($xoopsModuleConfig['subdomain'] != '' ? $xoopsModuleConfig['subdomain'] : XOOPS_URL) . $xoopsModuleConfig['htpath'] . '/printbook/' . $toc[0]['id'] . '/';
        if (RDFunctions::new_resource_allowed($xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS)) {
            $publish_url = RDFunctions::url() . '/publish/';
        }
    } else {
        if (RMFunctions::plugin_installed('topdf')) {
            $pdf_book_url = XOOPS_URL . '/modules/docs/index.php?page=content&amp;id=' . $res->id() . '&amp;action=pdfbook';
        }
        $print_book_url = XOOPS_URL . '/modules/docs/index.php?page=content&amp;id=' . $res->id() . '&amp;action=printbook';
        if (RDFunctions::new_resource_allowed($xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS)) {
            $publish_url = RDFunctions::url() . '/?action=publish';
        }
    }
    include RMTemplate::get()->get_template('rd_resall.php', 'module', 'docs');
} elseif ($res->getVar('quick')) {
    // Show Quick Index to User
    $content = false;
    //Obtiene índice
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT * FROM " . $db->prefix('rd_sections') . " WHERE id_res='" . $res->id() . "' AND parent=0 ORDER BY `order`";
    $result = $db->queryF($sql);
    // Quick index array
    $qindex_sections = array();
    while ($rows = $db->fetchArray($result)) {
        $sec = new RDSection();
        $sec->assignVars($rows);