From: <lfa...@us...> - 2004-03-09 14:21:09
|
Update of /cvsroot/tikiwiki/tiki/lib/structures In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13249/tikiwiki/lib/structures Modified Files: Tag: EXP-WIKI-FARM structlib.php Log Message: sync with HEAD and copy modified files from wikifarm. wikiwords bug was solved and wikifarm is now in menu. Index: structlib.php =================================================================== RCS file: /cvsroot/tikiwiki/tiki/lib/structures/structlib.php,v retrieving revision 1.46 retrieving revision 1.46.2.1 diff -u -d -r1.46 -r1.46.2.1 --- structlib.php 9 Feb 2004 18:20:21 -0000 1.46 +++ structlib.php 9 Mar 2004 14:03:25 -0000 1.46.2.1 @@ -1,12 +1,13 @@ <?php class StructLib extends TikiLib { - function StructLib($db) { + function StructLib($db, $wikiId=0) { # this is probably uneeded now if (!$db) { die ("Invalid db object passed to StructLib constructor"); } + $this->wikiId = $wikiId; $this->db = $db; } @@ -171,8 +172,8 @@ // if were not trying to add a duplicate structure head if ($created or isset($parent_id)) { //Get the page Id - $query = "select `page_id` from `tiki_pages` where `pageName`=?"; - $page_id = $this->getOne($query,array($name)); + $query = "select `page_id` from `tiki_pages` where `pageName`=? and wikiId=?"; + $page_id = $this->getOne($query,array($name, $this->wikiId)); if (isset($after_ref_id)) { $max = $this->getOne("select `pos` from `tiki_structures` where `page_ref_id`=?",array((int)$after_ref_id)); @@ -382,8 +383,8 @@ function page_is_in_structure($pageName) { $query = "select count(*) "; $query .= "from `tiki_structures` ts, `tiki_pages` tp "; - $query .= "where ts.`page_id`=tp.`page_id` and `pageName`=?"; - $cant = $this->getOne($query,array($pageName)); + $query .= "where ts.`page_id`=tp.`page_id` and `pageName`=? and `wikiId`=?"; + $cant = $this->getOne($query,array($pageName,$this->wikiId)); return $cant; } @@ -391,8 +392,8 @@ function get_struct_ref_if_head($pageName) { $query = "select `page_ref_id` "; $query .= "from `tiki_structures` ts, `tiki_pages` tp "; - $query .= "where ts.`page_id`=tp.`page_id` and (`parent_id` is null or `parent_id`=0) and `pageName`=?"; - $page_ref_id = $this->getOne($query,array($pageName)); + $query .= "where ts.`page_id`=tp.`page_id` and (`parent_id` is null or `parent_id`=0) and `pageName`=? and `wikiId`=?"; + $page_ref_id = $this->getOne($query,array($pageName,$this->wikiId)); return $page_ref_id; } @@ -401,8 +402,8 @@ function get_struct_ref_id($pageName) { $query = "select `page_ref_id` "; $query .= "from `tiki_structures` ts, `tiki_pages` tp "; - $query .= "where ts.`page_id`=tp.`page_id` and `pageName`=?"; - $page_ref_id = $this->getOne($query,array($pageName)); + $query .= "where ts.`page_id`=tp.`page_id` and `pageName`=? and wikiId=?"; + $page_ref_id = $this->getOne($query,array($pageName,$this->wikiId)); return $page_ref_id; } @@ -535,8 +536,8 @@ $structures_added = array(); $query = "select `page_ref_id` "; $query .= "from `tiki_structures` ts, `tiki_pages` tp "; - $query .= "where ts.`page_id`=tp.`page_id` and `pageName`=?"; - $result = $this->query($query,array($pageName)); + $query .= "where ts.`page_id`=tp.`page_id` and `pageName`=? and wikiId=?"; + $result = $this->query($query,array($pageName,$this->wikiId)); while ($res = $result->fetchRow()) { $next_page = $this->s_get_structure_info($res["page_ref_id"]); //Add each structure head only once @@ -600,11 +601,11 @@ if ($find) { $findesc = '%' . $find . '%'; - $mid = " where ts.`page_id`= tp.`page_id` and (`parent_id` is null or `parent_id`=0) and (tp.`pageName` like ?)"; - $bindvars=array($findesc); + $mid = " where ts.`page_id`= tp.`page_id` and (`parent_id` is null or `parent_id`=0) and (tp.`pageName` like ? and tp.`wikiId`=?)"; + $bindvars=array($findesc, $this->wikiId); } else { - $mid = " where ts.`page_id`= tp.`page_id` and (`parent_id` is null or `parent_id`=0) "; - $bindvars=array(); + $mid = " where ts.`page_id`= tp.`page_id` and (`parent_id` is null or `parent_id`=0) and tp.`wikiId`=?"; + $bindvars=array($this->wikiId); } $query = "select `page_ref_id`,`parent_id`,ts.`page_id`,`page_alias`,`pos`, @@ -791,6 +792,7 @@ } } -$structlib = new StructLib($dbTiki); +global $wikiId; +$structlib = new StructLib($dbTiki, $wikiId); ?> |