|
From: Arno H. <aho...@us...> - 2000-10-28 17:44:06
|
Update of /cvsroot/phpwiki/phpwiki/lib In directory slayer.i.sourceforge.net:/tmp/cvs-serv14355/lib Modified Files: config.php pgsql.php Log Message: pgsql patch (version7) from kb...@sa... Index: config.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/config.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** config.php 2000/10/25 14:41:32 1.8 --- config.php 2000/10/28 17:44:00 1.9 *************** *** 38,41 **** --- 38,42 ---- $LANG="C"; // (What should be the) Default: English // $LANG="nl"; // We all speak dutch, no? + // $LANG="es"; // We all speak spanish, no? if (!function_exists ('gettext')) { *************** *** 101,104 **** --- 102,108 ---- $WikiPageStore = "wiki"; // name of the table where pages are stored $ArchivePageStore = "archive"; // name of the table where pages are archived + $WikiLinksPageStore = "wikilinks"; + $HotTopicsPageStore = "hottopics"; + $HitCountPageStore = "hitcount"; $pg_dbhost = "localhost"; $pg_dbport = "5432"; Index: pgsql.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/pgsql.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** pgsql.php 2000/10/08 17:33:26 1.1 --- pgsql.php 2000/10/28 17:44:00 1.2 *************** *** 29,33 **** global $WikiDataBase, $pg_dbhost, $pg_dbport; ! $connectstring = "host=$pg_dbhost port=$pg_dbport dbname=$WikiDataBase"; if (!($dbc = pg_pconnect($connectstring))) { --- 29,35 ---- global $WikiDataBase, $pg_dbhost, $pg_dbport; ! $connectstring = $pg_dbhost?"host=$pg_dbhost ":""; ! $connectstring .= $pg_dbport?"pport=$pg_dbport ":""; ! $connectstring .= $WikiDataBase?"dbname=$WikiDataBase":""; if (!($dbc = pg_pconnect($connectstring))) { *************** *** 98,101 **** --- 100,109 ---- $pagehash["refs"] = serialize($pagehash["refs"]); + // Check for empty variables which can cause a sql error + if(empty($pagehash["created"])) + $pagehash["created"] = time(); + if(empty($pagehash["version"])) + $pagehash["version"] = 1; + // record the time of modification $pagehash["lastmodified"] = time(); *************** *** 237,242 **** function IsWikiPage($dbi, $pagename) { $pagename = addslashes($pagename); ! $query = "select count(*) from wiki where pagename='$pagename'"; $res = pg_exec($query); $array = pg_fetch_array($res, 0); --- 245,251 ---- 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); *************** *** 246,251 **** function IsInArchive($dbi, $pagename) { $pagename = addslashes($pagename); ! $query = "select count(*) from archive where pagename='$pagename'"; $res = pg_exec($query); $array = pg_fetch_array($res, 0); --- 255,261 ---- function IsInArchive($dbi, $pagename) { + global $ArchivePageStore; $pagename = addslashes($pagename); ! $query = "select count(*) from $ArchivePageStore where pagename='$pagename'"; $res = pg_exec($query); $array = pg_fetch_array($res, 0); *************** *** 318,327 **** function IncreaseHitCount($dbi, $pagename) { ! ! $query = "update hitcount set hits=hits+1 where pagename='$pagename'"; $res = pg_exec($dbi['dbc'], $query); if (!pg_cmdtuples($res)) { ! $query = "insert into hitcount (pagename, hits) " . "values ('$pagename', 1)"; $res = pg_exec($dbi['dbc'], $query); --- 328,337 ---- function IncreaseHitCount($dbi, $pagename) { ! global $HitCountPageStore; ! $query = "update $HitCountPageStore set hits=hits+1 where pagename='$pagename'"; $res = pg_exec($dbi['dbc'], $query); if (!pg_cmdtuples($res)) { ! $query = "insert into $HitCountPageStore (pagename, hits) " . "values ('$pagename', 1)"; $res = pg_exec($dbi['dbc'], $query); *************** *** 332,337 **** function GetHitCount($dbi, $pagename) { ! ! $query = "select hits from hitcount where pagename='$pagename'"; $res = pg_exec($dbi['dbc'], $query); if (pg_cmdtuples($res)) { --- 342,347 ---- function GetHitCount($dbi, $pagename) { ! global $HitCountPageStore; ! $query = "select hits from $HitCountPageStore where pagename='$pagename'"; $res = pg_exec($dbi['dbc'], $query); if (pg_cmdtuples($res)) { *************** *** 348,355 **** function InitMostPopular($dbi, $limit) { ! global $pg_most_pop_ctr; $pg_most_pop_ctr = 0; ! $query = "select * from hitcount " . "order by hits desc, pagename limit $limit"; $res = pg_exec($dbi['dbc'], $query); --- 358,365 ---- function InitMostPopular($dbi, $limit) { ! global $pg_most_pop_ctr, $HitCountPageStore; $pg_most_pop_ctr = 0; ! $query = "select * from $HitCountPageStore " . "order by hits desc, pagename limit $limit"; $res = pg_exec($dbi['dbc'], $query); *************** *** 369,374 **** function GetAllWikiPageNames($dbi) { ! ! $res = pg_exec($dbi['dbc'], "select pagename from wiki"); $rows = pg_numrows($res); for ($i = 0; $i < $rows; $i++) { --- 379,384 ---- function GetAllWikiPageNames($dbi) { ! global $WikiPageStore; ! $res = pg_exec($dbi['dbc'], "select pagename from $WikiPageStore"); $rows = pg_numrows($res); for ($i = 0; $i < $rows; $i++) { *************** *** 380,388 **** //////////////////////////////////////// // functionality for the wikilinks table ! /* // takes a page name, returns array of links function GetWikiPageLinks($dbi, $pagename) { ! ! $query = "select frompage from wikilinks where topage='$pagename'"; $res = pg_exec($dbi['dbc'], $query); $rows = pg_numrows($res); --- 390,398 ---- //////////////////////////////////////// // functionality for the wikilinks table ! // takes a page name, returns array of links function GetWikiPageLinks($dbi, $pagename) { ! global $WikiLinksPageStore; ! $query = "select frompage from $WikiLinksPageStore where topage='$pagename'"; $res = pg_exec($dbi['dbc'], $query); $rows = pg_numrows($res); *************** *** 399,407 **** function SetWikiPageLinks($dbi, $pagename, $linklist) { ! $frompage = addslashes($pagename); // first delete the old list of links ! $query = "delete from wikilinks where frompage='$frompage'"; // echo "$query<br>\n"; $res = pg_exec($dbi['dbc'], $query); --- 409,417 ---- function SetWikiPageLinks($dbi, $pagename, $linklist) { ! global $WikiLinksPageStore; $frompage = addslashes($pagename); // first delete the old list of links ! $query = "delete from $WikiLinksPageStore where frompage='$frompage'"; // echo "$query<br>\n"; $res = pg_exec($dbi['dbc'], $query); *************** *** 415,419 **** while (list($topage, $count) = each($linklist)) { $topage = addslashes($topage); ! $query = "insert into wikilinks (frompage, topage) " . "values ('$frompage', '$topage')"; // echo "$query<br>\n"; --- 425,429 ---- while (list($topage, $count) = each($linklist)) { $topage = addslashes($topage); ! $query = "insert into $WikiLinksPageStore (frompage, topage) " . "values ('$frompage', '$topage')"; // echo "$query<br>\n"; *************** *** 421,425 **** } } ! */ ?> --- 431,435 ---- } } ! ?> |