function makeEntryArrayHours($entries, &$maxCols) { $maxCols = 0; $day_view = array(); if (count($entries) > 0) { foreach ($entries as $entry) { $hour = (int) date("H", $entry['start']); $seconds = $entry['end'] - $entry['start']; if (date("i", $seconds) > 30 || $seconds <= 3600) { $rowspan = ceil($seconds / 60 / 60); } else { $rowspan = floor($seconds / 60 / 60); } // Check which column to put in for ($col = 0; $col <= $maxCols + 1; $col++) { $foundCol = true; for ($row = 0; $row < $rowspan; $row++) { if (isset($day_view[$hour + $row][$col])) { $foundCol = false; } } if ($foundCol) { $column = $col; break 1; } } $maxCols = $maxCols < $column ? $column : $maxCols; $day_view[$hour][$column]['start']['hour'] = date("H", $entry['start']); $day_view[$hour][$column]['start']['min'] = date("i", $entry['start']); $day_view[$hour][$column]['end']['hour'] = date("H", $entry['end']); $day_view[$hour][$column]['end']['min'] = date("i", $entry['end']); $day_view[$hour][$column]['rowspan'] = $rowspan; $day_view[$hour][$column]['title'] = makeHTMLURL($entry['title'], makeURL('calendar', array('mode' => 'view', 'calendarid' => $entry['calendarid']))); $day_view[$hour][$column]['description'] = nl2br($entry['description']); $day_view[$hour][$column]['calendarid'] = $entry['calendarid']; global $db; $color = $db->selectOneRow('calendar_categories', '*', "`categoryId`='" . $entry['categoryId'] . "'"); $day_view[$hour][$column]['backgroundcolor'] = strlen($color['backgroundcolor']) > 0 ? $color['backgroundcolor'] : "#57FF7E"; $day_view[$hour][$column]['fontcolor'] = strlen($color['fontcolor']) > 0 ? $color['fontcolor'] : "#000000"; for ($i = 1; $i < $rowspan; $i++) { $day_view[$hour + $i][$column]['rowspan'] = 0; } } } for ($i = 0; $i < 24; $i++) { $day_view[$i]['hour'] = $i; for ($j = 0; $j <= $maxCols; $j++) { if (!isset($day_view[$i][$j]['rowspan'])) { $day_view[$i][$j]['rowspan'] = 1; } } } ksort($day_view, SORT_NUMERIC); return $day_view; }
<?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>» " . 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; }
<?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;
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'); } }
$breadcrumbs->addElement($lang->get('user_matrix'), makeURL($mod, array('action' => 'user_matrix', 'mode' => 'groups'))); $smarty->assign('path', $template_dir . "/user_matrix.tpl"); $tbl_g = MYSQL_TABLE_PREFIX . 'groups'; $tbl_gu = MYSQL_TABLE_PREFIX . 'group_users'; $tbl_u = MYSQL_TABLE_PREFIX . 'users'; $glist = $db->selectList($tbl_g, "*"); $ulist = $db->selectList($tbl_gu . "`, `" . $tbl_u, "*", "`" . $tbl_u . "`.`userid`=`" . $tbl_gu . "`.`userid` GROUP BY `" . $tbl_u . "`.`userid`"); $list[' '][' '] = ' '; if (null != $glist && count($glist) > 0) { foreach ($glist as $g) { $list[' '][$g['groupid']] = makeHTMLURL('<strong>' . $g['name'] . '</strong>', makeURL($mod, array('mode' => 'groups', 'action' => 'edit', 'groupid' => $g['groupid']))); } } if (null != $ulist && count($ulist) > 0) { foreach ($ulist as $u) { $list[$u['userid']][0] = makeHTMLURL($u['nickname'], makeURL($mod, array('mode' => 'users', 'action' => 'memberships', 'userid' => $u['userid']))); if (null != $glist && count($glist) > 0) { foreach ($glist as $g) { $list[$u['userid']][$g['groupid']] = " "; } } } } $rlist = $db->selectList($tbl_gu, "*"); foreach ($rlist as $r) { $list[$r['userid']][$r['groupid']] = 'X'; } $smarty->assign('matrix', $list); break; case 'memberships': $group = $rights->getGroup($_GET['groupid']);
$in_month = false; $current_day = 0; } $current_day++; $current_day_ts = mktime(0, 0, 0, date("n", $day), $current_day, date("Y", $day)); $current_day_ts_start = mktime(0, 0, 0, date("n", $current_day_ts), date("j", $current_day_ts), date("Y", $current_day_ts)); $current_day_ts_stop = mktime(23, 59, 59, date("n", $current_day_ts), date("j", $current_day_ts), date("Y", $current_day_ts)); if ($in_month) { $found = false; if (count($list) > 0) { foreach ($list as $entry) { if ($entry['start'] >= $current_day_ts_start && $entry['start'] <= $current_day_ts_stop) { $found = true; break; } } } if ($found) { $field[$i] = makeHTMLURL(makeHighlighted($current_day), makeURL($mod, array('day' => $current_day_ts, 'view' => 'day'))); } else { $field[$i] = makeHTMLURL($current_day, makeURL($mod, array('day' => $current_day_ts, 'view' => 'day'))); } if ($current_day_ts_start < time() && $current_day_ts_stop > time()) { $field[$i] = makeToday($field[$i]); } } else { $field[$i] = makeGrey($current_day); } } $smarty->assign('field', $field); $smarty->assign('path', $template_dir . "/view_month.tpl");
<?php $smarty->assign('path', $template_dir . "/view_day.tpl"); $breadcrumbs->addElement(makeDate($day), makeURL($mod, array('day' => $day, 'view' => $view))); $smarty->assign('prev', makeHTMLURL($lang->get('prev_day'), makeURL($mod, array('day' => strtotime("-1 Day", $day), 'view' => $view)))); $smarty->assign('next', makeHTMLURL($lang->get('next_day'), makeURL($mod, array('day' => strtotime("+1 Day", $day), 'view' => $view)))); $list = listEntries($day); $day_view = makeEntryArrayQuarters($list, $maxCols); $tbl_info = array(); $width = (int) floor(85 / ($maxCols + 1)); for ($i = 1; $i <= $maxCols + 1; $i++) { $tbl_info[$i] = $width; } $smarty->assign('tbl_info', $tbl_info); $smarty->assign('birthdays', $config->get('calendar', 'show-birthdays') == 1 ? getTodaysBirthdays($day) : ""); $smarty->assign('day_view', $day_view);
$comments->add($mod, $login->currentUserID(), $_POST['text'], $contactid); } $smarty->assign('comments', $comments->get($mod, $contactid)); if ($request['read'] == 0) { $request['read'] = 1; $db->update($tbl_contact, "`read`=1", "`contactid`=" . $contactid); } if (isset($_POST['done'])) { $db->update($tbl_contact, "`done`=" . $login->currentUserID(), "`contactid`=" . $contactid); $request['done'] = $login->currentUserID(); $log->add($mod, 'contact entry ' . $contactid . ' marked as done'); } if (isset($_POST['move_to_groupware'])) { $end = strtotime("+1 Hour"); $db->insert($tbl_groupware, array('title', 'description', 'state', 'end', 'priority', 'contactid', 'userid'), array("'" . $request['subject'] . "'", "'" . $request['text'] . "'", 0, $end, 1, $contactid, 0)); $notify->add($lang->get('groupware'), $lang->get('copy_to_groupware_done')); $request['isInGroupware'] = true; } $u = $user->getUserByID($request['userid']); $request['sender'] = makeHTMLURL($u['nickname'], makeURL('profile', array('userid' => $request['userid']))); $request['timestamp'] = timeLeft($request['timestamp']); $request['text'] = $bbcode->parse($request['text']); $request['read'] = intToYesNo($request['read']); if ($request['done'] > 0) { $u = $user->getUserByID($request['done']); $request['done_by'] = makeHTMLURL($u['nickname'], makeURL('profile', array('userid' => $u['userid']))); } $smarty->assign('delete_url', makeURL($mod, array('mode' => 'contact'))); $smarty->assign('request', $request); } $smarty->assign('path', $template_dir . "/contact.tpl");
function get($mod, $params) { global $lang; $sites = $this->max_pages; $range = $this->range; $site = $this->current_page; $sitelist = array(); if ($sites <= $range) { for ($i = 1; $i <= $sites; $i++) { $sitelist[] = $i; //nächste zahl anhängen } } else { if ($site - ($range - 1) / 2 <= 0) { $offset = $site; } elseif ($site + ($range - 1) / 2 > $sites) { $offset = $range - ($sites - $site); } else { $offset = ($range + 1) / 2; } for ($i = 1; $i <= $range; $i++) { $sitelist[] = $i + $site - $offset; } } if (count($sitelist) > 0) { foreach ($sitelist as $i => $val) { if ($val != $site) { $p = $params; $p['page'] = $val; $sitelist[$i] = '<a href="' . makeURL($mod, $p) . '">' . $val . '</a>'; } else { $p = $params; $p['page'] = $val; $sitelist[$i] = '<strong>' . $val . '</strong>'; } } } if (count($sitelist) > 0) { $sl = implode(" ", $sitelist); } else { $sl = ""; } if ($this->max_pages > $this->current_page) { $p1 = array('page' => $this->current_page + 1) + $p; $p2 = array('page' => $this->lastPage()) + $p; $sl = $sl . " | " . makeHTMLURL($lang->get('next'), makeURL($mod, $p1)) . " | " . makeHTMLURL($lang->get('last'), makeURL($mod, $p2)); } else { $sl = $sl . " | " . $lang->get('next') . " | " . $lang->get('last'); } if ($this->current_page > 1) { $p1 = array('page' => $this->current_page - 1) + $p; $p2 = array('page' => 1) + $p; $sl = makeHTMLURL($lang->get('first'), makeURL($mod, $p2)) . " | " . makeHTMLURL($lang->get('prev'), makeURL($mod, $p1)) . " | " . $sl; } else { $sl = $lang->get('first') . " | " . $lang->get('prev') . " | " . $sl; } return $sl; }
$last_day = mktime(23, 59, 59, 12, 31, date("Y", $day)); $breadcrumbs->addElement(makeDateRange($first_day, $last_day), makeURL($mod, array('day' => $day, 'view' => $view))); // all entries for this month $list = listEntries($first_day, $last_day); for ($month = 0; $month < 12; $month++) { $month_ts = mktime(0, 0, 0, $month + 1, 1, date("Y", $day)); $days_of_month = date("t", $month_ts); for ($days = 1; $days <= $days_of_month; $days++) { $current_day_ts_start = mktime(0, 0, 0, $month + 1, $days, date("Y", $day)); $current_day_ts_end = mktime(23, 59, 59, $month + 1, $days, date("Y", $day)); $found = false; if (count($list) > 0) { foreach ($list as $entry) { if ($entry['start'] >= $current_day_ts_start && $entry['start'] <= $current_day_ts_end) { $found = true; break; } } } if ($found) { $fields[$month][$days - 1]['content'] = makeHTMLURL(makeHighlighted($days), makeURL($mod, array('day' => $current_day_ts_start, 'view' => 'day'))); } else { $fields[$month][$days - 1]['content'] = makeHTMLURL($days, makeURL($mod, array('day' => $current_day_ts_start, 'view' => 'day'))); } if ($current_day_ts_start < time() && $current_day_ts_end > time()) { $fields[$month][$days - 1]['content'] = makeToday($fields[$month][$days - 1]['content']); } $fields[$month][$days - 1]['flag'] = date("D", $current_day_ts_start); } } $smarty->assign('month', $fields);