Пример #1
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;
}
Пример #2
0
            $sql1 .= " (a.title LIKE '%{$search}%' OR b.post_text LIKE '%{$search}%') ";
        }
    }
    $sql2 .= ($sql1 ? " AND " : '') . " c.approved=1 AND a.id_topic=c.id_topic AND b.post_id=c.id_post AND d.id_forum=c.id_forum ";
    $sql2 .= $themes ? $themes == 1 ? " AND a.date>" . (time() - $xoopsModuleConfig['time_topics'] * 3600) : ($themes == 2 ? " AND a.replies=0" : '') : '';
    $sql2 .= "  ORDER BY a.sticky DESC, a.date DESC LIMIT {$start},{$limit}";
}
$result = $db->queryF($sql . $sql1 . $sql2);
while ($rows = $db->fetchArray($result)) {
    $date = bXFunctions::formatDate($rows['date']);
    $lastpost = array();
    $firstpost = array();
    if (!$search && $themes == 0) {
        $firstpost = bXFunctions::getFirstId($rows['id_topic']);
        $last = new bXPost($rows['last_post']);
        $lastpost['date'] = bXFunctions::formatDate($last->date());
        $lastpost['by'] = sprintf(__('By: %s', 'bxpress'), $last->uname());
        $lastpost['id'] = $last->id();
        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'];
        }
    }
    $tpl->append('posts', array('id' => $rows['id_topic'], 'title' => $rows['title'], 'sticky' => $rows['sticky'], 'user' => $rows['poster_name'], 'replies' => $rows['replies'], 'views' => $rows['views'], 'closed' => $rows['status'], 'date' => $date, 'by' => sprintf(__('By: %s', 'bxpress'), $rows['poster_name']), 'forum' => $rows['name'], 'id_post' => $rows['id_post'], 'post_text' => TextCleaner::getInstance()->truncate($rows['post_text'], 100), 'last' => $lastpost, 'firstpost' => $firstpost));
}
$tpl->assign('lang_search', __('Search:', 'bxpress'));
$tpl->assign('lang_recenttopics', __('Recent topics', 'bxpress'));
$tpl->assign('lang_alltopics', __('All topics', 'bxpress'));
$tpl->assign('lang_anunswered', __('Unanswered topics', 'bxpress'));
$tpl->assign('themes', $themes);
Пример #3
0
while ($row = $db->fetchArray($result)) {
    //print_r($row);
    $pt->assignVars($row);
    $post = array('id' => $row['last_post'], 'date' => sprintf(__('Last post on %s', 'bxpress'), bXFunctions::formatDate($row['post_time'])), 'by' => sprintf(__('By %s', 'bxpress'), $row['poster_name']), 'link' => $pt->permalink(), 'uid' => $row['uid']);
    $topic->assignVars($row);
    $forum->assignVars($row);
    $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_style('dashboard.css', 'bxpress');
RMTemplate::get()->add_script('dashboard.js', 'bxpress');
RMTemplate::get()->add_help('Ayuda de bXpress', 'http://www.xoopsmexico.net/docs/bxpress-forums/dashboard/standalone/1/');
// Activity
// 30 Days
$ago = strtotime("-30 days");
$sql = "SELECT id_post,post_time,id_forum FROM " . $db->prefix("mod_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']);
Пример #4
0
/**
* @desc Muestra todas las opciones configurables
*/
function showItemsAndOptions()
{
    global $xoopsUser, $db, $xoopsOption, $tpl, $xoopsModule, $xoopsConfig, $xoopsSecurity;
    global $xoopsModuleConfig, $forum;
    $xoopsOption['template_main'] = "bxpress_moderate.html";
    $xoopsOption['module_subpage'] = "moderate";
    include 'header.php';
    /**
     * Cargamos los temas
     */
    $tbl1 = $db->prefix("bxpress_topics");
    $tbl2 = $db->prefix("bxpress_forumtopics");
    $sql = "SELECT COUNT(*) FROM {$tbl1} WHERE id_forum='" . $forum->id() . "' ";
    list($num) = $db->fetchRow($db->queryF($sql));
    $page = isset($_REQUEST['pag']) ? $_REQUEST['pag'] : '';
    $limit = $xoopsModuleConfig['topicperpage'] > 0 ? $xoopsModuleConfig['topicperpage'] : 15;
    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 > 0) {
        $nav = new RMPageNav($num, $limit, $pactual);
        $nav->target_url('moderate.php?id=' . $forum->id() . '&amp;pag={PAGE_NUM}');
        $tpl->assign('itemsNavPage', $nav->render(false));
    }
    $sql = str_replace("COUNT(*)", '*', $sql);
    $sql .= " ORDER BY sticky DESC, date DESC LIMIT {$start},{$limit}";
    $result = $db->query($sql);
    while ($row = $db->fetchArray($result)) {
        $topic = new bXTopic();
        $topic->assignVars($row);
        $last = new bXPost($topic->lastPost());
        $lastpost = array();
        if (!$last->isNew()) {
            $lastpost['date'] = bXFunctions::formatDate($last->date());
            $lastpost['by'] = sprintf(__('By: %s', 'bxpress'), $last->uname());
            $lastpost['id'] = $last->id();
            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'];
            }
        }
        $tpages = ceil($topic->replies() / $xoopsModuleConfig['perpage']);
        if ($tpages > 1) {
            $pages = bXFunctions::paginateIndex($tpages);
        } else {
            $pages = null;
        }
        $tpl->append('topics', array('id' => $topic->id(), 'title' => $topic->title(), 'replies' => $topic->replies(), 'views' => $topic->views(), 'by' => sprintf(__('By: %s', 'bxpress'), $topic->posterName()), 'last' => $lastpost, 'popular' => $topic->replies() >= $forum->hotThreshold(), 'sticky' => $topic->sticky(), 'pages' => $pages, 'tpages' => $tpages, 'approved' => $topic->approved(), 'closed' => $topic->status()));
    }
    $tpl->assign('forum', array('id' => $forum->id(), 'title' => $forum->name()));
    $tpl->assign('lang_topic', __('Topic', 'bxpress'));
    $tpl->assign('lang_replies', __('Replies', 'bxpress'));
    $tpl->assign('lang_views', __('Views', 'bxpress'));
    $tpl->assign('lang_lastpost', __('Last Post', 'bxpress'));
    $tpl->assign('lang_sticky', __('Sticky', 'bxpress'));
    $tpl->assign('lang_moderating', __('Moderating Forum', 'bxpress'));
    $tpl->assign('lang_pages', __('Pages', 'bxpress'));
    $tpl->assign('lang_move', __('Move', 'bxpress'));
    $tpl->assign('lang_open', __('Unlock', 'bxpress'));
    $tpl->assign('lang_close', __('Lock', 'bxpress'));
    $tpl->assign('lang_dosticky', __('Sticky', 'bxpress'));
    $tpl->assign('lang_dounsticky', __('Unsticky', 'bxpress'));
    $tpl->assign('lang_approved', __('Approved', 'bxpress'));
    $tpl->assign('lang_app', __('Approve', 'bxpress'));
    $tpl->assign('lang_noapp', __('Unapprove', 'bxpress'));
    $tpl->assign('lang_delete', __('Delete', 'bxpress'));
    $tpl->assign('lang_confirm', __('Do you really want to delete selected topics?', 'bxpress'));
    $tpl->assign('token_input', $xoopsSecurity->getTokenHTML());
    bXFunctions::makeHeader();
    RMTemplate::get()->add_xoops_style('style.css', 'bxpress');
    include 'footer.php';
}
Пример #5
0
        $userData = array();
        $userData['id'] = 0;
        $userData['uname'] = $xoopsModuleConfig['anonymous_prefix'] . $post->uname();
        $userData['rank'] = $xoopsConfig['anonymous'];
        $userData['rank_image'] = '';
        $userData['registered'] = '';
        $userData['avatar'] = RMEvents::get()->run_event("rmcommon.get.avatar", '', 0);
        $userData['posts'] = sprintf(__('Posts: %u', 'bxpress'), 0);
        $userData['online'] = false;
    }
    // Adjuntos
    $attachs = array();
    foreach ($post->attachments() as $k) {
        $attachs[] = array('title' => $k->name(), 'downs' => $k->downloads(), 'id' => $k->id(), 'ext' => $k->extension(), 'size' => RMUtilities::formatBytesSize($k->size()), 'icon' => $k->getIcon());
    }
    $tpl->append('posts', array('id' => $post->id(), 'text' => $post->text(), 'edit' => $post->editText(), 'approved' => $post->approved(), 'date' => bXFunctions::formatDate($post->date()), 'canedit' => $canedit, 'candelete' => $candelete, 'canshow' => $canshow, 'canreport' => $report, 'poster' => $userData, 'attachs' => $attachs, 'attachscount' => count($attachs)));
}
unset($userData, $bbUser, $users);
$tpl->assign('lang_edit', __('Edit', 'bxpress'));
$tpl->assign('lang_delete', __('Delete', 'bxpress'));
$tpl->assign('lang_report', __('Report', 'bxpress'));
$tpl->assign('lang_quote', __('Quote', 'bxpress'));
$tpl->assign('lang_online', __('Online!', 'bxpress'));
$tpl->assign('lang_offline', __('Disconnected', 'bxpress'));
$tpl->assign('lang_attachments', __('Attachments', 'bxpress'));
$tpl->assign('xoops_pagetitle', $topic->title() . " &raquo; " . $xoopsModuleConfig['forum_title']);
$tpl->assign('token', $xoopsSecurity->createToken());
$tpl->assign('lang_edittext', __('Edit Text', 'bxpress'));
$tpl->assign('lang_goto', __('Change Forum:', 'bxpress'));
$tpl->assign('lang_go', __('Go!', 'bxpress'));
//$tpl->assign('url',XOOPS_URL."/modules/bxpress/report.php");