</a></p> <h1><?php echo $lang['uploadviaemail']; ?> </h1> <?php if ($userinfo['email'] == "") { error_alert($lang['pleasesetupemailaddress']); } $message = str_replace("[fromaddress]", $userinfo['email'], $lang['uploadviaemail-intro']); $message = str_replace("[toaddress]", $checkmail_email, $message); $subjectfield = sql_value("select title value from resource_type_field where ref='{$checkmail_subject_field}'", ""); $bodyfield = sql_value("select title value from resource_type_field where ref='{$checkmail_body_field}'", ""); $message = str_replace("[subjectfield]", lang_or_i18n_get_translated($subjectfield, "fieldtitle-"), $message); $message = str_replace("[bodyfield]", lang_or_i18n_get_translated($bodyfield, "fieldtitle-"), $message); $access = $checkmail_default_access; $access = $lang["access{$access}"]; $archive = $checkmail_default_archive; $archive = $lang["status{$archive}"]; $message = str_replace("[access]", $access, $message); $message = str_replace("[archive]", $archive, $message); $message = str_replace("[confirmation]", $lang['checkmail_confirmation_message'], $message); ?> <p><?php echo $message; ?> </p> </div> <?php
if ($searchbyday) { $searchbuttons.="document.getElementById('basicday').value='';"; } if ($display_user_rating_stars && $star_search) { $searchbuttons.="StarSearchRatingDisplay(0,'StarCurrent');document.getElementById('starsearch').value='';window['StarSearchRatingDone']=true;"; } $searchbuttons.="ResetTicks();\"/>"; } $searchbuttons.="<input name=\"Submit\" class=\"searchbutton\" type=\"submit\" value=\" ". $lang['searchbutton']." \" /></div>";?> <?php if (!$searchbar_buttons_at_bottom){ echo $searchbuttons."<br/>"; } ?> <?php if (!$basic_simple_search) { // Include simple search items (if any) $optionfields=array(); for ($n=0;$n<count($fields);$n++) { hook("modifysearchfieldtitle");?> <div class="SearchItem" id="simplesearch_<?php echo $fields[$n]["ref"] ?>" <?php if (strlen($fields[$n]["tooltip_text"])>=1){echo "title=\"" . htmlspecialchars(lang_or_i18n_get_translated($fields[$n]["tooltip_text"], "fieldtooltip-")) . "\"";}?>><?php echo htmlspecialchars($fields[$n]["title"]) ?><br /> <?php $value=""; # to do, fetch set value. if (isset($set_fields[$fields[$n]["name"]])) {$value=$set_fields[$fields[$n]["name"]];} #hook to modify field type in special case. Returning zero (to get a standard text box) doesn't work, so return 1 for type 0, 2 for type 1, etc. if(hook("modifyfieldtype")){$fields[$n]["type"]=hook("modifyfieldtype")-1;} switch ($fields[$n]["type"]) { case 0: # -------- Text boxes?><?php case 1: case 5: case 9: ?>
?> </td> </tr> <?php # ------------ View access to resource types $rtypes = sql_query("select * from resource_type order by name"); foreach ($rtypes as $rtype) { DrawOption("T" . $rtype["ref"], $lang["can_see_resource_type"] . " '" . lang_or_i18n_get_translated($rtype["name"], "resourcetype-") . "'", true); } # ------------ Restricted access to resource types foreach ($rtypes as $rtype) { DrawOption("X" . $rtype["ref"], $lang["restricted_access_only_to_resource_type"] . " '" . lang_or_i18n_get_translated($rtype["name"], "resourcetype-") . "'", false); } # ------------ Restricted upload for resource of type foreach ($rtypes as $rtype) { DrawOption("XU" . $rtype["ref"], $lang["restricted_upload_for_resource_of_type"] . " '" . lang_or_i18n_get_translated($rtype["name"], "resourcetype-") . "'", false); } ?> <tr class="ListviewTitleStyle"> <td colspan=3 class="permheader"><?php echo $lang["resource_creation_and_management"]; ?> </td> </tr> <?php # ------------ Edit access to workflow states for ($n = -2; $n <= 3; $n++) { DrawOption("e" . $n, $lang["edit_access_to_workflow_state"] . " '" . $lang["status" . $n] . "'", false); } foreach ($additional_archive_states as $additional_archive_state) { DrawOption("e" . $additional_archive_state, $lang["edit_access_to_workflow_state"] . " '" . (isset($lang["status" . $additional_archive_state]) ? $lang["status" . $additional_archive_state] : $additional_archive_state) . "'", false);
?> </td> <?php hook("user_log_before_userid"); ?> <td><?php echo $lang["resourceid"]; ?> </td> <?php if (!hook("replaceuserlogtitleheader")) { ?> <td><?php $field = get_fields(array($view_title_field)); if (isset($field[0])) { echo lang_or_i18n_get_translated($field[0]["title"], "fieldtitle-"); } ?> </td><?php } ?> <td><?php echo $lang["action"]; ?> </td> <td><?php echo $lang["field"]; ?> </td> <?php hook("adduserlogcolumnheader");
for($n=0;$n<count($list_display_array);$n++){?> <?php if ($per_page==$list_display_array[$n]){?><span class="Selected"><?php echo $list_display_array[$n]?></span><?php } else { ?><a onClick="return CentralSpaceLoad(this,true);" href="<?php echo $url; ?>&per_page_list_log=<?php echo $list_display_array[$n]?>"><?php echo $list_display_array[$n]?></a><?php } ?> | <?php } ?> <?php if ($per_page==99999){?><span class="Selected"><?php echo $lang["all"]?></span><?php } else { ?><a onClick="return CentralSpaceLoad(this,true);" href="<?php echo $url; ?>&per_page_list_log=99999"><?php echo $lang["all"]?></a><?php } ?> </div> <?php pager(false); ?></div> <div class="Listview"> <table border="0" cellspacing="0" cellpadding="0" class="ListviewStyle"> <!--Title row--> <tr class="ListviewTitleStyle"> <td><?php echo $lang["date"]?></td> <td><?php echo $lang["user"]?></td> <td><?php echo $lang["action"]?></td> <td><?php echo $lang["resourceid"]?></td> <td><?php $field=get_fields(array($view_title_field)); echo lang_or_i18n_get_translated($field[0]["title"], "fieldtitle-");?></td> </tr> <?php for ($n=$offset;(($n<count($log)) && ($n<($offset+$per_page)));$n++) { if (!isset($lang["collectionlog-".$log[$n]["type"]])){$lang["collectionlog-".$log[$n]["type"]]="";} ?> <!--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
function HookLicensemanagerViewCustompanels() { global $lang, $baseurl_short, $ref, $edit_access, $k; if ($k != "") { return false; } $licenses = sql_query("select ref,outbound,holder,license_usage,description,expires from resource_license where resource='{$ref}' order by ref"); ?> <!-- Begin Geolocation Section --> <div class="RecordBox"> <div class="RecordPanel"> <div class="Title"><?php echo $lang["license_management"]; ?> </div> <?php if ($edit_access) { ?> <p>> <a href="<?php echo $baseurl_short; ?> plugins/licensemanager/pages/edit.php?ref=new&resource=<?php echo $ref; ?> " onClick="return CentralSpaceLoad(this,true);"><?php echo $lang["new_license"]; ?> </a></p> <?php } ?> <?php if (count($licenses) > 0) { ?> <div class="Listview"> <table border="0" cellspacing="0" cellpadding="0" class="ListviewStyle"> <tr class="ListviewTitleStyle"> <td><?php echo $lang["license_id"]; ?> </a></td> <td><?php echo $lang["type"]; ?> </a></td> <td><?php echo $lang["licensor_licensee"]; ?> </a></td> <td><?php echo $lang["indicateusagemedium"]; ?> </a></td> <td><?php echo $lang["description"]; ?> </a></td> <td><?php echo $lang["fieldtitle-expiry_date"]; ?> </a></td> <?php if ($edit_access) { ?> <td><div class="ListTools"><?php echo $lang["tools"]; ?> </div></td> <?php } ?> </tr> <?php foreach ($licenses as $license) { $license_usage_mediums = trim_array(explode(", ", $license["license_usage"])); $translated_mediums = ""; ?> <tr> <td><?php echo $license["ref"]; ?> </td> <td><?php echo $license["outbound"] ? $lang["outbound"] : $lang["inbound"]; ?> </td> <td><?php echo $license["holder"]; ?> </td> <td><?php foreach ($license_usage_mediums as $medium) { $translated_mediums = $translated_mediums . lang_or_i18n_get_translated($medium, "license_usage-") . ", "; } $translated_mediums = substr($translated_mediums, 0, -2); # Remove the last ", " echo $translated_mediums; ?> </td> <td><?php echo $license["description"]; ?> </td> <td><?php echo nicedate($license["expires"]); ?> </td> <?php if ($edit_access) { ?> <td><div class="ListTools"> <a href="<?php echo $baseurl_short; ?> plugins/licensemanager/pages/edit.php?ref=<?php echo $license["ref"]; ?> &resource=<?php echo $ref; ?> " onClick="return CentralSpaceLoad(this,true);">> <?php echo $lang["action-edit"]; ?> </a> <a href="<?php echo $baseurl_short; ?> plugins/licensemanager/pages/delete.php?ref=<?php echo $license["ref"]; ?> &resource=<?php echo $ref; ?> " onClick="return CentralSpaceLoad(this,true);">> <?php echo $lang["action-delete"]; ?> </a> </div></td> <?php } ?> </tr> <?php } ?> </table> </div> <?php } ?> </div> <div class="PanelShadow"></div> </div> <?php return false; # Allow further custom panels }
if ($archiver) { ?> <div class="Question"> <label for="archivetype"><?php echo $lang["archivesettings"]; ?> </label> <div class="tickset"> <select name="settings" class="stdwidth" id="archivesettings"><?php foreach ($collection_download_settings as $key => $value) { ?> <option value="<?php echo htmlspecialchars($key); ?> "><?php echo lang_or_i18n_get_translated($value["name"], "archive-"); ?> </option><?php } ?> </select> <div class="clearerleft"></div></div><br> </div><?php } ?> <div class="QuestionSubmit" id="downloadbuttondiv"> <label for="download"> </label> <?php if (!$use_zip_extension) { ?>
echo "<tr><td colspan=\"5\">" . $lang['new_tags'] . "</td></tr>"; echo "<tr><td width=\"150\">" . $applicationname . "</td><td width=\"50\">" . $lang['group'] . "</td><td width=\"150\">" . $lang['exiftooltag'] . "</td><td>" . $lang['embeddedvalue'] . "</td><td>{$write_status}</td></tr>"; # Process the report of the original file. foreach ($results_simulated as $result_simulated) { $group = $result_simulated["group"]; $tag = $result_simulated["tag"]; $value = $result_simulated["value"]; $tagprops = $result_simulated["tagprops"]; # Check if the tag hasn't been displayed already. if (isset($resourcefields[$tag]['listed']) && !$resourcefields[$tag]['listed'] || isset($resourcefields[$group . ":" . $tag]['listed']) && !$resourcefields[$group . ":" . $tag]['listed']) { # Work out the RS resource field ref and title for the tag. echo "<tr>"; if (isset($resourcefields[$tag]['ref'])) { $RS_field_ref = $resourcefields[$tag]['ref']; } elseif (isset($resourcefields[$group . ":" . $tag]['ref'])) { $RS_field_ref = $resourcefields[$group . ":" . $tag]['ref']; } $RS_field_name = sql_query("select title from resource_type_field where ref = {$RS_field_ref}"); $RS_field_name = lang_or_i18n_get_translated($RS_field_name[0]['title'], "fieldtitle-"); # Display the RS resource field ref, title, exiftool group, tag and properties. echo "<td>" . str_replace(array('%ref%', '%name%'), array($RS_field_ref, $RS_field_name), $lang['field_ref_and_name']) . "</td><td>{$group}</td><td>{$tag} {$tagprops}</td>"; # Display the value. if ($tag != "filesize" && $tag != "filemodifydate") { echo "<td></td><td>+ " . $value . "</td>"; } echo "</tr>"; } } } echo "</table>"; }
$lGroupName = $ldapGroupList[$i]['cn']; // create the usergroup list echo '<select name="ldapmaptors['.$lGroupName.']">'; foreach ($usergroups as $usergroup) { $ref = $usergroup['ref']; echo '<option value="'.$ref.'"'; // check mapping; if (isset($ldapauth['groupmap'][$lGroupName]['rsGroup'])) { if ($ref == $ldapauth['groupmap'][$lGroupName]['rsGroup']) { echo "selected"; } } echo '>' . lang_or_i18n_get_translated($usergroup['name'], "usergroup-") . '</option>'; } echo "</select>"; echo "</td>"; echo "<td>"; echo '<input name="ldapGroupEnable['.$lGroupName.']" type="checkbox" '; // check to see if the enabled exists and if it has a value! if (isset($ldapauth['groupmap'][$lGroupName]['enabled'])) { if( $ldapauth['groupmap'][$lGroupName]['enabled']) { echo "checked"; } } echo ' />'; echo "</td>";
<td><div class="ListTools"><?php echo $lang['tools']; ?> </div></div> </td> </tr> <?php foreach ($current_whitelists as $whitelist) { ?> <tr> <td><?php echo $whitelist['ip_domain']; ?> </td> <td><?php echo $whitelist['fullname'] . " (" . lang_or_i18n_get_translated($whitelist['groupname'], "usergroup-") . ")"; ?> </td> <td><?php echo $whitelist['apis'] == "all" ? $lang['all'] : $whitelist['apis']; ?> </td> <td><div class="ListTools"><a onclick="return confirm('<?php echo $lang['apicore_deletesure']; ?> ')" href="<?php echo $baseurl_short; ?> plugins/api_core/pages/setup.php?delete=true&ref=<?php echo $whitelist['ref']; ?>
if (isset($smartsearch[0])) { $alt_text = "title='search=" . $smartsearch[0]['search'] . "&restypes=" . $smartsearch[0]['restypes'] . "&archive=" . $smartsearch[0]['archive'] . "&starsearch=" . $smartsearch[0]['starsearch'] . "'"; } } hook("collectionsearchtitlemod"); $search_title .= '<div align="left"><h1><div class="searchcrumbs">' . ($is_theme ? $theme_link . " > " : "") . '<span id="coltitle' . $collection . '"><a ' . $alt_text . ' href="' . $baseurl_short . 'pages/search.php?search=!collection' . $collection . $parameters_string . '" onClick="return CentralSpaceLoad(this,true);">' . i18n_get_collection_name($collectiondata) . ($display_user_and_access ? " <span class='CollectionUser'>(" . $colusername . $colaccessmode . ")" : "") . '</span></a></span>' . $searchcrumbs . '</div></h1> '; } elseif ($search == "" && $archive == 0) { # Which resource types (if any) are selected? $searched_types_refs_array = explode(",", $restypes); # Searched resource types and collection types $resource_types_array = get_resource_types("", false); # Get all resource types, untranslated $searched_resource_types_names_array = array(); for ($n = 0; $n < count($resource_types_array); $n++) { if (in_array($resource_types_array[$n]["ref"], $searched_types_refs_array)) { $searched_resource_types_names_array[] = htmlspecialchars(lang_or_i18n_get_translated($resource_types_array[$n]["name"], "resourcetype-", "-2")); } } if (count($searched_resource_types_names_array) == count($resource_types_array)) { # All resource types are selected, don't list all of them unset($searched_resource_types_names_array); $searched_resource_types_names_array[0] = $lang["all-resourcetypes"]; } # Which collection types (if any) are selected? $searched_collection_types_names_array = array(); if (in_array("mycol", $searched_types_refs_array)) { $searched_collection_types_names_array[] = $lang["mycollections"]; } if (in_array("pubcol", $searched_types_refs_array)) { $searched_collection_types_names_array[] = $lang["publiccollections"]; }
function send_periodic_report_emails() { # For all configured periodic reports, send a mail if necessary. global $lang, $baseurl; # Query to return all 'pending' report e-mails, i.e. where we haven't sent one before OR one is now overdue. $query = "\n\t\tSELECT pe.*,\n\t\t u.email,\n\t\t r.name\n\t\t FROM report_periodic_emails pe\n\t\t JOIN user u ON pe.user = u.ref\n\t\t JOIN report r ON pe.report = r.ref\n\t\t WHERE pe.last_sent IS NULL\n\t\t OR date_add(date(pe.last_sent), INTERVAL pe.email_days DAY) <= date(now());\n\t"; $reports = sql_query($query); foreach ($reports as $report) { $start = time() - 60 * 60 * 24 * $report["period"]; $from_y = date("Y", $start); $from_m = date("m", $start); $from_d = date("d", $start); $to_y = date("Y"); $to_m = date("m"); $to_d = date("d"); # Translates the report name. $report["name"] = lang_or_i18n_get_translated($report["name"], "report-"); # Generate remote HTML table. $output = do_report($report["report"], $from_y, $from_m, $from_d, $to_y, $to_m, $to_d, false, true); # Formulate a title $title = $report["name"] . ": " . str_replace("?", $report["period"], $lang["lastndays"]); # Send mail to original user - this contains the unsubscribe link # Note: this is basically the only way at the moment to delete a periodic report $delete_link = sprintf('<br />%s<br />%s/?dr=%s', $lang['report_delete_periodic_email_link'], $baseurl, $report['ref']); $unsubscribe = "<br>" . $lang["unsubscribereport"] . "<br>" . $baseurl . "/?ur=" . $report["ref"]; $email = $report["email"]; // Check user unsubscribed from this report $query = sprintf(' SELECT true as `value` FROM report_periodic_emails_unsubscribe WHERE user_id = "%s" AND periodic_email_id = "%s"; ', $report['user'], $report['ref']); $unsubscribed_user = sql_value($query, false); if (!$unsubscribed_user) { echo $lang["sendingreportto"] . " " . $email . "<br>" . $output . $delete_link . $unsubscribe . "<br>"; send_mail($email, $title, $output . $delete_link . $unsubscribe); } // Jump to next report if this should only be sent to one user if (!$report['send_all_users'] && empty($report['user_groups'])) { # Mark as done. sql_query('UPDATE report_periodic_emails set last_sent = now() where ref = "' . $report['ref'] . '";'); continue; } # Send to all other active users, if configured. # Send the report to all active users. $users = get_users(); // Send e-mail reports to users belonging to the specific user groups if (!empty($report['user_groups'])) { $users = get_users($report['user_groups']); } foreach ($users as $user) { $email = $user['email']; # Do not send to original report user, as they receive the mail with the unsubscribe link above. if ($user['approved'] && $email == $report['email'] || !$user['approved']) { continue; } // Check user unsubscribed from this report $query = sprintf(' SELECT true as `value` FROM report_periodic_emails_unsubscribe WHERE user_id = "%s" AND periodic_email_id = "%s"; ', $user['ref'], $report['ref']); $unsubscribed_user = sql_value($query, false); if (!$unsubscribed_user) { $unsubscribe_link = sprintf('<br />%s<br />%s/?ur=%s', $lang['unsubscribereport'], $baseurl, $report['ref']); echo $lang["sendingreportto"] . " " . $email . "<br>" . $output . $unsubscribe_link . "<br>"; send_mail($email, $title, $output . $unsubscribe_link); } } # Mark as done. sql_query('UPDATE report_periodic_emails set last_sent = now() where ref = "' . $report['ref'] . '";'); } }
if (in_array($tag, $writable_tags_array) && $file_writability) { $tagprops .= "w"; } if ($tagprops != "") { $tagprops = "({$tagprops})"; } if (isset($simcommands[$tag]['value']) || isset($simcommands[$group . ":" . $tag])) { #add notes to mapped fields if (isset($simcommands[$tag]['ref'])) { $RS_field_ref = $simcommands[$tag]['ref']; } elseif (isset($simcommands[$group . ":" . $tag])) { $RS_field_ref = $simcommands[$group . ":" . $tag]['ref']; } $RS_field_name = sql_query("select title from resource_type_field where ref = {$RS_field_ref}"); $RS_field_name = $RS_field_name[0]['title']; echo "<td>" . $RS_field_ref . " - " . lang_or_i18n_get_translated($RS_field_name, "fieldtitle-") . "</td><td>{$group}</td><td>{$tag} {$tagprops}</td>"; } else { echo "<td></td><td>{$group}</td><td>{$tag} {$tagprops}</td>"; } #add diff arrow to fields that will likely change if (isset($simcommands[$tag]['value']) || isset($simcommands[$group . ":" . $tag]['value'])) { if (isset($simcommands[$tag]['value'])) { $newvalue = $simcommands[$tag]['value']; } else { if (isset($simcommands[$group . ":" . $tag]['value'])) { $newvalue = $simcommands[$group . ":" . $tag]['value']; } } // remove a leading comma from value in database when comparing. if (substr($newvalue, 0, 1) == ',') { $newvalue = substr($newvalue, 1);
echo lang_or_i18n_get_translated($item["name"], array("resourcetype-", "requesttype-", "fieldtype-")); ?> </option> <?php } ?> </select> <?php break; #------------------------------------------------------------------------- #------------------------------------------------------------------------- case "lbl": # label ?> <?php echo str_replace("%ref", $ref, lang_or_i18n_get_translated($value, "information-")); ?> <?php break; } } } ?> </p> <?php } } ?> <table width="100%" cellpadding=0 cellspacing=0 style="margin-top:5px;"> <tr><td align=left> <!--
function render_search_field($field, $value = "", $autoupdate, $class = "stdwidth", $forsearchbar = false, $limit_keywords = array()) { # Renders the HTML for the provided $field for inclusion in a search form, for example the # advanced search page. Standard field titles are translated using $lang. Custom field titles are i18n translated. # # $field an associative array of field data, i.e. a row from the resource_type_field table. # $name the input name to use in the form (post name) # $value the default value to set for this field, if any global $auto_order_checkbox, $lang, $category_tree_open, $minyear; $name = "field_" . $field["ref"]; if (!$forsearchbar) { ?> <div class="Question" <?php if (strlen($field["tooltip_text"]) >= 1) { echo "title=\"" . htmlspecialchars(lang_or_i18n_get_translated($field["tooltip_text"], "fieldtooltip-")) . "\""; } ?> > <label><?php echo lang_or_i18n_get_translated($field["title"], "fieldtitle-"); ?> </label> <?php } else { ?> <div class="SearchItem"> <?php echo lang_or_i18n_get_translated($field["title"], "fieldtitle-"); ?> </br> <?php } switch ($field["type"]) { case 0: # -------- Text boxes # -------- Text boxes case 1: case 5: ?> <input class="<?php echo $class; ?> " type=text name="field_<?php echo $field["ref"]; ?> " value="<?php echo htmlspecialchars($value); ?> " <?php if ($autoupdate) { ?> onChange="UpdateResultCount();"<?php } ?> onKeyPress="if (!(updating)) {setTimeout('UpdateResultCount()',2000);updating=true;}"><?php break; case 2: case 3: # -------- Show a check list or dropdown for dropdowns and check lists? # By default show a checkbox list for both (for multiple selections this enabled OR functionality) # Translate all options $options = trim_array(explode(",", $field["options"])); $adjusted_dropdownoptions = hook("adjustdropdownoptions"); if ($adjusted_dropdownoptions) { $options = $adjusted_dropdownoptions; } $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) { asort($option_trans); } $options = array_keys($option_trans); # Set the options array to the keys, so it is now effectively sorted by translated string if ($field["display_as_dropdown"]) { # Show as a dropdown box $set = trim_array(explode(";", cleanse_string($value, true))); ?> <select class="<?php echo $class; ?> " name="field_<?php echo $field["ref"]; ?> " <?php if ($autoupdate) { ?> onChange="UpdateResultCount();"<?php } ?> ><option value=""></option><?php foreach ($option_trans as $option => $trans) { if (trim($trans) != "") { ?> <option value="<?php echo htmlspecialchars(trim($trans)); ?> " <?php if (in_array(cleanse_string($trans, true), $set)) { ?> selected<?php } ?> ><?php echo htmlspecialchars(trim($trans)); ?> </option> <?php } } ?> </select><?php } else { # Show as a checkbox list (default) $set = trim_array(explode(";", cleanse_string($value, true))); $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; } if ($l > 25) { $cols = 2; } # Filter the options array for blank values and ignored keywords. $newoptions = array(); foreach ($options as $option) { if ($option != "" && (count($limit_keywords) == 0 || in_array($option, $limit_keywords))) { $newoptions[] = $option; } } $options = $newoptions; $height = ceil(count($options) / $cols); global $checkbox_ordered_vertically; if ($checkbox_ordered_vertically) { if (!hook('rendersearchchkboxes')) { # ---------------- Vertical Ordering (only if configured) ----------- ?> <table cellpadding=2 cellspacing=0><tr><?php for ($y = 0; $y < $height; $y++) { for ($x = 0; $x < $cols; $x++) { # Work out which option to fetch. $o = $x * $height + $y; if ($o < count($options)) { $option = $options[$o]; $trans = $option_trans[$option]; $name = $field["ref"] . "_" . md5($option); if ($option != "") { ?> <td valign=middle><input type=checkbox id="<?php echo $name; ?> " name="<?php echo $name; ?> " value="yes" <?php if (in_array(cleanse_string($trans, true), $set)) { ?> checked<?php } ?> <?php if ($autoupdate) { ?> onClick="UpdateResultCount();"<?php } ?> ></td><td valign=middle><?php echo htmlspecialchars($trans); ?> </td> <?php } else { ?> <td></td><td></td><?php } } } ?> </tr><tr><?php } ?> </tr></table><?php } } else { # ---------------- Horizontal Ordering (Standard) --------------------- ?> <table cellpadding=2 cellspacing=0><tr><?php foreach ($option_trans as $option => $trans) { $wrap++; if ($wrap > $cols) { $wrap = 1; ?> </tr><tr><?php } $name = $field["ref"] . "_" . md5($option); if ($option != "") { ?> <td valign=middle><input type=checkbox id="<?php echo $name; ?> " name="<?php echo $name; ?> " value="yes" <?php if (in_array(cleanse_string(i18n_get_translated($option), true), $set)) { ?> checked<?php } ?> <?php if ($autoupdate) { ?> onClick="UpdateResultCount();"<?php } ?> ></td><td valign=middle><?php echo htmlspecialchars($trans); ?> </td> <?php } } ?> </tr></table><?php } } break; case 4: case 6: # ----- Date types $found_year = ''; $found_month = ''; $found_day = ''; $s = explode("-", $value); if (count($s) >= 3) { $found_year = $s[0]; $found_month = $s[1]; $found_day = $s[2]; } ?> <select name="<?php echo $name; ?> _year" class="SearchWidth" style="width:100px;" <?php if ($autoupdate) { ?> onChange="UpdateResultCount();"<?php } ?> > <option value=""><?php echo $lang["anyyear"]; ?> </option> <?php $y = date("Y"); for ($d = $minyear; $d <= $y; $d++) { ?> <option <?php if ($d == $found_year) { ?> selected<?php } ?> ><?php echo $d; ?> </option><?php } ?> </select> <select name="<?php echo $name; ?> _month" class="SearchWidth" style="width:100px;" <?php if ($autoupdate) { ?> onChange="UpdateResultCount();"<?php } ?> > <option value=""><?php echo $lang["anymonth"]; ?> </option> <?php for ($d = 1; $d <= 12; $d++) { $m = str_pad($d, 2, "0", STR_PAD_LEFT); ?> <option <?php if ($d == $found_month) { ?> selected<?php } ?> value="<?php echo $m; ?> "><?php echo $lang["months"][$d - 1]; ?> </option><?php } ?> </select> <select name="<?php echo $name; ?> _day" class="SearchWidth" style="width:100px;" <?php if ($autoupdate) { ?> onChange="UpdateResultCount();"<?php } ?> > <option value=""><?php echo $lang["anyday"]; ?> </option> <?php for ($d = 1; $d <= 31; $d++) { $m = str_pad($d, 2, "0", STR_PAD_LEFT); ?> <option <?php if ($d == $found_day) { ?> selected<?php } ?> value="<?php echo $m; ?> "><?php echo $m; ?> </option><?php } ?> </select> <?php break; case 7: # ----- Category Tree $options = $field["options"]; $set = trim_array(explode(";", cleanse_string($value, true))); if ($forsearchbar) { # On the search bar? # Produce a smaller version of the category tree in a single dropdown - max two levels ?> <select class="<?php echo $class; ?> " name="field_<?php echo $field["ref"]; ?> "><option value=""></option><?php $class = explode("\n", $options); for ($t = 0; $t < count($class); $t++) { $s = explode(",", $class[$t]); if (count($s) == 3 && $s[1] == 0) { # Found a first level ?> <option <?php if (in_array(cleanse_string($s[2], true), $set)) { ?> selected<?php } ?> ><?php echo $s[2]; ?> </option> <?php # Parse tree again looking for level twos at this point for ($u = 0; $u < count($class); $u++) { $v = explode(",", $class[$u]); if (count($v) == 3 && $v[1] == $s[0]) { # Found a first level ?> <option value="<?php echo $s[2] . "," . $v[2]; ?> " <?php if (in_array(cleanse_string($s[2], true), $set) && in_array(cleanse_string($v[2], true), $set)) { ?> selected<?php } ?> > - <?php echo $v[2]; ?> </option> <?php } } } } ?> </select> <?php } else { # For advanced search and elsewhere, include the category tree. include "../pages/edit_fields/7.php"; } break; case 9: #-- Dynamic keywords list $value = str_replace(";", ",", $value); # Different syntax used for keyword separation when searching. include "../pages/edit_fields/9.php"; break; } ?> <div class="clearerleft"> </div> </div> <?php }
function render_search_field($field, $value = "", $autoupdate, $class = "stdwidth", $forsearchbar = false, $limit_keywords = array()) { # Renders the HTML for the provided $field for inclusion in a search form, for example the # advanced search page. Standard field titles are translated using $lang. Custom field titles are i18n translated. # # $field an associative array of field data, i.e. a row from the resource_type_field table. # $name the input name to use in the form (post name) # $value the default value to set for this field, if any global $auto_order_checkbox, $auto_order_checkbox_case_insensitive, $lang, $category_tree_open, $minyear, $daterange_search, $is_search, $values, $n; $name = "field_" . $field["ref"]; #Check if field has a display condition set $displaycondition = true; if ($field["display_condition"] != "") { $s = explode(";", $field["display_condition"]); $condref = 0; foreach ($s as $condition) { $displayconditioncheck = false; $s = explode("=", $condition); global $fields; for ($cf = 0; $cf < count($fields); $cf++) { if ($s[0] == $fields[$cf]["name"] && ($fields[$cf]["resource_type"] == 0 || $fields[$cf]["resource_type"] == $field["resource_type"])) { $scriptconditions[$condref]["field"] = $fields[$cf]["ref"]; # add new jQuery code to check value $scriptconditions[$condref]['type'] = $fields[$cf]['type']; $scriptconditions[$condref]['options'] = $fields[$cf]['options']; $checkvalues = $s[1]; $validvalues = explode("|", strtoupper($checkvalues)); $scriptconditions[$condref]["valid"] = "\""; $scriptconditions[$condref]["valid"] .= implode("\",\"", $validvalues); $scriptconditions[$condref]["valid"] .= "\""; if (isset($values[$fields[$cf]["name"]])) { $v = trim_array(explode(" ", strtoupper($values[$fields[$cf]["name"]]))); foreach ($validvalues as $validvalue) { if (in_array($validvalue, $v)) { $displayconditioncheck = true; } # this is a valid value } } if (!$displayconditioncheck) { $displaycondition = false; } #add jQuery code to update on changes if ($fields[$cf]["type"] == 2 && $fields[$cf]["display_as_dropdown"] == 0) { # construct the value from the ticked boxes $val = ","; # Note: it seems wrong to start with a comma, but this ensures it is treated as a comma separated list by split_keywords(), so if just one item is selected it still does individual word adding, so 'South Asia' is split to 'South Asia','South','Asia'. $options = trim_array(explode(",", $fields[$cf]["options"])); ?> <script type="text/javascript"> jQuery(document).ready(function() {<?php for ($m = 0; $m < count($options); $m++) { $checkname = $fields[$cf]["ref"] . "_" . md5($options[$m]); echo "\n jQuery('input[name=\"" . $checkname . "\"]').change(function (){\n checkDisplayCondition" . $field["ref"] . "();\n });"; } ?> }); </script><?php } else { if ($fields[$cf]['type'] == 12 && $fields[$cf]['display_as_dropdown'] == 0) { ?> <script type="text/javascript"> jQuery(document).ready(function() { // Check for radio buttons (default behaviour) jQuery('input[name=field_<?php echo $fields[$cf]["ref"]; ?> ]:radio').change(function() { checkDisplayCondition<?php echo $field["ref"]; ?> (); }); <?php $options = trim_array(explode(',', $fields[$cf]['options'])); foreach ($options as $option) { $name = 'field_' . $fields[$cf]['ref'] . '_' . sha1($option); ?> // Check for checkboxes (advanced search behaviour) jQuery('input[name=<?php echo $name; ?> ]:checkbox').change(function() { checkDisplayCondition<?php echo $field['ref']; ?> (); }); <?php } ?> }); </script> <?php } else { ?> <script type="text/javascript"> jQuery(document).ready(function() { jQuery('#field_<?php echo $fields[$cf]["ref"]; ?> ').change(function (){ checkDisplayCondition<?php echo $field["ref"]; ?> (); }); }); </script> <?php } } } } # see if next field needs to be checked $condref++; } # check next condition ?> <script type="text/javascript"> function checkDisplayCondition<?php echo $field["ref"]; ?> () { var questionField = jQuery('#question_<?php echo $n; ?> '); var fieldStatus = questionField.css('display'); var newFieldStatus = 'none'; var newFieldProvisional = true; var newFieldProvisionalTest; <?php foreach ($scriptconditions as $scriptcondition) { ?> newFieldProvisionalTest = false; if (jQuery('#field_<?php echo $scriptcondition["field"]; ?> ').length != 0) { fieldValues<?php echo $scriptcondition["field"]; ?> = jQuery('#field_<?php echo $scriptcondition["field"]; ?> ').val().toUpperCase().split(','); } else { <?php # Handle Radio Buttons type: if ($scriptcondition['type'] == 12) { $scriptcondition["options"] = explode(',', $scriptcondition["options"]); foreach ($scriptcondition["options"] as $key => $radio_button_value) { $scriptcondition["options"][$key] = sha1($radio_button_value); } $scriptcondition["options"] = implode(',', $scriptcondition["options"]); ?> var options_string = '<?php echo $scriptcondition["options"]; ?> '; var field<?php echo $scriptcondition["field"]; ?> _options = options_string.split(','); var checked = null; var fieldOkValues<?php echo $scriptcondition["field"]; ?> = [<?php echo $scriptcondition["valid"]; ?> ]; for(var i=0; i < field<?php echo $scriptcondition["field"]; ?> _options.length; i++) { if(jQuery('#field_<?php echo $scriptcondition["field"]; ?> _' + field<?php echo $scriptcondition["field"]; ?> _options[i]).is(':checked')) { checked = jQuery('#field_<?php echo $scriptcondition["field"]; ?> _' + field<?php echo $scriptcondition["field"]; ?> _options[i] + ':checked').val().toUpperCase(); if(jQuery.inArray(checked, fieldOkValues<?php echo $scriptcondition["field"]; ?> ) > -1) { newFieldProvisionalTest = true; } } } <?php } # end of handling radio buttons type ?> fieldValues<?php echo $scriptcondition["field"]; ?> = new Array(); checkedVals<?php echo $scriptcondition["field"]; ?> = jQuery('input[name^=<?php echo $scriptcondition["field"]; ?> _]'); jQuery.each(checkedVals<?php echo $scriptcondition["field"]; ?> , function() { if (jQuery(this).is(':checked')) { checkText<?php echo $scriptcondition["field"]; ?> = jQuery(this).parent().next().text().toUpperCase(); fieldValues<?php echo $scriptcondition["field"]; ?> .push(jQuery.trim(checkText<?php echo $scriptcondition["field"]; ?> )); } }); } fieldOkValues<?php echo $scriptcondition["field"]; ?> = [<?php echo $scriptcondition["valid"]; ?> ]; jQuery.each(fieldValues<?php echo $scriptcondition["field"]; ?> ,function(f,v) { if ((jQuery.inArray(v,fieldOkValues<?php echo $scriptcondition["field"]; ?> ))>-1 || (fieldValues<?php echo $scriptcondition["field"]; ?> == fieldOkValues<?php echo $scriptcondition["field"]; ?> )) { newFieldProvisionalTest = true; } }); if (newFieldProvisionalTest == false) { newFieldProvisional = false; } <?php } ?> if (newFieldProvisional == true) { newFieldStatus = 'block' } if (newFieldStatus != fieldStatus) { questionField.slideToggle(); if (questionField.css('display') == 'block') { questionField.css('border-top',''); } else { questionField.css('border-top','none'); } } } </script> <?php } $is_search = true; if (!$forsearchbar) { ?> <div class="Question" id="question_<?php echo $n; ?> " <?php if (!$displaycondition) { ?> style="display:none;border-top:none;"<?php } if (strlen($field["tooltip_text"]) >= 1) { echo "title=\"" . htmlspecialchars(lang_or_i18n_get_translated($field["tooltip_text"], "fieldtooltip-")) . "\""; } ?> > <label><?php echo htmlspecialchars(lang_or_i18n_get_translated($field["title"], "fieldtitle-")); ?> </label> <?php } else { ?> <div class="SearchItem"> <?php echo htmlspecialchars(lang_or_i18n_get_translated($field["title"], "fieldtitle-")); ?> </br> <?php } //hook("rendersearchhtml", "", array($field, $class, $value, $autoupdate)); switch ($field["type"]) { case 0: # -------- Text boxes # -------- Text boxes case 1: case 5: case 8: ?> <input class="<?php echo $class; ?> " type=text name="field_<?php echo $field["ref"]; ?> " id="field_<?php echo $field["ref"]; ?> " value="<?php echo htmlspecialchars($value); ?> " <?php if ($autoupdate) { ?> onChange="UpdateResultCount();"<?php } ?> onKeyPress="if (!(updating)) {setTimeout('UpdateResultCount()',2000);updating=true;}"><?php break; case 2: case 3: if (!hook("customchkboxes", "", array($field, $value, $autoupdate, $class, $forsearchbar, $limit_keywords))) { # -------- Show a check list or dropdown for dropdowns and check lists? # By default show a checkbox list for both (for multiple selections this enabled OR functionality) # Translate all options $options = trim_array(explode(",", $field["options"])); $adjusted_dropdownoptions = hook("adjustdropdownoptions"); if ($adjusted_dropdownoptions) { $options = $adjusted_dropdownoptions; } $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 && !hook("ajust_auto_order_checkbox", "", array($field))) { if ($auto_order_checkbox_case_insensitive) { natcasesort($option_trans); } else { asort($option_trans); } } $options = array_keys($option_trans); # Set the options array to the keys, so it is now effectively sorted by translated string if ($field["display_as_dropdown"]) { # Show as a dropdown box $set = trim_array(explode(";", cleanse_string($value, true))); ?> <select class="<?php echo $class; ?> " name="field_<?php echo $field["ref"]; ?> " id="field_<?php echo $field["ref"]; ?> " <?php if ($autoupdate) { ?> onChange="UpdateResultCount();"<?php } ?> ><option value=""></option><?php foreach ($option_trans as $option => $trans) { if (trim($trans) != "") { ?> <option value="<?php echo htmlspecialchars(trim($trans)); ?> " <?php if (in_array(cleanse_string($trans, true), $set)) { ?> selected<?php } ?> ><?php echo htmlspecialchars(trim($trans)); ?> </option> <?php } } ?> </select><?php } else { # Show as a checkbox list (default) $set = trim_array(explode(";", cleanse_string($value, true))); $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; } if ($l > 25) { $cols = 2; } # Filter the options array for blank values and ignored keywords. $newoptions = array(); foreach ($options as $option) { if ($option != "" && (count($limit_keywords) == 0 || in_array($option, $limit_keywords))) { $newoptions[] = $option; } } $options = $newoptions; $height = ceil(count($options) / $cols); global $checkbox_ordered_vertically, $checkbox_vertical_columns; if ($checkbox_ordered_vertically) { if (!hook('rendersearchchkboxes')) { # ---------------- Vertical Ordering (only if configured) ----------- ?> <table cellpadding=2 cellspacing=0><tr><?php for ($y = 0; $y < $height; $y++) { for ($x = 0; $x < $cols; $x++) { # Work out which option to fetch. $o = $x * $height + $y; if ($o < count($options)) { $option = $options[$o]; $trans = $option_trans[$option]; $name = $field["ref"] . "_" . md5($option); if ($option != "") { ?> <td valign=middle><input type=checkbox id="<?php echo htmlspecialchars($name); ?> " name="<?php echo $name; ?> " value="yes" <?php if (in_array(cleanse_string($trans, true), $set)) { ?> checked<?php } ?> <?php if ($autoupdate) { ?> onClick="UpdateResultCount();"<?php } ?> ></td><td valign=middle><?php echo htmlspecialchars($trans); ?> </td> <?php } else { ?> <td></td><td></td><?php } } } ?> </tr><tr><?php } ?> </tr></table><?php } } else { # ---------------- Horizontal Ordering (Standard) --------------------- ?> <table cellpadding=2 cellspacing=0><tr><?php foreach ($option_trans as $option => $trans) { $wrap++; if ($wrap > $cols) { $wrap = 1; ?> </tr><tr><?php } $name = $field["ref"] . "_" . md5($option); if ($option != "") { ?> <td valign=middle><input type=checkbox id="<?php echo htmlspecialchars($name); ?> " name="<?php echo htmlspecialchars($name); ?> " value="yes" <?php if (in_array(cleanse_string(i18n_get_translated($option), true), $set)) { ?> checked<?php } ?> <?php if ($autoupdate) { ?> onClick="UpdateResultCount();"<?php } ?> ></td><td valign=middle><?php echo htmlspecialchars($trans); ?> </td> <?php } } ?> </tr></table><?php } } } break; case 4: case 6: case 10: # ----- Date types $found_year = ''; $found_month = ''; $found_day = ''; $found_start_year = ''; $found_start_month = ''; $found_start_day = ''; $found_end_year = ''; $found_end_month = ''; $found_end_day = ''; if ($daterange_search) { $startvalue = substr($value, strpos($value, "start") + 5, 10); $ss = explode(" ", $startvalue); if (count($ss) >= 3) { $found_start_year = $ss[0]; $found_start_month = $ss[1]; $found_start_day = $ss[2]; } $endvalue = substr($value, strpos($value, "end") + 3, 10); $se = explode(" ", $endvalue); if (count($se) >= 3) { $found_end_year = $se[0]; $found_end_month = $se[1]; $found_end_day = $se[2]; } ?> <!-- date range search start --> <div><label class="InnerLabel"><?php echo $lang["fromdate"]; ?> </label> <select name="<?php echo htmlspecialchars($name); ?> _startyear" class="SearchWidth" style="width:100px;" <?php if ($autoupdate) { ?> onChange="UpdateResultCount();"<?php } ?> > <option value=""><?php echo $lang["anyyear"]; ?> </option> <?php $y = date("Y"); for ($d = $y; $d >= $minyear; $d--) { ?> <option <?php if ($d == $found_start_year) { ?> selected<?php } ?> ><?php echo $d; ?> </option><?php } ?> </select> <select name="<?php echo $name; ?> _startmonth" class="SearchWidth" style="width:100px;" <?php if ($autoupdate) { ?> onChange="UpdateResultCount();"<?php } ?> > <option value=""><?php echo $lang["anymonth"]; ?> </option> <?php for ($d = 1; $d <= 12; $d++) { $m = str_pad($d, 2, "0", STR_PAD_LEFT); ?> <option <?php if ($d == $found_start_month) { ?> selected<?php } ?> value="<?php echo $m; ?> "><?php echo $lang["months"][$d - 1]; ?> </option><?php } ?> </select> <select name="<?php echo $name; ?> _startday" class="SearchWidth" style="width:100px;" <?php if ($autoupdate) { ?> onChange="UpdateResultCount();"<?php } ?> > <option value=""><?php echo $lang["anyday"]; ?> </option> <?php for ($d = 1; $d <= 31; $d++) { $m = str_pad($d, 2, "0", STR_PAD_LEFT); ?> <option <?php if ($d == $found_start_day) { ?> selected<?php } ?> value="<?php echo $m; ?> "><?php echo $m; ?> </option><?php } ?> </select> </div><br><div><label></label><label class="InnerLabel"><?php echo $lang["todate"]; ?> </label><select name="<?php echo $name; ?> _endyear" class="SearchWidth" style="width:100px;" <?php if ($autoupdate) { ?> onChange="UpdateResultCount();"<?php } ?> > <option value=""><?php echo $lang["anyyear"]; ?> </option> <?php $y = date("Y"); for ($d = $y; $d >= $minyear; $d--) { ?> <option <?php if ($d == $found_end_year) { ?> selected<?php } ?> ><?php echo $d; ?> </option><?php } ?> </select> <select name="<?php echo $name; ?> _endmonth" class="SearchWidth" style="width:100px;" <?php if ($autoupdate) { ?> onChange="UpdateResultCount();"<?php } ?> > <option value=""><?php echo $lang["anymonth"]; ?> </option> <?php $md = date("n"); for ($d = 1; $d <= 12; $d++) { $m = str_pad($d, 2, "0", STR_PAD_LEFT); ?> <option <?php if ($d == $found_end_month) { ?> selected<?php } ?> value="<?php echo $m; ?> "><?php echo $lang["months"][$d - 1]; ?> </option><?php } ?> </select> <select name="<?php echo $name; ?> _endday" class="SearchWidth" style="width:100px;" <?php if ($autoupdate) { ?> onChange="UpdateResultCount();"<?php } ?> > <option value=""><?php echo $lang["anyday"]; ?> </option> <?php $td = date("d"); for ($d = 1; $d <= 31; $d++) { $m = str_pad($d, 2, "0", STR_PAD_LEFT); ?> <option <?php if ($d == $found_end_day) { ?> selected<?php } ?> value="<?php echo $m; ?> "><?php echo $m; ?> </option><?php } ?> </select> <!-- date range search end date--> </div> <?php } else { $s = explode("|", $value); if (count($s) >= 3) { $found_year = $s[0]; $found_month = $s[1]; $found_day = $s[2]; } ?> <select name="<?php echo $name; ?> _year" class="SearchWidth" style="width:100px;" <?php if ($autoupdate) { ?> onChange="UpdateResultCount();"<?php } ?> > <option value=""><?php echo $lang["anyyear"]; ?> </option> <?php $y = date("Y"); for ($d = $minyear; $d <= $y; $d++) { ?> <option <?php if ($d == $found_year) { ?> selected<?php } ?> ><?php echo $d; ?> </option><?php } ?> </select> <select name="<?php echo $name; ?> _month" class="SearchWidth" style="width:100px;" <?php if ($autoupdate) { ?> onChange="UpdateResultCount();"<?php } ?> > <option value=""><?php echo $lang["anymonth"]; ?> </option> <?php for ($d = 1; $d <= 12; $d++) { $m = str_pad($d, 2, "0", STR_PAD_LEFT); ?> <option <?php if ($d == $found_month) { ?> selected<?php } ?> value="<?php echo $m; ?> "><?php echo $lang["months"][$d - 1]; ?> </option><?php } ?> </select> <select name="<?php echo $name; ?> _day" class="SearchWidth" style="width:100px;" <?php if ($autoupdate) { ?> onChange="UpdateResultCount();"<?php } ?> > <option value=""><?php echo $lang["anyday"]; ?> </option> <?php for ($d = 1; $d <= 31; $d++) { $m = str_pad($d, 2, "0", STR_PAD_LEFT); ?> <option <?php if ($d == $found_day) { ?> selected<?php } ?> value="<?php echo $m; ?> "><?php echo $m; ?> </option><?php } ?> </select> <?php } break; case 7: # ----- Category Tree $options = $field["options"]; $set = trim_array(explode(";", cleanse_string($value, true))); if ($forsearchbar) { # On the search bar? # Produce a smaller version of the category tree in a single dropdown - max two levels ?> <select class="<?php echo $class; ?> " name="field_<?php echo $field["ref"]; ?> "><option value=""></option><?php $class = explode("\n", $options); for ($t = 0; $t < count($class); $t++) { $s = explode(",", $class[$t]); if (count($s) == 3 && $s[1] == 0) { # Found a first level ?> <option <?php if (in_array(cleanse_string($s[2], true), $set)) { ?> selected<?php } ?> ><?php echo htmlspecialchars($s[2]); ?> </option> <?php # Parse tree again looking for level twos at this point for ($u = 0; $u < count($class); $u++) { $v = explode(",", $class[$u]); if (count($v) == 3 && $v[1] == $s[0]) { # Found a first level ?> <option value="<?php echo htmlspecialchars($s[2]) . "," . htmlspecialchars($v[2]); ?> " <?php if (in_array(cleanse_string($s[2], true), $set) && in_array(cleanse_string($v[2], true), $set)) { ?> selected<?php } ?> > - <?php echo htmlspecialchars($v[2]); ?> </option> <?php } } } } ?> </select> <?php } else { # For advanced search and elsewhere, include the category tree. include "../pages/edit_fields/7.php"; } break; case 9: #-- Dynamic keywords list $value = str_replace(";", ",", $value); # Different syntax used for keyword separation when searching. include "../pages/edit_fields/9.php"; break; // Radio buttons: // Radio buttons: case 12: // auto save is not needed when searching $edit_autosave = FALSE; $display_as_radiobuttons = FALSE; $display_as_checkbox = TRUE; if ($field['display_as_dropdown']) { $display_as_dropdown = TRUE; $display_as_checkbox = FALSE; } include '../pages/edit_fields/12.php'; break; } ?> <div class="clearerleft"> </div> </div> <?php }
,<?php echo $s[4]; ?> ,"<?php echo $icon; ?> ",0); <?php } } } else { $debug .= "<li>no query"; // empty, no security.php $user_restrict = array(); if (!in_array(trim($s[2]), $user_restrict)) { $nodename = lang_or_i18n_get_translated($s[2], "treenode-"); ?> AddNode(<?php echo $node; ?> ,"<?php echo $id . "-" . $n; ?> ","<?php echo trim($s[2]) == "" ? "?" : $nodename; ?> ",<?php echo $s[3]; ?> ,<?php echo $s[4];
/** * Generate an html multi-select check boxes block for selecting multiple the RS resource types. The * selected field type is posted as an array of the values of the "ref" column of the selected * resource types. * * @param string $name the name of the select block. Usually the name of the config variable being set. * @param string $label the user text displayed to label the select block. Usually a $lang string. * @param integer array $current the current value of the config variable being set * @param integer $width the width of the input field in pixels. Default: 300. */ function config_multi_rtype_select($name, $label, $current, $width=300) { global $lang; $rtypes=get_resource_types(); ?> <div class="Question"> <label for="<?php echo $name?>" title="<?php echo str_replace('%cvn', $name, $lang['plugins-configvar'])?>"><?php echo $label?></label> <fieldset id="<?php echo $name?>" style="width:<?php echo $width ?>px"> <?php foreach($rtypes as $rtype) { echo ' <input type="checkbox" value="'. $rtype['ref'] . '" name="' . $name . '[]"' . (in_array($rtype['ref'],$current)?' checked="checked"':'') . '>' . lang_or_i18n_get_translated($rtype['name'],'resourcetype-') . '</option><br />'; } ?> </fieldset> </div> <div class="clearerleft"></div> <?php }
function get_field($field) { # A standard field title is translated using $lang. A custom field title is i18n translated. # Executes query. $r = sql_query("select ref, name, title, type, options ,order_by, keywords_index, partial_index, resource_type, resource_column, display_field, use_for_similar, iptc_equiv, display_template, tab_name, required, smart_theme_name, exiftool_field, advanced_search, simple_search, help_text, display_as_dropdown from resource_type_field where ref='$field'"); # Translates the field title if the searched field is found. if (count($r)==0) { return false; } else { $r[0]["title"] = lang_or_i18n_get_translated($r[0]["title"], "fieldtitle-"); return $r[0]; } }
function send_periodic_report_emails() { # For all configured periodic reports, send a mail if necessary. global $lang, $baseurl; # Query to return all 'pending' report e-mails, i.e. where we haven't sent one before OR one is now overdue. $reports = sql_query("select pe.*,u.email,r.name,pe.send_all_users from report_periodic_emails pe join user u on pe.user=u.ref join report r on pe.report=r.ref where pe.last_sent is null or date_add(pe.last_sent,interval pe.email_days day)<=now()"); foreach ($reports as $report) { $start = time() - 60 * 60 * 24 * $report["period"]; $from_y = date("Y", $start); $from_m = date("m", $start); $from_d = date("d", $start); $to_y = date("Y"); $to_m = date("m"); $to_d = date("d"); # Translates the report name. $report["name"] = lang_or_i18n_get_translated($report["name"], "report-"); # Generate remote HTML table. $output = do_report($report["report"], $from_y, $from_m, $from_d, $to_y, $to_m, $to_d, false, true); # Formulate a title $title = $report["name"] . ": " . str_replace("?", $report["period"], $lang["lastndays"]); # Send mail to original user - this contains the unsubscribe link $unsubscribe = "<br>" . $lang["unsubscribereport"] . "<br>" . $baseurl . "/?ur=" . $report["ref"]; $email = $report["email"]; echo $lang["sendingreportto"] . " " . $email . "<br>" . $output . $unsubscribe . "<br>"; send_mail($email, $title, $output . $unsubscribe, "", "", "", null, "", "", true); # Send to all other active users, if configured. if ($report["send_all_users"]) { # Send the report to all active users. $users = get_users(); foreach ($users as $user) { $email = $user["email"]; if ($user["approved"] && $email != $report["email"]) { echo $lang["sendingreportto"] . " " . $email . "<br>" . $output . "<br>"; send_mail($email, $title, $output, "", "", "", null, "", "", true); } } } # Mark as done. sql_query("update report_periodic_emails set last_sent=now() where ref='" . $report["ref"] . "'"); } }
for ($n=0;$n<count($result);$n++) { $related_restype=$result[$n]["resource_type"]; $related_restypes[]=$related_restype; } //reduce array to unique values $related_restypes=array_unique($related_restypes); $count_restypes=0; foreach($related_restypes as $rtype) { ?> <div class="sharerelatedtype"> <?php $restypename=sql_value("select name as value from resource_type where ref = '$rtype'",""); $restypename = lang_or_i18n_get_translated($restypename, "resourcetype-", "-2"); ?><!--Panel for related resources--> <div class="Title"><?php echo $restypename ?></div> <?php // loop and display the results by resource type for ($n=0;$n<count($result);$n++) { if ($result[$n]["resource_type"]==$rtype){ $rref=$result[$n]["ref"]; $title=$result[$n]["field".$view_title_field]; // swap title fields if necessary if (isset($metadata_template_title_field) && isset($metadata_template_resource_type)) {
} ?> <?php if (!$basic_simple_search) { // Include simple search items (if any) $optionfields = array(); for ($n = 0; $n < count($fields); $n++) { hook("modifysearchfieldtitle"); ?> <div class="SearchItem" id="simplesearch_<?php echo $fields[$n]["ref"]; ?> " <?php if (strlen($fields[$n]["tooltip_text"]) >= 1) { echo "title=\"" . htmlspecialchars(lang_or_i18n_get_translated($fields[$n]["tooltip_text"], "fieldtooltip-")) . "\""; } ?> ><?php echo $fields[$n]["title"]; ?> <br /> <?php $value = ""; # to do, fetch set value. if (isset($set_fields[$fields[$n]["name"]])) { $value = $set_fields[$fields[$n]["name"]]; } #hook to modify field type in special case. Returning zero (to get a standard text box) doesn't work, so return 1 for type 0, 2 for type 1, etc. if (hook("modifyfieldtype")) { $fields[$n]["type"] = hook("modifyfieldtype") - 1;
function get_fields_for_search_display($field_refs) { # Returns a list of fields/properties with refs matching the supplied field refs, for search display setup # This returns fewer columns and doesn't require that the fields be indexed, as in this case it's only used to judge whether the field should be highlighted. # Standard field titles are translated using $lang. Custom field titles are i18n translated. if (!is_array($field_refs)) { print_r($field_refs); exit(" passed to getfields() is not an array. "); } # Executes query. $fields = sql_query("select ref, name, type, title, keywords_index, partial_index, value_filter from resource_type_field where ref in ('" . join("','", $field_refs) . "')"); # Applies field permissions and translates field titles in the newly created array. $return = array(); for ($n = 0; $n < count($fields); $n++) { if ((checkperm("f*") || checkperm("f" . $fields[$n]["ref"])) && !checkperm("f-" . $fields[$n]["ref"])) { $fields[$n]["title"] = lang_or_i18n_get_translated($fields[$n]["title"], "fieldtitle-"); $return[] = $fields[$n]; } } return $return; }
?><tr><td colspan=3 class="permheader"><?php echo $lang["resourcetypes"] ?></td></tr><?php # ------------ View access to resource types $rtypes=sql_query("select * from resource_type order by name"); foreach ($rtypes as $rtype) { DrawOption("T" . $rtype["ref"], $lang["can_see_resource_type"] ." '" . lang_or_i18n_get_translated($rtype["name"], "resourcetype-") . "'", true); } # ------------ Restricted access to resource types $rtypes=sql_query("select * from resource_type order by name"); foreach ($rtypes as $rtype) { DrawOption("X" . $rtype["ref"], $lang["restricted_access_only_to_resource_type"] . " '" . lang_or_i18n_get_translated($rtype["name"], "resourcetype-") . "'", false); } ?><tr><td colspan=3 class="permheader"><?php echo $lang["resource_creation_and_management"] ?></td></tr><?php # ------------ Edit access to workflow states for ($n=-2;$n<=3;$n++) { DrawOption("e" . $n, $lang["edit_access_to_workflow_state"] . " '" . $lang["status" . $n] . "'", false); } DrawOption("c", $lang["can_create_resources_and_upload_files-admins"]); DrawOption("d", $lang["can_create_resources_and_upload_files-general_users"]);
</label> <?php $s = trim_array(explode(",", $license["license_usage"])); foreach ($license_usage_mediums as $medium) { ?> <input type="checkbox" name="license_usage[]" value="<?php echo $medium; ?> " <?php if (in_array($medium, $s)) { ?> checked<?php } ?> > <?php echo lang_or_i18n_get_translated($medium, "license_usage-"); ?> <?php } ?> <div class="clearerleft"> </div></div> <div class="Question"><label><?php echo $lang["description"];
<div class="clearerleft"></div> </div> <?php } # Archiver settings if ($archiver) { ?> <div class="Question"> <label for="archivetype"><?php echo $lang["archivesettings"]?></label> <div class="tickset"> <select name="settings" class="stdwidth" id="archivesettings"<?php if (!empty($submitted)) echo ' disabled="disabled"' ?>><?php foreach ($collection_download_settings as $key=>$value) { ?> <option value="<?php echo htmlspecialchars($key) ?>"><?php echo lang_or_i18n_get_translated($value["name"],"archive-") ?></option><?php } ?> </select> <div class="clearerleft"></div></div><br> </div><?php } ?> <!-- Add CSV file with the metadata of all the resources found in this colleciton --> <div class="Question"> <label for="include_csv_file"><?php echo $lang['csvAddMetadataCSVToArchive']; ?></label> <input type="checkbox" id="include_csv_file" name="include_csv_file" value="yes"> </div> <div class="clearerleft"></div></div> <div class="QuestionSubmit" id="downloadbuttondiv">