function uri_to_name($uri) { if ($uri == URI_BASE) { return _TB_TOPPAGE; } if (preg_match(REG_MOD, $uri, $d)) { // module pages $mod = XoopsModule::getByDirname($d[1]); $name = is_object($mod) ? $mod->getVar("name") : $d[1]; $rest = myurldecode(preg_replace(REG_MOD, '', $uri)); $rest = str_replace("index.php?", "", $rest); return $name . ($rest == "" ? "" : " - ") . $rest; } return $uri; }
function make_track_item($data, $add = "", $attr = "target='_blank'") { global $xoopsModuleConfig; $cdate = formatTimestamp($data['since'], "m"); $mdate = $data['mtime'] > 10 ? formatTimestamp($data['mtime'], "m") : _TB_WAIT_UPDATE; $url = $data['ref_url']; $nref = $data['nref']; $nurl = ""; if (isset($data['refs'])) { $nurl = _TB_REF_NURL . ": " . $data['n']; $refn = $data["refn"]; foreach ($data["refs"] as $ref) { $nurl .= " <a href='{$ref}'>[" . array_shift($refn) . "]</a>"; } $nurl = "<div class='trinfo'>{$nurl}</div>"; } $title = $data['title']; $len = max($xoopsModuleConfig['title_len'], 255); $alt = ""; if ($title == '') { $title = strim(myurldecode($url), $len); } elseif (strlen($title) > $len) { $alt = " title='{$title}'"; $title = mysubstr($title, 0, $len - 2) . ".."; } if ($data['context'] != '') { $ctext = _TB_LEADER . preg_replace(array('/<u>/', '/<\\/u>/'), array("<u class='anc'>", "</u>"), htmlspecialchars($data['context'])) . _TB_LEADER; } else { $ctext = ""; } return "<a href='{$url}'{$alt} {$attr} class='trtitle'>{$title}</a>{$add}" . "<div class='trtext'>{$ctext}</div>" . "<div class='trinfo'>" . _TB_REF_COUNT . ":{$nref} [" . _TB_REF_CDATE . " {$cdate}] [" . _TB_REF_MDATE . " {$mdate}]<br/>" . _TB_REF_URL . " <a href='{$url}'>" . myurldecode($url) . "</a></div>" . $nurl; }
if ($nrec) { $popt = $page > 1 ? "&page={$page}" : ""; $ordstr = sprintf($order == "nref DESC" ? "<b>%s</b>" : "<a href='index.php?id={$track_id}{$popt}'>%s</a>", _TB_ORDER_NREF) . " | " . sprintf($order == "mtime DESC" ? "<b>%s</b>" : "<a href='index.php?id={$track_id}&order=time{$popt}'>%s</a>", _TB_ORDER_TIME); $xoopsTpl->assign('page_control', make_page_index("{$ordstr} - " . _TB_PAGE, $nrec, $page, " <a href='index.php?id={$track_id}{$opt}&page=%d'>(%d)</a>")); $referers = array(); while ($data = $xoopsDB->fetchArray($result)) { $data['seq'] = ++$start; $data['cdate'] = formatTimestamp($data['since'], "m"); $data['mdate'] = formatTimestamp($data['mtime'], "m"); if (!$detail && $data['n'] > 1) { // url list $rsub = $xoopsDB->query("SELECT nref, ref_url, mtime FROM " . TBR . " WHERE {$cond} AND title=" . $xoopsDB->quoteString($data['title']) . " ORDER BY {$order}", 20); $refs = array(); $refn = array(); while (list($nref, $url) = $xoopsDB->fetchRow($rsub)) { $refs[] = $url; $refn[] = $nref; } $data["refs"] = $refs; $data["refn"] = $refn; $data["ref_url"] = $refs[0]; } if (empty($data['title'])) { $data['title'] = myurldecode($data['ref_url']); } $referers[] = $data; } $xoopsTpl->assign('referers', $referers); } } include XOOPS_ROOT_PATH . "/footer.php";