Esempio n. 1
0
 public function eventRmcommonAdditionalOptions($settings)
 {
     $settings['categories']['helium'] = __('Control Panel', 'helium');
     $af_available = RMFunctions::plugin_installed('advform');
     $settings['config'][] = array('name' => 'helium_logo', 'title' => __('Logo to use', 'rmcommon'), 'description' => __('You can specify a logo as bitmap but SVG is recommended. The logo will be resize to 29 pixels of height.', 'helium'), 'formtype' => $af_available ? 'image-url' : 'textbox', 'valuetype' => 'text', 'default' => RMCURL . '/themes/helium/images/logo-he.svg', 'category' => 'helium');
     return $settings;
 }
Esempio n. 2
0
/**
* @desc Muestra el contenido completo de una sección
*/
function showSection(RDResource &$res, RDSection &$section)
{
    global $xoopsUser, $xoopsModuleConfig, $xoopsOption, $xoopsTpl, $xoopsConfig, $standalone;
    include 'header.php';
    $xoopsTpl->assign('xoops_pagetitle', $section->getVar('title'));
    // Resource data
    $resource = array('id' => $res->id(), 'title' => $res->getVar('title'), 'link' => $res->permalink(), 'reads' => $res->getVar('reads'));
    $res->add_read($res);
    // Navegación de Secciones
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT * FROM " . $db->prefix("rd_sections") . " WHERE id_res='" . $res->id() . "' AND parent = '0' ORDER BY `order`";
    $result = $db->query($sql);
    $i = 1;
    $number = 1;
    $located = false;
    // Check if current position has been located
    while ($row = $db->fetchArray($result)) {
        $sec = new RDSection();
        $sec->assignVars($row);
        if ($sec->id() == $section->id()) {
            $number = $i;
            $located = true;
        }
        if ($sec->id() == $section->id() && isset($sprev)) {
            $prev_section = array('id' => $sprev->id(), 'title' => $sprev->getVar('title'), 'link' => $sprev->permalink());
        }
        if ($number == $i - 1 && $located) {
            $next_section = array('id' => $sec->id(), 'title' => $sec->getVar('title'), 'link' => $sec->permalink());
            break;
        }
        $i++;
        $sprev = $sec;
    }
    $GLOBALS['rd_section_number'] = $number;
    $sections = RDFunctions::get_section_tree($section->id(), $res, $number, true);
    array_walk($sections, 'rd_insert_edit');
    // Check last modification date
    $last_modification = 0;
    foreach ($sections as $sec) {
        if ($sec['modified'] > $last_modification) {
            $last_modification = $sec['modified'];
            $last_author = array('id' => $sec['author'], 'name' => $sec['author_name']);
        }
    }
    // Event
    $sections = RMEvents::get()->run_event('docs.show.section', $sections, $res, $section);
    RMTemplate::get()->add_style('docs.css', 'docs');
    RMTemplate::get()->add_jquery();
    RMTemplate::get()->add_script(XOOPS_URL . '/modules/docs/include/js/docs.js');
    // URLs
    if ($xoopsModuleConfig['permalinks']) {
        /**
         * @todo Generate friendly links
         */
        if (RMFunctions::plugin_installed('topdf')) {
            $pdf_book_url = RDFunctions::url() . '/pdfbook/' . $section->id() . '/';
            $pdf_section_url = RDFunctions::url() . '/pdfsection/' . $section->id() . '/';
        }
        $print_book_url = RDFunctions::url() . '/printbook/' . $section->id() . '/';
        $print_section_url = RDFunctions::url() . '/printsection/' . $section->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&id=' . $section->id() . '&action=pdfbook';
            $pdf_section_url = XOOPS_URL . '/modules/docs/index.php?page=content&id=' . $section->id() . '&action=pdfsection';
        }
        $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';
        if (RDFunctions::new_resource_allowed($xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS)) {
            $publish_url = RDFunctions::url() . '/?action=publish';
        }
    }
    // Comments
    RMFunctions::get_comments('docs', 'res=' . $res->id() . '&id=' . $section->id(), 'module', 0);
    RMFunctions::comments_form('docs', 'res=' . $res->id() . '&id=' . $section->id(), 'module', RDPATH . '/class/mywordscontroller.php');
    RDFunctions::breadcrumb();
    RMBreadCrumb::get()->add_crumb($res->getVar('title'), $res->permalink());
    RMBreadCrumb::get()->add_crumb($section->getVar('title'), $section->permalink());
    include RMEvents::get()->run_event('docs.section.template', RMTemplate::get()->get_template('rd_section.php', 'module', 'docs'));
    if ($standalone) {
        RDFunctions::standalone();
    }
    include 'footer.php';
}
 /**
  * Get image data
  */
 public function process_image_data($result)
 {
     $mc = RMUtilities::module_config('galleries');
     $users = array();
     $ret = array();
     $tf = new RMTimeFormatter(0, "%M%/%d%/%Y%");
     $db = Database::getInstance();
     $i = 0;
     while ($row = $db->fetchArray($result)) {
         $img = new GSImage();
         $img->assignVars($row);
         if (!isset($users[$img->owner()])) {
             $users[$img->owner()] = new GSUser($img->owner(), 1);
         }
         $imglink = $users[$img->owner()]->userURL() . ($mc['urlmode'] ? 'img/' . $img->id() . '/' : '&img=' . $img->id());
         $ret[$i] = array('id' => $img->id(), 'title' => $img->title(), 'thumbnail' => $users[$img->owner()]->filesURL() . '/ths/' . $img->image(), 'thumbuser' => $users[$img->owner()]->filesURL() . '/' . ($mc['user_format_mode'] ? 'formats/user_' : 'ths/') . $img->image(), 'thumbsrh' => $users[$img->owner()]->filesURL() . '/' . ($mc['search_format_mode'] ? 'formats/srh_' : 'ths/') . $img->image(), 'image' => $users[$img->owner()]->filesURL() . '/' . $img->image(), 'by' => sprintf(__('by %s', 'galleries'), '<a href="' . $users[$img->owner()]->userUrl() . '">' . $users[$img->owner()]->uname() . '</a>'), 'link' => $imglink, 'created' => $tf->format($img->created()), 'public' => $img->isPublic(), 'desc' => $img->desc());
         // Format resize
         if (!$img->userFormat() && $mc['user_format_mode']) {
             $format = $mc['user_format_values'];
             GSFunctions::resizeImage($format[0], $users[$img->owner()]->filesPath() . '/' . $img->image(), $users[$img->owner()]->filesPath() . '/formats/user_' . $img->image(), $format[1], $format[2]);
             $img->setUserFormat(1, 1);
         }
         if (!$img->searchFormat() && $mc['search_format_mode']) {
             $format = $mc['search_format_values'];
             GSFunctions::resizeImage($format[0], $users[$img->owner()]->filesPath() . '/' . $img->image(), $users[$img->owner()]->filesPath() . '/formats/srh_' . $img->image(), $format[1], $format[2]);
             $img->setSearchFormat(1, 1);
         }
         if ($mc['search_format_mode']) {
             $ret[$i]['viewmore'] = sprintf(__('Ver <a href="%s">más fotos</a>.', 'galleries'), $users[$img->owner()]->userURL());
             $ret[$i]['avatar'] = RMEvents::get()->run_event('rmcommon.get.avatar', $users[$img->owner()]->userVar('email'), 0, $users[$img->owner()]->userVar('user_avatar'));
             $tags = $img->tags(true);
             $tagurl = self::get_url() . ($mc['urlmode'] ? 'explore/tags/tag/' : '?explore=tags&amp;tag=');
             $strtag = '';
             foreach ($tags as $tag) {
                 $strtag .= $strtag == '' ? "<a href=\"{$tagurl}" . $tag->getVar('nameid') . "\">" . $tag->tag() . "</a>" : ", <a href=\"{$tagurl}" . $tag->getVar('nameid') . "\">" . $tag->tag() . "</a>";
             }
             $ret[$i]['tags'] = $strtag;
         }
         $i++;
     }
     RMTemplate::get()->add_local_script('photos.js', 'galleries');
     if (!$mc['quickview']) {
         return $ret;
     }
     if (RMFunctions::plugin_installed('lightbox')) {
         RMLightbox::get()->add_element('.pic_qview a');
         RMLightbox::get()->render();
     }
     return $ret;
 }
Esempio n. 4
0
// Author: Eduardo Cortés <*****@*****.**>
// Email: i.bitcero@gmail.com
// License: GPL 2.0
// --------------------------------------------------------------
$product = new ShopProduct($id);
if ($product->isNew()) {
    ShopFunctions::error404();
}
$xoopsOption['template_main'] = 'shop_product.html';
include 'header.php';
$tf = new RMTimeFormatter(0, '%d%/%T%/%Y%');
$sf = new ShopFunctions();
// Product data
$xoopsTpl->assign('product', array('name' => $product->getVar('name'), 'description' => $product->getVar('description'), 'price' => $product->getVar('price') > 0 ? sprintf(__('Price: <strong>%s</strong>', 'shop'), sprintf($xoopsModuleConfig['format'], number_format($product->getVar('price'), 2))) : '', 'buy' => $sf->get_buy_link($product), 'type' => $product->getVar('type'), 'stock' => $product->getVar('available'), 'image' => $product->getVar('image'), 'created' => sprintf(__('Since: <strong>%s</strong>', 'shop'), $tf->format($product->getVar('created'))), 'updated' => $product->getVar('modified') > 0 ? sprintf(__("Updated: <strong>%s</strong>", 'shop'), $tf->format($product->getVar('modified'))) : '', 'link' => $product->permalink(), 'metas' => $product->get_meta(), 'images' => $product->get_images()));
$product->setVar('hits', $product->getVar('hits') + 1);
$product->save();
$options = array('<a href="' . ShopFunctions::get_url() . ($xoopsModuleConfig['urlmode'] ? 'contact/' . $product->getVar('nameid') . '/' : '?contact=' . $product->id()) . '">' . __('Request Information', 'shop') . '</a>');
$options = RMEvents::get()->run_event('shop.product.options', $options);
$xoopsTpl->assign('options', $options);
$xoopsTpl->assign('product_details', 1);
$xoopsTpl->assign('xoops_pagetitle', $product->getVar('name') . ' &raquo; ' . $xoopsModuleConfig['modtitle']);
$xoopsTpl->assign('lang_instock', __('In stock', 'shop'));
$xoopsTpl->assign('lang_outstock', __('Out of stock', 'shop'));
$xoopsTpl->assign('lang_buy', __('Buy Now!', 'shop'));
RMTemplate::get()->add_style('main.css', 'shop');
// Now minishop will use lightbox plugin for Common Utilities
if (RMFunctions::plugin_installed('lightbox')) {
    RMLightbox::get()->add_element('.prod_thumbs a');
    RMLightbox::get()->render();
}
include 'footer.php';
Esempio n. 5
0
/**
* Show all images existing in database
*/
function show_images()
{
    global $xoopsModule, $xoopsModuleConfig;
    $db = Database::getInstance();
    // Check if some category exists
    $catnum = RMFunctions::get_num_records("rmc_img_cats");
    if ($catnum <= 0) {
        redirectMsg('images.php?action=newcat', __('There are not categories yet! Please create one in order to add images.', 'rmcommon'), 1);
        die;
    }
    $cat = rmc_server_var($_GET, 'category', 0);
    if ($cat <= 0) {
        header('location: images.php?action=showcats');
        die;
    }
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("rmc_images");
    if ($cat > 0) {
        $sql .= " WHERE cat='{$cat}'";
    }
    /**
     * Paginacion de Resultados
     */
    $page = rmc_server_var($_GET, 'page', 1);
    $limit = $xoopsModuleConfig['imgsnumber'];
    list($num) = $db->fetchRow($db->query($sql));
    $tpages = ceil($num / $limit);
    $page = $page > $tpages ? $tpages : $page;
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url('images.php?' . ($cat > 0 ? 'category=' . $cat : '') . '&page={PAGE_NUM}');
    // Get categories
    $sql = "SELECT * FROM " . $db->prefix("rmc_images") . " " . ($cat > 0 ? "WHERE cat='{$cat}'" : '') . " ORDER BY id_img DESC LIMIT {$start},{$limit}";
    $result = $db->query($sql);
    $images = array();
    $categories = array();
    $authors = array();
    $category = new RMImageCategory($cat);
    $sizes = $category->getVar('sizes');
    $current_size = array();
    foreach ($sizes as $size) {
        if (empty($current_size)) {
            $current_size = $size;
        } else {
            if ($current_size['width'] >= $size['width'] && $size['width'] > 0) {
                $current_size = $size;
            }
        }
    }
    while ($row = $db->fetchArray($result)) {
        $img = new RMImage();
        $img->assignVars($row);
        if (!isset($categories[$img->getVar('cat')])) {
            $categories[$img->getVar('cat')] = new RMImageCategory($img->getVar('cat'));
        }
        if (!isset($authors[$img->getVar('uid')])) {
            $authors[$img->getVar('uid')] = new XoopsUser($img->getVar('uid'));
        }
        $fd = pathinfo($img->getVar('file'));
        $images[] = array('id' => $img->id(), 'title' => $img->getVar('title'), 'date' => $img->getVar('date'), 'desc' => $img->getVar('desc', 'n'), 'cat' => $categories[$img->getVar('cat')]->getVar('name'), 'author' => $authors[$img->getVar('uid')], 'file' => XOOPS_UPLOAD_URL . '/' . date('Y', $img->getVar('date')) . '/' . date('m', $img->getVar('date')) . '/sizes/' . $fd['filename'] . '_' . $current_size['width'] . 'x' . $current_size['height'] . '.' . $fd['extension'], 'big' => XOOPS_UPLOAD_URL . '/' . date('Y', $img->getVar('date')) . '/' . date('m', $img->getVar('date')) . '/' . $fd['filename'] . '.' . $fd['extension']);
    }
    $categories = RMFunctions::load_images_categories();
    if (RMFunctions::plugin_installed('lightbox')) {
        RMLightbox::get()->add_element('#list-images a.bigimages');
        RMLightbox::get()->render();
    }
    xoops_cp_header();
    RMFunctions::create_toolbar();
    RMTemplate::get()->add_style('imgmgr.css', 'rmcommon');
    RMTemplate::get()->add_style('general.css', 'rmcommon');
    RMTemplate::get()->add_script('include/js/jquery.checkboxes.js');
    include RMTemplate::get()->get_template('images_images.php', 'module', 'rmcommon');
    xoops_cp_footer();
}
Esempio n. 6
0
 public function eventRmcommonTextTodisplay($text, $source)
 {
     if (defined("XOOPS_CPFUNC_LOADED")) {
         return $text;
     }
     $search = "/\\[gallery (.*?)\\]/is";
     $replace = "\$1";
     $amatches = array();
     $count = preg_match_all($search, $text, $amatches);
     if ($count <= 0) {
         return $text;
     }
     for ($ic = 0; $ic < $count; $ic++) {
         $matches = array($amatches[0][$ic], $amatches[1][$ic]);
         $search = explode(" ", strip_tags($matches[1]));
         foreach ($search as $i) {
             $t = explode("=", $i);
             ${$t}[0] = $t[1];
         }
         include_once XOOPS_ROOT_PATH . '/modules/galleries/class/gsfunctions.class.php';
         $data = GSFunctions::load_images($id, $num, 1);
         if (empty($data)) {
             $text = str_replace($matches[0], '', $text);
             continue;
         }
         $images = $data['images'];
         if (!defined("GS_INCLUDED_GALS")) {
             if (RMFunctions::plugin_installed("lightbox")) {
                 RMLightbox::get()->add_element('.gs_gsl_item a');
                 RMLightbox::get()->render();
             }
             RMTemplate::get()->add_xoops_style('inclusion.css', 'galleries');
             RMTemplate::get()->add_local_script('inclusion.js', 'galleries');
             RMTemplate::get()->add_head('<script type="text/javascript">var gsurl = "' . XOOPS_URL . '/modules/galleries";</script>');
             define("GS_INCLUDED_GALS", 1);
         }
         // Pagination
         $page = $data['current'];
         $limit = $data['limit'];
         $num = $data['total'];
         $set = $data['set'];
         if ($full == 'true') {
             $nav = new RMPageNav($num, $limit, $page);
             $nav->set_template(RMTemplate::get()->get_template("other/gs_nav_included.php", "module", "galleries"));
             $nav->target_url($set['id'] . ',' . $limit);
         }
         $content = '';
         ob_start();
         echo '<div class="gals_loader">';
         include RMTemplate::get()->get_template('other/gs_gals_inclusion.php', 'module', 'galleries');
         echo '</div>';
         $content = ob_get_clean();
         $text = str_replace($matches[0], $content, $text);
     }
     return $text;
 }
Esempio n. 7
0
    // URLs
    if ($xoopsModuleConfig['permalinks']) {
        $config = array();
        $config =& $xoopsModuleConfig;
        /**
         * @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);
Esempio n. 8
0
 /**
  * is module or plugin installed?
  * @paramn string Directory name of module or plugin
  * @param string type can be 'module' or 'plugin'
  * @return bool
  */
 public function installed($dirname, $type)
 {
     $rmf = new RMFunctions();
     if ($type == 'plugin') {
         return $rmf->plugin_installed($dirname);
     } else {
         $mod = RMModules::load_module($dirname);
         if ($mod->isNew()) {
             return false;
         } else {
             return true;
         }
     }
 }