⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 edit.php

📁 php网页设计
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?include "include/db.php";include "include/authenticate.php"; include "include/general.php";include "include/resource_functions.php";include "include/collections_functions.php";include "include/search_functions.php";include "include/image_processing.php";# Editing resource or collection of resources (multiple)?$ref=getvalescaped("ref","");# Fetch search details (for next/back browsing and forwarding of search params)$search=getvalescaped("search","");$order_by=getvalescaped("order_by","relevance");$offset=getvalescaped("offset",0);$restypes=getvalescaped("restypes","");if (strpos($search,"!")!==false) {$restypes="";}$archive=getvalescaped("archive",0);$errors=array(); # The results of the save operation (e.g. required field messages)# next / previous resource browsing$go=getval("go","");if ($go!="")	{	# Re-run the search and locate the next and previous records.	$result=do_search($search,$restypes,$order_by,$archive,72+$offset+1);	if (is_array($result))		{		# Locate this resource		$pos=-1;		for ($n=0;$n<count($result);$n++)			{			if ($result[$n]["ref"]==$ref) {$pos=$n;}			}		if ($pos!=-1)			{			if (($go=="previous") && ($pos>0)) {$ref=$result[$pos-1]["ref"];}			if (($go=="next") && ($pos<($n-1))) {$ref=$result[$pos+1]["ref"];if (($pos+1)>=($offset+72)) {$offset=$pos+1;}} # move to next page if we've advanced far enough			}		}	}$collection=getvalescaped("collection","");if ($collection!="") 	{	# If editing multiple items, use the first resource as the template	$multiple=true;	$items=get_collection_resources($collection);	if (count($items)==0) {exit("You cannot edit an empty collection.");}	$ref=$items[0];	}else	{	$multiple=false;	}if (getval("regenexif","")!="")	{	extract_exif_comment($ref);	}# Fetch resource data.$resource=get_resource_data($ref);# Not allowed to edit this resource?if ((!checkperm("e" . $resource["archive"])) && ($ref>0)) {exit ("Permission denied.");}if (getval("regen","")!="")	{	create_previews($ref,false,$resource["file_extension"]);	}	if (getval("submitted","")!="")	{	# save data	if (!$multiple)		{		# Batch upload - change resource type		if (getval("swf","")!="")			{			$resource_type=getvalescaped("resource_type","");			update_resource_type($ref,$resource_type);			}				$save_errors=save_resource_data($ref,$multiple);			if (($save_errors===true)&&(getval("tweak","")==""))			{			if ($ref>0)				{				# Log this							daily_stat("Resource edit",$ref);				redirect("view.php?ref=" . $ref . "&search=" . urlencode($search) . "&offset=" . $offset . "&order_by=" . $order_by . "&archive=" . $archive);				}			else				{				if (getval("swf","")!="")					{					# Save button pressed? Move to next step.					if (getval("save","")!="") {redirect("upload_swf.php");}					}				else					{					# Save button pressed? Move to next step.					if (getval("save","")!="") {redirect("team_batch.php");}					}				}			}		elseif (getval("save","")!="")			{			?>			<script type="text/javascript">			alert('<?=$lang["requiredfields"]?>');			</script>			<?			}		}	else		{		# Save multiple resources		save_resource_data_multi($collection);		redirect("search.php?refreshcollectionframe=true&search=!collection" . $collection);		}	}if (getval("tweak","")!="")	{	$tweak=getval("tweak","");	switch($tweak)		{		case "rotateclock":		tweak_preview_images($ref,270,0,$resource["preview_extension"]);		break;		case "rotateanti":		tweak_preview_images($ref,90,0,$resource["preview_extension"]);		break;		case "gammaplus":		tweak_preview_images($ref,0,1.3,$resource["preview_extension"]);		break;		case "gammaminus":		tweak_preview_images($ref,0,0.7,$resource["preview_extension"]);		break;		case "restore":		create_previews($ref,false,$resource["file_extension"]);		break;		}	}include "include/header.php";?><div class="BasicsBox"> <form method="post" id="mainform"><input type="hidden" name="submitted" value="true"><? if ($multiple) { ?><h1><?=$lang["editmultipleresources"]?></h1><p><?=count($items)?> <?=$lang["resourcesselected"]?>. <?=text("multiple")?></p><? } elseif ($ref>0) { ?><h1><?=$lang["editresource"]?></h1><? if (!$multiple) { # Resource next / back browsing.?><div class="TopInpageNav"><a href="edit.php?ref=<?=$ref?>&search=<?=urlencode($search)?>&offset=<?=$offset?>&order_by=<?=$order_by?>&archive=<?=$archive?>&go=previous">&lt;&nbsp;<?=$lang["previousresult"]?></a>|<a href="search.php<? if (strpos($search,"!")!==false) {?>?search=<?=urlencode($search)?>&offset=<?=$offset?>&order_by=<?=$order_by?><? } ?>"><?=$lang["viewallresults"]?></a>|<a href="edit.php?ref=<?=$ref?>&search=<?=urlencode($search)?>&offset=<?=$offset?>&order_by=<?=$order_by?>&archive=<?=$archive?>&go=next"><?=$lang["nextresult"]?>&nbsp;&gt;</a></div><? } ?><div class="Question" style="border-top:none;"><label><?=$lang["resourceid"]?></label><div class="Fixed"><?=$ref?></div><div class="clearerleft"> </div></div><div class="Question"><label><? if ($resource["resource_type"]==1) {?><?=$lang["image"]?><?} elseif ($resource["resource_type"]==3) { ?><?=$lang["previewimage"]?><?} else {?><?=$lang["file"]?><?}?></label><? if ($resource["has_image"]==1) { ?><img align="top" src="<?=get_resource_path($ref,"thm",false,$resource["preview_extension"],-1,1,checkperm("w"))?>?nc=<?=time()?>" class="ImageBorder" style="margin-right:10px;"/><? } elseif ($resource["file_extension"]!="") { ?><strong><?=strtoupper($resource["file_extension"] . " " . $lang["file"]) . " (" . formatfilesize(@filesize(get_resource_path($ref,"",false,$resource["file_extension"]))) . ")" ?></strong><? } ?><a href="upload.php?ref=<?=$ref?>">&gt;&nbsp;<?=$lang["uploadafile"]?></a></div><? if ($resource["has_image"]==1) { ?><div class="Question"><label><?=$lang["imagecorrection"]?><br/><?=$lang["previewthumbonly"]?></label><select class="stdwidth" name="tweak" id="tweak" onChange="document.getElementById('mainform').submit();"><option value=""><?=$lang["select"]?></option><option value="rotateclock"><?=$lang["rotateclockwise"]?></option><option value="rotateanti"><?=$lang["rotateanticlockwise"]?></option><option value="gammaplus"><?=$lang["increasegamma"]?></option><option value="gammaminus"><?=$lang["decreasegamma"]?></option><option value="restore"><?=$lang["restoreoriginal"]?></option></select><div class="clearerleft"> </div></div><? } ?><? } else { # For batch uploads, specify default content (writes to resource with ID [negative user ref]) ?><h1><?=$lang["specifydefaultcontent"]?></h1><p><?=text("batch")?></p><? if (getval("swf","")!="") { # We need to ask for the resource type here for SWFUploads?><div class="Question"><label for="resourcetype"><?=$lang["resourcetype"]?></label><select name="resource_type" id="resourcetype" class="shrtwidth" onChange="document.getElementById('mainform').submit();"><?$types=get_resource_types();for ($n=0;$n<count($types);$n++)	{	?><option value="<?=$types[$n]["ref"]?>" <? if (getval("resource_type","")==$types[$n]["ref"]) {?>selected<? } ?>><?=$types[$n]["name"]?></option><?	}?></select><div class="clearerleft"> </div></div><? } ?><? } ?><?$lastrt=-1;# Batch uploads - "copy data from" featureif ($ref<0)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -