summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x[-rw-r--r--]backlinks.php25
-rwxr-xr-x[-rw-r--r--]book_to_html.php18
-rwxr-xr-x[-rw-r--r--]books.php18
-rwxr-xr-x[-rw-r--r--]copyrights.php38
-rwxr-xr-x[-rw-r--r--]edit.php285
-rwxr-xr-x[-rw-r--r--]edit_book.php41
-rwxr-xr-x[-rw-r--r--]export_wiki_pages.php12
-rwxr-xr-x[-rw-r--r--]index.php22
-rwxr-xr-x[-rw-r--r--]like_pages.php17
-rwxr-xr-x[-rw-r--r--]list_pages.php36
-rwxr-xr-x[-rw-r--r--]orphan_pages.php33
-rwxr-xr-x[-rw-r--r--]page_history.php25
-rwxr-xr-x[-rw-r--r--]page_loader.php6
-rwxr-xr-x[-rw-r--r--]page_watches.php21
-rwxr-xr-x[-rw-r--r--]print_multi_pages.php15
-rwxr-xr-x[-rw-r--r--]print_pages.php35
-rwxr-xr-x[-rw-r--r--]rankings.php39
-rwxr-xr-x[-rw-r--r--]remove_page.php27
-rwxr-xr-x[-rw-r--r--]sitemap.php20
-rwxr-xr-xslideshow.php47
-rwxr-xr-x[-rw-r--r--]wiki_graph.php15
-rwxr-xr-x[-rw-r--r--]wiki_rss.php26
22 files changed, 424 insertions, 397 deletions
diff --git a/backlinks.php b/backlinks.php
index f637de5..e4c3578 100644..100755
--- a/backlinks.php
+++ b/backlinks.php
@@ -12,31 +12,30 @@
/**
* required setup
*/
-require_once( '../kernel/includes/setup_inc.php' );
-include_once( WIKI_PKG_INCLUDE_PATH.'lookup_page_inc.php');
+require_once '../kernel/includes/setup_inc.php';
+use Bitweaver\KernelTools;
+include_once WIKI_PKG_INCLUDE_PATH.'lookup_page_inc.php';
$gBitSystem->verifyPackage( 'wiki' );
$gBitSystem->verifyFeature( 'wiki_backlinks' );
// Get the page from the request var or default it to HomePage
-if (!isset($_REQUEST["page"])) {
- $gBitSystem->fatalError(tra("No page indicated"));
-} else {
- $page = $_REQUEST["page"];
- $gBitSmarty->assignByRef('page', $_REQUEST["page"]);
+if ( empty($gContent->mPageName) ) {
}
-
// Now check permissions to access this page
$gContent->verifyViewPermission();
// If the page doesn't exist then display an error
-if( !$gContent->pageExists( $page )) {
- $gBitSystem->fatalError(tra("The page could not be found"));
+if( !$gContent->pageExists( $gContent->mPageName )) {
+ $gBitSystem->fatalError(KernelTools::tra("The page could not be found"));
+} else {
+ $_REQUEST["page"] = $gContent->mPageName;
+ $gBitSmarty->assign('page', $_REQUEST["page"]);
}
+
// Get the backlinks for the page "page"
$backlinks = $gContent->getBacklinks();
-$gBitSmarty->assignByRef('backlinks', $backlinks);
+$gBitSmarty->assign('backlinks', $backlinks);
// Display the template
-$gBitSystem->display( 'bitpackage:wiki/backlinks.tpl', NULL, array( 'display_mode' => 'display' ));
-?>
+$gBitSystem->display( 'bitpackage:wiki/backlinks.tpl', null, [ 'display_mode' => 'display' ] );
diff --git a/book_to_html.php b/book_to_html.php
index a5c5802..1c00595 100644..100755
--- a/book_to_html.php
+++ b/book_to_html.php
@@ -13,9 +13,9 @@
/**
* required setup
*/
-require_once( '../kernel/includes/setup_inc.php' );
+require_once '../kernel/includes/setup_inc.php';
-include_once( WIKI_PKG_CLASS_PATH.'BitBook.php');
+use Bitweaver\KernelTools;
function copys($source,$dest)
{
@@ -48,22 +48,22 @@ function deldirfiles($dir){
$current_dir = opendir($dir);
while($entryname = readdir($current_dir)){
if(is_dir("$dir/$entryname") and ($entryname != "." and $entryname!="..")){
- deldirfiles("${dir}/${entryname}");
+ deldirfiles("{$dir}/{$entryname}");
}elseif($entryname != "." and $entryname!=".."){
- unlink("${dir}/${entryname}");
+ unlink("{$dir}/{$entryname}");
}
}
closedir($current_dir);
}
if( !$gBitUser->isAdmin() ) {
- $gBitSmarty->assign('msg', tra("You dont have permission to use this feature"));
- $gBitSystem->display( 'error.tpl' , NULL, array( 'display_mode' => 'display' ));
+ $gBitSmarty->assign('msg', KernelTools::tra("You dont have permission to use this feature"));
+ $gBitSystem->display( 'error.tpl' , null, [ 'display_mode' => 'display' ] );
die;
}
$struct_info = $structlib->s_get_structure_info($_REQUEST['struct']);
-$gBitSmarty->assignByRef('struct_info',$struct_info);
+$gBitSmarty->assign('struct_info',$struct_info);
$gBitSmarty->assign('generated','y');
if(isset($_REQUEST['create'])) {
@@ -103,6 +103,4 @@ if(isset($_REQUEST['create'])) {
}
// Display the template
-$gBitSystem->display( 'bitpackage:wiki/create_webhelp.tpl', NULL, array( 'display_mode' => 'display' ));
-
-?>
+$gBitSystem->display( 'bitpackage:wiki/create_webhelp.tpl', null, array( 'display_mode' => 'display' ));
diff --git a/books.php b/books.php
index f1bdcb9..67acca1 100644..100755
--- a/books.php
+++ b/books.php
@@ -13,8 +13,8 @@
/**
* required setup
*/
-require_once( '../kernel/includes/setup_inc.php' );
-include_once( WIKI_PKG_CLASS_PATH.'BitBook.php');
+require_once '../kernel/includes/setup_inc.php';
+use Bitweaver\Wiki\BitBook;
// verify stuff
$gBitSystem->verifyPackage( 'wiki' );
@@ -22,16 +22,16 @@ $gBitSystem->verifyPermission( 'p_wiki_list_pages' );
$book = new BitBook();
-$listHash = array();
+$listHash = [];
$listHash['content_type_guid'] = BITBOOK_CONTENT_TYPE_GUID;
$channels = $book->getList( $listHash );
$cant_pages = ceil($channels["cant"] / $listHash['max_records']);
-$gBitSmarty->assignByRef('cant_pages', $cant_pages);
-$gBitSmarty->assign('actual_page', 1 + ($listHash['offset'] / $listHash['max_records']));
+$gBitSmarty->assign('cant_pages', $cant_pages);
+$gBitSmarty->assign('actual_page', 1 + $listHash['offset'] / $listHash['max_records'] );
if ($channels["cant"] > ($listHash['offset'] + $listHash['max_records'])) {
- $gBitSmarty->assign('next_offset', $listHash['offset'] + $listHash['max_records']);
+ $gBitSmarty->assign('next_offset', $listHash['offset'] + $listHash['max_records'] );
} else {
$gBitSmarty->assign('next_offset', -1);
}
@@ -43,8 +43,6 @@ if ($listHash['offset'] > 0) {
$gBitSmarty->assign('prev_offset', -1);
}
-$gBitSmarty->assignByRef('channels', $channels["data"]);
+$gBitSmarty->assign('channels', $channels["data"]);
-$gBitSystem->display( 'bitpackage:wiki/list_books.tpl', NULL, array( 'display_mode' => 'display' ));
-
-?>
+$gBitSystem->display( 'bitpackage:wiki/list_books.tpl', null, array( 'display_mode' => 'display' ));
diff --git a/copyrights.php b/copyrights.php
index c3a10dd..7eb663b 100644..100755
--- a/copyrights.php
+++ b/copyrights.php
@@ -13,12 +13,13 @@
/**
* required setup
*/
-require_once( '../kernel/includes/setup_inc.php' );
-$gBitSystem->isFeatureActive( 'wiki_copyrights', tra("The copyright management feature is not enabled.") );
+require_once '../kernel/includes/setup_inc.php';
+use Bitweaver\KernelTools;
+$gBitSystem->isFeatureActive( 'wiki_copyrights', KernelTools::tra("The copyright management feature is not enabled.") );
$gBitUser->hasPermission( 'p_wiki_edit_copyright' );
-require_once( WIKI_PKG_INCLUDE_PATH.'copyrights_lib.php' );
-require_once( WIKI_PKG_INCLUDE_PATH.'lookup_page_inc.php' );
+require_once WIKI_PKG_INCLUDE_PATH.'copyrights_lib.php';
+require_once WIKI_PKG_INCLUDE_PATH.'lookup_page_inc.php';
if (isset($_REQUEST['addcopyright'])) {
if ($gBitSystem->isFeatureActive( 'wiki_copyrights' ) && isset($_REQUEST['copyrightTitle']) && isset($_REQUEST['copyrightYear'])
@@ -28,8 +29,8 @@ if (isset($_REQUEST['addcopyright'])) {
$copyrightAuthors = $_REQUEST['copyrightAuthors'];
$copyrightslib->add_copyright($gContent->mPageId, $copyrightTitle, $copyrightYear, $copyrightAuthors, $gBitUser->mUserId);
} else {
- $gBitSmarty->assign('msg', tra("You must supply all the information, including title and year."));
- $gBitSystem->display( 'error.tpl' , NULL, array( 'display_mode' => 'display' ));
+ $gBitSmarty->assign('msg', KernelTools::tra("You must supply all the information, including title and year."));
+ $gBitSystem->display( 'error.tpl' , null, [ 'display_mode' => 'display' ]);
die;
}
}
@@ -42,22 +43,25 @@ if (isset($_REQUEST['editcopyright'])) {
$copyrightAuthors = $_REQUEST['copyrightAuthors'];
$copyrightslib->edit_copyright($copyright_id, $copyrightTitle, $copyrightYear, $copyrightAuthors, $gBitUser->mUserId);
} else {
- $gBitSmarty->assign('msg', tra("You must supply all the information, including title and year."));
- $gBitSystem->display( 'error.tpl' , NULL, array( 'display_mode' => 'display' ));
+ $gBitSmarty->assign('msg', KernelTools::tra("You must supply all the information, including title and year."));
+ $gBitSystem->display( 'error.tpl' , null, array( 'display_mode' => 'display' ));
die;
}
}
-if (isset($_REQUEST['action']) && isset($_REQUEST['copyright_id'])) {
- if ($_REQUEST['action'] == 'up') {
- $copyrightslib->up_copyright($_REQUEST['copyright_id']);
- } elseif ($_REQUEST['action'] == 'down') {
- $copyrightslib->down_copyright($_REQUEST['copyright_id']);
- } elseif ($_REQUEST['action'] == 'delete') {
- $copyrightslib->remove_copyright($_REQUEST['copyright_id']);
+if (isset($_REQUEST['action']) && isset($_REQUEST['copyright_id'] ) ) {
+ switch ($_REQUEST['action']) {
+ case 'up':
+ $copyrightslib->up_copyright($_REQUEST['copyright_id'] );
+ break;
+ case 'down':
+ $copyrightslib->down_copyright($_REQUEST['copyright_id'] );
+ break;
+ case 'delete':
+ $copyrightslib->remove_copyright($_REQUEST['copyright_id'] );
+ break;
}
}
$copyrights = $copyrightslib->list_copyrights( $gContent->mPageId );
$gBitSmarty->assign('copyrights', $copyrights["data"]);
// Display the template
-$gBitSystem->display( 'bitpackage:wiki/copyrights.tpl', NULL, array( 'display_mode' => 'display' ));
-?>
+$gBitSystem->display( 'bitpackage:wiki/copyrights.tpl', null, [ 'display_mode' => 'display' ] );
diff --git a/edit.php b/edit.php
index aba7162..e17d9e6 100644..100755
--- a/edit.php
+++ b/edit.php
@@ -13,8 +13,12 @@
/**
* required setup
*/
-require_once( '../kernel/includes/setup_inc.php' );
-include_once( WIKI_PKG_CLASS_PATH.'BitBook.php' );
+require_once '../kernel/includes/setup_inc.php';
+use Bitweaver\BitBase;
+use Bitweaver\KernelTools;
+use Bitweaver\Liberty\BitLinks;
+use Bitweaver\Liberty\LibertyContent;
+use Bitweaver\Liberty\LibertyComment;
$gBitSystem->verifyPackage( 'wiki' );
@@ -22,7 +26,7 @@ $gBitSystem->verifyPackage( 'wiki' );
unset($_REQUEST['content_id']);
// Disable parsing data if not asking to preview page
$_REQUEST["parse"] = false;
-include( WIKI_PKG_INCLUDE_PATH.'lookup_page_inc.php' );
+include WIKI_PKG_INCLUDE_PATH.'lookup_page_inc.php';
if( $gContent->isValid() ) {
$gContent->verifyUpdatePermission();
@@ -32,7 +36,6 @@ if( $gContent->isValid() ) {
//make comment count for this page available for templates
if( $gBitSystem->isFeatureActive( 'wiki_comments' ) && !empty( $_REQUEST['page_id'] ) ) {
- require_once( LIBERTY_PKG_CLASS_PATH.'LibertyComment.php' );
$gComment = new LibertyComment();
$numComments = $gComment->getNumComments($gContent->mContentId);
$gBitSmarty->assign('comments_count', $numComments);
@@ -47,7 +50,6 @@ if( $gContent->isLocked() ) {
$gBitSystem->fatalError( 'Cannot edit page because it is locked' );
}
-
$gContent->invokeServices( 'content_edit_function' );
if( !empty( $gContent->mInfo ) ) {
@@ -102,11 +104,7 @@ if( isset( $_REQUEST['title'] ) ) {
if( isset( $_REQUEST["description"] ) ) {
$formInfo['description'] = $_REQUEST["description"];
}
-if( isset( $_REQUEST["edit_comment"] ) ) {
- $formInfo['edit_comment'] = $_REQUEST["edit_comment"];
-} else {
- $formInfo['edit_comment'] = '';
-}
+$formInfo['edit_comment'] = $_REQUEST["edit_comment"] ?? '';
$cat_obj_type = BITPAGE_CONTENT_TYPE_GUID;
@@ -125,7 +123,7 @@ if( $gBitSystem->isFeatureActive( 'wiki_copyrights' ) ) {
// Pro
// Check if the page has changed
if( isset( $_REQUEST["fCancel"] ) ) {
- if( @BitBase::verifyId( $gContent->mContentId ) ) {
+ if( BitBase::verifyId( $gContent->mContentId ) ) {
header( "Location: ".$gContent->getDisplayUrl() );
} else {
header( "Location: ".WIKI_PKG_URL );
@@ -142,28 +140,29 @@ if( isset( $_REQUEST["fCancel"] ) ) {
&& !empty( $_REQUEST['copyrightYear'] )
&& !empty( $_REQUEST['copyrightTitle'] )
) {
- require_once( WIKI_PKG_INCLUDE_PATH.'copyrights_lib.php' );
+ require_once WIKI_PKG_INCLUDE_PATH.'copyrights_lib.php';
$copyrightYear = $_REQUEST['copyrightYear'];
$copyrightTitle = $_REQUEST['copyrightTitle'];
$copyrightAuthors = $_REQUEST['copyrightAuthors'];
$copyrightslib->add_copyright( $gContent->mPageId, $copyrightTitle, $copyrightYear, $copyrightAuthors, $gBitUser->mUserId );
}
+// $sBitLinks = new BitLinks();
if( $gContent->mPageId )
{ if( isset( $_REQUEST['isminor'] ) && $_REQUEST['isminor']=='on' ) {
- $_REQUEST['minor']=true;
+ $_REQUEST['minor'] = true;
} else {
- $_REQUEST['minor']=false;
-// $links = $gContent->get_links( $edit );
+ $_REQUEST['minor'] = false;
+ $links = []; // $sBitLinks->get_links( $edit );
// $wikilib->cache_links( $links );
-// $gContent->storeLinks( $links );
+// $sBitLinks->storeLinks( $links );
}
} else {
-// $links = $gContent->get_links( $_REQUEST["edit"] );
-// $notcachedlinks = $gContent->get_links_nocache( $_REQUEST["edit"] );
+ $links = []; // $sBitLinks->get_links( $_REQUEST["edit"] );
+// $notcachedlinks = $sBitLinks->get_links_nocache( $_REQUEST["edit"] );
// $cachedlinks = array_diff( $links, $notcachedlinks );
-// $gContent->cache_links( $cachedlinks );
-// $gContent->storeLinks( $cachedlinks );
+// $sBitLinks->cache_links( $cachedlinks );
+// $sBitLinks->storeLinks( $cachedlinks );
}
$data_to_parse = $formInfo['edit'];
@@ -178,7 +177,8 @@ if( isset( $_REQUEST["fCancel"] ) ) {
$gBitUser->storeWatch( "wiki_page_changed", $gContent->mPageId, $gContent->mContentTypeGuid, $_REQUEST['title'], $gContent->getDisplayUrl() );
}
- header( "Location: ".$gContent->getDisplayUrl( $gContent->mPageName ) );
+ $return = [ 'title' => $gContent->mPageName ];
+ header( "Location: ".$gContent->getDisplayUrlFromHash( $return ) );
die;
} else {
@@ -195,11 +195,12 @@ if( isset( $_REQUEST['format_guid'] ) && !isset( $gContent->mInfo['format_guid']
$formInfo['format_guid'] = $gContent->mInfo['format_guid'] = $_REQUEST['format_guid'];
}
+$preview = false;
if( isset( $_REQUEST["preview"] ) ) {
// Chrome does not like seeing the page source in the page itself.
header("X-XSS-Protection: 0");
- $gBitSmarty->assign( 'preview',1 );
- $gBitSmarty->assign( 'title',!empty( $_REQUEST["title"] ) ? $_REQUEST["title"]:$gContent->mPageName );
+ $preview = true;
+ $gBitSmarty->assign( 'title',!empty( $_REQUEST["title"] ) ? $_REQUEST["title"] : $gContent->mPageName );
if (!empty($formInfo['section'])) {
$formInfo['edit_section'] = 1;
@@ -212,7 +213,8 @@ if( isset( $_REQUEST["preview"] ) ) {
$formInfo['parsed_data'] = LibertyContent::parseDataHash( $data_to_parse );
$gContent->invokeServices( 'content_preview_function' );
-}
+}
+$gBitSmarty->assign( 'preview',$preview );
if( $gContent->isInStructure() ) {
$gBitSmarty->assign( 'showstructs', $gContent->getStructures() );
@@ -231,14 +233,14 @@ if( empty( $formInfo ) ) {
// make original page title available for template
$formInfo['original_title'] =( !empty( $gContent->mInfo['title'] ) ) ? $gContent->mInfo['title'] : "" ;
-$gBitSmarty->assignByRef( 'pageInfo', $formInfo );
-$gBitSmarty->assignByRef( 'errors', $gContent->mErrors );
+$gBitSmarty->assign( 'pageInfo', $formInfo );
+$gBitSmarty->assign( 'errors', $gContent->mErrors );
if( $gBitSystem->isPackageActive( 'ckeditor' ) ) {
// loadCkEditor();
}
-$gBitSystem->display( 'bitpackage:wiki/edit_page.tpl', 'Edit: '.$gContent->getTitle() , array( 'display_mode' => 'edit' ));
+$gBitSystem->display( 'bitpackage:wiki/edit_page.tpl', 'Edit: '.$gContent->getTitle() , [ 'display_mode' => 'edit' ] );
@@ -265,9 +267,9 @@ function parse_output( &$obj, &$parts,$i ) {
case 'application/x-tikiwiki':
$aux["body"] = $obj->body;
$ccc=$obj->headers["content-type"];
- $items = split( ';',$ccc );
+ $items = mb_split( ';',$ccc );
foreach( $items as $item ) {
- $portions = split( '=',$item );
+ $portions = mb_split( '=',$item );
if( isset( $portions[0] ) &&isset( $portions[1] ) ) {
$aux[trim( $portions[0] )]=trim( $portions[1] );
}
@@ -319,82 +321,145 @@ function compare_import_versions( $a1, $a2 ) {
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" ) {
- // 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 "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"].' )';
+ switch ($c[$i]["type"]) {
+ case "text":
+ $src .= $c[$i]["data"];
+ break;
+ case "tag":
+ switch ($c[$i]["data"]["type"]) {
+ case "open":
+ switch ($c[$i]["data"]["name"]) {
+ case "br":
+ $src .= "\n";
+ break;
+ case "title":
+ $src .= "\n!";
+ $p['stack'][] = [ 'tag' => 'title', 'string' => "\n" ];
+ break;
+ case "p":
+ $src .= "\n";
+ $p['stack'][] = [ 'tag' => 'p', 'string' => "\n" ];
+ break;
+ case "b":
+ $src .= '__';
+ $p['stack'][] = [ 'tag' => 'b', 'string' => '__' ];
+ break;
+ case "i":
+ $src .= "''";
+ $p['stack'][] = [ 'tag' => 'i', 'string' => "''" ];
+ break;
+ case "u":
+ $src .= "==";
+ $p['stack'][] = [ 'tag' => 'u', 'string' => "==" ];
+ break;
+ case "center":
+ $src .= '::';
+ $p['stack'][] = [ 'tag' => 'center', 'string' => '::' ];
+ break;
+ case "code":
+ $src .= '-+';
+ $p['stack'][] = [ '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'][] = [ 'tag' => 'h1', 'string' => "\n" ];
+ break;
+ case "h2":
+ $src .= "\n!!";
+ $p['stack'][] = [ 'tag' => 'h2', 'string' => "\n" ];
+ break;
+ case "h3":
+ $src .= "\n!!!";
+ $p['stack'][] = [ 'tag' => 'h3', 'string' => "\n" ];
+ break;
+ case "h4":
+ $src .= "\n!!!!";
+ $p['stack'][] = [ 'tag' => 'h4', 'string' => "\n" ];
+ break;
+ case "h5":
+ $src .= "\n!!!!!";
+ $p['stack'][] = [ 'tag' => 'h5', 'string' => "\n" ];
+ break;
+ case "h6":
+ $src .= "\n!!!!!!";
+ $p['stack'][] = [ 'tag' => 'h6', 'string' => "\n" ];
+ break;
+ case "pre":
+ $src .= '~pp~';
+ $p['stack'][] = [ 'tag' => 'pre', 'string' => '~/pp~' ];
+ break;
+ // Table parser
+ case "table":
+ $src .= '||';
+ $p['stack'][] = [ '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'][] = [ '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'][] = [ 'tag' => 'a', 'string' => ']' ];
+ }
+ break;
}
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' => ']' );
+ default:
+ switch ($c[$i]["data"]["name"]) {
+ case "ul":
+ if (end( $p['listack'] ) == '*')
+ array_pop( $p['listack'] );
+ break;
+ case "ol":
+ if (end( $p['listack'] ) == '#')
+ array_pop( $p['listack'] );
+ break;
+ default:
+ $e = end( $p['stack'] );
+ if ($c[$i]["data"]["name"] == $e['tag']) {
+ $src .= $e['string'];
+ array_pop( $p['stack'] );
+ }
+ break;
}
break;
}
- } else {
- // This is close tag type. Is that smth we r waiting for?
- switch( $c[$i]["data"]["name"] ) {
- case "ul":
- if( end( $p['listack'] ) == '*' ) array_pop( $p['listack'] );
- break;
- case "ol":
- if( end( $p['listack'] ) == '#' ) array_pop( $p['listack'] );
- break;
- default:
- $e = end( $p['stack'] );
- if( $c[$i]["data"]["name"] == $e['tag'] ) {
- $src .= $e['string'];
- array_pop( $p['stack'] );
- }
- break;
- }
- }
+ break;
}
// Recursive call on tags with content...
if( isset( $c[$i]["content"] ) ) {
@@ -405,10 +470,10 @@ function walk_and_parse( &$c, &$src, &$p ) {
}
if( isset( $_REQUEST["suck_url"] ) ) {
if( !$gBitSystem->isFeatureActive( 'wiki_url_import' ) ) {
- $gBitSystem->fatalError( tra( "Importing remote URLs is disabled" ));
+ $gBitSystem->fatalError( KernelTools::tra( "Importing remote URLs is disabled" ));
}
// Suck another page and append to the end of current
- require_once( UTIL_PKG_INCLUDE_PATH.'htmlparser/html_parser_inc.php' );
+ require_once UTIL_PKG_INCLUDE_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 ) {
@@ -425,22 +490,22 @@ if( isset( $_REQUEST["suck_url"] ) ) {
$parsed_url = parse_url($suck_url);
//Disallow urls without schema (usually relative urls), or http(s)
if(!isset($parsed_url['scheme']) || ($parsed_url['scheme']!='http' && $parsed_url['scheme']!='https')){
- $gBitSystem->fatalError( tra( "Invalid URL; not absolute or not HTTP" ));
+ $gBitSystem->fatalError( KernelTools::tra( "Invalid URL; not absolute or not HTTP" ));
}
//Make sure the passed host isn't local
if(!isset($parsed_url['host']) || ($parsed_url['host']=='localhost') || strncmp($parsed_url['host'],"127.",4)==0){
- $gBitSystem->fatalError( tra( "The host specified is either empty or local." ));
+ $gBitSystem->fatalError( KernelTools::tra( "The host specified is either empty or local." ));
}
$sdta = @file_get_contents( $suck_url );
if( isset( $php_errormsg ) && strlen( $php_errormsg ) ) {
- $gBitSystem->fatalError( tra( "Can't import remote HTML page" ));
+ $gBitSystem->fatalError( KernelTools::tra( "Can't import remote HTML page" ));
}
// Need to parse HTML?
if( $parsehtml == 'y' ) {
// Read compiled( serialized ) grammar
$grammarfile = UTIL_PKG_INCLUDE_PATH.'htmlparser/htmlgrammar.cmp';
if( !$fp = @fopen( $grammarfile,'r' ) ) {
- $gBitSystem->fatalError( tra( "Can't parse remote HTML page" ));
+ $gBitSystem->fatalError( KernelTools::tra( "Can't parse remote HTML page" ));
}
$grammar = unserialize( fread( $fp, filesize( $grammarfile ) ) );
fclose( $fp );
@@ -449,7 +514,7 @@ if( isset( $_REQUEST["suck_url"] ) ) {
$htmlparser->Parse();
// Should I try to convert HTML to wiki?
$parseddata = '';
- $p = array( 'stack' => array(), 'listack' => array(), 'first_td' => false );
+ $p = [ 'stack' => [], 'listack' => [], '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 : )
@@ -472,9 +537,3 @@ if( isset( $_REQUEST["suck_url"] ) ) {
$_REQUEST['edit'] .= $sdta;
}
}
-
-//***************************************
-
-
-
-?>
diff --git a/edit_book.php b/edit_book.php
index af7e1be..081f8bf 100644..100755
--- a/edit_book.php
+++ b/edit_book.php
@@ -13,17 +13,17 @@
/**
* required setup
*/
-require_once( '../kernel/includes/setup_inc.php' );
+require_once '../kernel/includes/setup_inc.php';
+use \Bitweaver\BitBase;
+use \Bitweaver\Liberty\LibertyStructure;
+use \Bitweaver\Wiki\BitBook;
+use \Bitweaver\Wiki\BitPage;
-if( isset( $_COOKIE['book_section'] ) && $_COOKIE['book_section'] == 'o' ) {
- $book_section = 'block';
-} else {
- $book_section = 'none';
-}
-$gBitSmarty->assign( 'book_section',$book_section );
+$book_section = isset( $_COOKIE['book_section'] ) && $_COOKIE['book_section'] == 'o'
+ ? $book_section = 'block'
+ : 'none';
-include_once( LIBERTY_PKG_CLASS_PATH.'LibertyStructure.php');
-include_once( WIKI_PKG_CLASS_PATH.'BitBook.php');
+$gBitSmarty->assign( 'book_section',$book_section );
global $gStructure;
@@ -33,15 +33,15 @@ global $gStructure;
**/
// get a book instance
global $gContent;
-if( BitBase::verifyIdParameter( $_REQUEST, 'structure_id' ) || BitBase::verifyIdParameter( $_REQUEST, 'content_id' ) ) {
- include_once( LIBERTY_PKG_INCLUDE_PATH.'lookup_content_inc.php' );
+if( BitBase::verifyId( $_REQUEST["structure_id"] ) || BitBase::verifyId( $_REQUEST["content_id"] ) ) {
+ include_once LIBERTY_PKG_INCLUDE_PATH.'lookup_content_inc.php';
if( empty( $gContent ) ){
$gBitSystem->fatalError( 'Error: Invalid structure id, the book you requested could not be found.' );
} elseif( empty( $_REQUEST["structure_id"] ) ) {
// we were passed a valid content_id. Make sure the root node exists, and if not, create it.
$newStructure = new LibertyStructure();
// alias => '' is a temporary setting until alias stuff has been removed
- if( !$node = $newStructure->getNode( NULL, $gContent->mContentId ) ) {
+ if( !$node = $newStructure->getNode( -2, $gContent->mContentId ) ) {
$structureHash = array( 'content_id' => $gContent->mContentId, 'alias' => '' );
$_REQUEST["structure_id"] = $newStructure->storeNode( $structureHash );
} else {
@@ -71,7 +71,7 @@ if( $gContent->isValid() ){
if( isset($_REQUEST["createstructure"]) ) {
if ((empty($_REQUEST['name']))) {
$gBitSmarty->assign('msg', tra("You must specify a name."));
- $gBitSystem->display( 'error.tpl' , NULL, array( 'display_mode' => 'edit' ));
+ $gBitSystem->display( 'error.tpl' , null, array( 'display_mode' => 'edit' ));
die;
}
@@ -95,7 +95,7 @@ if( isset($_REQUEST["createstructure"]) ) {
//Cannot create a structure if a structure already exists
if (!isset($structure_id)) {
$gBitSmarty->assign('msg', $_REQUEST['name'] . " " . tra("page not added (Exists)"));
- $gBitSystem->display( 'error.tpl' , NULL, array( 'display_mode' => 'edit' ));
+ $gBitSystem->display( 'error.tpl' , null, array( 'display_mode' => 'edit' ));
die;
}
@@ -118,16 +118,16 @@ if( isset($_REQUEST["createstructure"]) ) {
$params['title'] = trim($chapterName);
$params['edit'] = '';
if( !$nodePage->store( $params ) ) {
- $gBitSystem->fatalError( "There was an error storing the page: ".vc( $gContent->mErrors ));
+ $gBitSystem->fatalError( "There was an error storing the page: ".\Bitweaver\vc( $gContent->mErrors ));
}
}
$nodeHash['content_id'] = $nodePage->mContentId;
$nodeHash['after_ref_id'] = $gStructure->storeNode( $nodeHash );
}
}
- bit_redirect( WIKI_PKG_URL."edit_book.php?structure_id=".$structure_id );
+ header( "location: ".WIKI_PKG_URL."edit_book.php?structure_id=".$structure_id );
} else {
- $gBitSmarty->assignByRef( 'errors', $gContent->mErrors );
+ $gBitSmarty->assign( 'errors', $gContent->mErrors );
$gBitSmarty->assign( 'name', $_REQUEST['name']);
$gBitSmarty->assign( 'chapters', $_REQUEST['chapters']);
$mid = 'bitpackage:wiki/create_book.tpl';
@@ -140,7 +140,7 @@ if( isset($_REQUEST["createstructure"]) ) {
// set the correct display template
$mid = 'bitpackage:wiki/edit_book.tpl';
- include_once( LIBERTY_PKG_INCLUDE_PATH.'structure_edit_inc.php');
+ include_once LIBERTY_PKG_INCLUDE_PATH.'structure_edit_inc.php';
if( $gBitThemes->isAjaxRequest() ) {
$gBitSmarty->display( 'bitpackage:kernel/feedback_inc.tpl' );
}
@@ -149,7 +149,6 @@ if( isset($_REQUEST["createstructure"]) ) {
$gBitSystem->setBrowserTitle( 'Create Wiki Book' );
$mid = 'bitpackage:wiki/create_book.tpl';
}
-$gBitSystem->setBrowserTitle( !empty($gStructure) && $gStructure->isValid() ? 'Edit Wiki Book:'.$gStructure->getField( 'title' ) : NULL );
+$gBitSystem->setBrowserTitle( !empty($gStructure) && $gStructure->isValid() ? 'Edit Wiki Book:'.$gStructure->getField( 'title' ) : null );
// Display the template
-$gBitSystem->display( $mid , NULL, array( 'display_mode' => 'edit' ));
-?>
+$gBitSystem->display( $mid , null, array( 'display_mode' => 'edit' )); \ No newline at end of file
diff --git a/export_wiki_pages.php b/export_wiki_pages.php
index cf78b56..e1a516a 100644..100755
--- a/export_wiki_pages.php
+++ b/export_wiki_pages.php
@@ -13,9 +13,9 @@
/**
* required setup
*/
-require_once( '../kernel/includes/setup_inc.php' );
-include_once( UTIL_PKG_INCLUDE_PATH.'zip_lib.php' );
-include_once( WIKI_PKG_INCLUDE_PATH.'export_lib.php' );
+require_once '../kernel/includes/setup_inc.php';
+include_once UTIL_PKG_INCLUDE_PATH.'zip_lib.php';
+include_once WIKI_PKG_INCLUDE_PATH.'export_lib.php';
if (!$gBitUser->hasPermission( 'p_wiki_admin' ))
die;
if (!isset($_REQUEST["page_id"])) {
@@ -23,14 +23,10 @@ if (!isset($_REQUEST["page_id"])) {
$exportlib->MakeWikiZip( TEMP_PKG_PATH.$exportName );
header ("location: ".TEMP_PKG_URL.$exportName );
} else {
- if (isset($_REQUEST["all"]))
- $all = 0;
- else
- $all = 1;
+ $all = isset($_REQUEST["all"]) ? 0 : 1;
$data = $exportlib->export_wiki_page($_REQUEST["page_id"], $all);
$pageId = $_REQUEST["page_id"];
header ("Content-type: application/unknown");
header ("Content-Disposition: inline; filename=$pageId");
echo $data;
}
-?>
diff --git a/index.php b/index.php
index 9cc8fd5..fb29a0c 100644..100755
--- a/index.php
+++ b/index.php
@@ -13,19 +13,19 @@
/**
* required setup
*/
-require_once( '../kernel/includes/setup_inc.php' );
+namespace Bitweaver\Wiki;
+require_once '../kernel/includes/setup_inc.php';
$gBitSystem->verifyPackage( 'wiki' );
-require_once( WIKI_PKG_CLASS_PATH.'BitPage.php' );
if( !empty( $_REQUEST['structure_id'] ) ) {
- include( LIBERTY_PKG_INCLUDE_PATH.'structure_display_inc.php' );
+ include LIBERTY_PKG_INCLUDE_PATH.'structure_display_inc.php';
} else {
- // if no page set
+ // if no page set
if ( !isset( $_REQUEST['page'] ) and !isset( $_REQUEST['page_id'] ) ) {
// if auto create home page disabled just get a list
if( $gBitSystem->isFeatureActive( 'wiki_disable_auto_home' ) ){
- include( WIKI_PKG_PATH.'list_pages.php' );
+ include WIKI_PKG_PATH.'list_pages.php';
die;
}
// auto fetch/create default home page
@@ -35,17 +35,17 @@ if( !empty( $_REQUEST['structure_id'] ) ) {
$gHome = new BitPage();
$wikiHome = $gBitSystem->getConfig( "wiki_home_page", 'HomePage' );
if( !($gHome->pageExists( $wikiHome ) ) ) {
- $homeHash = array(
- 'title' => ( isset( $wikiHome ) ? $wikiHome : 'HomePage' ),
+ $homeHash = [
+ 'title' => $wikiHome ?? 'HomePage',
'creator_user_id' => ROOT_USER_ID,
'modifier_user_id' => ROOT_USER_ID,
- 'edit' => 'Welcome to '.( $gBitSystem->getConfig( 'site_title', 'our site' ) ) );
+ 'edit' => 'Welcome to '.( $gBitSystem->getConfig( 'site_title', 'our site' ) ) ];
$gHome->store( $homeHash );
}
-
- include( WIKI_PKG_INCLUDE_PATH.'lookup_page_inc.php' );
+
+ include WIKI_PKG_INCLUDE_PATH.'lookup_page_inc.php';
if( $gContent->isValid() ) {
$gBitSystem->setCanonicalLink( $gContent->getDisplayUrl() );
}
- include( WIKI_PKG_INCLUDE_PATH.'display_bitpage_inc.php' );
+ include WIKI_PKG_INCLUDE_PATH.'display_bitpage_inc.php';
}
diff --git a/like_pages.php b/like_pages.php
index 2762e24..daf0af3 100644..100755
--- a/like_pages.php
+++ b/like_pages.php
@@ -13,21 +13,24 @@
/**
* required setup
*/
-require_once( '../kernel/includes/setup_inc.php' );
-include_once( WIKI_PKG_CLASS_PATH.'BitPage.php');
-include_once( WIKI_PKG_INCLUDE_PATH.'lookup_page_inc.php' );
+namespace Bitweaver\Wiki;
+use Bitweaver\KernelTools;
+
+require_once '../kernel/includes/setup_inc.php';
+
+include_once WIKI_PKG_INCLUDE_PATH.'lookup_page_inc.php';
+
$gBitSystem->verifyPackage( 'wiki' );
$gBitSystem->verifyFeature( 'wiki_like_pages' );
$gBitSystem->verifyPermission( 'p_wiki_list_pages' );
// Get the page from the request var or default it to HomePage
if( !$gContent->isValid() ) {
- $gBitSystem->fatalError( tra( "No page indicated" ));
+ $gBitSystem->fatalError( KernelTools::tra( "No page indicated" ));
}
$likepages = $gContent->getLikePages( $gContent->mInfo['title'] );
-$gBitSmarty->assignByRef( 'likepages', $likepages );
+$gBitSmarty->assign( 'likepages', $likepages );
// Display the template
-$gBitSystem->display( 'bitpackage:wiki/like_pages.tpl', NULL, array( 'display_mode' => 'display' ));
-?>
+$gBitSystem->display( 'bitpackage:wiki/like_pages.tpl', null, array( 'display_mode' => 'display' )); \ No newline at end of file
diff --git a/list_pages.php b/list_pages.php
index d6dd9b8..cdf907f 100644..100755
--- a/list_pages.php
+++ b/list_pages.php
@@ -7,8 +7,9 @@
/**
* required setup
*/
-require_once( '../kernel/includes/setup_inc.php' );
-require_once( WIKI_PKG_CLASS_PATH.'BitPage.php' );
+require_once '../kernel/includes/setup_inc.php';
+use Bitweaver\Wiki\BitPage;
+use Bitweaver\KernelTools;
// verify stuff
$gBitSystem->verifyPackage( 'wiki' );
@@ -32,23 +33,19 @@ if( isset( $_REQUEST["batch_submit"] ) && isset( $_REQUEST["checked"] ) && $_REQ
if( !empty( $_REQUEST['cancel'] )) {
// user cancelled - just continue on, doing nothing
} elseif( empty( $_REQUEST['confirm'] )) {
- $formHash['delete'] = TRUE;
+ $formHash['delete'] = true;
$formHash['batch_submit'] = 'remove_pages';
foreach( $_REQUEST["checked"] as $del ) {
$tmpPage = new BitPage( $del);
- if( $tmpPage->load() && !empty( $tmpPage->mInfo['title'] )) {
- $info = $tmpPage->mInfo['title'];
- } else {
- $info = $del;
- }
+ $info = $tmpPage->load() && !empty( $tmpPage->mInfo['title'] ) ? $tmpPage->mInfo['title'] : $del;
$formHash['input'][] = '<input type="hidden" name="checked[]" value="'.$del.'"/>'.$info;
}
$gBitSystem->confirmDialog( $formHash,
- array(
- 'warning' => tra('Are you sure you want to delete these pages?') . ' (' . tra('Count: ') . count( $_REQUEST["checked"] ) . ')',
- 'error' => tra('This cannot be undone!'),
- )
- );
+ [
+ 'warning' => KernelTools::tra('Are you sure you want to delete these pages?') . ' (' . KernelTools::tra('Count: ') . count( $_REQUEST["checked"] ) . ')',
+ 'error' => KernelTools::tra('This cannot be undone!'),
+ ]
+ );
} else {
foreach( $_REQUEST["checked"] as $deletepage ) {
$tmpPage = new BitPage( $deletepage );
@@ -57,18 +54,18 @@ if( isset( $_REQUEST["batch_submit"] ) && isset( $_REQUEST["checked"] ) && $_REQ
}
}
if( !empty( $errors )) {
- $gBitSmarty->assignByRef( 'errors', $errors );
+ $gBitSmarty->assign( 'errors', $errors );
}
}
}
-$gBitSmarty->assignByRef( "gContent", $gContent );
+$gBitSmarty->assign( "gContent", $gContent );
if( !empty( $_REQUEST['sort_mode'] )) {
$listHash['sort_mode'] = preg_replace( '/^user_/', 'creator_user_', $_REQUEST['sort_mode'] );
}
$listHash = $_REQUEST;
-$listHash['extras'] = TRUE;
+$listHash['extras'] = true;
$listpages = $gContent->getList( $listHash );
// we will probably need a better way to do this
@@ -77,9 +74,8 @@ $listHash['listInfo']['parameters']['find_author'] = !empty( $listHash['fin
$listHash['listInfo']['parameters']['find_last_editor'] = !empty( $listHash['find_last_editor'] ) ? $listHash['find_last_editor'] : '';
$listHash['listInfo']['ihash']['content_type_guid'] = BITPAGE_CONTENT_TYPE_GUID;
-$gBitSmarty->assignByRef( 'listpages', $listpages );
-$gBitSmarty->assignByRef( 'listInfo', $listHash['listInfo'] );
+$gBitSmarty->assign( 'listpages', $listpages );
+$gBitSmarty->assign( 'listInfo', $listHash['listInfo'] );
// Display the template
-$gBitSystem->display( 'bitpackage:wiki/list_pages.tpl', tra( 'Wiki Pages' ), array( 'display_mode' => 'list' ));
-?>
+$gBitSystem->display( 'bitpackage:wiki/list_pages.tpl', KernelTools::tra( 'Wiki Pages' ), [ 'display_mode' => 'list' ] ); \ No newline at end of file
diff --git a/orphan_pages.php b/orphan_pages.php
index 7ba51be..cee77fe 100644..100755
--- a/orphan_pages.php
+++ b/orphan_pages.php
@@ -7,8 +7,9 @@
/**
* required setup
*/
-require_once( '../kernel/includes/setup_inc.php' );
-include_once( WIKI_PKG_CLASS_PATH.'BitPage.php' );
+require_once '../kernel/includes/setup_inc.php';
+use Bitweaver\Wiki\BitPage;
+use Bitweaver\KernelTools;
// verify stuff
$gBitSystem->verifyPackage( 'wiki' );
@@ -32,21 +33,18 @@ if( isset( $_REQUEST["batch_submit"] ) && isset( $_REQUEST["checked"] ) && $_REQ
if( !empty( $_REQUEST['cancel'] )) {
// user cancelled - just continue on, doing nothing
} elseif( empty( $_REQUEST['confirm'] )) {
- $formHash['delete'] = TRUE;
+ $formHash['delete'] = true;
$formHash['batch_submit'] = 'remove_pages';
foreach( $_REQUEST["checked"] as $del ) {
$tmpPage = new BitPage( $del);
- if( $tmpPage->load() && !empty( $tmpPage->mInfo['title'] )) {
- $info = $tmpPage->mInfo['title'];
- } else {
- $info = $del;
- }
+ $info = $tmpPage->load() && !empty( $tmpPage->mInfo['title'] ) ? $tmpPage->mInfo['title'] : $del;
+
$formHash['input'][] = '<input type="hidden" name="checked[]" value="'.$del.'"/>'.$info;
}
$gBitSystem->confirmDialog( $formHash,
array(
- 'warning' => tra('Are you sure you want to delete these pages?') . ' (' . tra('Count: ') . count( $_REQUEST["checked"] ) . ')',
- 'error' => tra('This cannot be undone!'),
+ 'warning' => KernelTools::tra('Are you sure you want to delete these pages?') . ' (' . KernelTools::tra('Count: ') . count( $_REQUEST["checked"] ) . ')',
+ 'error' => KernelTools::tra('This cannot be undone!'),
)
);
} else {
@@ -57,20 +55,20 @@ if( isset( $_REQUEST["batch_submit"] ) && isset( $_REQUEST["checked"] ) && $_REQ
}
}
if( !empty( $errors )) {
- $gBitSmarty->assignByRef( 'errors', $errors );
+ $gBitSmarty->assign( 'errors', $errors );
}
}
}
$gContent = new BitPage();
-$gBitSmarty->assignByRef( "gContent", $gContent );
+$gBitSmarty->assign( "gContent", $gContent );
if( !empty( $_REQUEST['sort_mode'] )) {
$listHash['sort_mode'] = preg_replace( '/^user_/', 'creator_user_', $_REQUEST['sort_mode'] );
}
$listHash = $_REQUEST;
-$listHash['extras'] = TRUE;
-$listHash['orphans_only'] = TRUE;
+$listHash['extras'] = true;
+$listHash['orphans_only'] = true;
$listpages = $gContent->getList( $listHash );
// we will probably need a better way to do this
@@ -78,9 +76,8 @@ $listHash['listInfo']['parameters']['find_title'] = !empty( $listHash['fin
$listHash['listInfo']['parameters']['find_author'] = !empty( $listHash['find_author'] ) ? $listHash['find_author'] : '';
$listHash['listInfo']['parameters']['find_last_editor'] = !empty( $listHash['find_last_editor'] ) ? $listHash['find_last_editor'] : '';
-$gBitSmarty->assignByRef( 'listpages', $listpages );
-$gBitSmarty->assignByRef( 'listInfo', $listHash['listInfo'] );
+$gBitSmarty->assign( 'listpages', $listpages );
+$gBitSmarty->assign( 'listInfo', $listHash['listInfo'] );
// Display the template
-$gBitSystem->display( 'bitpackage:wiki/orphan_pages.tpl', tra( 'Orphan Pages' ), array( 'display_mode' => 'list' ));
-?>
+$gBitSystem->display( 'bitpackage:wiki/orphan_pages.tpl', KernelTools::tra( 'Orphan Pages' ), array( 'display_mode' => 'list' ));
diff --git a/page_history.php b/page_history.php
index 86f18fe..add60d5 100644..100755
--- a/page_history.php
+++ b/page_history.php
@@ -13,24 +13,25 @@
/**
* required setup
*/
-require_once( '../kernel/includes/setup_inc.php' );
-require_once( WIKI_PKG_CLASS_PATH.'BitPage.php');
+require_once '../kernel/includes/setup_inc.php';
+use Bitweaver\Wiki\BitPage;
+use Bitweaver\KernelTools;
$gBitSystem->verifyPackage( 'wiki' );
$gBitSystem->verifyFeature( 'wiki_history' );
// Get the page from the request var or default it to HomePage
-include( WIKI_PKG_INCLUDE_PATH.'lookup_page_inc.php' );
+include WIKI_PKG_INCLUDE_PATH.'lookup_page_inc.php';
//vd($gContent->mPageId);vd($gContent->mInfo);
if( !$gContent->isValid() || empty( $gContent->mInfo ) ) {
- $gBitSystem->fatalError( tra( "Unknown page" ));
+ $gBitSystem->fatalError( KernelTools::tra( "Unknown page" ));
}
$gContent->verifyViewPermission();
$gContent->verifyUserPermission( 'p_wiki_view_history' );
-$gBitSmarty->assignByRef( 'pageInfo', $gContent->mInfo );
+$gBitSmarty->assign( 'pageInfo', $gContent->mInfo );
if (!empty( $_REQUEST['rollback_preview'] )) {
$gBitSmarty->assign( 'rollback_preview', $_REQUEST['rollback_preview']);
@@ -39,7 +40,7 @@ if (!empty( $_REQUEST['rollback_preview'] )) {
// set up stuff to get history working
$smartyContentRef = 'pageInfo';
$rollbackPerm = 'p_wiki_rollback';
-include_once( LIBERTY_PKG_INCLUDE_PATH.'content_history_inc.php' );
+include_once LIBERTY_PKG_INCLUDE_PATH.'content_history_inc.php';
// pagination stuff
$gBitSmarty->assign( 'page', $page = !empty( $_REQUEST['page'] ) ? $_REQUEST['page'] : 1 );
@@ -48,11 +49,11 @@ if( !empty( $_REQUEST['list_page'] )) {
}
$offset = ( $page - 1 ) * $gBitSystem->getConfig( 'max_records' );
-$history = $gContent->getHistory( NULL, NULL, $offset, $gBitSystem->getConfig( 'max_records' ) );
-$gBitSmarty->assignByRef( 'data', $history['data'] );
-$gBitSmarty->assignByRef( 'listInfo', $history['listInfo'] );
+$history = $gContent->getHistory( null, null, $offset, $gBitSystem->getConfig( 'max_records' ) );
+$gBitSmarty->assign( 'data', $history['data'] );
+$gBitSmarty->assign( 'listInfo', $history['listInfo'] );
// Display the template
-$gBitSmarty->assignByRef( 'gContent', $gContent );
-$gBitSystem->display( 'bitpackage:wiki/page_history.tpl' , NULL, array( 'display_mode' => 'display' ));
-?>
+$gBitSmarty->assign( 'gContent', $gContent );
+$gBitSystem->display( 'bitpackage:wiki/page_history.tpl' , null, array( 'display_mode' => 'display' ));
+
diff --git a/page_loader.php b/page_loader.php
index bcc9b33..0815d23 100644..100755
--- a/page_loader.php
+++ b/page_loader.php
@@ -13,8 +13,8 @@
/**
* required setup
*/
-include_once( '../../kernel/includes/setup_inc.php' );
-include_once (HTML_PKG_INCLUDE_PATH.'htmlpages_lib.php');
+include_once '../../kernel/includes/setup_inc.php';
+include_once HTML_PKG_INCLUDE_PATH.'htmlpages_lib.php';
$refresh = 1000 * $_REQUEST["refresh"];
?>
<html>
@@ -22,7 +22,7 @@ $refresh = 1000 * $_REQUEST["refresh"];
<script type = 'text/javascript'>
<?php
$zones = $htmlpageslib->list_html_page_content($_REQUEST["title"], 0, -1, 'zone_asc', '');
- $cmds = array();
+ $cmds = [];
for ($i = 0; $i < count($zones["data"]); $i++) {
$cmd = 'top.document.getElementById("' . $zones["data"][$i]["zone"] . '").innerHTML="' . $zones["data"][$i]["content"] . '";';
echo $cmd;
diff --git a/page_watches.php b/page_watches.php
index 791f78f..db00931 100644..100755
--- a/page_watches.php
+++ b/page_watches.php
@@ -13,15 +13,16 @@
/**
* required setup
*/
-require_once( '../kernel/includes/setup_inc.php' );
-include_once( WIKI_PKG_CLASS_PATH.'BitPage.php');
+require_once '../kernel/includes/setup_inc.php';
+use Bitweaver\KernelTools;
+use Bitweaver\Liberty\LibertyComment;
$gBitSystem->verifyPackage( 'wiki' );
$gBitSystem->verifyFeature( 'users_watches' );
-$gBitSystem->verifyPermission( 'p_admin_users', tra( "Permission denied you cannot browse these page watches" ) );
+$gBitSystem->verifyPermission( 'p_admin_users', KernelTools::tra( "Permission denied you cannot browse these page watches" ) );
// Get the page from the request var or default it to HomePage
-include( WIKI_PKG_INCLUDE_PATH.'lookup_page_inc.php' );
+include WIKI_PKG_INCLUDE_PATH.'lookup_page_inc.php';
// make comment count for this page available for templates
$gComment = new LibertyComment();
@@ -32,19 +33,17 @@ $gBitSmarty->assign('comments_count', $numComments);
//vd($gContent->mPageId);vd($gContent->mInfo);
if( !$gContent->isValid() || empty( $gContent->mInfo ) ) {
- $gBitSystem->fatalError( tra( "Unknown page" ));
+ $gBitSystem->fatalError( KernelTools::tra( "Unknown page" ));
}
-$watches = NULL;
+$watches = null;
if( !empty( $gContent->mPageId ) ) {
$event = 'wiki_page_changed';
$watches = $gBitUser->get_event_watches($event, $gContent->mPageId);
- $gBitSmarty->assignByRef('watches', $watches);
- $gBitSmarty->assignByRef( 'pageInfo', $gContent->mInfo );
+ $gBitSmarty->assign('watches', $watches);
+ $gBitSmarty->assign( 'pageInfo', $gContent->mInfo );
}
// Display the template
-$gBitSystem->display( 'bitpackage:wiki/page_watches.tpl', NULL, array( 'display_mode' => 'display' ));
-
-?>
+$gBitSystem->display( 'bitpackage:wiki/page_watches.tpl', null, [ 'display_mode' => 'display' ] );
diff --git a/print_multi_pages.php b/print_multi_pages.php
index 60155c8..f66cb5e 100644..100755
--- a/print_multi_pages.php
+++ b/print_multi_pages.php
@@ -13,22 +13,24 @@
/**
* required setup
*/
-require_once( '../kernel/includes/setup_inc.php' );
-require_once( WIKI_PKG_CLASS_PATH.'BitPage.php' );
+require_once '../kernel/includes/setup_inc.php';
+use Bitweaver\Wiki\BitPage;
+use Bitweaver\KernelTools;
+use Bitweaver\HttpStatusCodes;
$gBitSystem->verifyFeature( 'wiki_multiprint' );
if (!isset($_REQUEST["printpages"])) {
- $gBitSystem->fatalError( tra( "No pages indicated" ), NULL, NULL, HttpStatusCodes::HTTP_NOT_FOUND );
+ $gBitSystem->fatalError( KernelTools::tra( "No pages indicated" ), null, null, HttpStatusCodes::HTTP_NOT_FOUND );
} else {
$printpages = unserialize(urldecode($_REQUEST["printpages"]));
}
if (isset($_REQUEST["print"])) {
// Create XMLRPC object
- $pages = array();
+ $pages = [];
foreach( $printpages as $contentId ) {
- $page = new BitPage( NULL, $contentId );
+ $page = new BitPage( null, $contentId );
if( $page->load() ) {
$page->verifyViewPermission();
$page->getParsedData();
@@ -36,8 +38,7 @@ if (isset($_REQUEST["print"])) {
}
}
}
-$gBitSmarty->assignByRef('pages', $pages);
+$gBitSmarty->assign('pages', $pages);
// Display the template
$gBitSmarty->display("bitpackage:wiki/print_multi_pages.tpl");
-?>
diff --git a/print_pages.php b/print_pages.php
index 69f5ef9..cdad9f4 100644..100755
--- a/print_pages.php
+++ b/print_pages.php
@@ -13,24 +13,20 @@
/**
* required setup
*/
-require_once( '../kernel/includes/setup_inc.php' );
-require_once( WIKI_PKG_CLASS_PATH.'BitPage.php' );
+require_once '../kernel/includes/setup_inc.php';
+use Bitweaver\Wiki\BitPage;
+use Bitweaver\KernelTools;
+
if( !$gBitSystem->isFeatureActive( 'wiki_multiprint' ) ) {
- $gBitSystem->fatalError( tra("This feature is disabled").": wiki_multiprint" );
+ $gBitSystem->fatalError( KernelTools::tra("This feature is disabled").": wiki_multiprint" );
}
// Now check permissions if user can view wiki pages
-$gBitSystem->verifyPermission( 'p_wiki_view_page' );
+$gContent->verifyViewPermission();
+
+$printpages = isset($_REQUEST["printpages"]) ? unserialize(urldecode($_REQUEST["printpages"])) : [];
+
+$find = $_REQUEST["find"] ?? '';
-if (!isset($_REQUEST["printpages"])) {
- $printpages = array();
-} else {
- $printpages = unserialize(urldecode($_REQUEST["printpages"]));
-}
-if (isset($_REQUEST["find"])) {
- $find = $_REQUEST["find"];
-} else {
- $find = '';
-}
$gBitSmarty->assign('find', $find);
if (isset($_REQUEST["addpage"])) {
if (!in_array($_REQUEST["title"], $printpages)) {
@@ -38,19 +34,18 @@ if (isset($_REQUEST["addpage"])) {
}
}
if (isset($_REQUEST["clearpages"])) {
- $printpages = array();
+ $printpages = [];
}
$gBitSmarty->assign('printpages', $printpages);
$form_printpages = urlencode(serialize($printpages));
$gBitSmarty->assign('form_printpages', $form_printpages);
-$listHash = array(
+$listHash = [
'max_records' => -1,
'sort_mode' => 'title_asc',
'find' => $find,
-);
+];
$pages = $gContent->getList( $listHash );
-$gBitSmarty->assignByRef('pages', $pages);
+$gBitSmarty->assign('pages', $pages);
// Display the template
-$gBitSystem->display( 'bitpackage:wiki/print_pages.tpl', NULL, array( 'display_mode' => 'display' ));
-?>
+$gBitSystem->display( 'bitpackage:wiki/print_pages.tpl', null, array( 'display_mode' => 'display' ));
diff --git a/rankings.php b/rankings.php
index 217b917..da651bb 100644..100755
--- a/rankings.php
+++ b/rankings.php
@@ -13,49 +13,51 @@
/**
* required setup
*/
-require_once( '../kernel/includes/setup_inc.php' );
+require_once '../kernel/includes/setup_inc.php';
+use Bitweaver\KernelTools;
+use Bitweaver\Liberty\LibertyContent;
$gBitSystem->verifyPackage( 'wiki' );
$gBitSystem->verifyFeature( 'wiki_rankings' );
$gBitSystem->verifyPermission( 'p_wiki_list_pages' );
-$rankingOptions = array(
- array(
- 'output' => tra( 'Most Often Viewed' ),
+$rankingOptions = [
+ [
+ 'output' => KernelTools::tra( 'Most Often Viewed' ),
'value' => 'hits_desc'
- ),
- array(
- 'output' => tra( 'Most Recently Modified' ),
+ ],
+ [
+ 'output' => KernelTools::tra( 'Most Recently Modified' ),
'value' => 'last_modified_desc'
- ),
- array(
- 'output' => tra( 'Most Active Authors' ),
+ ],
+ [
+ 'output' => KernelTools::tra( 'Most Active Authors' ),
'value' => 'top_authors'
- ),
-);
+ ],
+];
$gBitSmarty->assign( 'rankingOptions', $rankingOptions );
if( !empty( $_REQUEST['sort_mode'] ) ) {
switch( $_REQUEST['sort_mode'] ) {
case 'last_modified_desc':
$gBitSmarty->assign( 'attribute', 'last_modified' );
- $_REQUEST['attribute'] = tra( 'Date of last modification' );
+ $_REQUEST['attribute'] = KernelTools::tra( 'Date of last modification' );
break;
case 'top_authors':
$gBitSmarty->assign( 'attribute', 'ag_hits' );
- $_REQUEST['attribute'] = tra( 'Hits to items by this Author' );
+ $_REQUEST['attribute'] = KernelTools::tra( 'Hits to items by this Author' );
break;
default:
$gBitSmarty->assign( 'attribute', 'hits' );
- $_REQUEST['attribute'] = tra( 'Hits' );
+ $_REQUEST['attribute'] = KernelTools::tra( 'Hits' );
break;
}
} else {
$gBitSmarty->assign( 'attribute', 'hits' );
- $_REQUEST['attribute'] = tra( 'Hits' );
+ $_REQUEST['attribute'] = KernelTools::tra( 'Hits' );
}
-$_REQUEST['title'] = tra( 'Wiki Rankings' );
+$_REQUEST['title'] = KernelTools::tra( 'Wiki Rankings' );
$_REQUEST['content_type_guid'] = BITPAGE_CONTENT_TYPE_GUID;
$_REQUEST['max_records'] = !empty( $_REQUEST['max_records'] ) ? $_REQUEST['max_records'] : 10;
@@ -65,5 +67,4 @@ if( empty( $gContent ) ) {
$rankList = $gContent->getContentRanking( $_REQUEST );
$gBitSmarty->assign( 'rankList', $rankList );
-$gBitSystem->display( 'bitpackage:liberty/rankings.tpl', tra( "Wiki Rankings" ) , array( 'display_mode' => 'display' ));
-?>
+$gBitSystem->display( 'bitpackage:liberty/rankings.tpl', KernelTools::tra( "Wiki Rankings" ) , array( 'display_mode' => 'display' ));
diff --git a/remove_page.php b/remove_page.php
index ba380e7..58fbfd5 100644..100755
--- a/remove_page.php
+++ b/remove_page.php
@@ -13,14 +13,15 @@
/**
* required setup
*/
-require_once( '../kernel/includes/setup_inc.php' );
-include_once( WIKI_PKG_CLASS_PATH.'BitPage.php');
-include_once( WIKI_PKG_INCLUDE_PATH.'lookup_page_inc.php' );
+require_once '../kernel/includes/setup_inc.php';
+use Bitweaver\KernelTools;
+
+include_once WIKI_PKG_INCLUDE_PATH.'lookup_page_inc.php';
$gBitSystem->verifyPackage( 'wiki' );
if( !$gContent->isValid() ) {
- $gBitSystem->fatalError( tra( "No page indicated" ));
+ $gBitSystem->fatalError( KernelTools::tra( "No page indicated" ) );
}
$gContent->verifyUserPermission( 'p_wiki_remove_page' );
@@ -30,19 +31,17 @@ if( isset( $_REQUEST["confirm"] ) ) {
header( "location: ".WIKI_PKG_URL );
die;
} else {
- $gBitSystem->fatalError( tra("There was an error deleting the page:") . ' ' . vc( $gContent->mErrors ));
+ $gBitSystem->fatalError( KernelTools::tra("There was an error deleting the page:") . ' ' . \Bitweaver\vc( $gContent->mErrors ));
}
}
-$gBitSystem->setBrowserTitle( tra( 'Confirm delete of: ' ).$gContent->getTitle() );
-$formHash['remove'] = TRUE;
+$gBitSystem->setBrowserTitle( KernelTools::tra( 'Confirm delete of: ' ).$gContent->getTitle() );
+$formHash['remove'] = true;
$formHash['page_id'] = $_REQUEST['page_id'];
-$msgHash = array(
- 'label' => tra( 'Delete WikiPage' ),
+$msgHash = [
+ 'label' => KernelTools::tra( 'Delete WikiPage' ),
'confirm_item' => $gContent->getTitle(),
- 'warning' => tra( 'All previous versions of this page will be completely deleted.' ),
- 'error' => tra( 'This cannot be undone!' ),
-);
+ 'warning' => KernelTools::tra( 'All previous versions of this page will be completely deleted.' ),
+ 'error' => KernelTools::tra( 'This cannot be undone!' ),
+];
$gBitSystem->confirmDialog( $formHash,$msgHash );
-
-?>
diff --git a/sitemap.php b/sitemap.php
index 80a5295..ecc94ac 100644..100755
--- a/sitemap.php
+++ b/sitemap.php
@@ -13,14 +13,15 @@
/**
* required setup
*/
-require_once( '../kernel/includes/setup_inc.php' );
-
-require_once( WIKI_PKG_CLASS_PATH.'BitBook.php' );
+require_once '../kernel/includes/setup_inc.php';
+use Bitweaver\Wiki\BitBook;
+use Bitweaver\Liberty\LibertyContent;
+use Bitweaver\Liberty\LibertyStructure;
$book = new BitBook();
-$gSiteMapHash = array();
+$gSiteMapHash = [];
-$listHash = array();
+$listHash = [];
if( $bookList = $book->getList( $listHash ) ) {
foreach( $bookList['data'] as $bookHash ) {
@@ -34,12 +35,11 @@ if( $bookList = $book->getList( $listHash ) ) {
}
}
-
function process_book_list( $pList, $pDepth = 1 ) {
global $gSiteMapHash;
foreach( array_keys( $pList ) as $key ) {
if( !empty( $pList[$key]['display_url'] ) ) {
- $hash = array();
+ $hash = [];
$hash['loc'] = BIT_BASE_URI.$pList[$key]['display_url'];
$hash['lastmod'] = date( 'Y-m-d', $pList[$key]['last_modified'] );
if( (time() - $pList[$key]['last_modified']) < 86400 ) {
@@ -51,15 +51,15 @@ function process_book_list( $pList, $pDepth = 1 ) {
}
$hash['changefreq'] = $freq;
- $hash['priority'] = 1 - (round( $pDepth * .5 ) * .1);
+ $hash['priority'] = 1 - round( $pDepth * .5 ) * .1;
$gSiteMapHash[$pList[$key]['content_id']] = $hash;
}
if( !empty( $pList[$key]['sub'] ) ) {
- process_book_list( $pList[$key]['sub'], ($pDepth + 1) );
+ process_book_list( $pList[$key]['sub'], $pDepth + 1 );
}
}
}
-$gBitSmarty->assignByRef( 'gSiteMapHash', $gSiteMapHash );
+$gBitSmarty->assign( 'gSiteMapHash', $gSiteMapHash );
$gBitThemes->setFormatHeader( 'xml' );
print $gBitSmarty->display( 'bitpackage:kernel/sitemap.tpl' );
diff --git a/slideshow.php b/slideshow.php
index 0767273..5166123 100755
--- a/slideshow.php
+++ b/slideshow.php
@@ -13,29 +13,27 @@
/**
* required setup
*/
-require_once( '../kernel/includes/setup_inc.php' );
-require_once( 'BitPage.php' );
+require_once '../kernel/includes/setup_inc.php';
+use Bitweaver\HttpStatusCodes;
+use Bitweaver\KernelTools;
+use Bitweaver\Liberty\LibertyContent;
$gBitSystem->verifyPackage( 'wiki' );
//print($GLOBALS["HTTP_REFERER"]);
-if (!isset($_SESSION["thedate"])) {
- $thedate = $gBitSystem->getUTCTime();
-} else {
- $thedate = $_SESSION["thedate"];
-}
+$thedate = $_SESSION["thedate"] ?? $gBitSystem->getUTCTime();
-require_once ( WIKI_PKG_INCLUDE_PATH.'lookup_page_inc.php' );
+require_once WIKI_PKG_INCLUDE_PATH.'lookup_page_inc.php';
// If the page doesn't exist then display an error
if (!$gContent->isValid()) {
- $gBitSystem->fatalError( tra("Page cannot be found"), NULL, NULL, HttpStatusCodes::HTTP_NOT_FOUND );
+ $gBitSystem->fatalError( KernelTools::tra("Page cannot be found"), null, null, HttpStatusCodes::HTTP_NOT_FOUND );
}
// Now check permissions to access this page
$gContent->verifyViewPermission();
// Get page data
-include( WIKI_PKG_INCLUDE_PATH.'lookup_page_inc.php' );
+include WIKI_PKG_INCLUDE_PATH.'lookup_page_inc.php';
$info = $gContent->mInfo;
// If not locked and last version is user version then can undo
@@ -51,7 +49,7 @@ if( $gContent->hasAdminPermission() ) {
//Now process the pages
preg_match_all("/-=([^=]+)=-/", $info["data"], $reqs);
-$slides = split("-=[^=]+=-", $info["data"]);
+$slides = mb_split("-=[^=]+=-", $info["data"]);
if (count($slides) < 2) {
$slides = explode(defined('PAGE_SEP') ? PAGE_SEP : "...page...", $info["data"]);
@@ -66,25 +64,11 @@ if (!isset($_REQUEST["slide"])) {
$gBitSmarty->assign('prev_slide', $_REQUEST["slide"] - 1);
$gBitSmarty->assign('next_slide', $_REQUEST["slide"] + 1);
-if (isset($reqs[1][$_REQUEST["slide"]])) {
- $slide_title = $reqs[1][$_REQUEST["slide"]];
-} else {
- $slide_title = '';
-}
+$slide_title = $reqs[1][$_REQUEST["slide"]] ?? '';
$slide_data = LibertyContent::parseDataHash( $slides[$_REQUEST["slide"] + 1] );
-
-if (isset($reqs[1][$_REQUEST["slide"] - 1])) {
- $slide_prev_title = $reqs[1][$_REQUEST["slide"] - 1];
-} else {
- $slide_prev_title = 'prev';
-}
-
-if (isset($reqs[1][$_REQUEST["slide"] + 1])) {
- $slide_next_title = $reqs[1][$_REQUEST["slide"] + 1];
-} else {
- $slide_next_title = 'next';
-}
+$slide_prev_title = $reqs[1][$_REQUEST["slide"] - 1] ?? 'prev';
+$slide_next_title = $reqs[1][$_REQUEST["slide"] + 1] ?? 'next';
$gBitSmarty->assign('slide_prev_title', $slide_prev_title);
$gBitSmarty->assign('slide_next_title', $slide_next_title);
@@ -97,13 +81,12 @@ $current_slide = $_REQUEST["slide"] + 1;
$gBitSmarty->assign('total_slides', $total_slides);
$gBitSmarty->assign('current_slide', $current_slide);
-//$gBitSmarty->assignByRef('last_modified',date("l d of F, Y [H:i:s]",$info["last_modified"]));
-$gBitSmarty->assignByRef('last_modified', $info["last_modified"]);
+//$gBitSmarty->assign('last_modified',date("l d of F, Y [H:i:s]",$info["last_modified"]));
+$gBitSmarty->assign('last_modified', $info["last_modified"]);
if (empty($info["user"])) {
$info["user"] = 'anonymous';
}
-$gBitSmarty->assignByRef('lastUser', $info["user"]);
+$gBitSmarty->assign('lastUser', $info["user"]);
$gBitSmarty->display("bitpackage:wiki/slideshow.tpl");
-?>
diff --git a/wiki_graph.php b/wiki_graph.php
index f8b60f8..1966031 100644..100755
--- a/wiki_graph.php
+++ b/wiki_graph.php
@@ -13,19 +13,18 @@
/**
* required setup
*/
-include_once( '../kernel/includes/setup_inc.php' );
-include_once( WIKI_PKG_CLASS_PATH.'BitPage.php');
-include_once( WIKI_PKG_INCLUDE_PATH.'lookup_page_inc.php');
-include_once( 'Image/GraphViz.php' );
+include_once '../kernel/includes/setup_inc.php';
+use Bitweaver\Wiki\BitPage;
+include_once WIKI_PKG_INCLUDE_PATH.'lookup_page_inc.php';
+include_once UTIL_PKG_INCLUDE_PATH.'pear/Image/GraphViz.php';
$graph = new Image_GraphViz();
-$params = array(
+$params = [
'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 );
+$gContent->linkStructureGraph( $graph, $linkStructure, $params );
$graph->image( 'png' );
-?>
diff --git a/wiki_rss.php b/wiki_rss.php
index 6af3d04..89d1695 100644..100755
--- a/wiki_rss.php
+++ b/wiki_rss.php
@@ -7,32 +7,33 @@
/**
* Initialization
*/
-require_once( "../kernel/includes/setup_inc.php" );
+require_once "../kernel/includes/setup_inc.php";
$gBitSystem->verifyPackage( 'wiki' );
$gBitSystem->verifyPackage( 'rss' );
$gBitSystem->verifyFeature( 'wiki_rss' );
-require_once( WIKI_PKG_CLASS_PATH.'BitPage.php' );
-require_once( RSS_PKG_INCLUDE_PATH.'rss_inc.php' );
+use Bitweaver\Wiki\BitPage;
+use Bitweaver\Rss\FeedItem;
+use Bitweaver\KernelTools;
-$rss->title = $gBitSystem->getConfig( 'wiki_rss_title', $gBitSystem->getConfig( 'site_title' ).' - '.tra( 'Wiki' ) );
-$rss->description = $gBitSystem->getConfig( 'wiki_rss_description', $gBitSystem->getConfig( 'site_title' ).' - '.tra( 'RSS Feed' ) );
+$rss->title = $gBitSystem->getConfig( 'wiki_rss_title', $gBitSystem->getConfig( 'site_title' ).' - '.KernelTools::tra( 'Wiki' ) );
+$rss->description = $gBitSystem->getConfig( 'wiki_rss_description', $gBitSystem->getConfig( 'site_title' ).' - '.KernelTools::tra( 'RSS Feed' ) );
// check permission to view wiki pages
if( !$gBitUser->hasPermission( 'p_wiki_view_page' ) ) {
- require_once( RSS_PKG_PATH."rss_error.php" );
+ 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.'/'.$cacheFileTail;
$rss->useCached( $rss_version_name, $cacheFile, $gBitSystem->getConfig( 'rssfeed_cache_time' ));
$wiki = new BitPage();
- $listHash = array(
+ $listHash = [
'max_records' => $gBitSystem->getConfig( 'wiki_rss_max_records', 10 ),
'sort_mode' => 'last_modified_desc',
- 'get_data' => TRUE,
- );
+ 'get_data' => true,
+ ];
$feeds = $wiki->getList( $listHash );
// set the rss link
@@ -42,15 +43,15 @@ if( !$gBitUser->hasPermission( 'p_wiki_view_page' ) ) {
foreach( $feeds as $feed ) {
$item = new FeedItem();
$item->title = $feed['title'];
- $item->link = BIT_BASE_URI.$wiki->getDisplayUrl( $feed['title'] );
+ $item->link = BIT_BASE_URI.$wiki->getDisplayUrlfromHash( $feed['title'] );
$item->description = BitPage::parseDataHash( $feed );
$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->author = $gBitUser->getDisplayName( false, array( 'real_name' => $feed['modifier_real_name'], 'login' => $feed['modifier_user'] ) );
$item->descriptionTruncSize = $gBitSystem->getConfig( 'rssfeed_truncate', 5000 );
- $item->descriptionHtmlSyndicated = FALSE;
+ $item->descriptionHtmlSyndicated = false;
// pass the item on to the rss feed creator
$rss->addItem( $item );
@@ -59,4 +60,3 @@ if( !$gBitUser->hasPermission( 'p_wiki_view_page' ) ) {
// finally we are ready to serve the data
echo $rss->saveFeed( $rss_version_name, $cacheFile );
}
-?>