Beispiel #1
0
function HookResourceconnectViewResourceactions_anonymous()
{
    if (getval("resourceconnect_source", "") == "") {
        return false;
    }
    # Not a ResourceConnect result set.
    global $lang, $title_field, $ref, $baseurl, $search, $offset, $scramble_key, $language, $resource;
    # Generate access key
    $access_key = md5("resourceconnect" . $scramble_key);
    # Formulate resource link (for collections bar)
    $view_url = $baseurl . "/pages/view.php?ref=" . $ref . "&k=" . substr(md5($access_key . $ref), 0, 10) . "&language_set=" . urlencode($language) . "&resourceconnect_source=" . urlencode($baseurl);
    # Add to collections link.
    $url = getval("resourceconnect_source", "") . "/plugins/resourceconnect/pages/add_collection.php?nc=" . time();
    $url .= "&title=" . urlencode(get_data_by_field($ref, $title_field));
    $url .= "&url=" . urlencode($view_url);
    # Add back URL
    $url .= "&back=" . urlencode($baseurl . "/pages/view.php?" . $_SERVER["QUERY_STRING"]);
    # Add images
    if ($resource["has_image"] == 1) {
        $url .= "&thumb=" . urlencode(get_resource_path($ref, false, "col", false, "jpg"));
    } else {
        $url .= "&thumb=" . urlencode($baseurl . "/gfx/" . get_nopreview_icon($resource["resource_type"], $resource["file_extension"], true));
    }
    ?>
	
	<li><a target="collections" href="<?php 
    echo $url;
    ?>
">&gt; <?php 
    echo $lang["action-addtocollection"];
    ?>
</a></li>
	<?php 
}
		<!--Resource Panel-->
		<div class="CollectionPanelShell" id="ResourceShell<?php echo urlencode($ref) ?>">
		<?php if (!hook("rendercollectionthumb")){?>
		<?php $access=get_resource_access($result[$n]);
		$use_watermark=check_use_watermark();?>
		<table border="0" class="CollectionResourceAlign"><tr><td>
		<a style="position:relative;" onclick="return <?php echo ($resource_view_modal?"Modal":"CentralSpace") ?>Load(this,true);" href="<?php echo $baseurl_short?>pages/view.php?ref=<?php echo urlencode($ref) ?>&search=<?php echo urlencode("!collection" . $usercollection)?>&k=<?php echo $k?>&curpos=<?php echo $n ?>"><?php if ($result[$n]["has_image"]==1) { 
		
		$colimgpath=get_resource_path($ref,false,"col",false,$result[$n]["preview_extension"],-1,1,$use_watermark,$result[$n]["file_modified"])
		?>
		<img border=0 src="<?php echo $colimgpath?>" class="CollectImageBorder" <?php if (!$infobox) { ?>title="<?php echo htmlspecialchars(i18n_get_translated($result[$n]["field".$view_title_field]))?>" alt="<?php echo htmlspecialchars(i18n_get_translated($result[$n]["field".$view_title_field]))?>"<?php } ?> 
		<?php if ($infobox) { ?>onMouseOver="InfoBoxSetResource(<?php echo $ref?>);" onMouseOut="InfoBoxSetResource(0);"<?php } ?>
		/>
			<?php
		
		} else { ?><img border=0 src="<?php echo $baseurl_short?>gfx/<?php echo get_nopreview_icon($result[$n]["resource_type"],$result[$n]["file_extension"],true) ?>"
		<?php if ($infobox) { ?>onMouseOver="InfoBoxSetResource(<?php echo $ref?>);" onMouseOut="InfoBoxSetResource(0);"<?php } ?>
		/><?php } ?><?php hook("aftersearchimg","",array($result[$n]))?></a></td>
		</tr></table>
		<?php } /* end hook rendercollectionthumb */?>
		
		<?php 

		$title=$result[$n]["field".$view_title_field];	
		$title_field=$view_title_field;
		if (isset($metadata_template_title_field) && isset($metadata_template_resource_type))
			{
			if ($result[$n]['resource_type']==$metadata_template_resource_type)
				{
				$title=$result[$n]["field".$metadata_template_title_field];
				$title_field=$metadata_template_title_field;
Beispiel #3
0
<?php if (!$is_template && !checkperm("F*")) { ?>
<div class="Question" id="question_file">
<label><?php echo $lang["file"]?></label>
<div class="Fixed">
<?php
if ($resource["has_image"]==1)
	{
	?><img align="top" src="<?php echo get_resource_path($ref,false,($edit_large_preview?"pre":"thm"),false,$resource["preview_extension"],-1,1,checkperm("w"))?>" class="ImageBorder" style="margin-right:10px;"/><br />
	<?php
	}
else
	{
	# Show the no-preview icon
	?>
	<img src="../gfx/<?php echo get_nopreview_icon($resource["resource_type"],$resource["file_extension"],true)?>" />
	<br />
	<?php
	}
if ($resource["file_extension"]!="") { ?><strong><?php echo str_replace_formatted_placeholder("%extension", $resource["file_extension"], $lang["cell-fileoftype"]) . " (" . formatfilesize(@filesize_unlimited(get_resource_path($ref,true,"",false,$resource["file_extension"]))) . ")" ?></strong><br /><?php } ?>

	<?php if ($resource["has_image"]!=1) { ?>
	<a href="<?php echo $baseurl_short?>pages/upload.php?ref=<?php echo urlencode($ref) ?>&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) ?>&upload_a_file=true" onClick="return CentralSpaceLoad(this,true);">&gt;&nbsp;<?php echo $lang["uploadafile"]?></a>
	<?php } else { ?>
	<a href="<?php echo $baseurl_short?>pages/upload_<?php echo $top_nav_upload_type ?>.php?ref=<?php echo urlencode($ref) ?>&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) ?>&replace_resource=<?php echo urlencode($ref)  ?>&resource_type=<?php echo $resource['resource_type']?>" onClick="return CentralSpaceLoad(this,true);">&gt;&nbsp;<?php echo $lang["replacefile"]?></a>
	<?php hook("afterreplacefile"); ?>
	<?php } ?>
	<?php if (! $disable_upload_preview) { ?><br />
	<a href="<?php echo $baseurl_short?>pages/upload_preview.php?ref=<?php echo urlencode($ref) ?>&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) ?>" onClick="return CentralSpaceLoad(this,true);">&gt;&nbsp;<?php echo $lang["uploadpreview"]?></a><?php } ?>
	<?php if (! $disable_alternative_files) { ?><br />
	<a href="<?php echo $baseurl_short?>pages/alternative_files.php?ref=<?php echo urlencode($ref) ?>&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) ?>"  onClick="return CentralSpaceLoad(this,true);">&gt;&nbsp;<?php echo $lang["managealternativefiles"]?></a><?php } ?>
    $original_link = get_resource_path($file[0]['ref'], FALSE, '', FALSE, $file[0]['file_extension'], -1, 1, FALSE, '', -1);
    printJson($original_link);
}
// get link to specific file thumbnail by file ID
// $get_file_thumbnail_link must be the ID of the file
if (!empty($get_file_thumbnail_link)) {
    $resource = $get_file_thumbnail_link;
    $file = sql_query("SELECT * FROM resource WHERE ref='{$resource}'");
    $preview_extension = $file[0]['file_extension'];
    if ($preview_extension == 'pdf') {
        $preview_extension = $file[0]['preview_extension'];
    }
    $thumbnail_link = get_resource_path($resource, FALSE, 'col', FALSE, $preview_extension, -1, 1, FALSE);
    $file_headers = get_headers($thumbnail_link);
    $resourcedata = get_resource_data($resource);
    $no_preview_icon = "gfx/" . get_nopreview_icon($resourcedata["resource_type"], $resourcedata["file_extension"], false);
    $data = array('thumbnail_link' => $thumbnail_link, 'no_preview_icon' => $no_preview_icon, 'file_header' => $file_headers[0]);
    printJson($data);
}
// get all collections
if ($get && $get_all_collections) {
    $all_collections = get_user_collections($user_id);
    printJson($all_collections);
}
// get all files within a specific collection
if ($get_files_in_collection && $collection_id) {
    $fetchFiles = "SELECT * \n            FROM resource \n            WHERE \n              ref IN (SELECT resource FROM collection_resource WHERE collection='{$collection_id}')";
    $fetchCollection = "SELECT ref, name FROM collection WHERE ref='{$collection_id}'";
    $fileData = sql_query($fetchFiles);
    $collectionData = sql_query($fetchCollection);
    foreach ($fileData as $k => $file) {
# 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);
    resource_log($ref, 'd', 0, $usagecomment, "", "", $usage, $size);
 $currenty = $pdf->GetY();
 if ($ref !== false) {
     # Find image
     # Load access level
     $access = get_resource_access($result[$n]);
     // feed get_resource_access the resource array rather than the ref, since access is included.
     $use_watermark = check_use_watermark();
     $imgpath = get_resource_path($ref, true, $imgsize, false, $preview_extension, -1, 1, $use_watermark);
     if (!file_exists($imgpath) && $preview_extension == "jpg" && $imgsize == 'hpr') {
         $imgpath = get_resource_path($ref, true, '', false, $preview_extension, -1, 1, $use_watermark);
     }
     if (!file_exists($imgpath) && $imgsize != 'pre') {
         $imgpath = get_resource_path($ref, true, 'pre', false, $preview_extension, -1, 1, $use_watermark);
     }
     if (!file_exists($imgpath)) {
         $imgpath = "../../gfx/" . get_nopreview_icon($result[$n]['resource_type'], $result[$n]['file_extension'], false, true);
         $preview_extension = explode(".", $imgpath);
         if (count($preview_extension) > 1) {
             $preview_extension = trim(strtolower($preview_extension[count($preview_extension) - 1]));
         }
     }
     if (file_exists($imgpath)) {
         # cells are used for measurement purposes only
         # Two ways to size image, either by height or by width.
         $thumbsize = getimagesize($imgpath);
         if ($thumbsize[0] > $thumbsize[1]) {
             ################# landscape image
             $imagewidth = $imagesize;
             $imageheight = 0;
             if ($sheetstyle == "thumbnails") {
                 $topy = $pdf->GetY();
Beispiel #7
0
										<?php 
										if ($infobox) 
											{ ?>
											onmouseover="InfoBoxSetResource(<?php echo htmlspecialchars($ref)?>);" 
											onmouseout="InfoBoxSetResource(0); "
											<?php 
											} ?> 
										alt="<?php echo str_replace(array("\"","'"),"",htmlspecialchars(i18n_get_translated($result[$n]["field".$view_title_field]))); ?>"
								/>
								<?php 
								} 
							else 
								{ ?>
								<img 
									border=0 
									src="<?php echo $baseurl_short?>gfx/<?php echo get_nopreview_icon($result[$n]["resource_type"],$result[$n]["file_extension"],false) ?>" 
									<?php 
									if ($infobox) 
										{ ?>
										onmouseover="InfoBoxSetResource(<?php echo htmlspecialchars($ref)?>);" 
										onmouseout="InfoBoxSetResource(0);"
										<?php 
										} ?>
								/>
								<?php 
								}
							hook("aftersearchimg","",array($result[$n])); 
							?>
						</a>
					    <?php 
						} ?>
            ?>
">



        
		<?php 
            $images = 0;
            for ($m = 0; $m < count($resources) && $images <= 4; $m++) {
                $border = true;
                $ref = $resources[$m]['ref'];
                $previewpath = get_resource_path($ref, true, "col", false, "jpg", -1, 1, false);
                if (file_exists($previewpath)) {
                    $previewpath = get_resource_path($ref, false, "col", false, "jpg", -1, 1, false, $resources[$m]["file_modified"]);
                } else {
                    $previewpath = "../gfx/" . get_nopreview_icon($resources[$m]["resource_type"], $resources[$m]["file_extension"], "col");
                    $border = false;
                }
                $images++;
                $space = 3 + ($images - 1) * 9;
                if (list($sw, $sh) = @getimagesize($previewpath)) {
                    ?>
            <img width="<?php 
                    echo floor($sw / 2);
                    ?>
" height="<?php 
                    echo floor($sh / 2);
                    ?>
" style="position: absolute; top:<?php 
                    echo $space;
                    ?>
function do_report($ref, $from_y, $from_m, $from_d, $to_y, $to_m, $to_d, $download = true, $add_border = false)
{
    # Run report with id $ref for the date range specified. Returns a result array.
    global $lang, $baseurl;
    $report = sql_query("select * from report where ref='{$ref}'");
    $report = $report[0];
    # Translates the report name.
    $report["name"] = lang_or_i18n_get_translated($report["name"], "report-");
    if ($download) {
        $filename = str_replace(array(" ", "(", ")", "-", "/"), "_", $report["name"]) . "_" . $from_y . "_" . $from_m . "_" . $from_d . "_" . $lang["to"] . "_" . $to_y . "_" . $to_m . "_" . $to_d . ".csv";
        header("Content-type: application/octet-stream");
        header("Content-disposition: attachment; filename=" . $filename . "");
    }
    if ($results = hook("customreport", "", array($ref, $from_y, $from_m, $from_d, $to_y, $to_m, $to_d, $download, $add_border))) {
    } else {
        $sql = $report["query"];
        $sql = str_replace("[from-y]", $from_y, $sql);
        $sql = str_replace("[from-m]", $from_m, $sql);
        $sql = str_replace("[from-d]", $from_d, $sql);
        $sql = str_replace("[to-y]", $to_y, $sql);
        $sql = str_replace("[to-m]", $to_m, $sql);
        $sql = str_replace("[to-d]", $to_d, $sql);
        global $view_title_field;
        #back compatibility for three default reports, to replace "title" with the view_title_field.
        #all reports should either use r.title or view_title_field when referencing the title column on the resource table.
        if ($ref == 7 || $ref == 8 || $ref == 9) {
            $sql = str_replace(",title", ",field" . $view_title_field, $sql);
        }
        $sql = str_replace("view_title_field", "field" . $view_title_field, $sql);
        $sql = str_replace("r.title", "field" . $view_title_field, $sql);
        $results = sql_query($sql);
        #echo "\"Number of results: " . count($results) . "\"\n";
    }
    if ($download) {
        for ($n = 0; $n < count($results); $n++) {
            $result = $results[$n];
            if ($n == 0) {
                $f = 0;
                foreach ($result as $key => $value) {
                    $f++;
                    if ($f > 1) {
                        echo ",";
                    }
                    if ($key != "thumbnail") {
                        echo "\"" . lang_or_i18n_get_translated($key, "columnheader-") . "\"";
                    }
                }
                echo "\n";
            }
            $f = 0;
            foreach ($result as $key => $value) {
                $f++;
                if ($f > 1) {
                    echo ",";
                }
                if ($key != "thumbnail") {
                    $value = lang_or_i18n_get_translated($value, "usergroup-");
                    $value = str_replace('"', '""', $value);
                    # escape double quotes
                    if (substr($value, 0, 1) == ",") {
                        $value = substr($value, 1);
                    }
                    # Remove comma prefix on dropdown / checkbox values
                    echo "\"" . $value . "\"";
                }
            }
            echo "\n";
        }
    } else {
        # Not downloading - output a table
        $border = "";
        if ($add_border) {
            $border = "border=\"1\"";
        }
        $output = "<br /><style>.InfoTable td {padding:5px;}</style><table {$border} class=\"InfoTable\">";
        for ($n = 0; $n < count($results); $n++) {
            $result = $results[$n];
            if ($n == 0) {
                $f = 0;
                $output .= "<tr>\r\n";
                foreach ($result as $key => $value) {
                    $f++;
                    if ($key == "thumbnail") {
                        $output .= "<td><strong>Link</strong></td>\r\n";
                    } else {
                        $output .= "<td><strong>" . lang_or_i18n_get_translated($key, "columnheader-") . "</strong></td>\r\n";
                    }
                }
                $output .= "</tr>\r\n";
            }
            $f = 0;
            $output .= "<tr>\r\n";
            foreach ($result as $key => $value) {
                $f++;
                if ($key == "thumbnail") {
                    $thm_path = get_resource_path($value, true, "thm", false, "", $scramble = -1, $page = 1, false);
                    if (!file_exists($thm_path)) {
                        $resourcedata = get_resource_data($value);
                        $thm_url = $baseurl . "/gfx/" . get_nopreview_icon($resourcedata["resource_type"], $resourcedata["file_extension"], true);
                    } else {
                        $thm_url = get_resource_path($value, false, "col", false, "", -1, 1, false);
                    }
                    $output .= "<td><a href=\"" . $baseurl . "/?r=" . $value . "\" target=\"_blank\"><img src=\"" . $thm_url . "\"></a></td>\r\n";
                } else {
                    $output .= "<td>" . lang_or_i18n_get_translated($value, "usergroup-") . "</td>\r\n";
                }
            }
            $output .= "</tr>\r\n";
        }
        $output .= "</table>\r\n";
        if (count($results) == 0) {
            $output .= $lang["reportempty"];
        }
        return $output;
    }
    exit;
}
function tile_search_multi($tile, $tile_id, $tile_width, $tile_height)
{
    global $baseurl_short, $lang, $dash_tile_shadows;
    $tile_type = "srch";
    $tile_style = "multi";
    $search_string = explode('?', $tile["link"]);
    parse_str(str_replace("&amp;", "&", $search_string[1]), $search_string);
    $count = $tile["resource_count"] ? "-1" : "4";
    $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"] : "";
    $resources = do_search($search, $restypes, $order_by, $archive, $count, $sort, false, 0, false, false, "", false, false);
    $img_size = "pre";
    for ($i = 0; $i < count($resources) && $i < 4; $i++) {
        $shadow = true;
        $ref = $resources[$i]['ref'];
        $previewpath = get_resource_path($ref, true, $img_size, false, "jpg", -1, 1, false);
        if (file_exists($previewpath)) {
            $previewpath = get_resource_path($ref, false, $img_size, false, "jpg", -1, 1, false, $resources[$i]["file_modified"]);
        } else {
            $previewpath = $baseurl_short . "gfx/" . get_nopreview_icon($resources[$i]["resource_type"], $resources[$i]["file_extension"], "");
            $border = false;
            $shadow = false;
        }
        $modifiedurl = hook('searchpublicmodifyurl');
        if ($modifiedurl) {
            $previewpath = $modifiedurl;
            $border = true;
        }
        #$space=$margin+($images-1)*$gap;
        $gap = 140 / min(count($resources), 4);
        $space = $i * $gap;
        ?>
        <img style="position: absolute; top:10px;left:<?php 
        echo $space * 1.5;
        ?>
px;height:100%;<?php 
        if ($shadow) {
            ?>
box-shadow: 0 0 25px #000;<?php 
        }
        ?>
;transform: rotate(<?php 
        echo 20 - $i * 12;
        ?>
deg);" src="<?php 
        echo $previewpath;
        ?>
">
        <?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 
    } else {
        if (!empty($tile["txt"])) {
            ?>
		<h2 class="title notitle thmbs_tile">
		<?php 
            echo htmlspecialchars($tile["txt"]);
            ?>
		</h2>
		<?php 
        }
    }
    if (!empty($tile["title"]) && !empty($tile["txt"])) {
        ?>
		<p>
		<?php 
        echo htmlspecialchars($tile["txt"]);
        ?>
		</p>
		<?php 
    }
    if ($tile["resource_count"]) {
        ?>
		<p class="tile_corner_box">
		<span class="count-icon"></span>
		<?php 
        echo count($resources);
        ?>
		</p>
		<?php 
    }
    if (!$dash_tile_shadows) {
        ?>
		<script>
			jQuery("#<?php 
        echo $tile_id;
        ?>
").addClass("TileContentShadow");
		</script>
		<?php 
    }
}
</p>
<p><?php 
echo $lang["drag_and_drop_to_rearrange"];
?>
</p>
<div id="splice_scroll">
<div id="splice_reel" style="width:<?php 
echo (count($videos) + 1) * 80;
?>
px">
<?php 
foreach ($videos as $video) {
    if ($video["has_image"]) {
        $img = get_resource_path($video["ref"], false, "col", false, $video["preview_extension"], -1, 1, false, $video["file_modified"]);
    } else {
        $img = "../../../gfx/" . get_nopreview_icon($video["resource_type"], $video["file_extension"], true);
    }
    ?>
<img src="<?php 
    echo $img;
    ?>
" id="splice_<?php 
    echo $video["ref"];
    ?>
" class="splice_item"><?php 
}
?>
</div></div>

<script type="text/javascript">
	function ReorderResourcesInCollectionSplice(idsInOrder){
function email_resource_request($ref, $details)
{
    # E-mails a basic resource request for a single resource (posted) to the team
    # (not a managed request)
    global $applicationname, $email_from, $baseurl, $email_notify, $username, $useremail, $userref, $lang, $request_senduserupdates, $watermark, $filename_field, $view_title_field, $access, $resource_type_request_emails;
    $resourcedata = get_resource_data($ref);
    $templatevars['thumbnail'] = get_resource_path($ref, true, "thm", false, "jpg", $scramble = -1, $page = 1, $watermark ? $access == 1 ? true : false : false);
    if (!file_exists($templatevars['thumbnail'])) {
        $templatevars['thumbnail'] = "../gfx/" . get_nopreview_icon($resourcedata["resource_type"], $resourcedata["file_extension"], false);
    }
    if (isset($filename_field)) {
        $templatevars["filename"] = $lang["fieldtitle-original_filename"] . ": " . get_data_by_field($ref, $filename_field);
    }
    if (isset($resourcedata["field" . $view_title_field])) {
        $templatevars["title"] = $resourcedata["field" . $view_title_field];
    }
    $templatevars['username'] = $username . " (" . $useremail . ")";
    $templatevars['formemail'] = getval("email", "");
    $templatevars['url'] = $baseurl . "/?r=" . $ref;
    $templatevars["requesturl"] = $templatevars['url'];
    $userdata = get_user($userref);
    $templatevars["fullname"] = $userdata["fullname"];
    $htmlbreak = "";
    global $use_phpmailer;
    if ($use_phpmailer) {
        $htmlbreak = "<br><br>";
    }
    $list = "";
    reset($_POST);
    foreach ($_POST as $key => $value) {
        if (strpos($key, "_label") !== false) {
            # Add custom field
            $data = "";
            $data = $_POST[str_replace("_label", "", $key)];
            $list .= $htmlbreak . $value . ": " . $data . "\n";
        }
    }
    $list .= $htmlbreak;
    $templatevars['list'] = $list;
    $templatevars['details'] = stripslashes($details);
    if ($templatevars['details'] != "") {
        $adddetails = $lang["requestreason"] . ": " . newlines($templatevars['details']) . "\n\n";
    } else {
        return false;
    }
    # Add custom fields
    $c = "";
    global $custom_request_fields, $custom_request_required;
    if (isset($custom_request_fields)) {
        $custom = explode(",", $custom_request_fields);
        # Required fields?
        if (isset($custom_request_required)) {
            $required = explode(",", $custom_request_required);
        }
        for ($n = 0; $n < count($custom); $n++) {
            if (isset($required) && in_array($custom[$n], $required) && getval("custom" . $n, "") == "") {
                return false;
                # Required field was not set.
            }
            $c .= i18n_get_translated($custom[$n]) . ": " . getval("custom" . $n, "") . "\n\n";
        }
    }
    $templatevars["requestreason"] = $lang["requestreason"] . ": " . $templatevars['details'] . $c . "";
    $message = $lang["user_made_request"] . "<br /><br />";
    $message .= isset($username) ? $lang["username"] . ": " . $username . " (" . $useremail . ")<br />" : "";
    $message .= !empty($templatevars["formemail"]) ? $lang["email"] . ":" . $templatevars["formemail"] . "<br />" : "";
    $message .= $adddetails . $c . "<br /><br />" . $lang["clicktoviewresource"] . "<br />" . $templatevars['url'];
    # Check if alternative request email notification address is set
    $admin_notify_email = $email_notify;
    if (isset($resource_type_request_emails)) {
        if (isset($resource_type_request_emails[$resourcedata["resource_type"]])) {
            $admin_notify_email = $resource_type_request_emails[$resourcedata["resource_type"]];
        }
    }
    send_mail($admin_notify_email, $applicationname . ": " . $lang["requestresource"] . " - {$ref}", $message, $useremail, $useremail, "emailresourcerequest", $templatevars);
    if ($request_senduserupdates) {
        $sender = !empty($useremail) ? $useremail : !empty($templatevars["formemail"]) ? $templatevars["formemail"] : "";
        $k = getval("k", "") != "" ? "&k=" . getval("k", "") : "";
        $userconfirmmessage = $lang["requestsenttext"] . "<br /><br />" . $lang["requestreason"] . ": " . $templatevars['details'] . $c . "<br /><br />" . $lang["clicktoviewresource"] . "\n{$baseurl}/?r={$ref}" . $k;
        if ($sender != "") {
            send_mail($sender, $applicationname . ": " . $lang["requestsent"] . " - {$ref}", $userconfirmmessage, $email_from, $email_notify, "emailuserresourcerequest", $templatevars);
        }
    }
    # Increment the request counter
    sql_query("update resource set request_count=request_count+1 where ref='{$ref}'");
}
Beispiel #13
0
function HookAnnotateViewRenderinnerresourcepreview()
{
    global $ref, $ffmpeg_preview_extension, $resource, $k, $search, $offset, $order_by, $sort, $archive, $lang, $download_multisize, $baseurl, $annotate_ext_exclude, $annotate_rt_exclude, $annotate_public_view, $annotate_pdf_output;
    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;
    }
    $download_multisize = true;
    $flvfile = get_resource_path($ref, true, "pre", false, $ffmpeg_preview_extension);
    if (file_exists($flvfile)) {
        return false;
    }
    if ($resource["has_image"] == 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><?php 
        $use_watermark = check_use_watermark($resource['ref']);
        $imagepath = get_resource_path($ref, true, "pre", false, $resource["preview_extension"], -1, 1, $use_watermark);
        if (!file_exists($imagepath)) {
            $imagepath = get_resource_path($ref, true, "thm", false, $resource["preview_extension"], -1, 1, $use_watermark);
            $imageurl = get_resource_path($ref, false, "thm", false, $resource["preview_extension"], -1, 1, $use_watermark);
        } else {
            $imageurl = get_resource_path($ref, false, "pre", false, $resource["preview_extension"], -1, 1, $use_watermark);
        }
        if (!file_exists($imagepath)) {
            return false;
        }
        $sizes = getimagesize($imagepath);
        $w = $sizes[0];
        $h = $sizes[1];
        if (file_exists($imagepath)) {
            ?>
	


		<div id="wrapper" style="display:block;clear:none;float:left;margin: 0px 10px 10px 0px;">
<div>
<img id="toAnnotate" src="<?php 
            echo $imageurl;
            ?>
" id="previewimage" class="Picture" GALLERYIMG="no" style="display:block;"   />
	</div>
	<div style="padding-top:10px;">
	<a style="display:inline;" href="preview.php?<?php 
            if (getval("annotate", "") != "") {
                ?>
annotate=true&<?php 
            }
            ?>
ref=<?php 
            echo $ref;
            ?>
&ext=<?php 
            echo $resource["preview_extension"];
            ?>
&k=<?php 
            echo $k;
            ?>
&search=<?php 
            echo urlencode($search);
            ?>
&offset=<?php 
            echo $offset;
            ?>
&order_by=<?php 
            echo $order_by;
            ?>
&sort=<?php 
            echo $sort;
            ?>
&archive=<?php 
            echo $archive;
            ?>
" title="<?php 
            echo $lang["fullscreenpreview"];
            ?>
">&gt;&nbsp;<?php 
            echo $lang["fullscreenpreview"];
            ?>
</a>
    
     <?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;<a style="display:inline;" href="<?php 
                    echo getval("from", "") == "search" ? "search.php?" : "view.php?ref=" . $ref . "&";
                    ?>
search=<?php 
                    echo urlencode($search);
                    ?>
&offset=<?php 
                    echo $offset;
                    ?>
&order_by=<?php 
                    echo $order_by;
                    ?>
&sort=<?php 
                    echo $sort;
                    ?>
&archive=<?php 
                    echo $archive;
                    ?>
&k=<?php 
                    echo $k;
                    ?>
" onClick="return CentralSpaceLoad(this);">&gt;&nbsp;<?php 
                    echo $lang['zoom'];
                    ?>
</a><?php 
                }
            }
            ///////////////
            ?>
     
<?php 
            if ($annotate_pdf_output) {
                ?>
&nbsp;&nbsp;<a style="display:inline;float:right;" class="nowrap" href="<?php 
                echo $baseurl;
                ?>
/plugins/annotate/pages/annotate_pdf_config.php?ref=<?php 
                echo $ref;
                ?>
&ext=<?php 
                echo $resource["preview_extension"];
                ?>
&k=<?php 
                echo $k;
                ?>
&search=<?php 
                echo urlencode($search);
                ?>
&offset=<?php 
                echo $offset;
                ?>
&order_by=<?php 
                echo $order_by;
                ?>
&sort=<?php 
                echo $sort;
                ?>
&archive=<?php 
                echo $archive;
                ?>
" onClick="return CentralSpaceLoad(this);">&gt;&nbsp;<?php 
                echo $lang["pdfwithnotes"];
                ?>
</a>
<?php 
            }
            ?>
</div>

	</div>
<script language="javascript">
	jQuery("#toAnnotate").load(function(){
	jQuery("#toAnnotate").annotateImage({
		getUrl: "<?php 
            echo $baseurl;
            ?>
/plugins/annotate/pages/get.php?ref=<?php 
            echo $ref;
            ?>
&k=<?php 
            echo $k;
            ?>
&pw=<?php 
            echo $w;
            ?>
&ph=<?php 
            echo $h;
            ?>
",
		saveUrl: "<?php 
            echo $baseurl;
            ?>
/plugins/annotate/pages/save.php?ref=<?php 
            echo $ref;
            ?>
&k=<?php 
            echo $k;
            ?>
&pw=<?php 
            echo $w;
            ?>
&ph=<?php 
            echo $h;
            ?>
",
		deleteUrl: "<?php 
            echo $baseurl;
            ?>
/plugins/annotate/pages/delete.php?ref=<?php 
            echo $ref;
            ?>
&k=<?php 
            echo $k;
            ?>
",
		useAjax: true,
		<?php 
            if ($k == "") {
                ?>
 editable: true <?php 
            } else {
                ?>
 editable: false <?php 
            }
            ?>
  
	});
	});
</script>
	
<?php 
        }
    } else {
        ?>
	<img src="<?php 
        echo $baseurl;
        ?>
/gfx/<?php 
        echo get_nopreview_icon($resource["resource_type"], $resource["file_extension"], false);
        ?>
" alt="" class="Picture" style="border:none;" id="previewimage" />
	<?php 
    }
    return true;
}
Beispiel #14
0
       {
       $wmpath=get_resource_path($ref,true,($edit_large_preview?"pre":"thm"),false,$resource["preview_extension"],-1,1,true);
       if (file_exists($wmpath))
          { ?>
          <img style="display:none;" id="wmpreview" align="top" src="<?php echo get_resource_path($ref,false,($edit_large_preview?"pre":"thm"),false,$resource["preview_extension"],-1,1,true)?>" class="ImageBorder"/>
          <?php 
          }
       } ?>
    <br />
    <?php
    }
 else
    {
    # Show the no-preview icon
      ?>
      <img src="<?php echo $baseurl_short ?>gfx/<?php echo get_nopreview_icon($resource["resource_type"],$resource["file_extension"],true)?>" />
      <br />
      <?php
    }
 if ($resource["file_extension"]!="") 
    { ?>           
    <strong>
    <?php 
    echo str_replace_formatted_placeholder("%extension", $resource["file_extension"], $lang["cell-fileoftype"]) . " (" . formatfilesize(@filesize_unlimited(get_resource_path($ref,true,"",false,$resource["file_extension"]))) . ")";
    ?>
    </strong>
    <?php 
    if (checkperm("w") && $resource["has_image"]==1 && file_exists($wmpath))
       { ?> 
       &nbsp;&nbsp;
       <a href="#" onclick="jQuery('#wmpreview').toggle();jQuery('#preview').toggle();if (jQuery(this).text()=='<?php echo $lang['showwatermark']?>'){jQuery(this).text('<?php echo $lang['hidewatermark']?>');} else {jQuery(this).text('<?php echo $lang['showwatermark']?>');}"><?php echo $lang['showwatermark']?></a>
 function email_resource($resource, $resourcename, $fromusername, $userlist, $message, $access = -1, $expires = "", $useremail = "", $from_name = "", $cc = "", $list_recipients = false, $open_internal_access = false, $useraccess = 2, $group = "")
 {
     # Attempt to resolve all users in the string $userlist to user references.
     global $baseurl, $email_from, $applicationname, $lang, $userref, $usergroup, $attach_user_smart_groups;
     if ($useremail == "") {
         $useremail = $email_from;
     }
     if ($group == "") {
         $group = $usergroup;
     }
     # remove any line breaks that may have been entered
     $userlist = str_replace("\\r\\n", ",", $userlist);
     if (trim($userlist) == "") {
         return $lang["mustspecifyoneusername"];
     }
     $userlist = resolve_userlist_groups($userlist);
     if ($attach_user_smart_groups && strpos($userlist, $lang["groupsmart"] . ": ") !== false) {
         $userlist_with_groups = $userlist;
         $groups_users = resolve_userlist_groups_smart($userlist, true);
         if ($groups_users != '') {
             if ($userlist != "") {
                 $userlist = remove_groups_smart_from_userlist($userlist);
                 if ($userlist != "") {
                     $userlist .= ",";
                 }
             }
             $userlist .= $groups_users;
         }
     }
     $ulist = trim_array(explode(",", $userlist));
     $ulist = array_filter($ulist);
     $ulist = array_values($ulist);
     $emails = array();
     $key_required = array();
     $emails_keys = resolve_user_emails($ulist);
     $unames = $emails_keys['unames'];
     $emails = $emails_keys['emails'];
     $key_required = $emails_keys['key_required'];
     # Send an e-mail to each resolved user / e-mail address
     $subject = "{$applicationname}: {$resourcename}";
     if ($fromusername == "") {
         $fromusername = $applicationname;
     }
     // fromusername is used for describing the sender's name inside the email
     if ($from_name == "") {
         $from_name = $applicationname;
     }
     // from_name is for the email headers, and needs to match the email address (app name or user name)
     $message = str_replace(array("\\n", "\\r", "\\"), array("\n", "\r", ""), $message);
     #	Commented 'no message' line out as formatted oddly, and unnecessary.
     #	if ($message==""){$message=$lang['nomessage'];}
     $resolve_open_access = false;
     for ($n = 0; $n < count($emails); $n++) {
         $key = "";
         # Do we need to add an external access key for this user (e-mail specified rather than username)?
         if ($key_required[$n]) {
             $k = generate_resource_access_key($resource, $userref, $access, $expires, $emails[$n], $group);
             $key = "&k=" . $k;
         } elseif ($useraccess == 0 && $open_internal_access && !$resolve_open_access) {
             debug("smart_groups: going to resolve open access");
             # get this all done at once
             resolve_open_access(isset($userlist_with_groups) ? $userlist_with_groups : $userlist, $resource, $expires);
             $resolve_open_access = true;
         }
         # make vars available to template
         global $watermark;
         $templatevars['thumbnail'] = get_resource_path($resource, true, "thm", false, "jpg", $scramble = -1, $page = 1, $watermark ? $access == 1 ? true : false : false);
         if (!file_exists($templatevars['thumbnail'])) {
             $resourcedata = get_resource_data($resource);
             $templatevars['thumbnail'] = "../gfx/" . get_nopreview_icon($resourcedata["resource_type"], $resourcedata["file_extension"], false);
         }
         $templatevars['url'] = $baseurl . "/?r=" . $resource . $key;
         $templatevars['fromusername'] = $fromusername;
         $templatevars['message'] = $message;
         $templatevars['resourcename'] = $resourcename;
         $templatevars['from_name'] = $from_name;
         if (isset($k)) {
             if ($expires == "") {
                 $templatevars['expires_date'] = $lang["email_link_expires_never"];
                 $templatevars['expires_days'] = $lang["email_link_expires_never"];
             } else {
                 $day_count = round((strtotime($expires) - strtotime('now')) / (60 * 60 * 24));
                 $templatevars['expires_date'] = $lang['email_link_expires_date'] . nicedate($expires);
                 $templatevars['expires_days'] = $lang['email_link_expires_days'] . $day_count;
                 if ($day_count > 1) {
                     $templatevars['expires_days'] .= " " . $lang['expire_days'] . ".";
                 } else {
                     $templatevars['expires_days'] .= " " . $lang['expire_day'] . ".";
                 }
             }
         } else {
             # Set empty expiration tempaltevars
             $templatevars['expires_date'] = '';
             $templatevars['expires_days'] = '';
         }
         # Build message and send.
         if (count($emails > 1) && $list_recipients === true) {
             $body = $lang["list-recipients"] . "\n" . implode("\n", $emails) . "\n\n";
             $templatevars['list-recipients'] = $lang["list-recipients"] . "\n" . implode("\n", $emails) . "\n\n";
         } else {
             $body = "";
         }
         $body .= $templatevars['fromusername'] . " " . $lang["hasemailedyouaresource"] . "\n\n" . $templatevars['message'] . "\n\n" . $lang["clicktoviewresource"] . "\n\n" . $templatevars['url'];
         send_mail($emails[$n], $subject, $body, $fromusername, $useremail, "emailresource", $templatevars, $from_name, $cc);
         # log this
         resource_log($resource, "E", "", $notes = $unames[$n]);
     }
     hook("additional_email_resource", "", array($resource, $resourcename, $fromusername, $userlist, $message, $access, $expires, $useremail, $from_name, $cc, $templatevars));
     # Return an empty string (all OK).
     return "";
 }
function email_resource($resource,$resourcename,$fromusername,$userlist,$message,$access=-1,$expires="",$useremail="",$from_name="",$cc="")
	{
	# Attempt to resolve all users in the string $userlist to user references.

	global $baseurl,$email_from,$applicationname,$lang,$userref;
	
	if ($useremail==""){$useremail=$email_from;}
	
	# remove any line breaks that may have been entered
	$userlist=str_replace("\\r\\n",",",$userlist);

	if (trim($userlist)=="") {return ($lang["mustspecifyoneusername"]);}
	$userlist=resolve_userlist_groups($userlist);
	$ulist=trim_array(explode(",",$userlist));
	$ulist=array_filter($ulist);
	$ulist=array_values($ulist);

	$emails=array();
	$key_required=array();
	
	$emails_keys=resolve_user_emails($ulist);
	$unames=$emails_keys['unames'];
	$emails=$emails_keys['emails'];
	$key_required=$emails_keys['key_required'];

	# Send an e-mail to each resolved user / e-mail address
	$subject="$applicationname: $resourcename";
	if ($fromusername==""){$fromusername=$applicationname;} // fromusername is used for describing the sender's name inside the email
	if ($from_name==""){$from_name=$applicationname;} // from_name is for the email headers, and needs to match the email address (app name or user name)
	
	$message=str_replace(array("\\n","\\r","\\"),array("\n","\r",""),$message);

#	Commented 'no message' line out as formatted oddly, and unnecessary.
#	if ($message==""){$message=$lang['nomessage'];}

	for ($n=0;$n<count($emails);$n++)
		{
		$key="";
		# Do we need to add an external access key for this user (e-mail specified rather than username)?
		if ($key_required[$n])
			{
			$k=substr(md5(time()),0,10);
			sql_query("insert into external_access_keys(resource,access_key,user,access,expires) values ('$resource','$k','$userref','$access'," . (($expires=="")?"null":"'" . $expires . "'"). ");");
			$key="&k=". $k;
			}
		
		# make vars available to template
		global $watermark;       
		$templatevars['thumbnail']=get_resource_path($resource,true,"thm",false,"jpg",$scramble=-1,$page=1,($watermark)?(($access==1)?true:false):false);
		if (!file_exists($templatevars['thumbnail'])){
			$resourcedata=get_resource_data($resource);
			$templatevars['thumbnail']="../gfx/".get_nopreview_icon($resourcedata["resource_type"],$resourcedata["file_extension"],false);
		}
		$templatevars['url']=$baseurl . "/?r=" . $resource . $key;
		$templatevars['fromusername']=$fromusername;
		$templatevars['message']=$message;
		$templatevars['resourcename']=$resourcename;
		$templatevars['from_name']=$from_name;
		
		# Build message and send.
		$body=$templatevars['fromusername']." ". $lang["hasemailedyouaresource"] . $templatevars['message']."\n\n" . $lang["clicktoviewresource"] . "\n\n" . $templatevars['url'];
		send_mail($emails[$n],$subject,$body,$fromusername,$useremail,"emailresource",$templatevars,$from_name,$cc);
		
		# log this
		resource_log($resource,"E","",$notes=$unames[$n]);
		
		}
		
	# Return an empty string (all OK).
	return "";
	}
        }
    }
    $results = $newresult;
}
if (getval("previewsize", "") != "") {
    for ($n = 0; $n < count($results); $n++) {
        $access = get_resource_access($results[$n]);
        $use_watermark = check_use_watermark();
        $filepath = get_resource_path($results[$n]['ref'], true, getval('previewsize', ''), false, 'jpg', -1, 1, $use_watermark, '', -1);
        $previewpath = get_resource_path($results[$n]['ref'], false, getval("previewsize", ""), false, "jpg", -1, 1, $use_watermark, "", -1);
        if (file_exists($filepath)) {
            $results[$n]['preview'] = $previewpath;
        } else {
            $previewpath = explode('filestore/', $previewpath);
            $previewpath = $previewpath[0] . "gfx/";
            $file = $previewpath . get_nopreview_icon($results[$n]["resource_type"], $results[$n]["file_extension"], false, true);
            $results[$n]['preview'] = $file;
        }
    }
}
if ($original) {
    for ($i = 0; $i < count($results); $i++) {
        $access = get_resource_access($results[$i]);
        $filepath = get_resource_path($results[$i]['ref'], TRUE, '', FALSE, $results[$i]['file_extension'], -1, 1, FALSE, '', -1);
        $original_link = get_resource_path($results[$i]['ref'], FALSE, '', FALSE, $results[$i]['file_extension'], -1, 1, FALSE, '', -1);
        if (file_exists($filepath)) {
            $results[$i]['original_link'] = $original_link;
        } else {
            $results[$i]['original_link'] = 'No original link available.';
        }
        // Get the size of the original file:
<img align="top" src="<?php 
        echo get_resource_path($ref, false, $edit_large_preview ? "pre" : "thm", false, $resource["preview_extension"], -1, 1, checkperm("w"));
        ?>
" alt="<?php 
        echo $imagename;
        ?>
" class="Picture"/><br />
		<?php 
    } else {
        # Show the no-preview icon
        ?>
		<img src="<?php 
        echo $baseurl_short;
        ?>
gfx/<?php 
        echo get_nopreview_icon($resource["resource_type"], $resource["file_extension"], true);
        ?>
" alt="<?php 
        echo $imagename;
        ?>
" class="Picture"/>
		<?php 
    }
    ?>
		
	</div>
	
	
	
	<?php 
}
Beispiel #19
0
function HookAnnotateViewRenderinnerresourcepreview()
{
    global $baseurl_short, $ajax, $ref, $ffmpeg_preview_extension, $resource, $k, $search, $offset, $order_by, $sort, $archive, $lang, $download_multisize, $baseurl, $annotate_ext_exclude, $annotate_rt_exclude, $annotate_public_view, $annotate_pdf_output;
    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;
    }
    $download_multisize = true;
    $flvfile = get_resource_path($ref, true, "pre", false, $ffmpeg_preview_extension);
    if (file_exists($flvfile)) {
        return false;
    }
    if ($resource["has_image"] == 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><?php 
        $use_watermark = check_use_watermark($resource['ref']);
        $imagepath = get_resource_path($ref, true, "pre", false, $resource["preview_extension"], -1, 1, $use_watermark);
        if (!file_exists($imagepath)) {
            $imagepath = get_resource_path($ref, true, "thm", false, $resource["preview_extension"], -1, 1, $use_watermark);
            $imageurl = get_resource_path($ref, false, "thm", false, $resource["preview_extension"], -1, 1, $use_watermark);
        } else {
            $imageurl = get_resource_path($ref, false, "pre", false, $resource["preview_extension"], -1, 1, $use_watermark);
        }
        if (!file_exists($imagepath)) {
            return false;
        }
        $sizes = getimagesize($imagepath);
        $w = $sizes[0];
        $h = $sizes[1];
        if (file_exists($imagepath)) {
            $page_count = get_page_count($resource);
            $multipage_document = FALSE;
            if ($page_count > 1) {
                $multipage_document = TRUE;
            }
            ?>
	


<div id="wrapper" class="annotate-view-wrapper">
<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 $imageurl;
            ?>
" id="previewimage" class="Picture" GALLERYIMG="no" style="display:block;"   />
</div>
	
<div class="annotate-view-preview-links" >
<a class="enterLink" href="<?php 
            echo $baseurl_short;
            ?>
pages/preview.php?<?php 
            if (getval("annotate", "") != "") {
                ?>
annotate=true&<?php 
            }
            ?>
ref=<?php 
            echo $ref;
            ?>
&amp;ext=<?php 
            echo $resource["preview_extension"];
            ?>
&amp;k=<?php 
            echo $k;
            ?>
&amp;search=<?php 
            echo urlencode($search);
            ?>
&amp;offset=<?php 
            echo $offset;
            ?>
&amp;order_by=<?php 
            echo $order_by;
            ?>
&amp;sort=<?php 
            echo $sort;
            ?>
&amp;archive=<?php 
            echo $archive;
            if ($multipage_document) {
                echo '&amp;page=1';
            }
            ?>
" title="<?php 
            echo $lang["fullscreenpreview"];
            ?>
">&gt;&nbsp;<?php 
            echo $lang["fullscreenpreview"];
            ?>
</a>
    
     <?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;<a style="display:inline;" href="<?php 
                    echo getval("from", "") == "search" ? $baseurl_short . "pages/search.php?" : $baseurl_short . "pages/view.php?ref=" . $ref . "&";
                    ?>
search=<?php 
                    echo urlencode($search);
                    ?>
&offset=<?php 
                    echo $offset;
                    ?>
&order_by=<?php 
                    echo $order_by;
                    ?>
&sort=<?php 
                    echo $sort;
                    ?>
&archive=<?php 
                    echo $archive;
                    ?>
&k=<?php 
                    echo $k;
                    ?>
" onClick="document.cookie='annotate=off';return CentralSpaceLoad(this);">&gt;&nbsp;<?php 
                    echo $lang['zoom'];
                    ?>
</a><?php 
                }
            }
            ///////////////
            ?>
     
<?php 
            if ($annotate_pdf_output) {
                ?>
&nbsp;&nbsp;<a style="display:inline;float:right;" class="nowrap" href="<?php 
                echo $baseurl_short;
                ?>
plugins/annotate/pages/annotate_pdf_config.php?ref=<?php 
                echo $ref;
                ?>
&ext=<?php 
                echo $resource["preview_extension"];
                ?>
&k=<?php 
                echo $k;
                ?>
&search=<?php 
                echo urlencode($search);
                ?>
&offset=<?php 
                echo $offset;
                ?>
&order_by=<?php 
                echo $order_by;
                ?>
&sort=<?php 
                echo $sort;
                ?>
&archive=<?php 
                echo $archive;
                ?>
" onClick="return CentralSpaceLoad(this);">&gt;&nbsp;<?php 
                echo $lang["pdfwithnotes"];
                ?>
</a>
<?php 
            }
            ?>

</div>
</div>

	
<?php 
        }
    } else {
        ?>
	<img src="<?php 
        echo $baseurl;
        ?>
/gfx/<?php 
        echo get_nopreview_icon($resource["resource_type"], $resource["file_extension"], false);
        ?>
" alt="" class="Picture" style="border:none;" id="previewimage" />
	<?php 
    }
    return true;
}
Beispiel #20
0
    $nextpage = -1;
}
# Locate the resource
$path = get_resource_path($ref, true, "scr", false, $ext, -1, $page, $use_watermark, "", $alternative);
$path_orig = get_resource_path($ref, true, "", false, $ext, -1, $page, $use_watermark, "", $alternative);
if (file_exists($path) && (resource_download_allowed($ref, "scr", $resource["resource_type"]) || $use_watermark)) {
    $url = get_resource_path($ref, false, "scr", false, $ext, -1, $page, $use_watermark, "", $alternative);
} else {
    $path = get_resource_path($ref, true, "pre", false, $ext, -1, $page, $use_watermark, "", $alternative);
    if (file_exists($path)) {
        $url = get_resource_path($ref, false, "pre", false, $ext, -1, $page, $use_watermark, "", $alternative);
    }
}
if (!isset($url)) {
    $info = get_resource_data($ref);
    $url = $baseurl . "/gfx/" . get_nopreview_icon($info["resource_type"], $info["file_extension"], false);
    $border = false;
}
$resource = get_resource_data($ref);
// get mp3 paths if necessary and set $use_mp3_player switch
if (!(isset($resource['is_transcoding']) && $resource['is_transcoding'] == 1) && (in_array($resource["file_extension"], $ffmpeg_audio_extensions) || $resource["file_extension"] == "mp3") && $mp3_player) {
    $use_mp3_player = true;
} else {
    $use_mp3_player = false;
}
if ($use_mp3_player) {
    $mp3realpath = get_resource_path($ref, true, "", false, "mp3");
    if (file_exists($mp3realpath)) {
        $mp3path = get_resource_path($ref, false, "", false, "mp3");
    }
}
Beispiel #21
0
                $reload_interval = 0;
                $resource_count = 0;
                $default_order_by = 7;
                $delete = 0;
                if (!existing_tile($title, $all_users, $url, $link, $reload_interval, $resource_count, $text)) {
                    create_dash_tile($url, $link, $title, $reload_interval, $all_users, $default_order_by, $resource_count, $text, $delete);
                    //Turn off the promoted collection
                    sql_query("UPDATE collection SET home_page_publish=0 WHERE ref=" . $home_collection["ref"]);
                }
            } else {
                $defaultpreview = false;
                if (file_exists(get_resource_path($home_collection["home_page_image"], true, "pre", false))) {
                    $home_col_image = get_resource_path($home_collection["home_page_image"], false, "pre", false);
                } else {
                    $defaultpreview = true;
                    $home_col_image = $baseurl_short . "gfx/" . get_nopreview_icon($home_collection["resource_type"], $home_collection["file_extension"], false);
                }
                $tile_height = 180;
                $tile_width = 250;
                ?>
				<a href="<?php 
                echo $baseurl_short;
                ?>
pages/search.php?search=!collection<?php 
                echo $home_collection["ref"];
                ?>
" onClick="return CentralSpaceLoad(this,true);" class="HomePanel HomePanelPromoted">
					<div id="HomePanelPromoted<?php 
                echo $home_collection["ref"];
                ?>
" class="HomePanelIN HomePanelPromotedIN" style="padding: 0;overflow: hidden;position: relative;height: 100%;width: 100%;min-height: 180px;">
						// swap title fields if necessary

						if (isset($metadata_template_title_field) && isset($metadata_template_resource_type))
							{
							if ($result[$n]['resource_type']==$metadata_template_resource_type)
								{
								$title=$result[$n]["field".$metadata_template_title_field];
								}	
							}	
								
						?>
						
						<!--Resource Panel-->
						<div class="ResourcePanelShellSmall">
						<table border="0" class="ResourceAlignSmall"><tr><td>
						<a href="<?php echo $baseurl_short?>pages/view.php?ref=<?php echo $rref?>&search=<?php echo urlencode("!related" . $ref)?>" onClick="return CentralSpaceLoad(this,true);"><?php if ($result[$n]["has_image"]==1) { ?><img border=0 src="<?php echo get_resource_path($rref,false,"col",false,$result[$n]["preview_extension"],-1,1,checkperm("w"),$result[$n]["file_modified"])?>" class="CollectImageBorder"/><?php } else { ?><img border=0 src="../gfx/<?php echo get_nopreview_icon($result[$n]["resource_type"],$result[$n]["file_extension"],true)?>"/><?php } ?></a></td>
						</tr></table>
						<div class="ResourcePanelInfo"><a href="<?php echo $baseurl_short?>pages/view.php?ref=<?php echo $rref?>" onClick="return CentralSpaceLoad(this,true);"><?php echo tidy_trim(i18n_get_translated($title),15)?></a>&nbsp;</div>
						<div class="ResourcePanelIcons"><input type="checkbox" id="share<?php echo $rref ?>" class="checkselect" onChange="UpdateRelatedField(this,<?php echo $rref ?>);"></div>
						
						</div>
						<?php		
						}
					}
					?>
					</div><!-- end of sharerelatedtype -->
					<div class="clearerleft"> </div>
					<?php
				} //end of display loop by resource extension
		
		?>
Beispiel #23
0
 $creation_date = $result[$n]["field" . $date_field];
 //echo $time = time();//date("r");
 // 2007-12-12 23:32:43
 // 0123456789012345678
 $year = substr($creation_date, 0, 4);
 $month = substr($creation_date, 5, 2);
 $day = substr($creation_date, 8, 2);
 $hour = substr($creation_date, 11, 2);
 $min = substr($creation_date, 14, 2);
 $sec = substr($creation_date, 17, 2);
 $pubdate = date('D, d M Y H:i:s +0100', mktime($hour, $min, $sec, $month, $day, $year));
 $url = $baseurl . "/pages/view.php?ref=" . $ref;
 $imgurl = "";
 $imgurl = get_resource_path($result[$n]['ref'], true, "col", false);
 if ($result[$n]['has_image'] != 1) {
     $imgurl = $baseurl . "/gfx/" . get_nopreview_icon($result[$n]["resource_type"], $result[$n]["file_extension"], true, false, true);
 } else {
     $imgurl = get_resource_path($result[$n]['ref'], false, "col", false);
 }
 $add_desc = "";
 foreach ($rss_fields as $rssfield) {
     if (is_array($result[$n])) {
         if (isset($result[$n]['field' . $rssfield])) {
             $value = i18n_get_translated($result[$n]['field' . $rssfield]);
         } else {
             $value = i18n_get_translated(get_data_by_field($result[$n]['ref'], $rssfield));
         }
         if ($value != "" && $value != ",") {
             // allow for value filters
             for ($x = 0; $x < count($df); $x++) {
                 if ($df[$x]['ref'] == $rssfield) {
                ?>
"><img width="<?php 
                echo $result[$n]["thumb_width"];
                ?>
" height="<?php 
                echo $result[$n]["thumb_height"];
                ?>
" src="<?php 
                echo get_resource_path($ref, false, "thm", false, $result[$n]["preview_extension"], -1, 1, (checkperm("w") || $k != "" && isset($watermark)) && $access == 1, $result[$n]["file_modified"]);
                ?>
" class="ImageBorder"></a>
		<?php 
            } else {
                ?>
		<img border=0 src="../gfx/<?php 
                echo get_nopreview_icon($result[$n]["resource_type"], $result[$n]["file_extension"], false);
                ?>
"/><?php 
            }
            ?>

		
		</td>
		</tr></table>
		<span class="ResourceSelect"><input type="checkbox" name="select_<?php 
            echo $ref;
            ?>
" value="yes"></span>

		<div class="ResourcePanelInfo"><?php 
            echo $displaytitle;
		
		<?php if ($result[$n]["has_image"]==1) {
			$path=get_resource_path($ref,true,"scr",false,$result[$n]["preview_extension"],-1,1,$use_watermark,$result[$n]["file_modified"]);
			if (file_exists($path))
				{
				# Use 'scr' path
				$path=get_resource_path ($ref, false,"scr",false,$result[$n]["preview_extension"],-1,1,$use_watermark,$result[$n]["file_modified"]);
				}
			else if (!file_exists($path))
				{
				# Attempt original file if jpeg
				$path=get_resource_path ($ref, false,"",false,$result[$n]["preview_extension"],-1,1,$use_watermark,$result[$n]["file_modified"]);
				}
		
		?><a class="lightbox" href="<?php echo $path?>" title="<?php echo htmlspecialchars($displaytitle) ?>"><img width="<?php echo $result[$n]["thumb_width"]?>" height="<?php echo $result[$n]["thumb_height"]?>" src="<?php echo get_resource_path($ref,false,"thm",false,$result[$n]["preview_extension"],-1,1,(checkperm("w") || ($k!="" && isset($watermark))) && $access==1,$result[$n]["file_modified"])?>" class="ImageBorder"></a>
		<?php } else { ?>		<img border=0 src="../gfx/<?php echo get_nopreview_icon($result[$n]["resource_type"],$result[$n]["file_extension"],false) ?>"/><?php } ?>

		
		</td>
		</tr></table>
		<span class="ResourceSelect"><input type="checkbox" name="select_<?php echo urlencode($ref) ?>" value="yes"></span>

		<div class="ResourcePanelInfo"><?php echo htmlspecialchars($displaytitle) ?>&nbsp;</div>
			
		<div class="clearer"> </div>
		</div>
		<div class="PanelShadow"></div>
		</div>
		
		<?php
		}