From: <lfa...@us...> - 2004-03-09 14:21:09
|
Update of /cvsroot/tikiwiki/tiki/lib/wiki In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13249/tikiwiki/lib/wiki Modified Files: Tag: EXP-WIKI-FARM histlib.php wikilib.php Log Message: sync with HEAD and copy modified files from wikifarm. wikiwords bug was solved and wikifarm is now in menu. Index: histlib.php =================================================================== RCS file: /cvsroot/tikiwiki/tiki/lib/wiki/histlib.php,v retrieving revision 1.8.2.1 retrieving revision 1.8.2.2 diff -u -d -r1.8.2.1 -r1.8.2.2 --- histlib.php 27 Feb 2004 05:20:37 -0000 1.8.2.1 +++ histlib.php 9 Mar 2004 14:03:26 -0000 1.8.2.2 @@ -121,9 +121,9 @@ // function parameters modified by ramiro_v on 11/03/2002 function get_last_changes($days, $offset = 0, $limit = -1, $sort_mode = 'lastModif_desc', $findwhat = '') { - $where = "where (th.`version` != '' or tp.`version` != '') and `wikiId`=? "; + $where = "where (th.`version` != '' or tp.`version` != '') and ta.`wikiId`=? and th.`wikiId`=?"; if ($findwhat == '') { - $bindvars=array($this->wikiId); + $bindvars=array($this->wikiId, $this->wikiId); } else { $findstr='%' . $findwhat . '%'; $where.= " and (ta.`pageName` like ? or ta.`user` like ? or ta.`comment` like ?)"; @@ -170,8 +170,7 @@ } } -$wikiId=0; -if (isset($_REQUEST['wikiId'])) $wikiId=$_REQUEST['wikiId']; +global $wikiId; $histlib = new HistLib($dbTiki, $wikiId); ?> Index: wikilib.php =================================================================== RCS file: /cvsroot/tikiwiki/tiki/lib/wiki/wikilib.php,v retrieving revision 1.50.2.1 retrieving revision 1.50.2.2 diff -u -d -r1.50.2.1 -r1.50.2.2 --- wikilib.php 27 Feb 2004 05:20:37 -0000 1.50.2.1 +++ wikilib.php 9 Mar 2004 14:03:26 -0000 1.50.2.2 @@ -13,7 +13,7 @@ die ("Invalid db object passed to WikiLib constructor"); } - $this->wikiId = (int)$id; + $this->id = (int)$id; $this->db = $db; } @@ -87,7 +87,7 @@ } function get_creator($name) { - return $this->getOne("select `creator` from `tiki_pages` where `pageName`=? and wikiId=?", array($name, $this->wikiId)); + return $this->getOne("select `creator` from `tiki_pages` where `pageName`=? and wikiId=?", array($name, $this->id)); } function wiki_page_graph(&$str, &$graph, $garg) { @@ -102,7 +102,7 @@ )); $graph->addNode("$page", array( - 'URL' => "tiki-index.php?page=" . urlencode(addslashes($page)), + 'URL' => "tiki-index.php?page=" . urlencode(addslashes($page)), #TODO WikiFarm check this 'label' => "$page", 'fontname' => (isset($garg['node']['fontname']))?$garg['node']['fontname']:"Arial", 'fontsize' => (isset($garg['node']['fontsize']))?$garg['node']['fontsize']:'9', @@ -136,7 +136,7 @@ function wiki_get_link_structure($page, $level) { $query = "select `toPage` from `tiki_links` where `fromPage`=? and `wikiId`=?"; - $result = $this->query($query,array($page, $this->wikiId)); + $result = $this->query($query,array($page, $this->id)); $aux['pages'] = array(); $aux['name'] = $page; @@ -171,22 +171,22 @@ // 1st rename the page in tiki_pages, using a tmpname inbetween for // rename pages like ThisTestpage to ThisTestPage $query = "update `tiki_pages` set `pageName`=? where `pageName`=? and `wikiId`=?"; - $this->query($query, array( $tmpName, $oldName, $this->wikiId ) ); + $this->query($query, array( $tmpName, $oldName, $this->id ) ); $query = "update `tiki_pages` set `pageName`=? where `pageName`=? and `wikiId`=?"; - $this->query($query, array( $newName, $tmpName, $this->wikiId ) ); + $this->query($query, array( $newName, $tmpName, $this->id ) ); // correct pageName in tiki_history, using a tmpname inbetween for // rename pages like ThisTestpage to ThisTestPage $query = "update `tiki_history` set `pageName`=? where `pageName`=? and `wikiId`=?"; - $this->query($query, array( $tmpName, $oldName, $this->wikiId ) ); + $this->query($query, array( $tmpName, $oldName, $this->id ) ); $query = "update `tiki_history` set `pageName`=? where `pageName`=? and `wikiId`=?"; - $this->query($query, array( $newName, $tmpName, $this->wikiId ) ); + $this->query($query, array( $newName, $tmpName, $this->id ) ); // get pages linking to the old page $query = "select `fromPage` from `tiki_links` where `toPage`=? and `wikiId`=?"; - $result = $this->query($query, array( $oldName, $this->wikiId ) ); + $result = $this->query($query, array( $oldName, $this->id ) ); while ($res = $result->fetchRow()) { $page = $res['fromPage']; @@ -198,20 +198,20 @@ $data = preg_replace("/(?<= |\n|\t|\r|\,|\;|^)$oldName(?= |\n|\t|\r|\,|\;|$)/", $newName, $data); $data = preg_replace("/(?<=\(\()$oldName(?=\)\)|\|)/", $newName, $data); $query = "update `tiki_pages` set `data`=?,`page_size`=? where `pageName`=? and `wikiId`=?"; - $this->query($query, array( $data,(int) strlen($data), $page, $this->wikiId)); + $this->query($query, array( $data,(int) strlen($data), $page, $this->id)); $this->invalidate_cache($page); } // correct toPage and fromPage in tiki_links $query = "update `tiki_links` set `fromPage`=? where `fromPage`=? and `wikiId`=?"; - $this->query($query, array( $newName, $oldName, $this->wikiId)); + $this->query($query, array( $newName, $oldName, $this->id)); $query = "update `tiki_links` set `toPage`=? where `toPage`=? and `wikiId`=?"; - $this->query($query, array( $newName, $oldName, $this->wikiId)); + $this->query($query, array( $newName, $oldName, $this->id)); // tiki_footnotes change pageName $query = "update `tiki_page_footnotes` set `pageName`=? where `pageName`=? and `wikiId`=?"; - $this->query($query, array( $newName, $oldName, $this->wikiId )); + $this->query($query, array( $newName, $oldName, $this->id )); // Build objectId using 'wiki page' and the name $oldId = 'wiki page' + md5($oldName); @@ -220,7 +220,7 @@ // in tiki_categorized_objects update objId $newcathref = 'tiki-index.php?page=' . urlencode($newName); $query = "update `tiki_categorized_objects` set `objId`=?,`name`=?,`href`=? where `objId`=?"; - $this->query($query, array( $newName, $newName, $newcathref, $oldName)); #TODO KIWI check this + $this->query($query, array( $newName, $newName, $newcathref, $oldName)); #TODO WikiFarm check this // old code that doesn't seem to be working // $query = "update tiki_categorized_objects set objId='$newId' where objId='$oldId'"; @@ -239,7 +239,7 @@ $this->query($query, array( $newId, $newName, $oldId ) ); $query = "update `tiki_wiki_attachments` set `page`=? where `page`=? and `wikiId`=?"; - $this->query($query, array( $newName, $oldName, $this->wikiId ) ); + $this->query($query, array( $newName, $oldName, $this->id ) ); // group home page $query = "update `users_groups` set `groupHome`=? where `groupHome`=?"; @@ -250,7 +250,7 @@ function set_page_cache($page,$cache) { $query = "update `tiki_pages` set `wiki_cache`=? where `pageName`=? and `wikiId`=?"; - $this->query($query, array( $cache, $page, $this->wikiId)); + $this->query($query, array( $cache, $page, $this->id)); } // huho why that fuction is empty ?? @@ -262,7 +262,7 @@ function get_cache_info($page) { $query = "select `cache`,`cache_timestamp` from `tiki_pages` where `pageName`=? and `wikiId`=?"; - $result = $this->query($query, array( $page, $this->wikiId ) ); + $result = $this->query($query, array( $page, $this->id ) ); $res = $result->fetchRow(); return $res; } @@ -271,7 +271,7 @@ $now = date('U'); $query = "update `tiki_pages` set `cache`=?, cache_timestamp=$now where `pageName`=? and `wikiId`=?"; - $result = $this->query($query, array( $data, $page, $this->wikiId ) ); + $result = $this->query($query, array( $data, $page, $this->id ) ); return true; } @@ -296,17 +296,17 @@ $comment = strip_tags($comment); $now = date("U"); $query = "insert into `tiki_wiki_attachments`(`wikiId`,`page`,`filename`,`filesize`,`filetype`,`data`,`created`,`downloads`,`user`,`comment`,`path`) values(?,?,?,?,?,?,?,0,?,?,?)"; - $result = $this->query($query,array($this->wikiId, "$page","$name", (int) $size,"$type","$data", (int) $now,"$user","$comment","$fhash")); + $result = $this->query($query,array($this->id, "$page","$name", (int) $size,"$type","$data", (int) $now,"$user","$comment","$fhash")); } function list_wiki_attachments($page, $offset, $maxRecords, $sort_mode, $find) { if ($find) { $mid = " where `page`=? and `filename` like ? and `wikiId`=?"; - $bindvars=array($page,"%".$find."%", $this->wikiId); + $bindvars=array($page,"%".$find."%", $this->id); } else { $mid = " where `page`=? and `wikiId`=? "; - $bindvars=array($page, $this->wikiId); + $bindvars=array($page, $this->id); } $query = "select `user`,`attId`,`page`,`filename`,`filesize`,`filetype`,`downloads`,`created`,`comment` from `tiki_wiki_attachments` $mid order by ".$this->convert_sortmode($sort_mode); @@ -328,38 +328,38 @@ // Functions for wiki page footnotes function get_footnote($user, $page) { - $count = $this->getOne("select count(*) from `tiki_page_footnotes` where `user`=? and `pageName`=? and `wikiId`=?",array($user,$page, $this->wikiId)); + $count = $this->getOne("select count(*) from `tiki_page_footnotes` where `user`=? and `pageName`=? and `wikiId`=?",array($user,$page, $this->id)); if (!$count) { return ''; } else { - return $this->getOne("select `data` from `tiki_page_footnotes` where `user`=? and `pageName`=? and `wikiId`=?",array($user,$page, $this->wikiId)); + return $this->getOne("select `data` from `tiki_page_footnotes` where `user`=? and `pageName`=? and `wikiId`=?",array($user,$page, $this->id)); } } function replace_footnote($user, $page, $data) { $querydel = "delete from `tiki_page_footnotes` where `user`=? and `pageName`=? and `wikiId`=?"; - $this->query($querydel,array($user, $page, $this->wikiId),-1,-1,false); + $this->query($querydel,array($user, $page, $this->id),-1,-1,false); $query = "insert into `tiki_page_footnotes`(`user`,`wikiId`,`pageName`,`data`) values(?,?,?)"; - $this->query($query,array($user,$this->wikiId, $page,$data)); + $this->query($query,array($user,$this->id, $page,$data)); } function remove_footnote($user, $page) { $query = "delete from `tiki_page_footnotes` where `user`=? and `pageName`=? and `wikiId`=?"; - $this->query($query,array($user,$page, $this->wikiId)); + $this->query($query,array($user,$page, $this->id)); } function wiki_link_structure() { $query = "select `pageName` from `tiki_pages` where `wikiId`=? order by ".$this->convert_sortmode("pageName_asc"); - $result = $this->query($query, array($this->wikiId)); + $result = $this->query($query, array($this->id)); while ($res = $result->fetchRow()) { print ($res["pageName"] . " "); $page = $res["pageName"]; $query2 = "select `toPage` from `tiki_links` where `fromPage`=? and `wikiId`=?"; - $result2 = $this->query($query2, array( $page, $this->wikiId ) ); + $result2 = $this->query($query2, array( $page, $this->id ) ); $pages = array(); while ($res2 = $result2->fetchRow()) { @@ -380,7 +380,7 @@ $this->invalidate_cache($page); $query = "select * from `tiki_history` where `pageName`=? and `wikiId`=? order by ".$this->convert_sortmode("lastModif_desc"); - $result = $this->query($query, array( $page, $this->wikiId ) ); + $result = $this->query($query, array( $page, $this->id ) ); if ($result->numRows()) { // We have a version @@ -395,7 +395,7 @@ $action = "Removed last version"; $t = date("U"); $query = "insert into `tiki_actionlog`( `action`, `wikiId`, `pageName`, `lastModif`, `user`, `ip`, `comment`) values( ?, ?, ?, ?, ?, ?, ?)"; - $result = $this->query($query, array( $action, $this->wikiId, $page, $t, "admin", $_SERVER["REMOTE_ADDR"], $comment ) ); + $result = $this->query($query, array( $action, $this->id, $page, $t, "admin", $_SERVER["REMOTE_ADDR"], $comment ) ); } // Like pages are pages that share a word in common with the current page @@ -414,7 +414,7 @@ $exp = implode(" or ", $exps); $query = "select `pageName` from `tiki_pages` where ($exp) and `wikiId`=? "; - $bindvars[] = $this->wikiId; + $bindvars[] = $this->id; $result = $this->query($query,$bindvars); $ret = array(); @@ -427,7 +427,7 @@ function is_locked($page) { $query = "select `flag` from `tiki_pages` where `pageName`=? and `wikiId`=?"; - $result = $this->query($query, array( $page, $this->wikiId ) ); + $result = $this->query($query, array( $page, $this->id ) ); $res = $result->fetchRow(); if ($res["flag"] == 'L') @@ -440,12 +440,12 @@ global $user; $query = "update `tiki_pages` set `flag`=? where `pageName`=? and `wikiId`=?"; - $result = $this->query($query, array( "L",$page, $this->wikiId ) ); + $result = $this->query($query, array( "L",$page, $this->id ) ); if (isset($user)) { $query = "update `tiki_pages` set `user`=? where `pageName`=? and `wikiId`=?"; - $result = $this->query($query, array( $user, $page, $this->wikiId ) ); + $result = $this->query($query, array( $user, $page, $this->id ) ); } return true; @@ -453,14 +453,14 @@ function unlock_page($page) { $query = "update `tiki_pages` set `flag`='' where `pageName`=? and `wikiId`=?"; - $result = $this->query($query, array( $page, $this->wikiId ) ); + $result = $this->query($query, array( $page, $this->id ) ); return true; } // Returns backlinks for a given page function get_backlinks($page) { $query = "select `fromPage` from `tiki_links` where `toPage` = ? and `wikiId`=?"; - $result = $this->query($query, array( $page, $this->wikiId )); + $result = $this->query($query, array( $page, $this->id )); $ret = array(); while ($res = $result->fetchRow()) { @@ -523,11 +523,11 @@ } function replace_wiki($wikiId, $name, $description) { - $bindvars = array((int)$wikiId, $name, $description); + if ((int)$wikiId) { $this->query("replace into tiki_wikis (wikiId, name, description) values (?,?,?)", array((int)$wikiId, $name, $description)); } else { - $this->query("insert into tiki_wikis (name, description, created) values (?,?,now())", array($name, $description)); + $this->query("insert into tiki_wikis (name, description, created) values (?,?,?)", array($name, $description, time())); } return true; } @@ -566,4 +566,4 @@ $wikiId = isset($_REQUEST['wikiId']) ? $_REQUEST['wikiId'] : 0; $wikilib = new WikiLib($dbTiki, $wikiId); -?> +?> \ No newline at end of file |