예제 #1
0
function show_group_form()
{
    global $xoopsDB, $xoopsSecurity;
    $ajax = new Rmcommon_Ajax();
    $ajax->prepare_ajax_response();
    $id = RMHttpRequest::get('id', 'integer', 0);
    if ($id > 0) {
        $group = new Rmcommon_Group($id);
        if ($group->isNew()) {
            $ajax->ajax_response(__('The specified group does not exists!', 'rmcommon'), 1, 1);
        }
    } else {
        $group = new Rmcommon_Group();
    }
    $result = $xoopsDB->query("SELECT * FROM " . $xoopsDB->prefix("modules") . " ORDER BY name ASC");
    $modules = array();
    $admin_rights = $group->load_permissions('module_admin');
    $access_rights = $group->load_permissions('module_read');
    while ($row = $xoopsDB->fetchArray($result)) {
        $modules[$row['mid']] = (object) $row;
        $modules[$row['mid']]->permissions = RMPrivileges::module_permissions($row['dirname']);
        $modules[$row['mid']]->privileges = RMPrivileges::read_permissions($row['dirname'], $group->id());
        $modules[$row['mid']]->admin = isset($admin_rights[$row['mid']]);
        $modules[$row['mid']]->read = isset($access_rights[$row['mid']]);
    }
    ob_start();
    include RMTemplate::get()->get_template('rmc-groups-form.php', 'module', 'rmcommon');
    $content = ob_get_clean();
    $ajax->ajax_response($group->isNew() ? __('Create new group', 'rmcommon') : sprintf(__('Edit group "%s"', 'rmcommon'), $group->getVar('name')), 0, 1, array('content' => $content, 'width' => 'xlarge', 'color' => 'green', 'windowId' => 'window-form-groups'));
}
예제 #2
0
 public function eventRmcommonXoopsCommonEnd()
 {
     $w = RMHttpRequest::get('twop6', 'string', '');
     if ($w == '') {
         return;
     }
     if ($w == 'colortest') {
         include_once XOOPS_ROOT_PATH . '/include/cp_functions.php';
         RMTemplate::get()->header();
         require RMCPATH . '/themes/twop6/include/test-color.php';
         RMTemplate::get()->footer();
         die;
     }
     if ($w == 'about') {
         include_once XOOPS_ROOT_PATH . '/include/cp_functions.php';
         RMTemplate::get()->header();
         require RMCPATH . '/themes/twop6/include/about.php';
         RMTemplate::get()->footer();
         die;
     }
 }
예제 #3
0
/**
* @desc Muestra el formulario para edición/creación de categorías
*/
function showForm($edit = 0)
{
    global $xoopsModule, $xoopsConfig, $xoopsModuleConfig;
    define('RMSUBLOCATION', 'newcategory');
    if ($edit) {
        $id = RMHttpRequest::get('id', 'integer', 0);
        if ($id <= 0) {
            RMUris::redirect_with_message(__('You had not provided a category ID', 'bxpress'), 'categories.php', RMMSG_WARN);
            die;
        }
        $catego = new bXCategory($id);
        if ($catego->isNew()) {
            RMUris::redirect_with_message(__('Specified category does not exists!', 'bxpress'), 'categories.php', RMMSG_ERROR);
            die;
        }
    }
    $bc = RMBreadCrumb::get();
    $bc->add_crumb(__('Categories', 'bxpress'), 'categories.php');
    $bc->add_crumb(__('Edit category', 'bxpress'));
    xoops_cp_header();
    $form = new RMForm($edit ? __('Edit Category', 'bxpress') : __('New Category', 'bxpress'), 'frmCat', 'categories.php');
    $form->addElement(new RMFormText(__('Name', 'bxpress'), 'title', 50, 100, $edit ? $catego->title() : ''), true);
    if ($edit) {
        $form->addElement(new RMFormText(__('Short name', 'bxpress'), 'friendname', 50, 100, $catego->friendName()));
    }
    $form->addElement(new RMFormEditor(__('Description', 'bxpress'), 'desc', '90%', '300px', $edit ? $catego->description() : ''));
    $form->addElement(new RMFormYesNo(__('Show description', 'bxpress'), 'showdesc', $edit ? $catego->showDesc() : 1));
    $form->addElement(new RMFormYesNo(__('Activate', 'bxpress'), 'status', $edit ? $catego->status() : 1));
    $form->addElement(new RMFormGroups(__('Groups', 'bxpress'), 'groups', 1, 1, 4, $edit ? $catego->groups() : array(0)), true, 'checked');
    $form->addElement(new RMFormHidden('action', $edit ? 'saveedit' : 'save'));
    if ($edit) {
        $form->addElement(new RMFormHidden('id', $catego->id()));
    }
    $buttons = new RMFormButtonGroup();
    $buttons->addButton('sbt', __('Submit', 'bxpress'), 'submit', '', true);
    $buttons->addButton('cancel', __('Cancel', 'bxpress'), 'button', 'onclick="window.location=\'categories.php\';"');
    $form->addElement($buttons);
    $form->display();
    xoops_cp_footer();
}
예제 #4
0
파일: rss.php 프로젝트: JustineBABY/mywords
         $img = new RMImage();
         $img->load_from_params($post->getVar('image', 'e'));
         if (!$img->isNew()) {
             $image = '<img src="' . $img->url() . '" alt="' . $post->getVar('title') . '" /><br />';
         } else {
             $image = '';
         }
         $item['description'] = XoopsLocal::convert_encoding(htmlspecialchars($image . $post->content(true), ENT_QUOTES));
         $item['pubdate'] = formatTimestamp($post->getVar('pubdate'), 'rss');
         $item['guid'] = $post->permalink();
         $rss_items[] = $item;
     }
     break;
 case 'author':
     include_once XOOPS_ROOT_PATH . '/modules/mywords/class/mweditor.class.php';
     $id = RMHttpRequest::get('author', 'integer', 0);
     if ($id <= 0) {
         redirect_header('backend.php', 1, __('Sorry, specified author was not foud!', 'mywords'));
         die;
     }
     $ed = new MWEditor($id);
     if ($ed->isNew()) {
         redirect_header('backend.php', 1, __('Sorry, specified author was not foud!', 'mywords'));
         die;
     }
     $rss_channel['title'] = sprintf(__('Posts by %s in %s', 'mywords'), $ed->name != '' ? $ed->name : $ed->shortname, $xoopsConfig['sitename']);
     $rss_channel['link'] = $ed->permalink();
     $rss_channel['description'] = sprintf(__('Posts published by %s.', 'mywords'), $ed->getVar('name')) . ' ' . htmlspecialchars(strip_tags($ed->getVar('bio')), ENT_QUOTES);
     $rss_channel['lastbuild'] = formatTimestamp(time(), 'rss');
     $rss_channel['webmaster'] = checkEmail($xoopsConfig['adminmail'], true);
     $rss_channel['editor'] = checkEmail($xoopsConfig['adminmail'], true);
예제 #5
0
 /**
  * RSS Management
  */
 public function eventCoreIncludeCommonEnd()
 {
     global $xoopsOption;
     if (defined('RMC_CHECK_UPDATES') && $xoopsOption['pagetype'] == 'admin') {
         global $xoopsSecurity, $rmTpl;
         $rmTpl->add_head_script('var xoToken = "' . $xoopsSecurity->createToken() . '";');
     }
     // Process notifications
     $current = explode("?", RMUris::relative_url(RMUris::current_url()));
     if ($current[0] == '/notifications.php') {
         $page = RMHttpRequest::post('page', 'string', '');
         if ('cu-notification-subscribe' == $page) {
             include RMCPATH . '/include/notifications.php';
         }
         $page = RMHttpRequest::get('page', 'string', '');
         if ('cu-notification-list' == $page) {
             include RMCPATH . '/include/notifications.php';
         }
     }
     RMEvents::get()->run_event('rmcommon.xoops.common.end');
 }
예제 #6
0
        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');
}
$action = RMHttpRequest::get('action', 'string', '');
switch ($action) {
    case 'showfeed':
        show_rss_content();
        break;
    default:
        show_rss_options();
        break;
}
예제 #7
0
/**
* Install specified theme
*/
function xt_install_theme()
{
    global $xoopsConfig, $xtFunctions, $xtAssembler;
    $current = $xtAssembler->theme()->getInfo('dir');
    $dir = RMHttpRequest::get('dir', 'string', '');
    if ($dir == '') {
        redirectMsg('themes.php', __('No theme has been specified!', 'xthemes'), RMMSG_ERROR);
    }
    $theme_dir = XOOPS_THEME_PATH . '/' . $dir;
    if (!is_file($theme_dir . '/theme.html')) {
        redirectMsg('themes.php', __('Specified directory does not contain a valid theme!', 'xthemes'), RMMSG_WARN);
    }
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    if (is_file($theme_dir . '/assemble/' . $dir . '.theme.php')) {
        // Install a xThemes Theme
        include_once $theme_dir . '/assemble/' . $dir . '.theme.php';
        $class = ucfirst($dir);
        if (!class_exists($class)) {
            redirectMsg('themes.php', __('Specified theme is not a valid xThemes theme!', 'xthemes'), RMMSG_WARN);
        }
        $theme = new $class();
        $theme->setVar('date', time());
        if (!$theme->on_install()) {
            RMUris::redirect_with_message(__('Theme could not be activated!', 'xthemes') . '<br>' . implode('<br>', $theme->errors()), 'themes.php', RMMSG_ERROR);
        }
        if (!$theme->save() && $theme->isNew()) {
            redirectMsg('themes.php', __('Sorry, theme could not be installed!', 'xthemes') . $theme->errors(), RMMSG_ERROR);
        }
        // Notify to current theme
        $xtFunctions->notify_deactivation($current);
        // Configuration options
        if (!$xtFunctions->insertOptions($theme)) {
            redirectMsg('themes.php', __('Sorry, theme could not be installed!', 'xthemes') . $theme->errors(), RMMSG_ERROR);
        }
        // Create blocks positions
        if (!$xtFunctions->insertPositions($theme)) {
            showMessage(__('The blocks positions could not be installed.', 'xthemes'), 'themes.php', RMMSG_WARN);
        }
    }
    $sql = "UPDATE " . $db->prefix("config") . " SET conf_value='{$dir}' WHERE conf_modid=0 AND conf_catid=1 AND conf_name='theme_set'";
    if (!$db->queryF($sql)) {
        redirectMsg('themes.php', __('Theme could not be activated', 'xthemes') . $db->getError(), RMMSG_ERROR);
    }
    $sql = "UPDATE " . $db->prefix("config") . " SET conf_value='" . serialize(array($dir)) . "' WHERE conf_modid=0 AND conf_catid=1 AND conf_name='theme_set_allowed'";
    $db->queryF($sql);
    redirectMsg('themes.php', __('Theme installed and activated successfully!', 'xthemes'), RMMSG_SUCCESS);
}
예제 #8
0
/**
 * Show the preferences for a specific module
 */
function show_module_preferences()
{
    global $rmTpl, $xoopsSecurity;
    $quick = RMHttpRequest::get('popup', 'integer', 0);
    $token = RMHttpRequest::get('CUTOKEN_REQUEST', 'string', '');
    $ajax = new AjaxResponse();
    $is_popup = $quick == 1 && $token != '';
    if ($is_popup) {
        $ajax->prepare_ajax_response();
        if (!$xoopsSecurity->validateToken(false, true, 'CUTOKEN')) {
            $ajax->ajax_response(__('Unauthorized action', 'rmcommon'), 1, 0, array('reload' => true));
        }
    }
    $mod = RMHttpRequest::get('mod', 'integer', 0);
    if ($mod <= 0) {
        RMUris::redirect_with_message(__('You have not specified a module!', 'rmcommon'), 'settings.php', RMMSG_WARN);
    }
    $mh = xoops_gethandler('module');
    $module = $mh->get($mod);
    if ($module->isNew()) {
        RMUris::redirect_with_message(__('You have not specified a valid module ID!', 'rmcommon'), 'settings.php', RMMSG_ERROR);
    }
    /**
     * Verify if module is rmcommon native or not
     */
    if ($module->getInfo('rmnative') != 1) {
        RMUris::redirect_with_message(__('This module can not be configured with Common Utilities', 'rmcommon'), XOOPS_URL . '/modules/system/admin.php?fct=preferences&op=showmod&mod=' . $mod, RMMSG_INFO);
    }
    /*
    Cargamos los valores y los datos para formar los campos
    */
    $values = RMSettings::module_settings($module->getVar('dirname'));
    $configs = $module->getInfo('config');
    $settings_categories = $module->getInfo('categories');
    $categories = array();
    if (empty($settings_categories)) {
        $categories = array('all' => array('caption' => __('Preferences', 'rmcommon')));
    } else {
        foreach ($settings_categories as $category => $caption) {
            $categories[$category] = array('caption' => $caption);
        }
    }
    unset($settings_categories);
    $fields = array();
    // Container for all fields and values
    foreach ($configs as $option) {
        $name = ucfirst($module->getVar('dirname')) . '[' . $option['name'] . ']';
        $field = new stdClass();
        $field->name = $name;
        $field->id = $option['name'];
        $field->value = isset($values->{$option}['name']) ? $values->{$option}['name'] : $option['default'];
        $field->caption = defined($option['title']) ? constant($option['title']) : $option['title'];
        $field->description = defined($option['description']) ? constant($option['description']) : $option['description'];
        $field->field = $option['formtype'];
        $field->type = $option['valuetype'];
        $field->options = isset($option['options']) ? $option['options'] : null;
        $category = isset($option['category']) ? $option['category'] : 'all';
        if (isset($categories[$category])) {
            $categories[$category]['fields'][$field->id] = $field;
        } else {
            if (!isset($categories['all'])) {
                $categories['all'] = array('caption' => __('Preferences', 'rmcommon'));
            }
            $categories['all']['fields'][$field->id] = $field;
        }
    }
    $categories = RMEvents::get()->run_event('rmcommon.settings.fields', $categories, $module);
    $rmTpl->add_style('settings.css', 'rmcommon', array('footer' => 1));
    /* Breadcrumb */
    $bc = RMBreadCrumb::get();
    if ($module->getVar('hasadmin')) {
        $bc->add_crumb($module->getVar('name'), XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/' . $module->getVar('adminindex'));
    } else {
        $bc->add_crumb($module->getVar('name'), '');
    }
    $bc->add_crumb(__('Settings', 'rmcommon'));
    $rmTpl->assign('xoops_pagetitle', sprintf(__('%s Settings', 'rmcommon'), $module->getVar('name')));
    if (!$is_popup) {
        $rmTpl->header();
        require $rmTpl->get_template('rmc-settings-form.php', 'module', 'rmcommon');
        $rmTpl->footer();
    } else {
        ob_start();
        require $rmTpl->get_template('rmc-settings-form.php', 'module', 'rmcommon');
        $response = ob_get_clean();
        $ajax->ajax_response(sprintf(__('%s Settings', 'rmcommon'), $module->getVar('name')), 0, 1, array('content' => $response, 'width' => 'xlarge', 'closeButton' => 1, 'id' => 'cu-settings-form'));
    }
}
예제 #9
0
<?php

/**
 * $Id$
 * --------------------------------------------------------------
 * Common Utilities
 * Author: Eduardo Cortes
 * Email: i.bitcero@gmail.com
 * License: GPL 2.0
 * URI: http://www.redmexico.com.mx
 */
require dirname(dirname(dirname(dirname(__FILE__)))) . '/include/cp_header.php';
$ajax = new Rmcommon_Ajax();
$ajax->prepare_ajax_response();
$dirname = RMHttpRequest::get('module', 'string', '');
if ($dirname == '') {
    $ajax->ajax_response(__('Please specify a valid module dirname!', 'rmcommon'), 1, 0);
}
$module = RMModules::load_module($dirname);
if (!$module) {
    $ajax->ajax_response(__('Specified module is not installed!', 'rmcommon'), 1, 0);
}
$url = $module->getInfo('updateurl');
$url .= false === strpos($url, '?') ? '?' : '&';
$url .= 'action=data&id=' . $module->dirname();
echo file_get_contents($url);