Esempio n. 1
0
function search_resources()
{
    global $xoopsConfig, $xoopsUser, $page, $xoopsTpl;
    $keyword = rmc_server_var($_GET, 'keyword', '');
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("rd_resources") . " WHERE (title LIKE '%{$keyword}%' OR description LIKE '%{$keyword}%') AND public=1 AND approved=1";
    list($num) = $db->fetchRow($db->query($sql));
    $page = rmc_server_var($_GET, 'page', 1);
    $limit = 15;
    $tpages = ceil($num / $limit);
    $page = $page > $tpages ? $tpages : $page;
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url(RDFunctions::make_link('search') . '?keyword=' . $keyword . '&amp;page={PAGE_NUM}');
    $sql = "SELECT * FROM " . $db->prefix("rd_resources") . " WHERE (title LIKE '%{$keyword}%' OR description LIKE '%{$keyword}%') AND public=1 AND approved=1 LIMIT {$start}, {$limit}";
    $result = $db->query($sql);
    $resources = array();
    while ($row = $db->fetchArray($result)) {
        $res = new RDResource();
        $res->assignVars($row);
        $resources[] = array('id' => $res->id(), 'title' => $res->getVar('title'), 'desc' => TextCleaner::truncate($res->getVar('description'), 100), 'link' => $res->permalink(), 'created' => $res->getVar('created'), 'owner' => $res->getVar('owner'), 'uname' => $res->getVar('owname'), 'reads' => $res->getVar('reads'));
    }
    RDFunctions::breadcrumb();
    RMBreadCrumb::get()->add_crumb(__('Browsing recent Documents', 'docs'));
    RMTemplate::get()->add_style('docs.css', 'docs');
    include 'header.php';
    $xoopsTpl->assign('xoops_pagetitle', sprintf(__('Search results for "%s"', 'docs'), $keyword));
    include RMEvents::get()->run_event('docs.template.search', RMTemplate::get()->get_template('rd_search.php', 'module', 'docs'));
    include 'footer.php';
}
Esempio n. 2
0
 /**
  * Generate the uploader object
  * 
  * @param string $dir
  * @param mixed $maxsize
  * @param mixed $allowedtypes
  * @return RMFileUploader
  */
 public function __construct($uploadDir, $maxFileSize, $allowed_exts = array())
 {
     //$this->XoopsMediaUploader($dir, $allowedtypes, $maxsize);
     $this->extensionToMime = (include $GLOBALS['xoops']->path('include/mimetypes.inc.php'));
     $ev = RMEvents::get();
     $this->extensionToMime = $ev->run_event('rmcommon.get.mime.types', $this->extensionToMime);
     if (!is_array($this->extensionToMime)) {
         $this->extensionToMime = array();
         return false;
     }
     if (is_array($allowed_exts)) {
         foreach ($allowed_exts as $ext) {
             $this->allowedMimeTypes[] = $this->extensionToMime[$ext];
         }
     }
     $this->uploadDir = $uploadDir;
     $this->maxFileSize = intval($maxFileSize);
     if (isset($maxWidth)) {
         $this->maxWidth = intval($maxWidth);
     }
     if (isset($maxHeight)) {
         $this->maxHeight = intval($maxHeight);
     }
     if (!@(include_once $GLOBALS['xoops']->path('language/' . $GLOBALS['xoopsConfig']['language'] . '/uploader.php'))) {
         include_once $GLOBALS['xoops']->path('language/english/uploader.php');
     }
 }
Esempio n. 3
0
function forums_data($data)
{
    global $xoopsUser;
    if (empty($data)) {
        return;
    }
    $forums = array();
    foreach ($data as $forum) {
        $isModerator = $xoopsUser && ($xoopsUser->isAdmin() || $forum->isModerator($xoopsUser->uid()));
        if (!$forum->active && !$isModerator) {
            continue;
        }
        $last = new bXPost($forum->lastPostId());
        $lastpost = array();
        if (!$last->isNew()) {
            if (!isset($posters[$last->uid])) {
                $posters[$last->uid] = new RMUser($last->uid);
            }
            $user = $posters[$last->uid];
            $lastpost['date'] = bXFunctions::formatDate($last->date());
            $lastpost['by'] = sprintf(__('by %s', 'bxpress'), $last->uname());
            $lastpost['id'] = $last->id();
            $lastpost['topic'] = $last->topic();
            $lastpost['user'] = array('uname' => $user->uname, 'name' => $user->name != '' ? $user->name : $user->uname, 'avatar' => $user ? RMEvents::get()->run_event('rmcommon.get.avatar', $user->getVar('email'), 50) : '');
            if ($xoopsUser) {
                $lastpost['new'] = $last->date() > $xoopsUser->getVar('last_login') && time() - $last->date() < $xoopsModuleConfig['time_new'];
            } else {
                $lastpost['new'] = time() - $last->date() <= $xoopsModuleConfig['time_new'];
            }
        }
        $category = new bXCategory($forum->cat);
        $forums[] = array('id' => $forum->id(), 'name' => $forum->name(), 'desc' => $forum->description(), 'topics' => $forum->topics(), 'posts' => $forum->posts(), 'link' => $forum->makeLink(), 'last' => $lastpost, 'image' => $forum->image, 'active' => $forum->active, 'category' => array('title' => $category->title));
    }
    return $forums;
}
Esempio n. 4
0
/**
* @desc Visualiza la lista de amigos del usuario
**/
function showFriends()
{
    global $xoopsOption, $tpl, $db, $xoopsUser, $xoopsModuleConfig, $pag, $xoopsConfig;
    $xoopsOption['template_main'] = 'gs_panel_friends.html';
    include 'header.php';
    $mc =& $xoopsModuleConfig;
    GSFunctions::makeHeader();
    //Barra de Navegación
    $sql = "SELECT COUNT(*) FROM " . $db->prefix('gs_friends') . " WHERE gsuser='******'";
    $page = isset($pag) ? $pag : '';
    $limit = 30;
    list($num) = $db->fetchRow($db->query($sql));
    if ($page > 0) {
        $page -= 1;
    }
    $start = $page * $limit;
    $tpages = (int) ($num / $limit);
    if ($num % $limit > 0) {
        $tpages++;
    }
    $pactual = $page + 1;
    if ($pactual > $tpages) {
        $rest = $pactual - $tpages;
        $pactual = $pactual - $rest + 1;
        $start = ($pactual - 1) * $limit;
    }
    if ($tpages > 1) {
        if ($mc['urlmode']) {
            $urlnav = 'cpanel/friends';
        } else {
            $urlnav = 'cpanel.php?by=cpanel/friends';
        }
        $nav = new GsPageNav($num, $limit, $start, 'pag', $urlnav, 0);
        $tpl->assign('friendsNavPage', $nav->renderNav(4, 1));
    }
    $showmax = $start + $limit;
    $showmax = $showmax > $num ? $num : $showmax;
    $tpl->assign('lang_showing', sprintf(__('Sowing friends %u to %u from %u.', 'galleries'), $start + 1, $showmax, $num));
    $tpl->assign('limit', $limit);
    $tpl->assign('pag', $pactual);
    //Fin de barra de navegación
    $sql = "SELECT * FROM " . $db->prefix('gs_friends') . " WHERE gsuser='******'";
    $sql .= " LIMIT {$start},{$limit}";
    $result = $db->query($sql);
    while ($row = $db->fetchArray($result)) {
        $xu = new XoopsUser($row['uid']);
        $tpl->append('users', array('uid' => $xu->uid(), 'uname' => $xu->uname(), 'link' => XOOPS_URL . "/modules/galleries/" . ($mc['urlmode'] ? "usr/" . $xu->uname() . "/" : "user.php?id=usr/" . $xu->uname()), 'avatar' => RMEvents::get()->run_event('rmcommon.get.avatar', $xu->email(), 0, $xu->user_avatar() != '' ? XOOPS_URL . '/uploads/avatars/' . $xu->user_avatar() : GS_URL . '/images/avatar.png')));
    }
    $tpl->assign('lang_uname', __('User name', 'galleries'));
    $tpl->assign('lang_newfriend', __('New Friend', 'galleries'));
    $tpl->assign('lang_del', __('Delete', 'galleries'));
    $tpl->assign('lang_confirm', __('Do you really wish to delete specified friend?', 'galleries'));
    $tpl->assign('lang_confirms', __('Do you really wish to delete selected friends?', 'galleries'));
    $tpl->assign('form_action_add', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/add/' : '?cp=add'));
    $tpl->assign('form_action_del', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/delete/' : '?cp=delete'));
    $tpl->assign('delete_link', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/deletefriend/pag/' . $pactual . '/id/' : '?cp=deletefriend&amp;page=' . $pactual . '&amp;id='));
    RMTemplate::get()->add_style('panel.css', 'galleries');
    createLinks();
    include 'footer.php';
}
Esempio n. 5
0
/**
 * Muestra una lista de las categorías existentes
 */
function showCategos()
{
    global $xoopsModule, $xoopsSecurity;
    $row = array();
    qpArrayCategos($row);
    $categories = array();
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    foreach ($row as $k) {
        $catego = new QPCategory($k['id_cat']);
        $catego->update();
        list($num) = $db->fetchRow($db->query("SELECT COUNT(*) FROM " . $db->prefix("qpages_pages") . " WHERE cat='{$k['id_cat']}'"));
        $k['posts'] = $num;
        $k['nombre'] = str_repeat("&#8212;", $k['saltos']) . ' ' . $k['nombre'];
        $categories[] = $k;
    }
    // Event
    $categories = RMEvents::get()->run_event('qpages.categories.list', $categories);
    RMTemplate::get()->add_style('admin.css', 'qpages');
    RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
    RMTemplate::get()->add_script('../include/js/qpages.js');
    RMTemplate::get()->assign('xoops_pagetitle', __('Categories management', 'qpages'));
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . '</a> &raquo; ' . __('Categories', 'qpages'));
    xoops_cp_header();
    include RMTemplate::get()->get_template("admin/qp_categos.php", 'module', 'qpages');
    xoops_cp_footer();
}
Esempio n. 6
0
/**
* @desc Muestra el contenido de las secciones editadas y original para su revisión
*/
function reviewEdit()
{
    global $xoopsModule;
    $id = rmc_server_var($_GET, 'id', 0);
    if ($id <= 0) {
        redirectMsg('edits.php', __('You have not specified any section!', 'docs'), 1);
        die;
    }
    $edit = new RDEdit($id);
    if ($edit->isNew()) {
        redirectMsg('edits.php', __('Specified content does not exists!', 'docs'), 1);
        die;
    }
    $sec = new RDSection($edit->getVar('id_sec'));
    if ($sec->isNew()) {
        redirectMsg('edits.php', __('The section indicated by current element does not exists!', 'docs'), 1);
        die;
    }
    // Datos de la Sección
    $section = array('id' => $sec->id(), 'title' => $sec->getVar('title'), 'text' => $sec->getVar('content'), 'link' => $sec->permalink(), 'res' => $sec->getVar('id_res'));
    // Datos de la Edición
    $new_content = array('id' => $edit->id(), 'title' => $edit->getVar('title'), 'text' => $edit->getVar('content'));
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; <a href='./edits.php'>" . __('Waiting Content', 'docs') . "</a> &raquo; " . sprintf(__('Editing %s', 'docs'), $sec->getVar('title')));
    xoops_cp_header();
    RMTemplate::get()->add_style('admin.css', 'docs');
    include RMEvents::get()->run_event('docs.template.review.waiting', RMTemplate::get()->get_template('admin/rd_reviewedit.php', 'module', 'docs'));
    xoops_cp_footer();
}
Esempio n. 7
0
/**
* Modify the page output to include some new features
* 
* @param mixed $output
* @return string
*/
function cu_render_output($output)
{
    global $xoTheme, $xoopsTpl;
    if (function_exists('xoops_cp_header')) {
        return $output;
    }
    $page = $output;
    if ($xoopsTpl) {
        if (defined('COMMENTS_INCLUDED') && COMMENTS_INCLUDED) {
            RMTemplate::get()->add_xoops_style('comments.css', 'rmcommon');
        }
    }
    $pos = strpos($page, "</head>");
    if ($pos === FALSE) {
        return $output;
    }
    include_once RMTemplate::get()->tpl_path('rmc_header.php', 'rmcommon');
    $rtn = substr($page, 0, $pos) . "\n";
    $rtn .= $scripts;
    $rtn .= $styles;
    $rtn .= $heads;
    $rtn .= substr($page, $pos);
    $rtn = RMEvents::get()->run_event('rmcommon.end.flush', $rtn);
    return $rtn;
}
Esempio n. 8
0
 public function toolbar()
 {
     RMTemplate::get()->add_tool(__('Dashboard', 'xthemes'), 'index.php', 'images/dashboard.png', 'dashboard');
     RMTemplate::get()->add_tool(__('Available Themes', 'xthemes'), 'themes.php', 'images/themes.png', 'catalog');
     RMTemplate::get()->add_tool(__('Theme Settings', 'xthemes'), 'settings.php', 'images/settings.png', 'settings');
     RMTemplate::get()->add_tool(__('About', 'xthemes'), 'index.php?action=about', 'images/about.png', 'about');
     $events = RMEvents::get();
     $events->run_event('xthemes.toolbar');
 }
Esempio n. 9
0
/**
* Show all RSS options
*/
function show_rss_options()
{
    global $xoopsTpl, $xoopsConfig;
    include XOOPS_ROOT_PATH . '/header.php';
    $xoopsTpl->assign('xoops_pagetitle', __('RSS Center', 'rmcommon'));
    $feeds = array();
    $feeds = RMEvents::get()->run_event('rmcommon.get.feeds.list', $feeds);
    RMTemplate::get()->add_style('rss.css', 'rmcommon');
    include RMTemplate::get()->get_template('rmc_rss_center.php', 'module', 'rmcommon');
    include XOOPS_ROOT_PATH . '/footer.php';
}
Esempio n. 10
0
 /**
  * Save comment
  */
 public function save()
 {
     // To check or modify data before save this
     $ret = RMEvents::get()->run_event('rmcommon.saving.comment', $this);
     if ($this->isNew()) {
         $sr = $this->saveToTable();
     } else {
         $sr = $this->updateTable();
     }
     return $ret && $sr;
 }
Esempio n. 11
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 = RMFunctions::current_url();
     $p = parse_url($url);
     if (substr($p['path'], -11) == 'backend.php') {
         include_once RMCPATH . '/rss.php';
         die;
     }
 }
Esempio n. 12
0
function show_rm_blocks()
{
    global $xoopsModule, $xoopsConfig, $wid_globals, $xoopsSecurity;
    $db = Database::getInstance();
    $modules = RMFunctions::get_modules_list(1);
    // ** API Event **
    // Allows other methods to add o modify the list of available widgets
    $modules = RMEvents::get()->run_event('rmcommon.blocks.modules', $modules);
    // Cargamos los grupos
    $sql = "SELECT groupid, name FROM " . $db->prefix("groups") . " ORDER BY name";
    $result = $db->query($sql);
    $groups = array();
    while ($row = $db->fetchArray($result)) {
        $groups[] = array('id' => $row['groupid'], 'name' => $row['name']);
    }
    // Cargamos las posiciones de bloques
    $bpos = RMBlocksFunctions::block_positions();
    $sql = createSQL();
    $result = $db->query($sql);
    $blocks = array();
    $used_blocks = array();
    while ($row = $db->fetchArray($result)) {
        $mod = RMFunctions::load_module($row['element']);
        if (!$mod) {
            continue;
        }
        $used_blocks[] = array('id' => $row['bid'], 'title' => $row['name'], 'module' => array('id' => $mod->mid(), 'dir' => $mod->dirname(), 'name' => $mod->name()), 'canvas' => $bpos[$row['canvas']], 'weight' => $row['weight'], 'visible' => $row['visible'], 'type' => $row['type'], 'options' => $row['edit_func'] != '' ? 1 : 0, 'description' => $row['description']);
    }
    // ** API **
    // Event for manege the used widgets list
    $used_blocks = RMEvents::get()->run_event('rmcommon.used.blocks.list', $used_blocks);
    $positions = array();
    foreach ($bpos as $row) {
        $positions[] = array('id' => $row['id_position'], 'name' => $row['name']);
    }
    $positions = RMEvents::get()->run_event('rmcommon.block.positions.list', $positions);
    xoops_cp_location('<a href="./">' . $xoopsModule->getVar('name') . '</a> &raquo; ' . __('Blocks', 'rmcommon'));
    RMTemplate::get()->add_style('blocks.css', 'rmcommon');
    RMTemplate::get()->add_local_script('blocks.js', 'rmcommon', 'include');
    RMTemplate::get()->add_local_script('jkmenu.js', 'rmcommon', 'include');
    RMTemplate::get()->add_style('forms.css', 'rmcommon');
    RMTemplate::get()->add_local_script('jquery-ui.min.js', 'rmcommon', 'include');
    xoops_cp_header();
    // Available Widgets
    $blocks = RMBlocksFunctions::get_available_list($modules);
    // Position
    $the_position = isset($_GET['pos']) ? intval($_GET['pos']) : '';
    include RMTemplate::get()->get_template("rmc_blocks.php", 'module', 'rmcommon');
    xoops_cp_footer();
}
Esempio n. 13
0
function rd_show_page()
{
    RMTemplate::get()->assign('xoops_pagetitle', __('Home Page', 'docs'));
    xoops_cp_header();
    include_once RMCPATH . '/class/form.class.php';
    $content = @file_get_contents(XOOPS_CACHE_PATH . '/rd_homepage.html');
    $content = TextCleaner::getInstance()->to_display($content);
    $editor = new RMFormEditor('', 'homepage', '100%', '450px', $content);
    $rmc_config = RMFunctions::configs();
    if ($rmc_config['editor_type'] == 'tiny') {
        $tiny = TinyEditor::getInstance();
        $tiny->add_config('theme_advanced_buttons1', 'res_index');
    }
    include RMEvents::get()->run_event('docs.get.homepage.template', RMTemplate::get()->get_template('admin/rd_homepage.php', 'module', 'docs'));
    xoops_cp_footer();
}
Esempio n. 14
0
function send_message()
{
    global $xoopsModule, $xoopsModuleConfig, $xoopsUser;
    $name = rmc_server_var($_POST, 'name', '');
    $email = rmc_server_var($_POST, 'email', '');
    $company = rmc_server_var($_POST, 'company', '');
    $phone = rmc_server_var($_POST, 'phone', '');
    $subject = rmc_server_var($_POST, 'subject', '');
    $message = rmc_server_var($_POST, 'message', '');
    if ($name == '' || $email == '' || !checkEmail($email) || $subject == '' || $message == '') {
        redirect_header($xoopsModuleConfig['url'], 1, __('Please fill all required fileds before to send this message!', 'contact'));
        die;
    }
    // Recaptcha check
    if (!RMEvents::get()->run_event('rmcommon.captcha.check', true)) {
        redirect_header($xoopsModuleConfig['url'], 1, __('Please check the security words and write it correctly!', 'contact'));
        die;
    }
    $xoopsMailer =& getMailer();
    $xoopsMailer->useMail();
    $xoopsMailer->setBody($message . "\n--------------\n" . __('Message sent with ContactMe!', 'contact') . "\n" . $xoopsModuleConfig['url']);
    $xoopsMailer->setToEmails($xoopsModuleConfig['mail']);
    $xoopsMailer->setFromEmail($email);
    $xoopsMailer->setFromName($name);
    $xoopsMailer->setSubject($subject);
    if (!$xoopsMailer->send(true)) {
        redirect_header($xoopsModuleConfig['url'], 1, __('Message could not be delivered. Please try again.', 'contact'));
        die;
    }
    // Save message on database for further use
    $msg = new CTMessage();
    $msg->setVar('subject', $subject);
    $msg->setVar('ip', $_SERVER['REMOTE_ADDR']);
    $msg->setVar('email', $email);
    $msg->setVar('name', $name);
    $msg->setVar('org', $company);
    $msg->setVar('body', $message);
    $msg->setVar('phone', $phone);
    $msg->setVar('register', $xoopsUser ? 1 : 0);
    if ($xoopsUser) {
        $msg->setVar('xuid', $xoopsUser->uid());
    }
    $msg->setVar('date', time());
    $msg->save();
    redirect_header(XOOPS_URL, 1, __('Your message has been sent successfully!', 'contact'));
}
Esempio n. 15
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;
     }
 }
Esempio n. 16
0
 public function eventRmcommonLoadRightWidgets($widgets)
 {
     global $xoopsModule;
     if (!isset($xoopsModule) || $xoopsModule->getVar('dirname') != 'system' && $xoopsModule->getVar('dirname') != 'dtransport') {
         return $widgets;
     }
     if (defined("RMCSUBLOCATION") && RMCSUBLOCATION == 'newitem') {
         include_once '../widgets/dt_items.php';
         $action = rmc_server_var($_GET, 'action', '');
         $edit = $action == 'edit' ? 1 : 0;
         $widgets[] = dt_widget_information($edit);
         $widgets[] = dt_widget_defimg($edit);
         $widgets[] = dt_widget_options($edit);
         //$widgets[] = dt_widget_alert($edit);
         //$widgets[] = dt_widget_credits($edit);
         // Other widgets
         $widgets = RMEvents::get()->run_event('dtransport.load.items.widgets', $widgets, $action, $edit);
     }
     return $widgets;
 }
Esempio n. 17
0
 public function __construct()
 {
     /**
      * Load all services provided for modules, plugins and themes.
      * The component must return a service identificator and the
      * class name to run this service.
      */
     $services = array();
     $services = \RMEvents::get()->run_event('rmcommon.get.services', $services);
     /**
      * Due to nature of services, the last added service will have
      * priority over other components for same service.
      */
     foreach ($services as $service) {
         if (!file_exists($service['file'])) {
             continue;
         }
         $this->services[$service['service']] = array('id' => $service['id'], 'file' => $service['file'], 'class' => $service['class']);
     }
 }
Esempio n. 18
0
 /**
  * Get the available widgets list
  *
  * @return array
  */
 public static function get_available_list($mods = null)
 {
     $db = XoopsDatabaseFactory::getDatabaseConnection();
     if ($mods == null || empty($mods)) {
         $mods = RMModules::get_modules_list();
     }
     $list = array();
     // Block list to return
     foreach ($mods as $mod) {
         if (!file_exists(XOOPS_ROOT_PATH . '/modules/' . $mod['dirname'] . '/xoops_version.php')) {
             continue;
         }
         load_mod_locale($mod['dirname']);
         $module = new XoopsModule();
         $module->loadInfoAsVar($mod['dirname']);
         $list[$mod['dirname']] = array('name' => $mod['name'], 'blocks' => $module->getInfo('blocks'));
     }
     // Event generated to modify the available widgets list
     $list = RMEvents::get()->run_event('rmcommon.available.widgets', $list);
     return $list;
 }
Esempio n. 19
0
 /**
  * Loads new SVG icons provider
  *
  * Components must use evenRmcommonRegisterIconProvider event and return an array
  * with keys 'id' and 'directory'.
  *
  * 'id' key must have an unique identifier to load icons from 'directory'.
  *
  * @return bool
  * @throws \Exception
  */
 private function loadProviders()
 {
     $providers = array();
     $providers = \RMEvents::get()->trigger('rmcommon.register.icon.provider', $providers);
     if (empty($providers)) {
         return true;
     }
     foreach ($providers as $provider) {
         if ($provider['id'] == '') {
             continue;
         }
         if (!is_dir($provider['directory'])) {
             continue;
         }
         if ($provider['id'] == 'rmcommon') {
             throw new \Exception(__('Illegal attempt to replace "Common Utilities" icons provider!', 'rmcommon'));
             return false;
         }
         $this->iconsProviders[$provider['id']] = $provider['directory'];
     }
 }
Esempio n. 20
0
/**
 * bXpress Forums
 * A light weight and easy to use XOOPS module to create forums
 * 
 * Copyright © 2014 Eduardo Cortés https://eduardocortes.mx
 * -----------------------------------------------------------------
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 * -----------------------------------------------------------------
 * @package    bXpress
 * @author     Eduardo Cortés <*****@*****.**>
 * @since      1.2
 * @license    GPL v2 (http://www.gnu.org/licenses/gpl-2.0.html)
 * @link       https://github.com/bitcero/bxpress
 */
function bxpress_block_users_show($options)
{
    // Add css styles
    RMTemplate::get()->add_style('bxpress-blocks.min.css', 'bxpress');
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $tbu = $db->prefix("users");
    $tbp = $db->prefix("mod_bxpress_posts");
    $tbl = $db->prefix("mod_bxpress_likes");
    if ('active' == $options['type']) {
        $sql = "SELECT DISTINCT posts.uid, users.uid, users.uname, users.email, users.name,\n                (SELECT COUNT(*) FROM {$tbp} WHERE uid = posts.uid) as total,\n                (SELECT SUM(likes) FROM {$tbp} WHERE uid = posts.uid ) as likes\n                FROM {$tbu} as users, {$tbp} as posts WHERE users.uid = posts.uid ORDER BY total DESC LIMIT 0, {$options['limit']}";
    }
    $result = $db->query($sql);
    $users = array();
    $user = new RMUser();
    while ($row = $db->fetchArray($result)) {
        $user->assignVars($row);
        $users[] = array('id' => $user->id(), 'name' => '' != $user->name ? $user->name : $user->uname, 'uname' => $user->uname, 'avatar' => RMEvents::get()->run_event("rmcommon.get.avatar", $user->email, 0), 'posts' => $row['total'], 'likes' => $row['likes']);
    }
    $block['users'] = $users;
    return $block;
}
 /**
  * @desc Crea la cabecera del módulo
  */
 public function makeHeader($title = '')
 {
     global $xoopsTpl, $xoopsUser;
     $func = RMUtilities::get();
     $mc = $func->module_config('dtransport');
     $xoopsTpl->assign('dt_header_title', $title);
     $header = array('cansubmit' => $this->canSubmit(), 'searchlink' => $mc['permalinks'] ? DT_URL . '/' . trim($mc['htbase'], '/') . '/search/' : DT_URL . '/?p=search');
     $header['links'][] = array('title' => __('Downloads', 'dtransport'), 'link' => DT_URL);
     $header['links'][] = array('title' => __('My Downloads', 'dtransport'), 'link' => $mc['permalinks'] ? DT_URL . '/cp/' : DT_URL . '/?p=cpanel');
     if ($this->canSubmit()) {
         $header['links'][] = array('title' => __('Submit Download', 'dtransport'), 'link' => $mc['permalinks'] ? DT_URL . '/submit/' : DT_URL . '/?p=explore&amp;f=submit');
     }
     $header['links'][] = array('title' => __('Recent Downloads', 'dtransport'), 'link' => $mc['permalinks'] ? DT_URL . '/recent/' : DT_URL . '/?p=explore&amp;f=recent');
     $header['links'][] = array('title' => __('Popular Downloads', 'dtransport'), 'link' => $mc['permalinks'] ? DT_URL . '/popular/' : DT_URL . '/?p=explore&amp;f=popular');
     $header['links'][] = array('title' => __('Best Rated', 'dtransport'), 'link' => $mc['permalinks'] ? DT_URL . '/rated/' : DT_URL . '/?p=explore&amp;f=rated');
     $ev = RMEvents::get();
     $header = $ev->run_event("dtransport.make.header", $header);
     $xoopsTpl->assign('header', $header);
     $tpl = RMTemplate::get();
     $tpl->add_xoops_style('main.css', 'dtransport');
     return true;
 }
Esempio n. 22
0
function delete_mw_trackbacks()
{
    global $xoopsSecurity;
    $tbs = rmc_server_var($_POST, 'tbs', array());
    if (empty($tbs) || !is_array($tbs)) {
        redirectMsg('trackbacks.php', __('Select one trackback at least!', 'mw_categories'), 1);
        die;
    }
    if (!$xoopsSecurity->check()) {
        redirectMsg('trackbacks.php', __('Session token expired!', 'mywords'), 1);
        die;
    }
    // Event
    RMEvents::get()->run_event('mywords.before.delete.trackback', $tbs);
    foreach ($tbs as $id) {
        $trac = new MWTrackbackObject($id);
        if ($trac->isNew()) {
            continue;
        }
        $trac->delete();
    }
    redirectMsg('trackbacks.php', __('Trackbacks deleted successfully', 'mywords'), 0);
}
Esempio n. 23
0
function m_show_ranking()
{
    global $xoopsModule;
    $champ = rmc_server_var($_REQUEST, 'champ', 0);
    $category = rmc_server_var($_REQUEST, 'category', 0);
    $champs = MCHFunctions::all_championships();
    $categories = array();
    MCHFunctions::categories_tree($categories);
    if ($champ > 0 && $category > 0) {
        $ranking = MCHFunctions::get_ranking($champ, $category);
    }
    MCHFunctions::toolbar();
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> &raquo; " . __('Coaches', 'match'));
    RMTemplate::get()->assign('xoops_pagetitle', __('Coaches', 'match'));
    RMTemplate::get()->add_style('admin.css', 'match');
    RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
    RMTemplate::get()->add_local_script('admin_match.js', 'match');
    RMTemplate::get()->add_head("<script type='text/javascript'>\nvar mch_message='" . __('Do you really want to delete selected coaches?', 'match') . "';\n\n        var mch_select_message = '" . __('You must select some coach before to execute this action!', 'match') . "';</script>");
    xoops_cp_header();
    $match_extra_options = RMEvents::get()->run_event('match.more.options');
    include RMTemplate::get()->get_template("admin/mch_ranking.php", 'module', 'match');
    xoops_cp_footer();
}
 /**
  * Get the menu for a specified module
  */
 public function moduleMenu($m)
 {
     global $xoopsModule, $xoopsUser;
     if (!is_a($xoopsModule, 'XoopsModule')) {
         $mod = RMFunctions::load_module($m);
     } else {
         if ($xoopsModule->dirname() == $m) {
             $mod = $xoopsModule;
         } else {
             $mod = RMFunctions::load_module($m);
         }
     }
     if (!is_a($mod, 'XoopsModule')) {
         return false;
     }
     // Check user
     if (!is_a($xoopsUser, 'XoopsUser')) {
         return false;
     }
     if (!$xoopsUser->isAdmin($mod->mid())) {
         return false;
     }
     $amenu = $mod->getAdminMenu();
     $amenu = RMEvents::get()->run_event($mod->dirname() . '.module.menu', $amenu);
     if (empty($amenu)) {
         return false;
     }
     $return_menu = array();
     foreach ($amenu as $menu) {
         $return_menu[] = array('title' => $menu['title'], 'link' => strpos($menu['link'], 'http://') !== FALSE && strpos($menu['link'], 'ftp://') !== FALSE ? $menu['link'] : XOOPS_URL . '/modules/' . $mod->getVar('dirname', 'n') . '/' . $menu['link'], 'icon' => isset($menu['icon']) ? strpos($menu['icon'], 'http://') !== FALSE ? $menu['icon'] : XOOPS_URL . '/modules/' . $mod->dirname() . '/' . $menu['icon'] : '', 'location' => isset($menu['location']) ? $menu['location'] : '', 'options' => isset($menu['options']) ? self::moduleSubmenu($menu['options'], $mod) : null);
     }
     if ($mod->hasconfig()) {
         $return_menu[] = array('title' => __('Options', 'rmcommon'), 'link' => XOOPS_URL . '/modules/system/admin.php?fct=preferences&amp;op=showmod&amp;mod=' . $mod->mid(), 'icon' => RMTHEMEURL . '/images/settings.png', '');
     }
     return $return_menu;
 }
 /**
  * Get the menu for a specified module
  */
 public function moduleMenu($m)
 {
     global $xoopsModule, $xoopsUser;
     if (!is_a($xoopsModule, 'XoopsModule')) {
         $mod = RMModules::load_module($m);
     } else {
         if ($xoopsModule->dirname() == $m) {
             $mod = $xoopsModule;
         } else {
             $mod = RMModules::load_module($m);
         }
     }
     if (!is_a($mod, 'XoopsModule')) {
         return false;
     }
     // Check user
     if (!is_a($xoopsUser, 'XoopsUser')) {
         return false;
     }
     if (!$xoopsUser->isAdmin($mod->mid())) {
         return false;
     }
     $amenu = $mod->getAdminMenu();
     $amenu = RMEvents::get()->run_event($mod->dirname() . '.module.menu', $amenu);
     if (empty($amenu)) {
         return false;
     }
     $return_menu = array();
     foreach ($amenu as $menu) {
         $return_menu[] = array('title' => $menu['title'], 'link' => preg_match("/^(http:\\/\\/|https:\\/\\/|ftp:\\/\\/|mailto:)/i", $menu['link']) ? $menu['link'] : XOOPS_URL . '/modules/' . $mod->getVar('dirname', 'n') . '/' . $menu['link'], 'icon' => isset($menu['icon']) ? preg_match("/^(http:\\/\\/|https:\\/\\/)/i", $menu['icon']) ? $menu['icon'] : (self::is_font_icon($menu['icon']) ? $menu['icon'] : XOOPS_URL . '/modules/' . $mod->dirname() . '/' . $menu['icon']) : '', 'location' => isset($menu['location']) ? $menu['location'] : '', 'options' => isset($menu['options']) ? self::moduleSubmenu($menu['options'], $mod) : ($m == 'system' && $menu['title'] == _AM_SYSTEM_PREF ? self::systemPreferences() : null));
     }
     if ($mod->hasconfig()) {
         $return_menu[] = array('divider' => 1);
         // Divisor for options
         $return_menu[] = array('title' => __('Options', 'rmcommon'), 'link' => $mod->getInfo('rmnative') ? XOOPS_URL . '/modules/rmcommon/settings.php?mod=' . $mod->mid() . '&amp;popup=1&amp;action=configure' : XOOPS_URL . '/modules/system/admin.php?fct=preferences&amp;op=showmod&amp;mod=' . $mod->mid(), 'icon' => '', 'type' => 1);
     }
     return $return_menu;
 }
Esempio n. 26
0
 /**
  * This function is only a holder for event exmevent_format_code
  *
  * @param string Code to format
  * @param string Language name
  * @return srtring
  */
 public function call_code_modifiers($code, $lang)
 {
     // Event to call methods thatr can handle code to display (eg. highlighters)
     return RMEvents::get()->run_event('rmcommon.format.code', $code, $lang);
 }
Esempio n. 27
0
include_once RMCPATH . '/class/fields/theme.class.php';
include_once RMCPATH . '/class/fields/language.class.php';
include_once RMCPATH . '/class/fields/modules.class.php';
include_once RMCPATH . '/class/fields/timezone.class.php';
include_once RMCPATH . '/class/fields/cachemod.class.php';
include_once RMCPATH . '/class/fields/avatar.class.php';
include_once RMCPATH . '/class/fields/textoptions.class.php';
include_once RMCPATH . '/class/fields/formuser.class.php';
include_once RMCPATH . '/class/fields/date.class.php';
include_once RMCPATH . '/class/fields/formimage.class.php';
include_once RMCPATH . '/api/editors/tinymce/tinyeditor.php';
/**
* @desc Controlador del editor TinyMCE
*/
$tiny =& TinyEditor::getInstance();
$tiny->configuration = array('mode' => 'exact', 'theme' => 'advanced', 'skin' => "exm_theme", 'inlinepopups_skin' => 'exm', 'plugins' => "safari,inlinepopups,spellchecker,media,fullscreen,exmsystem", 'theme_advanced_buttons1' => RMEvents::get()->run_event('rmcommon.tinybuttons.toolbar1', "bold,italic,strikethrough,|,bullist,numlist,blockquote,|,justifyleft,justifycenter,justifyright,|,link,unlink|,spellchecker,fullscreen,|,exm_more,exm_adv"), 'theme_advanced_buttons2' => RMEvents::get()->run_event('rmcommon.tinybuttons.toolbar2', "formatselect,underline,justifyfull,forecolor,|,pastetext,pasteword,removeformat,|,media,charmap,|,outdent,indent,|,undo,redo,|,exm_page,exm_img,exm_icons"), 'theme_advanced_buttons3' => "", 'theme_advanced_buttons4' => "", 'spellchecker_languages' => "+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv", 'theme_advanced_toolbar_location' => "top", 'theme_advanced_toolbar_align' => "left", 'theme_advanced_statusbar_location' => "bottom", 'theme_advanced_resizing' => "1", 'theme_advanced_resize_horizontal' => "", 'dialog_type' => "modal", 'relative_urls' => "", 'remove_script_host' => "", 'convert_urls' => "", 'apply_source_formatting' => "", 'remove_linebreaks' => "1", 'paste_convert_middot_lists' => "1", 'paste_remove_spans' => "1", 'paste_remove_styles' => "1", 'gecko_spellcheck' => "1", 'entities' => "38,amp,60,lt,62,gt", 'accessibility_focus' => "1", 'tab_focus' => "'=>prev,'=>next", 'save_callback' => "switchEditors.saveCallback", 'content_css' => RMTemplate::get()->style_url('editor.css', 'rmcommon'));
/**
 * Esta clase controla la generación de formularios automáticamente.<br />
 * Esta clase es un sustituto par ala clase XoopsForm
 */
class RMForm
{
    private $_fields = array();
    protected $_name = '';
    protected $_action = '';
    protected $_extra = '';
    protected $_method = '';
    protected $_title = '';
    private $_tableClass = 'outer';
    private $_thClass = '';
    private $_headClass = 'head';
Esempio n. 28
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. 29
0
/**
* Allows to translate string from exm system elements
*/
function translate($text, $domain = 'system')
{
    global $l10n;
    if (isset($l10n[$domain])) {
        return RMEvents::get()->run_event('rmcommon.get_locale_text', $l10n[$domain]->translate($text), $text, $domain);
    } else {
        return RMEvents::get()->run_event('rmcommon.get_locale_text', $text, $text, $domain);
    }
}
Esempio n. 30
0
 /**
  * Get resources index according to given options
  */
 public function resources_index($type = 'all', $display = 1, $cols = 3, $limit = 15)
 {
     $db = XoopsDatabaseFactory::getDatabaseConnection();
     $sql = "SELECT * FROM " . $db->prefix("rd_resources");
     if ($type == 'featured') {
         $sql .= " WHERE public=1 AND approved=1 AND featured=1 ORDER BY created DESC";
     } elseif ($type == 'all') {
         $sql .= " WHERE public=1 AND approved=1 ORDER BY created DESC";
     }
     $sql .= " LIMIT 0,{$limit}";
     $result = $db->query($sql);
     $resources = array();
     while ($row = $db->fetchArray($result)) {
         $res = new RDResource();
         $res->assignVars($row);
         $resources[] = array('id' => $res->id(), 'title' => $res->getVar('title'), 'desc' => $res->getVar('description'), 'link' => $res->permalink());
     }
     ob_start();
     include RMEvents::get()->run_event('docs.template.resources.index', RMTemplate::get()->get_template('rd_resindex.php', 'module', 'docs'));
     $ret = ob_get_clean();
     return $ret;
 }