Ejemplo n.º 1
0
 function getPolls($limit, $count, $orderby = "date", $orderhow = "DESC")
 {
     global $comments;
     $sql = $this->db->query("SELECT * FROM " . MYSQL_TABLE_PREFIX . "poll ORDER BY " . secureMySQL($orderby) . " " . secureMySQL($orderhow) . " LIMIT " . (int) $limit . "," . secureMySQL($count) . ";");
     while ($result = mysql_fetch_assoc($sql)) {
         $result['name'] = makeHtmlURL(makeLineBreaks($result['name']), makeURL('poll', array('pollid' => $result['ID'])));
         $result['commenturl'] = makeURL('poll', array('pollid' => $result['ID'])) . "#comments";
         $result['questions'] = $this->getQuestionsByPollID($result['ID']);
         $result['given_answers'] = $this->getSumOfAnswers($result['ID']);
         $result['comment_count'] = $comments->count('poll', $result['ID']);
         $result['allready_voted'] = 1;
         $polls[] = $result;
     }
     return $polls;
 }
Ejemplo n.º 2
0
<?php

if ($this->isInstalled('board')) {
    $area['title'] = $lang->get('posts');
    $area['content'] = '';
    $tbl_p = MYSQL_TABLE_PREFIX . 'post';
    $tbl_t = MYSQL_TABLE_PREFIX . 'thread';
    $tbl_b = MYSQL_TABLE_PREFIX . 'board';
    $tbl_gu = MYSQL_TABLE_PREFIX . 'group_users';
    $tbl_g = MYSQL_TABLE_PREFIX . 'groups';
    $limit = (int) $config->get('board', 'box-posts');
    $limit = $limit > 0 ? $limit : 5;
    if ($config->get('board', 'box-thread-once') == 1) {
        $sql = $db->query("SELECT posts.userid as userid, posts.timestamp, threads.thread, boards.boardid, threads.threadid \r\n\t\t\t\t\t\tFROM `" . $tbl_t . "` AS threads \r\n\t\t\t\t\t\tINNER JOIN `" . $tbl_p . "` AS posts\r\n\t\t\t\t\t\tON threads.lastpost=posts.postid\r\n\t\t\t\t\t\tINNER JOIN `" . $tbl_b . "` AS boards\r\n\t\t\t\t\t\tON threads.boardid=boards.boardid\r\n\t\t\t\t\t\tLEFT JOIN `" . $tbl_g . "` AS groups\r\n\t\t\t\t\t\tON boards.`assigned_groupid`=groups.groupid\r\n\t\t\t\t\t\tLEFT JOIN `" . $tbl_gu . "` AS group_users\r\n\t\t\t\t\t\tON boards.`assigned_groupid`=group_users.groupid\r\n\t\t\t\t\t\tWHERE group_users.userid=" . $login->currentUserID() . " OR (group_users.userid is NULL AND groups.groupid IS NULL)\r\n\t\t\t\t\t\tORDER BY posts.timestamp DESC\r\n\t\t\t\t\t\tLIMIT {$limit};");
    } else {
        $sql = $db->query("SELECT posts.userid as userid, posts.timestamp, threads.thread, boards.boardid, threads.threadid FROM \r\n\t\t\t\t\t\t`" . $tbl_p . "` AS posts \r\n\t\t\t\t\t\tINNER JOIN `" . $tbl_t . "` AS threads \r\n\t\t\t\t\t\tON threads.threadid=posts.threadid\r\n\t\t\t\t\t\tINNER JOIN `" . $tbl_b . "` AS boards\r\n\t\t\t\t\t\tON threads.boardid=boards.boardid\r\n\t\t\t\t\t\tLEFT JOIN `" . $tbl_g . "` AS groups\r\n\t\t\t\t\t\tON boards.`assigned_groupid`=groups.groupid\r\n\t\t\t\t\t\tLEFT JOIN `" . $tbl_gu . "` AS group_users\r\n\t\t\t\t\t\tON boards.`assigned_groupid`=group_users.groupid\r\n\t\t\t\t\t\tWHERE group_users.userid=" . $login->currentUserID() . " OR (group_users.userid is NULL AND groups.groupid IS NULL)\r\n\t\t\t\t\t\tORDER BY posts.timestamp DESC\r\n\t\t\t\t\t\tLIMIT {$limit};");
    }
    $list = array();
    while ($list_entry = mysql_fetch_assoc($sql)) {
        $list[] = $list_entry;
    }
    if (null != $list && count($list) > 0) {
        foreach ($list as $l) {
            $u = $user->getUserById($l['userid']);
            $area['content'] = $area['content'] . "<p>&raquo; " . makeHtmlURL($l['thread'], makeURL('board', array('boardid' => $l['boardid'], 'threadid' => $l['threadid']))) . ' (' . makeHTMLURL($u['nickname'], makeURL('profile', array('userid' => $u['userid']))) . ', ' . timeElapsed($l['timestamp']) . ')</p/>';
        }
    }
    $areas[] = $area;
}
Ejemplo n.º 3
0
<?php

global $current_language;
if ($this->isInstalled('calendar')) {
    $area['title'] = $lang->get('calendar');
    $area['content'] = '';
    if ($login->currentUser() === false) {
        $cal_list = $db->selectList('calendar', "*", "(`start` > " . time() . " AND `visible`=2)\r\n\t\t\t\tAND (`language` = '' OR `language` = '" . $current_language . "')", "`start` ASC", "5");
    } else {
        $cal_list = $db->selectList('calendar', "*", "(`start` > " . time() . " AND (`visible`=2 OR `visible`=1 OR (`visible`=0 AND `userid`=" . $login->currentUserId() . ")))\r\n\t\t\t\t\tAND (`language` = '' OR `language` = '" . $current_language . "')", "`start` ASC", "5");
    }
    if (null != $cal_list && count($cal_list) > 0) {
        foreach ($cal_list as $cal) {
            $time = time() > $cal['start'] ? timeElapsed($cal['start']) : timeLeft($cal['start']);
            $area['content'] = $area['content'] . "<p>&raquo; " . makeHtmlURL($cal['title'], makeURL('calendar', array('calendarid' => $cal['calendarid'], 'mode' => 'view', 'day' => $cal['start']))) . ' (' . $time . ')</p>';
        }
    }
    $areas[] = $area;
}
Ejemplo n.º 4
0
<?php

if ($this->isInstalled('news')) {
    $area['title'] = $lang->get('news');
    $area['content'] = '';
    $topnews = $db->selectList(MYSQL_TABLE_PREFIX . 'news', "*", "`domainid` = 0 OR `domainid` = " . getCurrentDomainIndex(), "`timestamp` DESC", "5");
    if (null != $topnews && count($topnews) > 0) {
        foreach ($topnews as $top) {
            $area['content'] = $area['content'] . "<p>&raquo; " . makeHtmlURL($top['title'], makeURL('news', array('newsid' => $top['newsid']))) . ' (' . timeElapsed($top['timestamp']) . ')</p>';
        }
    }
    $areas[] = $area;
}
Ejemplo n.º 5
0
<?php

if ($this->isInstalled('article')) {
    $area['title'] = $lang->get('article');
    $area['content'] = '';
    $articles = $db->selectList('article', "*", "1", "`timestamp` DESC", "5");
    if (null != $articles && count($articles) > 0) {
        foreach ($articles as $article) {
            $area['content'] = $area['content'] . "<p>&raquo; " . makeHtmlURL($article['title'], makeURL('article', array('articleid' => $article['articleid'], 'categoryid' => $article['categoryid']))) . ' (' . timeElapsed($article['timestamp']) . ')</p>';
        }
    }
    $areas[] = $area;
}
Ejemplo n.º 6
0
<?php

if ($this->isInstalled('poll')) {
    $area['title'] = $lang->get('poll');
    $area['content'] = '';
    $tbl_p = MYSQL_TABLE_PREFIX . 'poll';
    $list = $db->selectList($tbl_p, "*", "`active` = 1", "`ID` DESC", "5");
    if (null != $list && count($list) > 0) {
        foreach ($list as $l) {
            $area['content'] = $area['content'] . "<p>&raquo; " . makeHtmlURL($l['name'], makeURL('poll', array('pollid' => $l['ID']))) . '</p>';
        }
    }
    $areas[] = $area;
}