Exemplo n.º 1
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;
 }
Exemplo n.º 2
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;
 }
Exemplo n.º 4
0
function show_rss_content()
{
    global $xoopsConfig;
    include_once $GLOBALS['xoops']->path('class/template.php');
    $tpl = new XoopsTpl();
    $module = rmc_server_var($_GET, 'mod', '');
    if ($module == '') {
        redirect_header('backend.php', 1, __('Choose an option to see its feed', 'rmcommon'));
        die;
    }
    if (!file_exists(XOOPS_ROOT_PATH . '/modules/' . $module . '/rss.php')) {
        redirect_header('backend.php', 1, __('This module does not support rss feeds', 'rmcommon'));
        die;
    }
    $GLOBALS['xoopsLogger']->activated = false;
    if (function_exists('mb_http_output')) {
        mb_http_output('pass');
    }
    header('Content-Type:text/xml; charset=utf-8');
    include XOOPS_ROOT_PATH . '/modules/' . $module . '/rss.php';
    if (!isset($rss_channel['image'])) {
        $rmc_config = RMSettings::cu_settings();
        $rss_channel['image']['url'] = $rmc_config->rssimage;
        $dimention = getimagesize(XOOPS_ROOT_PATH . '/images/logo.png');
        $rss_channel['image']['width'] = $dimention[0] > 144 ? 144 : $dimention[0];
        $rss_channel['image']['height'] = $dimention[1] > 400 ? 400 : $dimention[1];
    }
    include RMTemplate::get()->get_template('rmc-rss.php', 'module', 'rmcommon');
}
Exemplo n.º 5
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;
 }
Exemplo n.º 6
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;
 }
Exemplo n.º 7
0
 /**
  * Class constructor.
  * Load all data from configurations and generate the initial clases
  * to manage the email
  *
  * @param string Content type for message body. It usually text/plain or text/html.
  * 		Default is 'text/plain' but can be changed later
  */
 public function __construct($content_type = 'text/plain')
 {
     $config = RMSettings::cu_settings();
     $config_handler =& xoops_gethandler('config');
     $xconfig = $config_handler->getConfigsByCat(XOOPS_CONF_MAILER);
     // Instantiate the Swit Transport according to our preferences
     // We can change this preferences later
     switch ($config->transport) {
         case 'mail':
             $this->swTransport = Swift_MailTransport::newInstance();
             break;
         case 'smtp':
             $this->swTransport = Swift_SmtpTransport::newInstance($config->smtp_server, $config->smtp_port, $config->smtp_crypt != 'none' ? $config->smtp_crypt : '');
             $this->swTransport->setUsername($config->smtp_user);
             $this->swTransport->setPassword($config->smtp_pass);
             break;
         case 'sendmail':
             $this->swTransport = Swift_SendmailTransport::newInstance($config->sendmail_path);
             break;
     }
     // Create the message object
     // Also this object could be change later with message() method
     $this->swMessage = Swift_Message::newInstance();
     $this->swMessage->setReplyTo($xconfig['from']);
     $this->swMessage->setFrom(array($xconfig['from'] => $xconfig['fromname']));
     $this->swMessage->setContentType($content_type);
 }
Exemplo n.º 8
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';
     }
 }
Exemplo n.º 9
0
 /**
  * @param string $caption Texto del campo
  * @param string $name Nombre de este campo
  * @param string $width Ancho del campo. Puede ser el valor en formato pixels (300px) o en porcentaje (100%)
  * @param string $height Alto de campo. El valor debe ser pasado en formato pixels (300px).
  * @param string $default Texto incial al cargar el campo. POr defecto se muestra vaco.
  * @param string $type Tipo de Editor. Posibles valores: tiny, html, xoops, simple, markdown
  */
 function __construct($caption, $name, $width = '100%', $height = '300px', $default = '', $type = '', $change = 1, $ele = array('op'))
 {
     $rmc_config = RMSettings::cu_settings();
     $tcleaner = TextCleaner::getInstance();
     $this->setCaption($caption);
     $this->setName($name);
     $this->_width = $width;
     $this->_height = $height;
     $this->_default = isset($_REQUEST[$name]) ? $tcleaner->stripslashes($_REQUEST[$name]) : $tcleaner->stripslashes($default);
     $this->_type = $type == '' ? $rmc_config->editor_type : $type;
     $this->_type = strtolower($this->_type);
     $this->_change = $change;
     $this->_eles = $ele;
 }
Exemplo n.º 10
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;
}
Exemplo n.º 11
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;
}
Exemplo n.º 12
0
 public function eventRmcommonXoopsCommonEnd()
 {
     global $xoopsConfig;
     // Get preloaders from current theme
     RMEvents::get()->load_extra_preloads(XOOPS_THEME_PATH . '/' . $xoopsConfig['theme_set'], ucfirst($xoopsConfig['theme_set'] . 'Theme'));
     $url = RMUris::current_url();
     $p = parse_url($url);
     $config = RMSettings::cu_settings();
     /**
      * This event has added in order to add custom codes in a "semantic" way, but
      * the codes can be added from any pertinent place
      */
     RMEvents::get()->run_event('rmcommon.load.codes');
     if (substr($p['path'], -11) == 'backend.php' && $config->rss_enable) {
         include_once RMCPATH . '/rss.php';
         die;
     }
 }
Exemplo n.º 13
0
 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;
 }
Exemplo n.º 14
0
 /**
  * @param string $caption Texto del campo
  * @param string $name Nombre de este campo
  * @param string $width Ancho del campo. Puede ser el valor en formato pixels (300px) o en porcentaje (100%)
  * @param string $height Alto de campo. El valor debe ser pasado en formato pixels (300px).
  * @param string $default Texto incial al cargar el campo. POr defecto se muestra vaco.
  * @param string $type Tipo de Editor. Posibles valores: tiny, html, xoops, simple, markdown
  */
 function __construct($caption, $name = null, $width = '100%', $height = '300px', $default = '', $type = '', $change = 1, $ele = array('op'))
 {
     $rmc_config = RMSettings::cu_settings();
     $tcleaner = TextCleaner::getInstance();
     if (is_array($caption)) {
         parent::__construct($caption);
     } else {
         parent::__construct([]);
         $this->setWithDefaults('caption', $caption, '');
         $this->setWithDefaults('name', $name, '');
         $this->setWithDefaults('id', $tcleaner->sweetstring($name), '');
         $this->setWithDefaults('width', $width, '100%');
         $this->setWithDefaults('height', $height, '300px');
         $this->setWithDefaults('value', isset($_REQUEST[$name]) ? $tcleaner->stripslashes($_REQUEST[$name]) : $tcleaner->stripslashes($default), '');
         $this->setWithDefaults('type', $type, $rmc_config->editor_type);
         $this->setWithDefaults('change', $change, 1);
         $this->setWithDefaults('elements', $ele, array('op'));
     }
     $this->setIfNotSet('type', $type == '' ? $rmc_config->editor_type : $type);
     $this->setIfNotSet('value', '');
 }
Exemplo n.º 15
0
 public function eventCoreHeaderEnd()
 {
     /**
      * Use internal blocks manager if enabled
      */
     $config = RMSettings::cu_settings();
     if ($config->blocks_enable) {
         global $xoopsTpl;
         $bks = RMBlocksFunctions::construct_blocks();
         $bks = RMEvents::get()->run_event('rmcommon.retrieve.xoops.blocks', $bks);
         $b =& $xoopsTpl->get_template_vars('xoBlocks');
         if (is_array($bks)) {
             $blocks = array_merge($b, $bks);
         } else {
             $blocks = $b;
         }
         $xoopsTpl->assign_by_ref('xoBlocks', $blocks);
         unset($b, $bks);
     }
     RMEvents::get()->run_event('rmcommon.core.header.end');
 }
Exemplo n.º 16
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;
}
Exemplo n.º 17
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;
}
Exemplo n.º 18
0
 /**
  * Decrypt a string
  *
  * @param strign Text to decrypt
  * @param bool Apply base64_decode? default true
  */
 public static function decrypt($string, $encode64 = true)
 {
     $rmc_config = RMSettings::cu_settings();
     $crypt = new Crypt(Crypt::MODE_HEX, $rmc_config->secretkey);
     $string = $crypt->decrypt($string);
     return $string;
 }
Exemplo n.º 19
0
            ?>
</label>
                                <?php 
            if ($field->description != '') {
                ?>
                                    <span class="help-block"><?php 
                echo $field->description;
                ?>
</span>
                                <?php 
            }
            ?>
                            </div>
                            <div class="col-md-8 col-lg-8">
                                <?php 
            echo RMSettings::render_field($field);
            ?>
                            </div>
                        </div>

                    <?php 
        }
        ?>
                <?php 
    }
    ?>

            </div>
            <?php 
    $i++;
}
Exemplo n.º 20
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;
        }
Exemplo n.º 21
0
 public function render()
 {
     $script = "<script type='text/javascript'>\n";
     $script .= "var lburl = '" . RMCURL . "/plugins/lightbox';\n";
     $config = RMSettings::plugin_settings('lightbox', true);
     $params = '';
     foreach ($this->options as $name => $value) {
         if ($value == 'true' || $value == 'false') {
             $value = $value;
         } elseif (is_string($value)) {
             $value = "'" . $value . "'";
         }
         $params .= $params == '' ? "{$name}: {$value}" : ", {$name}: {$value}";
     }
     if ($config->configs != '') {
         $params .= ", {$config->configs}";
     }
     $script .= "var lb_params = {" . $params . "};\n";
     if (!defined('RM_LB_PARAMS')) {
         define('RM_LB_PARAMS', 1);
     }
     $script .= "\$(function(){\n";
     if (is_array($this->elements)) {
         foreach ($this->elements as $element) {
             $script .= "\$(\"{$element}\").colorbox(lb_params);\n";
         }
     } else {
         $script .= "\$(\"{$this->elements}\").colorbox(lb_params);\n";
     }
     $script .= "});\n</script>\n";
     RMTemplate::get()->add_script('jquery.colorbox-min.js', 'rmcommon', array('directory' => 'plugins/lightbox'));
     RMTemplate::get()->add_head($script);
     return $script;
 }
Exemplo n.º 22
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';
     }
 }
Exemplo n.º 23
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;
 }
Exemplo n.º 24
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;
 }
Exemplo n.º 25
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) {
Exemplo n.º 26
0
 /**
  * Detects when settings has changed and if the permalink
  * feature is activated.
  *
  * @param string $dirname <p>Module dirname</p>
  * @param array $save <p>Settings options saved with values</p>
  * @param array $add <p>Settings options added with values</p>
  * @param array $delete <p>Settings options deleted from database table</p>
  * @return string
  */
 public function eventRmcommonSavedSettings($dirname, $save, $add, $delete)
 {
     if ($dirname != 'rmcommon') {
         return $dirname;
     }
     $base = parse_url(XOOPS_URL . '/');
     $base = isset($base['path']) ? rtrim($base['path'], '/') . '/' : '/';
     $rules = "ErrorDocument 404 " . $base . "modules/rmcommon/404.php\n";
     foreach ($save['modules_path'] as $mod => $path) {
         $path = ltrim($path, "/");
         $rules .= "RewriteRule ^{$path}/?(.*)\$ modules/{$mod}/index.php/\$1 [L]\n";
         $rules .= "RewriteRule ^admin/{$path}/?(.*)\$ modules/{$mod}/admin/index.php/\$2 [L]\n";
     }
     if ($save['permalinks'] == 0) {
         $ht = new RMHtaccess('rmcommon');
         $htResult = $ht->removeRule();
         if ($htResult !== true) {
             showMessage(__('An error ocurred while trying to delete .htaccess rules!', 'rmcommon') . '<br>' . __('Please delete lines starting with <code># begin rmcommon</code> and ending with <code># end rmcommon</code>', 'rmcommon'), RMMSG_ERROR);
         }
         return $dirname;
     }
     $rules .= "RewriteRule ^rss/?(.*)\$ modules/rmcommon/rss.php\$1 [L]\n";
     $ht = new RMHtaccess('rmcommon');
     $htResult = $ht->write($rules);
     if ($htResult !== true) {
         showMessage(__('An error ocurred while trying to write .htaccess file!', 'rmcommon') . '<br>' . __('Please try to add manually next lines:', 'rmcommon') . '<br><code>' . nl2br($rules) . '</code>', RMMSG_ERROR);
     }
     RMSettings::write_rewrite_js($save['modules_path']);
     return null;
 }
Exemplo n.º 27
0
<?php

// $Id: post-comment.php 902 2012-01-03 07:09:16Z i.bitcero $
// --------------------------------------------------------------
// Red México Common Utilities
// A framework for Red México Modules
// Author: Eduardo Cortés <*****@*****.**>
// Email: i.bitcero@gmail.com
// License: GPL 2.0
// --------------------------------------------------------------
include '../../mainfile.php';
$action = rmc_server_var($_REQUEST, 'action', '');
/**
* This file handle comments from Common Utilties
*/
$rmc_config = RMSettings::cu_settings();
if (!$rmc_config->enable_comments) {
    redirect_header(rmc_server_var($_REQUEST, 'comment_url', XOOPS_URL), 1, __('Sorry, comments has been disabled by administrator', 'rmcommon'));
    die;
}
if ($action == 'save') {
    if (!$xoopsSecurity->checkReferer()) {
        redirect_header(XOOPS_URL, 2, __('You are not allowed to do this action!', 'rmcommon'));
        die;
    }
    // Check if user is a Registered User
    if (!$xoopsUser) {
        $name = rmc_server_var($_POST, 'comment_name', '');
        $email = rmc_server_var($_POST, 'comment_email', '');
        $url = rmc_server_var($_POST, 'comment_url', '');
        $xuid = 0;
Exemplo n.º 28
0
 public function footer()
 {
     global $xoopsModule, $cuSettings, $xoopsConfig, $xoopsModuleConfig, $xoopsConfigMetaFooter, $xoopsOption, $xoopsUser, $xoopsTpl;
     if (defined('XOOPS_CPFUNC_LOADED')) {
         $content = ob_get_clean();
         ob_start();
         $cuSettings = RMSettings::cu_settings();
         $theme = isset($cuSettings->theme) ? $cuSettings->theme : 'default';
         if (!file_exists(RMCPATH . '/themes/' . $theme . '/admin-gui.php')) {
             $theme = 'twop6';
         }
         $rm_theme_url = RMCURL . '/themes/' . $theme;
         // Check if there are redirect messages
         $redirect_messages = array();
         if (isset($_SESSION['redirect_message'])) {
             foreach ($_SESSION['redirect_message'] as $msg) {
                 $redirect_messages[] = $msg;
             }
             unset($_SESSION['redirect_message']);
         }
         include_once RMCPATH . '/themes/' . $theme . '/admin-gui.php';
         $output = ob_get_clean();
         $output = RMEvents::get()->run_event('rmcommon.admin.output', $output);
         echo $output;
     } else {
         $vars = $this->get_vars();
         $xoopsTpl->assign($vars);
         require XOOPS_ROOT_PATH . '/footer.php';
     }
 }
Exemplo n.º 29
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;
    }
Exemplo n.º 30
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;
    }