diff options
| -rw-r--r-- | LibertyAttachable.php | 2 | ||||
| -rw-r--r-- | LibertyContent.php | 2 | ||||
| -rw-r--r-- | liberty_lib.php | 40 | ||||
| -rw-r--r-- | modules/mod_structure_toc.php | 2 | ||||
| -rw-r--r-- | plugins/mime.default.php | 4 | ||||
| -rw-r--r-- | templates/edit_format.tpl | 8 | ||||
| -rw-r--r-- | templates/mime/audio/edit.tpl | 4 | ||||
| -rw-r--r-- | templates/mime/image/edit.tpl | 4 | ||||
| -rw-r--r-- | templates/service_content_icon_inc.tpl | 6 |
9 files changed, 31 insertions, 41 deletions
diff --git a/LibertyAttachable.php b/LibertyAttachable.php index 89ce570..a385c10 100644 --- a/LibertyAttachable.php +++ b/LibertyAttachable.php @@ -160,7 +160,7 @@ class LibertyAttachable extends LibertyContent { if (!empty( $pParamHash['thumbnail_sizes'] ) ) { $storeRow['upload']['thumbnail_sizes'] = $pParamHash['thumbnail_sizes']; } - $storagePath = liberty_process_upload( $storeRow ); + $storagePath = liberty_process_upload( $storeRow['upload'] ); // We're gonna store to local file system & liberty_files table if( empty( $storagePath ) ) { $this->mErrors['file'] = tra( "Could not store file" ).": ".$storeRow['upload']['name'].'.'; diff --git a/LibertyContent.php b/LibertyContent.php index 06f1899..93dc137 100644 --- a/LibertyContent.php +++ b/LibertyContent.php @@ -1929,7 +1929,7 @@ class LibertyContent extends LibertyBase implements BitCacheable { * @param array pHash type hash of data to be used to provide base data * @return string Descriptive title for the page */ - static function getTitleFromHash( &$pHash, $pDefault=TRUE ) { + public static function getTitleFromHash( &$pHash, $pDefault=TRUE ) { $ret = NULL; if( !empty( $pHash['title'] ) ) { $ret = $pHash['title']; diff --git a/liberty_lib.php b/liberty_lib.php index 5471033..6569ae0 100644 --- a/liberty_lib.php +++ b/liberty_lib.php @@ -417,12 +417,12 @@ function liberty_content_edit( &$pObject ) { * Process uploaded files. Will automagically generate thumbnails for images * * @param array $pFileHash Data require to process the files - * @param array $pFileHash['upload']['name'] (required) Name of the uploaded file - * @param array $pFileHash['upload']['type'] (required) Mime type of the file uploaded - * @param array $pFileHash['upload']['dest_branch'] (required) Relative path where you want to store the file (trailing slash required) - * @param array $pFileHash['upload']['source_file'] (required) Absolute path to file including file name - * @param boolean $pFileHash['upload']['thumbnail'] (optional) Set to FALSE if you don't want to generate thumbnails - * @param array $pFileHash['upload']['thumbnail_sizes'] (optional) Decide what sizes thumbnails you want to create: icon, avatar, small, medium, large + * @param array $pFileHash['name'] (required) Name of the uploaded file + * @param array $pFileHash['type'] (required) Mime type of the file uploaded + * @param array $pFileHash['dest_branch'] (required) Relative path where you want to store the file (trailing slash required) + * @param array $pFileHash['tmp_name'] (required) Absolute path to file including file name + * @param boolean $pFileHash['thumbnail'] (optional) Set to FALSE if you don't want to generate thumbnails + * @param array $pFileHash['thumbnail_sizes'] (optional) Decide what sizes thumbnails you want to create: icon, avatar, small, medium, large * @param boolean $pMoveFile (optional) specify if you want to move or copy the original file * @access public * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure @@ -431,33 +431,33 @@ function liberty_process_upload( &$pFileHash, $pMoveFile = TRUE ) { global $gBitSystem; // Check for evil file extensions that could be execed on the server - if( preg_match( EVIL_EXTENSION_PATTERN, $pFileHash['upload']['name'] )) { - $pFileHash['upload']['type'] = 'text/plain'; - $pFileHash['upload']['name'] = $pFileHash['upload']['name'].'.txt'; + if( preg_match( EVIL_EXTENSION_PATTERN, $pFileHash['name'] )) { + $pFileHash['type'] = 'text/plain'; + $pFileHash['name'] = $pFileHash['name'].'.txt'; } if ( !is_windows() ) { - list( $pFileHash['upload']['name'], $pFileHash['upload']['type'] ) = $gBitSystem->verifyFileExtension( $pFileHash['upload']['tmp_name'], $pFileHash['upload']['name'] ); + list( $pFileHash['name'], $pFileHash['type'] ) = $gBitSystem->verifyFileExtension( $pFileHash['tmp_name'], $pFileHash['name'] ); } else { //$pFile['type'] = $gBitSystem->verifyMimeType( $pFile['tmp_name'] ); } - $ext = strrpos( $pFileHash['upload']['name'], '.' ); + $ext = strrpos( $pFileHash['name'], '.' ); // clean out crap that can make life difficult in server maintenance - $cleanedBaseName = preg_replace( '/[&\%:\/\\\]/', '', substr( $pFileHash['upload']['name'], 0, $ext ) ); - $pFileHash['upload']['dest_base_name'] = $cleanedBaseName; - $pFileHash['upload']['source_file'] = $pFileHash['upload']['tmp_name']; + $cleanedBaseName = preg_replace( '/[&\%:\/\\\]/', '', substr( $pFileHash['name'], 0, $ext ) ); + $pFileHash['dest_base_name'] = $cleanedBaseName; + $pFileHash['source_file'] = $pFileHash['tmp_name']; // lowercase all file extensions - $pFileHash['upload']['name'] = $cleanedBaseName.strtolower( substr( $pFileHash['upload']['name'], $ext ) ); + $pFileHash['name'] = $cleanedBaseName.strtolower( substr( $pFileHash['name'], $ext ) ); // Thumbs.db is a windows My Photos/ folder file, and seems to really piss off imagick $canThumbFunc = liberty_get_function( 'can_thumbnail' ); - if( !empty( $canThumbFunc ) && $canThumbFunc( $pFileHash['upload']['type'] ) && $pFileHash['upload']['name'] != 'Thumbs.db' ) { - $ret = liberty_process_image( $pFileHash['upload'], $pMoveFile ); + if( !empty( $canThumbFunc ) && $canThumbFunc( $pFileHash['type'] ) && $pFileHash['name'] != 'Thumbs.db' ) { + $ret = liberty_process_image( $pFileHash, $pMoveFile ); } else { - $ret = liberty_process_generic( $pFileHash['upload'], $pMoveFile ); + $ret = liberty_process_generic( $pFileHash, $pMoveFile ); } return $ret; @@ -691,7 +691,7 @@ function liberty_get_function( $pType ) { * @access public * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure */ -function liberty_generate_thumbnails( &$pFileHash ) { +function liberty_generate_thumbnails( $pFileHash ) { global $gBitSystem, $gThumbSizes; $resizeFunc = liberty_get_function( 'resize' ); $ret = FALSE; @@ -762,7 +762,7 @@ function liberty_generate_thumbnails( &$pFileHash ) { $pFileHash['dest_branch'] = $initialDestPath.'thumbs/'; clearstatcache(); if( !is_dir( STORAGE_PKG_PATH.$pFileHash['dest_branch'] )) { - mkdir( STORAGE_PKG_PATH.$pFileHash['dest_branch'] ); + mkdir( STORAGE_PKG_PATH.$pFileHash['dest_branch'], 0775, TRUE ); clearstatcache(); } } diff --git a/modules/mod_structure_toc.php b/modules/mod_structure_toc.php index 2895619..2b75e77 100644 --- a/modules/mod_structure_toc.php +++ b/modules/mod_structure_toc.php @@ -21,7 +21,7 @@ if( is_object( $gStructure ) && $gStructure->isValid() && $gStructure->hasViewPe } elseif( @BitBase::verifyId( $module_params['structure_id'] ) ) { $struct = new LibertyStructure( $module_params['structure_id'] ); $struct->load(); -} elseif( is_object( $gContent ) && $gContent->hasViewPermission() ) { +} elseif( is_object( $gContent ) && $gContent->hasViewPermission( FALSE ) ) { $structures = $gContent->getStructures(); // We take the first structure. not good, but works for now - spiderr if( !empty( $structures[0] ) ) { diff --git a/plugins/mime.default.php b/plugins/mime.default.php index d9a02a7..a19b101 100644 --- a/plugins/mime.default.php +++ b/plugins/mime.default.php @@ -165,7 +165,7 @@ if( !function_exists( 'mime_default_update' )) { } // Now we process the uploaded file - if( $storagePath = liberty_process_upload( $pStoreRow )) { + if( $storagePath = liberty_process_upload( $pStoreRow['upload'] )) { $sql = "UPDATE `".BIT_DB_PREFIX."liberty_files` SET `file_name` = ?, `mime_type` = ?, `file_size` = ?, `user_id` = ? WHERE `file_id` = ?"; $gBitSystem->mDb->query( $sql, array( $pStoreRow['upload']['name'], $pStoreRow['upload']['type'], $pStoreRow['upload']['size'], $pStoreRow['user_id'], $pStoreRow['file_id'] )); } @@ -199,7 +199,7 @@ if( !function_exists( 'mime_default_store' )) { $ret = FALSE; // take care of the uploaded file and insert it into the liberty_files and liberty_attachments tables - if( $storagePath = liberty_process_upload( $pStoreRow, empty( $pStoreRow['upload']['copy_file'] ))) { + if( $storagePath = liberty_process_upload( $pStoreRow['upload'], empty( $pStoreRow['upload']['copy_file'] ))) { // add row to liberty_files $storeHash = array( "file_name" => $pStoreRow['upload']['name'], diff --git a/templates/edit_format.tpl b/templates/edit_format.tpl index 1f9922c..04b66af 100644 --- a/templates/edit_format.tpl +++ b/templates/edit_format.tpl @@ -42,8 +42,7 @@ {formlabel label="Content Format"} {foreach name=formatPlugins from=$gLibertySystem->mPlugins item=plugin key=guid} {if $plugin.is_active eq 'y' and $plugin.edit_field and $plugin.plugin_type eq 'format'} - {forminput} - <label class="radio"> + {forminput label="radio"} {if $numformat > 1} <input type="radio" name="{$format_guid_variable|default:"format_guid"}" value="{$plugin.edit_field}" {if $contentObject->mInfo.format_guid eq $plugin.plugin_guid} checked="checked" @@ -77,7 +76,6 @@ {/if} {/if} {/if} - </label> {formhelp note=$plugin.edit_help} {/forminput} {/if} @@ -96,9 +94,7 @@ <div class="form-group"> {formlabel label="Content Format"} {forminput} - <label> - {$singleplugin.edit_label} - </label> + {$singleplugin.edit_label} {/forminput} </div> {/if} diff --git a/templates/mime/audio/edit.tpl b/templates/mime/audio/edit.tpl index 2df08b5..ef88d4c 100644 --- a/templates/mime/audio/edit.tpl +++ b/templates/mime/audio/edit.tpl @@ -36,10 +36,10 @@ {if $attachment.source_file} <div class="form-group"> - <label class="checkbox"> + {forminput label="checkbox"} <input type="checkbox" id="remove_original" name="plugin[{$attachment.attachment_id}][mimeaudio][remove_original]" value="y" />Remove Original {formhelp note="This will permanently remove the original file from the server. This will still allow you to listen to the audio file but not download it."} - </label> + {/forminput} </div> {/if} diff --git a/templates/mime/image/edit.tpl b/templates/mime/image/edit.tpl index 557bdca..2085c88 100644 --- a/templates/mime/image/edit.tpl +++ b/templates/mime/image/edit.tpl @@ -1,10 +1,10 @@ {strip} {if $gBitSystem->isFeatureActive( 'mime_image_panoramas' )} <div class="form-group"> - <label class="checkbox"> + {forminput label="checkbox"} <input type="checkbox" value="y" name="plugin[{$attachment.attachment_id}][mimeimage][preference][is_panorama]" id="panorama" {if $attachment.thumbnail_url.panorama}checked="checked"{/if} />Panorama Image {formhelp note="If this image is a 360° panoramic image with equirectangular projection, check this box. This works best for images with a 360° by 180° field of view (FOV)"} - </label> + {/forminput} </div> {/if} {/strip} diff --git a/templates/service_content_icon_inc.tpl b/templates/service_content_icon_inc.tpl index b33689e..bb402f1 100644 --- a/templates/service_content_icon_inc.tpl +++ b/templates/service_content_icon_inc.tpl @@ -21,11 +21,5 @@ {smartlink ipackage=liberty ifile="content_permissions.php" ititle="Assign Permissions" booticon="icon-key" class=$iconClass ipackage=liberty ifile="content_permissions.php" content_id=$serviceHash.content_id} {/if} {/if} - - {if $role_model } - {smartlink ipackage=liberty ifile="content_role_permissions.php" ititle="Assign Permissions" booticon="icon-key" class=$iconClass ipackage=liberty ifile="content_permissions.php" content_id=$serviceHash.content_id} - {else} - {smartlink ipackage=liberty ifile="content_permissions.php" ititle="Assign Permissions" booticon="icon-key" class=$iconClass ipackage=liberty ifile="content_permissions.php" content_id=$serviceHash.content_id} - {/if} {/if} {/strip} |
