コード例 #1
0
function setLink($selector, $url, $title, $rel = 'lightbox')
{
    ?>
		<script>
		jQuery(document).ready(function() {
			jQuery('<?php 
    echo $selector;
    ?>
')
					.attr('href', '<?php 
    echo $url;
    ?>
')
					.attr('title', '<?php 
    echo addslashes(htmlspecialchars(i18n_get_translated($title)));
    ?>
')
					.attr('rel', '<?php 
    echo $rel;
    ?>
')
					.attr('onmouseup', 'closeModalOnLightBoxEnable();');
		});
		</script>
	<?php 
}
コード例 #2
0
ファイル: themebar.php プロジェクト: Jtgadbois/Pedadida
function DisplayThemeBar($theme1)
        {
        global $lang,$flag_new_themes,$contact_sheet,$theme_images,$allow_share,$n,$baseurl;

        # Work out theme name
        $themename=$theme1;
        $theme_display=getval("theme_$n","off");
       
        $themes=get_themes(array($theme1));
        if (count($themes)>0)
                {
                ?>

<div
onclick="
var theme_display=get_cookie('theme_<?php echo $n?>');
if (theme_display=='off'){var toggle_theme_display='on';} else { var toggle_theme_display='off';}
SetCookie('theme_<?php echo $n?>',toggle_theme_display,1000);
jQuery('#themebar_<?php echo htmlspecialchars(str_replace(array("\""," "),"",$themename)) ?>').slideToggle(0.2);


return false;">                
               
	<a href='#'><b><?php echo htmlspecialchars(stripslashes(i18n_get_translated(str_replace("*","",$themename)))) ?></b></a></div>
               
<div id="themebar_<?php echo htmlspecialchars(str_replace(array("\""," "),"",$themename)) ?>" style="display:<?php if ($theme_display == 'off'){echo 'none';} else {echo '';}?>" >
                <?php
                for ($m=0;$m<count($themes);$m++)
                        { ?><br>
                        &nbsp;&nbsp;&nbsp;<a href="<?php echo $baseurl?>/pages/search.php?search=!collection<?php echo $themes[$m]["ref"]?>&bc_from=themes"  title="<?php echo $lang["collectionviewhover"]?>"><?php echo htmlspecialchars(i18n_get_collection_name($themes[$m])) ?></a>
                        <?php
                        }
                ?><br><br></div><?php
                }
        }
コード例 #3
0
 function i18n_get_translated($text)
 {
     # For field names / values using the i18n syntax, return the version in the current user's language
     # Format is ~en:Somename~es:Someothername
     $text = trim($text);
     # For multiple keywords, parse each keyword.
     if (strpos($text, ",") !== false && strpos($text, "~") !== false) {
         $s = explode(",", $text);
         $out = "";
         for ($n = 0; $n < count($s); $n++) {
             if ($n > 0) {
                 $out .= ",";
             }
             $out .= i18n_get_translated(trim($s[$n]));
         }
         return $out;
     }
     global $language, $defaultlanguage;
     $asdefaultlanguage = $defaultlanguage;
     if (!isset($asdefaultlanguage)) {
         $asdefaultlanguage = 'en';
     }
     # Split
     $s = explode("~", $text);
     # Not a translatable field?
     if (count($s) < 2) {
         return $text;
     }
     # Find the current language and return it
     $default = "";
     for ($n = 1; $n < count($s); $n++) {
         # Not a translated string, return as-is
         if (substr($s[$n], 2, 1) != ":" && substr($s[$n], 5, 1) != ":" && substr($s[$n], 0, 1) != ":") {
             return $text;
         }
         # Support both 2 character and 5 character language codes (for example en, en-US).
         $p = strpos($s[$n], ':');
         $textLanguage = substr($s[$n], 0, $p);
         if ($textLanguage == $language) {
             return substr($s[$n], $p + 1);
         }
         if ($textLanguage == $asdefaultlanguage || $p == 0) {
             $default = substr($s[$n], $p + 1);
         }
     }
     # Translation not found? Return default language
     # No default language entry? Then consider this a broken language string and return the string unprocessed.
     if ($default != "") {
         return $default;
     } else {
         return $text;
     }
 }
コード例 #4
0
function HookResourceconnectCollectionsThumblistextra()
{
    global $usercollection;
    $thumbs = sql_query("select * from resourceconnect_collection_resources where collection='{$usercollection}' order by date_added desc");
    foreach ($thumbs as $thumb) {
        ?>
		<!--Resource Panel--> 
		<div class="CollectionPanelShell"> 

		<table border="0" class="CollectionResourceAlign"><tr><td> 
		<a target="main" href="../plugins/resourceconnect/pages/view.php?url=<?php 
        echo urlencode($thumb["url"]);
        ?>
&k=<?php 
        echo getval("k", "");
        ?>
&col=<?php 
        echo $usercollection;
        ?>
"><img border=0 src="<?php 
        echo $thumb["thumb"];
        ?>
" class="CollectImageBorder" /></a></td> 
		</tr></table> 
				
		<div class="CollectionPanelInfo"><a target="main" href="../plugins/resourceconnect/pages/view.php?url=<?php 
        echo urlencode($thumb["url"]);
        ?>
&k=<?php 
        echo getval("k", "");
        ?>
&col=<?php 
        echo $usercollection;
        ?>
"><?php 
        echo tidy_trim(i18n_get_translated($thumb["title"]), 15);
        ?>
</a>&nbsp;</div> 
				
		<div class="CollectionPanelInfo"> 
		<a href="collections.php?resourceconnect_remove=<?php 
        echo $thumb["ref"];
        ?>
&nc=<?php 
        echo time();
        ?>
">x Remove</a></div>			
		</div>
		<?php 
    }
}
コード例 #5
0
function HookResourceofthedayHomeReplaceslideshow()
{
    include_once dirname(__FILE__) . "/../inc/rotd_functions.php";
    global $baseurl, $view_title_field;
    $rotd = get_resource_of_the_day();
    if ($rotd === false) {
        return false;
    }
    # No ROTD, return false to disable hook and display standard slide show.
    # Get preview width
    $sizes = get_image_sizes($rotd, true);
    foreach ($sizes as $size) {
        if ($size["id"] == "pre") {
            $width = $size["width"];
            break;
        }
    }
    # Fetch title
    $title = sql_value("select value from resource_data where resource='{$rotd}' and resource_type_field={$view_title_field}", "");
    # 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: <?php 
    echo $width;
    ?>
px; padding-left: 3px;">
	<a onClick="return CentralSpaceLoad(this,true);" href="<?php 
    echo $baseurl;
    ?>
/pages/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;
}
コード例 #6
0
/**
* Generates the CSV content of the metadata for resources passed in the array
*
* @param $resources
* @return string
*/
function generateResourcesMetadataCSV(array $resources)
{
    global $lang;
    $return = '';
    $csv_field_headers = array();
    $resources_fields_data = array();
    foreach ($resources as $resource) {
        foreach (get_resource_field_data($resource['ref'], false, true, -1, getval("k", "") != "") as $field_data) {
            if ($field_data['name'] == '') {
                die('Please check field ID ' . $field_data['ref'] . ' and make sure its "' . $lang['property-shorthand_name'] . '" is set!');
            }
            $csv_field_headers[$field_data['name']] = $field_data['title'];
            $resources_fields_data[$resource['ref']][$field_data['name']] = $field_data['value'];
        }
    }
    $csv_field_headers = array_unique($csv_field_headers);
    // Header
    $return = '"' . $lang['resourceids'] . '","' . implode('","', $csv_field_headers) . "\"\n";
    // Results
    $csv_row = '';
    foreach ($resources_fields_data as $resource_id => $resource_fields) {
        // First column will always be Resource ID
        $csv_row = $resource_id . ',';
        // Field values
        foreach ($csv_field_headers as $column_header => $column_header_title) {
            if (!array_key_exists($column_header, $resource_fields)) {
                $csv_row .= '"",';
                continue;
            }
            foreach ($resource_fields as $field_name => $field_value) {
                if ($column_header == $field_name) {
                    $csv_row .= '"' . tidylist(i18n_get_translated($field_value)) . '",';
                }
            }
        }
        $csv_row .= "\n";
        $return .= $csv_row;
    }
    return $return;
}
コード例 #7
0
ファイル: all.php プロジェクト: chandradrupal/resourcespace
function HookResourceConnectAllSearchfiltertop()
{
    # Option to search affiliate systems in the basic search panel
    global $lang, $language, $resourceconnect_affiliates, $baseurl, $resourceconnect_selected;
    if (!checkperm("resourceconnect")) {
        return false;
    }
    ?>

	<div class="SearchItem"><?php 
    echo $lang["resourceconnect_affiliate"];
    ?>
<br />
	<select class="SearchWidth" name="resourceconnect_selected">
	
	<?php 
    for ($n = 0; $n < count($resourceconnect_affiliates); $n++) {
        ?>
		<option value="<?php 
        echo $n;
        ?>
" <?php 
        if ($resourceconnect_selected == $n) {
            ?>
selected<?php 
        }
        ?>
><?php 
        echo i18n_get_translated($resourceconnect_affiliates[$n]["name"]);
        ?>
</option>
		<?php 
    }
    ?>
	</select>
	</div>
	<?php 
}
コード例 #8
0
ファイル: home.php プロジェクト: vongalpha/resourcespace
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;
}
コード例 #9
0
/**
* Generates the CSV content of the metadata for resources passed in the array
*
* @param $resources
* @return string
*/
function generateResourcesMetadataCSV(array $resources)
{
    global $lang;
    $return = '';
    $csv_field_headers = array();
    $resources_fields_data = array();
    foreach ($resources as $resource) {
        foreach (get_resource_field_data($resource['ref'], false, true, -1, getval("k", "") != "") as $field_data) {
            $csv_field_headers[$field_data['resource_type_field']] = $field_data['title'];
            $resources_fields_data[$resource['ref']][$field_data['resource_type_field']] = $field_data['value'];
        }
    }
    $csv_field_headers = array_unique($csv_field_headers);
    // Header
    $return = '"' . $lang['resourceids'] . '","' . implode('","', $csv_field_headers) . "\"\n";
    // Results
    $csv_row = '';
    foreach ($resources_fields_data as $resource_id => $resource_fields) {
        // First column will always be Resource ID
        $csv_row = $resource_id . ',';
        // Field values
        foreach ($csv_field_headers as $column_header => $column_header_title) {
            if (!array_key_exists($column_header, $resource_fields)) {
                $csv_row .= '"",';
                continue;
            }
            foreach ($resource_fields as $field_name => $field_value) {
                if ($column_header == $field_name) {
                    $csv_row .= '"' . str_replace(array("\\n", "\\r", "\""), "//", tidylist(i18n_get_translated($field_value))) . '",';
                }
            }
        }
        $csv_row .= "\n";
        $return .= $csv_row;
    }
    return $return;
}
コード例 #10
0
	<!--List Item-->
	<tr>
	<td><?php echo htmlspecialchars(nicedate($log[$n]["date"],true)) ?></td>
	<td><?php echo htmlspecialchars($log[$n]["fullname"])?></td>
	<td><?php 
		echo $lang["collectionlog-" . $log[$n]["type"]] ;
		if ($log[$n]["notes"] != "" ) { 
			##  notes field contains user IDs, collection references and /or standard texts
			##  Translate the standard texts
			$standard = array('#all_users', '#new_resource');
			$translated   = array($lang["all_users"], $lang["new_resource"]);
			$newnotes = str_replace($standard, $translated, $log[$n]["notes"]);
			echo $newnotes;
		}
		?></td>
	<td><?php if ($log[$n]['resource']!=0){?><a onClick="return CentralSpaceLoad(this,true);" href='<?php echo $baseurl_short?>pages/view.php?ref=<?php echo urlencode($log[$n]["resource"]) ?>'><?php echo $log[$n]["resource"]?></a><?php } ?></td>
	<td><?php if ($log[$n]['resource']!=0){?><a onClick="return CentralSpaceLoad(this,true);" href='<?php echo $baseurl_short?>pages/view.php?ref=<?php echo urlencode($log[$n]["resource"]) ?>'><?php echo i18n_get_translated($log[$n]["title"])?></a><?php } ?></td>
	</tr> 
<?php } ?>
</table>
</div> <!-- End of Listview -->

<div class="BottomInpageNav">
<?php pager(false); ?></div>

</div> <!-- End of BasicsBox -->

<?php
include "../include/footer.php";
?>
コード例 #11
0
ファイル: general.php プロジェクト: artsmia/mia_resourcespace
function format_display_field($value)
{
    // applies trim/wordwrap/highlights
    global $results_title_trim, $results_title_wordwrap, $df, $x, $search;
    if (isset($df[$x]['type']) && $df[$x]['type'] == 8) {
        $value = strip_tags($value);
    }
    $string = i18n_get_translated($value);
    $string = TidyList($string);
    //$string=tidy_trim($string,$results_title_trim);
    $string = htmlspecialchars($string);
    $string = highlightkeywords($string, $search, $df[$x]['partial_index'], $df[$x]['name'], $df[$x]['indexed']);
    return $string;
}
コード例 #12
0
'><?php 
    echo $log[$n]["resourceid"];
    ?>
</a></td>
	<td><?php 
    if (!hook("replaceuserlogtitlelink")) {
        ?>
<a onClick="return CentralSpaceLoad(this,true);" href='<?php 
        echo $baseurl_short;
        ?>
pages/view.php?ref=<?php 
        echo $log[$n]["resourceid"];
        ?>
'><?php 
        if (!hook("replaceuserlogtitle")) {
            echo i18n_get_translated($log[$n]["resourcetitle"]);
        }
        ?>
</a><?php 
    }
    ?>
</td>
	
	<td><?php 
    echo $lang["log-" . $log[$n]["type"]];
    # For emailed items, append email address from the 'notes' column
    if ($log[$n]["type"] == "E") {
        echo " " . $log[$n]["notes"];
    }
    # For purchases, append size and price
    if ($log[$n]["type"] == "p") {
コード例 #13
0
						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
		
		?>
		</div>
		<div class="clearerleft"> </div>
コード例 #14
0
			<div class="Question" id="question_access">
			<label for="archive"><?php echo $lang["access"]?></label>
			<select class="stdwidth" name="access" id="access">
			<?php
			# List available access levels. The highest level must be the minimum user access level.
			for ($n=$minaccess;$n<=1;$n++) { ?>
			<option value="<?php echo $n?>"><?php echo $lang["access" . $n]?></option>
			<?php } ?>
			</select>
			<div class="clearerleft"> </div>
			</div>
			
			<?php
			for ($x=0;$x<$themecount;$x++)
				{ ?>
					<input type="hidden" name="theme<?php echo $x+1 ?>" id="theme<?php echo $x+1 ?>" value="<?php echo i18n_get_translated($themes[$x]) ?>">
				<?php 
				}
			?>
			
			<div class="Question">
			<label><?php echo $lang["expires"]?></label>
			<select name="expires" class="stdwidth">
			<option value=""><?php echo $lang["never"]?></option>
			<?php for ($n=1;$n<=150;$n++)
				{
				$date=time()+(60*60*24*$n);
				?><option <?php $d=date("D",$date);if (($d=="Sun") || ($d=="Sat")) { ?>style="background-color:#cccccc"<?php } ?> value="<?php echo date("Y-m-d",$date)?>"><?php echo nicedate(date("Y-m-d",$date),false,true)?></option>
				<?php
				}
			?>
コード例 #15
0
            ?>

			<?php 
            if ($type == 3) {
                # Drop down box
                ?>
			<select name="custom<?php 
                echo $n;
                ?>
" id="custom<?php 
                echo $n;
                ?>
" class="stdwidth">
			<?php 
                foreach ($custom_request_options[$custom[$n]] as $option) {
                    $val = i18n_get_translated($option);
                    ?>
				<option <?php 
                    if (getval("custom" . $n, "") == $val) {
                        ?>
selected<?php 
                    }
                    ?>
><?php 
                    echo htmlspecialchars($val);
                    ?>
</option>
				<?php 
                }
                ?>
			</select>
コード例 #16
0
ファイル: 2.php プロジェクト: chandradrupal/resourcespace
<?php

/* -------- Check box list ------------------ */
if (!hook("customchkboxes")) {
    # Translate all options
    $options = trim_array(explode(",", $field["options"]));
    $option_trans = array();
    $option_trans_simple = array();
    for ($m = 0; $m < count($options); $m++) {
        $trans = i18n_get_translated($options[$m]);
        $option_trans[$options[$m]] = $trans;
        $option_trans_simple[] = $trans;
    }
    if ($auto_order_checkbox) {
        natsort($option_trans);
    }
    $options = array_keys($option_trans);
    # Set the options array to the keys, so it is now effectively sorted by translated string
    $set = trim_array(explode(",", $value));
    $wrap = 0;
    $l = average_length($option_trans_simple);
    $cols = 10;
    if ($l > 5) {
        $cols = 6;
    }
    if ($l > 10) {
        $cols = 4;
    }
    if ($l > 15) {
        $cols = 3;
    }
コード例 #17
0
" id="custom<?php 
                echo $n;
                ?>
" class="stdwidth">
			<?php 
                foreach ($custom_request_options[$custom[$n]] as $option) {
                    $val = i18n_get_translated($option);
                    ?>
				<option <?php 
                    if (getval("custom" . $n, "") == $val) {
                        ?>
selected<?php 
                    }
                    ?>
><?php 
                    echo htmlspecialchars(i18n_get_translated($option));
                    ?>
</option>
				<?php 
                }
                ?>
			</select>
			<?php 
            }
            ?>
			
			<div class="clearerleft"> </div>
			</div>
			<?php 
        }
    }
コード例 #18
0
ファイル: view.php プロジェクト: claytondaley/resourcespace
function display_field_data($field, $valueonly = false, $fixedwidth = 452)
{
    global $ref, $fieldcount, $tabcount, $show_expiry_warning, $access, $tabname, $search, $extra, $lang, $used_tab_names, $related_type_show_with_data, $show_default_related_resources;
    $value = $field["value"];
    $modified_field = hook("beforeviewdisplayfielddata_processing", "", array($field));
    if ($modified_field) {
        $field = $modified_field;
    }
    # Handle expiry fields
    if (!$valueonly && $field["type"] == 6 && $value != "" && $value <= date("Y-m-d H:i") && $show_expiry_warning) {
        $extra .= "<div class=\"RecordStory\"> <h1>" . $lang["warningexpired"] . "</h1><p>" . $lang["warningexpiredtext"] . "</p><p id=\"WarningOK\"><a href=\"#\" onClick=\"document.getElementById('RecordDownload').style.display='block';document.getElementById('WarningOK').style.display='none';\">" . $lang["warningexpiredok"] . "</a></p></div><style>#RecordDownload {display:none;}</style>";
    }
    if ($value != "" && $value != "," && $field["display_field"] == 1 && ($access == 0 || $access == 1 && !$field["hide_when_restricted"])) {
        if (!$valueonly) {
            $title = htmlspecialchars(str_replace("Keywords - ", "", $field["title"]));
        } else {
            $title = "";
        }
        //if ($field["type"]==4 || $field["type"]==6) {$value=NiceDate($value,false,true);}
        # Value formatting
        if ($field["type"] == 2 || $field["type"] == 7 || $field["type"] == 9) {
            $i18n_split_keywords = true;
        } else {
            $i18n_split_keywords = false;
        }
        $value = i18n_get_translated($value, $i18n_split_keywords);
        if ($field["type"] == 2 || $field["type"] == 3 || $field["type"] == 7 || $field["type"] == 9) {
            $value = TidyList($value);
        }
        $value_unformatted = $value;
        # store unformatted value for replacement also
        if ($field["type"] != 8 || $field["type"] == 8 && $value == strip_tags($value)) {
            $value = nl2br(htmlspecialchars($value));
        }
        $modified_value = hook('display_field_modified_value', '', array($field));
        if ($modified_value) {
            $value = $modified_value['value'];
        }
        # draw new tab panel?
        if (!$valueonly && $tabname != $field["tab_name"] && $fieldcount > 0) {
            $resource_type_tab_names = sql_array('SELECT tab_name as value FROM resource_type', '');
            $resource_type_tab_names = array_filter($resource_type_tab_names);
            # Display related resources on this tab, if set:
            if (isset($related_type_show_with_data)) {
                # NOTE: the resource type tab name and the current tab you are on need to be the same:
                if (in_array($tabname, $resource_type_tab_names)) {
                    if (($key = array_search($tabname, $resource_type_tab_names)) !== false) {
                        # Fields with display template should be rendered before the related resources list:
                        echo $extra;
                        $extra = '';
                        include '../include/related_resources.php';
                        unset($resource_type_tab_names[$key]);
                        $show_default_related_resources = FALSE;
                    }
                }
            }
            $tabcount++;
            # Also display the custom formatted data $extra at the bottom of this tab panel.
            ?>
<div class="clearerleft"> </div><?php 
            echo $extra;
            ?>
</div></div><div class="TabbedPanel StyledTabbedPanel" style="display:none;" id="tab<?php 
            echo $tabcount;
            ?>
"><div><?php 
            $extra = "";
        }
        $tabname = $field["tab_name"];
        $used_tab_names[] = $tabname;
        $used_tab_names = array_unique($used_tab_names);
        $fieldcount++;
        if (!$valueonly && trim($field["display_template"]) != "") {
            # Process the value using a plugin
            $plugin = "../plugins/value_filter_" . $field["name"] . ".php";
            if ($field['value_filter'] != "") {
                eval($field['value_filter']);
            } else {
                if (file_exists($plugin)) {
                    include $plugin;
                } else {
                    if ($field["type"] == 4 || $field["type"] == 6) {
                        $value = NiceDate($value, false, true);
                    }
                }
            }
            # Highlight keywords
            $value = highlightkeywords($value, $search, $field["partial_index"], $field["name"], $field["keywords_index"]);
            # Use a display template to render this field
            $template = $field["display_template"];
            $template = str_replace("[title]", $title, $template);
            $template = str_replace("[value]", $value, $template);
            $template = str_replace("[value_unformatted]", $value_unformatted, $template);
            $template = str_replace("[ref]", $ref, $template);
            $extra .= $template;
        } else {
            #There is a value in this field, but we also need to check again for a current-language value after the i18n_get_translated() function was called, to avoid drawing empty fields
            if ($value != "") {
                # Draw this field normally.
                # value filter plugin should be used regardless of whether a display template is used.
                $plugin = "../plugins/value_filter_" . $field["name"] . ".php";
                if ($field['value_filter'] != "") {
                    eval($field['value_filter']);
                } else {
                    if (file_exists($plugin)) {
                        include $plugin;
                    } else {
                        if ($field["type"] == 4 || $field["type"] == 6) {
                            $value = NiceDate($value, false, true);
                        }
                    }
                }
                # Highlight keywords
                $value = highlightkeywords($value, $search, $field["partial_index"], $field["name"], $field["keywords_index"]);
                ?>
<div <?php 
                if (!$valueonly) {
                    echo "class=\"itemNarrow\"";
                } elseif (isset($fixedwidth)) {
                    echo "style=\"width:" . $fixedwidth . "px\"";
                }
                ?>
>
				<h3><?php 
                echo $title;
                ?>
</h3><p><?php 
                echo $value;
                ?>
</p></div><?php 
            }
        }
    }
}
コード例 #19
0
            echo urlencode($sort);
            ?>
&archive=<?php 
            echo urlencode($archive);
            ?>
&page=<?php 
            echo urlencode($nextpage);
            ?>
" class="PDFnav pageNext">&gt;</a><?php 
        }
        ?>
</td>
</tr></table>

<?php 
    }
    // end hook previewimage2
}
// end hook previewimage
?>

<?php 
if ($show_resource_title_in_titlebar) {
    $title = htmlspecialchars(i18n_get_translated(get_data_by_field($ref, $view_title_field)));
    if (strlen($title) > 0) {
        echo "<script language='javascript'>\n";
        echo "document.title = \"{$applicationname} - {$title}\";\n";
        echo "</script>";
    }
}
include "../include/footer.php";
コード例 #20
0
ファイル: 3.php プロジェクト: vongalpha/resourcespace
<?php

/* --------Drop down list ---------------- */
# Translate all options
$options = trim_array(explode(",", $fields[$n]["options"]));
$adjusted_dropdownoptions = hook("adjustdropdownoptions");
if ($adjusted_dropdownoptions) {
    $options = $adjusted_dropdownoptions;
}
$option_trans = array();
for ($m = 0; $m < count($options); $m++) {
    $option_trans[$options[$m]] = i18n_get_translated($options[$m]);
}
if ($auto_order_checkbox) {
    asort($option_trans);
}
if (substr($value, 0, 1) == ',') {
    $value = substr($value, 1);
}
// strip the leading comma if it exists
?>
<select class="stdwidth" name="<?php 
echo $name;
?>
" id="<?php 
echo $name;
?>
" <?php 
echo $help_js;
if ($edit_autosave) {
    ?>
コード例 #21
0
function add_saved_search_items($collection)
{
    # Adds resources from a search to the collection.
    $results = do_search(getvalescaped("addsearch", ""), getvalescaped("restypes", ""), "relevance", getvalescaped("archive", "", true), -1, '', false, getvalescaped("starsearch", ""), false, false, getvalescaped("daylimit", ""));
    # Check if this collection has already been shared externally. If it has, we must add a further entry
    # for this specific resource, and warn the user that this has happened.
    $keys = get_collection_external_access($collection);
    $resourcesnotadded = array();
    # record the resources that are not added so we can display to the user
    if (count($keys) > 0) {
        # Set the flag so a warning appears.
        global $collection_share_warning, $collection_allow_not_approved_share;
        $collection_share_warning = true;
        for ($n = 0; $n < count($keys); $n++) {
            # Insert a new access key entry for this resource/collection.
            global $userref;
            for ($r = 0; $r < count($results); $r++) {
                $resource = $results[$r]["ref"];
                $archivestatus = $results[$r]["archive"];
                if ($archivestatus < 0 && !$collection_allow_not_approved_share) {
                    $resourcesnotadded[$resource] = $results[$r];
                    continue;
                }
                sql_query("insert into external_access_keys(resource,access_key,user,collection,date) values ('{$resource}','" . escape_check($keys[$n]["access_key"]) . "','{$userref}','{$collection}',now())");
                #log this
                collection_log($collection, "s", $resource, $keys[$n]["access_key"]);
            }
        }
    }
    if (is_array($results)) {
        $modifyNotAdded = hook('modifynotaddedsearchitems', '', array($results, $resourcesnotadded));
        if (is_array($modifyNotAdded)) {
            $resourcesnotadded = $modifyNotAdded;
        }
        for ($n = 0; $n < count($results); $n++) {
            $resource = $results[$n]["ref"];
            if (!isset($resourcesnotadded[$resource])) {
                sql_query("delete from collection_resource where resource='{$resource}' and collection='{$collection}'");
                sql_query("insert into collection_resource(resource,collection) values ('{$resource}','{$collection}')");
            }
        }
    }
    if (!empty($resourcesnotadded)) {
        # Translate to titles only for displaying them to the user
        global $view_title_field;
        $titles = array();
        foreach ($resourcesnotadded as $resource) {
            $titles[] = i18n_get_translated($resource['field' . $view_title_field]);
        }
        return $titles;
    }
    return array();
}
コード例 #22
0
function get_smart_themes($field,$node=0,$themebar=false)
	{
	# Returns a list of smart themes (which are really field options).
	# The results are filtered so that only field options that are in use are returned.
	
	# Fetch field info
	$fielddata=sql_query("select * from resource_type_field where ref='$field'");
	if (count($fielddata)>0) {$fielddata=$fielddata[0];} else {return false;}
	
	# Return a list of keywords that are in use for this field
    global $smart_themes_omit_archived;
	$inuse=sql_array("select distinct k.keyword value from keyword k join resource_keyword rk on k.ref=rk.keyword ".(($smart_themes_omit_archived)?"join resource r on rk.resource=r.ref":"")." where resource_type_field='$field' and resource>0 ".(($smart_themes_omit_archived)?"and archive=0":""));

	if ($fielddata["type"]==7)
		{
		# Category tree style view
		$tree=explode("\n",$fielddata["options"]);

		$return=array();	
		
		global $themes_category_split_pages;
		if ($themes_category_split_pages && !$themebar)
			{
			# Return one level only, unless grabbing for themebar
			$levels=1;
			}
		else
			{
			# Return an infinite number of levels
			$levels=-1;
			}
		$return=populate_smart_theme_tree_node($tree,$node,$return,0,$levels);
		
		# For each option, if it is in use, add it to the return list.
		$out=array();
		for ($n=0;$n<count($return);$n++)
			{
			# Prepare a 'tidied' local language version of the name to use for the comparison
			# Only return items that are in use.
			$tidy=escape_check(cleanse_string(trim(strtolower(str_replace("-"," ",i18n_get_collection_name($return[$n])))),false));
			
			if (in_array($tidy,$inuse))
				{
				$c=count($out);
				$out[$c]["indent"]=$return[$n]["indent"];
				$out[$c]["name"]=trim(i18n_get_collection_name($return[$n]));
				$out[$c]["node"]=$return[$n]["node"];
				$out[$c]["children"]=$return[$n]["children"];
				}
			}
		return $out;
		}
	else
		{
		# Standard checkbox list or drop-down box
		
		# Fetch raw options list
		$options=explode(",",$fielddata["options"]);
		
		# Tidy list so it matches the storage format used for keywords.
		# The translated version is fetched as each option will be indexed in the local language version of each option.
		$options_base=array();
		for ($n=0;$n<count($options);$n++) {$options_base[$n]=escape_check(trim(strtolower(i18n_get_translated($options[$n]))));}
		
		# For each option, if it is in use, add it to the return list.
		$return=array();
		for ($n=0;$n<count($options);$n++)
			{
			#echo "<li>Looking for " . $options_base[$n] . " in " . join (",",$inuse);
			if (in_array(str_replace("-"," ",$options_base[$n]),$inuse)) 		
				{
				$c=count($return);
				$return[$c]["name"]=trim(i18n_get_translated($options[$n]));
				$return[$c]["indent"]=0;
				$return[$c]["node"]=0;
				$return[$c]["children"]=0;
				}
			}
		return $return;
		}
	}
コード例 #23
0
style="background:none;"<?php 
}
?>
>
<?php 
if ($header_text_title) {
    ?>
    <div id="TextHeader"><?php 
    echo $applicationname;
    ?>
</a></div>
    <?php 
    if ($applicationdesc != "") {
        ?>
        <div id="TextDesc"><?php 
        echo i18n_get_translated($applicationdesc);
        ?>
</div>
    <?php 
    }
}
?>
<div id="HeaderNav1" class="HorizontalNav "></div>
<div class="BasicsBox" id="uploadbox"> 

<?php 
# Define the titles:
if ($replace_resource != "") {
    # Replace file
    $titleh1 = $lang["replacefile"];
    $titleh2 = "";
コード例 #24
0
     } else {
         $sizetext = "-" . $size;
     }
     if ($subbed_original) {
         $sizetext = '(' . $lang['substituted_original'] . ')';
     }
     $fields = get_resource_field_data($ref);
     $commentdata = get_collection_resource_comment($ref, $collection);
     if (count($fields) > 0) {
         $text .= ($sizetext == "" ? "" : $sizetext) . " " . $filename . "\r\n-----------------------------------------------------------------\r\n";
         $text .= $lang["resourceid"] . ": " . $ref . "\r\n";
         for ($i = 0; $i < count($fields); $i++) {
             $value = $fields[$i]["value"];
             $title = str_replace("Keywords - ", "", $fields[$i]["title"]);
             if (trim($value) != "" && trim($value) != ",") {
                 $text .= wordwrap("* " . $title . ": " . i18n_get_translated($value) . "\r\n", 65);
             }
         }
         if (trim($commentdata['comment']) != "") {
             $text .= wordwrap($lang["comment"] . ": " . $commentdata['comment'] . "\r\n", 65);
         }
         if (trim($commentdata['rating']) != "") {
             $text .= wordwrap($lang["rating"] . ": " . $commentdata['rating'] . "\r\n", 65);
         }
         $text .= "-----------------------------------------------------------------\r\n\r\n";
     }
 }
 hook('modifydownloadfile');
 $path .= $p . "\r\n";
 if ($use_zip_extension) {
     $zip->addFile($p, $filename);
コード例 #25
0
                echo $url;
                ?>
"  onClick="return CentralSpaceLoad(this,true);" <?php 
                if (!$infobox) {
                    ?>
title="<?php 
                    echo str_replace(array("\"", "'"), "", htmlspecialchars(i18n_get_translated($value)));
                    ?>
"<?php 
                }
                //end if infobox
                ?>
><?php 
            }
            //end link
            echo highlightkeywords(tidy_trim(TidyList(i18n_get_translated($value)), 28), $search, $df[$x]['partial_index'], $df[$x]['name'], $df[$x]['indexed']);
            if ($x == 0) {
                // add link if necessary
                ?>
</a><?php 
            }
            //end link
            ?>
&nbsp;</div><div class="clearer"></div>
			<?php 
        }
    }
    ?>
			<?php 
}
?>
コード例 #26
0
include "../../include/search_functions.php";
# Is this an ajax call from the view page?
$insert = getvalescaped("insert", "");
$ref = getvalescaped("ref", "", true);
# Load access level
$access = get_resource_access($ref);
# check permissions (error message is not pretty but they shouldn't ever arrive at this page unless entering a URL manually)
if ($access == 2) {
    exit("This is a confidential resource.");
}
# Fetch resource data
$resource = get_resource_data($ref);
if ($resource === false) {
    exit($lang['resourcenotfound']);
}
$imagename = i18n_get_translated($resource["field" . $view_title_field]);
if (getval("send", "") != "") {
    $messagetext = getvalescaped("messagetext", "");
    $templatevars['url'] = $baseurl . "/?r=" . $ref;
    $templatevars['fromusername'] = $userfullname == "" ? $username : $userfullname;
    $templatevars['resourcename'] = $imagename;
    $templatevars['emailfrom'] = $useremail;
    $subject = $templatevars['fromusername'] . $lang["contactadminemailtext"];
    $templatevars['message'] = $messagetext;
    $message = $templatevars['fromusername'] . ($useremail != "" ? " (" . $useremail . ")" : "") . $lang["contactadminemailtext"] . "\n\n" . $messagetext . "\n\n" . $lang["clicktoviewresource"] . "\n\n" . $templatevars['url'];
    global $watermark;
    $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);
    }
    # Build message and send.
コード例 #27
0
        for ($n = 0; $n < count($custom_top_nav); $n++) {
            if (preg_match("/^https?\\:\\/\\/.+/", $custom_top_nav[$n]['link'])) {
                $isextlink = true;
            } else {
                $isextlink = false;
            }
            if (strpos($custom_top_nav[$n]["title"], "(lang)") !== false) {
                $custom_top_nav_title = str_replace("(lang)", "", $custom_top_nav[$n]["title"]);
                $custom_top_nav[$n]["title"] = $lang[$custom_top_nav_title];
            }
            ?>
				<li><a href="<?php 
            echo $custom_top_nav[$n]["link"];
            ?>
" onClick="return CentralSpaceLoad(this,true);"><?php 
            echo i18n_get_translated($custom_top_nav[$n]["title"]);
            ?>
</a></li>
				<?php 
        }
    }
    ?>
		
		
		<?php 
    if ($help_link) {
        ?>
<li><a href="<?php 
        echo $baseurl;
        ?>
/pages/help.php" onClick="return CentralSpaceLoad(this,true);"><?php 
コード例 #28
0
function showProfileChooser($class = '', $disabled = false)
{
    global $format_chooser_profiles, $lang;
    if (empty($format_chooser_profiles)) {
        return;
    }
    ?>
<select name="profile" id="profile" <?php 
    if (!empty($class)) {
        echo 'class="' . $class . '"';
    }
    echo $disabled ? ' disabled="disabled"' : '';
    ?>
>
		<option value="" selected="selected"><?php 
    echo $lang['format_chooser_keep_profile'];
    ?>
</option><?php 
    $index = 0;
    foreach (array_keys($format_chooser_profiles) as $name) {
        if (empty($name)) {
            $name = $lang['format_chooser_remove_profile'];
        }
        ?>
<option value="<?php 
        echo $index++;
        ?>
"><?php 
        echo i18n_get_translated($name);
        ?>
</option><?php 
    }
    ?>
</select><?php 
}
コード例 #29
0
">

<?php 
    if ($feedback_resource_select) {
        ?>
<h2><?php 
        echo $lang["selectedresources"];
        ?>
:</h2><?php 
        # Show thumbnails and allow the user to select resources.
        $result = do_search("!collection" . $collection);
        for ($n = 0; $n < count($result); $n++) {
            $ref = $result[$n]["ref"];
            $access = get_resource_access($ref);
            $use_watermark = check_use_watermark($ref);
            $title = $ref . " : " . htmlspecialchars(tidy_trim(i18n_get_translated($result[$n]["field" . $view_title_field]), 60));
            if (isset($collection_feedback_display_field)) {
                $displaytitle = htmlspecialchars(get_data_by_field($ref, $collection_feedback_display_field));
            } else {
                $displaytitle = $title;
            }
            ?>
	
		<!--Resource Panel-->
		<div class="ResourcePanelShell" id="ResourceShell<?php 
            echo $ref;
            ?>
">
		<div class="ResourcePanel">
		
		<table border="0" class="ResourceAlign<?php 
コード例 #30
0
</p>
	<?php 
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 
    }
}
?>
	<?php 
if ($alternative_file_resource_title) {
    echo "<h2>" . htmlspecialchars(i18n_get_translated($resource['field' . $view_title_field])) . "</h2><br/>";
}
?>
<h1><?php 
echo $lang["managealternativefilestitle"];
?>
</h1>
</div>

<form method=post id="fileform" action="<?php 
echo $baseurl_short;
?>
pages/alternative_files.php?ref=<?php 
echo urlencode($ref);
?>
&search=<?php