Grunt
04-11-2003, 03:41 PM
im doing some work on a skin that i downloaded; i found this in the phpinclude and wondering if anyone could ID the modification that it is 'using'?
if (strpos($_SERVER['PHP_SELF'], "index.php") != false)
{
function cutit($s, $threshold)
{
if (strlen($s) > $threshhold)
{
return substr($s, 0, $threshold) . "...";
}
else return $s;
}
$result = $DB_site->query("SELECT forum.forumid AS forumid, thread.threadid AS threadid, thread.title AS title
FROM forum
LEFT JOIN thread ON (thread.forumid = forum.forumid AND thread.lastpost = forum.lastpost)
WHERE displayorder <> 0 AND active = 1 AND thread.title <> \"\"");
$shash = $session['sessionhash'];
define("LASTPOST_ARRAYBIT", "if (document.all['lasttitle[forumid]'])
lasttitle[forumid].innerHTML = \"<a href=\\\"showthread.php?s=$shash&threadid=[threadid]\\\">[title]</a>\";");
$findbits = array("[forumid]", "[threadid]", "[title]");
$jslines = array();
while ($bits = $DB_site->fetch_array($result)) // single equals sign intended
{
$lastthreadid = $bits['threadid'];
$lasttitle = addslashes(cutit($bits['title'], 20));
$lastforumid = $bits['forumid'];
$replacebits = array($lastforumid, $lastthreadid, $lasttitle);
array_push($jslines, str_replace($findbits, $replacebits, LASTPOST_ARRAYBIT));
}
$jslines = implode("\n", $jslines);
}
if (strpos($_SERVER['PHP_SELF'], "index.php") != false)
{
function cutit($s, $threshold)
{
if (strlen($s) > $threshhold)
{
return substr($s, 0, $threshold) . "...";
}
else return $s;
}
$result = $DB_site->query("SELECT forum.forumid AS forumid, thread.threadid AS threadid, thread.title AS title
FROM forum
LEFT JOIN thread ON (thread.forumid = forum.forumid AND thread.lastpost = forum.lastpost)
WHERE displayorder <> 0 AND active = 1 AND thread.title <> \"\"");
$shash = $session['sessionhash'];
define("LASTPOST_ARRAYBIT", "if (document.all['lasttitle[forumid]'])
lasttitle[forumid].innerHTML = \"<a href=\\\"showthread.php?s=$shash&threadid=[threadid]\\\">[title]</a>\";");
$findbits = array("[forumid]", "[threadid]", "[title]");
$jslines = array();
while ($bits = $DB_site->fetch_array($result)) // single equals sign intended
{
$lastthreadid = $bits['threadid'];
$lasttitle = addslashes(cutit($bits['title'], 20));
$lastforumid = $bits['forumid'];
$replacebits = array($lastforumid, $lastthreadid, $lasttitle);
array_push($jslines, str_replace($findbits, $replacebits, LASTPOST_ARRAYBIT));
}
$jslines = implode("\n", $jslines);
}