diff options
| -rw-r--r-- | BitPage.php | 490 | ||||
| -rw-r--r-- | admin/schema_inc.php | 46 | ||||
| -rw-r--r-- | admin/upgrades/1.0.1.php | 24 | ||||
| -rw-r--r-- | liberty_plugins/data.wikigraph.php | 135 | ||||
| -rw-r--r-- | received_pages.php | 117 | ||||
| -rw-r--r-- | templates/received_pages.tpl | 85 | ||||
| -rw-r--r-- | wiki_graph.php | 57 |
7 files changed, 173 insertions, 781 deletions
diff --git a/BitPage.php b/BitPage.php index 93d4117..28fde49 100644 --- a/BitPage.php +++ b/BitPage.php @@ -1,11 +1,11 @@ <?php /** - * @version $Header: /cvsroot/bitweaver/_bit_wiki/BitPage.php,v 1.115 2008/10/25 01:24:05 wjames5 Exp $ + * @version $Header: /cvsroot/bitweaver/_bit_wiki/BitPage.php,v 1.116 2008/11/13 09:39:03 squareing Exp $ * @package wiki * * @author spider <spider@steelsun.com> * - * @version $Revision: 1.115 $ $Date: 2008/10/25 01:24:05 $ $Author: wjames5 $ + * @version $Revision: 1.116 $ $Date: 2008/11/13 09:39:03 $ $Author: squareing $ * * Copyright (c) 2004 bitweaver.org * Copyright (c) 2003 tikwiki.org @@ -13,7 +13,7 @@ * All Rights Reserved. See copyright.txt for details and a complete list of authors. * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details * - * $Id: BitPage.php,v 1.115 2008/10/25 01:24:05 wjames5 Exp $ + * $Id: BitPage.php,v 1.116 2008/11/13 09:39:03 squareing Exp $ */ /** @@ -111,8 +111,7 @@ class BitPage extends LibertyMime { } return( count( $this->mInfo ) ); } - // }}} - // {{{ store + /** * This is the ONLY method that should be called in order to store (create or update) a wiki page! * It is very smart and will figure out what to do for you. It should be considered a black box. @@ -187,10 +186,9 @@ class BitPage extends LibertyMime { $this->mDb->CompleteTrans(); return( count( $this->mErrors ) == 0 ); } - // }}} - // {{{ verify + /** - * This function is responsible for data integrity and validation before any operations are performed with the $pParamHash + * verify This function is responsible for data integrity and validation before any operations are performed with the $pParamHash * NOTE: This is a PRIVATE METHOD!!!! do not call outside this class, under penalty of death! * * @param array pParams reference to hash of values that will be used to store the page, they will be modified where necessary @@ -350,12 +348,12 @@ class BitPage extends LibertyMime { /** * Store footnote */ - function storeFootnote($pUserId, $data) { + function storeFootnote($pUserId, $pData) { if( $this->verifyId( $this->mPageId ) ) { $querydel = "delete from `".BIT_DB_PREFIX."wiki_footnotes` where `user_id`=? and `page_id`=?"; $this->mDb->query( $querydel, array( $pUserId, $this->mPageId ) ); $query = "insert into `".BIT_DB_PREFIX."wiki_footnotes`(`user_id`,`page_id`,`data`) values(?,?,?)"; - $this->mDb->query( $query, array( $pUserId, $this->mPageId, $data ) ); + $this->mDb->query( $query, array( $pUserId, $this->mPageId, $pData ) ); } } @@ -742,7 +740,7 @@ class BitPage extends LibertyMime { $this->mErrors['page_id'] = "You must specify a where condition"; return false; } - + $query = "update `".BIT_DB_PREFIX."liberty_content` lc LEFT JOIN `".BIT_DB_PREFIX."wiki_pages` wp on (wp.`content_id`= lc.`content_id`) SET ".implode(',', $set)." @@ -752,22 +750,36 @@ class BitPage extends LibertyMime { } // ...page... functions - function countSubPages($data) { - // we always have at least one page - return( (preg_match_all( '/'.(defined('PAGE_SEP') ? preg_quote(PAGE_SEP) : '\.\.\.page\.\.\.').'/', $data, $matches ) + 1) ); + function countSubPages( $pData ) { + return(( preg_match_all( '/'.( defined( 'PAGE_SEP' ) ? preg_quote( PAGE_SEP ) : '\.\.\.page\.\.\.').'/', $pData, $matches ) + 1 )); } - function getSubPage($data, $i) { + /** + * getSubPage + * + * @param array $pData + * @param array $pPageNumber + * @access public + * @return string SubPage + */ + function getSubPage( $pData, $pPageNumber ) { // Get slides - $parts = explode(defined('PAGE_SEP') ? PAGE_SEP : "...page...", $data); - if (substr($parts[$i - 1], 1, 5) == "<br/>") - $ret = substr($parts[$i - 1], 6); - else - $ret = $parts[$i - 1]; + $parts = explode( defined( 'PAGE_SEP' ) ? PAGE_SEP : "...page...", $pData ); + if( substr( $parts[$pPageNumber - 1], 1, 5 ) == "<br/>" ) { + $ret = substr( $parts[$pPageNumber - 1], 6 ); + } else { + $ret = $parts[$pPageNumber - 1]; + } return $ret; } - // Like pages are pages that share a word in common with the current page + /** + * getLikePages Like pages are pages that share a word in common with the current page + * + * @param array $pPageTitle + * @access public + * @return boolean TRUE on success, FALSE on failure - $this->mErrors will contain reason for failure + */ function getLikePages( $pPageTitle ) { $ret = array(); if( !empty( $pPageName ) ) { @@ -796,6 +808,12 @@ class BitPage extends LibertyMime { return $ret; } + /** + * getStats getStats is always used by the stats package to display various stats of your package. + * + * @access public + * @return boolean TRUE on success, FALSE on failure - $this->mErrors will contain reason for failure + */ function getStats() { global $gBitSystem; $ret = array(); @@ -857,393 +875,83 @@ class BitPage extends LibertyMime { return $ret; } -} - -define('PLUGINS_DIR', WIKI_PKG_PATH.'plugins'); -/** - * @package wiki - */ -class WikiLib extends BitPage { - function WikiLib() { - BitPage::BitPage(); - } - function wiki_page_graph(&$str, &$graph, $garg) { - $page = $str['name']; - $graph->addAttributes(array( - 'nodesep' => (isset($garg['att']['nodesep']))?$garg['att']['nodesep']:".1", - 'rankdir' => (isset($garg['att']['rankdir']))?$garg['att']['rankdir']:'LR', - 'size' => (isset($garg['att']['size']))?$garg['att']['size']:'6', - 'bgcolor' => (isset($garg['att']['bgcolor']))?$garg['att']['bgcolor']:'transparent', - 'URL' => WIKI_PKG_URL.'index.php' - )); - $graph->addNode("$page", array( - 'URL' => WIKI_PKG_URL."index.php?page=" . urlencode(addslashes($page)), - 'label' => "$page", - 'fontname' => (isset($garg['node']['fontname']))?$garg['node']['fontname']:"Verdana", - 'fontsize' => (isset($garg['node']['fontsize']))?$garg['node']['fontsize']:'10', - 'shape' => (isset($garg['node']['shape']))?$garg['node']['shape']:'ellipse', - 'color' => (isset($garg['node']['color']))?$garg['node']['color']:'#AAAAAA', - 'style' => (isset($garg['node']['style']))?$garg['node']['style']:'filled', - 'fillcolor' => (isset($garg['node']['fillcolor']))?$garg['node']['fillcolor']:'#FFFFFF', - 'width' => (isset($garg['node']['width']))?$garg['node']['width']:'.5', - 'height' => (isset($garg['node']['height']))?$garg['node']['height']:'.25' - )); - //print("add node $page<br/>"); - foreach ($str['pages'] as $neig) { - $this->wiki_page_graph($neig, $graph, $garg); - $graph->addEdge(array("$page" => $neig['name']), array( - 'color' => (isset($garg['edge']['color']))?$garg['edge']['color']:'#998877', - 'style' => (isset($garg['edge']['style']))?$garg['edge']['style']:'solid', - )); - //print("add edge $page to ".$neig['name']."<br/>"); - } - } + // {{{ ==================================== GraphViz wiki graph methods ==================================== + /** + * linkStructureGraph + * + * @param array $pLinkStructure + * @param array $pParams + * @param array $pGraphViz + * @access public + * @return boolean TRUE on success, FALSE on failure - $this->mErrors will contain reason for failure + */ + function linkStructureGraph( $pLinkStructure = array(), $pParams = array(), &$pGraphViz ) { + if( !empty( $pLinkStructure ) && !empty( $pGraphViz )) { + $pParams['graph']['URL'] = WIKI_PKG_URL.'index.php'; + $pGraphViz->addAttributes( $pParams['graph'] ); - function get_graph_map($page, $level, $garg) { - include_once( UTIL_PKG_PATH.'GraphViz.php' ); - $str = $this->wiki_get_link_structure($page, $level); - $graph = new Image_GraphViz(); - $this->wiki_page_graph($str, $graph, $garg); - return $graph->fetch( 'cmap' ); - } + $pParams['node']['URL'] = $this->getDisplayUrl( $pLinkStructure['name'] ); + $pGraphViz->addNode( $pLinkStructure['name'], $pParams['node'] ); - function wiki_get_link_structure($page, $level) { - $query = "select lc2.`title` from `".BIT_DB_PREFIX."liberty_content_links` lcl - INNER JOIN liberty_content lc1 ON lc1.`content_id` = lcl.`from_content_id` - INNER JOIN liberty_content lc2 ON lc2.`content_id` = lcl.`to_content_id` - WHERE lc1.`title`=?"; - $result = $this->mDb->query($query,array($page)); - $aux['pages'] = array(); - $aux['name'] = $page; - while ($res = $result->fetchRow()) { - if ($level) { - $aux['pages'][] = $this->wiki_get_link_structure($res['title'], $level - 1); - } else { - $inner['name'] = $res['title']; - $inner['pages'] = array(); - $aux['pages'][] = $inner; + foreach( $pLinkStructure['pages'] as $node ) { + $this->linkStructureGraph( $node, $pParams, $pGraphViz ); + $pGraphViz->addEdge( array( $pLinkStructure['name'] => $node['name'] ), $pParams['node'] ); } } - return $aux; } - /*shared*/ - function list_received_pages($offset, $max_records, $sort_mode = 'title_asc', $find) { - $bindvars = array(); - if ($find) { - $findesc = '%'.strtoupper( $find ).'%'; - $mid = " where (UPPER(`pagename`) like ? or UPPER(`data`) like ?)"; - $bindvbars[] = $findesc; - $bindvbars[] = $findesc; - } else { - $mid = ""; + /** + * linkStructureMap + * + * @param array $pPageName + * @param int $pLevel + * @param array $pParams + * @access public + * @return boolean TRUE on success, FALSE on failure - $this->mErrors will contain reason for failure + */ + function linkStructureMap( $pPageName, $pLevel = 0, $pParams = array() ) { + if( !empty( $pPageName ) && @include_once( 'Image/GraphViz.php' )) { + $graph = new Image_GraphViz(); + $this->linkStructureGraph( $this->getLinkStructure( $pPageName, $pLevel ), $pParams, $graph ); + return $graph->fetch( 'cmap' ); } + } - $query = "select * from `".BIT_DB_PREFIX."wiki_received_pages` $mid order by ".$this->mDb->convertSortmode($sort_mode); - $query_cant = "select count(*) from `".BIT_DB_PREFIX."wiki_received_pages` $mid"; - $cant = $this->mDb->getOne($query_cant,$bindvars); - - # Check for offset out of range - if ( $offset < 0 ) { - $offset = 0; - } - elseif ( $offset > $cant ) { - $lastPageNumber = ceil ( $cant / $max_records ) - 1; - $offset = $max_records * $lastPageNumber; - } - - + /** + * getLinkStructure + * + * @param array $pPageName + * @param float $pLevel + * @access public + * @return boolean TRUE on success, FALSE on failure - $this->mErrors will contain reason for failure + */ + function getLinkStructure( $pPageName, $pLevel = 0 ) { + $query = " + SELECT lc2.`title` + FROM `".BIT_DB_PREFIX."liberty_content_links` lcl + INNER JOIN liberty_content lc1 ON( lc1.`content_id` = lcl.`from_content_id` ) + INNER JOIN liberty_content lc2 ON( lc2.`content_id` = lcl.`to_content_id` ) + WHERE lc1.`title` = ?"; + $result = $this->mDb->query( $query, array( $pPageName )); - $result = $this->mDb->query($query,$bindvars,$max_records,$offset); - $ret = array(); + $ret['pages'] = array(); + $ret['name'] = $pPageName; while ($res = $result->fetchRow()) { - if ($this->pageExists($res["title"])) { - $res["exists"] = 'y'; + if( !empty( $pLevel )) { + $ret['pages'][] = $this->getLinkStructure( $res['title'], $pLevel - 1 ); } else { - $res["exists"] = 'n'; + $ret['pages'][] = array( + 'name' => $res['title'], + 'pages' => array(), + ); } - - $ret[] = $res; } - - $retval = array(); - $retval["data"] = $ret; - $retval["cant"] = $cant; - return $retval; - } - - /* ================================================================================================= - * ================================================================================================= - * ================================================================================================= - * ================================ all the stuff below here is obsoleete ========================== - * ================================================================================================= - * ================================================================================================= - * ================================================================================================= - - function wiki_link_structure() { - $query = "select `title` from `".BIT_DB_PREFIX."wiki_pages` order by ".$this->mDb->convertSortmode("title_asc"); - $result = $this->mDb->query($query); - while ($res = $result->fetchRow()) { - print ($res["title"] . " "); - $page = $res["title"]; - $query2 = "select `to_page` from `".BIT_DB_PREFIX."liberty_content_links` where `from_page`=?"; - $result2 = $this->mDb->query($query2, array( $page ) ); - $pages = array(); - while ($res2 = $result2->fetchRow()) { - if (($res2["to_page"] <> $res["title"]) && (!in_array($res2["to_page"], $pages))) { - $pages[] = $res2["to_page"]; - print ($res2["to_page"] . " "); - } - } - print ("\n"); - } - } - - // This funcion return the $limit most accessed pages - // it returns title and hits for each page - function get_top_pages($limit) { - $query = "select `title` , `hits` - from `".BIT_DB_PREFIX."wiki_pages` JOIN `".BIT_DB_PREFIX."liberty_content_hits` - on `".BIT_DB_PREFIX."wiki_pages`.`content_id` = `".BIT_DB_PREFIX."liberty_content_hits`.`content_id`) - order by `hits` desc"; - - $result = $this->mDb->query($query, array(),$limit); - $ret = array(); - - while ($res = $result->fetchRow()) { - $aux["title"] = $res["title"]; - - $aux["hits"] = $res["hits"]; - $ret[] = $aux; - } - return $ret; } - - // Returns the name of "n" random pages - function get_random_pages( $pNumPages=10 ) { - $ret = NULL; - $query = "select `content_id`, `title` from `".BIT_DB_PREFIX."liberty_content` WHERE `content_type_guid`='".BITPAGE_CONTENT_TYPE_GUID."' ORDER BY ".$this->mDb->convertSortmode( 'random' ); - $rs = $this->mDb->query( $query, array(), $pNumPages ); - while( $rs && !$rs->EOF ) { - $ret[$rs->fields['content_id']]['title'] = $rs->fields['title']; - $ret[$rs->fields['content_id']]['display_url'] = $this->getDisplayUrl( $rs->fields['title'] ); - $rs->MoveNext(); - } - - return $ret; - } - - function getDumpFile() { - global $gBitSystem; - return( $this->getStoragePath( $gBitSystem->getConfig( 'bitdomain' ), NULL, WIKI_PKG_NAME ).'dump.tar' ); - } - - function getDumpUrl() { - global $gBitSystem; - return( $this->getStorageUrl( $gBitSystem->getConfig( 'bitdomain' ), NULL, WIKI_PKG_NAME ).'dump.tar' ); - } - - // Dumps the database to dump/new.tar - // changed for virtualhost support - function dumpPages() { - global $wiki_home_page, $gBitSystem, $gBitUser; - - $tar = new tar(); - $tar->addFile( $gBitThemes->getStyleCss() ); - // Foreach page - $query = "select * from `".BIT_DB_PREFIX."wiki_pages`"; - $result = $this->mDb->query($query,array()); - - $dumpFile = $this->getDumpFile(); - if( file_exists( $dumpFile ) ) { - unlink( $dumpFile ); - } - - while ($res = $result->fetchRow()) { - $title = $res["title"] . '.html'; - - $dat = $this->parseData($res); - // Now change index.php?page=foo to foo.html - // and index.php to HomePage.html - $dat = preg_replace("/index.php\?page=([^\'\"\$]+)/", "$1.html", $dat); - $dat = preg_replace("/edit.php\?page=([^\'\"\$]+)/", "", $dat); - //preg_match_all("/index.php\?page=([^ ]+)/",$dat,$cosas); - //print_r($cosas); - $data = "<html><head><title>" . $res["title"] . "</title><link rel='StyleSheet' href='".$gBitThemes->getStyleCss()."' type='text/css'></head><body><a class='wiki' href='$wiki_home_page.html'>home</a><br/><h1>" . $res["title"] . "</h1><div class='wikitext'>" . $dat . '</div></body></html>'; - $tar->addData($title, $data, $res["last_modified"]); - } - - $tar->toTar( $dumpFile, FALSE ); - unset ($tar); - $action = "dump created"; - $t = $gBitSystem->getUTCTime(); - $query = "insert into `".BIT_DB_PREFIX."liberty_action_log`(`log_message`,`content_id`,`last_modified`,`user_id`,`ip`,`error_message`) values(?,?,?,?,?,?)"; - $result = $this->mDb->query($query,array($action,1,$t,$gBitUser->mContentId,$_SERVER["REMOTE_ADDR"],'')); - } - - function list_extwiki($offset, $max_records, $sort_mode, $find) { - $bindvars=array(); - if ($find) { - $findesc = '%' . $find . '%'; - - $mid = " where (`extwiki` like ? )"; - $bindvars[]=$findesc; - } else { - $mid = ""; - } - - $query = "select * from `".BIT_DB_PREFIX."wiki_ext` $mid order by ".$this->mDb->convertSortmode($sort_mode); - $query_cant = "select count(*) from `".BIT_DB_PREFIX."wiki_ext` $mid"; - $result = $this->mDb->query($query,$bindvars,$max_records,$offset); - $cant = $this->mDb->getOne($query_cant,$bindvars); - $ret = array(); - - while ($res = $result->fetchRow()) { - $ret[] = $res; - } - - $retval = array(); - $retval["data"] = $ret; - $retval["cant"] = $cant; - return $retval; - } - - function replace_extwiki($extwiki_id, $extwiki, $name) { - // Check the name - if ($extwiki_id) { - $query = "update `".BIT_DB_PREFIX."wiki_ext` set `extwiki`=?,`name`=? where `extwiki_id`=?"; - $result = $this->mDb->query($query,array($extwiki,$name,$extwiki_id)); - } else { - $query = "delete from `".BIT_DB_PREFIX."wiki_ext` where `name`=? and `extwiki`=?"; - $bindvars=array($name,$extwiki); - $result = $this->mDb->query($query,$bindvars); - $query = "insert into `".BIT_DB_PREFIX."wiki_ext`(`name`,`extwiki`) - values(?,?)"; - $result = $this->mDb->query($query,$bindvars); - } - - // And now replace the perm if not created - $perm_name = 'bit_p_extwiki_' . $name; - $query = "delete from `".BIT_DB_PREFIX."users_permissions`where `perm_name`=?"; - $this->mDb->query($query,array($perm_name)); - $query = "insert into `".BIT_DB_PREFIX."users_permissions`(`perm_name`,`perm_desc`,`type`,`perm_level`) values - (?,?,?,?)"; - $this->mDb->query($query,array($perm_name,'Can use extwiki $extwiki','extwiki','editor')); - return true; - } - - function remove_extwiki($extwiki_id) { - $info = $this->get_extwiki($extwiki_id); - - $perm_name = 'bit_p_extwiki_' . $info['name']; - $query = "delete from `".BIT_DB_PREFIX."users_permissions` where `perm_name`=?"; - $this->mDb->query($query,array($perm_name)); - $query = "delete from `".BIT_DB_PREFIX."wiki_ext` where `extwiki_id`=?"; - $this->mDb->query($query,array($extwiki_id)); - return true; - } - - function get_extwiki($extwiki_id) { - $query = "select * from `".BIT_DB_PREFIX."wiki_ext` where `extwiki_id`=?"; - - $result = $this->mDb->query($query,array($extwiki_id)); - - if (!$result->numRows()) - return false; - - $res = $result->fetchRow(); - return $res; - } - -// ================== WIKI TAG FUNCTIONS ============== - function tag_exists($tag) { - $query = "select distinct `tag_name` from `".BIT_DB_PREFIX."wiki_tags` where `tag_name` = ?"; - - $result = $this->mDb->query($query,array($tag)); - return $result->numRows($result); - } - - function remove_tag($tagname) { - global $wiki_home_page, $gBitUser, $gBitSystem; - - $this->mDb->StartTrans(); - $query = "delete from `".BIT_DB_PREFIX."wiki_tags` where `tag_name`=?"; - $result = $this->mDb->query($query,array($tagname)); - $action = "removed tag: $tagname"; - $t = $gBitSystem->getUTCTime(); - $homeContentId = $this->mDb->getOne( "SELECT `content_id` from `".BIT_DB_PREFIX."wiki_pages` wp INNER JOIN `".BIT_DB_PREFIX."liberty_content` lc ON(wp.`content_id`=lc.`content_id`) WHERE lc.`title`=?", array( $wiki_home_page ) ); - $query = "insert into `".BIT_DB_PREFIX."liberty_action_log` (`content_id`, `log_message`, `last_modified`, `user_id`, `ip`, `error_message`) values ( ?,?,?,?,?,?,? )"; - $result = $this->mDb->query($query,array($homeContentId, $action,$wiki_home_page,$t,$gBitUser->mUserId,$_SERVER["REMOTE_ADDR"],'')); - $this->mDb->CompleteTrans(); - return true; - } - - function get_tags() { - $query = "select distinct `tag_name` from `".BIT_DB_PREFIX."wiki_tags`"; - - $result = $this->mDb->query($query,array()); - $ret = array(); - - while ($res = $result->fetchRow()) { - $ret[] = $res["tag_name"]; - } - - return $ret; - } - - // This function can be used to store the set of actual pages in the "tags" - // table preserving the state of the wiki under a tag name. - function create_tag($tagname, $comment = '') { - global $wiki_home_page, $gBitUser, $gBitSystem; - - $this->mDb->StartTrans(); - $query = "select * from `".BIT_DB_PREFIX."wiki_pages` wp INNER JOIN `".BIT_DB_PREFIX."liberty_content` lc ON( wp.`content_id`=lc.`content_id` )"; - $result = $this->mDb->query($query,array()); - - while ($res = $result->fetchRow()) { - $data = $res["data"]; - $description = $res["description"]; - $query = "delete from `".BIT_DB_PREFIX."wiki_tags`where `tag_name`=? and `page_id`=?"; - $this->mDb->query($query,array($tagname,$res["page_id"])); - $query = "insert into `".BIT_DB_PREFIX."wiki_tags`(`page_id`,`tag_name`,`page_name`,`hits`,`data`,`last_modified`,`error_message`,`version`,`user_id`,`ip`,`flag`,`description`) - values(?,?,?,?,?,?,?,?,?,?,?,?)"; - $result2 = $this->mDb->query($query,array($res["page_id"],$tagname,$res["title"],$res["hits"],$data,$res["last_modified"],$res["edit_comment"],$res["version"],$res["user_id"],$res["ip"],$res["flag"],$description)); - } - - $homeContentId = $this->mDb->getOne( "SELECT `content_id` from `".BIT_DB_PREFIX."wiki_pages` wp INNER JOIN `".BIT_DB_PREFIX."liberty_content` lc ON(wp.`content_id`=lc.`content_id`) WHERE lc.`title`=?", array( $wiki_home_page ) ); - $action = "created tag: $tagname"; - $t = $gBitSystem->getUTCTime(); - $query = "insert into `".BIT_DB_PREFIX."liberty_action_log`(`content_id`,`log_message`,last_modified`,`user_id`,`ip`,`error_message`) values(?,?,?,?,?,?,?)"; - $result = $this->mDb->query($query,array($homeContentId,$action,$wiki_home_page,$t,$gBitUser->mUserId,$_SERVER["REMOTE_ADDR"],$comment)); - $this->mDb->CompleteTrans(); - return true; - } - - // This funcion recovers the state of the wiki using a tag_name from the - // tags table - function restore_tag($tagname) { - global $wiki_home_page, $gBitUser, $gBitSystem; - require_once( WIKI_PKG_PATH.'BitPage.php' ); - - $this->mDb->StartTrans(); - $query = "update `".BIT_DB_PREFIX."wiki_pages` set `cache_timestamp`=0"; - $this->mDb->query($query,array()); - $query = "select *, `data` AS `edit`, `page_name` AS `title` FROM `".BIT_DB_PREFIX."wiki_tags` where `tag_name`=?"; - $result = $this->mDb->query($query,array($tagname)); - - while ($res = $result->fetchRow()) { - $tagPage = new BitPage( $res["page_id"] ); - $tagPage->store( $res ); - } - - $homePageId = $this->mDb->getOne( "SELECT `page_id` from `".BIT_DB_PREFIX."wiki_pages` wp INNER JOIN `".BIT_DB_PREFIX."liberty_content` lc ON(wp.`content_id`=lc.`content_id`) WHERE lc.`title`=?", array( $wiki_home_page ) ); - $action = "recovered tag: $tagname"; - $t = $gBitSystem->getUTCTime(); - } - */ + // }}} } +/* vim: :set fdm=marker : */ ?> diff --git a/admin/schema_inc.php b/admin/schema_inc.php index b91dea6..47c9731 100644 --- a/admin/schema_inc.php +++ b/admin/schema_inc.php @@ -8,46 +8,6 @@ $tables = array( data X ", -'wiki_pages' => " - page_id I4 PRIMARY, - content_id I4 NOTNULL, - wiki_page_size I4 DEFAULT 0, - edit_comment C(200), - flag C(1) -", - -'wiki_received_pages' => " - received_page_id I4 AUTO PRIMARY, - title C(160) NOTNULL, - data X, - description C(200), - received_comment C(200), - received_from_site C(200), - received_from_user C(200), - received_date I8 -", - -'wiki_tags' => " - page_id I4 PRIMARY, - tag_name C(80) PRIMARY, - title C(160), - user_id I4 NOTNULL, - hits I4, - description C(200), - data X, - last_modified I8, - tag_comment C(200), - version I4 NOTNULL, - ip C(15), - flag C(1) -", - -'wiki_ext' => " - extwiki_id I4 AUTO PRIMARY, - name C(200) NOTNULL, - extwiki C(255) -" - ); global $gBitInstaller; @@ -166,8 +126,8 @@ if( defined( 'RSS_PKG_NAME' )) { } // ### Register content types -$gBitInstaller->registerContentObjects( WIKI_PKG_NAME, array( - 'BitPage'=>WIKI_PKG_PATH.'BitPage.php', - 'BitBook'=>WIKI_PKG_PATH.'BitBook.php', +$gBitInstaller->registerContentObjects( WIKI_PKG_NAME, array( + 'BitPage' => WIKI_PKG_PATH.'BitPage.php', + 'BitBook' => WIKI_PKG_PATH.'BitBook.php', )); ?> diff --git a/admin/upgrades/1.0.1.php b/admin/upgrades/1.0.1.php new file mode 100644 index 0000000..9ec3b11 --- /dev/null +++ b/admin/upgrades/1.0.1.php @@ -0,0 +1,24 @@ +<?php +/** + * @version $Header: + */ +global $gBitInstaller; + +$infoHash = array( + 'package' => WIKI_PKG_NAME, + 'version' => str_replace( '.php', '', basename( __FILE__ )), + 'description' => "Drop unused tables.", + 'post_upgrade' => NULL, +); +$gBitInstaller->registerPackageUpgrade( $infoHash, array( + +array( 'DATADICT' => array( + array( 'DROPTABLE' => array( + 'wiki_received_pages', + 'wiki_tags', + 'wiki_ext', + )), +)), + +)); +?> diff --git a/liberty_plugins/data.wikigraph.php b/liberty_plugins/data.wikigraph.php index 5d0c301..44913ac 100644 --- a/liberty_plugins/data.wikigraph.php +++ b/liberty_plugins/data.wikigraph.php @@ -1,44 +1,29 @@ <?php /** - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ * @package liberty * @subpackage plugins_data */ -// +----------------------------------------------------------------------+ -// | Copyright (c) 2004, bitweaver.org -// +----------------------------------------------------------------------+ -// | All Rights Reserved. See copyright.txt for details and a complete list of authors. -// | Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details -// | -// | For comments, please use phpdocu.sourceforge.net documentation standards!!! -// | -> see http://phpdocu.sourceforge.net/ -// +----------------------------------------------------------------------+ -// | Author (TikiWiki): Unknown -// | Reworked & Undoubtedly Screwed-Up for (Bitweaver) -// | by: wolff_borg <wolff_borg@yahoo.com.au> -// | Reworked from: wikiplugin_wikigraph.php - see deprecated code below -// +----------------------------------------------------------------------+ -// $Id: data.wikigraph.php,v 1.2 2008/11/09 09:08:56 squareing Exp $ /** * definitions */ global $gBitSystem, $gLibertySystem; // only include this plugin if wiki is active and we have GraphViz -if( $gBitSystem->isPackageActive( 'wiki' ) && @include_once( UTIL_PKG_PATH.'GraphViz.php' )) { +if( @include_once( 'Image/GraphViz.php' )) { define( 'PLUGIN_GUID_DATAWIKIGRAPH', 'datawikigraph' ); $pluginParams = array ( - 'tag' => 'WIKIGRAPH', + 'tag' => 'wikigraph', 'auto_activate' => FALSE, 'requires_pair' => TRUE, 'load_function' => 'data_wikigraph', - 'title' => 'WikiGraph', - 'help_page' => 'DataPluginWikiGraph', - 'description' => tra("Inserts a graph for visual navigation. The graph shows the page and every page that can be reached from that page."), + 'title' => 'WikiGraph', + 'help_page' => 'DataPluginWikiGraph', + 'description' => tra( "Inserts a graph for visual navigation. The graph shows the page and every page that can be reached from that page." ), 'help_function' => 'data_wikigraph_help', - 'syntax' => "{WIKIGRAPH level= title= nodesep= rankdir= bgcolor= size= fontsize= fontname= shap= nodestyle= nodecolor= nodefillcolor= nodewidth= nodeheight= edgecolor= edgestyle= }".tra("Wiki page name")."{WIKIGRAPH}", - 'plugin_type' => DATA_PLUGIN + 'syntax' => "{wikigraph level= title= }".tra( "Wiki page name" )."{/wikigraph}", + 'plugin_type' => DATA_PLUGIN ); $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAWIKIGRAPH, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAWIKIGRAPH ); @@ -79,98 +64,46 @@ function data_wikigraph_help() { .'</table>' .tra( "Example: " )."{wikigraph level=1}Welcome{/wikigraph}"; return $help; - - /* - // old help - needs to be fulle converted into new format - $back = tra("^__Parameter Syntax:__ ") . "~np~{WIKIGRAPH" . tra("(key=>value)}~/np~\n"); - $back.= tra("Inserts a graph for visual navigation. The graph shows the page and every page that can be reached from that page. Each node in the graph can be clicked to navigate to the selected page. Unless a PageName is included between the ") . "__~np~{WIKIGRAPH}~/np~__" . tra(" blocks, the graph will be created for the Current Page. __Note:__ This plugin requires the installation of ))GraphViz(( on the server."); - $back.= tra("||__::key::__ | __::value::__ | __::Comments::__\n"); - $back.= "::level::" . tra(" | ::number:: | the number of levels that will be followed from the starting page. __Optional__ - can be omitted - the __Default = 0__ so only the links from the page will be displayed.\n"); - $back.= "::title::" . tra(" | ::string:: | the title of the graph. __Optional__ - can be omitted - the __Default = ~034~Wiki-Graph~034~__.\n"); - $back.= "::nodesep::" . tra(" | ::inches:: | the minimum distance between two nodes at the same level.Use the format __1.2__ in inches. __Optional__ - can be omitted - the __Default = .1__.\n"); - $back.= "::rankdir::" . tra(" | ::string:: | direction of graph layout. Can be Left to Right ") . "__LR__ or __RL__" . tra(" Right to Left. Vertical graphs can also be made using Top to Bottom ") . "__TB__ or __BT__" . tra(" Bottom to Top. __Optional__ - can be omitted - the __Default = ") . "TB__.\n"; - $back.= "::bgcolor::" . tra(" | ::colorname or hex color:: | specifies the background color for the graph. HTML colors (#RRGGBB) can be used if preceeded by the character #. __Optional__ - can be omitted - the __Default = ~034~transparent~034~__.\n"); - $back.= "::size::" . tra(" | ::inches:: | the width and height of the graph. Use the format __5,3__ in inches. If the graph is larger that the size it will be scaled down to fit. __Optional__ - can be omitted - the __Default = Unlimited__.\n"); - $back.= "::fontsize::" . tra(" | ::points:: | the font size in points - used in all text. __Optional__ - can be omitted - the __Default = 9__.\n"); - $back.= "::fontname::" . tra(" | ::font name:: | the name of the font used for the labels. It is better to use a font that is generally available, such as Times-Roman, Helvetica or Courier. __Optional__ - can be omitted - the __Default = Helvetica__.\n"); - $back.= "::shap::" . tra(" | ::value:: | the shape of the nodes. Values can be") . "__a1 / box / circle / diamond / doublecircle / doubleoctagon / egg / ellipse / hexagon / house / invhouse / invtrapezium / invtriangle / Mcircle / Mdiamond / Msquare / octagon / parallelogram / pentagon / point / polygon / rect / rectangle / septagon / trapezium / triangle / tripleoctagon__." . tra(" __Optional__ - can be omitted - the __Default = ") . "box__.\n"; - $back.= "::nodestyle::" . tra(" | ::value:: | the style used for creating the nodes. Values are: ") . "__dashed / dotted / solid / invis / bold / filled / diagonals / rounded__." . tra(" __Optional__ - can be omitted - the __Default = ") . "filled__.\n"; - $back.= "::nodecolor::" . tra(" | ::colorname or hex-color:: | basic color for all graphics. HTML colors (#RRGGBB) can be used if preceeded by the character #. __Optional__ - can be omitted - the __Default = #aeaeae__ (a light gray).\n"); - $back.= "::nodefillcolor::" . tra(" | ::colorname or hex-color:: | specifies the background color for the nodes. HTML colors (#RRGGBB) can be used if preceeded by the character #. __Optional__ - can be omitted - the __Default = #FFFFFF__ (White).\n"); - $back.= "::nodewidth::" . tra(" | ::inches:: | width of the nodes. This is the initial, minimum width of a node. Use the format __1.2__ in inches. __Optional__ - can be omitted - the __Default = .1__.\n"); - $back.= "::nodeheight::" . tra(" | ::inches:: | height of the nodes. This is the initial, minimum height of a node. Use the format __1.2__ in inches. __Optional__ - can be omitted - the __Default = .1__.\n"); - $back.= "::edgecolor::" . tra(" | ::colorname or hex-color:: | specifies the color of the links. HTML colors (#RRGGBB) can be used if preceeded by the character #. __Optional__ - can be omitted - the __Default = #999999__ (a darker gray).\n"); - $back.= "::edgestyle::" . tra(" | ::value:: | the shape of the arrow that points at the link. Values are: ") . "__normal / inv / dot / invdot / odot / invodot / none / tree / empty / invempty / diamond / ediamond / odiamond / crow / box / obox / open / halfopen__." . tra(" __Optional__ - can be omitted - the __Default = ") . "normal__.||^"; // This one may not be correct - this had a default of "solid" but the ArrowTypes given at http://www.research.att.com/~erg/graphviz/info/attrs.html#k:arrowType specify the default as "normal" - $back.= tra("^__Example:__ ") . "~np~{WIKIGRAPH(level=>0)}HomePage{WIKIGRAPH}~/np~^"; - $back.= tra("^__Note 1:__ Plugin's are __case sensitive__. The Name of the plugin __MUST__ be UPPERCASE. The Key(s) are __always__ lowercase. Some Values are mixed-case but most require lowercase. When in doubt - look at the Example.\n"); - $back.= tra("__Note 2:__ A listing of ColorNames can be found at ") . "<a class='wiki' target=" . '"_blank"' . " href='http://www.tikipro.org/wiki/index.php?page=Browser+ColorNames/'>" . tra("TikiPro</a>^"); - $back.= tra("__Note 3:__ One useful place for obtaining HTML colors is ") . "<a class='wiki' target=" . '"_blank"' . " href='http://www.pagetutor.com/pagetutor/makapage/picker/'>" . tra("The Color Picker II</a>^"); - */ } -include_once( WIKI_PKG_PATH.'BitPage.php'); - function data_wikigraph( $pData, $pParams ) { - global $gContent; - - $add = ""; + global $gContent, $gBitThemes; $ret = " "; - $ommit = array( 'title', 'data' ); - foreach( $pParams as $param => $value ) { - if( !in_array( $param, $ommit ) && !is_numeric( $param ) ) { - $add .= "&{$param}={$value}"; - } - } + if( !empty( $gContent ) && is_object( $gContent )) { + $querystring = ""; - if( empty( $title ) ) { - $title = "Wiki-Graph"; - } + $title = ( !empty( $pParams['title'] ) ? $pParams['title'] : 'Wiki-Graph' ); + unset( $pParams['title'] ); - if( empty( $pData ) ) { - $pData = ( ( !is_object( $gContent ) || empty( $gContent->mInfo['title'] ) ) ? NULL : $gContent->mInfo['title'] ); - } + foreach( $pParams as $param => $value ) { + $querystring .= "&{$param}={$value}"; + } - $level = isset( $level ) ? $level : "0"; + if( empty( $pData ) ) { + $pData = (( is_object( $gContent ) || !empty( $gContent->mPageName )) ? $gContent->mPageName : NULL ); + } - if( !empty( $pData ) ) { - $garg = array( - 'att' => array( - 'level' => !empty( $level ) ? $level : ".1", - 'nodesep' => isset( $nodesep ) ? $nodesep : ".1", - 'rankdir' => isset( $rankdir ) ? $rankdir : "LR", - 'bgcolor' => isset( $bgcolor ) ? $bgcolor : "transparent", - 'size' => isset( $size ) ? $size : "" - ), - 'node' => array( - 'fontsize' => isset( $fontsize ) ? $fontsize : "10", - 'fontname' => isset( $fontname ) ? $fontname : "sans", - 'shape' => isset( $shape ) ? $shape : "box", - 'style' => isset( $nodestyle ) ? $nodestyle : "filled", - 'color' => isset( $nodecolor ) ? $nodecolor : "#aaaaaa", - 'fillcolor' => isset( $nodefillcolor ) ? $nodefillcolor : "#f5f5f5", - 'width' => isset( $nodewidth ) ? $nodewidth : ".1", - 'height' => isset( $nodeheight ) ? $nodeheight : ".1" - ), - 'edge' => array( - 'color' => isset( $edgecolor ) ? $edgecolor : "#aa8866", - 'style' => isset( $edgestyle ) ? $edgestyle : "solid" - ) - ); + if( !empty( $pData ) ) { + $params = array( + 'graph' => $gBitThemes->getGraphvizGraphAttributes( $pParams ), + 'node' => $gBitThemes->getGraphvizNodeAttributes( $pParams ), + 'edge' => $gBitThemes->getGraphvizEdgeAttributes( $pParams ), + ); - $mapname=md5(uniqid(".")); - $ret = "<div align='center'><img border='0' src=\"".WIKI_PKG_URL."wiki_graph.php?page=".urlencode($pData)."{$add}\" alt='{$title}' usemap='#$mapname' />"; + $mapname = md5( microtime() ); + $mapdata = $gContent->linkStructureMap( $pData, ( isset( $pParams['level'] ) ? $pParams['level'] : 0 ), $params ); - if( !empty( $pData ) && !empty( $garg ) ) { - $wikilib = new WikiLib(); - $mapdata = $wikilib->get_graph_map( $pData, $level, $garg ); - $mapdata = preg_replace( "/\n|\r/", '', $mapdata ); - $ret .= "<map name='$mapname'>$mapdata</map>"; - $ret .= "</div>"; + $ret = " + <div align='center'> + <img border='0' src=\"".WIKI_PKG_URL."wiki_graph.php?page=".urlencode( $pData )."{$querystring}\" alt='{$title}' usemap='#$mapname' /> + <map name='$mapname'>$mapdata</map> + </div>"; + $ret = preg_replace( "/\n|\r/", '', $ret ); } } return $ret; } -} // wiki package and graphviz check +} // graphviz check ?> diff --git a/received_pages.php b/received_pages.php deleted file mode 100644 index 9946362..0000000 --- a/received_pages.php +++ /dev/null @@ -1,117 +0,0 @@ -<?php -/** - * $Header: /cvsroot/bitweaver/_bit_wiki/Attic/received_pages.php,v 1.10 2008/06/25 22:21:30 spiderr Exp $ - * - * Copyright (c) 2004 bitweaver.org - * Copyright (c) 2003 tikwiki.org - * Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al. - * All Rights Reserved. See copyright.txt for details and a complete list of authors. - * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details - * - * $Id: received_pages.php,v 1.10 2008/06/25 22:21:30 spiderr Exp $ - * @package wiki - * @subpackage functions - */ - -/** - * required setup - */ -require_once( '../bit_setup_inc.php' ); - -$gBitSystem->verifyPackage( 'xmlrpc' ); - -include_once( XMLRPC_PKG_PATH.'comm_lib.php' ); -include_once( WIKI_PKG_PATH.'BitPage.php'); - -$gBitSystem->verifyFeature( 'feature_comm' ); -$gBitSystem->verifyPermission( 'p_xmlrpc_admin_content' ); - -if (!isset($_REQUEST["received_page_id"])) { - $_REQUEST["received_page_id"] = 0; -} -$gBitSmarty->assign('received_page_id', $_REQUEST["received_page_id"]); -if (isset($_REQUEST["accept"])) { - - // CODE TO ACCEPT A PAGE HERE - $commlib->accept_page($_REQUEST["accept"]); -} -if ($_REQUEST["received_page_id"]) { - $info = $commlib->get_received_page($_REQUEST["received_page_id"]); -} else { - $info = array(); - $info["title"] = ''; - $info["data"] = ''; - $info["comment"] = ''; -} -$gBitSmarty->assign('view', 'n'); -if (isset($_REQUEST["view"])) { - $info = $commlib->get_received_page($_REQUEST["view"]); - $gBitSmarty->assign('view', 'y'); -} -if (isset($_REQUEST["preview"])) { - $info["title"] = $_REQUEST["title"]; - $info["data"] = $_REQUEST["data"]; - $info["comment"] = $_REQUEST["comment"]; -} -$gBitSmarty->assign('title', $info["title"]); -$gBitSmarty->assign('data', $info["data"]); -$gBitSmarty->assign('comment', $info["comment"]); -// Assign parsed -$gBitSmarty->assign('parsed', $gContent->parseData($info)); -if (isset($_REQUEST["remove"])) { - - $commlib->remove_received_page($_REQUEST["remove"]); -} -if (isset($_REQUEST["save"])) { - - $commlib->update_received_page($_REQUEST["received_page_id"], $_REQUEST["title"], $_REQUEST["data"], $_REQUEST["comment"]); - $gBitSmarty->assign('title', $_REQUEST["title"]); - $gBitSmarty->assign('data', $_REQUEST["data"]); - $gBitSmarty->assign('comment', $_REQUEST["comment"]); - $gBitSmarty->assign('received_page_id', $_REQUEST["received_page_id"]); - $gBitSmarty->assign('parsed', $gBitSystem->parseData($_REQUEST)); -} -if (empty( $_REQUEST["sort_mode"] )) { - $sort_mode = 'received_date_desc'; -} else { - $sort_mode = $_REQUEST["sort_mode"]; -} -$gBitSmarty->assign_by_ref('sort_mode', $sort_mode); -if (!isset($_REQUEST["offset"])) { - $offset = 0; -} else { - $offset = $_REQUEST["offset"]; -} -if (isset($_REQUEST['page'])) { - $page = &$_REQUEST['page']; - $offset = ($page - 1) * $max_records; -} -$gBitSmarty->assign_by_ref('offset', $offset); -if (isset($_REQUEST["find"])) { - $find = $_REQUEST["find"]; -} else { - $find = ''; -} -$gBitSmarty->assign_by_ref('find', $find); - -$wikilib = new WikiLib(); -$channels = $wikilib->list_received_pages($offset, $max_records, $sort_mode, $find); -$cant_pages = ceil($channels["cant"] / $max_records); -$gBitSmarty->assign_by_ref('cant_pages', $cant_pages); -$gBitSmarty->assign('actual_page', 1 + ($offset / $max_records)); -if ($channels["cant"] > ($offset + $max_records)) { - $gBitSmarty->assign('next_offset', $offset + $max_records); -} else { - $gBitSmarty->assign('next_offset', -1); -} -// If offset is > 0 then prev_offset -if ($offset > 0) { - $gBitSmarty->assign('prev_offset', $offset - $max_records); -} else { - $gBitSmarty->assign('prev_offset', -1); -} -$gBitSmarty->assign_by_ref('channels', $channels["data"]); - -// Display the template -$gBitSystem->display( 'bitpackage:wiki/received_pages.tpl', NULL, array( 'display_mode' => 'display' )); -?> diff --git a/templates/received_pages.tpl b/templates/received_pages.tpl deleted file mode 100644 index 079943f..0000000 --- a/templates/received_pages.tpl +++ /dev/null @@ -1,85 +0,0 @@ -<div class="floaticon">{bithelp}</div> - -<div class="display wiki"> -<div class="header"> -<h1>{tr}Received pages{/tr}</h1> -</div> - -<div class="body"> - -{if $received_page_id > 0 or $view eq 'y'} -<h2>{tr}Preview{/tr}</h2> -<div class="wikibody">{$parsed}</div> -{/if} -{if $received_page_id > 0} -<h2>{tr}Edit received page{/tr}</h2> -<form action="{$smarty.const.WIKI_PKG_URL}received_pages.php" method="post"> -<input type="hidden" name="received_page_id" value="{$received_page_id|escape}" /> -<table class="panel"> -<tr><td> -{tr}Name{/tr}:</td><td> -<input type="text" name="title" value="{$title|escape}" /> -</td></tr> -<tr><td> -{tr}Data{/tr}:</td><td> -<textarea name="data" rows="10" cols="50">{$data|escape}</textarea> -</td></tr> -<tr><td> -{tr}Comment{/tr}:</td><td> -<input type="text" name="comment" value="{$comment|escape}" /> -</td></tr> -<tr><td colspan="2"><input type="submit" name="preview" value="{tr}Preview{/tr}" /> <input type="submit" name="save" value="{tr}Save{/tr}" /></td></tr> -</table> -</form> -{/if} - -<table class="find"> -<tr><td>{tr}Find{/tr}</td> - <td> - <form method="get" action="{$smarty.const.WIKI_PKG_URL}received_pages.php"> - <input type="text" name="find" /> - <input type="submit" name="search" value="{tr}find{/tr}" /> - <input type="hidden" name="sort_mode" value="{$sort_mode|escape}" /> - </form> - </td> -</tr> -</table> - -<table class="data"> -<tr> -<th><a href="{$smarty.const.WIKI_PKG_URL}received_pages.php?offset={$offset}&sort_mode={if $sort_mode eq 'received_page_id_desc'}received_page_id_asc{else}received_page_id_desc{/if}">{tr}ID{/tr}</a></th> -<th><a href="{$smarty.const.WIKI_PKG_URL}received_pages.php?offset={$offset}&sort_mode={if $sort_mode eq 'title_desc'}title_asc{else}title_desc{/if}">{tr}name{/tr}</a></th> -<th><a href="{$smarty.const.WIKI_PKG_URL}received_pages.php?offset={$offset}&sort_mode={if $sort_mode eq 'received_date_desc'}received_date_asc{else}received_date_desc{/if}">{tr}Date{/tr}</a></th> -<th><a href="{$smarty.const.WIKI_PKG_URL}received_pages.php?offset={$offset}&sort_mode={if $sort_mode eq 'received_from_site_desc'}received_from_site_asc{else}received_from_site_desc{/if}">{tr}Site{/tr}</a></th> -<th><a href="{$smarty.const.WIKI_PKG_URL}received_pages.php?offset={$offset}&sort_mode={if $sort_mode eq 'received_from_user_desc'}received_from_user_asc{else}received_from_user_desc{/if}">{tr}User{/tr}</a></th> -<th>{tr}action{/tr}</th> -</tr> -{cycle values="even,odd" print=false} -{section name=user loop=$channels} -<tr class="{cycle}"> -<td>{$channels[user].received_page_id}</td> -{if $channels[user].exists eq 'y'} -<td><span class="highlight">{$channels[user].title|escape}</span></td> -{else} -<td>{$channels[user].title|escape}</td> -{/if} -<td>{$channels[user].received_date|bit_short_date}</td> -<td>{$channels[user].received_from_site}</td> -<td>{$channels[user].received_from_user}</td> -<td> - <a title="{tr}edit{/tr}" href="{$smarty.const.WIKI_PKG_URL}received_pages.php?offset={$offset}&sort_mode={$sort_mode}&received_page_id={$channels[user].received_page_id}">{biticon ipackage="icons" iname="accessories-text-editor" iexplain="edit"}</a> - <a title="{tr}view{/tr}" href="{$smarty.const.WIKI_PKG_URL}received_pages.php?offset={$offset}&sort_mode={$sort_mode}&view={$channels[user].received_page_id}">{biticon ipackage="icons" iname="document-open" iexplain="view"}</a> - <a title="{tr}accept{/tr}" href="{$smarty.const.WIKI_PKG_URL}received_pages.php?offset={$offset}&sort_mode={$sort_mode}&accept={$channels[user].received_page_id}">{biticon ipackage="icons" iname="dialog-ok" iexplain="accept"}</a> - <a title="{tr}remove{/tr}" href="{$smarty.const.WIKI_PKG_URL}received_pages.php?offset={$offset}&sort_mode={$sort_mode}&remove={$channels[user].received_page_id}">{biticon ipackage="icons" iname="edit-delete" iexplain="delete"}</a> -</td> -</tr> -{sectionelse} - <tr class="norecords"><td colspan="6">{tr}No records found{/tr}</td></tr> -{/section} -</table> - -</div><!-- end .body --> - -{pagination} - -</div><!-- end .wiki --> diff --git a/wiki_graph.php b/wiki_graph.php index f15c6b0..f0dc51e 100644 --- a/wiki_graph.php +++ b/wiki_graph.php @@ -1,6 +1,6 @@ <?php /** - * $Header: /cvsroot/bitweaver/_bit_wiki/wiki_graph.php,v 1.4 2007/06/01 16:01:30 squareing Exp $ + * $Header: /cvsroot/bitweaver/_bit_wiki/wiki_graph.php,v 1.5 2008/11/13 09:39:03 squareing Exp $ * * Copyright (c) 2004 bitweaver.org * Copyright (c) 2003 tikwiki.org @@ -8,7 +8,7 @@ * All Rights Reserved. See copyright.txt for details and a complete list of authors. * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details * - * $Id: wiki_graph.php,v 1.4 2007/06/01 16:01:30 squareing Exp $ + * $Id: wiki_graph.php,v 1.5 2008/11/13 09:39:03 squareing Exp $ * @package wiki * @subpackage functions */ @@ -17,49 +17,18 @@ * required setup */ include_once( '../bit_setup_inc.php' ); -include_once( UTIL_PKG_PATH.'GraphViz.php' ); include_once( WIKI_PKG_PATH.'BitPage.php'); -if(!isset($_REQUEST['level'])) $_REQUEST['level'] = 0; -if(!isset($_REQUEST['nodesep'])) $_REQUEST['nodesep'] = ".1"; -if(!isset($_REQUEST['rankdir'])) $_REQUEST['rankdir'] = "LR"; -if(!isset($_REQUEST['bgcolor'])) $_REQUEST['bgcolor'] = "transparent"; # general background color #rrvvbb or 'transparent' -if(!isset($_REQUEST['size'])) $_REQUEST['size'] = ""; # "x,y" in inches -if(!isset($_REQUEST['fontsize'])) $_REQUEST['fontsize'] = "9"; -if(!isset($_REQUEST['fontname'])) $_REQUEST['fontname'] = "Helvetica"; -if(!isset($_REQUEST['shape'])) $_REQUEST['shape'] = "box"; # plaintext ellipse circle egg triangle box diamond trapezium parallelogram house hexagon octagon -if(!isset($_REQUEST['nodestyle'])) $_REQUEST['nodestyle'] = "filled"; -if(!isset($_REQUEST['nodecolor'])) $_REQUEST['nodecolor'] = "#aeaeae"; -if(!isset($_REQUEST['nodefillcolor'])) $_REQUEST['nodefillcolor'] = "#FFFFFF"; -if(!isset($_REQUEST['nodewidth'])) $_REQUEST['nodewidth'] = ".1"; -if(!isset($_REQUEST['nodeheight'])) $_REQUEST['nodeheight'] = ".1"; -if(!isset($_REQUEST['edgecolor'])) $_REQUEST['edgecolor'] = "#999999"; -if(!isset($_REQUEST['edgestyle'])) $_REQUEST['edgestyle'] = "solid"; -$garg = array( - 'att' => array( - 'level' => $_REQUEST['level'], - 'nodesep' => $_REQUEST['nodesep'], - 'rankdir' => $_REQUEST['rankdir'], - 'bgcolor' => $_REQUEST['bgcolor'], - 'size' => $_REQUEST['size'] - ), - 'node' => array( - 'fontsize' => $_REQUEST['fontsize'], - 'fontname' => $_REQUEST['fontname'], - 'shape' => $_REQUEST['shape'], - 'style' => $_REQUEST['nodestyle'], - 'color' => $_REQUEST['nodecolor'], - 'fillcolor' => $_REQUEST['nodefillcolor'], - 'width' => $_REQUEST['nodewidth'], - 'height' => $_REQUEST['nodeheight'] - ), - 'edge' => array( - 'color' => $_REQUEST['edgecolor'], - 'style' => $_REQUEST['edgestyle'] - ) -); +include_once( WIKI_PKG_PATH.'lookup_page_inc.php'); +include_once( 'Image/GraphViz.php' ); $graph = new Image_GraphViz(); -$wikilib = new WikiLib(); -$str = $wikilib->wiki_get_link_structure($_REQUEST['page'], $_REQUEST['level']); -$wikilib->wiki_page_graph($str, $graph, $garg); + +$params = array( + 'graph' => $gBitThemes->getGraphvizGraphAttributes( $_REQUEST ), + 'node' => $gBitThemes->getGraphvizNodeAttributes( $_REQUEST ), + 'edge' => $gBitThemes->getGraphvizEdgeAttributes( $_REQUEST ), +); + +$linkStructure = $gContent->getLinkStructure( $gContent->mPageName, !empty( $_REQUEST['level'] ) ? $_REQUEST['level'] : 0 ); +$gContent->linkStructureGraph( $linkStructure, $params, $graph ); $graph->image( 'png' ); ?> |
