\n"), htmlspecialchars($page)); continue; } while (list($i, $line) = each($pagedata['content'])) { if (preg_match($pos['search'], $line)) return $page; } } return 0; } function IncreaseHitCount($dbi, $pagename) { return; return; // kluge: we ignore the $dbi for hit counting global $WikiDB; $hcdb = OpenDataBase($WikiDB['hitcount']); if (dbmexists($hcdb['active'], $pagename)) { // increase the hit count $count = dbmfetch($hcdb['active'], $pagename); $count++; dbmreplace($hcdb['active'], $pagename, $count); } else { // add it, set the hit count to one $count = 1; dbminsert($hcdb['active'], $pagename, $count); } CloseDataBase($hcdb); } function GetHitCount($dbi, $pagename) { return; // kluge: we ignore the $dbi for hit counting global $WikiDB; $hcdb = OpenDataBase($WikiDB['hitcount']); if (dbmexists($hcdb['active'], $pagename)) { // increase the hit count $count = dbmfetch($hcdb['active'], $pagename); return $count; } else { return 0; } CloseDataBase($hcdb); } function InitMostPopular($dbi, $limit) { return; $pagename = dbmfirstkey($dbi['hitcount']); $res[$pagename] = dbmfetch($dbi['hitcount'], $pagename); while ($pagename = dbmnextkey($dbi['hitcount'], $pagename)) { $res[$pagename] = dbmfetch($dbi['hitcount'], $pagename); echo "got $pagename with value " . $res[$pagename] . "
\n"; } rsort($res); reset($res); return($res); } function MostPopularNextMatch($dbi, $res) { return; // the return result is a two element array with 'hits' // and 'pagename' as the keys if (list($index1, $index2, $pagename, $hits) = each($res)) { echo "most popular next match called
\n"; echo "got $pagename, $hits back
\n"; $nextpage = array( "hits" => $hits, "pagename" => $pagename ); return $nextpage; } else { return 0; } } function GetAllWikiPagenames($dbi) { $namelist = array(); $d = opendir($dbi); while($entry = readdir($d)) { if ($entry == '.' || $entry == '..') continue; $pagename = rawurldecode($entry); if ($entry != EncodePagename($pagename)) { printf(gettext("%s: Bad filename in database
\n"), htmlspecialchars("$dbi/$entry")); continue; } $namelist[] = $pagename; } return $namelist; } ?>