diff options
Diffstat (limited to 'includes/functions')
| -rw-r--r-- | includes/functions/functions.php | 2 | ||||
| -rw-r--r-- | includes/functions/functions_db.php | 2 | ||||
| -rw-r--r-- | includes/functions/functions_print.php | 8 | ||||
| -rw-r--r-- | includes/functions/functions_rss.php | 537 |
4 files changed, 2 insertions, 547 deletions
diff --git a/includes/functions/functions.php b/includes/functions/functions.php index 2854633dfc..7def401f26 100644 --- a/includes/functions/functions.php +++ b/includes/functions/functions.php @@ -203,7 +203,6 @@ function load_gedcom_settings($ged_id=WT_GED_ID) { global $DISPLAY_JEWISH_THOUSANDS; $DISPLAY_JEWISH_THOUSANDS =get_gedcom_setting($ged_id, 'DISPLAY_JEWISH_THOUSANDS'); global $EDIT_AUTOCLOSE; $EDIT_AUTOCLOSE =get_gedcom_setting($ged_id, 'EDIT_AUTOCLOSE'); global $ENABLE_AUTOCOMPLETE; $ENABLE_AUTOCOMPLETE =get_gedcom_setting($ged_id, 'ENABLE_AUTOCOMPLETE'); - global $ENABLE_RSS; $ENABLE_RSS =get_gedcom_setting($ged_id, 'ENABLE_RSS'); global $EXPAND_NOTES; $EXPAND_NOTES =get_gedcom_setting($ged_id, 'EXPAND_NOTES'); global $EXPAND_RELATIVES_EVENTS; $EXPAND_RELATIVES_EVENTS =get_gedcom_setting($ged_id, 'EXPAND_RELATIVES_EVENTS'); global $EXPAND_SOURCES; $EXPAND_SOURCES =get_gedcom_setting($ged_id, 'EXPAND_SOURCES'); @@ -260,7 +259,6 @@ function load_gedcom_settings($ged_id=WT_GED_ID) { global $REPO_FACTS_UNIQUE; $REPO_FACTS_UNIQUE =get_gedcom_setting($ged_id, 'REPO_FACTS_UNIQUE'); global $REPO_ID_PREFIX; $REPO_ID_PREFIX =get_gedcom_setting($ged_id, 'REPO_ID_PREFIX'); global $REQUIRE_AUTHENTICATION; $REQUIRE_AUTHENTICATION =get_gedcom_setting($ged_id, 'REQUIRE_AUTHENTICATION'); - global $RSS_FORMAT; $RSS_FORMAT =get_gedcom_setting($ged_id, 'RSS_FORMAT'); global $SAVE_WATERMARK_IMAGE; $SAVE_WATERMARK_IMAGE =get_gedcom_setting($ged_id, 'SAVE_WATERMARK_IMAGE'); global $SAVE_WATERMARK_THUMB; $SAVE_WATERMARK_THUMB =get_gedcom_setting($ged_id, 'SAVE_WATERMARK_THUMB'); global $SEARCH_FACTS_DEFAULT; $SEARCH_FACTS_DEFAULT =get_gedcom_setting($ged_id, 'SEARCH_FACTS_DEFAULT'); diff --git a/includes/functions/functions_db.php b/includes/functions/functions_db.php index 4f7f22e5ff..46511a98a0 100644 --- a/includes/functions/functions_db.php +++ b/includes/functions/functions_db.php @@ -2025,7 +2025,7 @@ function get_calendar_events($jd1, $jd2, $facts='', $ged_id=WT_GED_ID) { * Get the list of current and upcoming events, sorted by anniversary date * * This function is used by the Todays and Upcoming blocks on the Index and Portal -* pages. It is also used by the RSS feed. +* pages. * * Special note on unknown day-of-month: * When the anniversary date is imprecise, the sort will pretend that the day-of-month diff --git a/includes/functions/functions_print.php b/includes/functions/functions_print.php index 7418327a30..c8bd5065ee 100644 --- a/includes/functions/functions_print.php +++ b/includes/functions/functions_print.php @@ -415,7 +415,7 @@ function print_header($title, $head="", $use_alternate_styles=true) { global $WT_IMAGE_DIR, $GEDCOM, $GEDCOM_TITLE, $COMMON_NAMES_THRESHOLD; global $QUERY_STRING, $action, $query, $theme_name; global $FAVICON, $stylesheet, $print_stylesheet, $rtl_stylesheet, $headerfile, $toplinks, $THEME_DIR, $print_headerfile; - global $WT_IMAGES, $TEXT_DIRECTION, $ONLOADFUNCTION, $REQUIRE_AUTHENTICATION, $ENABLE_RSS, $RSS_FORMAT; + global $WT_IMAGES, $TEXT_DIRECTION, $ONLOADFUNCTION, $REQUIRE_AUTHENTICATION; global $META_DESCRIPTION, $META_ROBOTS, $META_TITLE; // TODO: Shouldn't this be in session.php? @@ -451,12 +451,6 @@ function print_header($title, $head="", $use_alternate_styles=true) { } else { $GEDCOM_TITLE = get_gedcom_setting(WT_GED_ID, 'title'); } - if ($ENABLE_RSS){ - $applicationType = "application/rss+xml"; - if ($RSS_FORMAT == "ATOM" || $RSS_FORMAT == "ATOM0.3"){ - $applicationType = "application/atom+xml"; - } - } $javascript = ''; $query_string = $QUERY_STRING; if ($view!='preview' && $view!='simple') { diff --git a/includes/functions/functions_rss.php b/includes/functions/functions_rss.php deleted file mode 100644 index 163a50dff9..0000000000 --- a/includes/functions/functions_rss.php +++ /dev/null @@ -1,537 +0,0 @@ -<?php -/** -* Various functions used to generate the webtrees RSS feed. -* -* webtrees: Web based Family History software - * Copyright (C) 2010 webtrees development team. - * - * Derived from PhpGedView -* Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved. -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -* @version $Id$ -* @package webtrees -* @subpackage RSS -*/ - -if (!defined('WT_WEBTREES')) { - header('HTTP/1.0 403 Forbidden'); - exit; -} - -define('WT_FUNCTIONS_RSS_PHP', ''); - -require_once WT_ROOT.'includes/functions/functions_print_lists.php'; -require_once WT_ROOT.'includes/classes/class_stats.php'; - -$time = client_time(); -$day = date("j", $time); -$month = date("M", $time); -$year = date("Y", $time); - -/** -* Returns an ISO8601 formatted date used for the RSS feed -* -* @param $time the time in the UNIX time format (milliseconds since Jan 1, 1970) -* @return SO8601 formatted date in the format of 2005-07-06T20:52:16+00:00 -*/ -function iso8601_date($time) { - $tzd = date('O',$time); - $tzd = $tzd[0].str_pad((int)($tzd/100), 2, "0", STR_PAD_LEFT).':'.str_pad((int)($tzd % 100), 2, "0", STR_PAD_LEFT); - $date = date('Y-m-d\TH:i:s', $time) . $tzd; - return $date; -} - -/** -* Returns the upcoming events array used for the RSS feed. -* Uses configuration set for the blocks. If not configured, it will default to events in the -* next 30 days, all events for living & and not living people -* -* @return the array with upcoming events data. the format is $dataArray[0] = title, $dataArray[1] = date, -* $dataArray[2] = data -*/ -function getUpcomingEvents() { - global $month, $year, $day, $HIDE_LIVE_PEOPLE, $ctype, $TEXT_DIRECTION; - global $WT_IMAGE_DIR, $WT_IMAGES, $WT_BLOCKS; - global $DAYS_TO_SHOW_LIMIT; - - $dataArray[0] = i18n::translate('Upcoming Events'); - $dataArray[1] = time(); - - if (empty($config)) $config = $WT_BLOCKS["print_upcoming_events"]["config"]; - if (!isset($DAYS_TO_SHOW_LIMIT)) $DAYS_TO_SHOW_LIMIT = 30; - if (isset($config["days"])) $daysprint = $config["days"]; - else $daysprint = 30; - if (isset($config["filter"])) $filter = $config["filter"]; // "living" or "all" - else $filter = "all"; - if (isset($config["onlyBDM"])) $onlyBDM = $config["onlyBDM"]; // "yes" or "no" - else $onlyBDM = "no"; - - if ($daysprint < 1) $daysprint = 1; - if ($daysprint > $DAYS_TO_SHOW_LIMIT) $daysprint = $DAYS_TO_SHOW_LIMIT; // valid: 1 to limit - - $startjd=client_jd()+1; - $endjd=client_jd()+$daysprint; - - $daytext=print_events_list($startjd, $endjd, $onlyBDM=='yes'?'BIRT MARR DEAT':'', $filter=='living', true); - $daytext = str_replace(array("<br />", "<ul></ul>", " </a>"), array(" ", "", "</a>"), $daytext); - $daytext = strip_tags($daytext, '<a><ul><li><b><span>'); - $dataArray[2] = $daytext; - return $dataArray; -} - - -/** -* Returns the today's events array used for the RSS feed -* -* @return the array with todays events data. the format is $dataArray[0] = title, $dataArray[1] = date, -* $dataArray[2] = data -*/ -function getTodaysEvents() { - global $month, $year, $day, $HIDE_LIVE_PEOPLE, $ctype, $TEXT_DIRECTION; - global $WT_IMAGE_DIR, $WT_IMAGES, $WT_BLOCKS; - global $DAYS_TO_SHOW_LIMIT; - - $dataArray[0] = i18n::translate('On This Day ...'); - $dataArray[1] = time(); - - if (empty($config)) $config = $WT_BLOCKS["print_todays_events"]["config"]; - if (isset($config["filter"])) $filter = $config["filter"]; // "living" or "all" - else $filter = "all"; - if (isset($config["onlyBDM"])) $onlyBDM = $config["onlyBDM"]; // "yes" or "no" - else $onlyBDM = "no"; - - $daytext=print_events_list(client_jd(), client_jd(), $onlyBDM=='yes'?'BIRT MARR DEAT':'', $filter=='living', true); - $daytext = str_replace(array("<br />", "<ul></ul>", " </a>"), array(" ", "", "</a>"), $daytext); - $daytext = strip_tags($daytext, '<a><ul><li><b><span>'); - $dataArray[2] = $daytext; - return $dataArray; -} - -/** -* Returns the GEDCOM stats. -* -* @return the array with GEDCOM stats data. the format is $dataArray[0] = title, $dataArray[1] = date, -* $dataArray[2] = data -* @TODO does not print the family with most children due to the embedded html in that function. -*/ -function getGedcomStats() { - global $day, $month, $year, $WT_BLOCKS, $ctype, $COMMON_NAMES_THRESHOLD, $RTLOrd; - - if (empty($config)) $config = $WT_BLOCKS["print_gedcom_stats"]["config"]; - if (!isset($config['stat_indi'])) $config = $WT_BLOCKS["print_gedcom_stats"]["config"]; - - $data = ""; - $dataArray[0] = i18n::translate('GEDCOM Statistics') . " - " . get_gedcom_setting(WT_GED_ID, 'title'); - - $head = find_gedcom_record("HEAD", WT_GED_ID); - $ct=preg_match("/1 SOUR (.*)/", $head, $match); - if ($ct>0) { - $softrec = get_sub_record(1, "1 SOUR", $head); - $tt= preg_match("/2 NAME (.*)/", $softrec, $tmatch); - if ($tt>0) $title = trim($tmatch[1]); - else $title = trim($match[1]); - if (!empty($title)) { - $tt = preg_match("/2 VERS (.*)/", $softrec, $tmatch); - if ($tt>0) $version = trim($tmatch[1]); - else $version=""; - $data .= strip_tags(i18n::translate('This GEDCOM was created using %s %s', $title, $version)); - } - } - $ct=preg_match("/1 DATE (.+)/", $head, $match); - if ($ct>0) { - $date = trim($match[1]); - $dataArray[1] = strtotime($date); - - $date=new GedcomDate($date); - if (empty($title)){ - $data .= i18n::translate('This GEDCOM was created on <b>%s</b>', $date->Display(false)); - } else { - $data .= i18n::translate(' on <b>%s</b>', $date->Display(false)); - } - } - - $stats=new stats(WT_GEDCOM, WT_SERVER_NAME.WT_SCRIPT_PATH); - - $data .= " <br />"; - if (!isset($config["stat_indi"]) || $config["stat_indi"]=="yes"){ - $data .= $stats->totalIndividuals()." - " .i18n::translate('Individuals')."<br />"; - } - if (!isset($config["stat_fam"]) || $config["stat_fam"]=="yes"){ - $data .= $stats->totalFamilies()." - ".i18n::translate('Families')."<br />"; - } - if (!isset($config["stat_sour"]) || $config["stat_sour"]=="yes"){ - $data .= $stats->totalSources()." - ".i18n::translate('Sources')."<br /> "; - } - if (!isset($config["stat_other"]) || $config["stat_other"]=="yes"){ - $data .= $stats->totalOtherRecords()." - ".i18n::translate('Other records')."<br />"; - } - if (!isset($config["stat_first_birth"]) || $config["stat_first_birth"]=="yes") { - $data .= i18n::translate('Earliest birth year')." - ".$stats->firstBirthYear()."<br />"; - } - if (!isset($config["stat_last_birth"]) || $config["stat_last_birth"]=="yes") { - $data .= i18n::translate('Latest birth year')." - ".$stats->lastBirthYear()."<br />"; - } - if (!isset($config["stat_long_life"]) || $config["stat_long_life"]=="yes") { - $data .= i18n::translate('Person who lived the longest')." - ".$stats->LongestLifeAge()."<br />"; - } - if (!isset($config["stat_avg_life"]) || $config["stat_avg_life"]=="yes") { - $data .= i18n::translate('Average age at death')." - ".$stats->averageLifespan()."<br />"; - } - if (!isset($config["stat_most_chil"]) || $config["stat_most_chil"]=="yes") { - $data .= i18n::translate('Family with the most children') . $stats->largestFamilySize().' - '.$stats->largestFamily()."<br />"; - } - if (!isset($config["stat_avg_chil"]) || $config["stat_avg_chil"]=="yes") { - $data .= i18n::translate('Average number of children per family')." - ".$stats->averageChildren()."<br />"; - } - if (!isset($config["show_common_surnames"]) || $config["show_common_surnames"]=="yes") { - $data .="<b>".i18n::translate('Most Common Surnames')."</b><br />".$stats->commonSurnames(); - } - - $data = strip_tags($data, '<a><br><b>'); - $dataArray[2] = $data; - return $dataArray; -} - -/** -* Returns the gedcom news for the RSS feed -* -* @return array of GEDCOM news arrays. Each GEDCOM news array contains $itemArray[0] = title, $itemArray[1] = date, -* $itemArray[2] = data, $itemArray[3] = anchor (so that the link will load the proper part of the PGV page) -* @TODO prepend relative URL's in news items with SERVER URL -*/ -function getGedcomNews() { - global $WT_IMAGE_DIR, $WT_IMAGES, $TEXT_DIRECTION, $ctype; - - $usernews = getUserNews(WT_GEDCOM); - - $dataArray = array(); - foreach($usernews as $key=>$news) { - - $day = date("j", $news["date"]); - $mon = date("M", $news["date"]); - $year = date("Y", $news["date"]); - $data = ""; - - // Look for $GLOBALS substitutions in the News title - $newsTitle = embed_globals($news["title"]); - $itemArray[0] = $newsTitle; - - $itemArray[1] = iso8601_date($news["date"]); - - // Look for $GLOBALS substitutions in the News text - $newsText = embed_globals($news["text"]); - $trans = get_html_translation_table(HTML_SPECIALCHARS); - $trans = array_flip($trans); - $newsText = strtr($newsText, $trans); - $newsText = nl2br($newsText); - $data .= $newsText; - $itemArray[2] = $data; - $itemArray[3] = $news["anchor"]; - $dataArray[] = $itemArray; - - } - return $dataArray; -} - -/** -* Returns the top 10 surnames -* -* @return the array with the top 10 surname data. the format is $dataArray[0] = title, $dataArray[1] = date, -* $dataArray[2] = data -* @TODO Possibly turn list into a <ul> list -*/ -function getTop10Surnames() { - global $TEXT_DIRECTION; - global $COMMON_NAMES_ADD, $COMMON_NAMES_REMOVE, $COMMON_NAMES_THRESHOLD, $WT_BLOCKS, $ctype, $WT_IMAGES, $WT_IMAGE_DIR; - - $data = ""; - $dataArray = array(); - - - function top_surname_sort($a, $b) { - return $b["match"] - $a["match"]; - } - - if (empty($config)) $config = $WT_BLOCKS["print_block_name_top10"]["config"]; - - if (isset($config["num"])) $numName = $config["num"]; - else $numName = 10; - - $dataArray[0] = str_replace("10", $numName, i18n::translate('Top 10 Surnames')); - $dataArray[1] = time(); - - $surnames = get_common_surnames($numName); - - // Sort the list and save for future reference - uasort($surnames, "top_surname_sort"); - - if (count($surnames)>0) { - $i=0; - foreach($surnames as $indexval => $surname) { - $data .= "<a href=\"".encode_url(WT_SERVER_NAME.WT_SCRIPT_PATH."indilist.php?surname={$surname['name']}")."\">".PrintReady($surname["name"])."</a> "; - if ($TEXT_DIRECTION=="rtl") $data .= getRLM() . "[" . getRLM() .$surname["match"].getRLM() . "]" . getRLM() . "<br />"; - else $data .= "[".$surname["match"]."]<br />"; - $i++; - if ($i>=$numName) break; - } - } - $dataArray[2] = $data; - return $dataArray; -} - -/** -* Returns the recent changes list for the RSS feed -* -* @return the array with recent changes data. the format is $dataArray[0] = title, $dataArray[1] = date, -* $dataArray[2] = data -* @TODO merge many changes from recent changes block -* @TODO use date of most recent change instead of curent time -*/ -function getRecentChanges() { - global $month, $year, $day, $HIDE_LIVE_PEOPLE, $ctype, $TEXT_DIRECTION; - global $WT_IMAGE_DIR, $WT_IMAGES, $ASC, $IGNORE_FACTS, $IGNORE_YEAR, $LAST_QUERY, $WT_BLOCKS; - global $objectlist; - - if ($ctype=="user") $filter = "living"; - else $filter = "all"; - - if (empty($config)) $config = $WT_BLOCKS["print_recent_changes"]["config"]; - $configDays = 30; - if(isset($config["days"]) && $config["days"] > 0) $configDays = $config["days"]; - if (isset($config["hide_empty"])) $HideEmpty = $config["hide_empty"]; - else $HideEmpty = "no"; - - $dataArray[0] = i18n::translate('Recent Changes'); - $dataArray[1] = time();//FIXME - get most recent change time - - $recentText = "<ul>"; - - $action = "today"; - $found_facts = array(); - $changes=get_recent_changes(client_jd()-$configDays); - - if (count($changes)>0) { - $found_facts = array(); - foreach($changes as $gid) { - $gedrec = find_gedcom_record($gid, WT_GED_ID, true); - - if (!empty($gedrec)) { - $type = "INDI"; - $match = array(); - $ct = preg_match('/0 @'.WT_REGEX_XREF.'@ ('.WT_REGEX_TAG.')/', $gedrec, $match); - if ($ct>0) $type = $match[1]; - $disp = true; - switch($type) { - case 'INDI': - $person=Person::getInstance($gid); - if ($filter=="living" && $person->isDead()) { - $disp = false; - } else { - $disp = $person->canDisplayDetails(); - } - break; - case 'FAM': - if ($filter=="living") { - $parents = find_parents_in_record($gedrec); - $husb=Person::getInstance($parents['HUSB']); - $wife=Person::getInstance($parents['HUSB']); - if ($husb->isDead()) { - $disp = false; - } elseif ($HIDE_LIVE_PEOPLE) { - $disp = $husb->canDisplayDetails(); - } - if ($disp) { - if ($wife->isDead()) { - $disp = false; - } elseif ($HIDE_LIVE_PEOPLE) { - $disp = $wife->canDisplayDetails(); - } - } - } else { - if ($HIDE_LIVE_PEOPLE) $disp = canDisplayRecord(WT_GED_ID, $gedrec); - } - break; - default: - $disp = canDisplayRecord(WT_GED_ID, $gedrec); - break; - } - if ($disp) { - $factrec = get_sub_record(1, "1 CHAN", $gedrec); - $found_facts[$gid] = array($gid, $factrec, $type); - } - } - } - } - -// Start output - if (count($found_facts)==0 and $HideEmpty=="yes") return false; -// Print block content - if (count($found_facts)==0) { - echo i18n::translate('<b>There have been no changes within the last %s days.</b>', $configDays); - } else { - echo i18n::translate('<b>Changes made within the last %s days</b>', $configDays); - foreach($found_facts as $gid=>$factarr) { - $record=GedcomRecord::getInstance($gid); - if ($record && $record->canDisplayDetails()) { - $recentText.='<li>'; - $recentText.='<a href="'.encode_url($record->getAbsoluteLinkUrl()).'"><b>'.PrintReady($record->getFullName()).'</b>'; - $recentText.='</a> '.translate_fact('CHAN').' - '.$record->LastChangeTimestamp(false).'</li>'; - } - } - } - $recentText.='</ul>'; - $recentText = strip_tags($recentText, '<a><ul><li><b><span>'); - $dataArray[2] = $recentText; - return $dataArray; -} - -/** -* Returns a random media for the RSS feed -* -* @return the array with random media data. the format is $dataArray[0] = title, $dataArray[1] = date, -* $dataArray[2] = data, $dataArray[3] = file path, $dataArray[4] = mime type, -* $dataArray[5] = file size, $dataArray[5] = media title -*/ -function getRandomMedia() { - global $foundlist, $MULTI_MEDIA, $TEXT_DIRECTION, $WT_IMAGE_DIR, $WT_IMAGES; - global $MEDIA_EXTERNAL, $MEDIA_DIRECTORY; - global $MEDIATYPE, $THUMBNAIL_WIDTH, $USE_MEDIA_VIEWER; - global $WT_BLOCKS, $ctype, $action; - global $WT_IMAGE_DIR, $WT_IMAGES; - if (empty($config)) $config = $WT_BLOCKS["print_random_media"]["config"]; - if (isset($config["filter"])) $filter = $config["filter"]; // indi, event, or all - else $filter = "all"; - - $dataArray[0] = i18n::translate('Random Picture'); - $dataArray[1] = time();//FIXME - get most recent change time - - $randomMedia = ""; - - - if (!$MULTI_MEDIA) return; - $medialist = array(); - $foundlist = array(); - - $medialist = get_medialist(false, '', true, true); - $ct = count($medialist); - if ($ct>0) { - $i=0; - $disp = false; - //-- try up to 40 times to get a media to display - while($i<40) { - $error = false; - $value = array_rand($medialist); - $links = $medialist[$value]["LINKS"]; - $disp = ($medialist[$value]["EXISTS"]>0) && $medialist[$value]["LINKED"] && $medialist[$value]["CHANGE"]!="delete" ; - $disp &= canDisplayRecord($value["GEDFILE"], $value["GEDCOM"]); - $disp &= canDisplayFact($value["XREF"], $value["GEDFILE"], $value["GEDCOM"]); - - $isExternal = isFileExternal($medialist[$value]["FILE"]); - - if (!$isExternal) $disp &= ($medialist[$value]["THUMBEXISTS"]>0); - - // Filter according to format and type (Default: unless configured otherwise, don't filter) - if (!empty($medialist[$value]["FORM"]) && isset($config["filter_".$medialist[$value]["FORM"]]) && $config["filter_".$medialist[$value]["FORM"]]!="yes") $disp = false; - if (!empty($medialist[$value]["TYPE"]) && isset($config["filter_".$medialist[$value]["TYPE"]]) && $config["filter_".$medialist[$value]["TYPE"]]!="yes") $disp = false; - - if ($disp && count($links) != 0){ - foreach($links as $key=>$type) { - $gedrec = find_gedcom_record($key, WT_GED_ID); - $disp &= !empty($gedrec); - //-- source privacy is now available through the display details by id method - // $disp &= $type!="SOUR"; - $disp &= canDisplayRecord(WT_GED_ID, $gedrec); - } - if ($disp && $filter!="all") { - // Apply filter criteria - $ct = preg_match("/0 (@.*@) OBJE/", $medialist[$value]["GEDCOM"], $match); - $objectID = $match[1]; - $ct2 = preg_match("/(\d) OBJE {$objectID}/", $gedrec, $match2); - if ($ct2>0) { - $objectRefLevel = $match2[1]; - if ($filter=="indi" && $objectRefLevel!="1") $disp = false; - if ($filter=="event" && $objectRefLevel=="1") $disp = false; - } - else $disp = false; - } - } - //-- leave the loop if we find an image that works - if ($disp) { - break; - } - //-- otherwise remove the private media item from the list - else { - unset($medialist[$value]); - } - //-- if there are no more media items, then try to get some more - if (count($medialist)==0) $medialist = get_medialist(false, '', true, true); - $i++; - } - if (!$disp) return false; - - $imgsize = findImageSize($medialist[$value]["FILE"]); - $imgwidth = $imgsize[0]+40; - $imgheight = $imgsize[1]+150; - - $mediaid = $medialist[$value]["XREF"]; - $randomMedia .= "<a href=\"".encode_url("mediaviewer.php?mid={$mediaid}")."\">"; - $mediaTitle = ""; - if (!empty($medialist[$value]["TITL"])) { - $mediaTitle = PrintReady($medialist[$value]["TITL"]); - } else { - $mediaTitle = basename($medialist[$value]["FILE"]); - } - //if ($block) { - $randomMedia .= "<img src=\"".$medialist[$value]["THUMB"]."\" border=\"0\" class=\"thumbnail\""; - if ($isExternal) $randomMedia .= " width=\"".$THUMBNAIL_WIDTH."\""; - $randomMedia .= " alt=\"" . $mediaTitle . "\" title=\"" . $mediaTitle . "\" />"; - /*} else { - print "<img src=\"".$medialist[$value]["FILE"]."\" border=\"0\" class=\"thumbnail\" "; - $imgsize = findImageSize($medialist[$value]["FILE"]); - if ($imgsize[0] > 175) print "width=\"175\" "; - print " alt=\"" . $mediaTitle . "\" title=\"" . $mediaTitle . "\" />"; - }*/ - $randomMedia .= "</a>\n"; - $randomMedia .= "<br />"; - $randomMedia .= "<a href=\"".encode_url("mediaviewer.php?mid={$mediaid}")."\">"; - $randomMedia .= "<b>". $mediaTitle ."</b>"; - $randomMedia .= "</a>"; - - $dataArray[2] = $randomMedia; - $dataArray[3] = $medialist[$value]["FILE"]; - $dataArray[4] = image_type_to_mime_type($imgsize[2]); - if ($dataArray[4] == false){ - $dataArray[4] =""; - $parts = pathinfo($filename); - if (isset ($parts["extension"])) { - $ext = strtolower($parts["extension"]); - } else { - $ext=""; - } - if($ext == "pdf"){ - $dataArray[4] = "application/pdf"; - } - } - $dataArray[5] = @filesize($medialist[$value]["FILE"]); - $dataArray[6] = $mediaTitle; - //$dataArray[7] = $medialist[$value]["XREF"]; - } - return $dataArray; -} - - -?> |
