summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BitPage.php22
-rw-r--r--bit_setup_inc.php2
-rw-r--r--edit.php407
-rw-r--r--edit_book.php9
-rw-r--r--templates/admin_external_wikis.tpl2
-rw-r--r--templates/page_action_bar.tpl7
-rw-r--r--templates/page_icons.tpl2
7 files changed, 208 insertions, 243 deletions
diff --git a/BitPage.php b/BitPage.php
index 21af36e..ede11c9 100644
--- a/BitPage.php
+++ b/BitPage.php
@@ -1,11 +1,11 @@
<?php
/**
- * @version $Header: /cvsroot/bitweaver/_bit_wiki/BitPage.php,v 1.12 2005/10/29 17:57:43 squareing Exp $
+ * @version $Header: /cvsroot/bitweaver/_bit_wiki/BitPage.php,v 1.13 2005/12/18 22:33:42 squareing Exp $
* @package wiki
*
* @author spider <spider@steelsun.com>
*
- * @version $Revision: 1.12 $ $Date: 2005/10/29 17:57:43 $ $Author: squareing $
+ * @version $Revision: 1.13 $ $Date: 2005/12/18 22:33:42 $ $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.12 2005/10/29 17:57:43 squareing Exp $
+ * $Id: BitPage.php,v 1.13 2005/12/18 22:33:42 squareing Exp $
*/
/**
@@ -272,7 +272,7 @@ class BitPage extends LibertyAttachable {
*/ }
if( empty( $pParamHash['comment'] ) ) {
- unset( $pParamHash['comment'] );
+ $pParamHash['page_store']['comment'] = NULL;
} else {
$pParamHash['page_store']['comment'] = substr( $pParamHash['comment'], 0, 200 );
}
@@ -473,23 +473,19 @@ class BitPage extends LibertyAttachable {
if( is_array( $pExistsHash ) ) {
if( is_array( current( $pExistsHash ) ) ) {
$exists = $pExistsHash[0];
+ $multiple = true;
} else {
$exists = $pExistsHash;
+ $multiple = false;
}
// we have a multi-demensional array (likely returned from LibertyContent::pageExists() ) - meaning we potentially have multiple pages with the same name
- if( count( $pExistsHash ) > 1 ) {
+ if( $multiple ) {
$desc = tra( 'Multiple pages with this name' );
$ret = "<a title=\"$desc\" href=\"" . BitPage::getDisplayUrl( $exists['title'] ) . "\">$pPageName</a>";
- } elseif( count( $pExistsHash ) == 1 ) {
- $desc = $exists['description'];
- $ret = "<a title=\"$desc\" href=\"" . BitPage::getDisplayUrl( $exists['title'] ) . "\">$pPageName</a>";
} else {
- if( $gBitUser->hasPermission( 'bit_p_edit' ) ) {
- $ret = "<a href=\"".WIKI_PKG_URL."edit.php?page=" . urlencode( $exists['title'] ). "\" class=\"create\">$pPageName</a>";
- } else {
- $ret = $pPageName;
- }
+ $desc = !isset($exists['description']) ? $exists['title'] : $exists['description'];
+ $ret = "<a title=\"$desc\" href=\"" . BitPage::getDisplayUrl( $exists['title'] ) . "\">$pPageName</a>";
}
} else {
if( $gBitUser->hasPermission( 'bit_p_edit' ) ) {
diff --git a/bit_setup_inc.php b/bit_setup_inc.php
index 552f36d..807edb8 100644
--- a/bit_setup_inc.php
+++ b/bit_setup_inc.php
@@ -6,7 +6,7 @@
if($gBitSystem->isPackageActive( 'wiki' ) ) {
if ($gBitUser->hasPermission( 'bit_p_view' )) {
- $gBitSystem->registerAppMenu( 'wiki', 'Wiki', WIKI_PKG_URL.'index.php', 'bitpackage:wiki/menu_wiki.tpl', 'wiki');
+ $gBitSystem->registerAppMenu( WIKI_PKG_DIR, 'Wiki', WIKI_PKG_URL.'index.php', 'bitpackage:wiki/menu_wiki.tpl', 'wiki');
}
$gBitSystem->registerNotifyEvent( array( "wiki_page_changes" => tra("Any wiki page is changed") ) );
diff --git a/edit.php b/edit.php
index b5959fb..588bf4b 100644
--- a/edit.php
+++ b/edit.php
@@ -1,14 +1,14 @@
<?php
/**
- * $Header: /cvsroot/bitweaver/_bit_wiki/edit.php,v 1.9 2005/10/12 15:14:13 spiderr Exp $
+ * $Header: /cvsroot/bitweaver/_bit_wiki/edit.php,v 1.10 2005/12/18 22:33:43 squareing Exp $
*
- * Copyright (c) 2004 bitweaver.org
- * Copyright (c) 2003 tikwiki.org
- * Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+ * 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: edit.php,v 1.9 2005/10/12 15:14:13 spiderr Exp $
+ * $Id: edit.php,v 1.10 2005/12/18 22:33:43 squareing Exp $
* @package wiki
* @subpackage functions
*/
@@ -18,7 +18,7 @@
*/
require_once( '../bit_setup_inc.php' );
-include_once( WIKI_PKG_PATH.'BitBook.php');
+include_once( WIKI_PKG_PATH.'BitBook.php' );
include_once( LIBERTY_PKG_PATH.'edit_help_inc.php' );
$gBitSystem->verifyPackage( 'wiki' );
@@ -29,13 +29,12 @@ include( WIKI_PKG_PATH.'lookup_page_inc.php' );
global $wikilib, $gLibertySystem;
#edit preview needs this
-if (!isset($_REQUEST['title']) && isset($gContent->mInfo['title'])) {
+if( !isset( $_REQUEST['title'] ) && isset( $gContent->mInfo['title'] ) ) {
$_REQUEST['title'] = $gContent->mInfo['title'];
}
$sandbox = FALSE;
-if ( (!empty($_REQUEST['page']) && $_REQUEST['page'] == 'SandBox') ||
- (!empty($_REQUEST['title']) && $_REQUEST['title'] == 'SandBox') ) {
+if( ( !empty( $_REQUEST['page'] ) && $_REQUEST['page'] == 'SandBox' ) || ( !empty( $_REQUEST['title'] ) && $_REQUEST['title'] == 'SandBox' ) ) {
$gContent->mInfo['title'] = 'SandBox';
$sandbox = TRUE;
}
@@ -58,16 +57,16 @@ foreach( $gLibertySystem->mPlugins as $plugin ) {
}
}
-function compare_import_versions($a1, $a2) {
+function compare_import_versions( $a1, $a2 ) {
return $a1["version"] - $a2["version"];
}
/**
- * \brief Parsed HTML tree walker (used by HTML sucker)
+ * \brief Parsed HTML tree walker( used by HTML sucker )
*
- * This is initial implementation (stupid... w/o any intellegence (almost :))
+ * This is initial implementation( stupid... w/o any intellegence( almost : ) )
* It is rapidly designed version... just for test: 'can this feature be useful'.
- * Later it should be replaced by well designed one :) don't bash me now :)
+ * Later it should be replaced by well designed one :) don't bash me now : )
*
* \param &$c array -- parsed HTML
* \param &$src string -- output string
@@ -75,159 +74,144 @@ function compare_import_versions($a1, $a2) {
['listack'] = stack of list types currently opened
['first_td'] = flag: 'is <tr> was just before this <td>'
*/
-function walk_and_parse(&$c, &$src, &$p)
-{
- for ($i=0; $i <= $c["contentpos"]; $i++)
- {
+function walk_and_parse( &$c, &$src, &$p ) {
+ for( $i=0; $i <= $c["contentpos"]; $i++ ) {
// If content type 'text' output it to destination...
- if ($c[$i]["type"] == "text") $src .= $c[$i]["data"];
- elseif ($c[$i]["type"] == "tag")
- {
- if ($c[$i]["data"]["type"] == "open")
- {
+ if( $c[$i]["type"] == "text" ) {
+ $src .= $c[$i]["data"];
+ } elseif( $c[$i]["type"] == "tag" ) {
+ if( $c[$i]["data"]["type"] == "open" ) {
// Open tag type
- switch ($c[$i]["data"]["name"])
- {
- case "br": $src .= "\n"; break;
- case "title": $src .= "\n!"; $p['stack'][] = array('tag' => 'title', 'string' => "\n"); break;
- case "p": $src .= "\n"; $p['stack'][] = array('tag' => 'p', 'string' => "\n"); break;
- case "b": $src .= '__'; $p['stack'][] = array('tag' => 'b', 'string' => '__'); break;
- case "i": $src .= "''"; $p['stack'][] = array('tag' => 'i', 'string' => "''"); break;
- case "u": $src .= "=="; $p['stack'][] = array('tag' => 'u', 'string' => "=="); break;
- case "center": $src .= '::'; $p['stack'][] = array('tag' => 'center', 'string' => '::'); break;
- case "code": $src .= '-+'; $p['stack'][] = array('tag' => 'code', 'string' => '+-'); break;
- // headers detection looks like real suxx code...
- // but possible it run faster :) I don't know where is profiler in PHP...
- case "h1": $src .= "\n!"; $p['stack'][] = array('tag' => 'h1', 'string' => "\n"); break;
- case "h2": $src .= "\n!!"; $p['stack'][] = array('tag' => 'h2', 'string' => "\n"); break;
- case "h3": $src .= "\n!!!"; $p['stack'][] = array('tag' => 'h3', 'string' => "\n"); break;
- case "h3": $src .= "\n!!!!"; $p['stack'][] = array('tag' => 'h4', 'string' => "\n"); break;
- case "h5": $src .= "\n!!!!!"; $p['stack'][] = array('tag' => 'h5', 'string' => "\n"); break;
- case "h6": $src .= "\n!!!!!!"; $p['stack'][] = array('tag' => 'h6', 'string' => "\n"); break;
- case "pre": $src .= '~pp~'; $p['stack'][] = array('tag' => 'pre', 'string' => '~/pp~'); break;
- // Table parser
- case "table": $src .= '||'; $p['stack'][] = array('tag' => 'table', 'string' => '||'); break;
- case "tr": $p['first_td'] = true; break;
- case "td": $src .= $p['first_td'] ? '' : '|'; $p['first_td'] = false; break;
- // Lists parser
- case "ul": $p['listack'][] = '*'; break;
- case "ol": $p['listack'][] = '#'; break;
- case "li":
- // Generate wiki list item according to current list depth.
- // (ensure '*/#' starts from begining of line)
- for ($l = ''; strlen($l) < count($p['listack']); $l .= end($p['listack']));
- $src .= "\n$l ";
- break;
- case "font":
- // If color attribute present in <font> tag
- if (isset($c[$i]["pars"]["color"]["value"]))
- {
- $src .= '~~'.$c[$i]["pars"]["color"]["value"].':';
- $p['stack'][] = array('tag' => 'font', 'string' => '~~');
- }
- break;
- case "img":
- // If src attribute present in <img> tag
- if (isset($c[$i]["pars"]["src"]["value"]))
- // Note what it produce (img) not {img}! Will fix this below...
- $src .= '(img src='.$c[$i]["pars"]["src"]["value"].')';
- break;
- case "a":
- // If href attribute present in <a> tag
- if (isset($c[$i]["pars"]["href"]["value"]))
- {
- $src .= '['.$c[$i]["pars"]["href"]["value"].'|';
- $p['stack'][] = array('tag' => 'a', 'string' => ']');
- }
- break;
+ switch( $c[$i]["data"]["name"] ) {
+ case "br": $src .= "\n"; break;
+ case "title": $src .= "\n!"; $p['stack'][] = array( 'tag' => 'title', 'string' => "\n" ); break;
+ case "p": $src .= "\n"; $p['stack'][] = array( 'tag' => 'p', 'string' => "\n" ); break;
+ case "b": $src .= '__'; $p['stack'][] = array( 'tag' => 'b', 'string' => '__' ); break;
+ case "i": $src .= "''"; $p['stack'][] = array( 'tag' => 'i', 'string' => "''" ); break;
+ case "u": $src .= "=="; $p['stack'][] = array( 'tag' => 'u', 'string' => "==" ); break;
+ case "center": $src .= '::'; $p['stack'][] = array( 'tag' => 'center', 'string' => '::' ); break;
+ case "code": $src .= '-+'; $p['stack'][] = array( 'tag' => 'code', 'string' => '+-' ); break;
+ // headers detection looks like real suxx code...
+ // but possible it run faster :) I don't know where is profiler in PHP...
+ case "h1": $src .= "\n!"; $p['stack'][] = array( 'tag' => 'h1', 'string' => "\n" ); break;
+ case "h2": $src .= "\n!!"; $p['stack'][] = array( 'tag' => 'h2', 'string' => "\n" ); break;
+ case "h3": $src .= "\n!!!"; $p['stack'][] = array( 'tag' => 'h3', 'string' => "\n" ); break;
+ case "h4": $src .= "\n!!!!"; $p['stack'][] = array( 'tag' => 'h4', 'string' => "\n" ); break;
+ case "h5": $src .= "\n!!!!!"; $p['stack'][] = array( 'tag' => 'h5', 'string' => "\n" ); break;
+ case "h6": $src .= "\n!!!!!!"; $p['stack'][] = array( 'tag' => 'h6', 'string' => "\n" ); break;
+ case "pre": $src .= '~pp~'; $p['stack'][] = array( 'tag' => 'pre', 'string' => '~/pp~' ); break;
+ // Table parser
+ case "table": $src .= '||'; $p['stack'][] = array( 'tag' => 'table', 'string' => '||' ); break;
+ case "tr": $p['first_td'] = true; break;
+ case "td": $src .= $p['first_td'] ? '' : '|'; $p['first_td'] = false; break;
+ // Lists parser
+ case "ul": $p['listack'][] = '*'; break;
+ case "ol": $p['listack'][] = '#'; break;
+ case "li":
+ // Generate wiki list item according to current list depth.
+ //( ensure '*/#' starts from begining of line )
+ for( $l = ''; strlen( $l ) < count( $p['listack'] ); $l .= end( $p['listack'] ) );
+ $src .= "\n$l ";
+ break;
+ case "font":
+ // If color attribute present in <font> tag
+ if( isset( $c[$i]["pars"]["color"]["value"] ) ) {
+ $src .= '~~'.$c[$i]["pars"]["color"]["value"].':';
+ $p['stack'][] = array( 'tag' => 'font', 'string' => '~~' );
+ }
+ break;
+ case "img":
+ // If src attribute present in <img> tag
+ if( isset( $c[$i]["pars"]["src"]["value"] ) ) {
+ // Note what it produce( img ) not {img}! Will fix this below...
+ $src .= '( img src='.$c[$i]["pars"]["src"]["value"].' )';
+ }
+ break;
+ case "a":
+ // If href attribute present in <a> tag
+ if( isset( $c[$i]["pars"]["href"]["value"] ) ) {
+ $src .= '['.$c[$i]["pars"]["href"]["value"].'|';
+ $p['stack'][] = array( 'tag' => 'a', 'string' => ']' );
+ }
+ break;
}
- }
- else
- {
+ } else {
// This is close tag type. Is that smth we r waiting for?
- switch ($c[$i]["data"]["name"])
- {
+ switch( $c[$i]["data"]["name"] ) {
case "ul":
- if (end($p['listack']) == '*') array_pop($p['listack']);
+ if( end( $p['listack'] ) == '*' ) array_pop( $p['listack'] );
break;
case "ol":
- if (end($p['listack']) == '#') array_pop($p['listack']);
+ if( end( $p['listack'] ) == '#' ) array_pop( $p['listack'] );
break;
default:
- $e = end($p['stack']);
- if ($c[$i]["data"]["name"] == $e['tag'])
- {
+ $e = end( $p['stack'] );
+ if( $c[$i]["data"]["name"] == $e['tag'] ) {
$src .= $e['string'];
- array_pop($p['stack']);
+ array_pop( $p['stack'] );
}
break;
}
}
}
// Recursive call on tags with content...
- if (isset($c[$i]["content"]))
- {
-// if (substr($src, -1) != " ") $src .= " ";
- walk_and_parse($c[$i]["content"], $src, $p);
+ if( isset( $c[$i]["content"] ) ) {
+// if( substr( $src, -1 )!= " " )$src .= " ";
+ walk_and_parse( $c[$i]["content"], $src, $p );
}
}
}
if( isset( $_REQUEST["suck_url"] ) ) {
// Suck another page and append to the end of current
require_once( UTIL_PKG_PATH.'htmlparser/html_parser_inc.php' );
- $suck_url = isset($_REQUEST["suck_url"]) ? $_REQUEST["suck_url"] : '';
- $parsehtml = isset ($_REQUEST["parsehtml"]) ? ($_REQUEST["parsehtml"] == 'on' ? 'y' : 'n') : 'n';
- if (isset($_REQUEST['do_suck']) && strlen($suck_url) > 0)
- {
+ $suck_url = isset( $_REQUEST["suck_url"] ) ? $_REQUEST["suck_url"] : '';
+ $parsehtml = isset( $_REQUEST["parsehtml"] ) ? ( $_REQUEST["parsehtml"] == 'on' ? 'y' : 'n' ): 'n';
+ if( isset( $_REQUEST['do_suck'] ) && strlen( $suck_url ) > 0 ) {
// \note by zaufi
// This is ugly implementation of wiki HTML import.
// I think it should be plugable import/export converters with ability
// to choose from edit form what converter to use for operation.
// In case of import converter, it can try to guess what source
- // file is (using mime type from remote server response).
+ // file is( using mime type from remote server response ).
// Of couse converters may have itsown configuration panel what should be
- // pluged into wiki page edit form too... (like HTML importer may have
- // flags 'strip HTML tags' and 'try to convert HTML to wiki' :)
- // At least one export filter for wiki already coded :) -- PDF exporter...
- $sdta = @file_get_contents($suck_url);
- if (isset($php_errormsg) && strlen($php_errormsg))
- {
+ // pluged into wiki page edit form too...( like HTML importer may have
+ // flags 'strip HTML tags' and 'try to convert HTML to wiki' : )
+ // At least one export filter for wiki already coded : ) -- PDF exporter...
+ $sdta = @file_get_contents( $suck_url );
+ if( isset( $php_errormsg ) && strlen( $php_errormsg ) ) {
$gBitSystem->fatalError( 'Can\'t import remote HTML page' );
}
// Need to parse HTML?
- if ($parsehtml == 'y')
- {
- // Read compiled (serialized) grammar
+ if( $parsehtml == 'y' ) {
+ // Read compiled( serialized ) grammar
$grammarfile = HTML_PKG_PATH.'htmlgrammar.cmp';
- if (!$fp = @fopen($grammarfile,'r'))
- {
+ if( !$fp = @fopen( $grammarfile,'r' ) ) {
$gBitSystem->fatalError( 'Can\'t parse remote HTML page' );
}
- $grammar = unserialize(fread($fp, filesize($grammarfile)));
- fclose($fp);
+ $grammar = unserialize( fread( $fp, filesize( $grammarfile ) ) );
+ fclose( $fp );
// create parser object, insert html code and parse it
- $htmlparser = new HtmlParser($sdta, $grammar, '', 0);
+ $htmlparser = new HtmlParser( $sdta, $grammar, '', 0 );
$htmlparser->Parse();
// Should I try to convert HTML to wiki?
$parseddata = '';
- $p = array('stack' => array(), 'listack' => array(), 'first_td' => false);
- walk_and_parse($htmlparser->content, $parseddata, $p);
- // Is some tags still opened? (It can be if HTML not valid, but this is not reason
- // to produce invalid wiki :)
- while (count($p['stack']))
- {
- $e = end($p['stack']);
+ $p = array( 'stack' => array(), 'listack' => array(), 'first_td' => false );
+ walk_and_parse( $htmlparser->content, $parseddata, $p );
+ // Is some tags still opened?( It can be if HTML not valid, but this is not reason
+ // to produce invalid wiki : )
+ while( count( $p['stack'] ) ) {
+ $e = end( $p['stack'] );
$sdta .= $e['string'];
- array_pop($p['stack']);
+ array_pop( $p['stack'] );
}
// Unclosed lists r ignored... wiki have no special start/end lists syntax....
// OK. Things remains to do:
- // 1) fix linked images
- $parseddata = preg_replace(',\[(.*)\|\(img src=(.*)\)\],mU','{img src=$2 link=$1}', $parseddata);
- // 2) fix remains images (not in links)
- $parseddata = preg_replace(',\(img src=(.*)\),mU','{img src=$1}', $parseddata);
- // 3) remove empty lines
- $parseddata = preg_replace(",[\n]+,mU","\n", $parseddata);
+ // 1 ) fix linked images
+ $parseddata = preg_replace( ',\[(.*)\|\( img src=(.*)\)\],mU','{img src=$2 link=$1}', $parseddata );
+ // 2 ) fix remains images( not in links )
+ $parseddata = preg_replace( ',\( img src=(.*)\),mU','{img src=$1}', $parseddata );
+ // 3 ) remove empty lines
+ $parseddata = preg_replace( ",[\n]+,mU","\n", $parseddata );
// Reassign previous data
$sdta = $parseddata;
}
@@ -239,31 +223,31 @@ if( isset( $_REQUEST["suck_url"] ) ) {
//include_once( WIKI_PKG_PATH.'page_setup_inc.php' );
// Now check permissions to access this page
-if(isset($gContent->mInfo['wiki_cache']) && $gContent->mInfo['wiki_cache']!=0) {
+if( isset( $gContent->mInfo['wiki_cache'] ) && $gContent->mInfo['wiki_cache']!=0 ) {
$wiki_cache = $gContent->mInfo['wiki_cache'];
- $gBitSmarty->assign('wiki_cache',$wiki_cache);
+ $gBitSmarty->assign( 'wiki_cache',$wiki_cache );
}
if( !empty( $gContent->mInfo ) ) {
$formInfo = $gContent->mInfo;
- $formInfo['edit'] = !empty( $gContent->mInfo['data'] ) ? $gContent->mInfo['data'] : '';
+ $formInfo['edit'] = !empty( $gContent->mInfo['data'] )? $gContent->mInfo['data'] : '';
$formInfo['comment'] = '';
}
-$gBitSmarty->assign('footnote', '');
-$gBitSmarty->assign('has_footnote', 'n');
-if ($gBitSystem->isFeatureActive( 'feature_wiki_footnotes' ) ) {
+$gBitSmarty->assign( 'footnote', '' );
+$gBitSmarty->assign( 'has_footnote', 'n' );
+if( $gBitSystem->isFeatureActive( 'feature_wiki_footnotes' ) ) {
if( $gBitUser->mUserId ) {
$footnote = $gContent->getFootnote( $gBitUser->mUserId );
- $gBitSmarty->assign('footnote', $footnote);
- if ($footnote)
- $gBitSmarty->assign('has_footnote', 'y');
- $gBitSmarty->assign('parsed_footnote', $wikilib->parseData($footnote));
- if (isset($_REQUEST['footnote'])) {
+ $gBitSmarty->assign( 'footnote', $footnote );
+ if( $footnote )
+ $gBitSmarty->assign( 'has_footnote', 'y' );
+ $gBitSmarty->assign( 'parsed_footnote', $wikilib->parseData( $footnote ) );
+ if( isset( $_REQUEST['footnote'] ) ) {
- $gBitSmarty->assign('parsed_footnote', $wikilib->parseData($_REQUEST['footnote']));
- $gBitSmarty->assign('footnote', $_REQUEST['footnote']);
- $gBitSmarty->assign('has_footnote', 'y');
+ $gBitSmarty->assign( 'parsed_footnote', $wikilib->parseData( $_REQUEST['footnote'] ) );
+ $gBitSmarty->assign( 'footnote', $_REQUEST['footnote'] );
+ $gBitSmarty->assign( 'has_footnote', 'y' );
if( empty( $_REQUEST['footnote'] ) ) {
$gContent->expungeFootnote( $gBitUser->mUserId );
} else {
@@ -272,69 +256,63 @@ if ($gBitSystem->isFeatureActive( 'feature_wiki_footnotes' ) ) {
}
}
}
-if (isset($_REQUEST["template_id"]) && $_REQUEST["template_id"] > 0) {
- $template_data = $wikilib->get_template($_REQUEST["template_id"]);
+if( isset( $_REQUEST["template_id"] ) && $_REQUEST["template_id"] > 0 ) {
+ $template_data = $wikilib->get_template( $_REQUEST["template_id"] );
$_REQUEST["edit"] = $template_data["content"];
$_REQUEST["preview"] = 1;
}
-if(isset($_REQUEST["edit"])) {
+if( isset( $_REQUEST["edit"] ) ) {
$formInfo['edit'] = $_REQUEST["edit"];
}
-if(isset($_REQUEST['title'])) {
+if( isset( $_REQUEST['title'] ) ) {
$formInfo['title'] = $_REQUEST['title'];
}
-if(isset($_REQUEST["description"])) {
+if( isset( $_REQUEST["description"] ) ) {
$formInfo['description'] = $_REQUEST["description"];
}
-if (isset($_REQUEST["comment"])) {
+if( isset( $_REQUEST["comment"] ) ) {
$formInfo['comment'] = $_REQUEST["comment"];
+} else {
+ $formInfo['comment'] = '';
}
-else {
- # comment needs to get set to null when page is updated and user didn't supply a comment
- # but if comment is a null value then the comment column in the page table row is not updated
- # and retains its now incorrect value
- # so set to blank
- # there must be a better way to fix this...
- $formInfo['comment'] = ' ';
- }
$cat_obj_type = BITPAGE_CONTENT_TYPE_GUID;
if( $gBitSystem->isFeatureActive( 'wiki_feature_copyrights' ) ) {
- if (isset($_REQUEST['copyrightTitle'])) {
- $gBitSmarty->assign('copyrightTitle', $_REQUEST["copyrightTitle"]);
+ if( isset( $_REQUEST['copyrightTitle'] ) ) {
+ $gBitSmarty->assign( 'copyrightTitle', $_REQUEST["copyrightTitle"] );
}
- if (isset($_REQUEST['copyrightYear'])) {
- $gBitSmarty->assign('copyrightYear', $_REQUEST["copyrightYear"]);
+ if( isset( $_REQUEST['copyrightYear'] ) ) {
+ $gBitSmarty->assign( 'copyrightYear', $_REQUEST["copyrightYear"] );
}
- if (isset($_REQUEST['copyrightAuthors'])) {
- $gBitSmarty->assign('copyrightAuthors', $_REQUEST["copyrightAuthors"]);
+ if( isset( $_REQUEST['copyrightAuthors'] ) ) {
+ $gBitSmarty->assign( 'copyrightAuthors', $_REQUEST["copyrightAuthors"] );
}
}
-function htmldecode($string) {
- $string = strtr($string, array_flip(get_html_translation_table(HTML_ENTITIES)));
- $string = preg_replace("/&#([0-9]+);/me", "chr('\\1')", $string);
+function htmldecode( $string ) {
+ $string = strtr( $string, array_flip( get_html_translation_table( HTML_ENTITIES ) ) );
+ $string = preg_replace( "/&#([0-9]+);/me", "chr('\\1')", $string );
return $string;
}
-function parse_output(&$obj, &$parts,$i) {
+function parse_output( &$obj, &$parts,$i ) {
if( !empty( $obj->parts ) ) {
- for($i=0; $i<count($obj->parts); $i++) {
- parse_output($obj->parts[$i], $parts,$i);
+ for( $i=0; $i<count( $obj->parts ); $i++ ) {
+ parse_output( $obj->parts[$i], $parts,$i );
}
} else {
$ctype = $obj->ctype_primary.'/'.$obj->ctype_secondary;
- switch($ctype) {
+ switch( $ctype ) {
case 'application/x-tikiwiki':
$aux["body"] = $obj->body;
$ccc=$obj->headers["content-type"];
- $items = split(';',$ccc);
- foreach($items as $item) {
- $portions = split('=',$item);
- if(isset($portions[0])&&isset($portions[1])) {
- $aux[trim($portions[0])]=trim($portions[1]);
+ $items = split( ';',$ccc );
+ foreach( $items as $item ) {
+ $portions = split( '=',$item );
+ if( isset( $portions[0] ) &&isset( $portions[1] ) ) {
+ $aux[trim( $portions[0] )]=trim( $portions[1] );
}
}
$parts[]=$aux;
@@ -344,59 +322,59 @@ function parse_output(&$obj, &$parts,$i) {
// Pro
// Check if the page has changed
-if (isset($_REQUEST["fCancel"])) {
+if( isset( $_REQUEST["fCancel"] ) ) {
if( !empty( $gContent->mContentId ) ) {
- header("Location: ".$gContent->getDisplayUrl() );
+ header( "Location: ".$gContent->getDisplayUrl() );
} else {
- header("Location: ".WIKI_PKG_URL );
+ header( "Location: ".WIKI_PKG_URL );
}
die;
-} elseif (isset($_REQUEST["fSavePage"])) {
+} elseif( isset( $_REQUEST["fSavePage"] ) ) {
// Check if all Request values are delivered, and if not, set them
// to avoid error messages. This can happen if some features are
// disabled
// add permisions here otherwise return error!
if( $gBitSystem->isFeatureActive( 'wiki_feature_copyrights' )
- && isset($_REQUEST['copyrightAuthors'])
- && !empty($_REQUEST['copyrightYear'])
- && !empty($_REQUEST['copyrightTitle'])
- ) {
+ && isset( $_REQUEST['copyrightAuthors'] )
+ && !empty( $_REQUEST['copyrightYear'] )
+ && !empty( $_REQUEST['copyrightTitle'] )
+ ) {
require_once( WIKI_PKG_PATH.'copyrights_lib.php' );
$copyrightYear = $_REQUEST['copyrightYear'];
$copyrightTitle = $_REQUEST['copyrightTitle'];
$copyrightAuthors = $_REQUEST['copyrightAuthors'];
$copyrightslib->add_copyright( $gContent->mPageId, $copyrightTitle, $copyrightYear, $copyrightAuthors, $gBitUser->mUserId );
}
- // Parse $edit and eliminate image references to external URIs (make them internal)
- if ( $gBitSystem->isPackageActive( 'imagegals' ) ) {
+ // Parse $edit and eliminate image references to external URIs( make them internal )
+ if( $gBitSystem->isPackageActive( 'imagegals' ) ) {
include_once( IMAGEGALS_PKG_PATH.'imagegal_lib.php' );
- $edit = $imagegallib->capture_images($edit);
+ $edit = $imagegallib->capture_images( $edit );
}
- if ( $gContent->mPageId )
- { if(isset($_REQUEST['isminor'])&&$_REQUEST['isminor']=='on') {
+ if( $gContent->mPageId )
+ { if( isset( $_REQUEST['isminor'] ) && $_REQUEST['isminor']=='on' ) {
$_REQUEST['minor']=true;
} else {
$_REQUEST['minor']=false;
-// $links = $gContent->get_links($edit);
-// $wikilib->cache_links($links);
-// $gContent->storeLinks($links);
+// $links = $gContent->get_links( $edit );
+// $wikilib->cache_links( $links );
+// $gContent->storeLinks( $links );
}
} else {
-// $links = $gContent->get_links($_REQUEST["edit"]);
-// $notcachedlinks = $gContent->get_links_nocache($_REQUEST["edit"]);
-// $cachedlinks = array_diff($links, $notcachedlinks);
-// $gContent->cache_links($cachedlinks);
-// $gContent->storeLinks($cachedlinks);
+// $links = $gContent->get_links( $_REQUEST["edit"] );
+// $notcachedlinks = $gContent->get_links_nocache( $_REQUEST["edit"] );
+// $cachedlinks = array_diff( $links, $notcachedlinks );
+// $gContent->cache_links( $cachedlinks );
+// $gContent->storeLinks( $cachedlinks );
}
if( $gContent->store( $_REQUEST ) ) {
- if ( $gBitSystem->isFeatureActive( 'wiki_watch_author' ) ) {
+ if( $gBitSystem->isFeatureActive( 'wiki_watch_author' ) ) {
$gBitUser->storeWatch( "wiki_page_changed", $gContent->mPageId, $gContent->mContentTypeGuid, $_REQUEST['title'], $gContent->getDisplayUrl() );
}
- header("Location: ".$gContent->getDisplayUrl() );
+ header( "Location: ".$gContent->getDisplayUrl() );
} else {
$formInfo = $_REQUEST;
$formInfo['data'] = &$_REQUEST['edit'];
@@ -406,28 +384,28 @@ if (isset($_REQUEST["fCancel"])) {
$formInfo = $_REQUEST;
$formInfo['data'] = &$_REQUEST['edit'];
}
-if ($gBitSystem->isFeatureActive( 'feature_wiki_templates' ) && $gBitUser->hasPermission( 'bit_p_use_content_templates' )) {
- $templates = $wikilib->list_templates('wiki', 0, -1, 'name_asc', '');
+if( $gBitSystem->isFeatureActive( 'feature_wiki_templates' ) && $gBitUser->hasPermission( 'bit_p_use_content_templates' ) ) {
+ $templates = $wikilib->list_templates( 'wiki', 0, -1, 'name_asc', '' );
}
-$gBitSmarty->assign_by_ref('templates', $templates["data"]);
+$gBitSmarty->assign_by_ref( 'templates', $templates["data"] );
-if(isset($_REQUEST["preview"])) {
- $gBitSmarty->assign('preview',1);
- $gBitSmarty->assign('title',!empty($_REQUEST["title"])?$_REQUEST["title"]:$gContent->mPageName);
+if( isset( $_REQUEST["preview"] ) ) {
+ $gBitSmarty->assign( 'preview',1 );
+ $gBitSmarty->assign( 'title',!empty( $_REQUEST["title"] ) ? $_REQUEST["title"]:$gContent->mPageName );
- $parsed = $gContent->parseData($formInfo['edit'], (!empty( $_REQUEST['format_guid'] ) ? $_REQUEST['format_guid'] :
- ( isset($gContent->mInfo['format_guid']) ? $gContent->mInfo['format_guid'] : 'tikiwiki' ) ) );
+ $parsed = $gContent->parseData( $formInfo['edit'],( !empty( $_REQUEST['format_guid'] ) ? $_REQUEST['format_guid'] :
+( isset( $gContent->mInfo['format_guid'] ) ? $gContent->mInfo['format_guid'] : 'tikiwiki' ) ) );
/* SPELLCHECKING INITIAL ATTEMPT */
//This nice function does all the job!
- if ($wiki_spellcheck == 'y') {
- if (isset($_REQUEST["spellcheck"]) && $_REQUEST["spellcheck"] == 'on') {
- $parsed = $gBitSystem->spellcheckreplace($edit_data, $parsed, $gBitLanguage->mLanguage, 'editwiki');
- $gBitSmarty->assign('spellcheck', 'y');
+ if( $wiki_spellcheck == 'y' ) {
+ if( isset( $_REQUEST["spellcheck"] ) && $_REQUEST["spellcheck"] == 'on' ) {
+ $parsed = $gBitSystem->spellcheckreplace( $edit_data, $parsed, $gBitLanguage->mLanguage, 'editwiki' );
+ $gBitSmarty->assign( 'spellcheck', 'y' );
} else {
- $gBitSmarty->assign('spellcheck', 'n');
+ $gBitSmarty->assign( 'spellcheck', 'n' );
}
}
- $gBitSmarty->assign_by_ref('parsed', $parsed);
+ $gBitSmarty->assign_by_ref( 'parsed', $parsed );
$gContent->invokeServices( 'content_preview_function' );
} else {
@@ -435,22 +413,22 @@ if(isset($_REQUEST["preview"])) {
}
// Configure quicktags list
-if ($gBitSystem->isPackageActive( 'quicktags' ) ) {
+if( $gBitSystem->isPackageActive( 'quicktags' ) ) {
include_once( QUICKTAGS_PKG_PATH.'quicktags_inc.php' );
}
-if ($gBitSystem->isFeatureActive( 'feature_theme_control' ) ) {
+if( $gBitSystem->isFeatureActive( 'feature_theme_control' ) ) {
include( THEMES_PKG_PATH.'tc_inc.php' );
}
if( $gContent->isInStructure() ) {
- $gBitSmarty->assign('showstructs', $gContent->getStructures() );
+ $gBitSmarty->assign( 'showstructs', $gContent->getStructures() );
}
// Flag for 'page bar' that currently 'Edit' mode active
// so no need to show comments & attachments, but need
// to show 'wiki quick help'
-$gBitSmarty->assign('edit_page', 'y');
+$gBitSmarty->assign( 'edit_page', 'y' );
// WYSIWYG and Quicktag variable
$gBitSmarty->assign( 'textarea_id', 'editwiki' );
@@ -461,12 +439,13 @@ if( empty( $formInfo ) ) {
}
// make original page title available for template
-$formInfo['original_title'] = (!empty($gContent->mInfo['title'])) ? $gContent->mInfo['title'] : "" ;
+$formInfo['original_title'] =( !empty( $gContent->mInfo['title'] ) ) ? $gContent->mInfo['title'] : "" ;
$gBitSmarty->assign_by_ref( 'pageInfo', $formInfo );
$gBitSmarty->assign_by_ref( 'errors', $gContent->mErrors );
-$gBitSmarty->assign( (!empty( $_REQUEST['tab'] ) ? $_REQUEST['tab'] : 'body').'TabSelect', 'tdefault' );
-$gBitSmarty->assign('show_page_bar', 'y');
+$gBitSmarty->assign( 'show_page_bar', 'y' );
+// load the ajax library for this page
+$gBitSmarty->assign( 'loadAjax', TRUE );
$gBitSystem->display( 'bitpackage:wiki/edit_page.tpl', 'Edit: '.$gContent->getTitle() );
?>
diff --git a/edit_book.php b/edit_book.php
index b02629e..b093f1e 100644
--- a/edit_book.php
+++ b/edit_book.php
@@ -1,6 +1,6 @@
<?php
/**
- * $Header: /cvsroot/bitweaver/_bit_wiki/edit_book.php,v 1.4 2005/08/01 18:42:04 squareing Exp $
+ * $Header: /cvsroot/bitweaver/_bit_wiki/edit_book.php,v 1.5 2005/12/18 22:33:43 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: edit_book.php,v 1.4 2005/08/01 18:42:04 squareing Exp $
+ * $Id: edit_book.php,v 1.5 2005/12/18 22:33:43 squareing Exp $
* @package wiki
* @subpackage functions
*/
@@ -33,11 +33,6 @@ include_once( WIKI_PKG_PATH.'BitBook.php');
global $gStructure;
-// check what tab is active
-if( isset( $_REQUEST['tab'] ) ) {
- $gBitSmarty->assign( $_REQUEST['tab'].'TabSelect','tdefault' );
-}
-
if( isset($_REQUEST["createstructure"]) ) {
if ((empty($_REQUEST['name']))) {
$gBitSmarty->assign('msg', tra("You must specify a name."));
diff --git a/templates/admin_external_wikis.tpl b/templates/admin_external_wikis.tpl
index cd12419..6fca060 100644
--- a/templates/admin_external_wikis.tpl
+++ b/templates/admin_external_wikis.tpl
@@ -30,7 +30,7 @@
<td>{$channels[user].name}</td>
<td>{$channels[user].extwiki}</td>
<td>
- &nbsp;&nbsp;<a href="{$smarty.const.WIKI_PKG_URL}admin/admin_external_wikis.php?offset={$offset}&amp;sort_mode={$sort_mode}&amp;remove={$channels[user].extwiki_id}" onclick="return confirmTheLink(this,'{tr}Are you sure you want to delete this external wiki?{/tr}')" title="Click here to delete this external wiki">{biticon ipackage=liberty iname="delete" iexplain="remove"}</a>&nbsp;&nbsp;
+ &nbsp;&nbsp;<a href="{$smarty.const.WIKI_PKG_URL}admin/admin_external_wikis.php?offset={$offset}&amp;sort_mode={$sort_mode}&amp;remove={$channels[user].extwiki_id}" onclick="return confirm('{tr}Are you sure you want to delete this external wiki?{/tr}')" title="Click here to delete this external wiki">{biticon ipackage=liberty iname="delete" iexplain="remove"}</a>&nbsp;&nbsp;
<a href="{$smarty.const.WIKI_PKG_URL}admin/admin_external_wikis.php?offset={$offset}&amp;sort_mode={$sort_mode}&amp;extwiki_id={$channels[user].extwiki_id}">{biticon ipackage=liberty iname="edit" iexplain="edit"}</a>
</td>
</tr>
diff --git a/templates/page_action_bar.tpl b/templates/page_action_bar.tpl
index bb30f0d..b93d214 100644
--- a/templates/page_action_bar.tpl
+++ b/templates/page_action_bar.tpl
@@ -6,12 +6,7 @@
{assign var=format_guid value=$pageInfo.format_guid}
{if $gLibertySystem->mPlugins.$format_guid.is_active eq 'y'}
{if $gBitUser->hasPermission( 'bit_p_edit' ) or $page eq 'SandBox'}
- {if $beingEdited eq 'y'}
- {*popup_init src="`$smarty.const.THEMES_PKG_URL`js/overlib.js"*}
- <li><strong><a href="{$smarty.const.WIKI_PKG_URL}edit.php?page_id={$pageInfo.page_id}" {popup text="$semUser"}>{tr}Edit{/tr}</a></strong></li>
- {else}
- <li><a href="{$smarty.const.WIKI_PKG_URL}edit.php?page_id={$pageInfo.page_id}">{tr}Edit{/tr}</a></li>
- {/if}
+ <li><a {if $beingEdited eq 'y'}class="highlight" title="{$semUser}"{/if} href="{$smarty.const.WIKI_PKG_URL}edit.php?page_id={$pageInfo.page_id}">{tr}Edit{/tr}</a></li>
{/if}
{/if}
{/if}
diff --git a/templates/page_icons.tpl b/templates/page_icons.tpl
index e4a4b80..e40cf93 100644
--- a/templates/page_icons.tpl
+++ b/templates/page_icons.tpl
@@ -18,7 +18,7 @@
{assign var=format_guid value=$pageInfo.format_guid}
{if $gLibertySystem->mPlugins.$format_guid.is_active eq 'y'}
{if $gBitUser->hasPermission( 'bit_p_edit' ) or $page eq 'SandBox'}
- <a href="{$smarty.const.WIKI_PKG_URL}edit.php?page_id={$pageInfo.page_id}" {if $beingEdited eq 'y'}{*popup_init src="`$smarty.const.THEMES_PKG_URL`js/overlib.js"*}{popup text="$semUser" width="-1"}{/if}>{biticon ipackage=liberty iname="edit" iexplain="edit"}</a>
+ <a href="{$smarty.const.WIKI_PKG_URL}edit.php?page_id={$pageInfo.page_id}" {if $beingEdited eq 'y'}class="highlight" title="$semUser"{/if}>{biticon ipackage=liberty iname="edit" iexplain="edit"}</a>
{/if}
{/if}
{/if}