'; else echo ''; echo $subject; echo ($id == $hilight) ? '' : ''; ?> (, ) [] [] )"><? echo $message[8]; ?>
= count($item['items'])); $lines[$level+1] = $last ? './forum/blank.gif' : './forum/line.gif'; showTreeItem($sub_item, $level+1, $hilight); } } } function showThreads($tree, $hilight) { global $threadsPerPage, $mNr, $tNr, $lines; $total = count($tree); $cnt = 0; while(list($thread, $items) = each($tree)) { $cnt++; $last = ($tNr || $cnt == $total); $lines[0] = $last ? './forum/blank.gif' : './forum/line.gif'; while(list($key, $item) = each($items)) { showTreeItem($item, 0, $hilight); } } } function updateTreeItem(&$item, $date, $sub = false) { global $open; $item['replies']++; if($date > $item['date']) $item['update'] = $date; if($open || $sub) $item['open'] = true; } function addTreeItem(&$tree, $item) { $id = $item['id']; $pid = $item['pid']; if($pid && $tree[$pid]) { $tree[$pid]['items'][$id] = $item; updateTreeItem($tree[$pid], $item['date'], $item['open']); return true; } reset($tree); while(list($key, $val) = each($tree)) { if(addTreeItem($tree[$key]['items'], $item)) { updateTreeItem($tree[$key], $item['date'], $item['open']); return true; } } return false; } function buildThreads($open = 0) { global $threadsPerPage, $start, $date_show, $date_show_from, $tNr, $total_threads, $tbl_name, $fld_id, $fld_date, $fld_thread, $fld_pid; $errors = $cond = ''; $threads = $keys = array(); if($tNr) { $cond = "$fld_thread='$tNr'"; } else if($date_show_from && $date_show) { $cond = "$fld_date>='$date_show_from' AND $fld_date<='$date_show'"; } $sql = "SELECT $fld_thread, MAX($fld_id) FROM $tbl_name"; if($cond) $sql .= " WHERE $cond"; $sql .= " GROUP BY $fld_thread"; $result = mysql_query($sql); if($result) while($row = mysql_fetch_row($result)) { $threads[$row[0]] = $tNr ? array() : $row[1]; } else sql_error(); $total_threads = count($threads); if(!$tNr) { arsort($threads); $cnt = 0; while(list($thread, $val) = each($threads)) { if($cnt < $start || $cnt >= $start + $threadsPerPage) { unset($threads[$thread]); } else { $threads[$thread] = array(); $keys[] = $thread; } $cnt++; } if(count($keys)) $cond = "$fld_thread IN (" . join(',', $keys) . ")"; } $sql = "SELECT $fld_id, $fld_pid, $fld_thread, $fld_date FROM $tbl_name"; if($cond) $sql .= " WHERE $cond"; $sql .= " ORDER BY $fld_id"; $result = mysql_query($sql); if($result) while($row = mysql_fetch_row($result)) { $item = array( 'id' => $row[0], 'pid' => $row[1], 'thread' => $row[2], 'date' => $row[3], 'open' => ($open == $row[0]) ? true : false, 'replies' => 0, 'update' => $row[3], 'items' => array() ); if(!addTreeItem($threads[$row[2]], $item)) { if(!$row[1]) $threads[$row[2]][$row[0]] = $item; else $errors .= 'ERROR: could not add ID ' . $item['id'] . ' to tree
'; } } else sql_error(); if($errors) echo '
' . $errors . '
'; return $threads; } //======================================================================================================== // Main //======================================================================================================== if($open == '') $open = $openThreads ? 1 : 0; // $forum = $forum_all = "$PHP_SELF?open=$open"; $forum = $forum_all = "?id=./forum/forum&open=$open"; $forum_date = "$forum&date_show"; if($start >= 0) $forum .= "&start=$start"; if($date_show) $forum .= "&date_show=$date_show"; $forum_open = preg_replace('/open=\d+/', 'open=1', $forum); $forum_close = preg_replace('/open=\d+/', 'open=0', $forum); //donbiker // header('Cache-control: private, no-cache, must-revalidate'); // header('Expires: Sat, 01 Jan 2000 00:00:00 GMT'); // header('Date: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // header('Pragma: no-cache'); ?> <? echo $forumTitle; ?>
Operation cancelled.'; else { echo '
'; echo '
'; echo "Table $tbl_name doesn't exist. Create it now?   "; echo 'yes   '; echo 'no'; echo '
'; } } else $table_exists = true; if($table_exists) { if($_SESSION['sf_admin'] && $_SESSION['sf_admin'] == $adminPass && $delete) { $result = mysql_query("SELECT $fld_thread, $fld_pid FROM $tbl_name WHERE $fld_id='$delete'"); if($result && mysql_num_rows($result)) { $row = mysql_fetch_row($result); $thr = $row[0]; $pid = $row[1]; if(!mysql_query("DELETE FROM $tbl_name WHERE $fld_thread='$thr' AND $fld_pid>=$delete")) sql_error(); if(!mysql_query("DELETE FROM $tbl_name WHERE $fld_id='$delete'")) sql_error(); $date_show = 0; if($pid) { $tNr = $thr; $mNr = $pid; } } } if($new) { if($tstamp) { if(!$sfSubject || !$sfText) { $error = $message[1]; } else { $kuk = checkSpam($sfID, $tstamp, $sfName, $sfEMail, $sfSubject, $sfText, $sfSignature); echo $kuk; if($kuk) $error = $message[21]; } if($error) { ?>
" method="post">
:
:
:
:
:
 « 
HTML:
URLs:
UBBs:

  
'; } $img_old = $img; } ?>
[ ]   [ ]
:
:
:
:
Thread:

'; $showMessage = $mNr; $threads = buildThreads(); showThreads($threads, $mNr); ?>
[ ]   [ " class="cssLink3"> ]
= $total_threads) $start = $total_threads - $threadsPerPage; if($start < 0) $start = 0; $forum2 = preg_replace('/&start=\d+/', '', $forum); ?>
:
[ " class="cssLink3"> ]   [ ]   [ " class="cssLink3"> ]   [ ]   [ + ]   [ ]