Пример #1
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 = rmc_server_var($_GET, 'id', 0);
        if ($id <= 0) {
            redirectMsg('categos.php', __('You had not provided a category ID', 'bxpress'), 1);
            die;
        }
        $catego = new bXCategory($id);
        if ($catego->isNew()) {
            redirectMsg('categos.php', __('Specified category does not exists!', 'bxpress'), 1);
            die;
        }
    }
    bXFunctions::menu_bar();
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . ($edit ? __('Edit Category', 'bxpress') : __('New Category', 'bxpress')));
    xoops_cp_header();
    $form = new RMForm($edit ? __('Edit Category', 'bxpress') : __('New Category', 'bxpress'), 'frmCat', 'categos.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=\'categos.php\';"');
    $form->addElement($buttons);
    $form->display();
    xoops_cp_footer();
}
Пример #2
0
/**
* @desc Permitirá al administrador elegir los temas que serán 
* eliminados despues de un cierto período
**/
function prune()
{
    global $xoopsModule;
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . __('Prune Posts', 'bxpress'));
    xoops_cp_header();
    bXFunctions::menu_bar();
    $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('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();
}
Пример #3
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('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/');
    bXFunctions::menu_bar();
    RMTemplate::get()->assign('xoops_pagetitle', __('Reports Management', 'bxpress'));
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . __('Reports Management', 'bxpress'));
    xoops_cp_header();
    include RMTemplate::get()->get_template('admin/forums_reports.php', 'module', 'bxpress');
    xoops_cp_footer();
}
Пример #4
0
/**
* @desc Visualiza lista de usuarios para determinar moderadores
**/
function bx_moderators()
{
    global $xoopsModule;
    $id = rmc_server_var($_REQUEST, 'id', 0);
    if ($id <= 0) {
        redirectMsg('forums.php', __('No forum ID has been provided!', 'bxpress'), 1);
        break;
    }
    $forum = new bXForum($id);
    if ($forum->isNew()) {
        redirectMsg('forums.php', __('Specified forum does not exists!', 'bxpress'), 1);
        break;
    }
    RMTemplate::get()->set_help('http://www.redmexico.com.mx/docs/bxpress-forums/foros/standalone/1/#moderadores');
    bXFunctions::menu_bar();
    xoops_cp_header();
    //Lista de usuarios
    $form = new RMForm(sprintf(__('Forum "%s" Moderators', 'bxpress'), $forum->name()), 'formmdt', 'forums.php');
    $form->addElement(new RMFormUser(__('Moderators', 'bxpress'), 'users', 1, $forum->moderators(), 30), true, 'checked');
    $form->element('users')->setDescription(__('Choose from the list the moderators users', 'bxpress'));
    $buttons = new RMFormButtonGroup();
    $buttons->addButton('sbt', __('Save Moderators', 'bxpress'), 'submit');
    $buttons->addButton('cancel', __('Cancel', 'bxpress'), 'button', 'onclick="window.location.href=\'forums.php\';"');
    $form->addElement($buttons);
    $form->addElement(new RMFormHidden('action', 'savemoderat'));
    $form->addElement(new RMFormHidden('id', $id));
    $form->display();
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . __('forum Moderators', 'bxpress'));
    xoops_cp_footer();
}
Пример #5
0
/**
* @desc Presenta el formulario para creación o edición de un anuncio
*/
function showForm($edit = 0)
{
    global $tpl, $xoopsModule, $db;
    if ($edit) {
        $id = rmc_server_var($_GET, 'id', 0);
        if ($id <= 0) {
            redirectMsg('announcements.php', __('Provided ID is not valid!', 'bxpress'), 1);
            die;
        }
        $an = new bXAnnouncement($id);
        if ($an->isNew()) {
            redirectMsg('announcements.php', __('Specified announcement does not exists!', 'bxpress'), 1);
            die;
        }
    }
    RMTemplate::get()->set_help('http://www.redmexico.com.mx/docs/bxpress-forums/anuncios/standalone/1/#crear-un-anuncio');
    bXFunctions::menu_bar();
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . ($edit ? __('Edit Announcement', 'bxpress') : __('New Announcement', 'bxpress')));
    xoops_cp_header();
    $form = new RMForm($edit ? __('Edit Announcement', 'bxpress') : __('New Announcement', 'bxpress'), 'frmAnnouncements', 'announcements.php');
    $form->oddClass('oddForm');
    $form->addElement(new RMFormEditor(__('Text', 'bxpress'), 'text', '100%', '300px', $edit ? $an->text('e') : ''), true);
    // Caducidad
    $ele = new RMFormDate(__('Expire on', 'bxpress'), 'expire', $edit ? $an->expire() : time());
    $form->addElement($ele);
    // Mostran en
    $ele = new RMFormRadio(__('Show on', 'bxpress'), 'where', 1, 0);
    $ele->addOption(__('Module home page', 'bxpress'), 0, $edit ? $an->where() == 0 : 1);
    $ele->addOption(__('Forum', 'bxpress'), 1, $edit ? $an->where() == 1 : 0);
    $ele->addOption(__('All module', 'bxpress'), 2, $edit ? $an->where() == 2 : 0);
    $form->addElement($ele);
    // Foros
    $ele = new RMFormSelect(__('Forum', 'bxpress'), 'forum', 0, $edit ? array($an->forum()) : array());
    $ele->setDescription(__('Please select the forum where this announcement will be shown. This option only is valid when "In Forum" has been selected.', 'bxpress'));
    $tbl1 = $db->prefix("bxpress_categories");
    $tbl2 = $db->prefix("bxpress_forums");
    $sql = "SELECT b.*, a.title FROM {$tbl1} a, {$tbl2} b WHERE b.cat=a.id_cat AND b.active='1' ORDER BY a.order, b.order";
    $result = $db->query($sql);
    $categories = array();
    while ($row = $db->fetchArray($result)) {
        $cforum = array('id' => $row['id_forum'], 'name' => $row['name']);
        if (isset($categores[$row['cat']])) {
            $categories[$row['cat']]['forums'][] = $cforum;
        } else {
            $categories[$row['cat']]['title'] = $row['title'];
            $categories[$row['cat']]['forums'][] = $cforum;
        }
    }
    foreach ($categories as $cat) {
        $ele->addOption(0, $cat['title'], 0, true, 'color: #000; font-weight: bold; font-style: italic; border-bottom: 1px solid #c8c8c8;');
        foreach ($cat['forums'] as $cforum) {
            $ele->addOption($cforum['id'], $cforum['name'], 0, false, 'padding-left: 10px;');
        }
    }
    $form->addElement($ele);
    $ele = new RMFormButtonGroup();
    $ele->addButton('sbt', $edit ? __('Save Changes', 'bxpress') : __('Create Announcement', 'bxpress'), 'submit');
    $ele->addButton('cancel', __('Cancel', 'bxpress'), 'button', 'onclick="window.location=\'announcements.php\';"');
    $form->addElement($ele);
    $form->addElement(new RMFormHidden('action', $edit ? 'saveedit' : 'save'));
    if ($edit) {
        $form->addElement(new RMFormHidden('id', $id));
    }
    $form = RMEvents::get()->run_event('bxpress.form.announcement', $form);
    $form->display();
    xoops_cp_footer();
}
Пример #6
0
    $topics[] = array('id' => $row['id_topic'], 'title' => $row['title'], 'post' => $post, 'link' => $topic->permalink(), 'forum' => array('id' => $forum->id(), 'name' => $forum->name(), 'link' => $forum->permalink()));
}
$sql = "SELECT * FROM {$tbl2} ORDER BY replies DESC LIMIT 0,5";
$result = $db->query($sql);
$poptops = array();
$topic = new bXTopic();
while ($row = $db->fetchArray($result)) {
    $topic->assignVars($row);
    $forum->assignVars($row);
    $poptops[] = array('id' => $topic->id(), 'title' => $topic->title(), 'date' => sprintf(__('Created on %s', 'bxpress'), bXFunctions::formatDate($row['date'])), 'replies' => $topic->replies(), 'link' => $topic->permalink(), 'forum' => array('id' => $forum->id(), 'name' => $forum->name(), 'link' => $forum->permalink()));
}
unset($post, $pt, $topic, $result, $row, $sql, $tbl1, $tbl2, $tbl3);
RMTemplate::get()->add_xoops_style('dashboard.css', 'bxpress');
RMTemplate::get()->add_local_script('dashboard.js', 'bxpress');
RMTemplate::get()->set_help('http://www.redmexico.com.mx/docs/bxpress-forums/dashboard/standalone/1/');
bXFunctions::menu_bar();
// Activity
// 30 Days
$ago = strtotime("-30 days");
$sql = "SELECT id_post,post_time,id_forum FROM " . $db->prefix("bxpress_posts") . " WHERE post_time>={$ago} ORDER BY post_time ASC";
$result = $db->query($sql);
$posts = array();
$forums = array();
$p = '';
while ($row = $db->fetchArray($result)) {
    $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;