Пример #1
0
if (getval("method", "") != "") {
    $ranges = getval("ranges", "");
    $rs = explode(",", $ranges);
    # Original file path
    $file = get_resource_path($ref, true, "", true, "pdf");
    foreach ($rs as $r) {
        # For each range
        $s = explode(":", $r);
        $from = $s[0];
        $to = $s[1];
        if (getval("method", "") == "alternativefile") {
            $aref = add_alternative_file($ref, $lang["pages"] . " " . $from . " - " . $to, "", "", "pdf");
            $copy_path = get_resource_path($ref, true, "", true, "pdf", -1, 1, false, "", $aref);
        } else {
            # Create a new resource based upon the metadata/type of the current resource.
            $copy = copy_resource($ref);
            # Find out the path to the original file.
            $copy_path = get_resource_path($copy, true, "", true, "pdf");
        }
        # Extract this one page to a new resource.
        $ghostscript_fullpath = get_utility_path("ghostscript");
        $gscommand = $ghostscript_fullpath . " -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=" . escapeshellarg($copy_path) . "  -dFirstPage=" . $from . " -dLastPage=" . $to . " " . escapeshellarg($file);
        $output = run_command($gscommand);
        if (getval("method", "") == "alternativefile") {
            # Preview creation for alternative files (enabled via config)
            global $alternative_file_previews;
            if ($alternative_file_previews) {
                create_previews($ref, false, "pdf", false, false, $aref);
            }
            # Update size.
            sql_query("update resource_alt_files set file_size='" . filesize_unlimited($copy_path) . "' where ref='{$aref}'");
Пример #2
0
     if ($result === false) {
         exit("ERROR: File upload error. Please check the size of the file you are trying to upload.");
     }
     chmod($path, 0777);
     $file_size = @filesize_unlimited($path);
     # Save alternative file data.
     sql_query("update resource_alt_files set file_name='" . escape_check($plfilename) . "',file_extension='" . escape_check($extension) . "',file_size='" . $file_size . "',creation_date=now() where resource='{$alternative}' and ref='{$aref}'");
     if ($alternative_file_previews_batch) {
         create_previews($alternative, false, $extension, false, false, $aref);
     }
     echo "SUCCESS";
     exit;
 }
 if ($replace == "" && $replace_resource == "") {
     # Standard upload of a new resource
     $ref = copy_resource(0 - $userref);
     # Copy from user template
     # Add to collection?
     if ($collection_add != "") {
         add_resource_to_collection($ref, $collection_add);
     }
     # Log this
     daily_stat("Resource upload", $ref);
     resource_log($ref, "u", 0);
     $status = upload_file($ref, getval("no_exif", "") != "", false, getval('autorotate', '') != '');
     echo "SUCCESS: " . $ref;
     exit;
 } elseif ($replace == "" && $replace_resource != "") {
     # Replacing an existing resource file
     $status = upload_file($replace_resource, getval("no_exif", "") != "", false, getval('autorotate', '') != '');
     echo "SUCCESS: {$replace_resource}";
Пример #3
0
				# Save alternative file data.
				sql_query("update resource_alt_files set file_name='" . escape_check($plfilename) . "',file_extension='" . escape_check($extension) . "',file_size='" . $file_size . "',creation_date=now() where resource='$alternative' and ref='$aref'");
				
				if ($alternative_file_previews_batch)
					{
					create_previews($alternative,false,$extension,false,false,$aref);
					}
				
				echo "SUCCESS " . htmlspecialchars($alternative) . ", " . htmlspecialchars($aref);
				exit();
				}
			if ($replace=="" && $replace_resource=="")
				{
				# Standard upload of a new resource

				$ref=copy_resource(0-$userref); # Copy from user template
				
				# Add to collection?
				if ($collection_add!="")
					{
					add_resource_to_collection($ref,$collection_add);
					}
					
				# Log this			
				daily_stat("Resource upload",$ref);
				resource_log($ref,"u",0);				
				$status=upload_file($ref,(getval("no_exif","")!=""),false,(getval('autorotate','')!=''));
				echo "SUCCESS: " . htmlspecialchars($ref);
				exit();
				}
			elseif ($replace=="" && $replace_resource!="")
function HookImagestreamUpload_pluploadInitialuploadprocessing()
{
    #Support for uploading multi files as zip
    global $config_windows, $id, $targetDir, $resource_type, $imagestream_restypes, $imagestream_transitiontime, $zipcommand, $use_zip_extension, $userref, $session_hash, $filename, $filename_field, $collection_add, $archiver, $zipcommand, $ffmpeg_fullpath, $ffmpeg_preview_extension, $ffmpeg_preview_options, $ffmpeg_preview_min_height, $ffmpeg_preview_max_height, $ffmpeg_preview_min_width, $ffmpeg_preview_max_width, $lang, $collection_download_settings, $archiver_listfile_argument;
    $ffmpeg_fullpath = get_utility_path("ffmpeg");
    debug("DEBUG: Imagestream - checking restype: " . $resource_type . $imagestream_restypes);
    if (in_array($resource_type, $imagestream_restypes)) {
        debug("DEBUG: Imagestream - uploading file");
        #Check that we have an archiver configured
        $archiver_fullpath = get_utility_path("archiver");
        if (!isset($zipcommand) && !$use_zip_extension) {
            if ($archiver_fullpath == false) {
                exit($lang["archiver-utility-not-found"]);
            }
        }
        echo print_r($_POST) . print_r($_GET);
        if (getval("lastqueued", "")) {
            debug("DEBUG: Imagestream - last queued file");
            $ref = copy_resource(0 - $userref);
            # Copy from user template
            debug("DEBUG: Imagestream - creating resource: " . $ref);
            # Create the zip file
            $imagestreamzippath = get_resource_path($ref, true, "", true, "zip");
            if ($use_zip_extension) {
                $zip = new ZipArchive();
                $zip->open($imagestreamzippath, ZIPARCHIVE::CREATE);
            }
            $deletion_array = array();
            debug("DEBUG: opening directory: " . $targetDir);
            $imagestream_files = opendir($targetDir);
            $imagestream_workingfiles = get_temp_dir() . DIRECTORY_SEPARATOR . "plupload" . DIRECTORY_SEPARATOR . $session_hash . "workingfiles";
            if (!file_exists($imagestream_workingfiles)) {
                if ($config_windows) {
                    @mkdir($imagestream_workingfiles);
                } else {
                    @mkdir($imagestream_workingfiles, 0777, true);
                }
            }
            $filenumber = 00;
            $imagestream_filelist = array();
            while ($imagestream_filelist[] = readdir($imagestream_files)) {
                sort($imagestream_filelist);
            }
            closedir($imagestream_files);
            $imageindex = 1;
            foreach ($imagestream_filelist as $imagestream_file) {
                if ($imagestream_file != '.' && $imagestream_file != '..') {
                    $filenumber = sprintf("%03d", $filenumber);
                    $deletion_array[] = $targetDir . DIRECTORY_SEPARATOR . $imagestream_file;
                    if (!$use_zip_extension) {
                        $imagestreamcmd_file = get_temp_dir(false, $id) . "/imagestreamzipcmd" . $imagestream_file . ".txt";
                        $fh = fopen($imagestreamcmd_file, 'w') or die("can't open file");
                        fwrite($fh, $targetDir . DIRECTORY_SEPARATOR . $imagestream_file . "\r\n");
                        fclose($fh);
                        $deletion_array[] = $imagestreamcmd_file;
                    }
                    if ($use_zip_extension) {
                        debug("DEBUG: Imagestream - adding filename: " . $imagestream_file);
                        debug("DEBUG: using zip PHP extension, set up zip at : " . $imagestreamzippath);
                        $zip->addFile($imagestream_file);
                        debug(" Added files number : " . $zip->numFiles);
                        $wait = $zip->close();
                        debug("DEBUG: closed zip");
                    } else {
                        if ($archiver_fullpath) {
                            debug("DEBUG: using archiver, running command: \r\n" . $archiver_fullpath . " " . $collection_download_settings[0]["arguments"] . " " . escapeshellarg($imagestreamzippath) . " " . $archiver_listfile_argument . escapeshellarg($imagestream_file));
                            run_command($archiver_fullpath . " " . $collection_download_settings[0]["arguments"] . " " . escapeshellarg($imagestreamzippath) . " " . $archiver_listfile_argument . escapeshellarg($imagestreamcmd_file));
                        } else {
                            if (!$use_zip_extension) {
                                if ($config_windows) {
                                    debug("DEBUG: using zip command: . {$zipcommand} " . escapeshellarg($imagestreamzippath) . " @" . escapeshellarg($imagestreamcmd_file));
                                    exec("{$zipcommand} " . escapeshellarg($imagestreamzippath) . " @" . escapeshellarg($imagestreamcmd_file));
                                } else {
                                    # Pipe the command file, containing the filenames, to the executable.
                                    exec("{$zipcommand} " . escapeshellarg($imagestreamzippath) . " -@ < " . escapeshellarg($imagestreamcmd_file));
                                }
                            }
                        }
                    }
                    #Create a JPEG if not already in that format
                    $imagestream_file_parts = explode('.', $imagestream_file);
                    $imagestream_file_ext = $imagestream_file_parts[count($imagestream_file_parts) - 1];
                    $imagestream_file_noext = basename($imagestream_file, $imagestream_file_ext);
                    global $imagemagick_path, $imagemagick_quality;
                    $icc_transform_complete = false;
                    # Camera RAW images need prefix
                    if (preg_match('/^(dng|nef|x3f|cr2|crw|mrw|orf|raf|dcr)$/i', $imagestream_file_ext, $rawext)) {
                        $prefix = $rawext[0] . ':';
                    }
                    # Locate imagemagick.
                    $convert_fullpath = get_utility_path("im-convert");
                    if ($convert_fullpath == false) {
                        exit("Could not find ImageMagick 'convert' utility at location '{$imagemagick_path}'.");
                    }
                    $prefix = '';
                    if ($prefix == "cr2:" || $prefix == "nef:") {
                        $flatten = "";
                    } else {
                        $flatten = "-flatten";
                    }
                    $command = $convert_fullpath . ' ' . escapeshellarg($targetDir . DIRECTORY_SEPARATOR . $imagestream_file) . ' +matte ' . $flatten . ' -quality ' . $imagemagick_quality;
                    # EXPERIMENTAL CODE TO USE EXISTING ICC PROFILE IF PRESENT
                    global $icc_extraction, $icc_preview_profile, $icc_preview_options, $ffmpeg_supported_extensions;
                    if ($icc_extraction) {
                        $iccpath = $targetDir . DIRECTORY_SEPARATOR . $imagestream_file . '.icc';
                        if (!file_exists($iccpath) && !isset($iccfound) && $extension != "pdf" && !in_array($imagestream_file_ext, $ffmpeg_supported_extensions)) {
                            // extracted profile doesn't exist. Try extracting.
                            if (extract_icc_profile($ref, $imagestream_file_ext)) {
                                $iccfound = true;
                            } else {
                                $iccfound = false;
                            }
                        }
                    }
                    if ($icc_extraction && file_exists($iccpath) && !$icc_transform_complete) {
                        // we have an extracted ICC profile, so use it as source
                        $targetprofile = dirname(__FILE__) . '/../iccprofiles/' . $icc_preview_profile;
                        $profile = " +profile \"*\" -profile {$iccpath} {$icc_preview_options} -profile {$targetprofile} +profile \"*\" ";
                        $icc_transform_complete = true;
                    } else {
                        // use existing strategy for color profiles
                        # Preserve colour profiles? (omit for smaller sizes)
                        $profile = "+profile \"*\" -colorspace RGB";
                        # By default, strip the colour profiles ('+' is remove the profile, confusingly)
                        #if ($imagemagick_preserve_profiles && $id!="thm" && $id!="col" && $id!="pre" && $id!="scr") {$profile="";}
                    }
                    $runcommand = $command . " +matte {$profile} " . escapeshellarg($imagestream_workingfiles . DIRECTORY_SEPARATOR . "imagestream" . $filenumber . ".jpg");
                    $deletion_array[] = $imagestream_workingfiles . DIRECTORY_SEPARATOR . "imagestream" . $filenumber . ".jpg";
                    $output = run_command($runcommand);
                    debug("processed file" . $filenumber . ": " . $imagestream_file . "\r\n");
                    debug("Image index: " . $imageindex . ". file count: " . count($imagestream_filelist));
                    if ($filenumber == 00) {
                        $snapshotsize = getimagesize($imagestream_workingfiles . DIRECTORY_SEPARATOR . "imagestream" . $filenumber . ".jpg");
                        list($width, $height) = $snapshotsize;
                        # Frame size must be a multiple of two
                        if ($width % 2) {
                            $width++;
                        }
                        if ($height % 2) {
                            $height++;
                        }
                    }
                    if ($imageindex == count($imagestream_filelist) - 1) {
                        $additionalfile = $filenumber + 1;
                        $additionalfile = sprintf("%03d", $additionalfile);
                        copy($imagestream_workingfiles . DIRECTORY_SEPARATOR . "imagestream" . $filenumber . ".jpg", $imagestream_workingfiles . DIRECTORY_SEPARATOR . "imagestream" . $additionalfile . ".jpg");
                        $deletion_array[] = $imagestream_workingfiles . DIRECTORY_SEPARATOR . "imagestream" . $additionalfile . ".jpg";
                    }
                    $filenumber++;
                }
                #end of loop for each uploadedfile
                $imageindex++;
            }
            #Add the resource and move this zip file, set extension
            # Add to collection?
            if ($collection_add != "") {
                add_resource_to_collection($ref, $collection_add);
            }
            # Log this
            daily_stat("Resource upload", $ref);
            resource_log($ref, "u", 0);
            #Change this!!!!!!!!!!!
            #$status=upload_file($ref,true,false,false));
            if (!$config_windows) {
                @chmod($imagestreamzippath, 0777);
            }
            # Store extension in the database and update file modified time.
            sql_query("update resource set file_extension='zip',preview_extension='zip',file_modified=now(), has_image=0 where ref='{$ref}'");
            #update_field($ref,$filename_field,$filename);
            update_disk_usage($ref);
            # create the mp4 version
            # Add a new alternative file
            $aref = add_alternative_file($ref, "MP4 version");
            $imagestreamqtfile = get_resource_path($ref, true, "", false, "mp4", -1, 1, false, "", $aref);
            $shell_exec_cmd = $ffmpeg_fullpath . " -loglevel panic -y -r " . $imagestream_transitiontime . " -i " . $imagestream_workingfiles . DIRECTORY_SEPARATOR . "imagestream%3d.jpg -r " . $imagestream_transitiontime . " -s {$width}x{$height} " . $imagestreamqtfile;
            echo "Running command: " . $shell_exec_cmd;
            if ($config_windows) {
                $shell_exec_cmd = $ffmpeg_fullpath . " -loglevel panic -y -r " . $imagestream_transitiontime . " -i " . $imagestream_workingfiles . DIRECTORY_SEPARATOR . "imagestream%%3d.jpg -r " . $imagestream_transitiontime . " -s {$width}x{$height} " . $imagestreamqtfile;
                file_put_contents(get_temp_dir() . DIRECTORY_SEPARATOR . "imagestreammp4" . $session_hash . ".bat", $shell_exec_cmd);
                $shell_exec_cmd = get_temp_dir() . DIRECTORY_SEPARATOR . "imagestreammp4" . $session_hash . ".bat";
                $deletion_array[] = $shell_exec_cmd;
            }
            run_command($shell_exec_cmd);
            debug("DEBUG created slideshow MP4 video");
            if (!$config_windows) {
                @chmod($imagestreamqtfile, 0777);
            }
            $file_size = @filesize_unlimited($imagestreamqtfile);
            # Save alternative file data.
            sql_query("update resource_alt_files set file_name='quicktime.mp4',file_extension='mp4',file_size='" . $file_size . "',creation_date=now() where resource='{$ref}' and ref='{$aref}'");
            #create the FLV preview as per normal video processing if possible?
            if ($height < $ffmpeg_preview_min_height) {
                $height = $ffmpeg_preview_min_height;
            }
            if ($width < $ffmpeg_preview_min_width) {
                $width = $ffmpeg_preview_min_width;
            }
            if ($height > $ffmpeg_preview_max_height) {
                $width = ceil($width * ($ffmpeg_preview_max_height / $height));
                $height = $ffmpeg_preview_max_height;
            }
            if ($width > $ffmpeg_preview_max_width) {
                $height = ceil($height * ($ffmpeg_preview_max_width / $width));
                $width = $ffmpeg_preview_max_width;
            }
            $flvzippreviewfile = get_resource_path($ref, true, "pre", false, $ffmpeg_preview_extension);
            $shell_exec_cmd = $ffmpeg_fullpath . " -loglevel panic -y -i " . $imagestreamqtfile . " {$ffmpeg_preview_options} -s {$width}x{$height} " . $flvzippreviewfile;
            debug("Running command: " . $shell_exec_cmd);
            if ($config_windows) {
                file_put_contents(get_temp_dir() . DIRECTORY_SEPARATOR . "imagestreamflv" . $session_hash . ".bat", $shell_exec_cmd);
                $shell_exec_cmd = get_temp_dir() . DIRECTORY_SEPARATOR . "imagestreamflv" . $session_hash . ".bat";
                $deletion_array[] = $shell_exec_cmd;
            }
            run_command($shell_exec_cmd);
            debug("DEBUG created slideshow FLV video");
            if (!$config_windows) {
                @chmod($flvzippreviewfile, 0777);
            }
            #Tidy up
            rcRmdir($imagestream_workingfiles);
            rcRmdir($targetDir);
            foreach ($deletion_array as $tmpfile) {
                debug("\r\nDEBUG: Deleting: " . $tmpfile);
                delete_exif_tmpfile($tmpfile);
            }
            echo "SUCCESS";
            #return true;
            exit;
        } else {
            echo "SUCCESS";
            exit;
        }
        return true;
    } else {
        return false;
    }
}
Пример #5
0
function HookVideo_spliceViewAfterresourceactions()
{
    global $videosplice_resourcetype, $resource, $lang, $config_windows, $resourcetoolsGT;
    if ($resource["resource_type"] != $videosplice_resourcetype) {
        return false;
    }
    # Not the right type.
    if (getval("video_splice_cut_from_hours", "") != "") {
        # Process actions
        $error = "";
        # Receive input
        $fh = getvalescaped("video_splice_cut_from_hours", "");
        $fm = getvalescaped("video_splice_cut_from_minutes", "");
        $fs = getvalescaped("video_splice_cut_from_seconds", "");
        $th = getvalescaped("video_splice_cut_to_hours", "");
        $tm = getvalescaped("video_splice_cut_to_minutes", "");
        $ts = getvalescaped("video_splice_cut_to_seconds", "");
        $preview = getvalescaped("preview", "") != "";
        # Calculate a duration, as needed by FFMPEG
        $from_seconds = $fh * 60 * 60 + $fm * 60 + $fs;
        $to_seconds = $th * 60 * 60 + $tm * 60 + $ts;
        $seconds = $to_seconds - $from_seconds;
        # Any problems?
        if ($seconds <= 0) {
            $error = $lang["error-from_time_after_to_time"];
        }
        # Convert seconds to HH:MM:SS as required by FFmpeg.
        $dh = floor($seconds / (60 * 60));
        $dm = floor(($seconds - $dh * 60 * 60) / 60);
        $ds = floor($seconds - $dh * 60 * 60 - $dm * 60);
        # Show error message if necessary
        if ($error != "") {
            ?>
			<script type="text/javascript">
			alert("<?php 
            echo $error;
            ?>
");
			</script>
			<?php 
        } else {
            # Process video.
            $ss = $fh . ":" . $fm . ":" . $fs;
            $t = str_pad($dh, 2, "0", STR_PAD_LEFT) . ":" . str_pad($dm, 2, "0", STR_PAD_LEFT) . ":" . str_pad($ds, 2, "0", STR_PAD_LEFT);
            # Establish FFMPEG location.
            $ffmpeg_fullpath = get_utility_path("ffmpeg");
            # Work out source/destination
            global $ffmpeg_preview_extension, $ref;
            if (file_exists(get_resource_path($ref, true, "pre", false, $ffmpeg_preview_extension))) {
                $source = get_resource_path($ref, true, "pre", false, $ffmpeg_preview_extension, -1, 1, false, "", -1, false);
            } else {
                $source = get_resource_path($ref, true, "", false, $ffmpeg_preview_extension, -1, 1, false, "", -1, false);
            }
            # Preview only?
            global $userref;
            if ($preview) {
                # Preview only.
                $target = get_temp_dir() . "/video_splice_preview_" . $userref . "." . $ffmpeg_preview_extension;
            } else {
                # Not a preview. Create a new resource.
                $newref = copy_resource($ref);
                $target = get_resource_path($newref, true, "", true, $ffmpeg_preview_extension, -1, 1, false, "", -1, false);
                # Set parent resource field details.
                global $videosplice_parent_field;
                update_field($newref, $videosplice_parent_field, $ref . ": " . $resource["field8"] . " [{$fh}:{$fm}:{$fs} - {$th}:{$tm}:{$ts}]");
                # Set created_by, archive and extension
                sql_query("update resource set created_by='{$userref}',archive=-2,file_extension='" . $ffmpeg_preview_extension . "' where ref='{$newref}'");
            }
            # Unlink the target
            if (file_exists($target)) {
                unlink($target);
            }
            if ($config_windows) {
                # Windows systems have a hard time with the long paths used for video generation.
                $target_ext = strrchr($target, '.');
                $source_ext = strrchr($source, '.');
                $target_temp = get_temp_dir() . "/vs_t" . $newref . $target_ext;
                $target_temp = str_replace("/", "\\", $target_temp);
                $source_temp = get_temp_dir() . "/vs_s" . $ref . $source_ext;
                $source_temp = str_replace("/", "\\", $source_temp);
                copy($source, $source_temp);
                $shell_exec_cmd = $ffmpeg_fullpath . " -y -i " . escapeshellarg($source_temp) . " -ss {$ss} -t {$t} " . escapeshellarg($target_temp);
                $output = exec($shell_exec_cmd);
                rename($target_temp, $target);
                unlink($source_temp);
            } else {
                $shell_exec_cmd = $ffmpeg_fullpath . " -y -i " . escapeshellarg($source) . " -ss {$ss} -t {$t} " . escapeshellarg($target);
                $output = exec($shell_exec_cmd);
            }
            #echo "<p>" . $shell_exec_cmd . "</p>";
            # Generate preview/thumbs if not in preview mode
            if (!$preview) {
                include_once "../include/image_processing.php";
                create_previews($newref, false, $ffmpeg_preview_extension);
                # Add the resource to the user's collection.
                global $usercollection, $baseurl;
                add_resource_to_collection($newref, $usercollection);
                ?>
				<script type="text/javascript">
				top.collections.location.href="<?php 
                echo $baseurl;
                ?>
/pages/collections.php?nc=<?php 
                echo time();
                ?>
";
				</script>
				<?php 
            }
        }
    }
    ?>
<li><a href="#" onClick="
if (document.getElementById('videocut').style.display=='block') {document.getElementById('videocut').style.display='none';} else {document.getElementById('videocut').style.display='block';} return false;"><?php 
    echo ($resourcetoolsGT ? "&gt; " : "") . $lang["action-cut"];
    ?>
</a></li>
<form id="videocut" style="<?php 
    if (!(isset($preview) && $preview)) {
        ?>
display:none;<?php 
    }
    ?>
padding:10px 0 3px 0;" method="post">

<table>
<tr>
<td><?php 
    echo $lang["from-time"];
    ?>
</td>
<td><?php 
    echo $lang["hh"];
    ?>
<select name="video_splice_cut_from_hours">
<?php 
    for ($n = 0; $n < 100; $n++) {
        ?>
<option <?php 
        if (isset($fh) && $fh == $n) {
            ?>
selected<?php 
        }
        ?>
><?php 
        echo str_pad($n, 2, "0", STR_PAD_LEFT);
        ?>
</option><?php 
    }
    ?>
</select></td>
<td><?php 
    echo $lang["mm"];
    ?>
<select name="video_splice_cut_from_minutes">
<?php 
    for ($n = 0; $n < 60; $n++) {
        ?>
<option <?php 
        if (isset($fm) && $fm == $n) {
            ?>
selected<?php 
        }
        ?>
><?php 
        echo str_pad($n, 2, "0", STR_PAD_LEFT);
        ?>
</option><?php 
    }
    ?>
</select></td>
<td><?php 
    echo $lang["ss"];
    ?>
<select name="video_splice_cut_from_seconds">
<?php 
    for ($n = 0; $n < 60; $n++) {
        ?>
<option <?php 
        if (isset($fs) && $fs == $n) {
            ?>
selected<?php 
        }
        ?>
><?php 
        echo str_pad($n, 2, "0", STR_PAD_LEFT);
        ?>
</option><?php 
    }
    ?>
</select></td>
</tr>

<tr>
<td><?php 
    echo $lang["to-time"];
    ?>
</td>
<td><?php 
    echo $lang["hh"];
    ?>
<select name="video_splice_cut_to_hours">
<?php 
    for ($n = 0; $n < 100; $n++) {
        ?>
<option <?php 
        if (isset($th) && $th == $n) {
            ?>
selected<?php 
        }
        ?>
><?php 
        echo str_pad($n, 2, "0", STR_PAD_LEFT);
        ?>
</option><?php 
    }
    ?>
</select></td>
<td><?php 
    echo $lang["mm"];
    ?>
<select name="video_splice_cut_to_minutes">
<?php 
    for ($n = 0; $n < 60; $n++) {
        ?>
<option <?php 
        if (isset($tm) && $tm == $n) {
            ?>
selected<?php 
        }
        ?>
><?php 
        echo str_pad($n, 2, "0", STR_PAD_LEFT);
        ?>
</option><?php 
    }
    ?>
</select></td>
<td><?php 
    echo $lang["ss"];
    ?>
<select name="video_splice_cut_to_seconds">
<?php 
    for ($n = 0; $n < 60; $n++) {
        ?>
<option <?php 
        if (isset($ts) && $ts == $n) {
            ?>
selected<?php 
        }
        ?>
><?php 
        echo str_pad($n, 2, "0", STR_PAD_LEFT);
        ?>
</option><?php 
    }
    ?>
</select></td>
</tr>

<tr><td colspan=4 align="center">
<input type="submit" name="preview" value="<?php 
    echo $lang["action-preview"];
    ?>
" style="width:40%;">
&nbsp;&nbsp;
<input type="submit" name="cut" value="<?php 
    echo $lang["action-cut"];
    ?>
" style="width:40%;">
</td></tr>

</table>

<?php 
    if (isset($preview) && $preview) {
        # Show the preview
        # Work out a colour theme
        global $userfixedtheme;
        $theme = isset($userfixedtheme) && $userfixedtheme != "" ? $userfixedtheme : getval("colourcss", "greyblu");
        $colour = "505050";
        if ($theme == "greyblu") {
            $colour = "446693";
        }
        global $baseurl;
        # Embedded preview player
        ?>
	<p align="center">
	<object type="application/x-shockwave-flash" data="../lib/flashplayer/player_flv_maxi.swf" width="240" height="135">
    <param name="allowFullScreen" value="true" />
	
     <param name="movie" value="../lib/flashplayer/player_flv_maxi.swf" />
     <param name="FlashVars" value="flv=<?php 
        echo convert_path_to_url($target);
        ?>
&amp;width=240&amp;height=135&amp;margin=0&amp;buffer=10&amp;showvolume=0&amp;volume=200&amp;showtime=0&amp;autoplay=1&amp;autoload=1&amp;showfullscreen=0&amp;showstop=0&amp;playercolor=<?php 
        echo $colour;
        ?>
" />
	</object>
	</p>
	<?php 
    }
    ?>



</form>

	<?php 
    return true;
}
Пример #6
0
    }
    ?>
	top.collections.location.href="<?php 
    echo $baseurl;
    ?>
/pages/collections.php?nc=<?php 
    echo time();
    ?>
";
	<?php 
    exit;
}
# Fetch videos
$videos = do_search("!collection" . $usercollection);
if (getval("splice", "") != "" && count($videos) > 1) {
    $ref = copy_resource($videos[0]["ref"]);
    # Base new resource on first video (top copy metadata).
    # Set parent resource field details.
    global $videosplice_parent_field;
    $resources = "";
    for ($n = 0; $n < count($videos); $n++) {
        if ($n > 0) {
            $resources .= ", ";
        }
        $crop_from = get_data_by_field($videos[$n]["ref"], $videosplice_parent_field);
        $resources .= $videos[$n]["ref"] . ($crop_from != "" ? " " . str_replace("%resourceinfo", $crop_from, $lang["cropped_from_resource"]) : "");
    }
    $history = str_replace("%resources", $resources, $lang["merged_from_resources"]);
    update_field($ref, $videosplice_parent_field, $history);
    # Establish FFMPEG location.
    $ffmpeg_fullpath = get_utility_path("ffmpeg");
Пример #7
0
 * Copy resource page (part of Team Center)
 * 
 * @package ResourceSpace
 * @subpackage Pages_Team
 */
include "../../include/db.php";
include "../../include/authenticate.php";
if (!checkperm("c")) {
    exit("Permission denied.");
}
include "../../include/general.php";
include "../../include/resource_functions.php";
# Fetch user data
if (getval("from", "") != "") {
    # Copy data
    $to = copy_resource(getvalescaped("from", ""));
    if ($to === false) {
        $error = true;
    } else {
        redirect($baseurl_short . "pages/edit.php?ref=" . $to);
    }
}
include "../../include/header.php";
?>
<div class="BasicsBox">
<h1><?php 
echo $lang["copyresource"];
?>
</h1>

<p><?php 
Пример #8
0
       else
       {
        if ((getval("uploader","")!="")&&(getval("uploader","")!="local"))
        {
                    # Save button pressed? Move to next step.
          if (getval("save","")!="") {redirect($baseurl_short."pages/upload_" . getval("uploader","") . ".php?collection_add=" . getval("collection_add","")."&entercolname=".urlencode(getvalescaped("entercolname",""))."&resource_type=" . urlencode($resource_type) . "&status=" . $setarchivestate .  "&no_exif=" . urlencode($no_exif) . "&autorotate=" . urlencode($autorotate) . "&themestring=" . urlencode(getval('themestring','')) . "&public=" . urlencode(getval('public','')) . "&archive=" . urlencode($archive) . $uploadparams . hook("addtouploadurl"));}
       }
                elseif ((getval("local","")!="")||(getval("uploader","")=="local")) // Test if fetching resource from local upload folder.
                {
                    # Save button pressed? Move to next step.
                   if (getval("save","")!="") {redirect($baseurl_short."pages/team/team_batch_select.php?use_local=yes&collection_add=" . getval("collection_add","")."&entercolname=".urlencode(getvalescaped("entercolname",""))."&resource_type=". urlencode($resource_type) . "&status=" . $setarchivestate .  "&no_exif=" . $no_exif . "&autorotate=" . $autorotate . $uploadparams );}
                }
                elseif (getval("single","")!="") // Test if single upload (archived or not).
                {
                    # Save button pressed? Move to next step. if noupload is set - create resource without uploading stage
                   if ((getval("noupload","")!="")&&(getval("save","")!="")) {$ref=copy_resource(0-$userref);redirect($baseurl_short."pages/view.php?ref=". urlencode($ref));}

                   if (getval("save","")!="") {redirect($baseurl_short."pages/upload.php?resource_type=". urlencode($resource_type) . "&status=" . $setarchivestate .  "&no_exif=" . $no_exif . "&autorotate=" . urlencode($autorotate) . "&archive=" . urlencode($archive) . $uploadparams );}
                }    
                else // Hence fetching from ftp.
                {
                    # Save button pressed? Move to next step.
                   if (getval("save","")!="") {redirect($baseurl_short."pages/team/team_batch.php?collection_add=" . getval("collection_add","")."&entercolname=".urlencode(getvalescaped("entercolname","")). "&resource_type=". urlencode($resource_type) . "&status=" . $setarchivestate .  "&no_exif=" . $no_exif . "&autorotate=" . urlencode($autorotate) . $uploadparams );}
                }
             }
          }
          elseif (getval("save","")!="")
          {           
            $show_error=true;
         }
      }
Пример #9
0
function new_item($arr, $oldid = '', $oldsku = '')
{
    global $dbh, $log, $img_dir;
    // first check for pre-existing product entry
    if ($oldsku != 'US-1011-00') {
        $query = "SELECT * FROM items WHERE sku='{$arr['sku']}'" . ($oldid ? " OR old_id='{$oldid}'" : '');
        if (!($res = $dbh->query($query))) {
            return false;
        }
        if ($res->num_rows > 0) {
            print "Skipping product {$arr['sku']} - already exists\n{$query}\n";
            fwrite($log, "DUPLICATE product exists in 'items' {$arr['sku']} - {$oldid} - SKIPPING PRODUCT\n");
            return false;
        }
    }
    if (!($newid = insert_item($arr))) {
        fwrite($log, "FAILED on insert of 'items' {$arr['sku']} - {$oldsku} :: " . $dbh->error . "\n");
        return false;
    } elseif ($oldid) {
        if (!copy_times($oldid, $newid)) {
            fwrite($log, "FAILED on insert of 'item_availability_times' {$arr['sku']} - {$oldsku} :: " . $dbh->error . "\n");
            return false;
        } elseif (!copy_content($oldid, $newid)) {
            fwrite($log, "FAILED on insert of 'item_content' {$arr['sku']} - {$oldsku} :: " . $dbh->error . "\n");
            return false;
        } elseif (!copy_upsell($oldid, $newid)) {
            fwrite($log, "FAILED on insert of 'item_upselling' {$arr['sku']} - {$oldsku} :: " . $dbh->error . "\n");
            return false;
        } elseif (!copy_resource($oldid, $newid, $arr['sku'])) {
            fwrite($log, "FAILED on insert of 'item_resources' {$arr['sku']} - {$oldsku} :: " . $dbh->error . "\n");
            return false;
        }
        // update the redirect value for the old product
        $query = "UPDATE items SET redirect_sku='{$arr['sku']}' WHERE id='{$oldid}'";
        if (!$dbh->query($query)) {
            fwrite($log, "FAILED to update old 'items' product record for item_id {$oldid} :: " . $dbh->error . "\n");
            return false;
        }
    } else {
        // add item availability record for sets
        $row = array('item_id' => $newid, 'item_availability_id' => 3, 'start_date' => date('Y-m-d H:i:s'));
        $query = "INSERT INTO item_availability_times (" . implode(',', array_keys($row)) . ") VALUES ('" . implode("','", array_values($row)) . "')";
        if (!$dbh->query($query)) {
            return false;
        }
    }
    return $newid;
}