Beispiel #1
0
        }
        // 			$result_msg = "Error downloading file: ".$_POST['upload_url'].$infoStr;
        $result_msg = "<font color='red'><b>" . __("Upload Unsuccessful", $flutter_domain) . "!</b></font>";
    } else {
        // 			$result_msg = 'The URL '.$_POST['upload_url'].' was downloaded successfuly. Please remember to click the save button.';
        $result_msg = "<font color='green'><b>" . __("Successful upload", $flutter_domain) . "!</b></font>";
        $operationSuccess = "true";
    }
    include_once "RCCWP_WritePostPage.php";
    $edit_anchor = RCCWP_WritePostPage::snipshot_anchor(FLUTTER_FILES_URI . $filename);
    echo $result_msg . "*" . $filename . "*" . $edit_anchor;
}
if (isset($_FILES['async-upload'])) {
    if ($_FILES['async-upload']['error'] == UPLOAD_ERR_OK) {
        $special_chars = array(' ', '`', '"', '\'', '\\', '/', " ", "#", "\$", "%", "^", "&", "*", "!", "~", "‘", "\"", "’", "'", "=", "?", "/", "[", "]", "(", ")", "|", "<", ">", ";", "\\", ",");
        $filename = str_replace($special_chars, '', $_FILES['async-upload']['name']);
        $filename = time() . $filename;
        @move_uploaded_file($_FILES['async-upload']['tmp_name'], FLUTTER_FILES_PATH . $filename);
        @chmod(FLUTTER_FILES_PATH . $filename, 0644);
        // 		$result_msg = 'The file '.$_FILES['Filedata']['name'].' was uploaded successfuly. Please remember to click the save button.';
        $result_msg = "<font color='green'><b>" . __("Successful upload", $flutter_domain) . "!</b></font>";
        $operationSuccess = "true";
    } elseif ($_FILES['Filedata']['error'] == UPLOAD_ERR_INI_SIZE) {
        $result_msg = __('The uploaded file exceeds the maximum upload limit', $flutter_domain);
    } else {
        $result_msg = "<font color='red'><b>" . __("Upload Unsuccessful", $flutter_domain) . "!</b></font>";
    }
    include_once "RCCWP_WritePostPage.php";
    $edit_anchor = RCCWP_WritePostPage::snipshot_anchor(FLUTTER_FILES_URI . $filename);
    echo $result_msg . "*" . $filename . "*" . $edit_anchor;
}
Beispiel #2
0
    ?>
){
			par.getElementById("<?php 
    echo $_POST["input_name"];
    ?>
").value = "<?php 
    echo $filename;
    ?>
";
			
			//Set image
			<?php 
    //$newImagePath = FLUTTER_URI.'phpThumb.php
    $newImagePath = PHPTHUMB . '?&w=150&h=120&src=' . FLUTTER_FILES_PATH . $filename;
    include_once "RCCWP_WritePostPage.php";
    $edit_anchor = RCCWP_WritePostPage::snipshot_anchor($newImagePath);
    if (isset($_POST['imageThumbID'])) {
        ?>
				if( par.getElementById('<?php 
        echo $_POST['imageThumbID'];
        ?>
') )
				{ 
					par.getElementById('<?php 
        echo $_POST['imageThumbID'];
        ?>
').src = "<?php 
        echo $newImagePath;
        ?>
";
					//var s = "<a class='thickbox' href='#impossible_location' onclick=\"call_thickbox('<?php 
Beispiel #3
0
    function PhotoInterface($customField, $inputName, $groupCounter, $fieldCounter)
    {
        global $flutter_domain;
        $customFieldId = '';
        // <---- ¿?
        $filepath = $inputName . '_filepath';
        /// <---- ¿?
        $noimage = "";
        // <---- if no exists image?
        $freshPageFolderName = dirname(plugin_basename(__FILE__));
        if ($customField->required_field) {
            $requiredClass = "field_required";
        }
        //global $countImageThumbID;
        $imageThumbID = "";
        $imageThumbID = "img_thumb_" . $inputName;
        if (isset($_REQUEST['post'])) {
            $customFieldId = $customField->id;
            $value = RCCWP_CustomField::GetCustomFieldValues(true, $_REQUEST['post'], $customField->name, $groupCounter, $fieldCounter);
            $path = PHPTHUMB . "?src=" . FLUTTER_FILES_PATH;
            $valueRelative = $value;
            $value = $path . $value;
            if (!(strpos($value, 'http') === FALSE)) {
                $hidValue = str_replace('"', "'", $valueRelative);
            }
            $value = stripslashes(trim("\\<img src=\\'" . $value . "\\' class=\"freshout\" \\/\\>"));
        } else {
            if (!empty($customField->value)) {
                $path = PHPTHUMB . "?src=" . FLUTTER_FILES_PATH;
                $valueRelative = $customField->value;
                $value = $path . $customField->value;
                if (!(strpos($value, 'http') === FALSE)) {
                    $hidValue = str_replace('"', "'", $valueRelative);
                    $value = stripslashes(trim("\\<img src=\\'" . $value . "\\' class=\"freshout\" \\/\\>"));
                }
            } else {
                $noimage = "<img src='" . FLUTTER_URI . "images/noimage.jpg' id='" . $imageThumbID . "'/>";
            }
        }
        if ($valueRelative == '') {
            $noimage = "<img src='" . FLUTTER_URI . "images/noimage.jpg' id='" . $imageThumbID . "'/>";
        }
        include_once 'RCCWP_Options.php';
        $useSnipshot = RCCWP_Options::Get('use-snipshot');
        // If the field is at right, set a constant width to the text box
        $field_group = RCCWP_CustomGroup::Get($customField->group_id);
        $urlInputSize = false;
        $is_canvas = 0;
        if ($field_group->at_right) {
            $urlInputSize = 5;
            $is_canvas = 1;
        }
        ?>

		<p class="error_msg_txt" id="upload_progress_<?php 
        echo $inputName;
        ?>
" style="visibility:hidden;height:0px"></p>
		

        <!--- This Script is for remove the image -->
	    <script type="text/javascript">
             remove_photo2 = function(ide){
                if(confirm("<?php 
        _e('Are you sure?', $flutter_domain);
        ?>
")){
                        //get the  name to the image
                        //id = ide.split("-")[1];
                        id = ide;
                        image = jQuery('#'+id).val();
                        jQuery.get('<?php 
        echo FLUTTER_URI;
        ?>
RCCWP_removeFiles.php',{'action':'delete','file':image},
                                    function(message){
                                        if(message == "true"){
                                            photo = "img_thumb_" + id;
                                            jQuery("#"+photo).attr("src","<?php 
        echo FLUTTER_URI . "images/noimage.jpg";
        ?>
");
                                            jQuery("#photo_edit_link_"+id).empty();
                                            jQuery("#"+id).val("");

                                        }
                                    });
                    }
            }

            remove_photo = function(){
                if(confirm("<?php 
        _e('Are you sure?', $flutter_domain);
        ?>
")){
                        //get the  name to the image
                        id = jQuery(this).attr('id').split("-")[1];
                        image = jQuery('#'+id).val();
                        jQuery.get('<?php 
        echo FLUTTER_URI;
        ?>
RCCWP_removeFiles.php',{'action':'delete','file':image},
                                    function(message){
                                        if(message == "true"){
                                            photo = "img_thumb_" + id;
                                            jQuery("#"+photo).attr("src","<?php 
        echo FLUTTER_URI . "images/noimage.jpg";
        ?>
");
                                            jQuery("#photo_edit_link_"+id).empty();
                                            jQuery("#"+id).val("");

                                        }
                                    });
                    }
            }

            jQuery(document).ready(function(){
                jQuery(".remove").click(remove_photo);
            });
        </script>
        <!-- Here finish -->


		<div id="image_photo" style="width:150px;">
		
			<?php 
        if ($valueRelative != "") {
            if (!(strpos($value, '<img src') === FALSE)) {
                $valueLinkArr = explode("'", $value);
                $valueLink = $valueLinkArr[1];
                //$valueLink = $value;
                if (!(strpos($value, '&sw') === FALSE)) {
                    // Calculating Image Width/Height
                    $arrSize = explode("=", $value);
                    $arrSize1 = explode("&", $arrSize[3]);
                    $arrSize2 = explode("&", $arrSize[4]);
                    $imageWidth = $arrSize1[0];
                    $imageHeight = $arrSize2[0];
                    // END
                    $valueArr = explode("&sw", $value);
                    $valueArr = explode("'", $valueArr[1]);
                    $value = str_replace("&sw" . $valueArr[0] . "'", "&sw" . $valueArr[0] . "&w=150&h=120' align='center' id='" . $imageThumbID . "'", $value);
                } else {
                    if (!(strpos($value, '&w') === FALSE)) {
                        // Calculating Image Width/Height
                        $arrSize = explode("=", $value);
                        $arrSize1 = explode("&", $arrSize[3]);
                        $arrSize2 = explode("'", $arrSize[4]);
                        $imageWidth = $arrSize1[0];
                        $imageHeight = $arrSize2[0];
                        // END
                        $valueArr = explode("&", $value);
                        $valueArr = explode("'", $valueArr[2]);
                        $value = str_replace($valueArr[0], "&w=150&h=120' align='left' id='" . $imageThumbID . "'", $value);
                    } else {
                        // Calculating Image Width/Height
                        $arrSize = explode("&", $params);
                        $arrSize1 = explode("=", $arrSize[1]);
                        $arrSize2 = explode("=", $arrSize[2]);
                        $imageWidth = $arrSize1[1];
                        $imageHeight = $arrSize2[1];
                        // END
                        $valueArr = explode("'", $value);
                        $value = str_replace($valueArr[1], $valueArr[1] . "&w=150' id='" . $imageThumbID . "' align='", $value);
                    }
                }
                if (!empty($imageWidth)) {
                    ?>

						<?php 
                }
                echo '<a style="display: block;margin-left: auto;margin-right: auto " href="' . $valueLink . '" target="_blank">' . $value . '</a>';
            }
        }
        echo $noimage;
        $arrSize = explode("phpThumb.php?src=", $valueLink);
        $fileLink = $arrSize[1];
        $andPos = strpos($arrSize[1], "?");
        if ($andPos === FALSE) {
            $andPos = strpos($arrSize[1], "&");
        }
        // Remove & parameters from file path
        if ($andPos > 0) {
            $fileLink = substr($arrSize[1], 0, $andPos);
        }
        $ext = substr($fileLink, -3, 3);
        ?>
	
		
		<div id="photo_edit_link_<?php 
        echo $inputName;
        ?>
" class="photo_edit_link"> 
			
				<?php 
        if (isset($_REQUEST['post']) && $hidValue != '') {
            if (False) {
                echo "<a href='" . RCCWP_WritePostPage::snipshot_anchor($fileLink) . "' class='thickbox' tittle='Flutter'<strong onclick=prepareUpdatePhoto('{$inputName}')>" . __("Edit", $flutter_domain) . "</strong> </a>";
            } else {
                $cropperLink = FLUTTER_URI . "cropper.php?input_name=" . urlencode($inputName) . "&id=" . urlencode($hidValue) . "&url=" . urlencode($_SERVER['REQUEST_URI']) . "&imageThumbId={$imageThumbID}";
                ?>
						<a  rel="gb_page_fs[]" href="<?php 
                echo $cropperLink;
                ?>
" title="Flutter" class="greybox" id="lnkCropper"> <strong><?php 
                _e('Crop', $flutter_domain);
                ?>
</strong> </a>
				<?php 
            }
            echo "&nbsp;<strong><a href='#remove' class='remove' id='remove-{$inputName}'>" . __("Delete", $flutter_domain) . "</a></strong>";
        }
        ?>
			
		    </div>
		</div>
		<br />
		<div id="image_input">
					
			<input tabindex="3" 
				id="<?php 
        echo $inputName;
        ?>
" 
				name="<?php 
        echo $inputName;
        ?>
" 
				type="hidden" 
				class="<?php 
        echo $requiredClass;
        ?>
"
				size="46"
				value="<?php 
        echo $hidValue;
        ?>
"
				/>
			
			<?php 
        include_once "RCCWP_SWFUpload.php";
        RCCWP_SWFUpload::Body($inputName, 1, $is_canvas, $urlInputSize);
        ?>

		</div>
		
		<input type="hidden" name="rc_cwp_meta_photos[]" value="<?php 
        echo $inputName;
        ?>
" 	/>
		<input type="hidden" name="<?php 
        echo $inputName;
        ?>
_dorename" id="<?php 
        echo $inputName;
        ?>
_dorename" value="0" />
		

		<!-- Used to store name of URL Field -->
		<!--<input type="hidden" name="parent_text_<?php 
        echo $countImageThumbID;
        ?>
" id="parent_text_<?php 
        echo $countImageThumbID;
        ?>
" value="<?php 
        echo $filepath;
        ?>
"/>
		<input type="hidden" name="hidImgValue<?php 
        echo $countImageThumbID;
        ?>
" id="hidImgValue<?php 
        echo $countImageThumbID;
        ?>
" value="<?php 
        echo $inputName;
        ?>
_last" />-->

		<?php 
    }