Location: PHPKode > projects > Content*Builder > contentbuilder/plugins/media_manager/mediaFiles.inc.php
<?php

	/**
	*@access		public
	*@author		Jörg Stöber <hide@address.com>
	*@version 	    1.0 17/08/2002 19:00
	**/
	$query    = mysql_query("SELECT * FROM ".TABLE."_user WHERE name = '$HTTP_SESSION_VARS[user]'");
	$result   = mysql_fetch_array($query);
	
	// Limitierung der Anzahl der Uploadboxen
	if(!empty($_REQUEST[limit]))  { $limit = $_REQUEST[limit]; }  else { $limit = 4; }
	
	// Ermittlung der Branch ID
	if(!empty($_REQUEST[bid]))  { $branchID = $_REQUEST[bid]; }
		
	$myMedia = new MediaManagement();
	
	/*
	* Smarty Template für das Medien Management ableiten
	*/
	$mediaTPL = new Smarty;
	$mediaTPL->template_dir = CB_TEMPLATE_DIR;
	$mediaTPL->compile_dir  = CB_TEMPLATE_DIR."compiled/";
		
	$myMedia->mediaText = $media;
	$myMedia->setUserID($cbUserID);
	$myMedia->setLimit($limit);				
	$myMedia->setBranchID($branchID);
	$myMedia->setOptionObject($cbOption);
	$myMedia->setTemplateObject($mediaTPL);
	
	$myMedia->tpl->assign("PHP_SELF", $PHP_SELF);
	$myMedia->tpl->assign("URLIDENT", $config['urlIdent']);
	$myMedia->tpl->assign("PLUGINLOCATION", $pluginLocation);
	$myMedia->tpl->assign("SID", "&".SID);
	$myMedia->tpl->assign("SUB", $sub);
	$myMedia->tpl->assign("BID", $branchID);
	
	$tpl->assign("BID", $branchID);
	
	if(!empty($_POST[delbox])) {
		$myMedia->deleteFiles($_POST[delbox]);
	}
	
	if(!empty($MEDIA_addUnregistered)) {
		$myMedia->registerFile($MEDIA_addFileName, $bid, $MEDIA_type);
	}
	
	$myMedia->setFileStatus($onbox, $offbox);
	
	if(!empty($MEDIA_fileRenameStatus)) {
		$fileRenameArr = array();
		$fileRenameArr['fileID']   = $fid;
		$fileRenameArr['newName']  = $MEDIA_fileName;
		$myMedia->renameFile($fileRenameArr);
	}
	
	if(!empty($fileID)) {
		if(empty($updateButton)) {
			$myMedia->packUpdateTemplate($fileID);
			$myMedia->activateTemplate("upload_heading_set");
			$myMedia->activateTemplate("upload_title_set");
			$myMedia->activateTemplate("upload_description_set");
			$myMedia->activateTemplate("upload_keywords_set");
			$mainPluginContent[] = $myMedia->fetchTemplate();
			
			$fileInformation = $myMedia->getFileValues( $fileID );
			$extension = array_reverse(explode(".", $fileInformation[filename]));
			$extFileString = "plugins/media_manager/ext/".strtolower($extension[0])."/ext.fileInfo.php";
			if(is_file( $extFileString )) {
				require_once( $extFileString );
			}
		} else {
			$myMedia->updateFileValues($fileID, 
				array ( "title"       => $_POST[title],
						"description" => $_POST[description],
						"keywords"    => $_POST[keywords]
				)
			);
			$display = "overview";
		}
	}
	
	if(!empty($branchID)) {
		if($action == "add") {
			// Max. Dateigröße bestimmen
			if(empty($uploadbutton)) {
				$myMedia->mediaTypeID = $mediaType;
				$myMedia->packUploadTemplate();
				$myMedia->activateTemplate("upload_heading_set");
				$myMedia->activateTemplate("upload_title_set");
				$myMedia->activateTemplate("upload_description_set");
				$myMedia->activateTemplate("upload_keywords_set");
				$myMedia->activateTemplate("upload_form_set");
				$mainPluginContent[] = $myMedia->fetchTemplate();
			} else {
				$myMedia->mediaTypeID = $mediaType;
				$myMedia->addFileValues(
					array ( "title"       => $_POST[title],
							"description" => $_POST[description],
							"keywords"    => $_POST[keywords]
					)
				);
				$moveResult = &$myMedia->moveFiles();
				if(is_array($moveResult)) {
					foreach($moveResult as $k => $v) {
						$mediaError[] = $v->getMessage();
					}
				}
				cb_log(1);
				$display = "overview";
			}
		} else {$display = "overview";}
	}
	
	if($display == "overview") {
		if(count($mediaError) > 0) {
			$tpl->assign("errorSet", "1");
			$tpl->assign("errorList", $mediaError);
		}
		
		$myMedia->mediaTypeID = $mediaType;
		$myMedia->packFileListTemplate();
		$myMedia->packUnregisteredFileListTemplate();
		
		$myMedia->activateTemplate("fileoverview_set");
		$myMedia->activateTemplate("unregisteredFileoverview_set");
		
		$mainPluginContent[]  = $myMedia->fetchTemplate();
		$mainMessageContent[] = $tpl->fetch($config['templates']."messages.template", null, "pluginMedia".$cbUserID);
	}
?>
Return current item: Content*Builder