Esempio n. 1
0
function show_available_updates()
{
    global $rmTpl, $rmEvents, $updfile, $xoopsSecurity;
    $rmFunc = RMFunctions::get();
    $rmUtil = RMUtilities::get();
    $tf = new RMTimeFormatter('', '%T% %d%, %Y% at %h%:%i%');
    if (is_file($updfile)) {
        $updates = unserialize(base64_decode(file_get_contents($updfile)));
    }
    $rmTpl->add_style('updates.css', 'rmcommon');
    $rmTpl->add_script('updates.js', 'rmcommon');
    $rmTpl->add_head_script('var xoToken = "' . $xoopsSecurity->createToken() . '";');
    $rmTpl->add_head_script('var langUpdated = "' . __('Item updated!', 'rmcommon') . '";');
    $rmTpl->add_help(__('Updates Help', 'rmcommon'), 'http://www.xoopsmexico.net/docs/common-utilities/actualizaciones-automaticas/standalone/1/');
    $ftpserver = parse_url(XOOPS_URL);
    $ftpserver = $ftpserver['host'];
    $pathinfo = parse_url(XOOPS_URL);
    $ftpdir = str_replace($pathinfo['scheme'] . '://' . $pathinfo['host'], '', XOOPS_URL);
    unset($pathinfo);
    RMBreadCrumb::get()->add_crumb(__('Available Updates', 'rmcommon'));
    $rmTpl->assign('xoops_pagetitle', __('Available Updates', 'rmcommon'));
    xoops_cp_header();
    include $rmTpl->get_template('rmc-updates.php', 'module', 'rmcommon');
    xoops_cp_footer();
}
Esempio n. 2
0
 /**
  * This function allows to other modules or plugins get gravatars
  * by passing an email address and other options
  */
 public function eventRmcommonGetAvatar($email, $size = 0, $default = '')
 {
     $config = RMFunctions::get()->plugin_settings('avatars', true);
     $size = $size <= 0 ? $size = $config['size'] : $size;
     $default = $default == '' ? $config['default'] : $default;
     $avatar = "http://www.gravatar.com/avatar/" . md5($email) . "?s=" . $size . '&d=' . $default;
     return $avatar;
 }
Esempio n. 3
0
 public function settings($name = '')
 {
     $settings = empty($this->settings) ? RMFunctions::get()->plugin_settings($this->get_info('dir'), true) : $this->settings;
     if (isset($settings[$name])) {
         return $settings[$name];
     }
     return $settings;
 }
 public function check()
 {
     $config = RMFunctions::get()->plugin_settings('recaptcha', true);
     include_once RMCPATH . '/plugins/recaptcha/recaptchalib.php';
     $privatekey = $config['private'];
     $resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
     return $resp->is_valid;
 }
function dt_block_categories($options)
{
    include_once XOOPS_ROOT_PATH . '/modules/dtransport/class/dtcategory.class.php';
    $rmu = RMUtilities::get();
    $rmf = RMFunctions::get();
    $mc = $rmu->module_config('dtransport');
    $url = $rmf->current_url();
    $rpath = parse_url($url);
    $xpath = parse_url(XOOPS_URL);
    if ($mc['permalinks']) {
        $params = trim(str_replace($xpath['path'] . '/' . trim($mc['htbase'], '/'), '', rtrim($rpath['path'], "/")), '/');
        $search = array('category', 'publisher', 'recents', 'popular', 'rated', 'updated');
        if ($params == '') {
            $params = array();
        } else {
            $params = explode("/", trim($params));
        }
        if (!empty($params) && $params[0] == 'category') {
            $db = XoopsDatabaseFactory::getDatabaseConnection();
            $params = explode("page", implode("/", array_slice($params, 1)));
            $path = explode("/", $params[0]);
            foreach ($path as $k) {
                if ($k == '') {
                    continue;
                }
                $category = new DTCategory();
                $sql = "SELECT * FROM " . $db->prefix("dtrans_categos") . " WHERE nameid='{$k}' AND parent='{$idp}'";
                $result = $db->query($sql);
                if ($db->getRowsNum($result) > 0) {
                    $row = $db->fetchArray($result);
                    $idp = $row['id_cat'];
                    $category->assignVars($row);
                } else {
                    $dtfunc->error_404();
                }
            }
        } else {
            $category = new DTCategory();
        }
    }
    $tpl = RMTemplate::get();
    $tpl->add_xoops_style('blocks.css', 'dtransport');
    include_once XOOPS_ROOT_PATH . '/modules/dtransport/class/dtfunctions.class.php';
    $categories = array();
    $dtfunc = new DTFunctions();
    $dtfunc->getCategos($categories, 0, $category->id(), array(), false, 1);
    $block = array();
    foreach ($categories as $cat) {
        if ($cat['jumps'] > $options[0] - 1 && $options[0] > 0) {
            continue;
        }
        $block['categories'][] = $cat;
    }
    if (!$category->isNew()) {
        $block['parent'] = array('name' => $category->name(), 'link' => $category->permalink());
    }
    return $block;
}
Esempio n. 6
0
 private function get_html()
 {
     $config = RMFunctions::get()->plugin_settings('ayah', true);
     self::set_config();
     require_once RMCPATH . '/plugins/ayah/include/ayah.php';
     $ayah = new AYAH();
     $ayah->debug_mode($config['debug']);
     return $ayah->getPublisherHTML();
 }
Esempio n. 7
0
 public function check()
 {
     $config = RMFunctions::get()->plugin_settings('recaptcha', true);
     $this->set_config();
     include_once RMCPATH . '/plugins/ayah/include/ayah.php';
     $ayah = new AYAH();
     $ayah->debug_mode($config['debug']);
     $resp = $ayah->scoreResult();
     return $resp;
 }
Esempio n. 8
0
 public function eventRmcommonCaptchaCheck($value)
 {
     global $xoopsUser;
     $config = RMFunctions::get()->plugin_settings('recaptcha', true);
     if ($xoopsUser && $xoopsUser->isAdmin() && !$config['show']) {
         return $value;
     }
     include_once RMCPATH . '/plugins/recaptcha/recaptchalib.php';
     $privatekey = $config['private'];
     $resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
     return $resp->is_valid;
 }
Esempio 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: FCKeditor, DHTML
  */
 function __construct($caption, $name, $width = '100%', $height = '300px', $default = '', $type = '', $change = 1, $ele = array('op'))
 {
     $rmc_config = RMFunctions::get()->configs();
     $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;
 }
Esempio n. 10
0
 public function eventRmcommonGetStyles($styles)
 {
     $rmf = RMFunctions::get();
     $config = $rmf->plugin_settings('minifier', true);
     if (!$config['enable']) {
         return $styles;
     }
     $mini = array();
     foreach ($styles as $id => $style) {
         $url = parse_url($style['url']);
         $info = pathinfo($url['path']);
         $path = str_replace($info['basename'], '', $url['path']);
         $identifier = sprintf("%u", crc32($path . $style['media']));
         $add = !isset($mini[$identifier]) ? RMCURL . '/plugins/minifier/min/f=' . $url['path'] : $mini[$identifier]['url'] . ',' . $url['path'];
         $mini[$identifier] = array('url' => $add, 'type' => $style['type'], 'media' => $style['media'], 'rel' => 'stylesheet');
     }
     return $mini;
 }
Esempio n. 11
0
 /**
  * This method is designed specially for MyWords
  */
 public function eventMywordsViewPost($post_data, MWPost $post)
 {
     $config = RMFunctions::get()->plugin_settings('metaseo', true);
     if (!$config['meta']) {
         $metas = '<meta name="description" content="' . TextCleaner::truncate($post->content(true), $config['len']) . '" />';
         $tags = array();
         foreach ($post->tags() as $tag) {
             $tags[] = $tag['tag'];
         }
         $tags = implode(',', $tags);
         $metas .= '<meta name="keywords" content="' . $tags . '" />';
     } else {
         $metas = '<meta name="description" content="' . $post->get_meta($config['meta_name'], false) . '" />';
         $metas = '<meta name="description" content="' . $post->get_meta($config['meta_keys'], false) . '" />';
     }
     RMTemplate::get()->add_head($metas);
     return $post_data;
 }
Esempio n. 12
0
/**
* @des Visualiza todas las pantallas existentes
**/
function showScreens()
{
    global $xoopsModule, $xoopsSecurity, $tpl, $functions, $xoopsModule, $xoopsModuleConfig, $xoopsUser, $xoopsConfig;
    define('RMCSUBLOCATION', 'screenshots');
    if ($xoopsConfig['closesite']) {
        showMessage(__('Screenshop uploader does not work when site is closed. Before to start uploding, please change this configuration.', 'rmcommon'), RMMSG_WARN);
    }
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $tc = TextCleaner::getInstance();
    $item = rmc_server_var($_REQUEST, 'item', 0);
    if ($item <= 0) {
        redirectMsg('items.php', __('Download item ID not provided!', 'dtransport'), RMMSG_WARN);
    }
    $sw = new DTSoftware($item);
    $sql = "SELECT * FROM " . $db->prefix('dtrans_screens') . " WHERE id_soft={$item}";
    $result = $db->queryF($sql);
    while ($rows = $db->fetchArray($result)) {
        $sc = new DTScreenshot();
        $sc->assignVars($rows);
        $screens[] = array('id' => $sc->id(), 'title' => $sc->title(), 'desc' => substr($tc->clean_disabled_tags($sc->desc()), 0, 80) . "...", 'image' => XOOPS_UPLOAD_URL . '/screenshots/' . date('Y', $sc->date()) . '/' . date('m', $sc->date()) . '/ths/' . $sc->image());
    }
    // CSS Styles
    $tpl->add_style('admin.css', 'dtransport');
    $tpl->add_style('screens.css', 'dtransport');
    $tpl->add_style('uploadify.css', 'rmcommon');
    // Javascripts
    $tpl->add_local_script('swfobject.js', 'rmcommon', 'include');
    $tpl->add_local_script('jquery.uploadify.js', 'rmcommon', 'include');
    $tpl->add_local_script('screens.js', 'dtransport');
    $tc = TextCleaner::getInstance();
    $rmf = RMFunctions::get();
    ob_start();
    include DT_PATH . '/js/screenshots.js';
    $script = ob_get_clean();
    $tpl->add_head_script($script);
    $functions->toolbar();
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; <a href='items.php'>" . __('Downloads', 'dtransport') . "</a> &raquo; " . __('Screenshots Management', 'dtransport'));
    $tpl->assign('xoops_pagetitle', sprintf(__("%s Screenshots", 'dtransport'), $sw->getVar('name')));
    include DT_PATH . '/include/js_strings.php';
    xoops_cp_header();
    include $tpl->get_template('admin/dtrans_screens.php', 'module', 'dtransport');
    xoops_cp_footer();
}
Esempio n. 13
0
 /**
  * This event check spam in comments, posts and other contents for modules
  * 
  * @param array All params to check (blogurl, name, email, url, text, permalink)
  * @return bool
  */
 public function eventRmcommonCheckPostSpam($params)
 {
     $config = RMFunctions::get()->plugin_settings('akismet', true);
     if ($config['key'] == '') {
         return;
     }
     extract($params);
     $akismet = new Akismet($blogurl, $config['key']);
     $akismet->setCommentAuthor($name);
     $akismet->setCommentAuthorEmail($email);
     $akismet->setCommentAuthorURL($url);
     $akismet->setCommentContent($text);
     $akismet->setPermalink($permalink);
     $akismet->setUserIP($_SERVER['REMOTE_ADDR']);
     if ($akismet->isCommentSpam()) {
         return false;
     }
     return true;
 }
Esempio n. 14
0
/**
 * Shows existing groups
 */
function show_groups_list()
{
    global $xoopsDB;
    define('RMCSUBLOCATION', 'allgroups');
    list($total) = $xoopsDB->fetchRow($xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("groups_users_link")));
    $navigation = new RMPageNav($total, 20, RMHttpRequest::get('page', 'integer', 1));
    $navigation->target_url(RMCURL . '/users.php?action=groups&amp;page={PAGE_NUM}');
    $sql = "SELECT g.*, (SELECT COUNT(*) FROM " . $xoopsDB->prefix("groups_users_link") . "\n            WHERE groupid = g.groupid) as total_users FROM " . $xoopsDB->prefix("groups") . " as g ORDER BY g.name\n            LIMIT " . $navigation->start() . ", 20";
    $result = $xoopsDB->query($sql);
    $groups = array();
    while ($row = $xoopsDB->fetchArray($result)) {
        $groups[] = (object) $row;
    }
    $bc = RMBreadCrumb::get();
    $bc->add_crumb(__('Users Management', 'rmcommon'), RMCURL . '/users.php');
    $bc->add_crumb(__('Groups', 'rmcommon'));
    RMTemplate::get()->assign('xoops_pagetitle', __('Groups Management', 'rmcommon'));
    RMFunctions::get()->create_toolbar();
    RMTemplate::get()->add_script('cu-groups.js', 'rmcommon', array('footer' => 1));
    include RMCPATH . '/js/cu-js-language.php';
    RMTemplate::get()->header();
    include RMTemplate::get()->get_template('rmc-groups.php', 'module', 'rmcommon');
    RMTemplate::get()->footer();
}
Esempio n. 15
0
 public function render()
 {
     $script = "<script type='text/javascript'>\n";
     $script .= "var lburl = '" . RMCURL . "/plugins/lightbox';\n";
     $config = RMFunctions::get()->plugin_settings('lightbox', true);
     $params = "{";
     $params .= "transition:'{$config['transition']}'";
     $params .= ",speed:{$config['speed']}";
     $params .= $config['width'] != '' ? ",maxWidth:'{$config['width']}'" : '';
     $params .= $config['height'] != '' ? ",maxHeight:'{$config['height']}'" : '';
     $params .= ",scalePhotos:{$config['scale']}";
     $params .= ",loop:" . ($config['loop'] ? 'true' : 'false');
     if ($config['slideshow']) {
         $params .= ",slideshow:true";
         $params .= ",slideshowSpeed:" . $config['slspeed'];
         $params .= ",slideshowStart:'" . __('Start Slideshow', 'lightbox') . "'";
         $params .= ",slideshowStop:'" . __('Stop Slideshow', 'lightbox') . "'";
     }
     $params .= $config['configs'] != '' ? ",{$config['configs']}" : '';
     $params .= "}";
     $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_local_script('jquery.colorbox-min.js', 'rmcommon', 'plugins/lightbox');
     return $script;
 }
Esempio n. 16
0
function cache_delete_expired()
{
    global $xoopsSecurity;
    if (!$xoopsSecurity->check()) {
        redirectMsg('plugins.php?p=booster&action=view', __('Session token expired!', 'booster'), 1);
        die;
    }
    $plugin = RMFunctions::get()->load_plugin('booster');
    $items = XoopsLists::getFileListAsArray(XOOPS_CACHE_PATH . '/booster/files');
    $files = array();
    foreach ($items as $file) {
        $tmp = explode('.', $file);
        if ($tmp[1] != 'meta') {
            continue;
        }
        $content = json_decode(file_get_contents(XOOPS_CACHE_PATH . '/booster/files/' . $file), true);
        if (time() - $content['created'] >= $plugin->get_config('time')) {
            @unlink(XOOPS_CACHE_PATH . '/booster/files/' . $file);
            @unlink(XOOPS_CACHE_PATH . '/booster/files/' . $tmp[0] . '.html');
        }
    }
    redirectMsg('plugins.php?p=booster&action=view', __('Expired pages deleted successfully', 'boost'), 0);
    die;
}
Esempio n. 17
0
 /**
  * Encrypt a string
  * 
  * @param string Text to crypt
  * @param bool Apply base64_encode?
  * @return string
  */
 public function encrypt($string, $encode64 = true)
 {
     $rmc_config = RMFunctions::get()->configs();
     $crypt = new Crypt(Crypt::MODE_HEX, $rmc_config['secretkey']);
     $string = $crypt->encrypt($string);
     //if ($encode64) $string = base64_encode($string);
     return $string;
 }
Esempio n. 18
0
function dt_delete_screen()
{
    global $xoopsSecurity, $xoopsConfig, $xoopsModule, $xoopsUser;
    $rmf = RMFunctions::get();
    $xoopsModule = $rmf->load_module('dtransport');
    include_once '../../../include/cp_header.php';
    $func = new DTFunctions();
    if (!$xoopsSecurity->check()) {
        $func->dt_send_message(__('Session token not valid!', 'dtransport'), 1, 0);
    }
    $id = rmc_server_var($_POST, 'id', 0);
    $sc = new DTScreenshot($id);
    if ($sc->isNew()) {
        $func->dt_send_message(__('Specified screenshot does not exists!', 'dtransport'), 1, 1);
    }
    if (!$sc->delete()) {
        $func->dt_send_message(__('Screenshot could not be deleted!', 'dtransport') . '<br />' . $sc->errors(), 1, 1);
    }
    $ret = array('id' => $sc->id());
    $func->dt_send_message($ret, 0, 1);
}
 /**
  * @desc Genera un array con los datos de un elemento específico
  * @param object {@link DTSoftware()}
  * @return array
  */
 public function createItemData(DTSoftware &$item)
 {
     global $mc, $xoopsUser;
     if (!$mc) {
         $mc = RMUtilities::module_config('dtransport');
     }
     $rmfunc = RMFunctions::get();
     $data = array();
     $data['link'] = $item->permalink();
     // Vinculo para detalles
     $data['dlink'] = $item->permalink(0, 'download');
     // Vinculo de descarga
     $data['id'] = $item->id();
     $data['name'] = $item->getVar('name');
     $data['description'] = $item->getVar('shortdesc');
     $data['votes'] = $item->getVar('votes');
     $data['comments'] = $item->getVar('comments');
     $data['siterate'] = DTFunctions::ratingStars($item->getVar('siterate'));
     $data['rating'] = @number_format($item->getVar('rating') / $item->getVar('votes'), 1);
     $data['language'] = $item->getVar('langs');
     // Image
     $img = new RMImage();
     $img->load_from_params($item->getVar('image'));
     $data['image'] = $img->get_smallest();
     $data['created'] = formatTimestamp($item->getVar('created'), 's');
     if ($item->getVar('created') < $item->getVar('modified')) {
         $data['modified'] = formatTimestamp($item->getVar('modified'), 's');
     }
     $data['is_new'] = $item->getVar('created') > time() - $mc['new'] * 86400;
     $data['is_updated'] = $data['is_new'] ? false : $item->getVar('modified') > time() - $mc['update'] * 86400;
     $data['approved'] = $item->getVar('approved');
     $data['downs'] = $item->getVar('hits');
     $data['screens'] = $item->getVar('screens');
     $data['featured'] = $item->getVar('featured');
     $data['nameid'] = $item->getVar('nameid');
     $data['candownload'] = $item->canDownload($xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS);
     // Licencias
     $data['lics'] = '';
     foreach ($item->licences(true) as $lic) {
         $data['lics'] .= $data['lics'] == '' ? '<a href="' . $lic->link() . '" target="_blank">' . $lic->name() . '</a>' : ', <a href="' . $lic->link() . '" target="_blank">' . $lic->name() . '</a>';
     }
     //  Plataformas
     $data['os'] = '';
     foreach ($item->platforms(true) as $os) {
         $data['os'] .= $data['os'] == '' ? $os->name() : ', ' . $os->name();
     }
     $data['metas'] = $this->get_metas('down', $item->id());
     return $data;
 }
Esempio n. 20
0
/**
* @desc Formulario de archivos
**/
function formFiles($edit = 0)
{
    global $tpl, $xoopsModule, $xoopsModuleConfig, $xoopsUser, $xoopsSecurity;
    define("RMCSUBLOCATION", 'newfile');
    $id = rmc_server_var($_GET, 'id', 0);
    $item = rmc_server_var($_GET, 'item', 0);
    //Verificamos si el software es válido
    if ($item <= 0) {
        redirectMsg('files.php', __('No download item ID has been provided!', 'dtransport'), RMMSG_WARN);
    }
    //Verificamos si existe el software
    $sw = new DTSoftware($item);
    if ($sw->isNew()) {
        redirectMsg('files.php', __('Specified download item does not exists!', 'dtransport'), RMMSG_ERROR);
    }
    $file_exists = true;
    if ($edit) {
        //Verificamos si archivo es válido
        if ($id <= 0) {
            redirectMsg('./files.php?item=' . $item, __('No file ID has been specified!', 'dtransport'), RMMSG_WARN);
        }
        //Verificamos si existe archivo
        $fl = new DTFile($id);
        if ($fl->isNew()) {
            redirectMsg('files.php?item=' . $item, __('Specified file does not exists!', 'dtransport'), RMMSG_ERROR);
        }
        if ($sw->getVar('secure')) {
            $dir = $xoopsModuleConfig['directory_secure'];
        } else {
            $dir = $xoopsModuleConfig['directory_insecure'];
        }
        if (!$fl->remote()) {
            if (!is_file($dir . '/' . $fl->file())) {
                $file_exists = false;
                showMessage(sprintf(__('File %s does not exists! You need to upload this file again.', 'dtransport'), $dir . '/' . $fl->file()), RMMSG_WARN);
            }
        }
    }
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; <a href='items.php'>" . $sw->getVar('name') . "</a> &raquo; <a href='files.php?item=" . $sw->id() . "'>" . __('Files', 'dtransport') . "</a> &raquo; " . ($edit ? __('Edit file', 'dtransport') : __('New file', 'dtransport')));
    $tpl->assign('xoops_pagetitle', $xoopsModule->name() . " &raquo; " . $sw->getVar('name') . " &raquo; " . __('Files', 'dtransport') . " &raquo; " . ($edit ? __('Edit file', 'dtransport') : __('New file', 'dtransport')));
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $func = new DTFunctions();
    $func->toolbar();
    $rmf = RMFunctions::get();
    $rmu = RMUtilities::get();
    // Uploader
    $tc = TextCleaner::getInstance();
    $uploader = new RMFlashUploader('dtfiles-uploader', DT_URL . '/ajax/upload.php');
    $token = $xoopsSecurity->createToken();
    $uploader->add_setting('onUploadStart', 'function(file){
        $("#dtfiles-uploader").uploadify("settings", "formData", {
            action: "upload",
            item: $("#item").val(),
            XOOPS_TOKEN_REQUEST: $("#XOOPS_TOKEN_REQUEST").val(),
            data: "' . $tc->encrypt($_SERVER['HTTP_USER_AGENT'] . '|' . session_id() . '|' . $xoopsUser->uid() . '|' . $rmf->current_url()) . '"
        });
    }');
    $uploader->add_setting('multi', false);
    $uploader->add_setting('fileExt', '*.' . implode(";*.", $xoopsModuleConfig['type_file']));
    $uploader->add_setting('fileDesc', sprintf(__('Allowed files (%s)', 'dtransport'), implode(";*.", $xoopsModuleConfig['type_file']) . ')'));
    $uploader->add_setting('sizeLimit', $xoopsModuleConfig['size_file'] * 1024 * 1024);
    $uploader->add_setting('buttonText', __('Select File...', 'rmcommon'));
    $uploader->add_setting('queueSizeLimit', 1);
    $uploader->add_setting('auto', true);
    $uploader->add_setting('onUploadSuccess', "function(file, resp, data){\n            eval('ret = '+resp);\n            if (ret.error==1){\n                \$('.dt-errors').html(ret.message).slideDown('fast');\n                upload_error = 1;\n            } else {\n                upload_error = 0;\n                getFilesToken();\n                \$('#dtfiles-preview .name').html(ret.file);\n                \$('#dtfiles-preview .size').html(ret.size);\n                \$('#size').val(ret.fullsize);\n                \$('#dtfiles-preview .type').html(ret.type);\n                \$('#dtfiles-preview .secure').html(ret.secure);\n            }\n            return true;\n        }");
    $uploader->add_setting('onQueueComplete', "function(event, data){\n            if(upload_error==1) return;\n            \$('.dt-errors').slideUp('fast');\n            \$('#dtfiles-uploader').fadeOut('fast');\n            \$('#dtfiles-preview').fadeIn('fast');\n        }");
    $uploader->add_setting('onSelectOnce', "function(event, data){\n            \$('#upload-errors').html('');\n        }");
    if ($edit && $file_exists) {
        $uploader->add_setting('onInit', 'function(instance){
            $("#dtfiles-uploader").hide();
        }');
    }
    $groups = array();
    //Lista de grupos
    $sql = "SELECT * FROM " . $db->prefix('dtrans_groups') . " WHERE id_soft={$item}";
    $result = $db->queryF($sql);
    while ($rows = $db->fetchArray($result)) {
        $group = new DTFileGroup();
        $group->assignVars($rows);
        $groups[] = array('id' => $group->id(), 'name' => $group->name());
    }
    $tpl->add_head($uploader->render());
    $tpl->add_style('admin.css', 'dtransport');
    $tpl->add_style('files.css', 'dtransport');
    $tpl->add_local_script('admin.js', 'dtransport');
    $tpl->add_local_script('files.js', 'dtransport');
    $tpl->add_head_script('var upload_error = 0;');
    include DT_PATH . '/include/js_strings.php';
    xoops_cp_header();
    include $tpl->get_template("admin/dtrans_filesform.php", 'module', 'dtransport');
    xoops_cp_footer();
}
Esempio n. 21
0
 private function insert_configs()
 {
     $dir = $this->plugin()->get_info('dir');
     $pre_options = $this->plugin->options();
     if (empty($pre_options)) {
         return;
     }
     $db = Database::getInstance();
     $c_options = RMFunctions::get()->plugin_settings($dir);
     if (empty($c_options)) {
         $sql = '';
         foreach ($pre_options as $name => $option) {
             $sql .= $sql == '' ? '' : ',';
             $sql .= "('{$dir}','{$name}','plugin','{$option['value']}','{$option['valuetype']}')";
         }
         $sql = "INSERT INTO " . $db->prefix("rmc_settings") . " (`element`,`name`,`type`,`value`,`valuetype`) VALUES " . $sql;
         if (!$db->queryF($sql)) {
             $this->addError($this->db->error());
             return false;
         } else {
             return true;
         }
     } else {
         $sql = '';
         foreach ($pre_options as $name => $option) {
             if (isset($c_options[$name])) {
                 $option['value'] = $c_options[$name]['value'];
                 $sql = "UPDATE " . $db->prefix("rmc_settings") . " SET value='{$option['value']}' WHERE element='{$dir}' AND type='plugin' AND name='{$name}'";
                 $db->queryF($sql);
             } else {
                 $sql = "INSERT INTO " . $db->prefix("rmc_settings") . " (`element`,`name`,`type`,`value`,`valuetype`) VALUES \n                            ('{$dir}','{$name}','plugin','{$option['value']}','{$option['valuetype']}')";
                 $db->queryF($sql);
             }
         }
     }
     return true;
 }
Esempio n. 22
0
    }
    $xoopsTpl->assign('comments', $comms);
    // Comments form
    RMFunctions::comments_form('mywords', 'post=' . $post->id(), 'module', MW_PATH . '/class/mywordscontroller.php');
}
// Load trackbacks
$trackbacks = $post->trackbacks();
foreach ($trackbacks as $tb) {
    $xoopsTpl->append('trackbacks', array('id' => $tb->id(), 'title' => $tb->getVar('title'), 'blog' => $tb->getVar('blog_name'), 'url' => $tb->getVar('url'), 'text' => $tb->getVar('excerpt'), 'date' => formatTimestamp($tb->getVar('date'), 'c')));
}
// Language
$xoopsTpl->assign('lang_publish', __('Published in', 'mywords'));
$xoopsTpl->assign('lang_tagged', __('Tagged as', 'mywords'));
$xoopsTpl->assign('lang_numcoms', sprintf(__('%u Comments', 'mywords'), $post->getVar('comments')));
$xoopsTpl->assign('lang_numtracks', sprintf(__('%u trackbacks', 'mywords'), count($trackbacks)));
$xoopsTpl->assign('lang_trackback', __('Trackback', 'mywords'));
$xoopsTpl->assign('lang_homemw', __('Main Page', 'mywords'));
$xoopsTpl->assign('enable_images', $xoopsModuleConfig['post_imgs']);
//Trackback
if ($post->getVar('pingstatus')) {
    $tb = new MWTrackback($xoopsConfig['sitename'], $editor->getVar('name'));
    RMTemplate::get()->add_head($tb->rdf_autodiscover(date('r', $post->getVar('pubdate')), $post->getVar('title'), TextCleaner::getInstance()->truncate($post->content(true), 255), $post->permalink(), MWFunctions::get_url(true) . $post->id(), $editor->getVar('name')));
}
$rmf = RMFunctions::get();
$description = $post->get_meta('description', false);
$keywords = $post->get_meta('keywords', false);
$rmf->add_keywords_description($description != '' ? $description : $post->content(true), $keywords != '' ? $keywords : '');
// Send pings?
$pings = $post->getVar('toping');
$xoopsTpl->assign('pingnow', empty($pings));
include 'footer.php';
Esempio n. 23
0
function configure_rm_plugin()
{
    $name = rmc_server_var($_GET, 'plugin', '');
    if ($name == '') {
        redirectMsg('plugins.php', __('You must specify a existing plugin', 'rmcommon'), 1);
        die;
    }
    $plugin = new RMPlugin($name);
    if ($plugin->isNew()) {
        redirectMsg('plugins.php', __('Specified plugin is not installed yet!', 'rmcommon'), 1);
        die;
    }
    if (!$plugin->getVar('status')) {
        redirectMsg('plugins.php', __('Specified plugin is not active!', 'rmcommon'), 1);
        die;
    }
    $rmc_config = RMFunctions::configs();
    $settings = RMFunctions::get()->plugin_settings($name, true);
    $form = new RMForm(sprintf(__('%s configuration', 'rmcommon'), $plugin->getVar('name')), 'frmconfig', 'plugins.php');
    $form->addElement(new RMFormHidden('plugin', $plugin->getVar('dir')));
    $form->addElement(new RMFormHidden('action', 'savesettings'));
    foreach ($plugin->options() as $config => $option) {
        if (isset($settings[$config])) {
            $option['value'] = $settings[$config];
        }
        if (isset($option['separator']) && !empty($option['separator'])) {
            $form->addElement(new RMFormSubTitle($option['separator']['title'], 1, '', $option['separator']['desc']));
            continue;
        }
        switch ($option['fieldtype']) {
            case 'checkbox_groups':
            case 'group_multi':
                $ele = new RMFormGroups($option['caption'], 'conf_' . $config, 1, 1, 3, $option['value']);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'radio_groups':
                $ele = new RMFormGroups($option['caption'], 'conf_' . $config, 0, 1, 3, $option['value']);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'group':
            case 'select_groups':
                $ele = new RMFormGroups($option['caption'], 'conf_' . $config, 0, 0, 3, $option['value']);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'select_groups_multi':
                $ele = new RMFormGroups($option['caption'], 'conf_' . $config, 1, 0, 3, $option['value']);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'editor':
                if ($rmc_config['editor_type'] == 'tiny') {
                    $tiny = TinyEditor::getInstance();
                    $tiny->add_config('elements', 'conf_' . $config);
                }
                $ele = new RMFormEditor($option['caption'], 'conf_' . $config, is_numeric($option['size']) ? '90%' : $option['size'], '300px', $option['value'], '', 1, array('op'));
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'theme':
            case 'select_theme':
                $ele = new RMFormTheme($option['caption'], 'conf_' . $config, 0, 0, $option['value'], 3);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'theme_multi':
            case 'select_theme_multi':
                $ele = new RMFormTheme($option['caption'], 'conf_' . $config, 0, 1, $option['value'], 3);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'checkbox_theme':
                $ele = new RMFormTheme($option['caption'], 'conf_' . $config, 1, 1, $option['value'], 4);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'select_theme_admin':
                $ele = new RMFormTheme($option['caption'], 'conf_' . $config, 0, 0, $option['value'], 3, 'GUI');
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'yesno':
                $ele = new RMFormYesNo($option['caption'], 'conf_' . $config, $option['value']);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'email':
                $ele = new RMFormText($option['caption'], 'conf_' . $config, $option['size'] > 0 ? $option['size'] : 50, null, $option['value']);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele, false, 'email');
                break;
            case 'select':
                $ele = new RMFormSelect($option['caption'], 'conf_' . $config);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                foreach ($option['options'] as $op => $opvalue) {
                    $ele->addOption($opvalue, $op, $opvalue == $option['value'] ? 1 : 0);
                }
                $form->addElement($ele);
                break;
            case 'select_multi':
                $ele = new RMFormSelect($option['caption'], 'conf_' . $config . '[]', 1, $option['value']);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                foreach ($option['options'] as $op => $opvalue) {
                    $ele->addOption($opvalue, $op);
                }
                $form->addElement($ele);
                break;
            case 'language':
            case 'select_language':
                $ele = new RMFormLanguageField($option['caption'], 'conf_' . $config, 0, 0, $option['value'], 3);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'select_language_multi':
                $ele = new RMFormLanguageField($option['caption'], 'conf_' . $config, 1, 0, $option['value'], 3);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'checkbox_language':
                $ele = new RMFormLanguageField($option['caption'], 'conf_' . $config, 1, 1, $option['value'], 3);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'startpage':
            case 'select_modules':
                $ele = new RMFormModules($option['caption'], 'conf_' . $config, 0, 0, $option['value'], 3);
                $ele->setInserted(array('--' => __('None', 'rmcommon')));
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'select_modules_multi':
                $ele = new RMFormModules($option['caption'], 'conf_' . $config, 1, 0, $option['value'], 3);
                $ele->setInserted(array('--' => __('None', 'rmcommon')));
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'checkbox_modules':
                $ele = new RMFormModules($option['caption'], 'conf_' . $config, 1, 1, $option['value'], 3);
                $ele->setInserted(array('--' => __('None', 'rmcommon')));
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'radio_modules':
                $ele = new RMFormModules($option['caption'], 'conf_' . $config, 0, 1, $option['value'], 3);
                $ele->setInserted(array('--' => __('None', 'rmcommon')));
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'timezone':
            case 'select_timezone':
                $ele = new RMFormTimeZoneField($option['caption'], 'conf_' . $config, 0, 0, $option['value'], 3);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'select_timezone_multi':
                $ele = new RMFormTimeZoneField($option['caption'], 'conf_' . $config, 0, 1, $option['value'], 3);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'checkbox_timezone':
                $ele = new RMFormTimeZoneField($option['caption'], 'conf_' . $config, 1, 1, $option['value'], 3);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'radio_timezone':
                $ele = new RMFormTimeZoneField($option['caption'], 'conf_' . $config, 1, 0, $option['value'], 3);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'tplset':
                $ele = new RMFormSelect($option['caption'], 'conf_' . $config);
                $tplset_handler =& exm_gethandler('tplset');
                $tplsetlist =& $tplset_handler->getList();
                asort($tplsetlist);
                foreach ($tplsetlist as $key => $name) {
                    $ele->addOption($key, $name, $option['value'] == $key ? 1 : 0);
                }
                $form->addElement($ele);
                break;
            case 'textarea':
                $ele = new RMFormTextArea($option['caption'], 'conf_' . $config, 5, $option['size'] > 0 ? $option['size'] : 50, $option['valuetype'] == 'array' ? $cleaner->htmlspecialchars(implode('|', $option['value'])) : $cleaner->htmlspecialchars($option['value']));
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'module_cache':
                $ele = new RMFormCacheModuleField($option['caption'], 'conf_' . $config, $option['value']);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'user_select':
                $ele = new RMFormUser($option['caption'], 'conf_' . $config, $form->getName(), $option['value'], 'select', $limit = '300', '');
                $ele->setOnPage("document.forms[0].op.value='config';");
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'radio':
                $ele = new RMFormRadio($option['caption'], 'conf_' . $config, 1);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                foreach ($option['options'] as $op => $opvalue) {
                    $ele->addOption($op, $opvalue, $opvalue == $option['value'] ? 1 : 0);
                }
                $form->addElement($ele);
                break;
            case 'font_select':
                $ele = new RMFormSelect($option['caption'], 'conf_' . $config, 0, array($option['value']));
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $fonts = EXMLists::getFileListAsArray(ABSPATH . '/rmcommon/fonts/');
                foreach ($fonts as $font) {
                    $info = pathinfo(ABSPATH . '/rmcommon/fonts/' . $font);
                    if (strtoupper($info['extension']) != 'TTF') {
                        continue;
                    }
                    $ele->addOption($font, $font);
                }
                $form->addElement($ele);
                break;
            case 'select_editor':
                $ele = new RMFormSelect($option['caption'], 'conf_' . $config, 0, array($option['value']));
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $ele->addOption('tiny', __('Visual Editor', 'rmcommon'));
                $ele->addOption('code', __('EXMCode Editor', 'rmcommon'));
                $ele->addOption('textarea', __('Simple Editor', 'rmcommon'));
                $ele->addOption('html', __('HTML Editor', 'rmcommon'));
                $form->addElement($ele);
                break;
            case 'textbox':
            case 'password':
            default:
                $ele = new RMFormText($option['caption'], 'conf_' . $config, $option['size'] > 0 ? $option['size'] : 50, null, $option['valuetype'] == 'array' ? implode('|', $option['value']) : $option['value'], $option['fieldtype'] == 'password' ? 1 : 0);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele, false, $option['valuetype'] == 'int' || $option['valuetype'] == 'float' ? 'num' : '');
                break;
        }
    }
    $ele = new RMFormButtonGroup();
    $ele->addButton('', __('Save Settings', 'rmcommon'), 'submit');
    $ele->addButton('', __('Cancel', 'rmcommon'), 'button', 'onclick="history.go(-1);"');
    $form->addElement($ele);
    // Other components can add items to database
    $form = RMEvents::get()->run_event("rmcommon.settings.form", $form, $plugin);
    RMFunctions::create_toolbar();
    xoops_cp_header();
    $form->display();
    xoops_cp_footer();
}
Esempio n. 24
0
        return $page;
    }
    $pos = strpos($page, "</head>");
    if ($pos === FALSE) {
        return $output;
    }
    $ret = substr($page, 0, $pos) . "\n";
    $ret .= $rtn;
    $ret .= substr($page, $pos);
    $ret = RMEvents::get()->run_event('rmcommon.end.flush', $ret);
    return $ret;
}
include_once XOOPS_ROOT_PATH . '/class/logger/xoopslogger.php';
include_once XOOPS_ROOT_PATH . '/class/database/databasefactory.php';
$db = XoopsDatabaseFactory::getDatabaseConnection();
$GLOBALS['rmc_config'] = RMFunctions::get()->configs();
$rmc_config = $GLOBALS['rmc_config'];
define('RMCLANG', RMEvents::get()->run_event('rmcommon.set.language', $rmc_config['lang']));
// Load plugins
$file = XOOPS_CACHE_PATH . '/plgs.cnf';
$plugins = array();
$GLOBALS['installed_plugins'] = array();
if (file_exists($file)) {
    $plugins = json_decode(file_get_contents($file), true);
}
if (empty($plugins) || !is_array($plugins)) {
    $result = $db->query("SELECT dir FROM " . $db->prefix("rmc_plugins") . ' WHERE status=1');
    while ($row = $db->fetchArray($result)) {
        $GLOBALS['installed_plugins'][$row['dir']] = true;
        $plugins[] = $row['dir'];
        RMEvents::get()->load_extra_preloads(RMCPATH . '/plugins/' . $row['dir'], ucfirst($row['dir']) . 'Plugin');
Esempio n. 25
0
    if ($ret['message'] == 0) {
        continue;
    }
    if ($ret['error'] == 1) {
        continue;
    }
    $ret['data']['type'] = 'module';
    $ret['data']['dir'] = $dir;
    $ret['data']['name'] = $modNames[$dir];
    $upds[] = $ret;
    $total++;
}
/**
 * Now load all installed plugins to search for updates
 */
$rmFunc = RMFunctions::get();
$urls = array();
$plugNames = array();
// Check updates for plugins
$result = $xoopsDB->query("SELECT dir FROM " . $xoopsDB->prefix("mod_rmcommon_plugins"));
while ($row = $xoopsDB->fetchArray($result)) {
    $plugin = $rmFunc->load_plugin($row['dir']);
    if (!$plugin) {
        continue;
    }
    $info = $plugin->info();
    if (!isset($info['updateurl'])) {
        continue;
    }
    $plugNames[$row['dir']] = $info['name'];
    $v = $info['version'];
Esempio n. 26
0
<?php

// $Id: admin_loader.php 628 2011-05-13 05:15:28Z 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
// --------------------------------------------------------------
/**
* Admin loader file
*/
//require_once 'loader.php';
// Usefull admin clases
$tpl = RMTemplate::get();
$rmc_config = RMFunctions::get()->configs();
$rmc_theme = isset($rmc_config['theme']) ? $rmc_config['theme'] : 'default';
if (!file_exists(RMCPATH . '/themes/' . $rmc_theme . '/admin_gui.php')) {
    $rmc_theme = 'default';
}
RMTemplate::get()->add_style('general.css', 'rmcommon');
define('RMTHEMEPATH', RMCPATH . '/themes/' . $rmc_theme);
define('RMTHEMEURL', RMCURL . '/themes/' . $rmc_theme);
// Load theme events
RMEvents::get()->load_extra_preloads(RMTHEMEPATH, ucfirst($rmc_theme) . 'Theme');
header("Expires: Mon, 26 Jul 1990 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
Esempio n. 27
0
function dt_get_identifier()
{
    global $functions, $xoopsUser;
    $id = rmc_server_var($_POST, 'identifier', '');
    if ($id == '') {
        $functions->dt_send_message(__('Identifier could not be verified!', 'dtransport'), 1, 0);
    }
    $tc = TextCleaner::getInstance();
    $data = explode("|", $tc->decrypt($id));
    $rmu = RMFunctions::get();
    if (session_id() != $data[0] && $xoopsUser->uid() != $data[1] || !$xoopsUser->isAdmin($rmu->load_module('dtransport'))) {
        $functions->dt_send_message(__('Critical error!', 'dtransport'), 1, 0);
    }
    $ret = array('message' => __('Verified', 'dtransport'));
    $functions->dt_send_message($ret, 0, 1);
}