Core Functions that can be used by any page in PGV
The functions in this file are common to all PGV pages and include date conversion routines and sorting functions.
phpGedView: Genealogy Viewer Copyright (C) 2002 to 2003 John Finlay and Others
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
Core Functions that can be used by any page in PGV
The functions in this file are common to all PGV pages and include date conversion routines and sorting functions.
phpGedView: Genealogy Viewer Copyright (C) 2002 to 2003 John Finlay and Others
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
check if the page view rate for a session has been exeeded.
initialize and check the database
this function will create a database connection and return false if any errors occurred
check file in
clean up user submitted input before submitting it to the SQL query
This function will take user submitted input string and remove any special characters before they are submitted to the SQL query. Examples of invalid characters are _ & ?
fact date sort
compare individuals by a fact date
compare two fact records by date
Compare facts function is used by the usort PHP function to sort fact baseds on date it parses out the year and if the year is the same, it creates a timestamp based on the current year and the month and day information of the fact
get the relative filename for a media item
gets the relative file path from the full media path for a media item. checks the $MEDIA_DIRECTORY_LEVELS to make sure the directory structure is maintained.
get the full file path
get the file path from a multimedia gedcom record
Function to sort GEDCOM fact tags based on their tanslations
decode a filename
windows doesn't use UTF-8 for its file system so we have to decode the filename before it can be used on the filesystem
encode a filename
windows doesn't use UTF-8 for its file system so we have to encode the filename before it can be used in PGV
find the children in a family
find and return an array containing the children of the given family record
find the children in a family record
find and return an array containing the children of the given family record
find all family ids in the given record
searches an individual gedcom record and returns an array of the FAMS|C ids
find all child family ids
searches an individual gedcom record and returns an array of the FAMC ids where this person is a child in the family
find the highlighted media object for a gedcom entity
Rules for finding the highlighted media object:
find the parents in a family
find and return a two element array containing the parents of the given family record
find the parents in a family record
find and return a two element array containing the parents of the given family record
find record in file
this function finds a gedcom record in the gedcom file by searching through the file 4Kb at a time
find all spouse family ids
searches an individual gedcom record and returns an array of the FAMS ids where this person is a spouse in the family
find and return an updated gedcom record
function to generate a thumbnail image
Get the current time in micro seconds
returns a timestamp for the current time in micro seconds obtained from online documentation for the microtime() function on php.net
find all of the level 1 subrecords of the given record
format a fact for calendar viewing
get gedcom configuration file
this function returns the path to the currently active GEDCOM configuration file
get CONT lines
get the N+1 CONT or CONC lines of a gedcom subrecord
Get first tag in GEDCOM sub-record
This routine uses function get_sub_record to retrieve the specified sub-record and then returns the first tag.
get a gedcom filename from its database id
get gedcom tag value
returns the value of a gedcom tag from the given gedcom record
get the next available xref
calculates the next available XREF id for the given type of record
Get the path to the privacy file
Get the path to the privacy file for the currently active GEDCOM
Get the version of the privacy file
This function opens the given privacy file and returns the privacy version from the file
function to build an URL querystring from GET or POST variables
Get relationship between two individuals in the gedcom
function to calculate the relationship between two people it uses hueristics based on the individuals birthdate to try and calculate the shortest path between the two individuals it uses a node cache to help speed up calculations when using relationship privacy this cache is indexed using the string "$pid1-$pid2"
get a list of the reports in the reports directory
When $force is false, the function will first try to read the reports list from the$INDEX_DIRECTORY."/reports.dat" data file. Otherwise the function will parse the report xml files and get the titles.
get a gedcom subrecord
searches a gedcom record and returns a subrecord of it. A subrecord is defined starting at a line with level N and all subsequent lines greater than N until the next N level is reached. For example, the following is a BIRT subrecord:
get theme names
function to get the names of all of the themes as an array it searches the themes directory and reads the name from the theme_name variable in the theme.php file.
check if the given string has UTF-8 characters
sort a list by the gedcom xref id
Determine the type of ID NOTE: Be careful when using this function as not all GEDCOMS have ID prefixes. Many GEDCOMS just use numbers like 100, 101, etc without the I, F, etc prefixes.
Check if a person is dead
For the given XREF id, this function will return true if the person is dead and false if the person is alive.
sort arrays or strings
this function is called by the uasort PHP function to compare two items and tell which should be sorted first. It uses the language alphabets to create a string that will is used to compare the strings. For each letter in the strings, the letter's position in the alphabet string is found. Whichever letter comes first in the alphabet string should be sorted first.
Load language variables Set language-dependent global variables
This function loads the variables for the language, as specified by the first input parameter. It also loads any existing language-specific functions such special date handling for Finnish and Turkish.
If the forceLoad parameter is true, English will be loaded first, followed by the desired language file.
sort an array of media items
array merge function for PGV
the PHP array_merge function will reindex all numerical indexes This function should only be used for associative arrays
PGV Error Handling function
This function will be called by PHP whenever an error occurs. The error handling is set in the session.php
remove any custom PGV tags from the given gedcom record
custom tags include _PGVU and _THUM
Locate and run any hook files found.
This function will sort a list of facts It uses an insertion sort algorithm which is a slower algorithm but it insures that all of the items get checked against each other which works better with the way that facts are sorted.
New twist: Run the sort twice, first on dated material, then undated, inserting at the last position that matches sort order.
split multi-ged keys and return either key or gedcom
Store GEDCOMS array
this function will store the $GEDCOMS array in the $INDEX_DIRECTORY/gedcoms.php file. The gedcoms.php file is included in session.php to create the $GEDCOMS array with every page request.
String sorting function
Replacement function for strrpos() Returns the numeric position of the last occurrence of needle in the haystack string.
Note that the needle in this case can only be a single character in PHP 4. If a string is passed as the needle, then only the first character of that string will be used.
User Name comparison Function
This function just needs to call the itemsort function on the fullname field of the array
write changes
this function writes the $pgv_changes back to the $INDEX_DIRECTORY/pgv_changes.php file so that it can be read in and checked to see if records have been updated. It also stores old records so that they can be undone.
Documentation generated on Wed, 28 Mar 2007 09:54:16 -0600 by phpDocumentor 1.3.1