当前位置: 首页>>代码示例>>PHP>>正文


PHP get_resource_data函数代码示例

本文整理汇总了PHP中get_resource_data函数的典型用法代码示例。如果您正苦于以下问题:PHP get_resource_data函数的具体用法?PHP get_resource_data怎么用?PHP get_resource_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_resource_data函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: savetoelastic

function savetoelastic($ref){
global $baseurl, $pagename;
if($pagename != "upload2"){
//error_log($ref);
   $results=array();
   $results[] = get_resource_data($ref,false);
   $resourcetype=get_resource_type_name($results[0]['resource_type']);
   if($resourcetype != "Audio"){
     $thethumb = $baseurl.str_replace("/var/www/include/..","",get_resource_path($ref,true,"thm",false,"jpg"));
     if(!file_exists($thethumb)){
       $thethumb = $results[0]["thumbnail"] = $baseurl."/gfx/no_preview/extension/".$results[0]['file_extension'].".png";
     }
     $results[0]["thumbnail"]=$thethumb;
   }else{
     $results[0]["thumbnail"] = $baseurl."/gfx/no_preview/extension/".$results[0]['file_extension'].".png";
   }
   if($resourcetype == "Audio"){
       $results[0]["preview"]=$baseurl.str_replace("/var/www/include/..","",get_resource_path($ref, true, "", false, "mp3"));
   }else if($resourcetype == "Video"){
       $results[0]["preview"]=$baseurl.str_replace("/var/www/include/..","",get_resource_path($ref, true, "pre", false, "mp4"));
   }
   $results = mia_results($results);
   $results=json_encode($results[0]);
   $query = push_RStoElastic($resourcetype,$ref,$results);
   if($query == false){
       //failed to connect to elastic search
       createcron($attempts=1, $ref);
   }else{
//       var_dump($query);exit();
   }
   return;
}
}
开发者ID:artsmia,项目名称:mia_resourcespace,代码行数:33,代码来源:all.php

示例2: alt_from_resource

function alt_from_resource($source,$target,$name='',$delete=false){
	// Copy a resource as an alt file of another resource
	// alt is the source resource, $ref is the target resource that will get the new alternate
	global $view_title_field;
	$srcdata=get_resource_data($source);
	$srcext = $srcdata['file_extension'];
	$srcpath = get_resource_path($source,true,"",false,$srcext);
	if ($name == ''){
		$name = sql_value("select value from resource_data where resource_type_field = '$view_title_field' and resource = '$source'",'Untitled');
	}

	$description = '';
	if (!file_exists($srcpath)){
		echo "ERROR: File not found.";
		return false;
	} else {

		$file_size = filesize_unlimited($srcpath);
		$altid = add_alternative_file($target,$name,$description="",$file_name="",$file_extension="",$file_size,$alt_type='');
		$newpath = get_resource_path($target,true,"",true,$srcext,-1,1,false,'',$altid);
		copy($srcpath,$newpath);
		# Preview creation for alternative files (enabled via config)
                global $alternative_file_previews;
                if ($alternative_file_previews){
			create_previews($target,false,$srcext,false,false,$altid);
               	}
		if ($delete){
			// we are supposed to delete the original resource when we're done
			# Not allowed to edit this resource? They shouldn't have been able to get here.
			if ((!get_edit_access($source,$srcdata["archive"]))||checkperm('D')) {
				exit ("Permission denied.");
			} else {
				delete_resource($source);
			}
		}
		return true;

	}
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:39,代码来源:resource_to_alt.php

示例3: HookResourceofthedayHomeReplaceslideshow

function HookResourceofthedayHomeReplaceslideshow()
{
    include_once dirname(__FILE__) . "/../inc/rotd_functions.php";
    $rotd = get_resource_of_the_day();
    if ($rotd === false) {
        return false;
    }
    # No ROTD, return false to disable hook and display standard slide show.
    # Fetch resource data
    $resource = get_resource_data($rotd);
    # Fetch title
    $title = sql_value("select value from resource_data where resource='{$rotd}' and resource_type_field=8", "");
    # Fetch caption
    $caption = sql_value("select value from resource_data where resource='{$rotd}' and resource_type_field=18", "");
    # Show resource!
    $pre = get_resource_path($rotd, false, "pre", false, "jpg");
    ?>
	<div class="HomePicturePanel RecordPanel" style="width:350px;padding-left:4px;">
	<a href="view.php?ref=<?php 
    echo $rotd;
    ?>
"><img class="ImageBorder" style="margin-bottom: 10px;" src="<?php 
    echo $pre;
    ?>
" /></a>
	<br />
	<h2 ><?php 
    echo i18n_get_translated(htmlspecialchars($title));
    ?>
</h2>
	<?php 
    echo $caption;
    ?>
	</div>
	<?php 
    return true;
}
开发者ID:vongalpha,项目名称:resourcespace,代码行数:37,代码来源:home.php

示例4: save_proposed_changes

function save_proposed_changes($ref)
{
    global $userref, $auto_order_checkbox, $multilingual_text_fields, $languages, $language;
    # Loop through the field data and save (if necessary)
    $errors = array();
    $fields = get_resource_field_data($ref, false);
    $resource_data = get_resource_data($ref);
    for ($n = 0; $n < count($fields); $n++) {
        if ($fields[$n]["type"] == 2) {
            # construct the value from the ticked boxes
            $val = ",";
            # Note: it seems wrong to start with a comma, but this ensures it is treated as a comma separated list by split_keywords(), so if just one item is selected it still does individual word adding, so 'South Asia' is split to 'South Asia','South','Asia'.
            $options = trim_array(explode(",", $fields[$n]["options"]));
            for ($m = 0; $m < count($options); $m++) {
                $name = $fields[$n]["ref"] . "_" . md5($options[$m]);
                if (getval($name, "") == "yes") {
                    if ($val != ",") {
                        $val .= ",";
                    }
                    $val .= $options[$m];
                }
            }
        } elseif ($fields[$n]["type"] == 4 || $fields[$n]["type"] == 6 || $fields[$n]["type"] == 10) {
            # date type, construct the value from the date/time dropdowns
            $val = sprintf("%04d", getvalescaped("field_" . $fields[$n]["ref"] . "-y", ""));
            if ((int) $val <= 0) {
                $val = "";
            } elseif (($field = getvalescaped("field_" . $fields[$n]["ref"] . "-m", "")) != "") {
                $val .= "-" . $field;
                if (($field = getvalescaped("field_" . $fields[$n]["ref"] . "-d", "")) != "") {
                    $val .= "-" . $field;
                    if (($field = getval("field_" . $fields[$n]["ref"] . "-h", "")) != "") {
                        $val .= " " . $field . ":";
                        if (($field = getvalescaped("field_" . $fields[$n]["ref"] . "-i", "")) != "") {
                            $val .= $field;
                        } else {
                            $val .= "00";
                        }
                    }
                }
            }
        } elseif ($multilingual_text_fields && ($fields[$n]["type"] == 0 || $fields[$n]["type"] == 1 || $fields[$n]["type"] == 5)) {
            # Construct a multilingual string from the submitted translations
            $val = getvalescaped("field_" . $fields[$n]["ref"], "");
            $val = "~" . $language . ":" . $val;
            reset($languages);
            foreach ($languages as $langkey => $langname) {
                if ($language != $langkey) {
                    $val .= "~" . $langkey . ":" . getvalescaped("multilingual_" . $n . "_" . $langkey, "");
                }
            }
        } elseif ($fields[$n]["type"] == 3) {
            $val = getvalescaped("field_" . $fields[$n]["ref"], "");
            // if it doesn't already start with a comma, add one
            if (substr($val, 0, 1) != ',') {
                $val = ',' . $val;
            }
        } else {
            # Set the value exactly as sent.
            $val = getvalescaped("field_" . $fields[$n]["ref"], "");
        }
        # Check for regular expression match
        if (trim(strlen($fields[$n]["regexp_filter"])) >= 1 && strlen($val) > 0) {
            if (preg_match("#^" . $fields[$n]["regexp_filter"] . "\$#", $val, $matches) <= 0) {
                global $lang;
                debug($lang["information-regexp_fail"] . ": -" . "reg exp: " . $fields[$n]["regexp_filter"] . ". Value passed: " . $val);
                if (getval("autosave", "") != "") {
                    exit;
                }
                $errors[$fields[$n]["ref"]] = $lang["information-regexp_fail"] . " : " . $val;
                continue;
            }
        }
        $error = hook("additionalvalcheck", "all", array($fields, $fields[$n]));
        if ($error) {
            global $lang;
            $errors[$fields[$n]["ref"]] = $error;
            continue;
        }
        if (str_replace("\r\n", "\n", $fields[$n]["value"]) !== str_replace("\r\n", "\n", unescape($val))) {
            # This value is different from the value we have on record.
            # Add this to the proposed changes table for the user
            sql_query("insert into propose_changes_data(resource,user,resource_type_field,value) values('{$ref}','{$userref}','" . $fields[$n]["ref"] . "','" . escape_check($val) . "')");
        }
    }
    return true;
}
开发者ID:claytondaley,项目名称:resourcespace,代码行数:87,代码来源:propose_changes_functions.php

示例5: sql_query

     if($exists){
       $query = sql_query("UPDATE resource_data SET value = '$val' WHERE resource = $ref AND resource_type_field = $key");
       if($query === false){
         $qerr[]="UPDATE resource_data SET value = '$val' WHERE resource = $ref AND resource_type_field = $key";
       }
     }else{
       $query = sql_query("INSERT INTO resource_data VALUES ($ref,$key,'$val')");
       if($query === false){
         $qerr[]="INSERT INTO resource_data VALUES ($ref,$key,'$val')";
       }
     }
   }
 }
 if(empty($qerr)){
   $results=array();
   $results[] = get_resource_data($ref,false);
   $thumb_path = array("thumbnail"=>$baseurl.str_replace("/var/www/include/..","",get_resource_path($ref,true,"thm",false,"jpg")));
   $newresults[] = array_merge($thumb_path,$results[0]);
   $results = $newresults;
   $results = mia_results($results);
   $resourcetype=get_resource_type_name($results[0]['resource_type']);
   $results=json_encode($results[0]);
   $query = push_RStoElastic($resourcetype,$ref,$results);
   if($query == false){
       //failed to connect to elastic search
       createcron($attempts=1,$ref);
       echo("Resolved TMS but failed to connect to Elastic Search. A Cron Job for Elastic Search has been instantiated and will try to resolve the issue" . date('d-m-Y h:i:s')."n");
   }else{
       echo("Art Object data was successfully resolved from TMS and added to Elastic Search ".date('d-m-Y h:i:s')."\n");
   }
 }else{
开发者ID:artsmia,项目名称:mia_resourcespace,代码行数:31,代码来源:cron_tms.php

示例6: HookAnnotatePreviewPreviewimage2

function HookAnnotatePreviewPreviewimage2()
{
    global $ajax, $ext, $baseurl, $ref, $k, $search, $offset, $order_by, $sort, $archive, $lang, $download_multisize, $baseurl, $url, $path, $path_orig, $annotate_ext_exclude, $annotate_rt_exclude, $annotate_public_view, $annotate_pdf_output;
    if (getval("alternative", "") != "") {
        return false;
    }
    $resource = get_resource_data($ref);
    if (in_array($resource['file_extension'], $annotate_ext_exclude)) {
        return false;
    }
    if (in_array($resource['resource_type'], $annotate_rt_exclude)) {
        return false;
    }
    if (!($k == "") && !$annotate_public_view) {
        return false;
    }
    if (!file_exists($path) && !file_exists($path_orig)) {
        return false;
    }
    if (!file_exists($path)) {
        $sizes = getimagesize($path_orig);
    } else {
        $sizes = getimagesize($path);
    }
    $w = $sizes[0];
    $h = $sizes[1];
    ?>

<script type="text/javascript">
    button_ok = "<?php 
    echo preg_replace("/\r?\n/", "\\n", addslashes($lang["ok"]));
    ?>
";
    button_cancel = "<?php 
    echo preg_replace("/\r?\n/", "\\n", addslashes($lang["cancel"]));
    ?>
";
    button_delete = "<?php 
    echo preg_replace("/\r?\n/", "\\n", addslashes($lang["action-delete"]));
    ?>
";
    button_add = "&gt&nbsp;<?php 
    echo preg_replace("/\r?\n/", "\\n", addslashes($lang["action-add_note"]));
    ?>
";		
    button_toggle = "&gt;&nbsp;<?php 
    echo preg_replace("/\r?\n/", "\\n", addslashes($lang["action-toggle-on"]));
    ?>
";
    button_toggle_off = "&gt;&nbsp;<?php 
    echo preg_replace("/\r?\n/", "\\n", addslashes($lang["action-toggle-off"]));
    ?>
";
    error_saving = "<?php 
    echo preg_replace("/\r?\n/", "\\n", addslashes($lang["error-saving"]));
    ?>
";
    error_deleting = "<?php 
    echo preg_replace("/\r?\n/", "\\n", addslashes($lang["error-deleting"]));
    ?>
";
</script>
<script>
     jQuery.noConflict();
</script>

<div id="wrapper" style="display:block;clear:none;float:left;margin: 0px;">
<div>
		<img id="toAnnotate" onload="annotate(<?php 
    echo $ref;
    ?>
,'<?php 
    echo $k;
    ?>
','<?php 
    echo $w;
    ?>
','<?php 
    echo $h;
    ?>
',<?php 
    echo getvalescaped("annotate_toggle", true);
    ?>
);" src="<?php 
    echo $url;
    ?>
" id="previewimage" class="Picture" GALLERYIMG="no" style="display:block;"   />
	</div>

<div style="padding-top:5px;">



     <?php 
    // MAGICTOUCH PLUGIN COMPATIBILITY
    global $magictouch_account_id;
    if ($magictouch_account_id != "") {
        global $plugins;
        global $magictouch_rt_exclude;
        global $magictouch_ext_exclude;
//.........这里部分代码省略.........
开发者ID:chandradrupal,项目名称:resourcespace,代码行数:101,代码来源:preview.php

示例7: exit

    exit("Permission denied");
}
set_time_limit(0);
if (!$exiftool_resolution_calc) {
    die("Please turn on the exiftool resolution calculator in your config.php file.");
} else {
    $exiftool_fullpath = get_utility_path("exiftool");
    if ($exiftool_fullpath == false) {
        die("Could not find exiftool. Aborting...");
    } else {
        # get all resources in the DB
        $resources = sql_query("select ref,field" . $view_title_field . ",file_extension from resource where ref>0 order by ref");
        foreach ($resources as $resource) {
            $resource_path = get_resource_path($resource['ref'], true, "", false, $resource['file_extension']);
            if (file_exists($resource_path) && !in_array($resource['file_extension'], $exiftool_no_process)) {
                $resource = get_resource_data($resource['ref']);
                $command = $exiftool_fullpath . " -s -s -s -t -composite:imagesize -xresolution -resolutionunit " . escapeshellarg($resource_path);
                $dimensions_resolution_unit = explode("\t", run_command($command));
                # if anything was extracted, update the database.
                if (count($dimensions_resolution_unit) >= 1 && $dimensions_resolution_unit[0] != '') {
                    # check db for existing record
                    $delete = sql_query("delete from resource_dimensions where resource=" . $resource['ref']);
                    # break down the width and height
                    $wh = explode("x", $dimensions_resolution_unit[0]);
                    if (count($wh) > 1) {
                        $width = $wh[0];
                        $height = $wh[1];
                        $filesize = filesize_unlimited($resource_path);
                        $sql_insert = "insert into resource_dimensions (resource,width,height,file_size";
                        $sql_values = " values('" . $resource['ref'] . "','{$width}','{$height}','{$filesize}'";
                        if (count($dimensions_resolution_unit) >= 2) {
开发者ID:perryrothjohnson,项目名称:resourcespace,代码行数:31,代码来源:update_resource_dimensions.php

示例8: get_resource_access

}
# additional access check, as the resource download may be allowed, but access restriction should force watermark.
$access = get_resource_access($ref);
$use_watermark = check_use_watermark($ref);
# If no extension was provided, we fallback to JPG.
if ($ext == "") {
    $ext = "jpg";
}
$noattach = getval("noattach", "");
$path = get_resource_path($ref, true, $size, false, $ext, -1, $page, $use_watermark && $alternative == -1, "", $alternative);
if (!file_exists($path)) {
    $path = get_resource_path($ref, true, "", false, $ext, -1, $page, false, "", $alternative);
}
if (!file_exists($path) && $noattach != "") {
    # Return icon for file (for previews)
    $info = get_resource_data($ref);
    $path = "../gfx/" . get_nopreview_icon($info["resource_type"], $ext, "thm");
}
# writing RS metadata to files: exiftool
if ($noattach == "" && $alternative == -1) {
    $tmpfile = write_metadata($path, $ref);
    if ($tmpfile !== false && file_exists($tmpfile)) {
        $path = $tmpfile;
    }
}
hook('modifydownloadfile');
$filesize = filesize_unlimited($path);
header("Content-Length: " . $filesize);
# Log this activity (download only, not preview)
if ($noattach == "") {
    daily_stat("Resource download", $ref);
开发者ID:claytondaley,项目名称:resourcespace,代码行数:31,代码来源:download.php

示例9: if

<label for="users"><?php echo $lang["emailtousers"]?></label><?php include "../include/user_select.php"; ?>
<div class="clearerleft"> </div>
<?php if ($errors!="") { ?><div class="FormError">!! <?php echo $errors?> !!</div><?php } ?>
</div>
<?php } ?>

<?php if ($list_recipients){?>
<div class="Question">
<label for="list_recipients"><?php echo $lang["list-recipients-label"]; ?></label><input type=checkbox id="list_recipients" name="list_recipients">
<div class="clearerleft"> </div>
</div>
<?php } ?>

<?php if($useraccess==0)
	{
	$resourcedata=get_resource_data($ref,true);
	if(get_edit_access($ref,$resource['archive'],false,$resource))
		{?>
		<div class="Question">
		<label for="grant_internal_access"><?php echo $lang["internal_share_grant_access"] ?></label>
		<input type=checkbox id="grant_internal_access" name="grant_internal_access" onClick="if(this.checked){jQuery('#question_internal_access').slideDown();}else{jQuery('#question_internal_access').slideUp()};">
		<div class="clearerleft"> </div>
		</div>
		<?php
		}
	}?>


<?php if(!hook("replaceemailaccessselector")){?>
<div class="Question" id="question_access">
<label for="access"><?php echo $lang["externalselectresourceaccess"]?></label>
开发者ID:artsmia,项目名称:mia_resourcespace,代码行数:31,代码来源:resource_email.php

示例10: HookAnnotatePreviewPreviewimage2

function HookAnnotatePreviewPreviewimage2()
{
    global $ext, $baseurl, $ref, $k, $search, $offset, $order_by, $sort, $archive, $lang, $download_multisize, $baseurl, $url, $path, $path_orig, $annotate_ext_exclude, $annotate_rt_exclude, $annotate_public_view, $annotate_pdf_output;
    if (getval("alternative", "") != "") {
        return false;
    }
    $resource = get_resource_data($ref);
    if (in_array($resource['file_extension'], $annotate_ext_exclude)) {
        return false;
    }
    if (in_array($resource['resource_type'], $annotate_rt_exclude)) {
        return false;
    }
    if (!($k == "") && !$annotate_public_view) {
        return false;
    }
    if (!file_exists($path) && !file_exists($path_orig)) {
        return false;
    }
    if (!file_exists($path)) {
        $sizes = getimagesize($path_orig);
    } else {
        $sizes = getimagesize($path);
    }
    $w = $sizes[0];
    $h = $sizes[1];
    ?>
<style type="text/css" media="all">@import "<?php 
    echo $baseurl;
    ?>
/plugins/annotate/lib/jquery/css/annotation.css";</style>

<script type="text/javascript" src="<?php 
    echo $baseurl;
    ?>
/plugins/annotate/lib/jquery/js/jquery.annotate.js"></script>
<script type="text/javascript">
    button_ok = "<?php 
    echo preg_replace("/\r?\n/", "\\n", addslashes($lang["ok"]));
    ?>
";
    button_cancel = "<?php 
    echo preg_replace("/\r?\n/", "\\n", addslashes($lang["cancel"]));
    ?>
";
    button_delete = "<?php 
    echo preg_replace("/\r?\n/", "\\n", addslashes($lang["action-delete"]));
    ?>
";
    button_add = "&gt&nbsp;<?php 
    echo preg_replace("/\r?\n/", "\\n", addslashes($lang["action-add_note"]));
    ?>
";		
    error_saving = "<?php 
    echo preg_replace("/\r?\n/", "\\n", addslashes($lang["error-saving"]));
    ?>
";
    error_deleting = "<?php 
    echo preg_replace("/\r?\n/", "\\n", addslashes($lang["error-deleting"]));
    ?>
";
</script>
<script>
     jQuery.noConflict();
</script>

<div id="wrapper" style="display:block;clear:none;float:left;margin: 0px 10px 10px 0px;">
<div>
		<img id="toAnnotate" src="<?php 
    echo $url;
    ?>
" id="previewimage" class="Picture" GALLERYIMG="no" style="display:block;"   />
	</div>

<div style="padding-top:10px;">
     <?php 
    // MAGICTOUCH PLUGIN COMPATIBILITY
    global $magictouch_account_id;
    if ($magictouch_account_id != "") {
        global $plugins;
        global $magictouch_rt_exclude;
        global $magictouch_ext_exclude;
        if (in_array("magictouch", $plugins) && !in_array($resource['resource_type'], $magictouch_rt_exclude) && !in_array($resource['file_extension'], $magictouch_ext_exclude) && !defined("MTFAIL")) {
            ?>
&nbsp;&nbsp;<a style="display:inline;" href="<?php 
            echo getval("from", "") == "search" ? "search.php?" : "preview.php?ref=" . $ref . "&";
            ?>
search=<?php 
            echo urlencode($search);
            ?>
&offset=<?php 
            echo $offset;
            ?>
&order_by=<?php 
            echo $order_by;
            ?>
&sort=<?php 
            echo $sort;
            ?>
&archive=<?php 
//.........这里部分代码省略.........
开发者ID:vongalpha,项目名称:resourcespace,代码行数:101,代码来源:preview.php

示例11: reindex_resource

function reindex_resource($ref)
	{
	global $index_contributed_by;
	# Reindex a resource. Delete all resource_keyword rows and create new ones.
	
	# Delete existing keywords
	sql_query("delete from resource_keyword where resource='$ref'");

	# Index fields
	$data=get_resource_field_data($ref,false,false); # Fetch all fields and do not use permissions.
	for ($m=0;$m<count($data);$m++)
		{
		if ($data[$m]["keywords_index"]==1)
			{
			#echo $data[$m]["value"];
			$value=$data[$m]["value"];
			if ($data[$m]["type"]==3 || $data[$m]["type"]==2)
				{
				# Prepend a comma when indexing dropdowns
				$value="," . $value;
				}
			
			# Date field? These need indexing differently.
			$is_date=($data[$m]["type"]==4 || $data[$m]["type"]==6);
			
			add_keyword_mappings($ref,i18n_get_indexable($value),$data[$m]["ref"],$data[$m]["partial_index"],$is_date);		
			}
		}
	
	# Also index contributed by field, unless disabled
	if ($index_contributed_by)
		{
		$resource=get_resource_data($ref);
		$userinfo=get_user($resource["created_by"]);
		add_keyword_mappings($ref,$userinfo["username"] . " " . $userinfo["fullname"],-1);
		}

	# Always index the resource ID as a keyword
	remove_keyword_mappings($ref, $ref, -1);
	add_keyword_mappings($ref, $ref, -1);
	
	hook("afterreindexresource","all",array($ref));
	
	}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:44,代码来源:resource_functions.php

示例12: upload_video


//.........这里部分代码省略.........
			curl_close( $curl );
			get_youtube_access_token(true);
			return array(false,$lang["youtube_publish_renewing_token"],true);
			}		
		}
	else
		{
		curl_close( $curl );
		$upload_result=$lang["error"] . curl_error($curl);
		return array(false,curl_errno($curl),false);			
		}
			
	$header = substr($response, 0, $info['header_size']);
	$retVal = array();
	$fields = explode("\r\n", preg_replace('/\x0D\x0A[\x09\x20]+/', ' ', $header));
        foreach( $fields as $field ) 
			{
            if( preg_match('/([^:]+): (.+)/m', $field, $match) ) {
                $match[1] = preg_replace('/(?<=^|[\x09\x20\x2D])./e', 'strtoupper("\0")', strtolower(trim($match[1])));
                if( isset($retVal[$match[1]]) ) 
					{
                    $retVal[$match[1]] = array($retVal[$match[1]], $match[2]);
					} 
				else
					{
                    $retVal[$match[1]] = trim($match[2]);
					}
				}
			}
	if (isset($retVal['Location']))
		{
		$location =  $retVal['Location'];
		}
	else
		{
		$upload_result=$lang["youtube_publish_failedupload_nolocation"];
		curl_close( $curl );
		return array(false,$upload_result,false);
		}
	
			
	
	curl_close( $curl );
	
	# Finally upload the file			
	
	# Get file info for upload
	$resource=get_resource_data($ref);
	$alternative=-1;
	$ext=$resource["file_extension"];
	$path=get_resource_path($ref,true,"",false,$ext,-1,1,false,"",$alternative);
	
	# We assign a default mime-type, in case we can find the one associated to the file extension.
	$mime="application/octet-stream";
			
	# Get mime type via exiftool if possible
	$exiftool_fullpath = get_utility_path("exiftool");
	if ($exiftool_fullpath!=false)
		{	
		$command=$exiftool_fullpath . " -s -s -s -t -mimetype " . escapeshellarg($path);
		$mime=run_command($command);
		}	
		
	# Override or correct for lack of exiftool with config mappings	
	if (isset($mime_type_by_extension[$ext]))
		{
		$mime = $mime_type_by_extension[$ext];
		}
	
	
	$video_file = fopen($path, 'rb');
	
	$curl = curl_init($location);
	
	curl_setopt($curl, CURLOPT_PUT, 1);
	curl_setopt($curl, CURLOPT_BINARYTRANSFER, 1);	 
	curl_setopt($curl, CURLOPT_INFILE, $video_file); // file pointer
	curl_setopt($curl, CURLOPT_INFILESIZE, filesize($path));
	curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($curl, CURLOPT_HEADER, $mime );
	curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 3600); 
	
	
	$response = curl_exec( $curl );
	$videoxml = new SimpleXmlElement($response, LIBXML_NOCDATA);
	
	$urlAtt = $videoxml->link->attributes();
	$youtube_new_url	= $urlAtt['href'];
	$youtube_urlmatch = '#http://(www\.)youtube\.com/watch\?v=([^ &\n]+)(&.*?(\n|\s))?#i';
	preg_match($youtube_urlmatch, $youtube_new_url, $matches);	
	$youtube_new_url=$matches[0];	
		
	# end of actual file upload
	
	
	fclose($video_file);
    $video_file = null;	
	
	return array(true,$youtube_new_url,false);
	}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:101,代码来源:youtube_functions.php

示例13: if

	# Add language support if available
	if (file_exists("../lib/plupload/i18n/" . $language . ".js"))
		{
		echo "<script type=\"text/javascript\" src=\"../lib/plupload/i18n/" . $language . ".js?" . $css_reload_key . "\"></script>";
		}
		?>
		
<div class="BasicsBox" >

<?php if ($alternative!=""){?><p> <a href="<?php echo $baseurl_short?>pages/edit.php?ref=<?php echo urlencode($alternative)?>&search=<?php echo urlencode($search)?>&offset=<?php echo urlencode($offset)?>&order_by=<?php echo urlencode($order_by)?>&sort=<?php echo urlencode($sort)?>&archive=<?php echo urlencode($archive)?>">&lt;&nbsp;<?php echo $lang["backtoeditresource"]?></a><br / >
<a onClick="return CentralSpaceLoad(this,true);" href="<?php echo $baseurl_short?>pages/view.php?ref=<?php echo urlencode($alternative)?>&search=<?php echo urlencode($search)?>&offset=<?php echo urlencode($offset)?>&order_by=<?php echo urlencode($order_by)?>&sort=<?php echo urlencode($sort)?>&archive=<?php echo urlencode($archive)?>">&lt; <?php echo $lang["backtoresourceview"]?></a></p><?php } ?>

<?php if ($replace_resource!=""){?><p> <a href="<?php echo $baseurl_short?>pages/edit.php?ref=<?php echo urlencode($replace_resource)?>&search=<?php echo urlencode($search)?>&offset=<?php echo urlencode($offset)?>&order_by=<?php echo urlencode($order_by)?>&sort=<?php echo urlencode($sort)?>&archive=<?php echo urlencode($archive)?>">&lt;&nbsp;<?php echo $lang["backtoeditresource"]?></a><br / >
<a onClick="return CentralSpaceLoad(this,true);" href="<?php echo $baseurl_short?>pages/view.php?ref=<?php echo urlencode($replace_resource) ?>&search=<?php echo urlencode($search)?>&offset=<?php echo urlencode($offset)?>&order_by=<?php echo urlencode($order_by)?>&sort=<?php echo urlencode($sort)?>&archive=<?php echo urlencode($archive)?>">&lt; <?php echo $lang["backtoresourceview"]?></a></p><?php } ?>

<?php if ($alternative!=""){$resource=get_resource_data($alternative);
	if ($alternative_file_resource_preview){ 
		$imgpath=get_resource_path($resource['ref'],true,"col",false);
		if (file_exists($imgpath)){ ?><img src="<?php echo get_resource_path($resource['ref'],false,"col",false);?>"/><?php }
	}
	if ($alternative_file_resource_title){ 
		echo "<h2>".$resource['field'.$view_title_field]."</h2><br/>";
	}
}

# Define the titles:
if ($replace!="") 
	{
	# Replace Resource Batch
	$titleh1 = $lang["replaceresourcebatch"];
	$titleh2 = "";
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:31,代码来源:upload_plupload.php

示例14: dirname

<?php

include dirname(__FILE__) . '/../../include/db.php';
include dirname(__FILE__) . '/../../include/general.php';
include dirname(__FILE__) . '/../../include/authenticate.php';
include dirname(__FILE__) . '/../../include/resource_functions.php';
$resource = getvalescaped('resource', '');
$ref = getvalescaped('ref', '');
$type = getvalescaped('type', '');
$resource_data = get_resource_data($resource);
// User should have edit access to this resource!
if (!get_edit_access($resource, $resource_data['archive'], false, $resource_data)) {
    exit('Permission denied.');
}
if ($type == 'user') {
    // Delete the user record from the database
    $query = sprintf('
			DELETE FROM resource_custom_access 
				  WHERE resource = "%s"
					AND user = "%s";
		', $resource, $ref);
} elseif ($type == 'usergroup') {
    // Delete the user record from the database
    $query = sprintf('
			DELETE FROM resource_custom_access 
				  WHERE resource = "%s"
					AND usergroup = "%s";
		', $resource, $ref);
} else {
    exit('No type');
}
开发者ID:perryrothjohnson,项目名称:resourcespace,代码行数:31,代码来源:remove_custom_access.php

示例15: tile_search_thumbs

function tile_search_thumbs($tile, $tile_id, $tile_width, $tile_height, $promoted_image = false)
{
    global $baseurl_short, $lang, $dash_tile_shadows;
    $tile_type = "srch";
    $tile_style = "thmbs";
    $search_string = explode('?', $tile["link"]);
    parse_str(str_replace("&amp;", "&", $search_string[1]), $search_string);
    $count = $tile["resource_count"] ? "-1" : "1";
    $search = isset($search_string["search"]) ? $search_string["search"] : "";
    $restypes = isset($search_string["restypes"]) ? $search_string["restypes"] : "";
    $order_by = isset($search_string["order_by"]) ? $search_string["order_by"] : "";
    $archive = isset($search_string["archive"]) ? $search_string["archive"] : "";
    $sort = isset($search_string["sort"]) ? $search_string["sort"] : "";
    $tile_search = do_search($search, $restypes, $order_by, $archive, $count, $sort, false, 0, false, false, "", false, false);
    $found_resources = true;
    $count = count($tile_search);
    if (!isset($tile_search[0]["ref"])) {
        $found_resources = false;
        $count = 0;
    }
    if ($found_resources) {
        $previewresource = $tile_search[0];
        if ($promoted_image) {
            $promoted_image_data = get_resource_data($promoted_image);
            if ($promoted_image_data !== false) {
                $previewresource = $promoted_image_data;
            }
        }
        $defaultpreview = false;
        $previewpath = get_resource_path($previewresource["ref"], true, "pre", false, "jpg", -1, 1, false);
        if (file_exists($previewpath)) {
            $previewpath = get_resource_path($previewresource["ref"], false, "pre", false, "jpg", -1, 1, false);
        } else {
            $previewpath = $baseurl_short . "gfx/" . get_nopreview_icon($previewresource["resource_type"], $previewresource["file_extension"], false);
            $defaultpreview = true;
        }
        ?>
		<img 
			src="<?php 
        echo $previewpath;
        ?>
" 
			<?php 
        if ($defaultpreview) {
            ?>
				style="position:absolute;top:<?php 
            echo ($tile_height - 128) / 2;
            ?>
px;left:<?php 
            echo ($tile_width - 128) / 2;
            ?>
px;"
				<?php 
        } else {
            #fit image to tile size
            if ($previewresource["thumb_width"] * 0.7 >= $previewresource["thumb_height"]) {
                $ratio = $previewresource["thumb_height"] / $tile_height;
                $width = $previewresource["thumb_width"] / $ratio;
                if ($width < $tile_width) {
                    echo "width='100%' ";
                } else {
                    echo "height='100%' ";
                }
            } else {
                $ratio = $previewresource["thumb_width"] / $tile_width;
                $height = $previewresource["thumb_height"] / $ratio;
                if ($height < $tile_height) {
                    echo "height='100%' ";
                } else {
                    echo "width='100%' ";
                }
            }
            ?>
				style="position:absolute;top:0;left:0;"
				<?php 
        }
        ?>
			class="thmbs_tile_img"
		/>
		<?php 
    }
    $icon = "";
    if (substr($search_string["search"], 0, 11) == "!collection") {
        $icon = "collection";
    } else {
        if (substr($search_string["search"], 0, 7) == "!recent" || substr($search_string["search"], 0, 5) == "!last") {
            $icon = "clock";
        } else {
            $icon = "search";
        }
    }
    echo "<span class='" . $icon . "-icon'></span>";
    if (!empty($tile["title"])) {
        ?>
		<h2 class="title thmbs_tile">
		<?php 
        echo htmlspecialchars($tile["title"]);
        ?>
		</h2>
		<?php 
//.........这里部分代码省略.........
开发者ID:perryrothjohnson,项目名称:resourcespace,代码行数:101,代码来源:dash_tile_generation.php


注:本文中的get_resource_data函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。