$unanswered_posts = !$th ? '<b>::</b> <a class="GenLink" href="/egroupware/fudforum/3814588639/index.php?t=selmsg&reply_count=0&' . _rsid . '&frm_id=' . $frm->id . '" title="Show all messages, which have no replies">Unanswered Posts</a>' : ''; $TITLE_EXTRA = ': ' . htmlspecialchars($frm->name); $r = q("SELECT\n\t\t\tt.moved_to, t.thread_opt, t.root_msg_id, r.last_view,\n\t\t\tm.subject, m.reply_to, m.poll_id, m.attach_cnt, m.icon, m.poster_id, m.post_stamp, m.thread_id, m.id,\n\t\t\tu.alias\n\t\tFROM phpgw_fud_thread_view tv\n\t\tINNER JOIN phpgw_fud_thread t ON tv.thread_id=t.id\n\t\tINNER JOIN phpgw_fud_msg m ON t.id=m.thread_id AND m.apr=1\n\t\tLEFT JOIN phpgw_fud_users u ON m.poster_id=u.id\n\t\tLEFT JOIN phpgw_fud_read r ON t.id=r.thread_id AND r.user_id=" . _uid . "\n\t\tWHERE tv.forum_id=" . $frm->id . " AND tv.page=" . $cur_frm_page . " ORDER by pos ASC, m.id"); if (!db_count($r)) { $thread_list_table_data = '<font class="GenText">There are no messages in this forum.</font>'; } else { $thread_list_table_data = ''; $p = $cur_th_id = 0; error_reporting(0); while ($obj = db_rowobj($r)) { unset($stack, $tree, $arr, $cur); db_seek($r, $p); $cur_th_id = $obj->thread_id; while ($obj = db_rowobj($r)) { if ($obj->thread_id != $cur_th_id) { db_seek($r, $p); break; } $arr[$obj->id] = $obj; @$arr[$obj->reply_to]->kiddie_count++; @($arr[$obj->reply_to]->kiddies[] =& $arr[$obj->id]); if (!$obj->reply_to) { @$tree->kiddie_count++; @($tree->kiddies[] =& $arr[$obj->id]); } $p++; } if (@is_array($tree->kiddies)) { reset($tree->kiddies); $stack[0] =& $tree; $stack_cnt = $tree->kiddie_count;
function GetGrpContent($id_cat, $item_txt, $txt_pre, $txt_post, $txt_prerow, $txt_postrow) { global $PICMAN_INFO, $page_pg, $num_total_pages; if (!$id_cat) { return array('', ''); } $pagesel = ''; $group = db_fetch_array(db_query("SELECT colcols, colrows FROM {categories} WHERE id = {$id_cat}")); $perpage = $group['colcols'] * $group['colrows']; $ticodir = $PICMAN_INFO['dircat']; $result = db_query("\n\tSELECT DISTINCT\n\t\tG.id AS id, G.uniqid AS uniqid, G.name AS name, G.weight AS weight, G.quantity AS quantity, G.date_create AS dcreate,\n\t\tG.icoindex AS icoindex, G.coldir AS coldir, G.thumbsubdir AS thumbsubdir, G.thumbtemp AS thumbtemp, G.uid_cat AS uid_cat, 0 AS linkitem\n\tFROM {categories} C\n\t\tINNER JOIN {collections} G ON (C.uniqid = G.uid_cat)\n\tWHERE C.id = {$id_cat}\n\t\n\tUNION SELECT\n\t\tG.id AS id, G.uniqid AS uniqid, G.name AS name, L.weight AS weight, G.quantity AS quantity, G.date_create AS dcreate,\n\t\tG.icoindex AS icoindex, G.coldir AS coldir, G.thumbsubdir AS thumbsubdir, G.thumbtemp AS thumbtemp, G.uid_cat AS uid_cat, 1 AS linkitem\n\tFROM {categories} C\n\t\tINNER JOIN {links} L ON (C.uniqid = L.uid_cat)\n\t\tINNER JOIN {collections} G ON (L.uid_col = G.uniqid)\n\tWHERE C.id = {$id_cat}\n\n\tORDER BY weight DESC, dcreate DESC, name\n\t"); $txt = ''; if ($num = db_num_rows($result)) { $page = 1; $total = (int) ($num / $perpage); if ($num % $perpage) { $total++; } if (isset($page_pg) && $page_pg > 1) { $page = $page_pg; if ($page > $total) { $page = $total; } } $startnum = ($page - 1) * $perpage; $maxnum = $page < $total ? $perpage : $num - ($total - 1) * $perpage; $num_total_pages = $total; $txt .= $txt_pre; $pgnumtemp = '%02d'; if ($total > 1) { $pages_arr = array(); for ($p = 1; $p <= $total; $p++) { if ($p == $page_pg) { $pages_arr[] = sprintf("<B>{$pgnumtemp}</B>", $p); } else { $pages_arr[] = sprintf('<a href="' . PICMAN_MAIN . "i%03dp%03d.html\">{$pgnumtemp}</a>", $id_cat, $p, $p); } } $pagesel = join(' || ', $pages_arr); } $arr_collections = array(); $arr_links = array(); db_seek($result, $startnum); for ($rec = $startnum; $rec < $num && $rec < $startnum + $perpage; $rec++) { $grp_dir = ''; $grp = db_fetch_array($result); if (!empty($grp['icoindex'])) { $grp_dir = "{$ticodir}/" . $grp['coldir']; $icoarr = split(':', $grp['icoindex']); if ($icoarr[0] == 'T') { // Jako ikona będzie thumnbails $grp['icoindex'] = sprintf($grp['thumbsubdir'] . "/" . $grp['thumbtemp'], $icoarr[1]); } if ($grp['linkitem']) { $grp_dir = ''; } } $arr_collections[] = array('id' => $grp['id'], 'name' => $grp['name'], 'count' => $grp['quantity'], 'icon' => $grp['icoindex'], 'dir' => $grp_dir, 'uniqid' => $grp['uniqid'], 'date' => date('Y-m-d', strtotime($grp['dcreate'])), 'link' => $grp['linkitem']); $arr_links[$grp['uniqid']] = $grp['uid_cat']; } $links_output = array(); $qid_links = db_query("\n\t\tSELECT DISTINCT C.id AS id, C.name AS name, L.uid_col AS uid_col FROM {links} L\n\t\t\tINNER JOIN {categories} C ON (C.uniqid = L.uid_cat)\n\t\tWHERE\n\t\t\t(L.uid_cat IN ('" . join("','", array_unique(array_values($arr_links))) . "') OR L.uid_col IN ('" . join("','", array_unique(array_keys($arr_links))) . "'))\n\t\t\tAND C.id != {$id_cat}\n\n\t\tUNION SELECT C.id AS id, C.name AS name, G.uniqid AS uid_col FROM {collections} G\n\t\t\tINNER JOIN {categories} C ON (C.uniqid = G.uid_cat)\n\t\tWHERE\n\t\t\t(G.uid_cat IN ('" . join("','", array_unique(array_values($arr_links))) . "') OR G.uniqid IN ('" . join("','", array_unique(array_keys($arr_links))) . "'))\n\t\t\tAND C.id != {$id_cat}\n\t\t"); if ($num_links = db_num_rows($qid_links)) { while ($pos = db_fetch_array($qid_links, $idx++)) { $links_output[$pos['uid_col']][$pos['id']] = $pos['name']; } } // echo '<pre>'; // print_r($links_output); // echo '</pre>'; $snum = 1; for ($r = 1; $r <= $group['colrows'] && $snum <= $maxnum; $r++) { $txt .= $txt_prerow; for ($c = 1; $c <= $group['colcols'] && $snum <= $maxnum; $c++) { $gr = $arr_collections[$snum - 1]; $icon_thumb = $gr['link'] ? GetDirForCollection($gr['id']) . '/' : ''; $icon_thumb .= $gr['dir'] . '/' . $gr['icon']; echo "\n<!-- Pic[{$snum}] : {$icon_thumb} --- " . $gr['dir'] . " :: " . $gr['icon'] . " -->\n"; $icon = preg_replace('/[\\/]+/', '/', is_file(PICMAN_IMAGE_DIR . $icon_thumb) ? PICMAN_IMAGE . $icon_thumb : DEFAULT_COLLECTION_ICON); $others = ''; if (isset($links_output[$gr['uniqid']])) { foreach ($links_output[$gr['uniqid']] as $catid => $catname) { $others .= sprintf('<a href="%si%03dp%03d.html" title="%s">»</a> ', PICMAN_MAIN, $catid, 1, $catname); } } if (PICMAN_ADMINISTRATION == 1) { $others .= sprintf('<a href="%si%03dp%03d.html" title="%s">[::]</a> ', PICMAN_ADMIN_COLLECTION, $gr['id'], 1, $catname); } $txt .= UpdateTemplate($item_txt, array('href' => sprintf(PICMAN_COLLECTION . "i%03d.html", $gr['id']), 'name' => $gr['name'], 'count' => $gr['count'] ? $gr['count'] : '', 'icon' => $icon, 'dateupdate' => $gr['date'], 'others' => $others)); $snum++; } $txt .= $txt_postrow; } $txt .= $txt_post; } return array($txt, $pagesel); }
if ($count > $PAGE_MAX) { print "<table border='0' cellspacing='0' cellpadding='0' " . "width='100%'>\n"; print "<tr><td>"; if ($index > 0) { print "<a href='{$PHP_SELF}?L+I{$prev}+Q" . urlencode($search) . "'>Previous {$PAGE_MAX}</a>"; } print "</td><td align='right'>"; if ($end < $count) { $next_count = min($PAGE_MAX, $count - $end); print "<a href='{$PHP_SELF}?L+I{$next}+Q" . urlencode($search) . "'>Next {$next_count}</a>"; } print "</td></tr>\n"; print "</table>\n"; } html_start_table(array("ID", "Title", "Last Modified", "Comment(s)")); db_seek($result, $index); for ($i = 0; $i < $PAGE_MAX && ($row = db_next($result)); $i++) { html_start_row(); $id = $row['id']; $link = "<a href='{$PHP_SELF}?L{$id}{$options}' alt='Article #{$id}'>"; print "<td nowrap>"; if ($LOGIN_LEVEL >= AUTH_DEVEL) { print "<input type='checkbox' name='ID_{$row['id']}'>"; } print "{$link}{$id}</a></td>"; $temp = htmlspecialchars($row['title']); if ($row['is_published'] == 0) { $temp .= " <img src='images/private.gif' width='16' height='16' " . "border='0' align='absmiddle' alt='Private'>"; } print "<td align='center' width='67%'>{$link}{$temp}</a></td>"; $temp = date("M d, Y", $row['modify_date']);