SourceForge logo
SourceForge logo
Menu

phpwiki-checkins

From: Steve W. <wai...@us...> - 2000年11月02日 04:24:03
Update of /cvsroot/phpwiki/phpwiki/lib
In directory slayer.i.sourceforge.net:/tmp/cvs-serv10176
Modified Files:
	pgsql.php 
Log Message:
Incoming, outgoing, and most popular top 5's appear to work now.
Index: pgsql.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/pgsql.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** pgsql.php	2000年11月02日 03:05:20	1.3
--- pgsql.php	2000年11月02日 04:23:59	1.4
***************
*** 11,14 ****
--- 11,15 ----
 SaveCopyToArchive($dbi, $pagename, $pagehash) 
 IsWikiPage($dbi, $pagename)
+ IsInArchive($dbi, $pagename)
 InitTitleSearch($dbi, $search)
 TitleSearchNextMatch($dbi, $res)
***************
*** 19,22 ****
--- 20,24 ----
 InitMostPopular($dbi, $limit)
 MostPopularNextMatch($dbi, $res)
+ GetAllWikiPageNames($dbi)
 GetWikiPageLinks($dbi, $pagename)
 SetWikiPageLinks($dbi, $pagename, $linklist)
***************
*** 84,92 ****
 function InsertPage($dbi, $pagename, $pagehash) {
 $pagename = addslashes($pagename);
- // echo "<p>dbi in InsertPage: '$dbi' '$dbi[table]' '$dbi[dbc]'<p>";
 
 // update the wikilinks table
! // UpdateWikiLinks($dbi, $pagename, implode(" ",$pagehash['content']));
 
 // prepare the content for storage
 if (!isset($pagehash["pagename"]))
--- 86,95 ----
 function InsertPage($dbi, $pagename, $pagehash) {
 $pagename = addslashes($pagename);
 
 // update the wikilinks table
! $linklist = ExtractWikiPageLinks($pagehash['content']);
! SetWikiPageLinks($dbi, $pagename, $linklist);
 
+ 
 // prepare the content for storage
 if (!isset($pagehash["pagename"]))
***************
*** 203,251 ****
 
 
- function UpdateWikiLinks($dbi, $pagename, $pagetext) {
- 
- global $AllowedProtocols;
- // extract all links from the page, both [] and OldStyle
- 
- // this is [bracketlinks]
- $numBracketLinks = preg_match_all("/\[.+?\]/s", $pagetext, $brktlinks);
- 
- // this is OldSchoolLinking
- $numWikiLinks = preg_match_all("#!?\b(([A-Z][a-z]+){2,})\b#",
- $pagetext, $wikilinks);
- 
- for ($x = 0; $x < $numWikiLinks; $x++) {
- if (preg_match("/^!/", $wikilinks[0][$x]))
- continue;
- $alllinks[$wikilinks[0][$x]]++;
- //echo "MATCH: ", $wikilinks[0][$x], "<P>\n";
- //echo "assigned ", $alllinks[$wikilinks[0][$x]], " ", $wikilinks[0][$x], " <br>\n";
- }
- 
- for ($x = 0; $x < $numBracketLinks; $x++) {
- // skip escaped bracket sets [[like this]
- if (preg_match("/^\[\[/", $brktlinks[0][$x]))
- continue;
- // skip anything with an allowed protocol
- if (preg_match("/$AllowedProtocols/", $brktlinks[0][$x]))
- continue;
- 
- 
- $alllinks[$brktlinks[0][$x]]++;
- 
- //echo "MATCH: ", $brktlinks[0][$x], "<P>\n";
- //echo "assigned ", $alllinks[$brktlinks[0][$x]], " ", $brktlinks[0][$x], " <br>\n";
- }
- 
- // call the right function to update the table
- SetWikiPageLinks($dbi, $pagename, $alllinks);
- 
- }
- 
- 
 function IsWikiPage($dbi, $pagename) {
 global $WikiPageStore; 	
 $pagename = addslashes($pagename);
! $query = "select count(*) from $WikiPageStore where pagename='$pagename'";
 $res = pg_exec($query);
 $array = pg_fetch_array($res, 0);
--- 206,214 ----
 
 
 function IsWikiPage($dbi, $pagename) {
 global $WikiPageStore; 	
 $pagename = addslashes($pagename);
! $query = "select count(*) from $WikiPageStore " .
! "where pagename='$pagename'";
 $res = pg_exec($query);
 $array = pg_fetch_array($res, 0);
***************
*** 257,261 ****
 	 global $ArchivePageStore;
 $pagename = addslashes($pagename);
! $query = "select count(*) from $ArchivePageStore where pagename='$pagename'";
 $res = pg_exec($query);
 $array = pg_fetch_array($res, 0);
--- 220,225 ----
 	 global $ArchivePageStore;
 $pagename = addslashes($pagename);
! $query = "select count(*) from $ArchivePageStore " .
! "where pagename='$pagename'";
 $res = pg_exec($query);
 $array = pg_fetch_array($res, 0);
***************
*** 274,278 ****
 $query = "select pagename from $dbi[table] where lower(pagename) " .
 "like '%$search%' order by pagename";
! // echo "search query: $query<br>\n";
 $res = pg_exec($dbi["dbc"], $query);
 
--- 238,242 ----
 $query = "select pagename from $dbi[table] where lower(pagename) " .
 "like '%$search%' order by pagename";
! //echo "search query: $query<br>\n";
 $res = pg_exec($dbi["dbc"], $query);
 
***************
*** 394,405 ****
 function GetWikiPageLinks($dbi, $pagename) {
 global $WikiLinksPageStore;
! $query = "select frompage from $WikiLinksPageStore where topage='$pagename'";
! $res = pg_exec($dbi['dbc'], $query);
 $rows = pg_numrows($res);
 for ($i = 0; $i < $rows; $i++) {
! 	 $pages[$i] = pg_result($res, $i, "frompage");
 }
! return $pages;
! 
 }
 
--- 358,386 ----
 function GetWikiPageLinks($dbi, $pagename) {
 global $WikiLinksPageStore;
! $pagename = addslashes($pagename);
! 
! $res = pg_exec("select topage, score from wikilinks, wikiscore where topage=pagename and frompage='$pagename' order by score desc, topage");
 $rows = pg_numrows($res);
 for ($i = 0; $i < $rows; $i++) {
! 	 $out = pg_fetch_array($res, $i);
! 	 $links['out'][] = array($out['topage'], $out['score']);
 }
! 
! $res = pg_exec("select frompage, score from wikilinks, wikiscore where frompage=pagename and topage='$pagename' order by score desc, frompage");
! $rows = pg_numrows($res);
! for ($i = 0; $i < $rows; $i++) {
! 	 $out = pg_fetch_array($res, $i);
! 	 $links['in'][] = array($out['frompage'], $out['score']);
! }
! 
! $res = pg_exec("select distinct pagename, hits from wikilinks, hitcount where (frompage=pagename and topage='$pagename') or (topage=pagename and frompage='$pagename') order by hits desc, pagename");
! $rows = pg_numrows($res);
! for ($i = 0; $i < $rows; $i++) {
! 	 $out = pg_fetch_array($res, $i);
! 	 $links['popular'][] = array($out['pagename'], $out['hits']);
! }
! 
! return $links;
! 
 }
 
***************
*** 414,418 ****
 // first delete the old list of links
 $query = "delete from $WikiLinksPageStore where frompage='$frompage'";
! // echo "$query<br>\n";
 $res = pg_exec($dbi['dbc'], $query);
 
--- 395,399 ----
 // first delete the old list of links
 $query = "delete from $WikiLinksPageStore where frompage='$frompage'";
! //echo "$query<br>\n";
 $res = pg_exec($dbi['dbc'], $query);
 
***************
*** 425,433 ****
 while (list($topage, $count) = each($linklist)) {
 $topage = addslashes($topage);
! $query = "insert into $WikiLinksPageStore (frompage, topage) " .
! "values ('$frompage', '$topage')";
! // echo "$query<br>\n";
! $res = pg_exec($dbi['dbc'], $query);
 }
 }
 
--- 406,420 ----
 while (list($topage, $count) = each($linklist)) {
 $topage = addslashes($topage);
! if ($topage != $frompage) {
! $query = "insert into $WikiLinksPageStore (frompage, topage) " .
! "values ('$frompage', '$topage')";
! //echo "$query<br>\n";
! $res = pg_exec($dbi['dbc'], $query);
! }
 }
+ // update pagescore
+ pg_exec("delete from wikiscore");
+ pg_exec("insert into wikiscore select w1.topage, count(*) from wikilinks as w1, wikilinks as w2 where w2.topage=w1.frompage group by w1.topage");
+ 
 }
 
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /