diff options
| author | Max Kremmel <xing@synapse.plus.com> | 2005-10-29 17:57:43 +0000 |
|---|---|---|
| committer | Max Kremmel <xing@synapse.plus.com> | 2005-10-29 17:57:43 +0000 |
| commit | cba52a666bb221c21f622600af12252305b69320 (patch) | |
| tree | 85cf20bc8adf7cf845948829a881870fbb763fc5 | |
| parent | 05e583e9e3ce79084c57f384610d82e29909e395 (diff) | |
| download | wiki-cba52a666bb221c21f622600af12252305b69320.tar.gz wiki-cba52a666bb221c21f622600af12252305b69320.tar.bz2 wiki-cba52a666bb221c21f622600af12252305b69320.zip | |
merge recent changes into HEAD
| -rw-r--r-- | BitPage.php | 82 | ||||
| -rw-r--r-- | admin/schema_inc.php | 136 | ||||
| -rw-r--r-- | templates/create_book.tpl | 4 | ||||
| -rw-r--r-- | templates/edit_page.tpl | 6 | ||||
| -rw-r--r-- | templates/header_inc.tpl | 5 | ||||
| -rw-r--r-- | templates/received_pages.tpl | 2 | ||||
| -rw-r--r-- | wiki_rss.php | 18 |
7 files changed, 141 insertions, 112 deletions
diff --git a/BitPage.php b/BitPage.php index de5107c..21af36e 100644 --- a/BitPage.php +++ b/BitPage.php @@ -1,11 +1,11 @@ <?php /** - * @version $Header: /cvsroot/bitweaver/_bit_wiki/BitPage.php,v 1.11 2005/10/23 14:44:19 squareing Exp $ + * @version $Header: /cvsroot/bitweaver/_bit_wiki/BitPage.php,v 1.12 2005/10/29 17:57:43 squareing Exp $ * @package wiki * * @author spider <spider@steelsun.com> * - * @version $Revision: 1.11 $ $Date: 2005/10/23 14:44:19 $ $Author: squareing $ + * @version $Revision: 1.12 $ $Date: 2005/10/29 17:57:43 $ $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.11 2005/10/23 14:44:19 squareing Exp $ + * $Id: BitPage.php,v 1.12 2005/10/29 17:57:43 squareing Exp $ */ /** @@ -756,7 +756,7 @@ class BitPage extends LibertyAttachable { * This can take some time to calculate, and so should not normally be enabled * @param pOrphansOnly If Set list only unattached pages ( ones not used in other content ) */ - function getList($offset = 0, $maxRecords = -1, $sort_mode = 'title_desc', $find = '', $pUserId=NULL, $pExtras=FALSE, $pOrphansOnly=FALSE ) { + function getList($offset = 0, $maxRecords = -1, $sort_mode = 'title_desc', $find = '', $pUserId=NULL, $pExtras=FALSE, $pOrphansOnly=FALSE, $pGetData=FALSE ) { global $gBitSystem; if ($sort_mode == 'size_desc') { $sort_mode = 'page_size_desc'; @@ -798,16 +798,45 @@ class BitPage extends LibertyAttachable { $bindVars = array_merge($bindVars, array( $pUserId )); } - $query = "SELECT uue.`login` AS modifier_user, uue.`real_name` AS modifier_real_name, uuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name ,`page_id`, `hits`, `page_size` as `len`, tc.`title`, tc.`format_guid`, tp.`description`, tc.`last_modified`, tc.`created`, `ip`, `comment`, `version`, `flag`, tp.`content_id` - FROM `".BIT_DB_PREFIX."tiki_pages` tp INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc ON (tc.`content_id` = tp.`content_id`), `".BIT_DB_PREFIX."users_users` uue, `".BIT_DB_PREFIX."users_users` uuc - WHERE tc.`content_type_guid`=? AND tc.`modifier_user_id`=uue.`user_id` AND tc.`user_id`=uuc.`user_id` $mid - ORDER BY ".$this->mDb->convert_sortmode($sort_mode); - $query_cant = "select count(*) from - `".BIT_DB_PREFIX."tiki_pages` tp INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc - ON (tc.`content_id` = tp.`content_id`) + if( $pGetData ) { + $get_data = 'tc.`data`,'; + } else { + $get_data = ''; + } + + $query = "SELECT + uue.`login` AS modifier_user, + uue.`real_name` AS modifier_real_name, + uuc.`login` AS creator_user, + uuc.`real_name` AS creator_real_name, + `page_id`, + `hits`, + `page_size` as `len`, + tc.`title`, + tc.`format_guid`, + tp.`description`, + tc.`last_modified`, + tc.`created`, + $get_data + `ip`, + `comment`, + `version`, + `flag`, + tp.`content_id` + FROM `".BIT_DB_PREFIX."tiki_pages` tp + INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc ON (tc.`content_id` = tp.`content_id`), + `".BIT_DB_PREFIX."users_users` uue, + `".BIT_DB_PREFIX."users_users` uuc + WHERE tc.`content_type_guid`=? + AND tc.`modifier_user_id`=uue.`user_id` + AND tc.`user_id`=uuc.`user_id` $mid + ORDER BY ".$this->mDb->convert_sortmode( $sort_mode ); + $query_cant = "SELECT COUNT(*) + FROM `".BIT_DB_PREFIX."tiki_pages` tp + INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc ON (tc.`content_id` = tp.`content_id`) WHERE tc.`content_type_guid`=? $mid"; - if ($pOrphansOnly) { + if( $pOrphansOnly ) { $query = "SELECT uue.`login` AS modifier_user, uue.`real_name` AS modifier_real_name, @@ -821,43 +850,40 @@ class BitPage extends LibertyAttachable { tp.`description`, tc.`last_modified`, tc.`created`, + $get_data `ip`, `comment`, `version`, `flag`, tp.`content_id` FROM `".BIT_DB_PREFIX."tiki_pages` tp - LEFT JOIN `".BIT_DB_PREFIX."tiki_links` tl ON tp.`content_id` = tl.`to_content_id` - INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc - ON (tc.`content_id` = tp.`content_id`), + LEFT JOIN `".BIT_DB_PREFIX."tiki_links` tl ON (tp.`content_id` = tl.`to_content_id`) + INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc ON (tc.`content_id` = tp.`content_id`), `".BIT_DB_PREFIX."users_users` uue, `".BIT_DB_PREFIX."users_users` uuc WHERE tc.`content_type_guid`=? AND tc.`modifier_user_id`=uue.`user_id` AND tc.`user_id`=uuc.`user_id` $mid AND tl.`to_content_id` is NULL - ORDER BY " - . $this->mDb->convert_sortmode($sort_mode); - $query_cant = "select count(*) - FROM `".BIT_DB_PREFIX."tiki_pages` tp - LEFT JOIN `".BIT_DB_PREFIX."tiki_links` tl on tp.`content_id` = tl.`to_content_id` - INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc - ON (tc.`content_id` = tp.`content_id`) - WHERE tc.`content_type_guid`=? - AND tl.`to_content_id` is NULL"; + ORDER BY ".$this->mDb->convert_sortmode( $sort_mode ); + $query_cant = "SELECT COUNT(*) + FROM `".BIT_DB_PREFIX."tiki_pages` tp + LEFT JOIN `".BIT_DB_PREFIX."tiki_links` tl ON (tp.`content_id` = tl.`to_content_id`) + INNER JOIN `".BIT_DB_PREFIX."tiki_content` tc ON (tc.`content_id` = tp.`content_id`) + WHERE tc.`content_type_guid`=? $mid + AND tl.`to_content_id` IS NULL"; } - // If sort mode is versions then offset is 0, maxRecords is -1 (again) and sort_mode is nil // If sort mode is links then offset is 0, maxRecords is -1 (again) and sort_mode is nil // If sort mode is backlinks then offset is 0, maxRecords is -1 (again) and sort_mode is nil $this->mDb->StartTrans(); - $result = $this->mDb->query($query,$bindVars,$maxRecords,$offset); - $cant = $this->mDb->getOne($query_cant,$bindVars); + $result = $this->mDb->query( $query, $bindVars, $maxRecords, $offset ); + $cant = $this->mDb->getOne( $query_cant, $bindVars ); $this->mDb->CompleteTrans(); $ret = array(); - while ($res = $result->fetchRow()) { + while( $res = $result->fetchRow() ) { $aux = array(); $aux = $res; $aux['creator'] = (isset( $res['creator_real_name'] ) ? $res['creator_real_name'] : $res['creator_user'] ); diff --git a/admin/schema_inc.php b/admin/schema_inc.php index 31252d3..99428b2 100644 --- a/admin/schema_inc.php +++ b/admin/schema_inc.php @@ -3,101 +3,101 @@ $tables = array( 'tiki_actionlog' => " - page_id I4 NOTNULL, - user_id I4 NOTNULL, - action C(255) NOTNULL, - last_modified I8, - title C(160), - ip C(15), - comment C(200) + page_id I4 NOTNULL, + user_id I4 NOTNULL, + action C(255) NOTNULL, + last_modified I8, + title C(160), + ip C(15), + comment C(200) ", 'tiki_copyrights' => " - copyright_id I4 AUTO PRIMARY, - page_id I4 NOTNULL, - title C(200), - year I8, - authors C(200), - copyright_order I8, - user_id I4 + copyright_id I4 AUTO PRIMARY, + page_id I4 NOTNULL, + title C(200), + year I8, + authors C(200), + copyright_order I8, + user_id I4 ", 'tiki_history' => " - page_id I4 PRIMARY, - version I4 PRIMARY, - last_modified I8 NOTNULL, - format_guid C(16) NOTNULL, - description C(200), - user_id C(40), - ip C(15), - comment C(200), - data X - CONSTRAINTS ', CONSTRAINT `tiki_history_page_ref` FOREIGN KEY (`page_id`) REFERENCES `".BIT_DB_PREFIX."tiki_pages`( `page_id` )' + page_id I4 PRIMARY, + version I4 PRIMARY, + last_modified I8 NOTNULL, + format_guid C(16) NOTNULL, + description C(200), + user_id C(40), + ip C(15), + comment C(200), + data X + CONSTRAINTS ', CONSTRAINT `tiki_history_page_ref` FOREIGN KEY (`page_id`) REFERENCES `".BIT_DB_PREFIX."tiki_pages`( `page_id` )' ", 'tiki_links' => " - from_content_id I4 PRIMARY, - to_content_id I4 PRIMARY + from_content_id I4 PRIMARY, + to_content_id I4 PRIMARY ", 'tiki_page_footnotes' => " - user_id C(40) PRIMARY, - page_id I4 NOTNULL, - data X + user_id C(40) PRIMARY, + page_id I4 NOTNULL, + data X ", 'tiki_pages' => " - page_id I4 PRIMARY, - content_id I4 NOTNULL, - version I4 NOTNULL, - page_size I4 DEFAULT 0, - description C(200), - comment C(200), - flag C(1), - points I4, - votes I4, - cache X, - wiki_cache I8, - cache_timestamp I8, - page_rank N(4,3) + page_id I4 PRIMARY, + content_id I4 NOTNULL, + version I4 NOTNULL, + page_size I4 DEFAULT 0, + description C(200), + comment C(200), + flag C(1), + points I4, + votes I4, + cache X, + wiki_cache I8, + cache_timestamp I8, + page_rank N(4,3) ", 'tiki_received_pages' => " - received_page_id I4 AUTO PRIMARY, - title C(160) NOTNULL, - data X, - description C(200), - comment C(200), - received_from_site C(200), - received_from_user C(200), - received_date I8 + received_page_id I4 AUTO PRIMARY, + title C(160) NOTNULL, + data X, + description C(200), + comment C(200), + received_from_site C(200), + received_from_user C(200), + received_date I8 ", 'tiki_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, - comment C(200), - version I4 NOTNULL, - ip C(15), - flag C(1) + 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, + comment C(200), + version I4 NOTNULL, + ip C(15), + flag C(1) ", 'tiki_semaphores' => " - sem_name C(250) PRIMARY, - user_id I4 NOTNULL, - created I8 + sem_name C(250) PRIMARY, + user_id I4 NOTNULL, + created I8 ", 'tiki_extwiki' => " - extwiki_id I4 AUTO PRIMARY, - name C(200) NOTNULL, - extwiki C(255) + extwiki_id I4 AUTO PRIMARY, + name C(200) NOTNULL, + extwiki C(255) " ); diff --git a/templates/create_book.tpl b/templates/create_book.tpl index acff898..587974a 100644 --- a/templates/create_book.tpl +++ b/templates/create_book.tpl @@ -1,4 +1,4 @@ -{* $Header: /cvsroot/bitweaver/_bit_wiki/templates/create_book.tpl,v 1.1 2005/06/19 06:12:45 bitweaver Exp $ *} +{* $Header: /cvsroot/bitweaver/_bit_wiki/templates/create_book.tpl,v 1.2 2005/10/29 17:57:43 squareing Exp $ *} {strip} <div class="floaticon">{bithelp}</div> @@ -21,7 +21,7 @@ <div class="row"> {formlabel label="Table of Contents<br />(optional)" for="chapters"} {forminput} - <textarea rows="10" cols="60" name="chapters" id="chapters"></textarea> + <textarea rows="10" cols="50" name="chapters" id="chapters"></textarea> {formhelp note="To enter the table of contents manually, you can add WikiPage names on separate lines. Pages that don't exist will be added automagically and you can edit them later."} {/forminput} </div> diff --git a/templates/edit_page.tpl b/templates/edit_page.tpl index 370ae97..04e44d4 100644 --- a/templates/edit_page.tpl +++ b/templates/edit_page.tpl @@ -1,4 +1,4 @@ -{* $Header: /cvsroot/bitweaver/_bit_wiki/templates/edit_page.tpl,v 1.10 2005/10/12 15:14:13 spiderr Exp $ *} +{* $Header: /cvsroot/bitweaver/_bit_wiki/templates/edit_page.tpl,v 1.11 2005/10/29 17:57:43 squareing Exp $ *} <div class="floaticon">{bithelp}</div> <div class="edit wiki"> @@ -92,7 +92,7 @@ <div class="row"> {forminput} - <textarea id="{$textarea_id}" name="edit" rows="{$rows|default:20}" cols="{$cols|default:80}">{$pageInfo.data|escape:html}</textarea> + <textarea id="{$textarea_id}" name="edit" rows="{$rows|default:20}" cols="{$cols|default:50}">{$pageInfo.data|escape:html}</textarea> {/forminput} </div> @@ -100,7 +100,7 @@ <div class="row"> {formlabel label="Footnotes" for="footnote"} {forminput} - <textarea name="footnote" id="footnote" rows="8" cols="80">{$footnote|escape}</textarea> + <textarea name="footnote" id="footnote" rows="8" cols="50">{$footnote|escape}</textarea> {formhelp note=""} {/forminput} </div> diff --git a/templates/header_inc.tpl b/templates/header_inc.tpl index 705d959..1e50ad1 100644 --- a/templates/header_inc.tpl +++ b/templates/header_inc.tpl @@ -1,6 +1,7 @@ -{* $Header: /cvsroot/bitweaver/_bit_wiki/templates/header_inc.tpl,v 1.2 2005/10/23 14:44:19 squareing Exp $ *} +{* $Header: /cvsroot/bitweaver/_bit_wiki/templates/header_inc.tpl,v 1.3 2005/10/29 17:57:43 squareing Exp $ *} {strip} {if $gBitSystem->isPackageActive( 'rss' ) and $smarty.const.ACTIVE_PACKAGE eq 'wiki' and $gBitUser->hasPermission( 'bit_p_view' )} - <link rel="alternate" type="application/rss+xml" title="{$siteTitle} - wiki" href="{$smarty.const.WIKI_PKG_URL}wiki_rss.php" /> + <link rel="alternate" type="application/rss+xml" title="{tr}Wiki{/tr} RSS" href="{$smarty.const.WIKI_PKG_URL}wiki_rss.php?version=rss20" /> + <link rel="alternate" type="application/rss+xml" title="{tr}Wiki{/tr} ATOM" href="{$smarty.const.WIKI_PKG_URL}wiki_rss.php?version=atom" /> {/if} {/strip} diff --git a/templates/received_pages.tpl b/templates/received_pages.tpl index 814cca4..87e07ff 100644 --- a/templates/received_pages.tpl +++ b/templates/received_pages.tpl @@ -22,7 +22,7 @@ </td></tr> <tr><td> {tr}Data{/tr}:</td><td> -<textarea name="data" rows="10" cols="60">{$data|escape}</textarea> +<textarea name="data" rows="10" cols="50">{$data|escape}</textarea> </td></tr> <tr><td> {tr}Comment{/tr}:</td><td> diff --git a/wiki_rss.php b/wiki_rss.php index 53f33f3..fbedda4 100644 --- a/wiki_rss.php +++ b/wiki_rss.php @@ -6,29 +6,33 @@ require_once( WIKI_PKG_PATH."BitPage.php" ); $gBitSystem->verifyPackage( 'wiki' ); $gBitSystem->verifyPackage( 'rss' ); -$rss->title = $gBitSystem->getPreference( 'title_rss_wiki', $gBitSystem->mPrefs['siteTitle'] ); +$rss->title = $gBitSystem->getPreference( 'title_rss_wiki', $gBitSystem->mPrefs['siteTitle'].' - '.tra( 'Wiki' ) ); $rss->description = $gBitSystem->getPreference( 'desc_rss_wiki', $gBitSystem->mPrefs['siteTitle'].' - '.tra( 'RSS Feed' ) ); // check permission to view wiki pages if( !$gBitUser->hasPermission( 'bit_p_view' ) ) { require_once( RSS_PKG_PATH."rss_error.php" ); } else { + // check if we want to use the cache file + $cacheFile = TEMP_PKG_PATH.RSS_PKG_NAME.'/'.WIKI_PKG_NAME.'_'.$version.'.xml'; + $rss->useCached( $cacheFile ); // use cached version if age < 1 hour + $wiki = new BitPage(); - $feeds = $wiki->getList( 0, $gBitSystem->getPreference( 'max_rss_wiki', 10 ), 'last_modified_desc'); + $feeds = $wiki->getList( 0, $gBitSystem->getPreference( 'max_rss_wiki', 10 ), 'last_modified_desc', NULL, NULL, FALSE, FALSE, TRUE ); $feeds = $feeds['data']; // get all the data ready for the feed creator foreach( $feeds as $feed ) { $item = new FeedItem(); $item->title = $feed['title']; - $item->link = 'http://'.$_SERVER['HTTP_HOST'].BIT_ROOT_URL.$wiki->getDisplayUrl( $feed['title'] ); - $item->description = $feed['description']."\n\n".$feed['comment']; + $item->link = BIT_BASE_URI.$wiki->getDisplayUrl( $feed['title'] ); + $item->description = $wiki->parseData( $feed['data'], $feed['format_guid'] ); - $item->date = (int) $feed['last_modified']; + $item->date = ( int )$feed['last_modified']; $item->source = 'http://'.$_SERVER['HTTP_HOST'].BIT_ROOT_URL; $item->author = $gBitUser->getDisplayName( FALSE, array( 'real_name' => $feed['modifier_real_name'], 'login' => $feed['modifier_user'] ) ); - $item->descriptionTruncSize = $gBitSystem->getPreference( 'rssfeed_truncate', 500 ); + $item->descriptionTruncSize = $gBitSystem->getPreference( 'rssfeed_truncate', 1000 ); $item->descriptionHtmlSyndicated = FALSE; // pass the item on to the rss feed creator @@ -36,8 +40,6 @@ if( !$gBitUser->hasPermission( 'bit_p_view' ) ) { } // finally we are ready to serve the data - $cacheFile = TEMP_PKG_PATH.'rss/wiki_'.$version.'.xml'; - $rss->useCached( $cacheFile ); // use cached version if age < 1 hour echo $rss->saveFeed( $rss_version_name, $cacheFile ); } ?> |
