Example #1
0
 function getMovements()
 {
     global $db;
     global $login;
     $result = $db->selectList($this->table, "*", "`userid`=" . $login->currentUserID(), "`timestamp` DESC");
     if (count($result) > 0) {
         foreach ($result as $i => $r) {
             $result[$i]['time'] = timeElapsed($r['timestamp']);
         }
     }
     return $result;
 }
Example #2
0
 function listActive()
 {
     global $db;
     global $config;
     $limit = (int) $config->get('login', 'session-time');
     $tbl_users = MYSQL_TABLE_PREFIX . 'users';
     $time = time() - $limit;
     $sql = "SELECT * FROM `" . $tbl_users . "` WHERE `lastaction`>=" . $time;
     $result = $db->query($sql);
     while ($row = mysql_fetch_assoc($result)) {
         $row['str_lastaction'] = timeElapsed($row['lastaction']);
         $row['url'] = makeURL('profile', array('userid' => $row['userid']));
         $list[] = $row;
     }
     return $list;
 }
Example #3
0
 function makeNews(&$comments, &$db, $table, $tbl_users, $start, $end, $title)
 {
     global $lng;
     $news = '';
     $result = $db->query("SELECT * FROM `" . $table . "`, `" . $tbl_users . "`\r\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE `" . $table . "`.`userid` = `" . $tbl_users . "`.`userid` \r\n\t\t\t\t\t\t\t\t\t\t\t\tAND `timestamp`>" . $start . " \r\n\t\t\t\t\t\t\t\t\t\t\t\tAND `timestamp`<" . $end . " \r\n\t\t\t\t\t\t\t\t\t\t\t\tAND (`language` = '" . secureMySQL($lng) . "' OR `language` = '')\r\n\t\t\t\t\t\t\t\t\t\t\t\tAND (`domainid` = 0 OR `domainid` = " . getCurrentDomainIndex() . ")\r\n\t\t\t\t\t\t\t\t\t\t\t\tORDER BY `timestamp` DESC;");
     while ($row = mysql_fetch_assoc($result)) {
         $row['time'] = timeElapsed($row['timestamp']);
         $row['url'] = makeURL('news', array('newsid' => $row['newsid']));
         $row['text'] = stripslashes($row['text']);
         $row['title'] = stripslashes($row['title']);
         $row['user_url'] = makeURL('profile', array('userid' => $row['userid']));
         $row['comments'] = $comments->count('news', $row['newsid']);
         $news[] = $row;
     }
     return array('title' => $title, 'news' => $news, 'news_count' => mysql_num_rows($result));
 }
Example #4
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;
}
Example #5
0
function getNewestDownloads()
{
    global $db, $login, $rights, $current_language;
    $groups = $rights->getGroups($login->currentUserId());
    if (count($groups) > 0) {
        $groupswhere = "IN (-1,";
        for ($i = 0; $i < count($groups) - 1; $i++) {
            $groupswhere .= $groups[$i]['groupid'] . ",";
        }
        $groupswhere .= $groups[count($groups) - 1]['groupid'] . ")";
    } else {
        $groupswhere = " = -1";
    }
    $tbl_dl = MYSQL_TABLE_PREFIX . 'media_downloads';
    $tbl_cat = MYSQL_TABLE_PREFIX . 'media_categories';
    $tbl_perm = MYSQL_TABLE_PREFIX . 'media_categories_permissions';
    $items = array();
    $result = $db->query("\r\n\t\t\tSELECT timestamp, dl.categoryid, dl.name, dl.downloadid, dl.description, perm.groupid FROM " . $tbl_dl . " AS dl \r\n\t\t\tLEFT JOIN " . $tbl_perm . " AS perm ON dl.categoryid = perm.categoryid\r\n\t\t\tLEFT JOIN " . $tbl_cat . " AS cat ON cat.categoryid = dl.categoryid\r\n\t\t\tWHERE IFNULL(perm.groupid, -1) " . $groupswhere . " \r\n\t\t\tAND (cat.language = '' OR cat.language = '" . $current_language . "')\r\n\t\t\tGROUP BY dl.downloadid\r\n\t\t\tORDER BY timestamp DESC \r\n\t\t\tLIMIT 10;");
    while ($row = mysql_fetch_assoc($result)) {
        $row['time'] = timeElapsed($row['timestamp']);
        $row['url'] = makeURL('media', array('categoryid' => $row['categoryid'], 'downloadid' => $row['downloadid']));
        $items[] = $row;
    }
    return $items;
}
Example #6
0
function makeLastPost($boardid, $threadid, $postid, $ppp)
{
    global $lang;
    global $db;
    global $user;
    global $debug;
    if ($postid > 0) {
        $debug->add('ppp', $ppp);
        $page = lastPage($threadid, $ppp);
        $post = $db->selectOneRow(MYSQL_TABLE_PREFIX . 'post', "*", "`postid`=" . (int) $postid);
        $u = $user->getUserByID($post['userid']);
        $s[] = "%a";
        $r[] = $u['nickname'];
        $s[] = "%t";
        $r[] = timeElapsed($post['timestamp']);
        return makeHTMLURL(str_replace($s, $r, $lang->get('last_post_by')), makeURL('board', array('boardid' => $boardid, 'threadid' => $threadid, 'page' => $page), "post" . $postid));
    } else {
        return $lang->get('last_post_none');
    }
}
Example #7
0
             }
         }
         $smarty->assign('list', $list);
     } else {
         // include the template
         $smarty->assign('path', $template_dir . '/pm.tpl');
         // get message
         $message = $db->selectOneRow($tbl_outbox, '*', "`senderid`=" . $login->currentUserID() . " AND `pmid`=" . (int) $_GET['pmid']);
         // get users
         $u = $user->getUserByID($message['recieverid']);
         $me = $login->currentUser();
         $message['reciever'] = $u['nickname'];
         $message['reciever_url'] = makeURL('profile', array('userid' => $message['recieverid']));
         $message['sender'] = $me['nickname'];
         $message['sender_url'] = makeURL('profile', array('userid' => $message['senderid']));
         $message['timestamp_str'] = timeElapsed($message['timestamp']);
         // add a breadcrumb containing subject
         $breadcrumbs->addElement($message['subject'], makeURL($mod, array('mode' => 'inbox', 'pmid' => $_GET['pmid'])));
         // add br to message
         $message['message'] = $bbcode->parse($message['message']);
         $smarty->assign('message', $message);
     }
     break;
 case "write":
     $breadcrumbs->addElement($lang->get('write'), makeURL($mod, array('mode' => 'write')));
     if (isset($_POST['send']) && trim($_POST['subject'] != '' && trim($_POST['message']) != '')) {
         $u = $user->find($_POST['reciever'], 1);
         if ($u !== false) {
             // check if inbox is full
             $otherinbox = $db->num_rows($tbl_inbox, "`recieverid`=" . $u[0]['userid']);
             $allowed = $config->get($mod, 'inbox_limit');
Example #8
0
function smarty_function_timeelapsed($params, $template)
{
    if (isset($params['time'])) {
        return timeElapsed($params['time']);
    }
}
Example #9
0
<?php

$tbl = MYSQL_TABLE_PREFIX . 'shoutbox';
$tbl_u = MYSQL_TABLE_PREFIX . 'users';
$lockTime = (int) $config->get('shoutbox', 'lock-time');
if ($lockTime <= 0) {
    $lockTime = 15;
}
if (@trim($_POST['text']) != '' && $login->currentUser() !== false) {
    $last_post = $db->selectOneRow($tbl, "*", "`userid`=" . $login->currentUserId(), "`timestamp` DESC");
    if ($last_post['timestamp'] + $lockTime < time()) {
        $db->insert($tbl, array('userid', 'timestamp', 'text'), array($login->currentUserID(), time(), "'" . str_replace("\n", "", trim($_POST['text'])) . "'"));
    }
}
$posts = $db->selectList($tbl . "`, `" . $tbl_u, "*", "`" . $tbl_u . "`.`userid`=`" . $tbl . "`.`userid`", "`timestamp` DESC", (int) $config->get('shoutbox', 'posts'));
if (null != $posts && count($posts) > 0) {
    foreach ($posts as $i => $p) {
        $posts[$i]['timestamp_str'] = timeElapsed($p['timestamp']);
        $posts[$i]['url'] = makeURL('profile', array('userid' => $p['userid']));
        $posts[$i]['text'] = $bbcode->parse($p['text']);
    }
}
if ($config->get('shoutbox', 'reverse') == 1) {
    $posts = array_reverse($posts);
}
$smarty->assign('posts', $posts);
$smarty->display('../boxes/shoutbox/posts.tpl');
Example #10
0
$statistic['visitors_yesterday'] = $stat->visitorsYesterday();
$statistic['visitors_this_month'] = $stat->visitorsThisMonth();
$statistic['visitors_overall'] = $stat->visitorsOverall();
$visitorList = $stat->listOnline();
if (count($visitorList) > 0) {
    foreach ($visitorList as $i => $v) {
        $visitorList[$i]['url'] = makeURL('profile', array('userid' => $v['userid']));
        @($visitorList[$i]['duration_str'] = durationToString($v['duration']));
    }
}
$statistic['visitor_list'] = $visitorList;
$lastSeenList = $stat->lastSeen();
if (count($lastSeenList) > 0) {
    foreach ($lastSeenList as $i => $v) {
        $lastSeenList[$i]['url'] = makeURL('profile', array('userid' => $v['userid']));
        $lastSeenList[$i]['timeelapsed'] = timeElapsed($v['lastaction']);
    }
}
$statistic['lastseen'] = $lastSeenList;
$statistic['visitors_per_day'] = $stat->visitorsPerDay();
$month = date("n");
$year = date("Y");
if (isset($_POST['btnChangeYearAndMonth'])) {
    $month = (int) $_POST['Date_Month'];
    $year = (int) $_POST['Date_Year'];
}
$statistic['table_this_month'] = $stat->visitorsTablePerMonth($month, $year);
$statistic['this_month_name'] = date("F", mktime(0, 0, 0, $month, 1, $year));
$statistic['table_this_year'] = $stat->visitorsTablePerYear($year);
$statistic['this_year_name'] = date("Y", mktime(0, 0, 0, $month, 1, $year));
$statistic['table_browseragent'] = $stat->makeBrowseragentList();
Example #11
0
 function find($needle)
 {
     global $user, $bbcode;
     $sql = "SELECT * FROM `" . $this->table . "` WHERE `text` LIKE '%" . secureMySQL($needle) . "%' LIMIT 20;";
     $result = $this->db->query($sql);
     $list = array();
     while ($row = mysql_fetch_assoc($result)) {
         $u = $user->getUserByID($row['userid']);
         $l['time'] = timeElapsed($row['timestamp']);
         $l['nickname'] = $u['nickname'];
         $l['text'] = $bbcode->parse($row['text']);
         $l['mod'] = $row['mod'];
         $l['url'] = makeURL('profile', array('userid' => $row['userid']));
         $list[] = $l;
     }
     return $list;
 }
Example #12
0
<?php

if ($login->currentUser() !== false) {
    if ($_POST['text'] != '') {
        $db->insert('tournamentcomm', array('tournamentid', 'userid', 'encid', 'roundid', 'text', 'timestamp'), array((int) $_POST['tournamentid'], $login->currentUserId(), (int) $_POST['encid'], (int) $_POST['roundid'], "'" . $_POST['text'] . "'", time()));
    }
    $list = $db->selectList('tournamentcomm`, `' . MYSQL_TABLE_PREFIX . 'users', '*', "`tournamentid`=" . (int) $_POST['tournamentid'] . "\r\n\t\t\tAND `encid`=" . (int) $_POST['encid'] . "\r\n\t\t\tAND `roundid`=" . (int) $_POST['roundid'] . "\r\n\t\t\tAND `" . MYSQL_TABLE_PREFIX . "tournamentcomm`.`userid`=`" . MYSQL_TABLE_PREFIX . "users`.`userid`", "`timestamp` DESC");
    foreach ($list as $i => $item) {
        $list[$i]['timestamp_str'] = timeElapsed($item['timestamp']);
    }
    $smarty->assign('list', $list);
    $smarty->display('../mod/default/tournament/communication.tpl');
}
Example #13
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;
}
Example #14
0
<?php

//$lang->addModSpecificLocalization('events');
$table = MYSQL_TABLE_PREFIX . 'events';
$tbl_reg = MYSQL_TABLE_PREFIX . 'register';
$tbl_users = MYSQL_TABLE_PREFIX . 'users';
$e = $db->selectOneRow($table, "*", "`end`>" . time(), "`start` ASC", "1");
if (@$e['eventid'] == '') {
    $tpl_file = $template_dir . "/none.tpl";
} else {
    $e['url'] = makeURL('events', array('eventid' => $e['eventid']));
    //$e['start'] = date('d.m.Y / H:i', $e['start']);
    $e['start'] = time() > $e['start'] ? timeElapsed($e['start']) : timeLeft($e['start']);
    $e['end'] = date('d.m.Y / H:i', $e['end']);
    $e['registered'] = $db->num_rows($tbl_reg, "`eventid`=" . $e['eventid']);
    $e['payed'] = $db->num_rows($tbl_reg, "`eventid`=" . $e['eventid'] . " AND `payed` > 0");
    $e['payed_pre'] = $db->num_rows($tbl_reg, "`eventid`=" . $e['eventid'] . " AND `payed`!=0 AND `payed`!=2");
    $e['payed_box_office'] = $db->num_rows($tbl_reg, "`eventid`=" . $e['eventid'] . " AND `payed`=2");
    $e['seats_free'] = $e['seats'] - $e['registered'];
    $bar_width = 100;
    // is user registered?
    $reg = $db->num_rows($tbl_reg, "`userid`=" . $login->currentUserID() . " \r\n\t\t\t\t\t\t\t\t\t\tAND `eventid`=" . $e['eventid']);
    $smarty->assign('box_events_reg', $reg);
    if ($reg == 1) {
        $smarty->assign('box_events_state', $lang->get('event_registered'));
    } else {
        $smarty->assign('box_events_state', $lang->get('event_not_registered'));
    }
    if ($e['free'] == 0) {
        $e['not_payed'] = $e['registered'] - $e['payed'];
    }
Example #15
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;
}
Example #16
0
$usr = $login->currentUser();
if ($usr !== false) {
    $smarty->assign('nickname', $usr['nickname']);
}
if (isset($_POST['delete']) && $isallowed) {
    $db->delete($tbl, "`guestbookid`=" . (int) $_POST['guestbookid']);
    $notify->add($lang->get('guestbook'), $lang->get('deleted'));
}
if (isset($_POST['add']) && $_POST['email'] == '') {
    if (trim($_POST['author']) == '' || trim($_POST['message']) == '') {
        $notify->add($lang->get('guestbook'), $lang->get('fill_all'));
    } else {
        if ($ip_blocker_enabled == 1 && $db->num_rows($tbl, "`ipadress`='" . getRemoteAdr() . "' AND `timestamp`>" . (time() - $ip_blocker_limit)) == 0 || $ip_blocker_enabled == 0) {
            $db->insert($tbl, array('timestamp', 'author', 'message', 'ipadress'), array(time(), "'" . $_POST['author'] . "'", "'" . strip_tags($_POST['message']) . "'", "'" . getRemoteAdr() . "'"));
        } else {
            $notify->add($lang->get('guestbook'), $lang->get('ip-blocker'));
        }
    }
}
$messageCount = $db->num_rows($tbl, "1");
$messagesPerPage = $config->get($mod, 'entries-per-page');
@$pages->setValues((int) $_GET['page'], $messagesPerPage, $messageCount);
$list = $db->selectList($tbl, "*", "1", "`timestamp` DESC", $pages->currentValue() . ", " . (int) $messagesPerPage);
if (count($list) > 0) {
    foreach ($list as $i => $l) {
        $list[$i]['time'] = timeElapsed($l['timestamp']);
        $list[$i]['message'] = $bbcode->parse($l['message']);
    }
}
$smarty->assign('list', $list);
$smarty->assign('pages', $pages->get($mod, array()));
Example #17
0
<?php

$lang->addModSpecificLocalization('board');
$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;
$ppp = $config->get('board', 'posts-per-page');
require_once './mod/default/board/board.function.php';
if ($config->get('board', 'box-thread-once') == 1) {
    $sql = $db->query("SELECT posts.userid as userid, posts.timestamp, threads.thread, boards.boardid, threads.threadid, threads.lastpost \r\n\t\t\t\t\tFROM `" . $tbl_t . "` AS threads \r\n\t\t\t\t\tINNER JOIN `" . $tbl_p . "` AS posts\r\n\t\t\t\t\tON threads.lastpost=posts.postid\r\n\t\t\t\t\tINNER JOIN `" . $tbl_b . "` AS boards\r\n\t\t\t\t\tON threads.boardid=boards.boardid\r\n\t\t\t\t\tLEFT JOIN `" . $tbl_g . "` AS groups\r\n\t\t\t\t\tON boards.`assigned_groupid`=groups.groupid\r\n\t\t\t\t\tLEFT JOIN `" . $tbl_gu . "` AS group_users\r\n\t\t\t\t\tON boards.`assigned_groupid`=group_users.groupid\r\n\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\tORDER BY posts.timestamp DESC\r\n\t\t\t\t\tLIMIT {$limit};");
} else {
    $sql = $db->query("SELECT posts.userid as userid, posts.timestamp, threads.thread, boards.boardid, threads.threadid, threads.lastpost FROM \r\n\t\t\t\t\t`" . $tbl_p . "` AS posts \r\n\t\t\t\t\tINNER JOIN `" . $tbl_t . "` AS threads \r\n\t\t\t\t\tON threads.threadid=posts.threadid\r\n\t\t\t\t\tINNER JOIN `" . $tbl_b . "` AS boards\r\n\t\t\t\t\tON threads.boardid=boards.boardid\r\n\t\t\t\t\tLEFT JOIN `" . $tbl_g . "` AS groups\r\n\t\t\t\t\tON boards.`assigned_groupid`=groups.groupid\r\n\t\t\t\t\tLEFT JOIN `" . $tbl_gu . "` AS group_users\r\n\t\t\t\t\tON boards.`assigned_groupid`=group_users.groupid\r\n\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\tORDER BY posts.timestamp DESC\r\n\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 $i => $l) {
        $u = $user->getUserById($l['userid']);
        $list[$i]['url'] = makeURL('board', array('boardid' => $l['boardid'], 'threadid' => $l['threadid'], 'page' => lastPage($l['threadid'], $ppp)), "post" . $l['lastpost']);
        $list[$i]['info'] = '(' . makeHTMLURL($u['nickname'], makeURL('profile', array('userid' => $u['userid']))) . ', ' . timeElapsed($l['timestamp']) . ')';
    }
}
$smarty->assign('box_board_posts', $list);
$tpl_file = $template_dir . "/posts.tpl";
$visible = true;
Example #18
0
 $e['start'] = date('d.m.Y / H:i', $e['start']);
 $e['end'] = date('d.m.Y / H:i', $e['end']);
 $e['reg_start'] = date('d.m.Y / H:i', $e['reg_start']);
 $e['reg_end'] = date('d.m.Y / H:i', $e['reg_end']);
 $e['registered'] = $db->num_rows($tbl_reg, "`eventid`=" . (int) $_GET['eventid']);
 $e['payed'] = $db->num_rows($tbl_reg, "`eventid`=" . (int) $_GET['eventid'] . " AND `payed` > 0");
 $e['payed_pre'] = $db->num_rows($tbl_reg, "`eventid`=" . (int) $_GET['eventid'] . " AND `payed`=1");
 $e['payed_box_office'] = $db->num_rows($tbl_reg, "`eventid`=" . (int) $_GET['eventid'] . " AND `payed`=2");
 $e['seats_free'] = $e['seats'] - $e['registered'];
 if ($e['free'] == 0) {
     $e['not_payed'] = $e['registered'] - $e['payed'];
 }
 if ($e['last_check'] == 0) {
     $e['last_check'] = $lang->get('never');
 } else {
     $e['last_check'] = timeElapsed($e['last_check']);
 }
 $smarty->assign('path', $template_dir . "/view.tpl");
 $smarty->assign('event', $e);
 // edit and remove urls
 $smarty->assign('edit_url', makeURL($mod, array('mode' => 'edit', 'eventid' => $e['eventid'])));
 $smarty->assign('remove_url', makeURL($mod, array('mode' => 'remove', 'eventid' => $e['eventid'])));
 $smarty->assign('paystate_url', makeURL($mod, array('mode' => 'paystate', 'eventid' => $e['eventid'])));
 $smarty->assign('agb_url', makeURL($mod, array('mode' => 'agb', 'eventid' => $e['eventid'])));
 // Paystate bar
 if ($e['free'] == 0) {
     $smarty->assign('payed_width', 100 * $e['payed'] / $e['seats'] * ($bar_width / 100));
     $smarty->assign('not_payed_width', 100 * $e['not_payed'] / $e['seats'] * ($bar_width / 100));
     $smarty->assign('free_width', 100 * $e['seats_free'] / $e['seats'] * ($bar_width / 100));
 } else {
     $smarty->assign('payed_width', 100 * $e['registered'] / $e['seats'] * ($bar_width / 100));
Example #19
0
<?php

$smarty->assign('path', $template_dir . "/credit.tpl");
$smarty->assign('mv', $credit->getMovements());
$smarty->assign('balance', $credit->getBalance());
$smarty->assign('last_activity', timeElapsed($credit->getLastActivity()));
Example #20
0
                 $register->joinGroup($tournament, $groupid, $_POST['creategroup_password']);
             }
         }
         if (isset($_POST['unjoin'])) {
             $register->leaveTournament($tournamentid);
         }
         if (isset($_POST['joingroup'])) {
             $register->joinGroup($tournament, $_POST['joingroup_groupid'], $_POST['joingroup_password']);
         }
         $smarty->assign('already_joined', $register->alreadyJoined($tournamentid));
         $smarty->assign('grouplist', $register->getPlayerList($tournament));
     }
     if ($tournament['start'] > time()) {
         $tournament['start_str'] = timeLeft($tournament['start']);
     } else {
         $tournament['start_str'] = timeElapsed($tournament['start']);
     }
     // Ranking of tournament
     if ($tournament['state'] == 2 || $tournament['state'] == 3) {
         $ranking = $tournament_obj->ranking();
         $smarty->assign('ranking', $ranking);
     }
     $tournament['regcount'] = $register->getRegCount($tournamentid);
     $smarty->assign('tournament', $tournament);
     break;
 case 'editstate':
     if (!$right['add_remove_edit']) {
         break;
     }
     if (isset($_POST['save'])) {
         $tournamentList->setState($tournamentid, $_POST['state']);
Example #21
0
// check if user exists
if ($u !== false) {
    // set breadcrumb
    $breadcrumbs->addElement($u['nickname'], makeURL($mod, array('userid' => $u['userid'])));
    // set my userid
    $smarty->assign('myid', $login->currentUserId());
    // include the template
    $smarty->assign('path', $template_dir . '/profile.tpl');
    if ($config->get('profile', 'hide-lastname') == '1') {
        $u['lastname'] = substr($u['lastname'], 0, 1) . '.';
    }
    $smarty->assign('user', $u);
    // avatar
    $smarty->assign('avatar', $avatar->get($_GET['userid']));
    // last seen
    $smarty->assign('last_seen', timeElapsed($u['lastaction']));
    // clan
    if ($this->isInstalled('clan')) {
        $clanid = (int) $db->selectOne('clan_member', 'clanid', "`userid`=" . $userid);
        if ($clanid > 0) {
            $clan = $db->selectOneRow('clan', '*', '`clanid`=' . $clanid);
            $clan['url'] = makeURL('clan', array('clanid' => $clanid));
            $smarty->assign('clan', $clan);
        }
    }
    // get personal fields
    $tbl_fields = MYSQL_TABLE_PREFIX . 'personal_fields';
    $tbl_data = MYSQL_TABLE_PREFIX . 'personal_data';
    $list = $db->selectList($tbl_fields);
    $l = array();
    if (count($list) > 0) {
Example #22
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;
}