summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kremmel <xing@synapse.plus.com>2005-11-22 07:27:19 +0000
committerMax Kremmel <xing@synapse.plus.com>2005-11-22 07:27:19 +0000
commit065390ab852a58a14c6339e90dfb0d7eced2afba (patch)
treed112df21749dc050030bf4b665da4e3755a3a9f4
parent300a03c554874c55d3a6861450a7c780e19c89f4 (diff)
downloadliberty-065390ab852a58a14c6339e90dfb0d7eced2afba.tar.gz
liberty-065390ab852a58a14c6339e90dfb0d7eced2afba.tar.bz2
liberty-065390ab852a58a14c6339e90dfb0d7eced2afba.zip
merge recent changes into HEAD
-rw-r--r--LibertyAttachable.php398
-rwxr-xr-xLibertySystem.php3
-rw-r--r--admin/admin_liberty_inc.php2
-rw-r--r--attachment_browser.php31
-rw-r--r--comments_inc.php14
-rw-r--r--edit_storage_inc.php40
-rw-r--r--icons/busy.gifbin0 -> 1647 bytes
-rw-r--r--icons/generating_thumbnails.pngbin0 -> 4410 bytes
-rw-r--r--modules/mod_last_changes.php10
-rw-r--r--plugins/data.addtabs.php6
-rw-r--r--plugins/data.agentinfo.php6
-rw-r--r--plugins/data.article.php6
-rw-r--r--plugins/data.avatar.php6
-rw-r--r--plugins/data.backlinks.php8
-rw-r--r--plugins/data.category.php6
-rw-r--r--plugins/data.catorphans.php6
-rw-r--r--plugins/data.catpath.php6
-rw-r--r--plugins/data.code.php6
-rw-r--r--plugins/data.copyright.php6
-rw-r--r--plugins/data.countdown.php6
-rw-r--r--plugins/data.dropdown.php4
-rw-r--r--plugins/data.example.php4
-rw-r--r--plugins/data.flash.php6
-rw-r--r--plugins/data.gauge.php6
-rw-r--r--plugins/data.lang.php8
-rw-r--r--plugins/data.ledgertable.php148
-rw-r--r--plugins/data.maketoc.php8
-rw-r--r--plugins/data.mapquest.php6
-rw-r--r--plugins/data.module.php16
-rw-r--r--plugins/data.mqdirections.php6
-rw-r--r--plugins/data.pluginhelp.php6
-rw-r--r--plugins/data.sf.php6
-rw-r--r--plugins/data.sort.php6
-rw-r--r--plugins/data.split.php6
-rw-r--r--plugins/data.spytext.php4
-rw-r--r--plugins/data.titlesearch.php6
-rw-r--r--plugins/data.translated.php8
-rw-r--r--plugins/data.usercount.php6
-rwxr-xr-xplugins/data.userlink.php6
-rw-r--r--plugins/data.userlist.php6
-rw-r--r--plugins/data.wikigraph.php6
-rw-r--r--plugins/data.wikilist.php6
-rw-r--r--plugins/format.markdown.php16
-rw-r--r--plugins/format.tikiwiki.php4
-rw-r--r--plugins/storage.bitfile.php13
-rw-r--r--templates/admin_liberty.tpl22
-rw-r--r--templates/attachment_browser.tpl71
-rw-r--r--templates/edit_storage.tpl68
-rw-r--r--templates/edit_storage_list.tpl32
-rw-r--r--templates/libertypagination.tpl26
-rw-r--r--templates/storage_thumbs.tpl10
51 files changed, 756 insertions, 356 deletions
diff --git a/LibertyAttachable.php b/LibertyAttachable.php
index cd1f529..5b92179 100644
--- a/LibertyAttachable.php
+++ b/LibertyAttachable.php
@@ -3,7 +3,7 @@
* Management of Liberty Content
*
* @package liberty
- * @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyAttachable.php,v 1.7 2005/10/29 17:54:23 squareing Exp $
+ * @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyAttachable.php,v 1.8 2005/11/22 07:27:18 squareing Exp $
* @author spider <spider@steelsun.com>
*/
// +----------------------------------------------------------------------+
@@ -213,7 +213,7 @@ Disable for now - instead fend off new uploads once quota is exceeded. Need a ni
// Things to be stored should be shoved in the array $pParamHash['STORAGE']
function store ( &$pParamHash ) {
- global $gLibertySystem;
+ global $gLibertySystem, $gBitSystem;
$this->mDb->StartTrans();
if( LibertyAttachable::verify( $pParamHash ) && LibertyContent::store( $pParamHash ) && !empty( $pParamHash['STORAGE'] ) && count( $pParamHash['STORAGE'] ) ) {
foreach( array_keys( $pParamHash['STORAGE'] ) as $guid ) {
@@ -241,6 +241,10 @@ Disable for now - instead fend off new uploads once quota is exceeded. Need a ni
// if we have uploaded a file, we can take care of that generically
if( is_array( $storeRow['upload'] ) && !empty( $storeRow['upload']['size'] ) ) {
+ if( empty( $storeRow['upload']['type'] ) ) {
+ $ext = substr( $storeRow['upload']['name'], strrpos( $storeRow['upload']['name'], '.' ) + 1 );
+ $storeRow['upload']['type'] = $gBitSystem->lookupMimeType( $ext );
+ }
$storeRow['upload']['dest_path'] = $this->getStorageBranch( $storeRow['attachment_id'], $pParamHash['user_id'], 'images' );
$storagePath = liberty_process_upload( $storeRow );
// We're gonna store to local file system & tiki_files table
@@ -425,7 +429,8 @@ function liberty_process_upload( &$pFileHash ) {
$pFileHash['upload']['name'] = $pFileHash['upload']['name'].'.txt';
}
// Thumbs.db is a windows My Photos/ folder file, and seems to really piss off imagick
- if( preg_match( '/^image\/*/', $pFileHash['upload']['type'] ) && $pFileHash['upload']['name'] != 'Thumbs.db' ) {
+ if( (preg_match( '/^image\/*/', $pFileHash['upload']['type'] ) || preg_match( '/pdf/i', $pFileHash['upload']['type'] ) )
+ && $pFileHash['upload']['name'] != 'Thumbs.db' ) {
$ret = liberty_process_image( $pFileHash['upload'] );
} else {
$ret = liberty_process_generic( $pFileHash['upload'] );
@@ -433,6 +438,66 @@ function liberty_process_upload( &$pFileHash ) {
return $ret;
}
+function liberty_process_archive( &$pFileHash ) {
+ $cwd = getcwd();
+ $dir = dirname( $pFileHash['tmp_name'] );
+ $upExt = strtolower( substr( $pFileHash['name'], (strrpos( $pFileHash['name'], '.' ) + 1) ) );
+ $baseDir = $dir.'/';
+ if( is_uploaded_file( $pFileHash['tmp_name'] ) ) {
+ global $gBitUser;
+ $baseDir .= $gBitUser->mUserId;
+ }
+ $destDir = $baseDir.'/'.basename( $pFileHash['tmp_name'] );
+ if( (is_dir( $baseDir ) || mkdir( $baseDir )) && @mkdir( $destDir ) ) {
+ // Some commands don't nicely support extracting to other directories
+ chdir( $destDir );
+ list( $mimeType, $mimeExt ) = split( '/', $pFileHash['type'] );
+ switch( $mimeExt ) {
+ case 'x-rar-compressed':
+ case 'x-rar':
+ $shellResult = shell_exec( "unrar x $pFileHash[tmp_name] \"$destDir\"" );
+ break;
+ case 'x-bzip2':
+ case 'bzip2':
+ case 'x-gzip':
+ case 'gzip':
+ case 'x-tgz':
+ case 'x-tar':
+ case 'tar':
+ switch( $upExt ) {
+ case 'gz':
+ case 'tgz': $compressFlag = '-z'; break;
+ case 'bz2': $compressFlag = '-j'; break;
+ default: $compressFlag = ''; break;
+ }
+ $shellResult = shell_exec( "tar -x $compressFlag -f $pFileHash[tmp_name] -C \"$destDir\"" );
+ break;
+ case 'x-zip-compressed':
+ case 'x-zip':
+ case 'zip':
+ $shellResult = shell_exec( "unzip $pFileHash[tmp_name] -d \"$destDir\"" );
+ break;
+ case 'x-stuffit':
+ case 'stuffit':
+ $shellResult = shell_exec( "unstuff -d=\"$destDir\" $pFileHash[tmp_name] " );
+ break;
+ default:
+ if( $upExt == 'zip' ) {
+ $shellResult = shell_exec( "unzip $pFileHash[tmp_name] -d \"$destDir\"" );
+ } elseif( $upExt == 'rar' ) {
+ $shellResult = shell_exec( "unrar x $pFileHash[tmp_name] \"$destDir\"" );
+ } elseif( $upExt == 'sit' || $upExt == 'sitx' ) {
+ print( "unstuff -d=\"$destDir\" $pFileHash[tmp_name] " );
+ $shellResult = shell_exec( "unstuff -d=\"$destDir\" $pFileHash[tmp_name] " );
+ } else {
+ $destDir = NULL;
+ }
+ break;
+ }
+ }
+ chdir( $cwd );
+ return $destDir;
+}
function liberty_process_generic( &$pFileHash ) {
$ret = NULL;
@@ -454,10 +519,11 @@ function liberty_process_generic( &$pFileHash ) {
function liberty_process_image( &$pFileHash ) {
global $gBitSystem;
$ret = NULL;
- $resizeFunc = ($gBitSystem->getPreference( 'image_processor' ) == 'imagick' ) ? 'liberty_imagick_resize_image' : 'liberty_gd_resize_image';
+ $resizeFunc = liberty_get_function( 'resize' );
+
list($type, $ext) = split( '/', strtolower( $pFileHash['type'] ) );
mkdir_p( BIT_PKG_PATH.$pFileHash['dest_path'] );
- if( $resizePath = $resizeFunc( $pFileHash, $ext ) ) {
+ if( $resizePath = liberty_process_generic( $pFileHash, $ext ) ) {
$pFileHash['source_file'] = BIT_ROOT_PATH.$resizePath;
$nameHold = $pFileHash['name'];
$sizeHold = $pFileHash['size'];
@@ -483,16 +549,34 @@ function liberty_clear_thumbnails( &$pFileHash ) {
}
}
+function liberty_get_function( $pType ) {
+ global $gBitSystem;
+ $ret = NULL;
+ switch( $gBitSystem->getPreference( 'image_processor' ) ) {
+ case 'imagick':
+ $ret = 'liberty_imagick_'.$pType.'_image';
+ break;
+ case 'magickwand':
+ $ret = 'liberty_magickwand_'.$pType.'_image';
+ break;
+ default:
+ $ret = 'liberty_gd_'.$pType.'_image';
+ break;
+ }
+ return $ret;
+}
+
+define( 'MAX_THUMBNAIL_DIMENSION', 99999 );
function liberty_generate_thumbnails( &$pFileHash ) {
global $gBitSystem;
- $resizeFunc = ($gBitSystem->getPreference( 'image_processor' ) == 'imagick' ) ? 'liberty_imagick_resize_image' : 'liberty_gd_resize_image';
+ $resizeFunc = liberty_get_function( 'resize' );
if( !preg_match( '/image\/(gif|jpg|jpeg|png)/', strtolower( $pFileHash['type'] ) ) && $gBitSystem->isFeatureActive( 'liberty_jpeg_originals' ) ) {
// jpeg version of original
$pFileHash['dest_base_name'] = 'original';
$pFileHash['name'] = 'original.jpg';
- $pFileHash['max_width'] = 99999;
- $pFileHash['max_height'] = 99999;
+ $pFileHash['max_width'] = MAX_THUMBNAIL_DIMENSION;
+ $pFileHash['max_height'] = MAX_THUMBNAIL_DIMENSION;
$pFileHash['icon_thumb_path'] = BIT_ROOT_PATH.$resizeFunc( $pFileHash );
}
// Icon thumb is 48x48
@@ -527,66 +611,8 @@ function liberty_generate_thumbnails( &$pFileHash ) {
$pFileHash['large_thumb_path'] = BIT_ROOT_PATH.$resizeFunc( $pFileHash );
}
-function liberty_imagick_resize_image( &$pFileHash, $pFormat = NULL ) {
- $pFileHash['error'] = NULL;
- $ret = NULL;
- if( !empty( $pFileHash['source_file'] ) && is_file( $pFileHash['source_file'] ) ) {
- $iImg = imagick_readimage( $pFileHash['source_file'] );
- if( !$iImg ) {
-// $pFileHash['error'] = $pFileHash['name'].' '.tra ( "is not a known image file" );
- $destUrl = liberty_process_generic( $pFileHash );
- } elseif( imagick_iserror( $iImg ) ) {
-// $pFileHash['error'] = imagick_failedreason( $iImg ) . imagick_faileddescription( $iImg );
- $destUrl = liberty_process_generic( $pFileHash );
- } else {
- imagick_set_image_quality( $iImg, 85 );
- $iwidth = imagick_getwidth( $iImg );
- $iheight = imagick_getheight( $iImg );
- if( (($iwidth / $iheight) > 0) && !empty( $pFileHash['max_width'] ) && !empty( $pFileHash['max_height'] ) ) {
- // we have a portrait image, flip everything
- $temp = $pFileHash['max_width'];
- $pFileHash['max_height'] = $pFileHash['max_width'];
- $pFileHash['max_width'] = $temp;
- }
- $itype = imagick_getmimetype( $iImg );
- list($type, $mimeExt) = split( '/', strtolower( $itype ) );
- if( !empty( $pFileHash['max_width'] ) && !empty( $pFileHash['max_height'] ) && ( ($pFileHash['max_width'] < $iwidth || $pFileHash['max_height'] < $iheight ) || ($mimeExt != 'jpeg')) ) {
- // We have to resize. *ALL* resizes are converted to jpeg
- $destExt = '.jpg';
- $destUrl = $pFileHash['dest_path'].$pFileHash['dest_base_name'].$destExt;
- $destFile = BIT_PKG_PATH.'/'.$destUrl;
- $pFileHash['name'] = $pFileHash['dest_base_name'].$destExt;
-// print " if ( !imagick_resize( $iImg, $pFileHash[max_width], $pFileHash[max_height], IMAGICK_FILTER_LANCZOS, 0.5, $pFileHash[max_width] x $pFileHash[max_height] > ) ) {";
-
- // Alternate Filter settings can seen here http://www.dylanbeattie.net/magick/filters/result.html
-
- if ( !imagick_resize( $iImg, $pFileHash['max_width'], $pFileHash['max_height'], IMAGICK_FILTER_CATROM, 1.00, '>' ) ) {
- $pFileHash['error'] .= imagick_failedreason( $iImg ) . imagick_faileddescription( $iImg );
- }
-// print "2YOYOYOYO $iwidth x $iheight $destUrl <br/>"; flush();
-
- if( function_exists( 'imagick_set_attribute' ) ) {
- // this exists in the PECL package, but not php-imagick
- $imagick_set_attribute($iImg,array("quality"=>1) );
- }
-
- if( !imagick_writeimage( $iImg, $destFile ) ) {
- $pFileHash['error'] .= imagick_failedreason( $iImg ) . imagick_faileddescription( $iImg );
- }
- $pFileHash['size'] = filesize( $destFile );
- } else {
- //print "GENERIC";
- $destUrl = liberty_process_generic( $pFileHash );
- }
- }
- $ret = $destUrl;
- } else {
- $pFileHash['error'] = "No source file to resize";
- }
-
- return $ret;
-}
+// =-=-=-=-=-=-=-=-=-=- gd functions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
function liberty_gd_resize_image( &$pFileHash, $pFormat = NULL ) {
$ret = NULL;
@@ -670,6 +696,109 @@ function liberty_gd_resize_image( &$pFileHash, $pFormat = NULL ) {
return $ret;
}
+function liberty_gd_rotate_image( &$pFileHash, $pFormat = NULL ) {
+ if( !function_exists( 'imagerotate' ) ) {
+ $pFileHash['error'] = "Rotate is not available on this webserver.";
+ } elseif( empty( $pFileHash['degrees'] ) || !is_numeric( $pFileHash['degrees'] ) ) {
+ $pFileHash['error'] = tra( 'Invalid rotation amount' );
+ } else {
+ // we need to scale and/or reformat
+ $fp = fopen( $pFileHash['source_file'], "rb" );
+ $data = fread( $fp, filesize( $pFileHash['source_file'] ) );
+ fclose ($fp);
+ if( function_exists("ImageCreateFromString") ) {
+ $img = @imagecreatefromstring($data);
+ }
+
+ if( !empty( $img ) ) {
+ //image rotate degrees seems back ass words.
+ $rotateImg = imagerotate ( $img, (-1 * $pFileHash['degrees']), 0 );
+ if( !empty( $rotateImg ) ) {
+ imagejpeg( $rotateImg, $pFileHash['source_file'] );
+ } else {
+ $pFileHash['error'] = "Image rotation failed.";
+ }
+ } else {
+ $pFileHash['error'] = "Image could not be opened for rotation.";
+ }
+ }
+
+ return( empty( $pFileHash['error'] ) );
+}
+
+function liberty_gd_can_thumbnail_image( $pMimeType ) {
+ $ret = FALSE;
+ if( !empty( $pMimeType ) ) {
+ $ret = preg_match( '/^image/i', $pMimeType );
+ }
+ return $ret;
+
+}
+
+
+
+// =-=-=-=-=-=-=-=-=-=- php-imagick functions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+function liberty_imagick_resize_image( &$pFileHash, $pFormat = NULL ) {
+ $pFileHash['error'] = NULL;
+ $ret = NULL;
+ if( !empty( $pFileHash['source_file'] ) && is_file( $pFileHash['source_file'] ) ) {
+ $iImg = imagick_readimage( $pFileHash['source_file'] );
+ if( !$iImg ) {
+// $pFileHash['error'] = $pFileHash['name'].' '.tra ( "is not a known image file" );
+ $destUrl = liberty_process_generic( $pFileHash );
+ } elseif( imagick_iserror( $iImg ) ) {
+// $pFileHash['error'] = imagick_failedreason( $iImg ) . imagick_faileddescription( $iImg );
+ $destUrl = liberty_process_generic( $pFileHash );
+ } else {
+ imagick_set_image_quality( $iImg, 85 );
+ $iwidth = imagick_getwidth( $iImg );
+ $iheight = imagick_getheight( $iImg );
+ if( (($iwidth / $iheight) > 0) && !empty( $pFileHash['max_width'] ) && !empty( $pFileHash['max_height'] ) ) {
+ // we have a portrait image, flip everything
+ $temp = $pFileHash['max_width'];
+ $pFileHash['max_height'] = $pFileHash['max_width'];
+ $pFileHash['max_width'] = $temp;
+ }
+ $itype = imagick_getmimetype( $iImg );
+ list($type, $mimeExt) = split( '/', strtolower( $itype ) );
+ if( !empty( $pFileHash['max_width'] ) && !empty( $pFileHash['max_height'] ) && ( ($pFileHash['max_width'] < $iwidth || $pFileHash['max_height'] < $iheight ) || ($mimeExt != 'jpeg')) ) {
+ // We have to resize. *ALL* resizes are converted to jpeg
+ $destExt = '.jpg';
+ $destUrl = $pFileHash['dest_path'].$pFileHash['dest_base_name'].$destExt;
+ $destFile = BIT_PKG_PATH.'/'.$destUrl;
+ $pFileHash['name'] = $pFileHash['dest_base_name'].$destExt;
+// print " if ( !imagick_resize( $iImg, $pFileHash[max_width], $pFileHash[max_height], IMAGICK_FILTER_LANCZOS, 0.5, $pFileHash[max_width] x $pFileHash[max_height] > ) ) {";
+
+ // Alternate Filter settings can seen here http://www.dylanbeattie.net/magick/filters/result.html
+
+ if ( !imagick_resize( $iImg, $pFileHash['max_width'], $pFileHash['max_height'], IMAGICK_FILTER_CATROM, 1.00, '>' ) ) {
+ $pFileHash['error'] .= imagick_failedreason( $iImg ) . imagick_faileddescription( $iImg );
+ }
+// print "2YOYOYOYO $iwidth x $iheight $destUrl <br/>"; flush();
+
+ if( function_exists( 'imagick_set_attribute' ) ) {
+ // this exists in the PECL package, but not php-imagick
+ $imagick_set_attribute($iImg,array("quality"=>1) );
+ }
+
+ if( !imagick_writeimage( $iImg, $destFile ) ) {
+ $pFileHash['error'] .= imagick_failedreason( $iImg ) . imagick_faileddescription( $iImg );
+ }
+ $pFileHash['size'] = filesize( $destFile );
+ } else {
+ //print "GENERIC";
+ $destUrl = liberty_process_generic( $pFileHash );
+ }
+ }
+ $ret = $destUrl;
+ } else {
+ $pFileHash['error'] = "No source file to resize";
+ }
+
+ return $ret;
+}
+
function liberty_imagick_rotate_image( &$pFileHash ) {
$ret = FALSE;
@@ -696,35 +825,132 @@ function liberty_imagick_rotate_image( &$pFileHash ) {
return( empty( $pFileHash['error'] ) );
}
+function liberty_imagick_can_thumbnail_image( $pMimeType ) {
+ $ret = FALSE;
+ if( !empty( $pMimeType ) ) {
+ $ret = preg_match( '/^image/i', $pMimeType );
+ }
+ return $ret;
-function liberty_gd_rotate_image( &$pFileHash, $pFormat = NULL ) {
- if( !function_exists( 'imagerotate' ) ) {
- $pFileHash['error'] = "Rotate is not available on this webserver.";
- } elseif( empty( $pFileHash['degrees'] ) || !is_numeric( $pFileHash['degrees'] ) ) {
- $pFileHash['error'] = tra( 'Invalid rotation amount' );
- } else {
- // we need to scale and/or reformat
- $fp = fopen( $pFileHash['source_file'], "rb" );
- $data = fread( $fp, filesize( $pFileHash['source_file'] ) );
- fclose ($fp);
- if( function_exists("ImageCreateFromString") ) {
- $img = @imagecreatefromstring($data);
+}
+
+
+// =-=-=-=-=-=-=-=-=-=- magickwand functions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+function liberty_magickwand_resize_image( &$pFileHash, $pFormat = NULL ) {
+ $magickWand = NewMagickWand();
+ $pFileHash['error'] = NULL;
+ $ret = NULL;
+ $isPdf = preg_match( '/pdf/i', $pFileHash['type'] );
+ if( !empty( $pFileHash['source_file'] ) && is_file( $pFileHash['source_file'] ) ) {
+ // This has to come BEFORE the MagickReadImage
+ if( $isPdf ) {
+ MagickSetImageColorspace( $magickWand, MW_RGBColorspace );
+ MagickSetImageUnits( $magickWand, MW_PixelsPerInchResolution );
+ $rez = empty( $pFileHash['max_width'] ) || $pFileHash['max_width'] == MAX_THUMBNAIL_DIMENSION ? 250 : 72;
+ MagickSetResolution( $magickWand, 300, 300 );
}
+ if( $error = liberty_magickwand_check_error( MagickReadImage( $magickWand, $pFileHash['source_file'] ), $magickWand ) ) {
+// $pFileHash['error'] = $error;
+ $destUrl = liberty_process_generic( $pFileHash );
+ } else {
- if( !empty( $img ) ) {
- //image rotate degrees seems back ass words.
- $rotateImg = imagerotate ( $img, (-1 * $pFileHash['degrees']), 0 );
- if( !empty( $rotateImg ) ) {
- imagejpeg( $rotateImg, $pFileHash['source_file'] );
+ if( $isPdf ) {
+ MagickResetIterator( $magickWand );
+ MagickNextImage( $magickWand );
+ }
+
+ MagickSetImageCompressionQuality( $magickWand, 85 );
+ $iwidth = round( MagickGetImageWidth( $magickWand ) );
+ $iheight = round( MagickGetImageHeight( $magickWand ) );
+ $itype = MagickGetImageMimeType( $magickWand );
+
+ MagickSetImageFormat( $magickWand, 'JPG' );
+
+ if( empty( $pFileHash['max_width'] ) || empty( $pFileHash['max_height'] ) || $pFileHash['max_width'] == MAX_THUMBNAIL_DIMENSION || $pFileHash['max_height'] == MAX_THUMBNAIL_DIMENSION ) {
+ $pFileHash['max_width'] = $iwidth;
+ $pFileHash['max_height'] = $iheight;
+ } elseif( (($iwidth / $iheight) < 1) && !empty( $pFileHash['max_width'] ) && !empty( $pFileHash['max_height'] ) ) {
+ // we have a portrait image, flip everything
+ $temp = $pFileHash['max_width'];
+ $pFileHash['max_height'] = $pFileHash['max_width'];
+ $pFileHash['max_width'] = round( ($iwidth / $iheight) * $pFileHash['max_height'] );
+ } elseif( !empty( $pFileHash['max_width'] ) ) {
+ $pFileHash['max_height'] = round( ($iheight / $iwidth) * $pFileHash['max_width'] );
+ }
+
+ list($type, $mimeExt) = split( '/', strtolower( $itype ) );
+ if( !empty( $pFileHash['max_width'] ) && !empty( $pFileHash['max_height'] ) && ( ($pFileHash['max_width'] < $iwidth || $pFileHash['max_height'] < $iheight ) || ($mimeExt != 'jpeg')) ) {
+ // We have to resize. *ALL* resizes are converted to jpeg
+ $destExt = '.jpg';
+ $destUrl = $pFileHash['dest_path'].$pFileHash['dest_base_name'].$destExt;
+ $destFile = BIT_PKG_PATH.'/'.$destUrl;
+ $pFileHash['name'] = $pFileHash['dest_base_name'].$destExt;
+ // Alternate Filter settings can seen here http://www.dylanbeattie.net/magick/filters/result.html
+ if ( $error = liberty_magickwand_check_error( MagickResizeImage( $magickWand, $pFileHash['max_width'], $pFileHash['max_height'], MW_CatromFilter, 1.00 ), $magickWand ) ) {
+ $pFileHash['error'] .= $error;
+ }
+ if( $error = liberty_magickwand_check_error( MagickWriteImage( $magickWand, $destFile ), $magickWand ) ) {
+ $pFileHash['error'] .= $error;
+ }
+ $pFileHash['size'] = filesize( $destFile );
} else {
- $pFileHash['error'] = "Image rotation failed.";
+ $destUrl = liberty_process_generic( $pFileHash );
}
+ }
+ $ret = $destUrl;
+ } else {
+ $pFileHash['error'] = "No source file to resize";
+ }
+ DestroyMagickWand( $magickWand );
+ return $ret;
+}
+
+
+function liberty_magickwand_rotate_image( &$pFileHash ) {
+ $ret = FALSE;
+ $magickWand = NewMagickWand();
+ $pFileHash['error'] = NULL;
+ if( !empty( $pFileHash['source_file'] ) && is_file( $pFileHash['source_file'] ) ) {
+ if( $error = liberty_magickwand_check_error( MagickReadImage( $magickWand, $pFileHash['source_file'] ), $magickWand ) ) {
+ $pFileHash['error'] = $error;
+ } elseif( empty( $pFileHash['degrees'] ) || !is_numeric( $pFileHash['degrees'] ) ) {
+ $pFileHash['error'] = tra( 'Invalid rotation amount' );
} else {
- $pFileHash['error'] = "Image could not be opened for rotation.";
+ $bgWand = NewPixelWand('white');
+ if( $error = liberty_magickwand_check_error( MagickRotateImage( $magickWand, $bgWand, $pFileHash['degrees'] ), $magickWand ) ) {
+ $pFileHash['error'] .= $error;
+ }
+ if( $error = liberty_magickwand_check_error( MagickWriteImage( $magickWand, $pFileHash['source_file'] ), $magickWand ) ) {
+ $pFileHash['error'] .= $error;
+ }
}
+ } else {
+ $pFileHash['error'] = "No source file to resize";
}
return( empty( $pFileHash['error'] ) );
}
+
+
+
+function liberty_magickwand_check_error( $pResult, $pWand ) {
+ $ret = FALSE;
+ if( $pResult === FALSE && WandHasException( $pWand ) ) {
+ $ret = 'An image processing error occurred : '.WandGetExceptionString($pWand);
+ }
+ return $ret;
+}
+
+function liberty_magickwand_can_thumbnail_image( $pMimeType ) {
+ $ret = FALSE;
+ if( !empty( $pMimeType ) ) {
+ $ret = preg_match( '/(^image|pdf)/i', $pMimeType );
+ }
+ return $ret;
+
+}
+
+
?>
diff --git a/LibertySystem.php b/LibertySystem.php
index 176647b..3f1c791 100755
--- a/LibertySystem.php
+++ b/LibertySystem.php
@@ -3,7 +3,7 @@
* System class for handling the liberty package
*
* @package liberty
-* @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertySystem.php,v 1.8 2005/10/12 15:13:52 spiderr Exp $
+* @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertySystem.php,v 1.9 2005/11/22 07:27:18 squareing Exp $
* @author spider <spider@steelsun.com>
*/
@@ -342,6 +342,5 @@ function parse_data_plugins(&$data, &$preparsed, &$noparsed, &$pParser ) {
global $gLibertySystem;
$gLibertySystem = new LibertySystem();
-$gBitSmarty->assign_by_ref( 'gLibertySystem', $gLibertySystem );
?>
diff --git a/admin/admin_liberty_inc.php b/admin/admin_liberty_inc.php
index 7fd749c..2f6a94d 100644
--- a/admin/admin_liberty_inc.php
+++ b/admin/admin_liberty_inc.php
@@ -28,7 +28,7 @@ $formValues = array( 'image_processor', 'liberty_attachment_link_format', 'comme
if( !empty( $_REQUEST['change_prefs'] ) ) {
$errors = array();
- $formFeatures = array_merge( $formLibertyFeatures, $formCommentFeatures, $formImageFeatures );
+ $formFeatures = array_merge( $formLibertyFeatures, $formImageFeatures );
foreach( $formFeatures as $item => $data ) {
simple_set_toggle( $item );
}
diff --git a/attachment_browser.php b/attachment_browser.php
index 3a0836a..0857189 100644
--- a/attachment_browser.php
+++ b/attachment_browser.php
@@ -3,7 +3,7 @@
* attachment_browser
*
* @author spider <spider@steelsun.com>
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
* @package liberty
* @subpackage functions
*/
@@ -11,19 +11,22 @@
/**
* bit setup
*/
-include_once("../bit_setup_inc.php");
+require_once("../bit_setup_inc.php");
-$userAttachments = $gBitUser->getUserAttachments();
-$gBitSmarty->assign('userAttachments', $userAttachments);
-if (empty($gBitSystem->mStyles['styleSheet'])) {
- $gBitSystem->mStyles['styleSheet'] = $gBitSystem->getStyleCss();
-}
-$gBitSystem->mStyles['browserStyleSheet'] = $gBitSystem->getBrowserStyleCss();
-$gBitSystem->mStyles['customStyleSheet'] = $gBitSystem->getCustomStyleCss();
-if( !defined( 'THEMES_STYLE_URL' ) ) {
- define( 'THEMES_STYLE_URL', $gBitSystem->getStyleUrl() );
-}
+global $gBitSmarty, $gContent, $gBitUser, $gBitSystem, $gLibertySystem;
+$listHash = $_REQUEST;
+$listHash = array(
+ 'page' => !empty( $_REQUEST['pgnPage'] ) ? $_REQUEST['pgnPage'] : NULL
+);
+$userAttachments = $gBitUser->getUserAttachments( $listHash );
+$gBitSmarty->assign( 'userAttachments', $userAttachments );
-//vd($userAttachments);
-$gBitSmarty->display('bitpackage:liberty/attachment_browser.tpl');
+// pagination
+$offset = !empty( $_REQUEST['offset'] ) ? $_REQUEST['offset'] : 0;
+$gBitSmarty->assign( 'curPage', $pgnPage = !empty( $_REQUEST['pgnPage'] ) ? $_REQUEST['pgnPage'] : 1 );
+$offset = ( $pgnPage - 1 ) * $gBitSystem->mPrefs['maxRecords'];
+
+// calculate page number
+$numPages = ceil( $userAttachments['cant'] / $gBitSystem->mPrefs['maxRecords'] );
+$gBitSmarty->assign( 'numPages', $numPages );
?>
diff --git a/comments_inc.php b/comments_inc.php
index 7e3b06b..42d94dd 100644
--- a/comments_inc.php
+++ b/comments_inc.php
@@ -3,12 +3,12 @@
* comment_inc
*
* @author spider <spider@steelsun.com>
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
* @package liberty
* @subpackage functions
*/
-// $Header: /cvsroot/bitweaver/_bit_liberty/comments_inc.php,v 1.5 2005/08/07 17:40:29 squareing Exp $
+// $Header: /cvsroot/bitweaver/_bit_liberty/comments_inc.php,v 1.6 2005/11/22 07:27:18 squareing Exp $
// 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.
@@ -98,7 +98,15 @@ if (!empty($_REQUEST['post_comment_reply_id'])) {
$post_comment_reply_id = $_REQUEST['post_comment_reply_id'];
$tmpComment = new LibertyComment(NULL, $post_comment_reply_id);
//$postComment['data'] = $commentsLib->quoteComment($tmpComment->mInfo['data']); // This is super-ugly, better to just not quote at all, the indented comment indicates what comment it is replying to
- $postComment['title'] = tra('Re:')." ".$tmpComment->mInfo['title'];
+
+ if (preg_match('/^' . tra('Re:') . '/', $tmpComment->mInfo['title'])) {
+ $comment_prefix = '';
+ }
+ else {
+ $comment_prefix = tra('Re:') . " ";
+ }
+ $postComment['title'] = $comment_prefix . $tmpComment->mInfo['title'];
+
$gBitSmarty->assign('post_comment_reply_id', $post_comment_reply_id);
}
diff --git a/edit_storage_inc.php b/edit_storage_inc.php
index 22e8ffe..c9d3011 100644
--- a/edit_storage_inc.php
+++ b/edit_storage_inc.php
@@ -3,7 +3,7 @@
* edit_storage_inc
*
* @author spider <spider@steelsun.com>
- * @version $Revision: 1.6 $
+ * @version $Revision: 1.7 $
* @package liberty
* @subpackage functions
*
@@ -12,46 +12,42 @@
*
* Calculate a base URL for the attachment deletion/removal icons to use
*/
-global $gBitSmarty, $gContent, $gBitUser, $gLibertySystem;
+global $gBitSmarty, $gContent, $gBitUser, $gBitSystem, $gLibertySystem;
$attachmentActionBaseURL = $_SERVER['PHP_SELF'].'?';
$GETArgs = split('&',$_SERVER['QUERY_STRING']);
-
-$userAttachments = $gBitUser->getUserAttachments();
-$gBitSmarty->assign('userAttachments', $userAttachments);
-
$firstArg = TRUE;
-foreach ($GETArgs as $arg) {
+
+foreach( $GETArgs as $arg ) {
$parts = split('=',$arg);
- if ( ($parts[0] != 'deleteAttachment') && $parts[0] != 'detachAttachment' ) {
- if (!$firstArg)
+ if( ( $parts[0] != 'deleteAttachment' ) && $parts[0] != 'detachAttachment' ) {
+ if( !$firstArg )
$attachmentActionBaseURL .= "&amp;";
else
$firstArg = FALSE;
$attachmentActionBaseURL .= $arg;
}
}
-$gBitSmarty->assign('attachmentActionBaseURL', $attachmentActionBaseURL);
+$gBitSmarty->assign( 'attachmentActionBaseURL', $attachmentActionBaseURL );
-if (!empty($_REQUEST['deleteAttachment'])) {
+if( !empty( $_REQUEST['deleteAttachment'] ) ) {
$attachmentId = $_REQUEST['deleteAttachment'];
- $siblingAttachments = $gContent->getSiblingAttachments($attachmentId);
- $attachmentInfo = $gContent->getAttachment($attachmentId);
+ $siblingAttachments = $gContent->getSiblingAttachments( $attachmentId );
+ $attachmentInfo = $gContent->getAttachment( $attachmentId );
- if (count($siblingAttachments) > 0 || (!$gBitUser->isAdmin() && $gBitUser->mUserId != $attachmentInfo['user_id'] && $gBitUser->mPerms['bit_p_detach_attachment'] == 'y')) {
+ if( count( $siblingAttachments ) > 0 || ( !$gBitUser->isAdmin() && $gBitUser->mUserId != $attachmentInfo['user_id'] && $gBitUser->mPerms['bit_p_detach_attachment'] == 'y' ) ) {
// Other tiki_attachment rows reference the same foreign_id so we should just detach
- $gContent->detachAttachment($attachmentId);
+ $gContent->detachAttachment( $attachmentId );
} else {
- $gContent->expungeAttachment($attachmentId);
+ $gContent->expungeAttachment( $attachmentId );
}
-} elseif (!empty($_REQUEST['detachAttachment'])) {
+} elseif( !empty( $_REQUEST['detachAttachment'] ) ) {
$attachmentId = $_REQUEST['detachAttachment'];
- $attachmentInfo = $gContent->getAttachment($attachmentId);
+ $attachmentInfo = $gContent->getAttachment( $attachmentId );
- if ($gBitUser->isAdmin() || $gBitUser->mPerms['bit_p_detach_attachment'] == 'y' || $attachmentInfo['user_id'] == $gBitUser->mUserId) {
- $gContent->detachAttachment($attachmentId);
+ if( $gBitUser->isAdmin() || $gBitUser->mPerms['bit_p_detach_attachment'] == 'y' || $attachmentInfo['user_id'] == $gBitUser->mUserId ) {
+ $gContent->detachAttachment( $attachmentId );
}
}
-$gBitSmarty->assign_by_ref('gLibertySystem', $gLibertySystem);
-
+$gBitSmarty->assign_by_ref( 'gLibertySystem', $gLibertySystem );
?>
diff --git a/icons/busy.gif b/icons/busy.gif
new file mode 100644
index 0000000..b7b700e
--- /dev/null
+++ b/icons/busy.gif
Binary files differ
diff --git a/icons/generating_thumbnails.png b/icons/generating_thumbnails.png
new file mode 100644
index 0000000..7fbb59d
--- /dev/null
+++ b/icons/generating_thumbnails.png
Binary files differ
diff --git a/modules/mod_last_changes.php b/modules/mod_last_changes.php
index c24074a..7ae80f6 100644
--- a/modules/mod_last_changes.php
+++ b/modules/mod_last_changes.php
@@ -1,14 +1,16 @@
<?php
-// $Header: /cvsroot/bitweaver/_bit_liberty/modules/mod_last_changes.php,v 1.6 2005/08/24 20:55:17 squareing Exp $
/**
+ * @version $Header: /cvsroot/bitweaver/_bit_liberty/modules/mod_last_changes.php,v 1.7 2005/11/22 07:27:18 squareing Exp $
+ * @package liberty
+ * @subpackage modules
* Params:
* - content_type_guid : if set, show only those content_type_guid's
* - show_date : if set, show date of last modification
- * @package liberty
- * @subpackage modules
*/
-
+/**
+ * Initialization
+ */
global $gQueryUser, $gBitUser, $module_rows, $module_params, $gLibertySystem, $module_title;
diff --git a/plugins/data.addtabs.php b/plugins/data.addtabs.php
index 889daa0..53119d5 100644
--- a/plugins/data.addtabs.php
+++ b/plugins/data.addtabs.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
* @package liberty
* @subpackage plugins_data
*/
@@ -15,7 +15,7 @@
// +----------------------------------------------------------------------+
// | Author: StarRider <starrrider@users.sourceforge.net>
// +----------------------------------------------------------------------+
-// $Id: data.addtabs.php,v 1.5 2005/08/24 20:55:17 squareing Exp $
+// $Id: data.addtabs.php,v 1.6 2005/11/22 07:27:18 squareing Exp $
/**
* definitions
@@ -62,7 +62,7 @@ function data_addtabs_help() {
}
function data_addtabs($data, $params) {
- extract ($params);
+ extract ($params, EXTR_SKIP);
$ret = '<div class="tabpane">';
for ($i = 1; $i <= 99; $i++) {
if( isset( ${'tab'.$i} ) && is_numeric( ${'tab'.$i} ) ) {
diff --git a/plugins/data.agentinfo.php b/plugins/data.agentinfo.php
index 9071162..3b44bea 100644
--- a/plugins/data.agentinfo.php
+++ b/plugins/data.agentinfo.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
* @package liberty
* @subpackage plugins_data
*/
@@ -17,7 +17,7 @@
// | Reworked for Bitweaver (& Undoubtedly Screwed-Up)
// | by: StarRider <starrrider@users.sourceforge.net>
// +----------------------------------------------------------------------+
-// $Id: data.agentinfo.php,v 1.5 2005/08/24 20:55:17 squareing Exp $
+// $Id: data.agentinfo.php,v 1.6 2005/11/22 07:27:18 squareing Exp $
/**
* definitions
@@ -65,7 +65,7 @@ function data_agentinfo_help() {
// Load Function
function data_agentinfo($data, $params) {
$info = 'IP';
- extract ($params);
+ extract ($params, EXTR_SKIP);
switch (strtoupper ($info)) {
case 'SVRSW': // To maintain Pre-Clyde Parameters
case 'SERVER':
diff --git a/plugins/data.article.php b/plugins/data.article.php
index ef5ec6c..e0b2b7c 100644
--- a/plugins/data.article.php
+++ b/plugins/data.article.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
* @package liberty
* @subpackage plugins_data
*/
@@ -18,7 +18,7 @@
// | by: StarRider <starrrider@users.sourceforge.net>
// | Reworked from: wikiplugin_article.php - see deprecated code below
// +----------------------------------------------------------------------+
-// $Id: data.article.php,v 1.4 2005/08/07 17:40:31 squareing Exp $
+// $Id: data.article.php,v 1.5 2005/11/22 07:27:18 squareing Exp $
/**
* definitions
@@ -85,7 +85,7 @@ if( $gBitSystem->isPackageActive( 'articles' ) ) {
function wikiplugin_article($data, $params) {
global $artlib;
- extract ($params);
+ extract ($params, EXTR_SKIP);
if (!isset($id)) {
return ("<b>The plugin Article needs an article ID to function.</b><br/>");
}
diff --git a/plugins/data.avatar.php b/plugins/data.avatar.php
index bfc8ea3..460ee91 100644
--- a/plugins/data.avatar.php
+++ b/plugins/data.avatar.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
* @package liberty
* @subpackage plugins_data
*/
@@ -18,7 +18,7 @@
// | by: StarRider <starrrider@users.sourceforge.net>
// | Reworked from: wikiplugin_avatar.php - see deprecated code below
// +----------------------------------------------------------------------+
-// $Id: data.avatar.php,v 1.4 2005/08/07 17:40:31 squareing Exp $
+// $Id: data.avatar.php,v 1.5 2005/11/22 07:27:18 squareing Exp $
/**
* definitions
@@ -90,7 +90,7 @@ require_once( KERNEL_PKG_PATH.'BitBase.php' );
function wikiplugin_avatar($data, $params) {
global $gBitSystem;
global $gBitUser;
- extract ($params);
+ extract ($params, EXTR_SKIP);
if (isset($float))
$avatar = $gBitSystem->get_user_avatar($data, $float);
else
diff --git a/plugins/data.backlinks.php b/plugins/data.backlinks.php
index 1a09e8c..5073138 100644
--- a/plugins/data.backlinks.php
+++ b/plugins/data.backlinks.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
* @package liberty
* @subpackage plugins_data
*/
@@ -18,7 +18,7 @@
// | by: StarRider <starrrider@users.sourceforge.net>
// | Reworked from: wikiplugin_backlinks.php - see deprecated code below
// +----------------------------------------------------------------------+
-// $Id: data.backlinks.php,v 1.4 2005/08/07 17:40:31 squareing Exp $
+// $Id: data.backlinks.php,v 1.5 2005/11/22 07:27:18 squareing Exp $
/**
* definitions
@@ -89,7 +89,7 @@ function data_backlinks($data, $params) { // Pre-Clyde Changes
// Renamed Parameters $include_self to $self & $noheader to $header
// Changed $header so that any value passed to it makes it True
// Added testing to Maintain Pre-Clyde compatability
- extract ($params);
+ extract ($params, EXTR_SKIP);
if (isset ($include_self) && ($include_self) ) // Maintain Pre-Clyde compatability
$self = TRUE;
$self = isset($self) ? TRUE : FALSE; // Any value passed in this parameter makes it True
@@ -111,7 +111,7 @@ The code below is from the deprecated BACKLINKS plugin. All comments and the hel
global $wikilib;
$params = $this->getParams($params, true);
$aInfoPreset = array_keys($this->aInfoPresetNames);
- extract ($params);
+ extract ($params, EXTR_SKIP);
/////////////////////////////////
// Create a valid list for $info
/////////////////////////////////
diff --git a/plugins/data.category.php b/plugins/data.category.php
index e0c1101..1c4325f 100644
--- a/plugins/data.category.php
+++ b/plugins/data.category.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
* @package liberty
* @subpackage plugins_data
*/
@@ -18,7 +18,7 @@
// | by: StarRider <starrrider@users.sourceforge.net>
// | Reworked from: wikiplugin_category.php - see deprecated code below
// +----------------------------------------------------------------------+
-// $Id: data.category.php,v 1.5 2005/08/07 17:40:31 squareing Exp $
+// $Id: data.category.php,v 1.6 2005/11/22 07:27:18 squareing Exp $
/**
* definitions
@@ -120,7 +120,7 @@ function wikiplugin_category($data, $params) {
if ($package_categories != 'y') {
return "<span class='warn'>" . tra("Categories are disabled"). "</span>";
}
- extract ($params);
+ extract ($params, EXTR_SKIP);
// array for converting long type names (as in database) to short names (as used in plugin)
$typetokens = array(
"article" => "article",
diff --git a/plugins/data.catorphans.php b/plugins/data.catorphans.php
index d200549..8a8a22c 100644
--- a/plugins/data.catorphans.php
+++ b/plugins/data.catorphans.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
* @package liberty
* @subpackage plugins_data
*/
@@ -18,7 +18,7 @@
// | by: StarRider <starrrider@users.sourceforge.net>
// | Reworked from: wikiplugin_catorphans.php - see deprecated code below
// +----------------------------------------------------------------------+
-// $Id: data.catorphans.php,v 1.5 2005/08/07 17:40:31 squareing Exp $
+// $Id: data.catorphans.php,v 1.6 2005/11/22 07:27:18 squareing Exp $
/**
* definitions
@@ -88,7 +88,7 @@ function wikiplugin_catorphans($data, $params) {
if ($package_categories != 'y') {
return "<span class='warn'>" . tra("Categories are disabled"). "</span>";
}
- extract ($params);
+ extract ($params, EXTR_SKIP);
// array for converting long type names (as in database) to short names (as used in plugin)
$typetokens = array(
"article" => "article",
diff --git a/plugins/data.catpath.php b/plugins/data.catpath.php
index af4fbfb..f1998b0 100644
--- a/plugins/data.catpath.php
+++ b/plugins/data.catpath.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
* @package liberty
* @subpackage plugins_data
*/
@@ -18,7 +18,7 @@
// | by: StarRider <starrrider@users.sourceforge.net>
// | Reworked from: wikiplugin_catpath.php - see deprecated code below
// +----------------------------------------------------------------------+
-// $Id: data.catpath.php,v 1.5 2005/08/07 17:40:31 squareing Exp $
+// $Id: data.catpath.php,v 1.6 2005/11/22 07:27:18 squareing Exp $
/**
* definitions
@@ -89,7 +89,7 @@ function wikiplugin_catpath($data, $params) {
if ($package_categories != 'y') {
return "<span class='warn'>" . tra("Categories are disabled"). "</span>";
}
- extract ($params);
+ extract ($params, EXTR_SKIP);
// default divider is '>'
if (!(isset($divider))) {
$divider = '>';
diff --git a/plugins/data.code.php b/plugins/data.code.php
index 665e041..75cb53b 100644
--- a/plugins/data.code.php
+++ b/plugins/data.code.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.6 $
+ * @version $Revision: 1.7 $
* @package liberty
* @subpackage plugins_data
*/
@@ -17,7 +17,7 @@
// | Reworked for Bitweaver (& Undoubtedly Screwed-Up)
// | by: StarRider <starrrider@users.sourceforge.net>
// +----------------------------------------------------------------------+
-// $Id: data.code.php,v 1.6 2005/10/29 17:54:23 squareing Exp $
+// $Id: data.code.php,v 1.7 2005/11/22 07:27:18 squareing Exp $
/**
* definitions
@@ -91,7 +91,7 @@ function data_code( $data, $params ) { // Pre-Clyde Changes
// Added testing to maintain Pre-Clyde compatability
// $num = NULL;
$add_tags = false;
- extract ($params);
+ extract ($params, EXTR_SKIP);
// This maintains Pre-Clyde Parameters
if (isset($colors) and ($colors == 'php') ) $source = 'php';
if (isset($in) ) $source = $in;
diff --git a/plugins/data.copyright.php b/plugins/data.copyright.php
index 809ed13..f903d9e 100644
--- a/plugins/data.copyright.php
+++ b/plugins/data.copyright.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
* @package liberty
* @subpackage plugins_data
*/
@@ -17,7 +17,7 @@
// | Reworked for Bitweaver (& Undoubtedly Screwed-Up)
// | by: StarRider <starrrider@users.sourceforge.net>
// +----------------------------------------------------------------------+
-// $Id: data.copyright.php,v 1.3 2005/08/07 17:40:31 squareing Exp $
+// $Id: data.copyright.php,v 1.4 2005/11/22 07:27:18 squareing Exp $
/**
* definitions
@@ -79,7 +79,7 @@ function data_copyright($data, $params) { // Pre-Clyde Changes
// The next 2 lines allow access to the $pluginParams given above and may be removed when no longer needed
global $gLibertySystem;
$pluginParams = $gLibertySystem->mPlugins[PLUGIN_GUID_DATACOPYRIGHT];
- extract ($params);
+ extract ($params, EXTR_SKIP);
// This maintains Pre-Clyde Parameters
if ( !empty( $data) ) { // The problem with this is that $authors HAS to be the last key-word
$pos1 = strpos( strtolower($data), '~title~') + 7;
diff --git a/plugins/data.countdown.php b/plugins/data.countdown.php
index 5f15782..c17d172 100644
--- a/plugins/data.countdown.php
+++ b/plugins/data.countdown.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
* @package liberty
* @subpackage plugins_data
*/
@@ -17,7 +17,7 @@
// | Reworked for Bitweaver (& Undoubtedly Screwed-Up)
// | by: StarRider <starrrider@users.sourceforge.net>
// +----------------------------------------------------------------------+
-// $Id: data.countdown.php,v 1.4 2005/08/07 17:40:31 squareing Exp $
+// $Id: data.countdown.php,v 1.5 2005/11/22 07:27:18 squareing Exp $
/**
* definitions
@@ -68,7 +68,7 @@ function data_countdown($data, $params) {
// The next 2 lines allow access to the $pluginParams given above
global $gLibertySystem;
$pluginParams = $gLibertySystem->mPlugins[PLUGIN_GUID_DATACOUNTDOWN];
- extract ($params);
+ extract ($params, EXTR_SKIP);
if (!isset($enddate) ) { // The Manditory Parameter is missing
$ret = tra("The required parameter ") . "<strong>enddate</strong>" . tra(" was missing from the plugin ") . '<strong>"' . $pluginParams['tag'] . '"</strong>';
$ret.= data_countdown_help();
diff --git a/plugins/data.dropdown.php b/plugins/data.dropdown.php
index b04e6c6..2e43da7 100644
--- a/plugins/data.dropdown.php
+++ b/plugins/data.dropdown.php
@@ -4,7 +4,7 @@
* assigned_modules
*
* @author StarRider <starrrider@sourceforge.net>
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
* @package liberty
* @subpackage plugins_data
*
@@ -63,7 +63,7 @@ function data_dropdown_help() {
* Load Function
*/
function data_dropdown($data, $params) {
- extract ($params);
+ extract ($params, EXTR_SKIP);
$title = (isset($title)) ? $title : 'For More Information';
$width = (isset($width)) ? $width : '20';
$width = ((100 - $width) / 2) . '%';
diff --git a/plugins/data.example.php b/plugins/data.example.php
index ba36530..3b5c54a 100644
--- a/plugins/data.example.php
+++ b/plugins/data.example.php
@@ -4,7 +4,7 @@
* assigned_modules
*
* @author StarRider starrrider@sourceforge.net
- * @version $Revision: 1.8 $
+ * @version $Revision: 1.9 $
* @package liberty
* @subpackage plugins_data
* @copyright Copyright (c) 2004, bitweaver.org
@@ -63,7 +63,7 @@ function data_example_help() {
* Load Function *
****************/
function data_example($data, $params) {
- extract ($params);
+ extract ($params, EXTR_SKIP);
$ret = ' ';
return $ret;
diff --git a/plugins/data.flash.php b/plugins/data.flash.php
index 652d9f2..f7ab0c8 100644
--- a/plugins/data.flash.php
+++ b/plugins/data.flash.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
* @package liberty
* @subpackage plugins_data
*/
@@ -17,7 +17,7 @@
// | Reworked for Bitweaver (& Undoubtedly Screwed-Up)
// | by: StarRider <starrrider@users.sourceforge.net>
// +----------------------------------------------------------------------+
-// $Id: data.flash.php,v 1.4 2005/08/24 20:55:17 squareing Exp $
+// $Id: data.flash.php,v 1.5 2005/11/22 07:27:18 squareing Exp $
/**
* definitions
@@ -79,7 +79,7 @@ function data_flash_help() {
// Load Function
function data_flash($data, $params) {
- extract ($params);
+ extract ($params, EXTR_SKIP);
$w = (isset($width)) ? $width : "";
$h = (isset($height)) ? $height : "";
$q = (isset($quality)) ? $quality : "high";
diff --git a/plugins/data.gauge.php b/plugins/data.gauge.php
index f3f57a5..cdaf1e4 100644
--- a/plugins/data.gauge.php
+++ b/plugins/data.gauge.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.8 $
* @package liberty
* @subpackage plugins_data
*/
@@ -17,7 +17,7 @@
// | Reworked for Bitweaver (& Undoubtedly Screwed-Up)
// | by: StarRider <starrrider@users.sourceforge.net>
// +----------------------------------------------------------------------+
-// $Id: data.gauge.php,v 1.7 2005/08/24 20:55:17 squareing Exp $
+// $Id: data.gauge.php,v 1.8 2005/11/22 07:27:18 squareing Exp $
/**
* definitions
@@ -98,7 +98,7 @@ function data_gauge_help() {
// Load Function
function data_gauge($data, $params) {
- extract ($params);
+ extract ($params, EXTR_SKIP);
if (!isset($max)) {
$max = 100;
}
diff --git a/plugins/data.lang.php b/plugins/data.lang.php
index 85e5edd..d85af5e 100644
--- a/plugins/data.lang.php
+++ b/plugins/data.lang.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
* @package liberty
* @subpackage plugins_data
*/
@@ -18,7 +18,7 @@
// | by: StarRider <starrrider@users.sourceforge.net>
// | Reworked from: wikiplugin_lang.php - see deprecated code below
// +----------------------------------------------------------------------+
-// $Id: data.lang.php,v 1.3 2005/08/07 17:40:31 squareing Exp $
+// $Id: data.lang.php,v 1.4 2005/11/22 07:27:18 squareing Exp $
/**
* definitions
@@ -53,7 +53,7 @@ function data_lang_help() {
// Load Function
function data_lang($data, $params) {
global $gBitLanguage;
- extract ($params);
+ extract ($params, EXTR_SKIP);
if (!isset($lang) || $lang == $gBitLanguage->mLanguage)
return $data;
else
@@ -64,7 +64,7 @@ The code below is from the deprecated LANG plugin. All comments and the help rou
function wikiplugin_lang($data, $params) {
global $gBitLanguage;
- extract ($params);
+ extract ($params, EXTR_SKIP);
if (!isset($lang) || $lang == $gBitLanguage->mLanguage)
return $data;
else
diff --git a/plugins/data.ledgertable.php b/plugins/data.ledgertable.php
new file mode 100644
index 0000000..ee68af4
--- /dev/null
+++ b/plugins/data.ledgertable.php
@@ -0,0 +1,148 @@
+<?php
+// $Id: data.ledgertable.php,v 1.2 2005/11/22 07:27:18 squareing Exp $
+/**
+ * assigned_modules
+ *
+ * @author KainX <mej@kainx.org>
+ * @version $Revision: 1.2 $
+ * @package liberty
+ * @subpackage plugins_data
+ * @copyright Copyright (c) 2004, bitweaver.org
+ * All Rights Reserved. See copyright.txt for details and a complete list of authors.
+ * @license Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
+ */
+/******************
+ * Initialization *
+ ******************/
+define( 'PLUGIN_GUID_DATALEDGERTABLE', 'dataledgertable' );
+global $gLibertySystem;
+$pluginParams = array ( 'tag' => 'LEDGERTABLE',
+ 'auto_activate' => FALSE,
+ 'requires_pair' => TRUE,
+ 'load_function' => 'data_ledgertable',
+ 'title' => 'Ledger Table (LEDGERTABLE)',
+ 'help_page' => 'DataPluginLedgertable',
+ 'description' => tra("This Plugin creates a ledger-like table with even/odd row colors, optional top- or left-placed headers, and support for row/column spans."),
+ 'help_function' => 'data_ledgertable_help',
+ 'syntax' => "{LEDGERTABLE loc= head= }",
+ 'plugin_type' => DATA_PLUGIN
+);
+$gLibertySystem->registerPlugin( PLUGIN_GUID_DATALEDGERTABLE, $pluginParams );
+$gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATALEDGERTABLE );
+/*****************
+ * Help Function *
+ *****************/
+function data_ledgertable_help() {
+ $help =
+ '<table class="data help">'
+ .'<tr>'
+ .'<th>' . tra( "Key" ) . '</th>'
+ .'<th>' . tra( "Type" ) . '</th>'
+ .'<th>' . tra( "Comments" ) . '</th>'
+ .'</tr>'
+ .'<tr class="odd">'
+ .'<td>loc</td>'
+ .'<td>' . tra( "string") . '<br />' . tra("(optional)") . '</td>'
+ .'<td>' . tra( "Where to display row/column headers (\"left\" or \"top\", default <strong>top</strong>).")
+ .'</td>'
+ .'</tr>'
+ .'<tr class="even">'
+ .'<td>head</td>'
+ .'<td>' . tra( "string") . '<br />' . tra("(optional)") . '</td>'
+ .'<td>' . tra( "Header(s) separated by \"~|~\", default <strong>none</strong>")
+ .'</td>'
+ .'</tr>'
+ .'</table>'
+ . tra("LedgerTable: ") . "{LEDGERTABLE loc=>left head=>Row1~|~Row2~|~Row3}<br />"
+ . tra("This will display")
+ . data_ledgertable('Example', array('loc' => 'left', 'head' => 'Row1~|~Row2~|~Row3'));
+ return $help;
+}
+/****************
+* Load Function *
+ ****************/
+function data_ledgertable($data, $params) {
+ global $gBitSystem;
+
+ if (empty($data)) {
+ return "<!-- Error: No data passed to LEDGERTABLE plugin. -->";
+ }
+ if (substr($data, 0, 1) == "\n") {
+ $data = substr($data, 1);
+ }
+
+ $ret = '';
+ if (isset($params['loc'])) {
+ $ret .= "<!-- Header row set to $params[loc]. -->";
+ $plugdata_loc = $params['loc'];
+ } else {
+ $ret .= "<!-- Defaulting header row to top. -->";
+ $plugdata_loc = 'top';
+ }
+ if (isset($params['head'])) {
+ $ret .= "<!-- Got headers. -->";
+ $plugdata_head = $params['head'];
+ } else {
+ $ret .= "<!-- No headers specified. -->";
+ }
+ if (isset($params['width'])) {
+ $ret .= "<!-- Got width $params[width]. -->";
+ $plugdata_width = " style=\"width: " . $params['width'] . '"';
+ } else {
+ $plugdata_width = "";
+ }
+
+ $ret .= "<table class=\"ledgertable\"$plugdata_width>";
+
+ if (isset($plugdata_head)) {
+ $headers = explode('~|~', $plugdata_head);
+ if ($plugdata_loc == 'top') {
+ $ret .= " <!-- Placing header row on top. -->";
+ $ret .= " <tr class=\"ledgertable header row\">";
+ foreach ($headers as $hdr) {
+ $ret .= " <th class=\"header highlight\">$hdr</td>";
+ }
+ $ret .= " </tr>";
+ }
+ }
+
+ $lines = split("\n", $data);
+ $line_count = 0;
+ foreach ($lines as $line) {
+ $line = trim($line);
+ if (strlen($line) <= 0) {
+ continue;
+ }
+ $line_count++;
+
+ $ret .= " <!-- Displaying row $line_count. -->";
+ $ret .= " <tr class=\"" . (($line_count % 2) ? ("odd") : ("even")) . "\">";
+ if (isset($plugdata_head) && ($plugdata_loc == "left")) {
+ $ret .= " <!-- Placing header on left. -->";
+ $ret .= " <th class=\"header highlight\"";
+ $header = array_shift($headers);
+ if (preg_match("/^~(row|col)span:(\d+)~(.*)$/", $header, $matches)) {
+ $ret .= " $matches[1]span=\"$matches[2]\"";
+ $header = $matches[3];
+ }
+ $ret .= ">$header</td>";
+ }
+ $cells = explode("~|~", $line);
+ foreach ($cells as $col) {
+ $ret .= " <td class=\"" . (($line_count % 2) ? ("odd") : ("even")) . "\"";
+ $col = trim($col);
+ if (!strcmp($col, "~blank~")) {
+ $col = "&nbsp;";
+ } else if (preg_match("/^~(row|col)span:(\d+)~(.*)$/", $col, $matches)) {
+ $ret .= " $matches[1]span=\"$matches[2]\"";
+ $col = $matches[3];
+ }
+ $ret .= ">$col</td>";
+ }
+ $ret .= " </tr>";
+ }
+ $ret .= "</table>";
+
+ return $ret;
+}
+?>
diff --git a/plugins/data.maketoc.php b/plugins/data.maketoc.php
index 45baabd..58760e3 100644
--- a/plugins/data.maketoc.php
+++ b/plugins/data.maketoc.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
* @package liberty
* @subpackage plugins_data
*/
@@ -15,7 +15,7 @@
// +----------------------------------------------------------------------+
// | Author: xing <xing@synapse.plus.com>
// +----------------------------------------------------------------------+
-// $Id: data.maketoc.php,v 1.4 2005/08/07 17:40:31 squareing Exp $
+// $Id: data.maketoc.php,v 1.5 2005/11/22 07:27:18 squareing Exp $
/**
* definitions
@@ -80,7 +80,7 @@ function data_maketoc( $data ) {
// remove any html tags from the output text and generate link ids
foreach( $headers[2] as $output ) {
$outputs[] = preg_replace( "/<.*?>/", "", $output );
- $anchor = preg_replace( "/[^\w|\d]*/", "", $output );
+ $anchor = preg_replace( "/<.*?>|[^\w|\d]*/", "", $output );
$anchors[] = !empty( $anchor) ? $anchor : 'id'.microtime() * 1000000;
}
@@ -115,7 +115,7 @@ function data_maketoc( $data ) {
}
function maketoc_create_list( $pTocHash, $pParams ) {
- extract( $pTocHash );
+ extract( $pTocHash , EXTR_SKIP);
// previous level
$prev = 0;
diff --git a/plugins/data.mapquest.php b/plugins/data.mapquest.php
index da8f7a9..418704c 100644
--- a/plugins/data.mapquest.php
+++ b/plugins/data.mapquest.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
* @package liberty
* @subpackage plugins_data
*/
@@ -15,7 +15,7 @@
// +----------------------------------------------------------------------+
// | Author: StarRider <starrrider@users.sourceforge.net>
// +----------------------------------------------------------------------+
-// $Id: data.mapquest.php,v 1.5 2005/08/24 20:55:17 squareing Exp $
+// $Id: data.mapquest.php,v 1.6 2005/11/22 07:27:18 squareing Exp $
/**
* definitions
@@ -126,7 +126,7 @@ function data_mapquest_help() {
// Load Function
function data_mapquest( $data, $params ) {
- extract ($params);
+ extract ($params, EXTR_SKIP);
$ret = '<a href="http://www.mapquest.com" title="Launch Map Quest in a New Window" onkeypress="popUpWin(this.href,\'standard\',800,800);" onclick="popUpWin(this.href,\'standard\',800,800);return false;">';
diff --git a/plugins/data.module.php b/plugins/data.module.php
index a760fd5..4428f9f 100644
--- a/plugins/data.module.php
+++ b/plugins/data.module.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
* @package liberty
* @subpackage plugins_data
*/
@@ -16,7 +16,7 @@
// | Author (TikiWiki): Mose <mose@users.sourceforge.net>
// | Reworked for Bitweaver by: Christian Fowler <spiderr@users.sourceforge.net>
// +----------------------------------------------------------------------+
-// $Id: data.module.php,v 1.5 2005/10/23 14:40:49 squareing Exp $
+// $Id: data.module.php,v 1.6 2005/11/22 07:27:18 squareing Exp $
/**
* definitions
@@ -56,6 +56,11 @@ function datamodule_help() {
.'<td>' . tra( "string" ) . '<br />' . tra( "(required)" ) . '</td>'
.'<td>' . tra( "Package the module is part of.")
.'</tr>'
+ .'<tr class="even">'
+ .'<td>rows</td>'
+ .'<td>' . tra( "numeric" ) . '<br />' . tra( "(optional)" ) . '</td>'
+ .'<td>' . tra( "Number of rows you wish to show.")
+ .'</tr>'
.'<tr class="odd">'
.'<td colspan="3">' . tra( "Additional arguments and values depend on the selected module." )
.'</tr>'
@@ -69,10 +74,12 @@ function data_datamodule( $data, $params ) {
require_once( KERNEL_PKG_PATH.'mod_lib.php' );
$out = '';
- extract( $params );
+ extract( $params , EXTR_SKIP);
if( !empty( $module ) && !empty( $package ) ) {
// not sure if we can use the php file, since it sets everything to NULL when passed in - xing
+ global $module_rows;
+ $module_rows = !empty( $rows ) ? $rows : 10;
$php = constant( strtoupper( $package ).'_PKG_PATH' ).'modules/mod_'.$module.'.php';
// TODO: assigning variables to template doesn't work since they are replaced by module paramaters set in the php file - even when it's not in use! - xing
$tpl = 'bitpackage:'.$package.'/mod_'.$module.'.tpl';
@@ -89,6 +96,7 @@ function data_datamodule( $data, $params ) {
}
}
$out = eregi_replace( "\n", "", $out );
+ //vd($out);
// deal with custom styling
$style = '';
@@ -132,7 +140,7 @@ function data_datamodule($data, $params) {
$feature_tasks, $feature_user_bookmarks, $bit_p_tasks, $bit_p_create_bookmarks, $imagegallib;
require_once( KERNEL_PKG_PATH.'mod_lib.php' );
$out = '';
- extract ($params);
+ extract ($params, EXTR_SKIP);
if (!isset($align)) {
$align = 'left';
}
diff --git a/plugins/data.mqdirections.php b/plugins/data.mqdirections.php
index 6bb384b..ac0e393 100644
--- a/plugins/data.mqdirections.php
+++ b/plugins/data.mqdirections.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
* @package liberty
* @subpackage plugins_data
*/
@@ -15,7 +15,7 @@
// +----------------------------------------------------------------------+
// | Author: StarRider <starrrider@users.sourceforge.net>
// +----------------------------------------------------------------------+
-// $Id: data.mqdirections.php,v 1.5 2005/08/24 20:55:17 squareing Exp $
+// $Id: data.mqdirections.php,v 1.6 2005/11/22 07:27:18 squareing Exp $
/**
* definitions
@@ -94,7 +94,7 @@ function data_mqdir_help() {
// Load Function
function data_mqdir( $data, $params ) {
- extract ($params);
+ extract ($params, EXTR_SKIP);
$a2a = isset($address) ? $address : ' ';
$a2c = isset($city) ? $city : ' ';
diff --git a/plugins/data.pluginhelp.php b/plugins/data.pluginhelp.php
index 486e818..9f4ee6e 100644
--- a/plugins/data.pluginhelp.php
+++ b/plugins/data.pluginhelp.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
* @package liberty
* @subpackage plugins_data
*/
@@ -17,7 +17,7 @@
// | Rewritten for bitweaver by Author
// | wikiplugin_pluginhelp.php - see deprecated code below
// +----------------------------------------------------------------------+
-// $Id: data.pluginhelp.php,v 1.4 2005/08/07 17:40:31 squareing Exp $
+// $Id: data.pluginhelp.php,v 1.5 2005/11/22 07:27:18 squareing Exp $
/**
* definitions
@@ -58,7 +58,7 @@ The code below is from the deprecated PLUGINHELP plugin. All comments and the he
include_once( WIKI_PKG_PATH.'BitPage.php');
function wikiplugin_pluginhelp($data, $params) {
global $wikilib;
- extract ($params);
+ extract ($params, EXTR_SKIP);
if (!isset($plugin)) {
return tra("The plugin <b>PluginHelp</b> needs the name of a plugin to function. Please seek Help.<br/>");
}
diff --git a/plugins/data.sf.php b/plugins/data.sf.php
index c52ef3b..e3b667a 100644
--- a/plugins/data.sf.php
+++ b/plugins/data.sf.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.6 $
+ * @version $Revision: 1.7 $
* @package liberty
* @subpackage plugins_data
*/
@@ -17,7 +17,7 @@
// | Reworked & Undoubtedly Screwed-Up for (Bitweaver)
// | by: StarRider <starrrider@sourceforge.net>
// +----------------------------------------------------------------------+
-// $Id: data.sf.php,v 1.6 2005/08/24 20:55:17 squareing Exp $
+// $Id: data.sf.php,v 1.7 2005/11/22 07:27:18 squareing Exp $
/**
* definitions
@@ -104,7 +104,7 @@ function data_sf($data, $params) {
// JGraph ******************************************************
$sftags['pbbrfe'] = array('7885','58021','PhpBB',' Bug #',' Bug Index');
- extract ($params);
+ extract ($params, EXTR_SKIP);
$tag = (isset($tag)) ? strtolower($tag) : ' '; // Just to be sure no caps
if (isset($sftags["$tag"]) and (is_array($sftags["$tag"])) ) { // is $tag in the array
list($groupid,$atid,$proj,$tag1,$tag2) = $sftags["$tag"];
diff --git a/plugins/data.sort.php b/plugins/data.sort.php
index bf46993..5fbab75 100644
--- a/plugins/data.sort.php
+++ b/plugins/data.sort.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
* @package liberty
* @subpackage plugins_data
*/
@@ -17,7 +17,7 @@
// | Reworked & Undoubtedly Screwed-Up for (Bitweaver)
// | by: StarRider <starrrider@sourceforge.net>
// +----------------------------------------------------------------------+
-// $Id: data.sort.php,v 1.4 2005/08/07 17:40:31 squareing Exp $
+// $Id: data.sort.php,v 1.5 2005/11/22 07:27:18 squareing Exp $
/**
* definitions
@@ -54,7 +54,7 @@ function data_sort_help() {
* Load Function
*/
function data_sort($data, $params) {
- extract ($params);
+ extract ($params, EXTR_SKIP);
$sort = (isset($sort)) ? $sort : "asc";
$lines = explode("\n", $data); // separate lines into array
// $lines = array_filter( $lines, "chop" ); // remove \n
diff --git a/plugins/data.split.php b/plugins/data.split.php
index 8567431..66cb3d5 100644
--- a/plugins/data.split.php
+++ b/plugins/data.split.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
* @package liberty
* @subpackage plugins_data
*/
@@ -18,7 +18,7 @@
// | by: StarRider <starrrider@users.sourceforge.net>
// | Reworked from: wikiplugin_split.php - see deprecated code below
// +----------------------------------------------------------------------+
-// $Id: data.split.php,v 1.4 2005/08/07 17:40:31 squareing Exp $
+// $Id: data.split.php,v 1.5 2005/11/22 07:27:18 squareing Exp $
/**
* definitions
@@ -64,7 +64,7 @@ function wikiplugin_split($data, $params) {
// Remove first <ENTER> if exists...
// it may be here if present after {SPLIT()} in original text
if (substr($data, 0, 1) == "\n") $data = substr($data, 1);
- extract ($params);
+ extract ($params, EXTR_SKIP);
$fixedsize = (!isset($fixedsize) ? true : false);
$joincols = (!isset($joincols) ? true : false);
// Split data by rows and cells
diff --git a/plugins/data.spytext.php b/plugins/data.spytext.php
index e46c1dd..fdf6f46 100644
--- a/plugins/data.spytext.php
+++ b/plugins/data.spytext.php
@@ -4,7 +4,7 @@
* assigned_modules
*
* @author StarRider starrrider@sourceforge.net
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
* @package liberty
* @subpackage plugins_data
* @copyright Copyright (c) 2004, bitweaver.org
@@ -153,7 +153,7 @@ function data_spytext_help() {
function data_spytext($data, $params) {
global $gLibertySystem;
global $gBitUser;
- extract ($params);
+ extract ($params, EXTR_SKIP);
if (empty($data)) { // If there is NO data to display - why do anything - get out of here
return " ";
diff --git a/plugins/data.titlesearch.php b/plugins/data.titlesearch.php
index 06170d5..35e8281 100644
--- a/plugins/data.titlesearch.php
+++ b/plugins/data.titlesearch.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
* @package liberty
* @subpackage plugins_data
*/
@@ -18,7 +18,7 @@
// | by: StarRider <starrrider@users.sourceforge.net>
// | Reworked from: wikiplugin_titlesearch.php - see deprecated code below
// +----------------------------------------------------------------------+
-// $Id: data.titlesearch.php,v 1.4 2005/08/07 17:40:31 squareing Exp $
+// $Id: data.titlesearch.php,v 1.5 2005/11/22 07:27:18 squareing Exp $
/**
* definitions
@@ -65,7 +65,7 @@ The code below is from the deprecated TITLESEARCH plugin. All comments and the h
global $WikiLib;
$aInfoPreset = array_keys($this->aInfoPresetNames);
$params = $this->getParams($params, true);
- extract ($params);
+ extract ($params, EXTR_SKIP);
if (!$search) {
return $this->error("You have to define a search");
}
diff --git a/plugins/data.translated.php b/plugins/data.translated.php
index 57897fd..b7533b1 100644
--- a/plugins/data.translated.php
+++ b/plugins/data.translated.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
* @package liberty
* @subpackage plugins_data
*/
@@ -18,7 +18,7 @@
// | by: StarRider <starrrider@sourceforge.net>
// | Reworked from: wikiplugin_translated.php - see deprecated code below
// +----------------------------------------------------------------------+
-// $Id: data.translated.php,v 1.4 2005/08/07 17:40:31 squareing Exp $
+// $Id: data.translated.php,v 1.5 2005/11/22 07:27:18 squareing Exp $
/**
* definitions
@@ -55,7 +55,7 @@ function data_translated_help() {
// Load Function
function data_translated($data, $params) {
- extract ($params);
+ extract ($params, EXTR_SKIP);
if (!isset($page) ) { // A Manditory Parameter is missing
$ret = 'The __page__ parameter was missing from the __~np~{TRANSLATED}~/np~__ plugin.';
$ret.= data_translated_help();
@@ -88,7 +88,7 @@ function data_translated($data, $params) {
/******************************************************************************
The code below is from the deprecated TRANSLATED plugin. All comments and the help routines have been removed. - StarRider
function wikiplugin_translated($data, $params) {
- extract ($params);
+ extract ($params, EXTR_SKIP);
$img = '';
$h = opendir(USERS_PKG_URL . "icons/flags/");
while ($file = readdir($h)) {
diff --git a/plugins/data.usercount.php b/plugins/data.usercount.php
index b6d3fff..ba2d4fe 100644
--- a/plugins/data.usercount.php
+++ b/plugins/data.usercount.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
* @package liberty
* @subpackage plugins_data
*/
@@ -18,7 +18,7 @@
// | by: StarRider <starrrider@sourceforge.net>
// | Reworked from: wikiplugin_usercount.php - see deprecated code below
// +----------------------------------------------------------------------+
-// $Id: data.usercount.php,v 1.4 2005/08/07 17:40:31 squareing Exp $
+// $Id: data.usercount.php,v 1.5 2005/11/22 07:27:18 squareing Exp $
/**
* definitions
@@ -59,7 +59,7 @@ The code below is from the deprecated USERCOUNT plugin. All comments and the hel
function wikiplugin_usercount($data, $params) {
global $gBitUser;
- extract ($params);
+ extract ($params, EXTR_SKIP);
$numusers = $gBitUser->count_users($data);
return $numusers;
}
diff --git a/plugins/data.userlink.php b/plugins/data.userlink.php
index 804a2f2..4b2b972 100755
--- a/plugins/data.userlink.php
+++ b/plugins/data.userlink.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
* @package liberty
* @subpackage plugins_data
* @author bigwasp bigwasp@sourceforge.net
@@ -19,7 +19,7 @@
// | by: StarRider <starrrider@sourceforge.net>
// | Reworked from: wikiplugin_usercount.php - see deprecated code below
// +----------------------------------------------------------------------+
-// $Id: data.userlink.php,v 1.2 2005/08/07 17:40:31 squareing Exp $
+// $Id: data.userlink.php,v 1.3 2005/11/22 07:27:18 squareing Exp $
/**
* definitions
@@ -71,7 +71,7 @@ function data_userlink($data, $params) {
$nFlag = 0;
$myHash = array();
$ret = '';
- extract ($params);
+ extract ($params, EXTR_SKIP);
if (isset($login)) {
$myHash['login'] = $login;
$nFlag++;
diff --git a/plugins/data.userlist.php b/plugins/data.userlist.php
index 8ed651a..c063360 100644
--- a/plugins/data.userlist.php
+++ b/plugins/data.userlist.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
* @package liberty
* @subpackage plugins_data
*/
@@ -18,7 +18,7 @@
// | by: StarRider <starrrider@sourceforge.net>
// | Reworked from: wikiplugin_userlist.php - see deprecated code below
// +----------------------------------------------------------------------+
-// $Id: data.userlist.php,v 1.4 2005/08/07 17:40:31 squareing Exp $
+// $Id: data.userlist.php,v 1.5 2005/11/22 07:27:18 squareing Exp $
/**
* definitions
@@ -124,7 +124,7 @@ function wikiplugin_compare_users($a, $b) {
function wikiplugin_userlist($data, $params) {
global $gBitUser, $gBitSystem;
- extract ($params);
+ extract ($params, EXTR_SKIP);
$num = (isset($num)) ? True : False; // Default = False
$userspage = (!isset($userspage)) ? True : False; // Default = True
$alpha = (!isset($alpha)) ? True : False; // Default = True
diff --git a/plugins/data.wikigraph.php b/plugins/data.wikigraph.php
index 9f4e9d2..f6cfa88 100644
--- a/plugins/data.wikigraph.php
+++ b/plugins/data.wikigraph.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
* @package liberty
* @subpackage plugins_data
*/
@@ -18,7 +18,7 @@
// | by: wolff_borg <wolff_borg@yahoo.com.au>
// | Reworked from: wikiplugin_wikigraph.php - see deprecated code below
// +----------------------------------------------------------------------+
-// $Id: data.wikigraph.php,v 1.3 2005/08/30 22:25:07 squareing Exp $
+// $Id: data.wikigraph.php,v 1.4 2005/11/22 07:27:18 squareing Exp $
/**
* definitions
*/
@@ -73,7 +73,7 @@ include_once( UTIL_PKG_PATH.'GraphViz.php' );
function data_wikigraph($data, $params) {
global $gContent, $wikilib;
$add = "";
- extract ($params);
+ extract ($params, EXTR_SKIP);
if(!isset($level)) $level = 0;
if(!isset($title)) $title = "Wiki-Graph";
if(isset($nodesep)) $add.="&amp;nodesep=$nodesep";
diff --git a/plugins/data.wikilist.php b/plugins/data.wikilist.php
index 7e66663..8f2a5e9 100644
--- a/plugins/data.wikilist.php
+++ b/plugins/data.wikilist.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
* @package liberty
* @subpackage plugins_data
*/
@@ -18,7 +18,7 @@
// | by: StarRider <starrrider@sourceforge.net>
// | Reworked from: wikiplugin_wikilist.php - see deprecated code below
// +----------------------------------------------------------------------+
-// $Id: data.wikilist.php,v 1.4 2005/08/07 17:40:31 squareing Exp $
+// $Id: data.wikilist.php,v 1.5 2005/11/22 07:27:18 squareing Exp $
/**
* definitions
@@ -85,7 +85,7 @@ function wikiplugin_wikilist($data, $params) {
// turn off $feature_hotwords to avoid conflicts
$feature_hotwords = 'n';
- extract ($params);
+ extract ($params, EXTR_SKIP);
if(!isset($alpha)) { $alpha = 1; }
if(!isset($userpages)) { $userpages = "all"; }
if(!isset($num)) { $num = 0; }
diff --git a/plugins/format.markdown.php b/plugins/format.markdown.php
index 432cb74..adea9f2 100644
--- a/plugins/format.markdown.php
+++ b/plugins/format.markdown.php
@@ -1,9 +1,14 @@
<?php
+/**
+ * @version $Revision: 1.3 $
+ * @package liberty
+ * @subpackage plugins_format
+ */
-//===================================================//
-//=========== start bitweaver configuration =========//
-//===================================================//
+/**
+ * Initialization
+ */
global $gLibertySystem;
/**
@@ -183,7 +188,10 @@ function smarty_modifier_markdown($text) {
if (strcasecmp(substr(__FILE__, -16), "classTextile.php") == 0) {
# Try to include PHP SmartyPants. Should be in the same directory.
@include_once 'smartypants.php';
- # Fake Textile class. It calls Markdown instead.
+ /**
+ * @package liberty
+ * Fake Textile class. It calls Markdown instead.
+ */
class Textile {
function TextileThis($text, $lite='', $encode='', $noimage='', $strict='') {
if ($lite == '' && $encode == '') $text = Markdown($text);
diff --git a/plugins/format.tikiwiki.php b/plugins/format.tikiwiki.php
index 4f6964a..2c1928a 100644
--- a/plugins/format.tikiwiki.php
+++ b/plugins/format.tikiwiki.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.10 $
+ * @version $Revision: 1.11 $
* @package liberty
*/
global $gLibertySystem;
@@ -693,6 +693,8 @@ $this->debug(0);
$data = preg_replace("/===([^\=]+)===/", "<span style=\"text-decoration:underline;\">$1</span>", $data);
// Center text
$data = preg_replace("/::(.+?)::/", "<div style=\"text-align:center;\">$1</div>", $data);
+ // Line breaks
+ $data = preg_replace('/%%%/', '<br />', $data);
// New syntax for wiki pages ((name|desc)) Where desc can be anything
preg_match_all("/\(\(($this->mWikiWordRegex)\|(.+?)\)\)/", $data, $pages);
diff --git a/plugins/storage.bitfile.php b/plugins/storage.bitfile.php
index be15c1f..595608e 100644
--- a/plugins/storage.bitfile.php
+++ b/plugins/storage.bitfile.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.6 $
+ * @version $Revision: 1.7 $
* @package liberty
* @subpackage plugins_storage
*/
@@ -69,11 +69,17 @@ function bit_files_load( $pRow ) {
WHERE ta.`foreign_id` = ? AND ta.`content_id` = ?";
if( $rs = $gBitSystem->mDb->query($query, array( $pRow['foreign_id'], $pRow['content_id'] )) ) {
$ret = $rs->fields;
- if (preg_match ( '/image\//', $ret['mime_type'] )) {
+ $canThumbFunc = liberty_get_function( 'can_thumbnail' );
+ if ( file_exists( BIT_ROOT_PATH.dirname( $ret['storage_path'] ).'/medium.jpg' ) ) {
$ret['thumbnail_url']['avatar'] = BIT_ROOT_URL.dirname( $ret['storage_path'] ).'/avatar.jpg';
$ret['thumbnail_url']['small'] = BIT_ROOT_URL.dirname( $ret['storage_path'] ).'/small.jpg';
$ret['thumbnail_url']['medium'] = BIT_ROOT_URL.dirname( $ret['storage_path'] ).'/medium.jpg';
$ret['thumbnail_url']['large'] = BIT_ROOT_URL.dirname( $ret['storage_path'] ).'/large.jpg';
+ } elseif( $canThumbFunc( $ret['mime_type'] ) ) {
+ $ret['thumbnail_url']['avatar'] = LIBERTY_PKG_URL.'icons/generating_thumbnails.png';
+ $ret['thumbnail_url']['small'] = LIBERTY_PKG_URL.'icons/generating_thumbnails.png';
+ $ret['thumbnail_url']['medium'] = LIBERTY_PKG_URL.'icons/generating_thumbnails.png';
+ $ret['thumbnail_url']['large'] = LIBERTY_PKG_URL.'icons/generating_thumbnails.png';
} else {
$mime_thumbnail = $gLibertySystem->getMimeThumbnailURL($ret['mime_type']);
$ret['thumbnail_url']['avatar'] = $mime_thumbnail;
@@ -81,6 +87,9 @@ function bit_files_load( $pRow ) {
$ret['thumbnail_url']['medium'] = $mime_thumbnail;
$ret['thumbnail_url']['large'] = $mime_thumbnail;
}
+// if ( file_exists( BIT_ROOT_PATH.dirname( $ret['storage_path'] ).'/original.jpg' ) ) {
+// $ret['thumbnail_url']['original'] = BIT_ROOT_URL.dirname( $ret['storage_path'] ).'/original.jpg';
+// }
$ret['filename'] = substr( $ret['storage_path'], strrpos($ret['storage_path'], '/')+1);
$ret['source_url'] = BIT_ROOT_URL.str_replace( '+', '%20', str_replace( '%2F', '/', urlencode( $ret['storage_path'] ) ) );
$ret['wiki_plugin_link'] = "{attachment id=".$ret['attachment_id']."}";
diff --git a/templates/admin_liberty.tpl b/templates/admin_liberty.tpl
index 07fcb5d..2599d4c 100644
--- a/templates/admin_liberty.tpl
+++ b/templates/admin_liberty.tpl
@@ -46,9 +46,26 @@
{/forminput}
</div>
+ {php}if( extension_loaded( 'magickwand' ) ) {{/php}{assign var=magickwandInstalled value=TRUE}{php}}{/php}
+ {if !$magickwandInstalled}
+ {formfeedback warning='To use MagickWand, you need to install the magickwand php extension. Unix and Windows users can find source code at <a href="http://www.magickwand.org/download/php/">the ImageMagick downloads website.</a>.'}
+ {/if}
+ <div class="row">
+ {formlabel label="
+ <a href='http://www.imagemagick.org/'>
+ <img class='icon' src=\"`$smarty.const.LIBERTY_PKG_URL`icons/imagick_logo.jpg\" alt='ImageMagick' />
+ </a>
+ "}
+ {forminput}
+ <label>
+ <input type="radio" name="image_processor" value="magickwand" {if !$magickwandInstalled}disabled="disabled"{/if} {if $gBitSystemPrefs.image_processor=='magickwand'}checked="checked"{/if}/> ImageMagick's MagickWand
+ </label>
+ {/forminput}
+ </div>
+
{php}if( extension_loaded( 'imagick' ) ) {{/php}{assign var=imagickInstalled value=TRUE}{php}}{/php}
{if !$imagickInstalled}
- {formfeedback warning='To use <a href="http://www.imagemagick.org/www/download.html">ImageMagick</a>, you need to install the php-imagick extension. For Linux users, RPM files can be found at <a href="http://phprpms.sourceforge.net/imagick">PHPRPMs</a> (or compile a <a href="http://sourceforge.net/project/showfiles.php?group_id=112092&package_id=139307&release_id=292417">source rpm</a>). Windows users can try <a href="http://www.bitweaver.org/builds/php_imagick.dll">this dll</a> however it has not been tested well.'}
+ {formfeedback warning='php-imagick is a no longer supported PECL extension for PHP + ImageMagick. We recommend using the much better supported magickwand option above. If you need to install the php-imagick extension, linux users can find RPM files at <a href="http://phprpms.sourceforge.net/imagick">PHPRPMs</a> (or compile a <a href="http://sourceforge.net/project/showfiles.php?group_id=112092&package_id=139307&release_id=292417">source rpm</a>). Windows users can try <a href="http://www.bitweaver.org/builds/php_imagick.dll">this dll</a> however it has not been tested well.'}
{/if}
<div class="row">
{formlabel label="
@@ -58,10 +75,11 @@
"}
{forminput}
<label>
- <input type="radio" name="image_processor" value="imagick" {if !$imagickInstalled}disabled="disabled"{/if} {if $gBitSystemPrefs.image_processor=='imagick'}checked="checked"{/if}/> ImageMagick
+ <input type="radio" name="image_processor" value="imagick" {if !$imagickInstalled}disabled="disabled"{/if} {if $gBitSystemPrefs.image_processor=='imagick'}checked="checked"{/if}/> php-imagick
</label>
{/forminput}
</div>
+
{foreach from=$formImageFeatures key=item item=output}
<div class="row">
{formlabel label=`$output.label` for=$item}
diff --git a/templates/attachment_browser.tpl b/templates/attachment_browser.tpl
index 7dbf389..0d4f3ad 100644
--- a/templates/attachment_browser.tpl
+++ b/templates/attachment_browser.tpl
@@ -1,36 +1,49 @@
{strip}
- <noscript>
- <p>Please insert {ldelim}attachment id=#{rdelim} where # is the appropriate attachment ID.</p>
- </noscript>
+<div class="row">
+ {formlabel label="Attach File(s)"}
+ {forminput}
+ <input type="text" name="existing_attachment_id[]" id="existing_attachment_id_input" size="20"/>
+ {formhelp note="Attaching an item to your page will insert a small icon representing the file. Please use the attachment IDs listed below.<br />You can attach multiple items at once by seperating them with a ',' (comma)."}
+ {/forminput}
+</div>
- <table class="data">
- <caption>{tr}Available Attachements{/tr}</caption>
- {counter start=-1 name="cells" print=false}
- {foreach from=$userAttachments item=attachment key=foo}
- {counter name="cells" assign="cells" print=false}
- {if $cells % 2 eq 0}
- <tr class="{cycle values="odd,even"}">
- {/if}
+<div class="row">
+ {formlabel label="Insert Attachment"}
+ {forminput}
+ <input type="text" name="dummy" id="copy" size="30" class="success" />
+ <input type="button" value="{tr}Clear{/tr}" onclick="document.getElementById( 'copy' ).value = '';" />
+ {formhelp note="Clicking on any of the attachments below, will display the correct attachment syntax in the textbox above. Insert this text into the textarea where needed."}
+ {/forminput}
+</div>
- <td>
- <a title="{tr}Attachment id: {$attachment.attachment_id}{/tr}" href="javascript:insertAt( 'copy', '{ldelim}attachment id={$attachment.attachment_id}{rdelim}' );">
- <img src="{$attachment.thumbnail_url.small}" alt="{$attachment.filename}" /><br />
- {$attachment.filename}<br />
- Attachment ID: {$attachment.attachment_id}
- </a>
- </td>
-
- {if $cells % 2 ne 0}
- </tr>
- {/if}
- {foreachelse}
- <tr class="norecords"><td>{tr}No Records Found{/tr}</td></tr>
- {/foreach}
+<table class="data">
+ <caption>{tr}Available Attachements{/tr} <span class="total">[ {$userAttachments.cant} ]</span></caption>
+ {counter start=-1 name="cells" print=false}
+ {foreach from=$userAttachments.data item=attachment key=foo}
+ {counter name="cells" assign="cells" print=false}
{if $cells % 2 eq 0}
- <td>&nbsp;</td></tr>
+ <tr class="{cycle values="odd,even"}">
+ {/if}
+
+ <td>
+ <a title="{tr}Attachment id: {$attachment.attachment_id}{/tr}" href="javascript:insertAt( 'copy', '{ldelim}attachment id={$attachment.attachment_id}{rdelim}' );">
+ <img src="{$attachment.thumbnail_url.small}" alt="{$attachment.filename}" /><br />
+ {$attachment.filename}<br />
+ Attachment ID: {$attachment.attachment_id}
+ </a>
+ </td>
+
+ {if $cells % 2 ne 0}
+ </tr>
{/if}
- </table>
- {if $userAttachments}
- {formhelp note="Clicking on an item will attach the item to your wiki page."}
+ {foreachelse}
+ <tr class="norecords"><td>{tr}No Records Found{/tr}</td></tr>
+ {/foreach}
+
+ {if $cells % 2 eq 0}
+ <td>&nbsp;</td></tr>
{/if}
+</table>
+
+{libertypagination pgnName="pgnPage" pgnPage=$curPage numPages=$numPages offset=$smarty.request.offset}
{/strip}
diff --git a/templates/edit_storage.tpl b/templates/edit_storage.tpl
index 9dd02a6..5de6896 100644
--- a/templates/edit_storage.tpl
+++ b/templates/edit_storage.tpl
@@ -1,5 +1,4 @@
{php} include (LIBERTY_PKG_PATH."edit_storage_inc.php"); {/php}
-{if $gContent->hasUserPermission('bit_p_content_attachments')}
{strip}
{foreach from=$gLibertySystem->mPlugins item=plugin key=guid}
{if $plugin.is_active eq 'y' and $plugin.edit_field and $plugin.plugin_type eq 'storage'}
@@ -12,69 +11,8 @@
</div>
{/if}
{/foreach}
-{/strip}
-
- <h2><a href="javascript:flip( 'attbrowser' );">{tr}Attachment Browser{/tr}</a> <small>click to show / hide</small></h2>
-
- <script type="text/javascript">//<![CDATA[
- this.document.write( '<div class="row" style="display:none;" id="attbrowser">' );
- //]]></script>
-
- <div class="row">
- {formlabel label="Attach File(s)"}
- {forminput}
- <input type="text" name="existing_attachment_id[]" id="existing_attachment_id_input" size="20"/>
- {formhelp note="Attaching an item to your page will insert a small icon representing the file. Please use the attachment IDs listed below.<br />You can attach multiple items at once by seperating them with a ',' (comma)."}
- {/forminput}
- </div>
-
- <div class="row">
- {formlabel label="Insert Attachment"}
- {forminput}
- <input type="text" name="dummy" id="copy" size="30" class="success" />
- <input type="button" value="{tr}Clear{/tr}" onclick="document.getElementById( 'copy' ).value = '';" />
- {formhelp note="Using this method will display the attachment within your text. See the help at the bottom of the page for more details.<br />Please copy the above to your textarea and insert where needed."}
- {/forminput}
- </div>
-
- <div class="attbrowser" style="overflow:auto; width:auto; height:400px;">
- {include file="bitpackage:liberty/attachment_browser.tpl"}
- </div>
-
- <script type="text/javascript">//<![CDATA[
- this.document.write( '</div>' );
- //]]></script>
-
-{strip}
- {if $gContent->mStorage}
- <div class="row">
- <table class="data" summary="List of attached files">
- <caption>{tr}Attached Items{/tr}</caption>
- <tr>
- <th scope="col" title="{tr}Thumbnail{/tr}">{tr}Thumbnail{/tr}</th>
- <th scope="col" title="{tr}File Properties{/tr}">{tr}File Properties{/tr}</th>
- </tr>
- {foreach from=$gContent->mStorage item=storage key=attachmentId}
- <tr class="{cycle values="odd,even"}">
- <td style="text-align:center;"><a href="{$storage.source_url}"><img src="{$storage.thumbnail_url.small}" alt="{$storage.filename}" /></a></td>
- <td>
- Attachment ID: {$attachmentId}
- <br />
- Filename: {$storage.filename}
- <br />
- Actions:
- {if $gBitUser->isAdmin() || $bit_p_detach_attachment || $storage.user_id == $gBitUser->mUserId}
- <a href="{$attachmentActionBaseURL}&amp;detachAttachment={$storage.attachment_id}">{biticon ipackage=liberty iname="detach" iexplain="detach"}</a>
- {/if}
- {if $gBitUser->isAdmin() || $storage.user_id == $gBitUser->mUserId}
- <a href="{$attachmentActionBaseURL}&amp;deleteAttachment={$storage.attachment_id}">{biticon ipackage=liberty iname="delete" iexplain="delete"}</a>
- {/if}
- </td>
- </tr>
- {/foreach}
- </table>
- </div>
- {/if}
+ <h2 class="clear"><a href="javascript:sendRequest( 'attbrowser' );" onclick="javascript:document.getElementById( 'attbrowser' ).innerHTML = '<br />{tr}Loading Attachment Browser...{/tr}'">{tr}Attachment Browser{/tr}</a></h2>
+ <noscript><div class="warning">{tr}The attachment browser only works with javascript enabled.{/tr}</div></noscript>
+ <div id="attbrowser" class="attbrowser"></div>
{/strip}
-{/if}
diff --git a/templates/edit_storage_list.tpl b/templates/edit_storage_list.tpl
index 93c046f..52fd46d 100644
--- a/templates/edit_storage_list.tpl
+++ b/templates/edit_storage_list.tpl
@@ -1,26 +1,32 @@
-{php}
-include (LIBERTY_PKG_PATH."edit_storage_inc.php");
-{/php}
+{php} include (LIBERTY_PKG_PATH."edit_storage_inc.php"); {/php}
{strip}
{if $gContent->mStorage}
<div class="row">
- <table class="data">
- <caption>{tr}Insert attached items{/tr}</caption>
+ <table class="data" summary="List of attached files">
+ <caption>{tr}Attached Items{/tr}</caption>
<tr>
- <th style="width:30%">Filename</th>
- <th style="width:70%">Attachment Tag</th>
+ <th scope="col" title="{tr}Thumbnail{/tr}">{tr}Thumbnail{/tr}</th>
+ <th scope="col" title="{tr}File Properties{/tr}">{tr}File Properties{/tr}</th>
</tr>
+
{foreach from=$gContent->mStorage item=storage key=attachmentId}
<tr class="{cycle values="odd,even"}">
- <td>{$storage.filename}</td>
- <td style="text-align:right;">
- <a title="{$storage.wiki_plugin_link}" href="javascript:insertAt('{$textarea_id}','{$storage.wiki_plugin_link|escape:"javascript"}');">{$storage.wiki_plugin_link}</a>
+ <td style="text-align:center;"><a href="{$storage.source_url}"><img src="{$storage.thumbnail_url.avatar}" alt="{$storage.filename}" /></a></td>
+ <td>
+ Attachment ID: {$attachmentId}
+ <br />
+ Filename: {$storage.filename}
+ <br />
+ Actions:
+ {if $gBitUser->isAdmin() || $bit_p_detach_attachment || $storage.user_id == $gBitUser->mUserId}
+ <a href="{$attachmentActionBaseURL}&amp;detachAttachment={$storage.attachment_id}">{biticon ipackage=liberty iname="detach" iexplain="detach"}</a>
+ {/if}
+ {if $gBitUser->isAdmin() || $storage.user_id == $gBitUser->mUserId}
+ <a href="{$attachmentActionBaseURL}&amp;deleteAttachment={$storage.attachment_id}">{biticon ipackage=liberty iname="delete" iexplain="delete"}</a>
+ {/if}
</td>
</tr>
{/foreach}
- {if $textarea_id}
- <tr><td colspan="2">{tr}Click on the Attachment Tag to insert it in the textarea{/tr}</td></tr>
- {/if}
</table>
</div>
{/if}
diff --git a/templates/libertypagination.tpl b/templates/libertypagination.tpl
index 5997322..7cc0ec0 100644
--- a/templates/libertypagination.tpl
+++ b/templates/libertypagination.tpl
@@ -1,28 +1,36 @@
{strip}
<div class="pagination">
- {if $page gt 1}
- <a href="{$smarty.server.PHP_SELF}?{$pgnName}={$page-1}{$pgnVars}">&laquo;</a>&nbsp;
+ {if $pgnPage gt 1}
+ {if $smarty.request.ajaxid}
+ <a href="javascript:sendRequest( '{$smarty.request.ajaxid}','{$pgnName}={$pgnPage-1}{$pgnVars}' )">&laquo;</a>&nbsp;
+ {else}
+ <a href="{$smarty.server.PHP_SELF}?{$pgnName}={$pgnPage-1}{$pgnVars}">&laquo;</a>&nbsp;
+ {/if}
{else}
- &nbsp;
+ &nbsp;&nbsp;
{/if}
- {tr}Page {$page} of {$numPages}{/tr}
+ {tr}Page {$pgnPage} of {$numPages}{/tr}
- {if $page lt $numPages}
- &nbsp;<a href="{$smarty.server.PHP_SELF}?{$pgnName}={$page+1}{$pgnVars}">&raquo;</a>
+ {if $pgnPage lt $numPages}
+ {if $smarty.request.ajaxid}
+ &nbsp;<a href="javascript:sendRequest( '{$smarty.request.ajaxid}','{$pgnName}={$pgnPage+1}{$pgnVars}' )">&raquo;</a>
+ {else}
+ &nbsp;<a href="{$smarty.server.PHP_SELF}?{$pgnName}={$pgnPage+1}{$pgnVars}">&raquo;</a>
+ {/if}
{else}
- &nbsp;
+ &nbsp;&nbsp;
{/if}
<br />
- {if $gBitSystem->isFeatureActive( 'direct_pagination' )}
+ {* MSIE dies when we use a form in the pagination when doing ajax stuff *}
+ {if $gBitSystem->isFeatureActive( 'direct_pagination' ) or $smarty.request.ajaxid}
{foreach from=$pgnPages item=link}
{$link}&nbsp;
{/foreach}
{else}
{form id="fPageSelect"}
-
<input type="hidden" name="comments_maxComments" value="{$maxComments}" />
<input type="hidden" name="comments_style" value="{$comments_style}" />
<input type="hidden" name="comments_sort_mode" value="{$comments_sort_mode}" />
diff --git a/templates/storage_thumbs.tpl b/templates/storage_thumbs.tpl
index 738d87e..c43ad6d 100644
--- a/templates/storage_thumbs.tpl
+++ b/templates/storage_thumbs.tpl
@@ -1,11 +1,19 @@
{strip}
+{if !$gBitSystem->isFeatureActive( 'feature_helppopup' )}
+ {popup_init src="`$smarty.const.THEMES_PKG_URL`js/overlib.js"}
+{/if}
+
{if $gContent->mStorage}
<div class="storage">
{foreach from=$gContent->mStorage item=attachment }
+ {capture name="popup"}
+ {include file="bitpackage:kernel/popup_box.tpl" content="`$attachment.filename`<br />{tr}Size{/tr}: `$attachment.size` bytes" noclose=true}
+ {/capture}
+ {$popup}
<div class="item">
{if $attachment.thumbnail_url.small}
{if $attachment.source_url}<a href="{$attachment.source_url}">{/if}
- <img class="thumb" src="{$attachment.thumbnail_url.avatar}" alt="{$attachment.filename}" />
+ <img class="thumb" src="{$attachment.thumbnail_url.avatar}" alt="{$attachment.filename}" title="{$attachment.filename}" {popup fullhtml="1" text=$smarty.capture.popup|escape:"javascript"|escape:"html"}/>
{if $attachment.source_url}</a>{/if}
{else}
{tr}No thumbnail for{/tr} {$attachment.source_url}