Ejemplo n.º 1
0
 /**
  * Obtiene el enlace a la categor?a
  */
 public function permalink()
 {
     $mc = RMSettings::module_settings('mywords');
     $link = MWFunctions::get_url();
     $link .= $mc->permalinks == 1 ? '?cat=' . $this->id() : ($mc->permalinks == 2 ? 'category/' . $this->path() : 'category/' . $this->id());
     return $link;
 }
Ejemplo n.º 2
0
 public function permalink()
 {
     $mc = RMSettings::module_settings('mywords');
     $rtn = MWFunctions::get_url();
     $rtn .= $mc->permalinks == 1 ? '?author=' . $this->id() : ($mc->permalinks == 2 ? "author/" . $this->getVar('shortname', 'n') . "/" : "author/" . RMUtilities::add_slash($this->id()));
     return $rtn;
 }
Ejemplo n.º 3
0
 public function eventRmcommonGetFeedsList($feeds)
 {
     load_mod_locale('bxpress');
     include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxfunctions.class.php';
     include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxforum.class.php';
     $module = RMModules::load_module('bxpress');
     $config = RMSettings::module_settings('bxpress');
     $url = XOOPS_URL . '/' . ($config->urlmode ? $config->htbase : 'modules/bxpress') . '/';
     $bxFunc = new bXFunctions();
     $data = array('title' => $module->name(), 'url' => $url, 'module' => 'bxpress');
     $options[] = array('title' => __('All Recent Messages', 'bxpress'), 'params' => 'show=all', 'description' => __('Show all recent messages', 'bxpress'));
     $forums = $bxFunc->forumList('', false);
     $table = '<table cellpadding="2" cellspacing="2" width="100%"><tr class="even">';
     $count = 0;
     foreach ($forums as $forum) {
         if ($count >= 3) {
             $count = 0;
             $table .= '</tr><tr class="' . tpl_cycle("odd,even") . '">';
         }
         $table .= '<td width="33%"><a href="' . XOOPS_URL . '/backend.php?action=showfeed&amp;mod=bxpress&amp;show=forum&amp;forum=' . $forum['id'] . '">' . $forum['title'] . '</a></td>';
         $count++;
     }
     $table .= '</tr></table>';
     $options[] = array('title' => __('Posts by forum', 'bxpress'), 'description' => __('Select a forum to see the messages posted recently.', 'bxpress') . ' <a href="javascript:;" onclick="$(\'#bxforums-feed\').slideToggle(\'slow\');">Show Forums</a>
                         <div id="bxforums-feed" style="padding: 10px; display: none;">' . $table . '</div>');
     unset($forums);
     $feed = array('data' => $data, 'options' => $options);
     $feeds[] = $feed;
     return $feeds;
 }
 public function from_name()
 {
     global $xoopsConfig;
     $mc = RMSettings::module_settings('bxpress');
     $ret = $xoopsConfig['sitename'] . ': ' . $mc->forum_title;
     return $ret;
 }
Ejemplo n.º 5
0
 function permalink()
 {
     $mc = RMSettings::module_settings('mywords');
     $ret = MWFunctions::get_url();
     $ret .= $mc->permalinks == 1 ? '?tag=' . $this->id() : ($mc->permalinks == 2 ? "tag/" . $this->getVar('shortname', 'n') . "/" : "tag/" . $this->id());
     return $ret;
 }
Ejemplo n.º 6
0
 public function get_main_link()
 {
     $mc = RMSettings::module_settings('mywords');
     if ($mc->permalinks > 1) {
         return XOOPS_URL . $mc->basepath;
     } else {
         return XOOPS_URL . '/modules/mywords';
     }
 }
Ejemplo n.º 7
0
function bxpress_block_topics_show($options)
{
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $mc = RMSettings::module_settings('bxpress');
    $tbl1 = $db->prefix('mod_bxpress_posts');
    $tbl2 = $db->prefix('mod_bxpress_topics');
    $tbl3 = $db->prefix('mod_bxpress_likes');
    $tbl4 = $db->prefix('mod_bxpress_forums');
    // Calculate period of time
    if (0 < $options['days']) {
        $period = time() - $options['days'] * 86400;
    }
    $order = 'DESC' == $options['order'] ? 'DESC' : 'ASC';
    $sql = "SELECT topics.*, forums.name,\n                (SELECT SUM(likes) FROM {$tbl1} WHERE id_topic=topics.id_topic) as likes,\n                (SELECT post_time FROm {$tbl1} WHERE id_topic=topics.id_topic ORDER BY post_time DESC LIMIT 0, 1) as updated\n                FROM {$tbl2} as topics, {$tbl4} as forums WHERE ";
    if (0 < $options['days']) {
        $sql .= " topics.date > {$period} AND ";
    }
    $sql .= "forums.id_forum=topics.id_forum";
    if ('recent' == $options['type']) {
        $sql .= " ORDER BY topics.id_topic {$order} LIMIT 0, {$options['limit']}";
    } elseif ('hot' == $options['type']) {
        $sql .= " ORDER BY topics.replies {$order} LIMIT 0, {$options['limit']}";
    } elseif ('hits' == $options['type']) {
        $sql .= " ORDER BY topics.views {$order} LIMIT 0, {$options['limit']}";
    }
    $result = $db->queryF($sql);
    $topics = array();
    $block = array();
    include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxforum.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxpost.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxtopic.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxfunctions.class.php';
    $topic = new bXTopic();
    $forum = new bXForum();
    $tf = new RMTimeFormatter(0, '%T% %d%, %Y%');
    while ($row = $db->fetchArray($result)) {
        $topic->assignVars($row);
        $forum->assignVars(array('id_forum' => $topic->forum()));
        $ret = array('id' => $topic->id(), 'title' => $topic->title, 'link' => $topic->permalink(), 'likes' => $topic->likes, 'replies' => $topic->replies, 'hits' => $topic->views, 'forum' => array('name' => $row['name'], 'id' => $row['id_forum'], 'link' => $forum->permalink()), 'time' => $topic->date, 'date' => $tf->ago($topic->date), 'likes' => $row['likes'], 'updated' => 'full' == $options['format'] ? sprintf(__('Updated on %s', 'bxpress'), $tf->format($row['updated'])) : $tf->ago($row['updated']));
        $topics[] = $ret;
    }
    $block['topics'] = $topics;
    $block['format'] = $options['format'];
    // Add css styles
    RMTemplate::get()->add_style('bxpress-blocks.min.css', 'bxpress');
    return $block;
}
Ejemplo n.º 8
0
function mywordsBlockRecent($options)
{
    global $xoopsModuleConfig, $xoopsModule, $xoopsUser;
    $mc = RMSettings::module_settings('mywords');
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $by = '';
    switch ($options[1]) {
        case 'recent':
            $by = 'pubdate';
            break;
        case 'popular':
            $by = "`reads`";
            break;
        case 'comm':
            $by = "`comments`";
            break;
    }
    $posts = MWFunctions::get_posts_by_cat($options[5], 0, $options[0], $by, 'DESC');
    $block = array();
    foreach ($posts as $post) {
        $ret = array();
        $ret['id'] = $post->id();
        $ret['title'] = $post->getVar('title');
        $ret['link'] = $post->permalink();
        // Content
        if ($options[2]) {
            $ret['content'] = TextCleaner::getInstance()->truncate($post->content(true), $options[3]);
        }
        // Pubdate
        if ($options[4]) {
            $ret['date'] = formatTimestamp($post->getVar('pubdate'), 'c');
        }
        // Show reads
        if ($options[1] == 'popular') {
            $ret['hits'] = sprintf(__('%u Reads', 'mywords'), $post->getVar('reads'));
        } elseif ($options[1] == 'comm') {
            $ret['comments'] = sprintf(__('%u Comments', 'mywords'), $post->getVar('comments'));
        }
        $ret['time'] = $post->getVar('pubdate');
        $ret['image'] = RMIMage::get()->load_from_params($post->image);
        $block['posts'][] = $ret;
    }
    RMTemplate::get()->add_style('mwblocks.css', 'mywords');
    return $block;
}
 protected function construct_module($module)
 {
     global $xoopsModule;
     if ($xoopsModule && $xoopsModule->getVar('dirname') == $module) {
         $moduleObject = $xoopsModule;
     } else {
         $moduleObject = RMModules::load_module($module);
     }
     if (!is_a($moduleObject, 'XoopsModule')) {
         throw new RMException(sprintf(__('The module "%s" does not exists!', 'rmcommon'), $module));
     }
     // Initialize properties
     $this->module_data = array('settings' => RMSettings::module_settings($module), 'path' => XOOPS_ROOT_PATH . '/modules/' . $module, 'real_url' => XOOPS_URL . '/modules/' . $module, 'data' => (object) $moduleObject->getInfo(), 'directory' => $module, 'controller' => '', 'action' => '', 'default_controller' => '', 'default_action' => '', 'parameters' => array());
     $this->module = $moduleObject;
     if (defined('XOOPS_CPFUNC_LOADED')) {
         $this->module_data['menu'] = $moduleObject->getAdminMenu();
     }
     $this->module_data['url'] = $this->url;
 }
Ejemplo n.º 10
0
/**
 * Función para realizar búsquedas
 */
function mywords_search($qa, $andor, $limit, $offset, $userid)
{
    global $xoopsUser;
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    include_once XOOPS_ROOT_PATH . '/modules/mywords/class/mwpost.class.php';
    $util =& RMUtilities::get();
    $mc =& RMSettings::module_settings('mywords');
    $sql = "SELECT * FROM " . $db->prefix("mod_mywords_posts");
    $adds = '';
    if (is_array($qa) && ($count = count($qa))) {
        $adds = '';
        for ($i = 0; $i < $count; $i++) {
            $adds .= $adds == '' ? "(title LIKE '%{$qa[$i]}%' OR content LIKE '%{$qa[$i]}%')" : " {$andor} (title LIKE '%{$qa[$i]}%' OR content LIKE '%{$qa[$i]}%')";
        }
    }
    $sql .= $adds != '' ? " WHERE " . $adds : '';
    if ($userid > 0) {
        $sql .= ($adds != '' ? " AND " : " WHERE ") . "author='{$userid}'";
    }
    $sql .= " ORDER BY pubdate DESC";
    $i = 0;
    $result = $db->query($sql, $limit, $offset);
    $ret = array();
    while ($row = $db->fetchArray($result)) {
        $post = new MWPost();
        $post->assignVars($row);
        $ret[$i]['image'] = "images/post.png";
        $ret[$i]['link'] = $post->permalink();
        $ret[$i]['title'] = $post->getVar('title');
        $ret[$i]['time'] = $post->getVar('pubdate');
        $ret[$i]['uid'] = $post->getVar('author');
        $ret[$i]['desc'] = substr(strip_tags($post->content()), 0, 150);
        $i++;
    }
    return $ret;
}
Ejemplo n.º 11
0
function mywordsBlockCats($options)
{
    global $xoopsModuleConfig, $xoopsModule;
    $categos = array();
    MWFunctions::categos_list($categos, 0, 0, $options[0]);
    $block = array();
    $mc = $xoopsModule && $xoopsModule->getVar('dirname') == 'mywords' ? $xoopsModuleConfig : RMSettings::module_settings('mywords');
    foreach ($categos as $k) {
        $ret = array();
        $cat = new MWCategory();
        $cat->assignVars($k);
        $cat->loadPosts();
        $ret['id'] = $cat->id();
        $ret['name'] = $cat->getVar('name');
        if (isset($options[1]) && $options[1]) {
            $ret['posts'] = $cat->getVar('posts');
        }
        $ret['indent'] = $k['indent'] * 2;
        $ret['link'] = $cat->permalink();
        $block['categos'][] = $ret;
    }
    RMTemplate::get()->add_style('mwblocks.css', 'mywords');
    return $block;
}
Ejemplo n.º 12
0
<?php

// $Id: files.php 819 2011-12-08 23:43:13Z i.bitcero $
// --------------------------------------------------------------
// bXpress Forums
// An simple forums module for XOOPS and Common Utilities
// Author: Eduardo Cortés <*****@*****.**>
// Email: i.bitcero@gmail.com
// License: GPL 2.0
// --------------------------------------------------------------
load_mod_locale("dtransport");
$show = rmc_server_var($_GET, 'show', 'all');
$xoopsModule = RMFunctions::load_module('bxpress');
$config = RMSettings::module_settings('bxpress');
include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxforum.class.php';
include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxpost.class.php';
include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxtopic.class.php';
include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxfunctions.class.php';
$rss_channel = array();
$rss_items = array();
$bxFunc = new bXFunctions();
$db = XoopsDatabaseFactory::getDatabaseConnection();
$tc = TextCleaner::getInstance();
$tbl1 = $db->prefix('mod_bxpress_posts');
$tbl2 = $db->prefix('mod_bxpress_topics');
$tbl3 = $db->prefix('mod_bxpress_posts_text');
$tbl4 = $db->prefix('mod_bxpress_forums');
switch ($show) {
    case 'forum':
        $id = rmc_server_var($_GET, 'forum', 0);
        if ($id <= 0) {
Ejemplo n.º 13
0
 public function format_time($time)
 {
     $day = date('d', $time);
     $month = date('m', $time);
     $year = date('Y', $time);
     $format = __("Published on %s at %s", 'mywords');
     $config = RMSettings::module_settings('mywords');
     if ($config->permalinks > 1) {
         $url = MWFunctions::get_url() . "{$day}/{$month}/{$year}/";
     } else {
         $url = MWFunctions::get_url() . "?date={$day}/{$month}/{$year}/";
     }
     $date = '<a href="' . $url . '">' . date(__('D d M, Y', 'mywords'), $time) . '</a>';
     $hour = date(__('H:i', 'mywords'), $time);
     $rtn = sprintf($format, $date, $hour);
     return $rtn;
 }
Ejemplo n.º 14
0
include '../header.php';
include XOOPS_ROOT_PATH . '/modules/mywords/class/mwtrackback.php';
global $xoopsLogger;
$xoopsLogger->renderingEnabled = false;
error_reporting(0);
$xoopsLogger->activated = false;
$frontend = 0;
extract($_POST);
/*if(!$xoopsSecurity->check() || !$xoopsSecurity->checkReferer()){
    $ret = array(
        'error'=>__('You are not allowed to do this operation!','mywords')
    );
    echo json_encode($ret);
    die();
}*/
$mc = RMSettings::module_settings('mywords');
if (!isset($xoopsUser) || !$xoopsUser->isAdmin() && !$mc->submit) {
    return_error(__('You are not allowed to do this action!', 'mywords'), false, MW_URL);
}
$editor = new MWEditor();
$editor->from_user($author);
if ($op == 'saveedit') {
    if (!isset($id) || $id <= 0) {
        return_error(__('You must provide a valid post ID', 'mywords'), 0, 'posts.php');
        die;
    }
    $post = new MWPost($id);
    if ($post->isNew()) {
        return_error(__('You must provide an existing post ID', 'mywords'), 0, 'posts.php');
        die;
    }
Ejemplo n.º 15
0
 /**
  * Obtiene el enlace permanente al artículo
  */
 public function permalink()
 {
     $mc = RMSettings::module_settings('mywords');
     $day = date('d', $this->getVar('pubdate'));
     $month = date('m', $this->getVar('pubdate'));
     $year = date('Y', $this->getVar('pubdate'));
     $rtn = MWFunctions::get_url();
     $rtn .= $mc->permalinks == 1 ? '?post=' . $this->id() : ($mc->permalinks == 2 ? "{$day}/{$month}/{$year}/" . $this->getVar('shortname', 'n') . "/" : "post/" . $this->id());
     return $rtn;
 }
Ejemplo n.º 16
0
 /**
  * Init data for theme rendering
  */
 public function init()
 {
     global $xoopsTpl, $xoopsConfig, $rmc_config, $xoTheme;
     // xThemes settings (?)
     $this->xsettings = RMSettings::module_settings('xthemes');
     $xoopsTpl->assign('isHome', defined('XTHEMES_IS_HOME'));
     if (!$this->isSupported()) {
         return;
     }
     if ($this->current->getInfo('dir') != $xoopsConfig['theme_set']) {
         // If user has selected another theme, realod all theme data
         $dir = XOOPS_THEME_PATH . '/' . $xoopsConfig['theme_set'];
         if (!is_file($dir . '/assemble/' . $xoopsConfig['theme_set'] . '.theme.php')) {
             $this->current = new StandardTheme();
             $this->current->set_dir($xoopsConfig['theme_set']);
             return;
         }
         require_once $dir . '/assemble/' . $xoopsConfig['theme_set'] . '.theme.php';
         $class = ucfirst($xoopsConfig['theme_set']);
         $this->current = new $class();
         /**
          * The theme support native menus?
          */
         $this->root_menus = $this->current->haveMenus();
         /**
          * Load theme configuration
          */
         $this->current->setSettings($this->load_settings());
         /*
          * @todo Agregar código para carga de métodos del tema
          */
         $this->loadMenus();
         // Register pluguins
         if (method_exists($this->current, 'register')) {
             $plugins = $this->theme()->register();
             $dir = str_replace(XOOPS_URL, XOOPS_ROOT_PATH, $this->theme()->url() . '/assemble/plugins');
             foreach ($plugins as $plug) {
                 if (!file_exists($dir . '/' . $plug['file'])) {
                     continue;
                 }
                 include_once $dir . '/' . $plug['file'];
                 $this->registered[$plug['var']] = new $plug['name']();
             }
         }
     }
     $xoopsTpl->assign('theme', $this->theme());
     $xoopsTpl->assign('xtConfig', $this->theme()->settings());
     $xoopsTpl->assign('xt_language', $rmc_config['lang']);
     $xoopsTpl->assign('isHome', defined('XTHEMES_IS_HOME'));
     $this->colors = new XtColor();
     $xoopsTpl->assign('xtColor', $this->colors);
     // Assign plugins
     foreach ($this->registered as $id => $o) {
         $xoopsTpl->assign($id, $o);
     }
     // Register smarty plugins
     $dir = str_replace(XOOPS_URL, XOOPS_ROOT_PATH, $this->theme()->url());
     $xoopsTpl->plugins_dir[] = XOOPS_ROOT_PATH . '/modules/xthemes/smarty';
     $xoopsTpl->plugins_dir[] = $dir . '/assemble/smarty';
     load_theme_locale($this->theme()->getInfo('dir'));
     $this->current->init();
 }
Ejemplo n.º 17
0
 /**
  * @deprecated
  * Retrieves the configuration for a given module.
  *
  * This function is deprecated, use RMSettings::settings->module_settings() instead
  *
  * @param string $directory Nombre del M?dulo
  * @param string $option Nombre de la opci?n de configuraci?n
  * @return string o array
  */
 public function module_config($directory, $option = '')
 {
     trigger_error(sprintf(__('Method %s is deprecated. Use %s::%s instead.', 'rmcommon'), __METHOD__, 'RMSettings', 'module_settings()'), E_USER_DEPRECATED);
     $settings = RMSettings::module_settings($directory, $option);
     if (is_object($settings)) {
         return (array) $settings;
     } else {
         return $settings;
     }
 }
Ejemplo n.º 18
0
    /**
     * Return the feed options to show in RSS Center
     */
    public function eventRmcommonGetFeedsList($feeds)
    {
        global $cuSettings;
        include_once XOOPS_ROOT_PATH . '/modules/mywords/class/mwfunctions.php';
        load_mod_locale('mywords');
        $module = RMModules::load_module('mywords');
        $config = RMSettings::module_settings('mywords');
        $data = array('title' => $module->name(), 'url' => XOOPS_URL . $config->basepath, 'module' => 'mywords');
        $options[] = array('title' => __('All Recent Posts', 'mywords'), 'params' => 'show=all', 'description' => __('Show all recent posts', 'mywords'));
        $categories = array();
        MWFunctions::categos_list($categories);
        $table = '<table cellpadding="2" cellspacing="2" width="100%"><tr class="even">';
        $count = 0;
        $base_link = $cuSettings->permalinks ? XOOPS_URL . '/rss/' : XOOPS_URL . '/backend.php';
        foreach ($categories as $cat) {
            if ($count >= 3) {
                $count = 0;
                $table .= '</tr><tr class="' . tpl_cycle("odd,even") . '">';
            }
            $table .= '<td width="33%"><a href="' . $base_link . '?action=showfeed&amp;mod=mywords&amp;show=cat&amp;cat=' . $cat['id_cat'] . '">' . $cat['name'] . '</a></td>';
            $count++;
        }
        $table .= '</tr></table>';
        $options[] = array('title' => __('Posts by category', 'mywords'), 'description' => __('Select a category to see the posts published recently.', 'mywords') . ' <a href="javascript:;" onclick="$(\'#categories-feed\').slideToggle(\'slow\');">Show Categories</a>
						    <div id="categories-feed" style="padding: 10px; display: none;">' . $table . '</div>');
        unset($categories);
        $tags = MWFunctions::get_tags("*", '', '', 99);
        $table = '<table cellpadding="2" cellspacing="2" width="100%"><tr class="even">';
        $count = 0;
        foreach ($tags as $tag) {
            if ($count >= 3) {
                $count = 0;
                $table .= '</tr><tr class="' . tpl_cycle("odd,even") . '">';
            }
            $table .= '<td width="33%"><a href="' . $base_link . '?action=showfeed&amp;mod=mywords&amp;show=tag&amp;tag=' . $tag['id_tag'] . '">' . $tag['tag'] . '</a></td>';
            $count++;
        }
        $table .= '</tr></table>';
        $options[] = array('title' => __('Show posts by tag', 'mywords'), 'description' => __('Select a tag to see the posts published recently.', 'mywords') . ' <a href="javascript:;" onclick="$(\'#tags-feed\').slideToggle(\'slow\');">Show Tags</a>
						    <div id="tags-feed" style="padding: 10px; display: none;">' . $table . '</div>');
        unset($tags);
        $db = XoopsDatabaseFactory::getDatabaseConnection();
        $sql = "SELECT * FROM " . $db->prefix("mod_mywords_editors") . " ORDER BY name";
        $result = $db->query($sql);
        $editors = array();
        while ($row = $db->fetchArray($result)) {
            $editors[] = $row;
        }
        asort($editors);
        $table = '<table cellpadding="2" cellspacing="2" width="100%"><tr class="even">';
        $count = 0;
        foreach ($editors as $ed) {
            if ($count >= 3) {
                $count = 0;
                $table .= '</tr><tr class="' . tpl_cycle("odd,even") . '">';
            }
            $table .= '<td width="33%"><a href="' . $base_link . '?action=showfeed&amp;mod=mywords&amp;show=author&amp;author=' . $ed['id_editor'] . '">' . $ed['name'] . '</a></td>';
            $count++;
        }
        $table .= '</tr></table>';
        $options[] = array('title' => __('Show posts by author', 'mywords'), 'description' => __('Select an author to see the posts published recently.', 'mywords') . ' <a href="javascript:;" onclick="$(\'#editor-feed\').slideToggle(\'slow\');">Show Authors</a>
						    <div id="editor-feed" style="padding: 10px; display: none;">' . $table . '</div>');
        unset($editors);
        unset($table);
        RMTemplate::get()->add_jquery();
        $feed = array('data' => $data, 'options' => $options);
        $feeds[] = $feed;
        return $feeds;
    }
Ejemplo n.º 19
0
function exmbb_rssdesc()
{
    global $util;
    $mc = RMSettings::module_settings('exmbb');
    return $mc->rssdesc;
}
Ejemplo n.º 20
0
 public function permalink()
 {
     $mc = RMSettings::module_settings('bxpress');
     if ($mc->urlmode) {
         $link = XOOPS_URL . $mc->htbase . '/topic.php?id=' . $this->id();
     } else {
         $link = XOOPS_URL . '/modules/bxpress/';
         $link .= "topic.php?id=" . $this->id();
     }
     return $link;
 }
Ejemplo n.º 21
0
 public static function url()
 {
     $mc = RMSettings::module_settings('bxpress');
     if ($mc->urlmode) {
         return XOOPS_URL . '/' . trim($mc->htbase, '/');
     } else {
         return XOOPS_URL . '/modules/bxpress';
     }
 }
Ejemplo n.º 22
0
 public function text()
 {
     if (!$this->havetext && $this->getVar('post_text', 'n') == '') {
         // Cargamos el texto
         $sql = "SELECT * FROM " . $this->db->prefix("mod_bxpress_posts_text") . " WHERE post_id='" . $this->id() . "'";
         $result = $this->db->queryF($sql);
         if ($this->db->getRowsNum($result) <= 0) {
             return;
         }
         $this->havetext = true;
         $row = $this->db->fetchArray($result);
         $this->setVar('post_text', $row['post_text']);
         $this->setVar('post_edit', $row['post_edit']);
     }
     // Clean HTML
     $mc = RMSettings::module_settings('bxpress');
     if (!$mc->html) {
         $this->setVar('post_text', TextCleaner::getInstance()->specialchars($this->getVar('post_text', 'n')));
     }
     //$this->setVar('post_text', TextCleaner::getInstance()->to_display($this->getVar('post_text')));
     return $this->getVar('post_text', 's');
 }
Ejemplo n.º 23
0
// $Id: rss.php 824 2011-12-08 23:50:30Z i.bitcero $
// --------------------------------------------------------------
// MyWords
// Complete Blogging System
// Author: BitC3R0 <*****@*****.**>
// Email: i.bitcero@gmail.com
// License: GPL 2.0
// --------------------------------------------------------------
if (!defined('XOOPS_MAINFILE_INCLUDED')) {
    header('Location: ../../backend.php');
    die;
}
load_mod_locale("mywords");
$show = rmc_server_var($_GET, 'show', 'all');
$xoopsModule = RMFunctions::load_module('mywords');
$config = RMSettings::module_settings('mywords');
include_once XOOPS_ROOT_PATH . '/modules/mywords/class/mwfunctions.php';
$rss_channel = array();
switch ($show) {
    case 'cat':
        include_once XOOPS_ROOT_PATH . '/modules/mywords/class/mwcategory.class.php';
        $id = rmc_server_var($_GET, 'cat', 0);
        if ($id <= 0) {
            redirect_header('backend.php', 1, __('Sorry, specified category was not foud!', 'mywords'));
            die;
        }
        $cat = new MWCategory($id);
        if ($cat->isNew()) {
            redirect_header('backend.php', 1, __('Sorry, specified category was not foud!', 'mywords'));
            die;
        }
Ejemplo n.º 24
0
/**
 * Save module settings
 */
function save_module_settings()
{
    global $xoopsSecurity, $xoopsDB;
    $mod = RMHttpRequest::post('mod', 'string', '');
    $via_ajax = RMHttpRequest::post('via_ajax', 'integer', 0);
    if ($via_ajax) {
        $ajax = new AjaxResponse();
        $ajax->prepare_ajax_response();
    }
    if ($mod == '') {
        RMUris::redirect_with_message(__('A module has not been specified!', 'rmcommon'), 'settings.php', RMMSG_ERROR);
    }
    //echo RMHttpRequest::request('CUTOKEN_REQUEST', 'string', '') . ' ' . print_r($_SESSION['CUTOKEN_SESSION'], true); die();
    if (!$xoopsSecurity->check(true, false, $via_ajax ? 'CUTOKEN' : 'XOOPS_TOKEN')) {
        if ($via_ajax) {
            $ajax->ajax_response(__('Session token expired. Please try again.', 'rmcommon'), 1, 0);
        } else {
            RMUris::redirect_with_message(__('Session token expired. Please try again.', 'rmcommon'), 'settings.php', RMMSG_WARN);
        }
    }
    $module = RMModules::load_module($mod);
    if (!$module) {
        if ($via_ajax) {
            $ajax->ajax_response(__('The specified module does not exists.', 'rmcommon'), 1, 1);
        } else {
            RMUris::redirect_with_message(__('The specified module does not exists.', 'rmcommon'), 'settings.php', RMMSG_ERROR);
        }
    }
    $current_settings = (array) RMSettings::module_settings($module->getVar('dirname'));
    $new_settings = RMHttpRequest::post(ucfirst($module->getVar('dirname')), 'array', array());
    $configs = $module->getInfo('config');
    $fields = array();
    // Container for all fields and values
    foreach ($configs as $option) {
        $id = $option['name'];
        $field = new stdClass();
        $field->id = $id;
        $field->value = isset($values->{$id}) ? $values->{$id} : $option['default'];
        $field->caption = defined($option['title']) ? constant($option['title']) : $option['title'];
        $field->description = defined($option['description']) ? constant($option['description']) : $option['description'];
        $field->field = $option['formtype'];
        $field->type = $option['valuetype'];
        $field->options = isset($option['options']) ? $option['options'] : null;
        $category = isset($option['category']) ? $option['category'] : 'all';
        $fields[$id] = $field;
    }
    /**
     * This keys already exists in database
     */
    $to_save = array_intersect_key($new_settings, $current_settings);
    /**
     * This settings will be added to database beacause don't exists in table
     */
    $to_add = array_diff_key($new_settings, $current_settings);
    /**
     * This keys has been removed from xoops_version.php file and then
     * must be removed from table
     */
    $to_delete = array_diff_key($current_settings, $new_settings);
    $errors = '';
    // Errors ocurred while saving
    /**
     * First for all, remove unused items
     */
    $keys = array_keys($to_delete);
    if (!empty($keys)) {
        $sql = "DELETE FROM " . $xoopsDB->prefix("config") . " WHERE conf_modid = " . $module->mid() . " AND (conf_name = '" . implode("' OR conf_name='", $keys) . "')";
        if (!$xoopsDB->queryF($sql)) {
            $errors .= $xoopsDB->error() . '<br>';
        }
    }
    /**
     * Save existing items
     */
    if (!empty($to_save)) {
        foreach ($to_save as $name => $value) {
            $item = new Rmcommon_Config_Item($name, $module->mid());
            if (isset($fields[$name])) {
                $item->setVar('conf_valuetype', $fields[$name]->type);
                $item->setVar('conf_title', $fields[$name]->caption);
                $item->setVar('conf_desc', $fields[$name]->description);
                $item->setVar('conf_formtype', $fields[$name]->field);
            }
            $item->set_value($value, $item->getVar('conf_valuetype'));
            $item->save();
        }
    }
    /**
     * Add new items
     */
    if (!empty($to_add)) {
        foreach ($to_add as $name => $value) {
            $item = new Rmcommon_Config_Item($name, $module->mid());
            if (isset($fields[$name])) {
                $item->setVar('conf_modid', $module->mid());
                $item->setVar('conf_name', $name);
                $item->setVar('conf_valuetype', $fields[$name]->type);
                $item->setVar('conf_title', $fields[$name]->caption);
                $item->setVar('conf_desc', $fields[$name]->description);
                $item->setVar('conf_formtype', $fields[$name]->field);
            }
            $item->set_value($value, $item->getVar('conf_valuetype'));
            $item->save();
        }
    }
    /**
     * Notify to system events
     */
    RMEvents::get()->trigger('rmcommon.saved.settings', $module->dirname(), $to_save, $to_add, $to_delete);
    if ($module->getInfo('hasAdmin')) {
        $goto = XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/' . $module->getInfo('adminindex');
    } else {
        $goto = 'settings.php';
    }
    if ($via_ajax) {
        $ajax->ajax_response(__('Settings saved successfully!', 'rmcommon'), 0, 1, array('closeWindow' => '#cu-settings-form', 'notify' => array('icon' => 'svg-rmcommon-ok-circle', 'type' => 'alert-success')));
    } else {
        RMUris::redirect_with_message(__('Settings saved successfully!', 'rmcommon'), $goto, RMMSG_SUCCESS, 'fa fa-check');
    }
}