Example #1
0
/**
* @desc Muestra el formulario para agregar un nuevo sitio
*/
function edit_bookmark()
{
    global $xoopsModule, $xoopsConfig, $xoopsSecurity, $rmTpl;
    $id = rmc_server_var($_GET, 'id', 0);
    if ($id <= 0) {
        redirectMsg('bookmarks.php', __('Site ID not provided!', 'mywords'), 1);
        die;
    }
    $book = new MWBookmark($id);
    if ($book->isNew()) {
        redirectMsg('bookmarks.php', __('Social site not exists!', 'mywords'), 1);
        die;
    }
    $temp = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . '/modules/mywords/images/icons');
    foreach ($temp as $icon) {
        $icons[] = array('url' => XOOPS_URL . "/modules/mywords/images/icons/{$icon}", 'name' => $icon);
    }
    MWFunctions::include_required_files();
    RMBreadCrumb::get()->add_crumb(__('Social Sites', 'mywords'), 'bookmarks.php');
    RMBreadCrumb::get()->add_crumb(__('Edit Site', 'mywords'));
    xoops_cp_header();
    $show_edit = true;
    include $rmTpl->get_template('admin/mywords_bookmarks.php', 'module', 'mywords');
    $rmTpl->assign('xoops_pagetitle', __('Edit Social Site', 'mywords'));
    $rmTpl->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
    $rmTpl->add_script('../include/js/scripts.php?file=bookmarks.js');
    xoops_cp_footer();
}
Example #2
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';
}
Example #3
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();
}
Example #4
0
function xt_show_themes()
{
    global $tpl, $xtf, $xoopsSecurity, $xtAssembler, $xtFunctions;
    $current = $xtAssembler->theme();
    // Read all available themes
    $dh = opendir(XOOPS_THEME_PATH);
    $i = 0;
    while (false !== ($dir = readdir($dh))) {
        if ($dir == '.' || $dir == '..' || is_file(XOOPS_THEME_PATH . '/' . $dir)) {
            continue;
        }
        if (!is_file(XOOPS_THEME_PATH . '/' . $dir . '/theme.html')) {
            continue;
        }
        // Supported themes
        $theme_path = XOOPS_THEME_PATH . '/' . $dir;
        if (is_file($theme_path . '/assemble/' . strtolower($dir) . '.theme.php')) {
            include_once $theme_path . '/assemble/' . strtolower($dir) . '.theme.php';
            $class = ucfirst(strtolower($dir));
            $theme = new $class();
        } else {
            $theme = new StandardTheme();
            $theme->set_dir($dir);
        }
        $themes[$i] = $theme->getInfo();
        $themes[$i]['url'] = $theme->url();
        $themes[$i]['installed'] = !$theme->isNew();
        $i++;
    }
    $tpl->add_style("themes.css", 'xthemes');
    $tpl->add_script('masonry.pkgd.min.js', 'xthemes');
    $tpl->add_script('xthemes.js', 'xthemes');
    $tpl->add_head_script("var xoops_url = '" . XOOPS_URL . "';");
    $tpl->assign('xoops_pagetitle', __('Themes Manager', 'xthemes'));
    $bc = RMBreadCrumb::get();
    $bc->add_crumb(__('Themes', 'xthemes'));
    xoops_cp_header();
    include $tpl->get_template("xt_themes.php", 'module', 'xthemes');
    xoops_cp_footer();
}
Example #5
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();
}
Example #6
0
function show_mw_trackbacks()
{
    global $xoopsModule, $xoopsSecurity;
    $id = rmc_server_var($_GET, 'id', 0);
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("mod_mywords_trackbacks");
    if ($id > 0) {
        $sql .= "WHERE post={$id}";
    }
    list($num) = $db->fetchRow($db->query($sql));
    $page = rmc_server_var($_GET, 'page', 1);
    $limit = isset($limit) && $limit > 0 ? $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('trackbacks.php?page={PAGE_NUM}' . ($id > 0 ? '&amp;id=' . $id : ''));
    $sql = str_replace("COUNT(*)", '*', $sql);
    $sql .= " ORDER BY `date` LIMIT {$start},{$limit}";
    $result = $db->query($sql);
    $posts = array();
    // posts cache
    $trackbacks = array();
    // Get trackbacks data
    while ($row = $db->fetchArray($result)) {
        $trac = new MWTrackbackObject();
        $trac->assignVars($row);
        $posts[$trac->getVar('post')] = isset($posts[$trac->getVar('post')]) ? $posts[$trac->getVar('post')] : new MWPost($trac->getVar('post'));
        $trackbacks[] = array('tb' => $trac, 'post' => array('title' => $posts[$trac->getVar('post')]->getVar('title'), 'link' => $posts[$trac->getVar('post')]->isNew() ? '' : $posts[$trac->getVar('post')]->permalink()));
    }
    // Event
    $trackbacks = RMEvents::get()->run_event("mywords.trackbacks.list", $trackbacks);
    MWFunctions::include_required_files();
    RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
    RMTemplate::get()->add_script(XOOPS_URL . '/modules/mywords/include/js/scripts.php?file=trackbacks.js');
    RMBreadCrumb::get()->add_crumb(__('Trackbacks', 'mywords'));
    xoops_cp_header();
    include RMTemplate::get()->get_template('admin/mywords-trackbacks.php', 'module', 'mywords');
    xoops_cp_footer();
}
Example #7
0
/**
* @desc Permitirá al administrador elegir los temas que serán 
* eliminados despues de un cierto período
**/
function prune()
{
    global $xoopsModule;
    $bc = RMBreadCrumb::get();
    $bc->add_crumb(__('Prune forum', 'bxpress'));
    xoops_cp_header();
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $form = new RMForm(__('Prune Posts', 'bxpress'), 'frmprune', 'prune.php');
    //Lista de foros
    $ele = new RMFormSelect(__('Prune from forum', 'bxpress'), 'forums');
    $ele->addOption('', __('Select option...', 'bxpress'));
    $ele->addOption(0, __('All forums', 'bxpress'));
    $sql = "SELECT id_forum,name FROM " . $db->prefix('mod_bxpress_forums');
    $result = $db->queryF($sql);
    while ($row = $db->fetchArray($result)) {
        $ele->addOption($row['id_forum'], $row['name']);
    }
    $form->addElement($ele, true);
    //Dias de antigüedad de temas
    $days = new RMFormText(__('Days old', 'bxpress'), 'days', 3, 3, 30);
    $days->setDescription(__('Delete topics older than these days', 'bxpress'));
    $form->addElement($days, true);
    //Lista de opciones para purgar temas
    $opc = new RMFormSelect(__('Topics to delete', 'bxpress'), 'option');
    $opc->addOption('', __('Select option', 'bxpress'));
    $opc->addOption(1, __('All topics', 'bxpress'));
    $opc->addOption(2, __('Unanswered Topics', 'bxpress'));
    $form->addElement($opc, true);
    //Temas fijos
    $form->addElement(new RMFormYesno(__('Delete Sticky Topics', 'bxpress'), 'fixed'));
    $buttons = new RMFormButtonGroup();
    $buttons->addButton('sbt', __('Prune Now!'), 'submit', 'onclick="return confirm(\'' . __('Do you really wish to delete the topics? \\nThis action will delete the data permanently.', 'bxpress') . '\');"');
    $buttons->addButton('cancel', __('Cancel', 'bxpress'), 'button', 'onclick="history.go(-1);"');
    $form->addElement($buttons);
    $form->addElement(new RMFormHidden('action', 'deltopics'));
    $form->display();
    xoops_cp_footer();
}
Example #8
0
function showReports()
{
    global $xoopsModule, $xoopsConfig, $xoopsSecurity;
    //Indica la lista a mostrar
    $show = isset($_REQUEST['show']) ? intval($_REQUEST['show']) : '0';
    //$show = 0 Muestra todos los reportes
    //$show = 1 Muestra los reportes revisados
    //$show = 2 Muestra los reportes no revisados
    define('RMCSUBLOCATION', $show == 0 ? 'allreps' : ($show == 1 ? 'reviews' : 'noreviewd'));
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    //Lista de Todos los reportes
    $sql = "SELECT * FROM " . $db->prefix('mod_bxpress_report') . ($show ? $show == 1 ? " WHERE zapped=1" : " WHERE zapped=0 " : '') . " ORDER BY report_time DESC";
    $result = $db->queryF($sql);
    $reports = array();
    $tf = new RMTimeFormatter(0, '%T% %d%, %Y% %h%:%i%:%s%');
    while ($rows = $db->fetchArray($result)) {
        $report = new bXReport();
        $report->assignVars($rows);
        $user = new XoopsUser($report->user());
        $post = new bXPost($report->post());
        $topic = new bXTopic($post->topic());
        $forum = new bXForum($post->forum());
        if ($report->zappedBy() > 0) {
            $zuser = new XoopsUser($report->zappedBy());
        }
        $reports[] = array('id' => $report->id(), 'post' => array('link' => $post->permalink(), 'id' => $report->post()), 'user' => $user->uname(), 'uid' => $user->uid(), 'date' => $tf->format($report->time()), 'report' => $report->report(), 'forum' => array('link' => $forum->permalink(), 'name' => $forum->name()), 'topic' => array('link' => $topic->permalink(), 'title' => $topic->title()), 'zapped' => $report->zapped(), 'zappedby' => $report->zappedby() > 0 ? array('uid' => $zuser->uid(), 'name' => $zuser->uname()) : '', 'zappedtime' => $report->zappedtime() > 0 ? $tf->format($report->zappedtime()) : '');
    }
    RMTemplate::get()->add_local_script('jquery.checkboxes.js', 'rmcommon', 'include');
    RMTemplate::get()->add_local_script('admin.js', 'bxpress');
    RMTemplate::get()->set_help('http://www.redmexico.com.mx/docs/bxpress-forums/introduccion/standalone/1/');
    RMTemplate::get()->assign('xoops_pagetitle', __('Reports Management', 'bxpress'));
    $bc = RMBreadCrumb::get();
    $bc->add_crumb(__('Reports management', 'bxpress'));
    xoops_cp_header();
    include RMTemplate::get()->get_template('admin/forums-reports.php', 'module', 'bxpress');
    xoops_cp_footer();
}
Example #9
0
/**
* @desc Muestra la lista de foros existentes
*/
function bx_show_forums()
{
    global $xoopsModule, $xoopsSecurity;
    $catid = RMHttpRequest::request('catid', 'integer', 0);
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT * FROM " . $db->prefix("mod_bxpress_forums");
    if ($catid > 0) {
        $sql .= " WHERE cat='{$catid}'";
    }
    $sql .= " ORDER BY cat,`order`";
    $result = $db->query($sql);
    $categos = array();
    $forums = array();
    while ($row = $db->fetchArray($result)) {
        $forum = new bXForum();
        $forum->assignVars($row);
        // Cargamos la categoría
        if (isset($categos[$forum->category()])) {
            $catego = $categos[$forum->category()];
        } else {
            $categos[$forum->category()] = new bXCategory($forum->category());
            $catego = $categos[$forum->category()];
        }
        // Asignamos los valores
        $forums[] = array('id' => $forum->id(), 'title' => $forum->name(), 'topics' => $forum->topics(), 'posts' => $forum->posts(), 'catego' => $catego->title(), 'active' => $forum->active(), 'attach' => $forum->attachments(), 'order' => $forum->order());
    }
    $bc = RMBreadCrumb::get();
    $bc->add_crumb(__('Forums', 'bxpress'));
    xoops_cp_header();
    RMTemplate::get()->add_help(__('Forums Help', 'bxpress'), 'http://www.redmexico.com.mx/docs/bxpress-forums/foros/standalone/1/');
    RMTemplate::get()->add_script('admin.js', 'bxpress');
    RMTemplate::get()->add_head_script('var bx_select_message = "' . __('You must select one forum at least in order to run this action!', 'bxpress') . '";
        var bx_message = "' . __('Do you really want to delete selected forums?\\n\\nAll posts sent in this forum will be deleted also!', 'bxpress') . '";');
    include RMTemplate::get()->get_template('admin/forums-forums.php', 'module', 'bxpress');
    xoops_cp_footer();
}
Example #10
0
function edit_editor()
{
    global $xoopsModule, $xoopsSecurity;
    $id = rmc_server_var($_GET, 'id', 0);
    $page = rmc_server_var($_GET, 'page', 1);
    if ($id <= 0) {
        redirectMsg('editors.php?page=' . $page, __('Editor ID not provided!.', 'mywords'), 1);
        die;
    }
    $editor = new MWEditor($id);
    if ($editor->isNew()) {
        redirectMsg('editors.php?page=' . $page, __('Editor does not exists!', 'mywords'), 1);
        die;
    }
    include_once RMCPATH . '/class/form.class.php';
    MWFunctions::include_required_files();
    RMTemplate::get()->assign('xoops_pagetitle', __('Editing Editor', 'mywords'));
    RMBreadCrumb::get()->add_crumb(__('Editors Management', 'mywords'), 'editors.php');
    RMBreadCrumb::get()->add_crumb(__('Edit Editor', 'mywords'));
    xoops_cp_header();
    $show_edit = true;
    include RMTemplate::get()->get_template('admin/mywords-editors.php', 'module', 'mywords');
    xoops_cp_footer();
}
Example #11
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();
}
Example #12
0
/**
* @desc Muestra el contenido completo de una sección
*/
function showSection(RDResource &$res, RDSection &$section)
{
    global $xoopsUser, $xoopsModuleConfig, $xoopsOption, $xoopsTpl, $xoopsConfig, $standalone;
    include 'header.php';
    $xoopsTpl->assign('xoops_pagetitle', $section->getVar('title'));
    // Resource data
    $resource = array('id' => $res->id(), 'title' => $res->getVar('title'), 'link' => $res->permalink(), 'reads' => $res->getVar('reads'));
    $res->add_read($res);
    // Navegación de Secciones
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT * FROM " . $db->prefix("rd_sections") . " WHERE id_res='" . $res->id() . "' AND parent = '0' ORDER BY `order`";
    $result = $db->query($sql);
    $i = 1;
    $number = 1;
    $located = false;
    // Check if current position has been located
    while ($row = $db->fetchArray($result)) {
        $sec = new RDSection();
        $sec->assignVars($row);
        if ($sec->id() == $section->id()) {
            $number = $i;
            $located = true;
        }
        if ($sec->id() == $section->id() && isset($sprev)) {
            $prev_section = array('id' => $sprev->id(), 'title' => $sprev->getVar('title'), 'link' => $sprev->permalink());
        }
        if ($number == $i - 1 && $located) {
            $next_section = array('id' => $sec->id(), 'title' => $sec->getVar('title'), 'link' => $sec->permalink());
            break;
        }
        $i++;
        $sprev = $sec;
    }
    $GLOBALS['rd_section_number'] = $number;
    $sections = RDFunctions::get_section_tree($section->id(), $res, $number, true);
    array_walk($sections, 'rd_insert_edit');
    // Check last modification date
    $last_modification = 0;
    foreach ($sections as $sec) {
        if ($sec['modified'] > $last_modification) {
            $last_modification = $sec['modified'];
            $last_author = array('id' => $sec['author'], 'name' => $sec['author_name']);
        }
    }
    // Event
    $sections = RMEvents::get()->run_event('docs.show.section', $sections, $res, $section);
    RMTemplate::get()->add_style('docs.css', 'docs');
    RMTemplate::get()->add_jquery();
    RMTemplate::get()->add_script(XOOPS_URL . '/modules/docs/include/js/docs.js');
    // URLs
    if ($xoopsModuleConfig['permalinks']) {
        /**
         * @todo Generate friendly links
         */
        if (RMFunctions::plugin_installed('topdf')) {
            $pdf_book_url = RDFunctions::url() . '/pdfbook/' . $section->id() . '/';
            $pdf_section_url = RDFunctions::url() . '/pdfsection/' . $section->id() . '/';
        }
        $print_book_url = RDFunctions::url() . '/printbook/' . $section->id() . '/';
        $print_section_url = RDFunctions::url() . '/printsection/' . $section->id() . '/';
        if (RDFunctions::new_resource_allowed($xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS)) {
            $publish_url = RDFunctions::url() . '/publish/';
        }
    } else {
        if (RMFunctions::plugin_installed('topdf')) {
            $pdf_book_url = XOOPS_URL . '/modules/docs/index.php?page=content&amp;id=' . $section->id() . '&amp;action=pdfbook';
            $pdf_section_url = XOOPS_URL . '/modules/docs/index.php?page=content&amp;id=' . $section->id() . '&amp;action=pdfsection';
        }
        $print_book_url = XOOPS_URL . '/modules/docs/index.php?page=content&amp;id=' . $section->id() . '&amp;action=printbook';
        $print_section_url = XOOPS_URL . '/modules/docs/index.php?page=content&amp;id=' . $section->id() . '&amp;action=printsection';
        if (RDFunctions::new_resource_allowed($xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS)) {
            $publish_url = RDFunctions::url() . '/?action=publish';
        }
    }
    // Comments
    RMFunctions::get_comments('docs', 'res=' . $res->id() . '&id=' . $section->id(), 'module', 0);
    RMFunctions::comments_form('docs', 'res=' . $res->id() . '&id=' . $section->id(), 'module', RDPATH . '/class/mywordscontroller.php');
    RDFunctions::breadcrumb();
    RMBreadCrumb::get()->add_crumb($res->getVar('title'), $res->permalink());
    RMBreadCrumb::get()->add_crumb($section->getVar('title'), $section->permalink());
    include RMEvents::get()->run_event('docs.section.template', RMTemplate::get()->get_template('rd_section.php', 'module', 'docs'));
    if ($standalone) {
        RDFunctions::standalone();
    }
    include 'footer.php';
}
Example #13
0
function edit_form()
{
    global $xoopsModule, $xoopsSecurity;
    $id = rmc_server_var($_GET, 'id', 0);
    $page = rmc_server_var($_GET, 'page', 1);
    if ($id <= 0) {
        redirectMsg('tags.php?page=' . $page, __('Tag ID not provided!.', 'mywords'), 1);
        die;
    }
    $tag = new MWTag($id);
    if ($tag->isNew()) {
        redirectMsg('tags.php?page=' . $page, __('Tag does not exists!', 'mywords'), 1);
        die;
    }
    MWFunctions::include_required_files();
    RMBreadCrumb::get()->add_crumb(__('Tags management', 'mywords'), 'tags.php');
    RMBreadCrumb::get()->add_crumb(__('Edit tag', 'mywords'));
    RMTemplate::get()->assign('xoops_pagetitle', __('Editing Tag', 'mywords'));
    xoops_cp_header();
    $show_edit = true;
    include RMTemplate::get()->get_template('admin/mywords-tags.php', 'module', 'mywords');
    xoops_cp_footer();
}
Example #14
0
function show_rm_blocks()
{
    global $xoopsModule, $xoopsConfig, $wid_globals, $xoopsSecurity, $rmc_config, $rmTpl;
    define('RMCSUBLOCATION', 'blocks');
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $modules = RMModules::get_modules_list('active');
    $from = rmc_server_var($_GET, 'from', '');
    // ** 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 = RMModules::load_module($row['element']);
        if (!$mod) {
            continue;
        }
        $used_blocks[$row['canvas']][] = array('id' => $row['bid'], 'title' => $row['name'], 'module' => array('id' => $mod->mid(), 'dir' => $mod->dirname(), 'name' => $mod->name(), 'icon' => RMModules::icon($mod->dirname(), 16)), 'canvas' => isset($bpos[$row['canvas']]) ? $bpos[$row['canvas']] : array(), 'weight' => $row['weight'], 'visible' => $row['visible'], 'active' => $row['isactive'], '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'], 'tag' => $row['tag'], 'active' => $row['active']);
    }
    $positions = RMEvents::get()->run_event('rmcommon.block.positions.list', $positions);
    RMTemplate::get()->add_script('jquery.nestable.js', 'rmcommon', array('directory' => 'include'));
    RMBreadCrumb::get()->add_crumb(__('Blocks Management', 'rmcommon'));
    $rmTpl->assign('xoops_pagetitle', __('Blocks Management', 'rmcommon'));
    RMTemplate::get()->add_style('blocks.css', 'rmcommon');
    RMTemplate::get()->add_script('blocks.js', 'rmcommon');
    RMTemplate::get()->add_script('jkmenu.js', 'rmcommon');
    RMTemplate::get()->add_style('forms.css', 'rmcommon');
    RMTemplate::get()->add_script('jquery-ui.min.js', 'rmcommon', array('directory' => 'include'));
    if (!$rmc_config['blocks_enable']) {
        showMessage(__('Internal blocks manager is currenlty disabled!', 'rmcommon'), RMMSG_WARN);
    }
    RMTemplate::get()->add_script('jquery.checkboxes.js', 'rmcommon');
    //include RMCPATH . '/js/cu-js-language.php';
    xoops_cp_header();
    // Available Widgets
    $blocks = RMBlocksFunctions::get_available_list($modules);
    foreach ($blocks as $id => $block) {
        if (empty($block['blocks'])) {
            continue;
        }
        foreach ($block['blocks'] as $bid => $val) {
            $str = isset($val['show_func']) ? $val['show_func'] : '';
            $str .= isset($val['edit_func']) ? $val['edit_func'] : '';
            $str .= isset($val['dir']) ? $val['dir'] : $id;
            $val['id'] = md5($str);
            $blocks[$id]['blocks'][$bid] = $val;
        }
    }
    // Position
    $the_position = isset($_GET['pos']) ? intval($_GET['pos']) : '';
    // Parameters
    $mid = rmc_server_var($_GET, 'mid', 0);
    $subpage = isset($_GET['subpage']) ? $_GET['subpage'] : '';
    $group = isset($_GET['group']) ? intval($_GET['group']) : 0;
    $visible = rmc_server_var($_GET, 'visible', -1);
    $pid = rmc_server_var($_GET, 'pos', 0);
    include RMTemplate::get()->get_template("rmc-blocks.php", 'module', 'rmcommon');
    xoops_cp_footer();
}
function smarty_function_breadcrumb($options, $tpl)
{
    $bc = RMBreadCrumb::get();
    return $bc->render();
}
Example #16
0
/**
* @desc Formulario para crear nueva sección
**/
function formSection($edit = 0)
{
    global $xoopsConfig, $xoopsUser, $xoopsModuleConfig, $id, $res;
    $res = rmc_server_var($_GET, 'id', $res);
    //Verifica si se proporcionó una publicación para la sección
    if ($res <= 0) {
        RDFunctions::error_404();
    }
    $res = new RDResource($res);
    if ($res->isNew()) {
        RDFunctions::error_404();
    }
    //Verificamos si es una publicación aprobada
    if (!$res->getVar('approved')) {
        redirect_header(RDURL, 2, __('Specified section does not exists!', 'docs'));
        die;
    }
    //Verificamos si el usuario tiene permisos de edicion
    if (!$xoopsUser->uid() == $res->getVar('owner') && !$res->isEditor($xoopsUser->uid()) && !$xoopsUser->isAdmin()) {
        redirect_header($section->permalink(), 1, __('Operation not allowed!', 'docs'));
        die;
    }
    if ($edit) {
        $id = rmc_server_var($_GET, 'id', $id);
        //Verifica si la sección es válida
        if ($id == '') {
            RDfunctions::error_404();
        }
        //Comprueba si la sección es existente
        $section = new RDSection($id);
        if ($section->isNew()) {
            RDFunctions::error_404();
        }
    }
    include 'header.php';
    include_once RMCPATH . '/class/form.class.php';
    define('RD_NO_FIGURES', 1);
    $rmc_config = RMFunctions::configs();
    $editor = new RMFormEditor('', 'content', '100%', '300px', $edit ? $section->getVar('content', $rmc_config['editor_type'] == 'tiny' ? 's' : 'e') : '', '', false);
    if ($rmc_config['editor_type'] == 'tiny') {
        $tiny = TinyEditor::getInstance();
        $tiny->configuration['content_css'] .= ',' . XOOPS_URL . '/modules/docs/css/figures.css';
        $tiny->add_config('theme_advanced_buttons1', 'rd_refs');
        $tiny->add_config('theme_advanced_buttons1', 'rd_figures');
        $tiny->add_config('theme_advanced_buttons1', 'rd_toc');
    }
    // Arbol de Secciones
    $sections = array();
    RDFunctions::sections_tree_index(0, 0, $res, '', '', false, $sections, false);
    // Breadcrumb
    RDFunctions::breadcrumb();
    $res_edit = RDFunctions::url() . ($xoopsModuleConfig['permalinks'] ? '/list/' . $res->id() . '/' : '?action=list&id=' . $res->id());
    RMBreadCrumb::get()->add_crumb($res->getVar('title'), $res_edit);
    if ($edit) {
        RMBreadCrumb::get()->add_crumb(sprintf(__('Editing "%s"', 'docs'), $section->getVar('title')));
    } else {
        RMBreadCrumb::get()->add_crumb(__('Create new section', 'docs'));
    }
    RMTemplate::get()->add_jquery(true);
    RMTemplate::get()->add_style('forms.css', 'docs');
    RMTemplate::get()->add_script(XOOPS_URL . '/modules/docs/include/js/scripts.php?file=metas.js');
    include RMEvents::get()->run_event('docs.template.formsections.front', RMTemplate::get()->get_template('rd_sec.php', 'module', 'docs'));
    include 'footer.php';
}
Example #17
0
/**
 * Presenta un formulario para la creación de una nueva
 * categoría para los artículos
 */
function newForm()
{
    global $xoopsModule;
    $id = isset($_GET['id']) ? $_GET['id'] : 0;
    if ($id <= 0) {
        redirectMsg('categories.php', __('You must specify a valid category', 'mywords'), 1);
        die;
    }
    // Cargamos la categoría
    $catego = new MWCategory($id);
    // Si no existe entonces devolvemos un error
    if ($catego->isNew()) {
        redirectMsg('cats.php', __('Specified category not exists!', 'mywords'), 1);
        die;
    }
    MWFunctions::include_required_files();
    RMBreadCrumb::get()->add_crumb(__('Categories', 'mywords'), 'categories.php');
    RMBreadCrumb::get()->add_crumb(__('Edit category', 'mywords'));
    xoops_cp_header();
    $cats = array();
    MWFunctions::categos_list($cats, 0, 0, true, $id);
    $form = new RMForm($edit ? __('Edit Category', 'mywords') : __('Edit Category', 'mywords'), 'frmNew', 'categories.php');
    $form->addElement(new RMFormText(__('Category name', 'mywords'), 'name', 50, 150, $catego->getVar('name')), true);
    $form->addElement(new RMFormText(__('Category slug', 'mywords'), 'shortname', '', '150', $catego->getVar('shortname', 'n')));
    $form->addElement(new RMFormTextArea(__('Category description', 'mywords'), 'desc', 5, 45, $catego->getVar('description', 'e')));
    $ele = new RMFormSelect(__('Category Parent', 'mywords'), 'parent');
    $ele->addOption(0, _SELECT, $catego->getVar('parent') == 0 ? 1 : 0);
    foreach ($cats as $k) {
        $ele->addOption($k['id_cat'], str_repeat("-", $k['indent']) . ' ' . $k['name'], $catego->getVar('parent') == $k['id_cat'] ? 1 : 0);
    }
    $form->addElement($ele);
    $form->addElement(new RMFormHidden('op', 'saveedit'));
    $form->addElement(new RMFormHidden('id', $id));
    $ele = new RMFormButtonGroup('', ' ');
    $ele->addButton('sbt', __('Update Category', 'mywords'), 'submit');
    $ele->addButton('cancel', __('Cancel', 'mywords'), 'button');
    $ele->setExtra('cancel', "onclick='history.go(-1);'");
    $form->addElement($ele);
    $form->display();
    xoops_cp_footer();
}
Example #18
0
function module_update_now()
{
    global $xoopsSecurity, $xoopsConfig, $rmTpl;
    $mod = rmc_server_var($_POST, 'module', '');
    if (!$xoopsSecurity->check()) {
        redirectMsg('modules.php', __('Sorry, this operation could not be completed!', 'rmcommon'), 1);
        die;
    }
    $module_handler = xoops_gethandler('module');
    $module = $module_handler->getByDirname($mod);
    if (!$module) {
        redirectMsg('modules.php', sprintf(__('Module %s is not installed yet!', 'rmcommon'), $mod), 1);
        die;
    }
    // Include system language file
    $file = XOOPS_ROOT_PATH . '/modules/system/language/' . $xoopsConfig['language'] . '/admin.php';
    if (file_exists($file)) {
        include_once $file;
    } else {
        include_once str_replace($xoopsConfig['language'], 'english', $file);
    }
    // Include system language file
    $file = XOOPS_ROOT_PATH . '/modules/system/language/' . $xoopsConfig['language'] . '/admin/modulesadmin.php';
    if (file_exists($file)) {
        include_once $file;
    } else {
        include_once str_replace($xoopsConfig['language'], 'english', $file);
    }
    include_once XOOPS_ROOT_PATH . '/modules/system/admin/modulesadmin/modulesadmin.php';
    RMEvents::get()->run_event('rmcommon.updating.module', $module);
    $module_log = xoops_module_update($mod);
    $module_log = RMEvents::get()->run_event('rmcommon.module.updated', $module_log, $module_log);
    //RMFunctions::create_toolbar();
    RMTemplate::get()->add_style('modules.min.css', 'rmcommon');
    xoops_cp_header();
    $log_title = sprintf(__('Update log for %s', 'rmcommon'), $module ? $module->getInfo('name') : $mod);
    RMBreadCrumb::get()->add_crumb(__('Modules Management', 'rmcommon'), 'modules.php');
    RMBreadCrumb::get()->add_crumb($log_title);
    $rmTpl->assign('xoops_pagetitle', $log_title);
    $action = rmc_server_var($_POST, 'action', '');
    include RMTemplate::get()->get_template('rmc-modules-log.php', 'module', 'rmcommon');
    xoops_cp_footer();
}
Example #19
0
$sql .= " ORDER BY created DESC LIMIT {$start},{$limit}";
$result = $db->query($sql);
// Numero de resultados en esta página
$t = $db->getRowsNum($result);
$tpl->assign('page_total', $t);
$tpl->assign('per_col', ceil($t / 2));
$categos = array();
$clients = array();
while ($row = $db->fetchArray($result)) {
    $work = new PWWork();
    $work->assignVars($row);
    if (!isset($categos[$work->category()])) {
        $categos[$work->category()] = new PWCategory($work->category());
    }
    if (!isset($clients[$work->client()])) {
        $clients[$work->client()] = new PWClient($work->client());
    }
    $tpl->append('works', array('id' => $work->id(), 'title' => $work->title(), 'desc' => $work->descShort(), 'catego' => $categos[$work->category()]->name(), 'client' => $clients[$work->client()]->name(), 'link' => $work->link(), 'time' => $work->created(), 'modified_time' => $work->getVar('modified'), 'modified' => formatTimeStamp($work->getVar('modified'), 's'), 'created' => formatTimeStamp($work->created(), 's'), 'image' => XOOPS_UPLOAD_URL . '/works/ths/' . $work->image(), 'rating' => PWFunctions::rating($work->rating()), 'featured' => $work->mark(), 'linkcat' => $categos[$work->category()]->link(), 'metas' => $work->get_metas()));
}
$tpl->assign('lang_works', sprintf(__('Works in "%s"', 'works'), $cat->name()));
$tpl->assign('xoops_pagetitle', sprintf(__('Works in "%s"', 'works'), $cat->name()) . " &raquo; " . $mc['title']);
$tpl->assign('lang_catego', __('Category:', 'works'));
$tpl->assign('lang_date', __('Date:', 'works'));
$tpl->assign('lang_client', __('Customer:', 'works'));
$tpl->assign('lang_rating', __('Our rate:', 'works'));
$thSize = $mc['image_ths'];
$tpl->assign('width', $thSize[0] + 20);
$tpl->assign('lang_featured', __('Featured', 'works'));
RMBreadCrumb::get()->add_crumb(__('Portfolio', 'works'), PW_URL);
RMBreadCrumb::get()->add_crumb($cat->getVar('name'), PW_URL);
include 'footer.php';
Example #20
0
<div id="he-content">
    <div class="container-fluid">
        <?php 
include 'toolbar.php';
?>

        <?php 
echo RMBreadCrumb::get()->render();
?>

        <?php 
if (!empty($right_widgets)) {
    ?>
            <div class="row">
                <div class="col-md-8 col-lg-9">
                    <?php 
    echo $content;
    ?>
                </div>
                <div class="col-md-4 col-lg-3">
                    <?php 
    foreach ($right_widgets as $widget) {
        ?>
                        <div class="cu-box box-primary">
                            <?php 
        if ('' != $widget['title']) {
            ?>
                                <div class="box-header">
                                    <span class="box-handler"><span class="fa fa-caret-down"></span></span>
                                    <h4 class="box-title"><?php 
            echo $widget['title'];
Example #21
0
    $ds = date("d-M-Y", $row['post_time']);
    if (!isset($posts[$row['id_forum']])) {
        $forums[$row['id_forum']] = new bXForum($row['id_forum']);
    }
    if (!isset($posts[$row['id_forum']][$ds])) {
        $posts[$row['id_forum']][$ds] = 1;
    } else {
        $posts[$row['id_forum']][$ds]++;
    }
}
// Days
$days_rows = array();
$j = 0;
$max = 0;
for ($i = 30; $i >= 0; $i--) {
    $j++;
    $ds = date("d-M-Y", strtotime("-" . $i . " days"));
    $days_rows[$i] = '["' . $ds . '"';
    foreach ($forums as $id => $f) {
        $max = isset($posts[$id][$ds]) ? $posts[$id][$ds] > $max ? $posts[$id][$ds] : $max : $max;
        $days_rows[$i] .= "," . (isset($posts[$id][$ds]) ? $posts[$id][$ds] : '0');
    }
    $days_rows[$i] .= "]\n";
}
unset($d, $posts);
$max += 10 - $max % 10;
$bc = RMBreadCrumb::get();
$bc->add_crumb(__('Forum Dashboard', 'bxpress'));
xoops_cp_header();
include RMTemplate::get()->get_template("admin/forums-index.php", 'module', 'bxpress');
xoops_cp_footer();
Example #22
0
if (!$res->getVar('approved')) {
    redirect_header(RDURL, 1, __('Sorry, this Document does not exists!', 'docs'));
    die;
}
//Verifica si el usuario cuenta con permisos para ver la publicación
$allowed = $res->isAllowed($xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS);
if (!$allowed && !$res->getVar('show_index')) {
    redirect_header(RDURL, 2, __('Sorry, you are not authorized to view this Document', 'docs'));
    die;
}
if (!$allowed && !$res->getVar('quick')) {
    redirect_header(RDURL, 2, __('Sorry, you are not authorized to view this Document', 'docs'));
    die;
}
RDFunctions::breadcrumb();
RMBreadCrumb::get()->add_crumb($res->getVar('title'), $res->permalink());
// Check if we must show all content for Document
if ($res->getVar('single')) {
    if (!$allowed) {
        RDfunctions::error_404();
    }
    // Show all content
    $toc = array();
    RDFunctions::sections_tree_index(0, 0, $res, '', '', false, $toc, true);
    array_walk($toc, 'rd_insert_edit');
    $last_modification = 0;
    foreach ($toc as $sec) {
        if ($sec['modified'] > $last_modification) {
            $last_modification = $sec['modified'];
            $last_author = array('id' => $sec['author'], 'name' => $sec['author_name']);
        }
Example #23
0
/**
* Function to edit images
*/
function edit_image()
{
    global $xoopsUser, $xoopsSecurity, $rmTpl, $rmEvents;
    $id = rmc_server_var($_GET, 'id', 0);
    $page = rmc_server_var($_GET, 'page', '');
    if ($id <= 0) {
        redirectMsg('images.php', __('Invalid image ID', 'rmcommon'), 1);
        die;
    }
    $image = new RMImage($id);
    if ($image->isNew()) {
        redirectMsg('images.php', __('Image not found!', 'rmcommon'), 1);
        die;
    }
    $cat = new RMImageCategory($image->getVar('cat'));
    $sizes = $cat->getVar('sizes');
    $current_size = array();
    $fd = pathinfo($image->getVar('file'));
    $updir = '/' . date('Y', $image->getVar('date')) . '/' . date('m', $image->getVar('date'));
    foreach ($sizes as $size) {
        if ($size['width'] <= 0) {
            continue;
        }
        if (empty($current_size)) {
            $current_size = $size;
        } else {
            if ($current_size['width'] >= $size['width'] && $size['width'] > 0) {
                $current_size = $size;
            }
        }
        if (!file_exists(XOOPS_UPLOAD_PATH . $updir . '/sizes/' . $fd['filename'] . '-' . $size['name'] . '.' . $fd['extension'])) {
            continue;
        }
        $image_data['sizes'][] = array('file' => XOOPS_UPLOAD_URL . $updir . '/sizes/' . $fd['filename'] . '-' . $size['name'] . '.' . $fd['extension'], 'name' => $size['name']);
    }
    $image_data['thumbnail'] = XOOPS_UPLOAD_URL . $updir . '/sizes/' . $fd['filename'] . '-' . $current_size['name'] . '.' . $fd['extension'];
    $mimes = (include XOOPS_ROOT_PATH . '/include/mimetypes.inc.php');
    $image_data['mime'] = isset($mimes[$fd['extension']]) ? $mimes[$fd['extension']] : 'application/octet-stream';
    $image_data['file'] = $image->getVar('file');
    $image_data['date'] = $image->getVar('date');
    $image_data['title'] = $image->getVar('title');
    $image_data['desc'] = $image->getVar('desc', 'e');
    $image_data['url'] = XOOPS_UPLOAD_URL . $updir . '/' . $image->getVar('file');
    $categories = RMFunctions::load_images_categories("WHERE status='open' ORDER BY id_cat DESC");
    RMFunctions::create_toolbar();
    RMBreadCrumb::get()->add_crumb(__('Images Manager', 'rmcommon'), 'images.php');
    RMBreadCrumb::get()->add_crumb(__('Edit Image', 'rmcommon'));
    $rmTpl->assign('xoops_pagetitle', __('Edit Image', 'rmcommon'));
    xoops_cp_header();
    RMTemplate::get()->add_script('images.js', 'rmcommon');
    RMTemplate::get()->add_script('include/js/jquery.validate.min.js');
    RMTemplate::get()->add_style('imgmgr.css', 'rmcommon');
    include RMTemplate::get()->get_template('rmc-images-edit.php', 'module', 'rmcommon');
    xoops_cp_footer();
}
Example #24
0
function edit_comment()
{
    global $rmTpl;
    $id = rmc_server_var($_GET, 'id', 0);
    $page = rmc_server_var($_GET, 'page', 1);
    $filter = rmc_server_var($_GET, 'filter', '');
    $w = rmc_server_var($_GET, 'w', '1');
    $qs = "w={$w}&page={$page}&filter={$filter}";
    if ($id <= 0) {
        redirectMsg('comments.php?' . $qs, __('Sorry, comment id is not valid', 'rmcommon'), 1);
        die;
    }
    $comment = new RMComment($id);
    if ($comment->isNew()) {
        redirectMsg('comments.php?' . $qs, __('Sorry, comment does not found', 'rmcommon'), 1);
        die;
    }
    $cpath = XOOPS_ROOT_PATH . '/modules/' . $comment->getVar('id_obj') . '/class/' . $comment->getVar('id_obj') . 'controller.php';
    if (is_file($cpath)) {
        include $cpath;
        $class = ucfirst($comment->getVar('id_obj')) . 'Controller';
        $controller = new $class();
    }
    $form = new RMForm(__('Edit Comment', 'rmcommon'), 'editComment', 'comments.php');
    $form->addElement(new RMFormLabel(__('In reply to', 'rmcommon'), $controller ? $controller->get_item($comment->getVar('params'), $comment) : ''));
    $form->addElement(new RMFormLabel(__('Posted date', 'rmcommon'), formatTimestamp($comment->getVar('posted'), 'mysql')));
    $form->addElement(new RMFormLabel(__('Module', 'rmcommon'), $comment->getVar('id_obj')));
    $form->addElement(new RMFormLabel(__('IP', 'rmcommon'), $comment->getVar('ip')));
    $user = new RMCommentUser($comment->getVar('user'));
    $ele = new RMFormUser(__('Poster', 'rmcommon'), 'user', false, $user->getVar('xuid') > 0 ? $user->getVar('xuid') : 0);
    $form->addElement($ele);
    $ele = new RMFormRadio(__('Status', 'rmcommon'), 'status', 1, 0, 2);
    $ele->addOption(__('Approved', 'rmcommon'), 'approved', $comment->getVar('status') == 'approved' ? 1 : 0);
    $ele->addOption(__('Unapproved', 'rmcommon'), 'waiting', $comment->getVar('status') == 'waiting' ? 1 : 0);
    $form->addElement($ele);
    $form->addElement(new RMFormTextArea(__('Content', 'rmcommon'), 'content', null, null, $comment->getVar('content', 'e'), '100%', '150px'), true);
    $form->addElement(new RMFormHidden('page', $page));
    $form->addElement(new RMFormHidden('filter', $filter));
    $form->addElement(new RMFormHidden('w', $w));
    $form->addElement(new RMFormHidden('id', $id));
    $form->addElement(new RMFormHidden('action', 'save'));
    $ele = new RMFormButtonGroup();
    $ele->addButton('sbt', __('Update Comment', 'rmcommon'), 'submit');
    $ele->addButton('cancel', __('Cancel', 'rmcommon'), 'button', 'onclick="history.go(-1);"');
    $form->addElement($ele);
    //RMFunctions::create_toolbar();
    RMBreadCrumb::get()->add_crumb(__('Comments Manager', 'rmcommon'), 'comments.php');
    RMBreadCrumb::get()->add_crumb(__('Edit Comment', 'rmcommon'));
    $rmTpl->assign('xoops_pagetitle', __('Edit Comment', 'rmcommon'));
    xoops_cp_header();
    $form->display();
    xoops_cp_footer();
}
Example #25
0
 /**
  * Creates the BreadCrumb bar with basic options
  */
 public function breadcrumb()
 {
     global $xoopsModule;
     // Breadcrumb
     $bc = RMBreadCrumb::get();
     $bc->add_crumb(__('Home Page', 'docs'), XOOPS_URL);
     $bc->add_crumb($xoopsModule->name(), RDFunctions::url());
 }
Example #26
0
    $editors[] = array('id' => $editor->id(), 'name' => $editor->getVar('name'), 'link' => $editor->permalink(), 'total' => $row['counter']);
}
unset($editor, $result, $sql);
// URL rewriting
$rule = "RewriteRule ^" . trim($xoopsModuleConfig['basepath'], '/') . "/?(.*)\$ modules/mywords/index.php [L]";
if ($xoopsModuleConfig['permalinks'] > 1) {
    $ht = new RMHtaccess('mywords');
    $htResult = $ht->write($rule);
    if ($htResult !== true) {
        showMessage(__('An error ocurred while trying to write .htaccess file!', 'mywords'), RMMSG_ERROR);
    }
} else {
    $ht = new RMHtaccess('mywords');
    $ht->removeRule();
    $ht->write();
}
RMBreadCrumb::get()->add_crumb(__('Dashboard', 'mywords'));
include 'menu.php';
MWFunctions::include_required_files();
RMTemplate::get()->add_script('../include/js/scripts.php?file=dashboard.js');
RMTemplate::get()->add_help(__('MyWords Documentation', 'mywords'), 'http://www.xoopsmexico.net/docs/mywords/introduccion/');
// Other panels for dashboard
$dashboardPanels = [];
$dashboardPanels = RMEvents::get()->trigger('mywords.dashboard.panels', $dashboardPanels);
xoops_cp_header();
// Show Templates
RMTemplate::get()->add_body_class('dashboard');
//$tpl->header();
include RMtemplate::get()->get_template('admin/mywords-theindex.php', 'module', 'mywords');
//$tpl->footer();
xoops_cp_footer();
Example #27
0
}
// JS Language
include RMCPATH . '/js/cu-js-language.php';
!defined('RMCLOCATION') ? define('RMCLOCATION', '') : true;
!defined('RMCSUBLOCATION') ? define('RMCSUBLOCATION', '') : true;
// Scripts
$heliumScripts = \RMTemplate::get()->get_scripts(true);
$heliumStyles = \RMTemplate::get()->get_styles(true);
// User Rank
$userRank = $xoopsUser->rank();
// Help
$helpLinks = RMTemplate::getInstance()->help();
// Body classess
if (!array_key_exists('sidebar', $_COOKIE) || $_COOKIE['sidebar'] == 'visible') {
    RMTemplate::getInstance()->add_body_class('sidebar');
}
if (RMBreadCrumb::get()->count() > 0) {
    RMTemplate::getInstance()->add_body_class('with-breadcrumb');
}
// The logo
$logoHelium = trim($cuSettings->helium_logo);
if ('' == $logoHelium) {
    $logoHelium = HELIUM_URL . '/images/logo-he.svg';
}
if (substr($logoHelium, -4) == '.svg') {
    $logoHelium = file_get_contents($logoHelium);
} else {
    $logoHelium = '<img src="' . $logoHelium . '">';
}
// Display theme
include_once HELIUM_PATH . '/theme.php';
Example #28
0
/**
* This function shows a form to send email to single or multiple users
*/
function show_mailer()
{
    global $xoopsConfig, $rmc_config, $rmTpl;
    $uid = rmc_server_var($_GET, 'uid', array());
    $query = rmc_server_var($_GET, 'query', '');
    if (!is_array($uid) && $uid <= 0 || empty($uid)) {
        // In admin control panel (side) add_message always must to be called before
        // ExmGUI::show_header()
        RMTemplate::get()->add_message(__('You must select one user at least. Please click on "Add Users" and select as many users as you wish.'), 0);
    }
    $uid = !is_array($uid) ? array($uid) : $uid;
    RMBreadCrumb::get()->add_crumb(__('Users Management', 'rmcommon'), 'users.php');
    RMBreadCrumb::get()->add_crumb(__('Send E-Mail', 'rmcommon'));
    $rmTpl->assign('xoops_pagetitle', __('Sending email to users', 'rmcommon'));
    xoops_cp_header();
    $form = new RMForm(__('Send Email to Users', 'rmcommon'), 'frm_mailer', 'users.php');
    $form->addElement(new RMFormUser(__('Users', 'global'), 'mailer_users', 1, $uid, 30, 600, 400));
    $form->element('mailer_users')->setDescription(__('Please note that the maximun users number that you can select depends of the limit of emails that you can send accourding to your email server policies (or hosting account policies).', 'rmcommon'));
    $form->addElement(new RMFormText(__('Message subject', 'rmcommon'), 'subject', 50, 255), true);
    $form->element('subject')->setDescription(__('Subject must be descriptive.', 'rmcommon'));
    $form->addElement(new RMFormRadio(__('Message type', 'rmcommon'), 'type', ' ', 1, 2));
    $form->element('type')->addOption(__('HTML', 'global'), 'html', 1, $rmc_config['editor_type'] == 'tiny' ? 'onclick="switchEditors.go(\'message\', \'tinymce\');"' : '');
    $form->element('type')->addOption(__('Plain Text', 'global'), 'text', 0, $rmc_config['editor_type'] == 'tiny' ? 'onclick="switchEditors.go(\'message\', \'html\');"' : '');
    $form->addElement(new RMFormEditor(__('Message content', 'rmcommon'), 'message', '99%', '300px', ''), true);
    $ele = new RMFormButtonGroup();
    $ele->addButton('sbt', __('Send E-Mail', 'rmcommon'), 'submit');
    $ele->addButton('cancel', __('Cancel', 'rmcommon'), 'button', 'onclick="history.go(-1);"');
    $form->addElement($ele);
    $form->addElement(new RMFormHidden('action', 'sendmail'));
    $form->addElement(new RMFormHidden('query', $query));
    $form->display();
    xoops_cp_footer();
}
Example #29
0
/**
 * Muestra el formulario para la creación de un nuevo artículo
 */
function newForm($edit = 0)
{
    global $db, $xoopsModule, $myts, $util, $xoopsConfig, $tpl, $xoopsSecurity, $cuSettings;
    define('RMCSUBLOCATION', 'new_post');
    if ($edit) {
        $id = rmc_server_var($_GET, 'id', 0);
        if ($id <= 0) {
            redirectMsg('posts.php', __('Please, specify a valid post ID', 'mywords'), 1);
            die;
        }
        $post = new MWPost($id);
        if ($post->isNew()) {
            redirectMsg('posts.php', __('Specified post does not exists!', 'mywords'), 1);
            die;
        }
    }
    // Context help
    $tpl->add_help(__('Publish articles', 'mywords'), 'http://www.xoopsmexico.net/docs/mywords/publicar-entradas/');
    MWFunctions::include_required_files(false);
    RMBreadCrumb::get()->add_crumb(__('Posts', 'mywords'), 'posts.php');
    RMBreadCrumb::get()->add_crumb(__('Write post', 'mywords'));
    RMTemplate::get()->assign('xoops_pagetitle', __('Write post', 'mywords'));
    $head = '<script type="text/javascript" src="' . MW_URL . '/include/forms_post.js"></script>';
    xoops_cp_header($head);
    include RMCPATH . '/class/form.class.php';
    /*include RMCPATH.'/class/fields/formelement.class.php';
      include RMCPATH.'/class/fields/editor.class.php';*/
    TinyEditor::getInstance()->add_config('elements', 'content_editor');
    //TinyEditor::getInstance()->add_config('theme_advanced_buttons1', 'bold,italic,strikethrough,|,bullist,numlist,blockquote,|,justifyleft,justifycenter,justifyright,|,link,unlink,|,spellchecker,fullscreen,|,exm_more,exm_adv', true);
    //TinyEditor::getInstance()->add_config('theme_advanced_buttons2','formatselect,underline,justifyfull,forecolor,|,pastetext,pasteword,removeformat,|,media,charmap,|,outdent,indent,|,undo,redo,|,exm_img,exm_icons,exm_page', true);
    //echo $post->getVar('content'); die();
    $editor = new RMFormEditor('', 'content', '100%', '350px', $edit ? $post->getVar('content', $cuSettings->editor_type == 'tiny' ? 's' : 'e') : '');
    // Get current metas
    $meta_names = MWFunctions::get()->get_metas();
    //RMTemplate::get()->add_script(RMCURL.'/include/js/jquery.validate.min.js');
    //RMTemplate::get()->add_script(RMCURL.'/include/js/forms.js');
    //RMTemplate::get()->add_head('<script type="text/javascript">$("form#mw-form-posts").validate();</script>');
    include '../templates/admin/mywords-formposts.php';
    xoops_cp_footer();
}
Example #30
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'));
    }
}