Ejemplo n.º 1
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);
 }
Ejemplo n.º 2
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');
}
Ejemplo n.º 3
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;
 }
Ejemplo n.º 4
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;
     }
 }
Ejemplo n.º 5
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');
 }
Ejemplo n.º 6
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', '');
 }
Ejemplo n.º 7
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;
 }
Ejemplo n.º 8
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';
     }
 }
Ejemplo n.º 9
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;
Ejemplo n.º 10
0
 /**
  * Get Common Utilities Settings.
  * ¡DO NOT USE ANYMORE!
  * This method is deprecated and it's scheduled for remove
  * Use RMSettings::cu_settings() instead
  *
  * @param string $name Settings option name
  * @return mixed Settings array or option value
  * @deprecated
  */
 public function configs($name = '')
 {
     trigger_error(sprintf(__('Method %s is deprecated. Use %s::%s instead.', 'rmcommon'), __METHOD__, 'RMSettings', 'cu_settings'));
     $ret = RMSettings::cu_settings($name);
     if (is_object($ret)) {
         return (array) $ret;
     } else {
         return $ret;
     }
 }
Ejemplo n.º 11
0
 public static function write_rewrite_js($paths)
 {
     if (empty($paths)) {
         $paths = array();
     }
     $settings = RMSettings::cu_settings();
     $file = XOOPS_CACHE_PATH . '/cu-rewrite.js';
     $content = "/**\nRewrite configuration for installed modules\n**/\nvar cu_modules = {\n";
     foreach ($paths as $module => $path) {
         $content .= "{$module}: '" . rtrim($path, '/') . "',\n";
     }
     $content .= "};\n";
     file_put_contents($file, $content);
 }