From 14a0f010ab89c7225193f9fcfa8e7ff1e659ac6e Mon Sep 17 00:00:00 2001 From: fisharebest Date: Fri, 31 Dec 2010 14:04:14 +0000 Subject: --- modules/googlemap/admin_config.php | 6 +- modules/googlemap/admin_editconfig.php | 451 ++++++++++++++++++++++ modules/googlemap/admin_placecheck.php | 353 ++++++++++++++++++ modules/googlemap/admin_places.php | 659 +++++++++++++++++++++++++++++++++ modules/googlemap/editconfig.php | 451 ---------------------- modules/googlemap/googlemap.php | 4 +- modules/googlemap/module.php | 14 +- modules/googlemap/pedigree_map.php | 8 +- modules/googlemap/placecheck.php | 353 ------------------ modules/googlemap/placehierarchy.php | 12 +- modules/googlemap/places.php | 659 --------------------------------- modules/googlemap/places_edit.php | 2 +- modules/sitemap/admin_config.php | 49 --- modules/sitemap/admin_index.php | 435 ++++++++++++++++++++++ modules/sitemap/index.php | 435 ---------------------- modules/sitemap/module.php | 4 +- modules/stories/module.php | 22 +- 17 files changed, 1934 insertions(+), 1983 deletions(-) create mode 100644 modules/googlemap/admin_editconfig.php create mode 100644 modules/googlemap/admin_placecheck.php create mode 100644 modules/googlemap/admin_places.php delete mode 100644 modules/googlemap/editconfig.php delete mode 100644 modules/googlemap/placecheck.php delete mode 100644 modules/googlemap/places.php delete mode 100644 modules/sitemap/admin_config.php create mode 100644 modules/sitemap/admin_index.php delete mode 100644 modules/sitemap/index.php diff --git a/modules/googlemap/admin_config.php b/modules/googlemap/admin_config.php index 9dde2b9915..3ebdcd65d8 100644 --- a/modules/googlemap/admin_config.php +++ b/modules/googlemap/admin_config.php @@ -50,13 +50,13 @@ if (WT_USER_IS_ADMIN) { ?> - + - + - +   diff --git a/modules/googlemap/admin_editconfig.php b/modules/googlemap/admin_editconfig.php new file mode 100644 index 0000000000..9752946842 --- /dev/null +++ b/modules/googlemap/admin_editconfig.php @@ -0,0 +1,451 @@ + 17 September 2005 +* +* @package webtrees +* @subpackage GoogleMap +* @version $Id$ +*/ + +if (!defined('WT_WEBTREES')) { + header('HTTP/1.0 403 Forbidden'); + exit; +} + +require WT_ROOT.'modules/googlemap/defaultconfig.php'; +require WT_ROOT.'includes/functions/functions_edit.php'; + +$action=safe_REQUEST($_REQUEST, 'action'); + +function print_level_config_table($level) { + global $GM_MARKER_COLOR, $GM_MARKER_SIZE, $GM_PREFIX; + global $GM_POSTFIX, $GM_PRE_POST_MODE, $GM_MAX_NOF_LEVELS; +?> +
"> + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + +
+ + + +
+
+', i18n::translate('GoogleMap Configuration'), ''; + +if (!WT_USER_IS_ADMIN) { + echo ""; + echo "
", i18n::translate('Page only for Administrators'); + echo "
"; + echo "


"; + print_footer(); + exit; +} + +if ($action=="update" && !isset($security_user)) { + set_module_setting('googlemap', 'GM_ENABLED', $_POST['NEW_GM_ENABLE']); + set_module_setting('googlemap', 'GM_API_KEY', $_POST['NEW_GM_API_KEY']); + set_module_setting('googlemap', 'GM_MAP_TYPE', $_POST['NEW_GM_MAP_TYPE']); + set_module_setting('googlemap', 'GM_MIN_ZOOM', $_POST['NEW_GM_MIN_ZOOM']); + set_module_setting('googlemap', 'GM_MAX_ZOOM', $_POST['NEW_GM_MAX_ZOOM']); + set_module_setting('googlemap', 'GM_XSIZE', $_POST['NEW_GM_XSIZE']); + set_module_setting('googlemap', 'GM_YSIZE', $_POST['NEW_GM_YSIZE']); + set_module_setting('googlemap', 'GM_PRECISION_0', $_POST['NEW_GM_PRECISION_0']); + set_module_setting('googlemap', 'GM_PRECISION_1', $_POST['NEW_GM_PRECISION_1']); + set_module_setting('googlemap', 'GM_PRECISION_2', $_POST['NEW_GM_PRECISION_2']); + set_module_setting('googlemap', 'GM_PRECISION_3', $_POST['NEW_GM_PRECISION_3']); + set_module_setting('googlemap', 'GM_PRECISION_4', $_POST['NEW_GM_PRECISION_4']); + set_module_setting('googlemap', 'GM_PRECISION_5', $_POST['NEW_GM_PRECISION_5']); + set_module_setting('googlemap', 'GM_DEFAULT_TOP_VALUE', $_POST['NEW_GM_DEFAULT_TOP_LEVEL']); + set_module_setting('googlemap', 'GM_MAX_NOF_LEVELS', $_POST['NEW_GM_LEVEL_COUNT']); + set_module_setting('googlemap', 'GM_COORD', $_POST['NEW_GM_COORD']); + set_module_setting('googlemap', 'GM_PLACE_HIERARCHY', $_POST['NEW_GM_PLACE_HIERARCHY']); + set_module_setting('googlemap', 'GM_PH_XSIZE', $_POST['NEW_GM_PH_XSIZE']); + set_module_setting('googlemap', 'GM_PH_YSIZE', $_POST['NEW_GM_PH_YSIZE']); + set_module_setting('googlemap', 'GM_PH_MARKER', $_POST['NEW_GM_PH_MARKER']); + set_module_setting('googlemap', 'GM_DISP_SHORT_PLACE', $_POST['NEW_GM_DISP_SHORT_PLACE']); + set_module_setting('googlemap', 'GM_PH_WHEEL', $_POST['NEW_GM_PH_WHEEL']); + set_module_setting('googlemap', 'GM_PH_CONTROLS', $_POST['NEW_GM_PH_CONTROLS']); + set_module_setting('googlemap', 'GM_DISP_COUNT', $_POST['NEW_GM_DISP_COUNT']); + + for ($i=1; $i<=9; $i++) { + set_module_setting('googlemap', 'GM_PREFIX_'.$i, $_POST['NEW_GM_PREFIX_'.$i]); + set_module_setting('googlemap', 'GM_POSTFIX_'.$i, $_POST['NEW_GM_POSTFIX_'.$i]); + set_module_setting('googlemap', 'GM_PRE_POST_MODE_'.$i, $_POST['NEW_GM_PRE_POST_MODE_'.$i]); + } + + AddToLog('Googlemap config updated', 'config'); + // read the config file again, to set the vars + require WT_ROOT.'modules/googlemap/defaultconfig.php'; +} + +?> + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + +
+ + + + + + +
+ + + +
+ + + + + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + : + : +
+ + + + + + + + + + + + + + + + + + + + + + + + +
     +
     +
     +
     +
     +
     +
+
+ +
+ + + +
+ + + + + + +
+ +
+ +    + +
+
+"; +} diff --git a/modules/googlemap/admin_placecheck.php b/modules/googlemap/admin_placecheck.php new file mode 100644 index 0000000000..d4b7bff0d8 --- /dev/null +++ b/modules/googlemap/admin_placecheck.php @@ -0,0 +1,353 @@ +

", i18n::translate('Place Check'), "

"; + +//Start of User Defined options +echo ""; +echo ""; +echo ""; +echo ""; +//Show Filter table +if (!isset ($_POST["matching"])) {$matching=0;} else {$matching=1;} +echo ""; + +//Show Key table +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo "
"; +echo ""; +echo ""; +//Option box to select gedcom +echo ""; +echo ""; +//Option box for 'Open in new window' +echo ""; +echo ""; +//Option box to select Country within Gedcom +echo ""; +echo ""; + +//Option box to select level 2 place within the selected Country +if ($country!='XYZ') { + echo ""; + echo ""; +} +echo "
", i18n::translate('PlaceCheck List Options'), "
".i18n::translate('GEDCOM File:')."
".i18n::translate('Open links in')."
", i18n::translate('Country'), "
", /* I18N: Part of a country, state/region/county */ i18n::translate('Subdivision'), "
"; +echo "
"; +echo ""; +echo ""; +echo "
"; +echo "", i18n::translate('List filtering options'), "", help_link('PLACECHECK_FILTER','googlemap'); +echo "
"; +echo i18n::translate('Include fully matched places: '), help_link('PLACECHECK_MATCH','googlemap'); +echo "
"; +echo "
"; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo "
", i18n::translate('Key to colors used below'), "
", translate_fact('PLAC'), "XX", i18n::translate('This place and its coordinates do not exist in the GoogleMap tables.'), "
", translate_fact('PLAC'), "XX", i18n::translate('This place exists in the GoogleMap tables, but has no coordinates.'), "
".i18n::translate('unknown')."XX", i18n::translate('This place level is blank in your GEDCOM file. It should be added to GoogleMap places as "unknown" with coordinates from its parent level before you add any place to the next level.'), "
".i18n::translate('unknown')."N55.0W75.0", i18n::translate('This place level is blank in your GEDCOM file, but exists as "unknown" in the GoogleMap places table with coordinates. No action required until the missing level can be entered.'), "
"; +echo "
"; +echo ""; +echo "
"; +echo "
"; + +switch ($action) { +case 'go': + //Identify gedcom file + echo "", i18n::translate('Place list for GEDCOM file'), ": ", htmlspecialchars(get_gedcom_setting($gedcom_id, 'title')), "

"; + //Select all '2 PLAC ' tags in the file and create array + $place_list=array(); + $ged_data=WT_DB::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_gedcom LIKE ? AND i_file=?") + ->execute(array("%\n2 PLAC %", $gedcom_id)) + ->fetchOneColumn(); + foreach ($ged_data as $ged_datum) { + preg_match_all('/\n2 PLAC (.+)/', $ged_datum, $matches); + foreach ($matches[1] as $match) { + $place_list[$match]=true; + } + } + $ged_data=WT_DB::prepare("SELECT f_gedcom FROM `##families` WHERE f_gedcom LIKE ? AND f_file=?") + ->execute(array("%\n2 PLAC %", $gedcom_id)) + ->fetchOneColumn(); + foreach ($ged_data as $ged_datum) { + preg_match_all('/\n2 PLAC (.+)/', $ged_datum, $matches); + foreach ($matches[1] as $match) { + $place_list[$match]=true; + } + } + // Unique list of places + $place_list=array_keys($place_list); + + // Apply_filter + if ($country=='XYZ') { + $filter='.*$'; + } else { + $filter=preg_quote($country).'$'; + if ($state!='XYZ') { + $filter=preg_quote($state).', '.$filter; + } + } + $place_list=preg_grep('/'.$filter.'/', $place_list); + + //sort the array, limit to unique values, and count them + $place_parts=array(); + usort($place_list, "utf8_strcasecmp"); + $i=count($place_list); + + //calculate maximum no. of levels to display + $x=0; + $max=0; + while ($x<$i) { + $levels=explode(",", $place_list[$x]); + $parts=count($levels); + if ($parts>$max) $max=$parts; + $x++;} + $x=0; + + //scripts for edit, add and refresh + ?> + + "; + echo "", i18n::translate('GEDCOM File Place Data
(2 PLAC tag)'), "
"; + echo "", i18n::translate('GoogleMap Places Table Data'), ""; + echo ""; + while ($cols<$max) { + if ($cols == 0) { + echo "", PrintReady(i18n::translate('Country')), ""; + } else { + echo "", PrintReady(i18n::translate('Level')), " ", $cols+1, ""; + } + $cols++; + } + echo ""; + $cols=0; + while ($cols<$max) { + echo "", translate_fact('PLAC'), "", i18n::translate('Latitude'), "", i18n::translate('Longitude'), ""; + $cols++; + } + echo ""; + $countrows=0; + while ($x<$i) { + $placestr=""; + $levels=explode(",", $place_list[$x]); + $parts=count($levels); + $levels=array_reverse($levels); + $placestr.="$ppart) { + $ppart=urlencode(trim($ppart)); + $placestr.="parent[$pindex]=".$ppart."&"; + } + $placestr.="level=".count($levels); + $placestr.="\">".$place_list[$x].""; + $gedplace="".$placestr.""; + $z=0; + $y=0; + $id=0; + $level=0; + $matched[$x]=0;// used to exclude places where the gedcom place is matched at all levels + $mapstr_edit=""; + $mapstr7="')\">"; + $mapstr8=""; + while ($z<$parts) { + if ($levels[$z]==' ' || $levels[$z]=='') + $levels[$z]="unknown";// GoogleMap module uses "unknown" while GEDCOM uses , , + + $levels[$z]=rtrim(ltrim($levels[$z])); + + $placelist=create_possible_place_names($levels[$z], $z+1); // add the necessary prefix/postfix values to the place name + foreach ($placelist as $key=>$placename) { + $row= + WT_DB::prepare("SELECT pl_id, pl_place, pl_long, pl_lati, pl_zoom FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place") + ->execute(array($z, $id, $placename)) + ->fetchOneRow(PDO::FETCH_ASSOC); + if (!empty($row['pl_id'])) { + $row['pl_placerequested']=$levels[$z]; // keep the actual place name that was requested so we can display that instead of what is in the db + break; + } + } + if ($row['pl_id']!='') { + $id=$row['pl_id']; + } + + if ($row['pl_place']!='') { + $placestr2=$mapstr_edit.$id."&level=".$level.$mapstr3.$mapstr5.i18n::translate('Zoom=').$row['pl_zoom'].$mapstr6.$row['pl_placerequested'].$mapstr8; + if ($row['pl_place']=='unknown') + $matched[$x]++; + } else { + if ($levels[$z]=="unknown") { + $placestr2=$mapstr_add.$id."&level=".$level.$mapstr3.$mapstr7."".rtrim(ltrim(i18n::translate('unknown')))."".$mapstr8;$matched[$x]++; + } else { + $placestr2=$mapstr_add.$id."&place_name=".urlencode($levels[$z])."&level=".$level.$mapstr3.$mapstr7.''.rtrim(ltrim($levels[$z])).''.$mapstr8;$matched[$x]++; + } + } + $plac[$z]="".$placestr2."\n"; + if ($row['pl_lati']=='0') { + $lati[$z]="".$row['pl_lati'].""; + } else if ($row['pl_lati']!='') { + $lati[$z]="".$row['pl_lati'].""; + } else { + $lati[$z]="X";$matched[$x]++; + } + if ($row['pl_long']=='0') { + $long[$z]="".$row['pl_long'].""; + } else if ($row['pl_long']!='') { + $long[$z]="".$row['pl_long'].""; + } else { + $long[$z]="X";$matched[$x]++; + } + $level++; + $mapstr3=$mapstr3."&parent[".$z."]=".addslashes(PrintReady($row['pl_placerequested'])); + $mapstr4=$mapstr4."&parent[".$z."]=".addslashes(PrintReady(rtrim(ltrim($levels[$z])))); + $z++; + } + if ($matching==1) { + $matched[$x]=1; + } + if ($matched[$x]!=0) { + echo $gedplace; + $z=0; + while ($z<$max) { + if ($z<$parts) { + echo $plac[$z]; + echo $lati[$z]; + echo $long[$z]; + } else { + echo "   ";} + $z++; + } + echo ""; + $countrows++; + } + $x++; + } + + // echo final row of table + echo "", i18n::translate('Total unique places'), ": ", $countrows, "

"; + break; +default: + // Do not run until user selects a gedcom/place/etc. + // Instead, show some useful help info. + echo "

", i18n::translate('This will list all the places from the selected GEDCOM file. By default this will NOT INCLUDE places that are fully matched between the GEDCOM file and the GoogleMap tables'), "


"; + break; +} + +//echo footers +echo "
"; +print_footer(); diff --git a/modules/googlemap/admin_places.php b/modules/googlemap/admin_places.php new file mode 100644 index 0000000000..aba9ca42f3 --- /dev/null +++ b/modules/googlemap/admin_places.php @@ -0,0 +1,659 @@ + 17 September 2005 + * + * @package webtrees + * @subpackage GoogleMap + * @see config.php + * $Id$ + */ + +if (!defined('WT_WEBTREES')) { + header('HTTP/1.0 403 Forbidden'); + exit; +} + +require WT_ROOT.'modules/googlemap/defaultconfig.php'; + +global $iso3166; +$action=safe_REQUEST($_REQUEST, 'action'); +if (isset($_REQUEST['parent'])) $parent=$_REQUEST['parent']; +if (isset($_REQUEST['display'])) $display=$_REQUEST['display']; +if (isset($_REQUEST['mode'])) $mode=$_REQUEST['mode']; +if (isset($_REQUEST['deleteRecord'])) $deleteRecord=$_REQUEST['deleteRecord']; + +if (!isset($parent)) $parent=0; +if (!isset($display)) $display=""; + +// Take a place id and find its place in the hierarchy +// Input: place ID +// Output: ordered array of id=>name values, starting with the Top Level +// e.g. array(0=>"Top Level", 16=>"England", 19=>"London", 217=>"Westminster"); +// NB This function exists in both places.php and places_edit.php +function place_id_to_hierarchy($id) { + $statement= + WT_DB::prepare("SELECT pl_parent_id, pl_place FROM `##placelocation` WHERE pl_id=?"); + $arr=array(); + while ($id!=0) { + $row=$statement->execute(array($id))->fetchOneRow(); + $arr=array($id=>$row->pl_place)+$arr; + $id=$row->pl_parent_id; + } + return $arr; +} + +// NB This function exists in both places.php and places_edit.php +function getHighestIndex() { + return (int)WT_DB::prepare("SELECT MAX(pl_id) FROM `##placelocation`")->fetchOne(); +} + +function getHighestLevel() { + return (int)WT_DB::prepare("SELECT MAX(pl_level) FROM `##placelocation`")->fetchOne(); +} + +/** + * Find all of the places in the hierarchy + */ +function get_place_list_loc($parent_id, $display='') { + if ($display=="inactive") { + $rows= + WT_DB::prepare("SELECT pl_id, pl_place, pl_lati, pl_long, pl_zoom, pl_icon FROM `##placelocation` WHERE pl_parent_id=? ORDER BY pl_place") + ->execute(array($parent_id)) + ->fetchAll(); + } else { + $rows= + WT_DB::prepare( + "SELECT DISTINCT pl_id, pl_place, pl_lati, pl_long, pl_zoom, pl_icon". + " FROM `##placelocation`". + " INNER JOIN `##places` ON `##placelocation`.pl_place=`##places`.p_place AND `##placelocation`.pl_level=`##places`.p_level". + " WHERE pl_parent_id=? ORDER BY pl_place" + ) + ->execute(array($parent_id)) + ->fetchAll(); + } + + $placelist=array(); + foreach ($rows as $row) { + $placelist[]=array("place_id"=>$row->pl_id, "place"=>$row->pl_place, "lati"=>$row->pl_lati, "long"=>$row->pl_long, "zoom"=>$row->pl_zoom, "icon"=>$row->pl_icon); + } + uasort($placelist, "placesort"); + return $placelist; +} + +function outputLevel($parent_id) { + $tmp = place_id_to_hierarchy($parent_id); + $maxLevel = getHighestLevel(); + if ($maxLevel>8) $maxLevel = 8; + $prefix = implode(';', $tmp); + if ($prefix!='') + $prefix.=';'; + $suffix=str_repeat(';', $maxLevel-count($tmp)); + $level=count($tmp); + + $rows= + WT_DB::prepare("SELECT pl_id, pl_place, pl_long, pl_lati, pl_zoom, pl_icon FROM `##placelocation` WHERE pl_parent_id=? ORDER BY pl_place") + ->execute(array($parent_id)) + ->fetchAll(); + + foreach ($rows as $row) { + echo "{$level};{$prefix}{$row->pl_place}{$suffix};{$row->pl_long};{$row->pl_lati};{$row->pl_zoom};{$row->pl_icon}\r\n"; + if ($level < $maxLevel) + outputLevel($row->pl_id); + } +} + +/** + * recursively find all of the csv files on the server + * + * @param string $path + */ +function findFiles($path) { + global $placefiles; + if (file_exists($path)) { + $dir = dir($path); + while (false !== ($entry = $dir->read())) { + if ($entry!="." && $entry!=".." && $entry!=".svn") { + if (is_dir($path."/".$entry)) { + findFiles($path."/".$entry); + } elseif (strstr($entry, ".csv")!==false) { + $placefiles[] = preg_replace("~modules/googlemap/extra~", "", $path)."/".$entry; + } + } + } + $dir->close(); + } +} + +if (!WT_USER_IS_ADMIN) { + echo "".i18n::translate('Edit geographic place locations')."

"; + echo "\n"; + echo "
", i18n::translate('Page only for Administrators'); + echo "
\n"; + echo "


\n"; + print_footer(); + exit; +} + +global $GOOGLEMAP_MAX_ZOOM; + +if ($action=="ExportFile" && WT_USER_IS_ADMIN) { + $tmp = place_id_to_hierarchy($parent); + $maxLevel = getHighestLevel(); + if ($maxLevel>8) $maxLevel=8; + $tmp[0] = "places"; + $outputFileName=preg_replace('/[:;\/\\\(\)\{\}\[\] $]/', '_', implode('-', $tmp)).'.csv'; + header('Content-Type: application/octet-stream'); + header('Content-Disposition: attachment; filename="'.$outputFileName.'"'); + echo "\"".i18n::translate('Level')."\";\"".i18n::translate('Country')."\";"; + if ($maxLevel>0) echo '"', i18n::translate('State'), '";'; + if ($maxLevel>1) echo '"', i18n::translate('County'), '";'; + if ($maxLevel>2) echo '"', i18n::translate('City'), '";'; + if ($maxLevel>3) echo '"', i18n::translate('Place'), '";'; + if ($maxLevel>4) echo '"', i18n::translate('Place'), '";'; + if ($maxLevel>5) echo '"', i18n::translate('Place'), '";'; + if ($maxLevel>6) echo '"', i18n::translate('Place'), '";'; + if ($maxLevel>7) echo '"', i18n::translate('Place'), '";'; + echo '"', i18n::translate('Longitude'), '";"', i18n::translate('Latitude'), '";'; + echo '"', i18n::translate('Zoom factor'), '";"', i18n::translate('Icon'), WT_EOL; + outputLevel($parent); + exit; +} + +print_header(i18n::translate('Edit geographic place locations')); + +if ($action=="ImportGedcom") { + $placelist=array(); + $j=0; + if ($mode=="all") { + $statement= + WT_DB::prepare("SELECT i_gedcom FROM `##individuals` UNION ALL SELECT f_gedcom FROM `##families`") + ->execute(); + } else { + $statement= + WT_DB::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_file=? UNION ALL SELECT f_gedcom FROM `##families` WHERE f_file=?") + ->execute(array(WT_GED_ID, WT_GED_ID)); + } + while ($gedrec=$statement->fetchColumn()) { + $i = 1; + $placerec = get_sub_record(2, "2 PLAC", $gedrec, $i); + while (!empty($placerec)) { + if (preg_match("/2 PLAC (.+)/", $placerec, $match)) { + $placelist[$j] = array(); + $placelist[$j]["place"] = trim($match[1]); + if (preg_match("/4 LATI (.*)/", $placerec, $match)) { + $placelist[$j]["lati"] = trim($match[1]); + if (($placelist[$j]["lati"][0] != "N") && ($placelist[$j]["lati"][0] != "S")) { + if ($placelist[$j]["lati"] < 0) { + $placelist[$j]["lati"][0] = "S"; + } else { + $placelist[$j]["lati"] = "N".$placelist[$j]["lati"]; + } + } + } + else $placelist[$j]["lati"] = "0"; + if (preg_match("/4 LONG (.*)/", $placerec, $match)) { + $placelist[$j]["long"] = trim($match[1]); + if (($placelist[$j]["long"][0] != "E") && ($placelist[$j]["long"][0] != "W")) { + if ($placelist[$j]["long"] < 0) { + $placelist[$j]["long"][0] = "W"; + } else { + $placelist[$j]["long"] = "E".$placelist[$j]["long"]; + } + } + } + else $placelist[$j]["long"] = "0"; + $j = $j + 1; + } + $i = $i + 1; + $placerec = get_sub_record(2, "2 PLAC", $gedrec, $i); + } + } + asort($placelist); + + $prevPlace = ""; + $prevLati = ""; + $prevLong = ""; + $placelistUniq = array(); + $j = 0; + foreach ($placelist as $k=>$place) { + if ($place["place"] != $prevPlace) { + $placelistUniq[$j] = array(); + $placelistUniq[$j]["place"] = $place["place"]; + $placelistUniq[$j]["lati"] = $place["lati"]; + $placelistUniq[$j]["long"] = $place["long"]; + $j = $j + 1; + } else if (($place["place"] == $prevPlace) && (($place["lati"] != $prevLati) || ($place["long"] != $prevLong))) { + if (($placelistUniq[$j-1]["lati"] == 0) || ($placelistUniq[$j-1]["long"] == 0)) { + $placelistUniq[$j-1]["lati"] = $place["lati"]; + $placelistUniq[$j-1]["long"] = $place["long"]; + } else if (($place["lati"] != "0") || ($place["long"] != "0")) { + echo "Verscil: vorige waarde = $prevPlace, $prevLati, $prevLong, huidige = ", $place["place"], ", ", $place["lati"], ", ", $place["long"], "
"; + } + } + $prevPlace = $place["place"]; + $prevLati = $place["lati"]; + $prevLong = $place["long"]; + } + + $highestIndex = getHighestIndex(); + + $default_zoom_level=array(4, 7, 10, 12); + foreach ($placelistUniq as $k=>$place) { + $parent=preg_split('/ *, */', $place["place"]); + $parent=array_reverse($parent); + $parent_id=0; + for ($i=0; $iexecute(array($i, $parent_id, $escparent)) + ->fetchOneRow(); + if ($i < count($parent)-1) { + // Create higher-level places, if necessary + if (empty($row)) { + $highestIndex++; + WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_zoom) VALUES (?, ?, ?, ?, ?)") + ->execute(array($highestIndex, $parent_id, $i, $escparent, $default_zoom_level[$i])); + echo htmlspecialchars($escparent), '
'; + $parent_id=$highestIndex; + } else { + $parent_id=$row->pl_id; + } + } else { + // Create lowest-level place, if necessary + if (empty($row->pl_id)) { + $highestIndex++; + WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom) VALUES (?, ?, ?, ?, ?, ?, ?)") + ->execute(array($highestIndex, $parent_id, $i, $escparent, $place["long"], $place["lati"], $default_zoom_level[$i])); + echo htmlspecialchars($escparent), '
'; + } else { + if (empty($row->pl_long) && empty($row->pl_lati) && $place['lati']!="0" && $place['long']!="0") { + WT_DB::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=? WHERE pl_id=?") + ->execute(array($place["lati"], $place["long"], $row->pl_id)); + echo htmlspecialchars($escparent), '
'; + } + } + } + } + } + $parent=0; +} + +if ($action=="ImportFile") { + $placefiles = array(); + findFiles("modules/googlemap/extra"); + sort($placefiles); +?> +
+ + + + + + + 0) { ?> + + + + + + + + + + + + + + + + + +
+ +
+
+
+$value) { + $country_names[$key]=i18n::translate($key); + } + if (isset($_POST["cleardatabase"])) { + WT_DB::exec("DELETE FROM `##placelocation` WHERE 1=1"); + } + if (!empty($_FILES["placesfile"]["tmp_name"])) { + $lines = file($_FILES["placesfile"]["tmp_name"]); + } elseif (!empty($_REQUEST['localfile'])) { + $lines = file("modules/googlemap/extra".$_REQUEST['localfile']); + } + // Strip BYTE-ORDER-MARK, if present + if (!empty($lines[0]) && substr($lines[0], 0, 3)==WT_UTF8_BOM) $lines[0]=substr($lines[0], 3); + asort($lines); + $highestIndex = getHighestIndex(); + $placelist = array(); + $j = 0; + $maxLevel = 0; + foreach ($lines as $p => $placerec) { + $fieldrec = explode(';', $placerec); + if ($fieldrec[0] > $maxLevel) $maxLevel = $fieldrec[0]; + } + $fields = count($fieldrec); + foreach ($lines as $p => $placerec) { + $fieldrec = explode(';', $placerec); + if (is_numeric($fieldrec[0]) && $fieldrec[0]<=$maxLevel) { + $placelist[$j] = array(); + $placelist[$j]["place"] = ""; + for ($ii=$fields-4; $ii>1; $ii--) { + if ($fieldrec[0] > $ii-2) $placelist[$j]["place"] .= $fieldrec[$ii].","; + } + foreach ($country_names as $countrycode => $countryname) { + if ($countrycode == strtoupper($fieldrec[1])) { + $fieldrec[1] = $countryname; + break; + } + } + $placelist[$j]["place"] .= $fieldrec[1]; + $placelist[$j]["long"] = $fieldrec[$fields-4]; + $placelist[$j]["lati"] = $fieldrec[$fields-3]; + $placelist[$j]["zoom"] = $fieldrec[$fields-2]; + $placelist[$j]["icon"] = trim($fieldrec[$fields-1]); + $j = $j + 1; + } + } + + $prevPlace = ""; + $prevLati = ""; + $prevLong = ""; + $placelistUniq = array(); + $j = 0; + foreach ($placelist as $k=>$place) { + if ($place["place"] != $prevPlace) { + $placelistUniq[$j] = array(); + $placelistUniq[$j]["place"] = $place["place"]; + $placelistUniq[$j]["lati"] = $place["lati"]; + $placelistUniq[$j]["long"] = $place["long"]; + $placelistUniq[$j]["zoom"] = $place["zoom"]; + $placelistUniq[$j]["icon"] = $place["icon"]; + $j = $j + 1; + } else if (($place["place"] == $prevPlace) && (($place["lati"] != $prevLati) || ($place["long"] != $prevLong))) { + if (($placelistUniq[$j-1]["lati"] == 0) || ($placelistUniq[$j-1]["long"] == 0)) { + $placelistUniq[$j-1]["lati"] = $place["lati"]; + $placelistUniq[$j-1]["long"] = $place["long"]; + $placelistUniq[$j-1]["zoom"] = $place["zoom"]; + $placelistUniq[$j-1]["icon"] = $place["icon"]; + } else if (($place["lati"] != "0") || ($place["long"] != "0")) { + echo "Differenc: last value = $prevPlace, $prevLati, $prevLong, current = ", $place["place"], ", ", $place["lati"], ", ", $place["long"], "
"; + } + } + $prevPlace = $place["place"]; + $prevLati = $place["lati"]; + $prevLong = $place["long"]; + } + + $default_zoom_level = array(); + $default_zoom_level[0] = 4; + $default_zoom_level[1] = 7; + $default_zoom_level[2] = 10; + $default_zoom_level[3] = 12; + foreach ($placelistUniq as $k=>$place) { + $parent = explode(',', $place["place"]); + $parent = array_reverse($parent); + $parent_id=0; + for ($i=0; $iexecute(array($i, $parent_id, $escparent)) + ->fetchOneRow(); + if (empty($row)) { // this name does not yet exist: create entry + if (!isset($_POST["updateonly"])) { + $highestIndex = $highestIndex + 1; + if (($i+1) == count($parent)) { + $zoomlevel = $place["zoom"]; + } elseif (isset($default_zoom_level[$i])) { + $zoomlevel = $default_zoom_level[$i]; + } else { + $zoomlevel = $GOOGLEMAP_MAX_ZOOM; + } + if (($place["lati"] == "0") || ($place["long"] == "0") || (($i+1) < count($parent))) { + WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?)") + ->execute(array($highestIndex, $parent_id, $i, $escparent, $zoomlevel, $place["icon"])); + } else { + //delete leading zero + $pl_lati = str_replace(array('N', 'S', ','), array('', '-', '.') , $place["lati"]); + $pl_long = str_replace(array('E', 'W', ','), array('', '-', '.') , $place["long"]); + if ($pl_lati >= 0) { + $place["lati"] = "N".abs($pl_lati); + } elseif ($pl_lati < 0) { + $place["lati"] = "S".abs($pl_lati); + } + if ($pl_long >= 0) { + $place["long"] = "E".abs($pl_long); + } elseif ($pl_long < 0) { + $place["long"] = "W".abs($pl_long); + } + WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?, ?, ?)") + ->execute(array($highestIndex, $parent_id, $i, $escparent, $place["long"], $place["lati"], $zoomlevel, $place["icon"])); + } + $parent_id = $highestIndex; + } + } else { + $parent_id = $row->pl_id; + if ((isset($_POST["overwritedata"])) && ($i+1 == count($parent))) { + WT_DB::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=?, pl_zoom=?, pl_icon=? WHERE pl_id=?") + ->execute(array($place["lati"], $place["long"], $place["zoom"], $place["icon"], $parent_id)); + } else { + if ((($row->pl_long == "0") || ($row->pl_long == null)) && (($row->pl_lati == "0") || ($row->pl_lati == null))) { + WT_DB::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=? WHERE pl_id=?") + ->execute(array($place["lati"], $place["long"], $parent_id)); + } + if (empty($row->pl_icon) && !empty($place['icon'])) { + WT_DB::prepare("UPDATE `##placelocation` SET pl_icon=? WHERE pl_id=?") + ->execute(array($place["icon"], $parent_id)); + } + } + } + } + } + $parent=0; +} + +if ($action=="DeleteRecord") { + $exists= + WT_DB::prepare("SELECT 1 FROM `##placelocation` WHERE pl_parent_id=?") + ->execute(array($deleteRecord)) + ->fetchOne(); + + if (!$exists) { + WT_DB::prepare("DELETE FROM `##placelocation` WHERE pl_id=?") + ->execute(array($deleteRecord)); + } else { + echo "
".i18n::translate('Location not removed: this location contains sub-locations')."
"; + } +} + +?> + +".i18n::translate('Edit geographic place locations').": "; +$where_am_i=place_id_to_hierarchy($parent); +foreach (array_reverse($where_am_i, true) as $id=>$place) { + if ($id==$parent) { + if ($place != "Unknown") { + echo PrintReady($place); + } else { + echo i18n::translate('unknown'); + } + } else { + echo ""; + if ($place != "Unknown") { + echo PrintReady($place), ""; + } else { + echo i18n::translate('unknown'), ""; + } + } + echo " - "; +} +echo "".i18n::translate('Top Level').""; +echo "

"; +echo "\n
", i18n::translate('Click here to show inactive places'), ": \n"; +echo help_link('PLE_ACTIVE','googlemap'); +echo "
"; +echo "
"; + +$placelist=get_place_list_loc($parent, $display); + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +if (count($placelist) == 0) + echo ""; +foreach ($placelist as $place) { + echo ""; + else + echo i18n::translate('unknown'), ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + $noRows= + WT_DB::prepare("SELECT COUNT(pl_id) FROM `##placelocation` WHERE pl_parent_id=?") + ->execute(array($place["place_id"])) + ->fetchOne(); + if ($noRows==0) { ?> + + + + + + +
", translate_fact('PLAC'), "", translate_fact('LATI'), "", translate_fact('LONG'), "".i18n::translate('Zoom factor')."".i18n::translate('Icon').""; +echo i18n::translate('Edit geographic location'), help_link('PL_EDIT_LOCATION','googlemap'), "
", i18n::translate('No places found'), "
"; + if ($place["place"] != "Unknown") + echo PrintReady($place["place"]), "{$place['lati']}{$place['long']}{$place['zoom']}"; + if (($place["icon"] == NULL) || ($place["icon"] == "")) { + if (($place['lati'] == NULL) || ($place['long'] == NULL) || (($place['lati'] == "0") && ($place['long'] == "0"))) { + echo " "; + echo ""; + } + else { + echo " "; + echo ""; + } + } else { + echo ""; + } + echo "", i18n::translate('Edit'), ""; ?><?php echo i18n::translate('Remove'); ?>
+ + + + + + + + + + + + + +
+"; + echo i18n::translate('Export current view to file'), ""; + echo help_link('PL_EXPORT_FILE','googlemap'); + } else { + echo " "; + } + echo ""; + echo ""; + echo i18n::translate('Export all locations to file'), ""; + echo help_link('PL_EXPORT_ALL_FILE','googlemap'); + echo "

"; +if (empty($SEARCH_SPIDER)) + print_footer(); +else { + echo i18n::translate('Search Engine Spider Detected'), ": ", $SEARCH_SPIDER; + echo "\n\n\t\n"; +} diff --git a/modules/googlemap/editconfig.php b/modules/googlemap/editconfig.php deleted file mode 100644 index 84e7b5eb00..0000000000 --- a/modules/googlemap/editconfig.php +++ /dev/null @@ -1,451 +0,0 @@ - 17 September 2005 -* -* @package webtrees -* @subpackage GoogleMap -* @version $Id$ -*/ - -if (!defined('WT_WEBTREES')) { - header('HTTP/1.0 403 Forbidden'); - exit; -} - -require WT_ROOT.'modules/googlemap/defaultconfig.php'; -require WT_ROOT.'includes/functions/functions_edit.php'; - -$action=safe_REQUEST($_REQUEST, 'action'); - -function print_level_config_table($level) { - global $GM_MARKER_COLOR, $GM_MARKER_SIZE, $GM_PREFIX; - global $GM_POSTFIX, $GM_PRE_POST_MODE, $GM_MAX_NOF_LEVELS; -?> -
"> - - - - - - - - - - - - - - - - -
- -
- - - -
- - - -
- - - -
-
-', i18n::translate('GoogleMap Configuration'), ''; - -if (!WT_USER_IS_ADMIN) { - echo ""; - echo "
", i18n::translate('Page only for Administrators'); - echo "
"; - echo "


"; - print_footer(); - exit; -} - -if ($action=="update" && !isset($security_user)) { - set_module_setting('googlemap', 'GM_ENABLED', $_POST['NEW_GM_ENABLE']); - set_module_setting('googlemap', 'GM_API_KEY', $_POST['NEW_GM_API_KEY']); - set_module_setting('googlemap', 'GM_MAP_TYPE', $_POST['NEW_GM_MAP_TYPE']); - set_module_setting('googlemap', 'GM_MIN_ZOOM', $_POST['NEW_GM_MIN_ZOOM']); - set_module_setting('googlemap', 'GM_MAX_ZOOM', $_POST['NEW_GM_MAX_ZOOM']); - set_module_setting('googlemap', 'GM_XSIZE', $_POST['NEW_GM_XSIZE']); - set_module_setting('googlemap', 'GM_YSIZE', $_POST['NEW_GM_YSIZE']); - set_module_setting('googlemap', 'GM_PRECISION_0', $_POST['NEW_GM_PRECISION_0']); - set_module_setting('googlemap', 'GM_PRECISION_1', $_POST['NEW_GM_PRECISION_1']); - set_module_setting('googlemap', 'GM_PRECISION_2', $_POST['NEW_GM_PRECISION_2']); - set_module_setting('googlemap', 'GM_PRECISION_3', $_POST['NEW_GM_PRECISION_3']); - set_module_setting('googlemap', 'GM_PRECISION_4', $_POST['NEW_GM_PRECISION_4']); - set_module_setting('googlemap', 'GM_PRECISION_5', $_POST['NEW_GM_PRECISION_5']); - set_module_setting('googlemap', 'GM_DEFAULT_TOP_VALUE', $_POST['NEW_GM_DEFAULT_TOP_LEVEL']); - set_module_setting('googlemap', 'GM_MAX_NOF_LEVELS', $_POST['NEW_GM_LEVEL_COUNT']); - set_module_setting('googlemap', 'GM_COORD', $_POST['NEW_GM_COORD']); - set_module_setting('googlemap', 'GM_PLACE_HIERARCHY', $_POST['NEW_GM_PLACE_HIERARCHY']); - set_module_setting('googlemap', 'GM_PH_XSIZE', $_POST['NEW_GM_PH_XSIZE']); - set_module_setting('googlemap', 'GM_PH_YSIZE', $_POST['NEW_GM_PH_YSIZE']); - set_module_setting('googlemap', 'GM_PH_MARKER', $_POST['NEW_GM_PH_MARKER']); - set_module_setting('googlemap', 'GM_DISP_SHORT_PLACE', $_POST['NEW_GM_DISP_SHORT_PLACE']); - set_module_setting('googlemap', 'GM_PH_WHEEL', $_POST['NEW_GM_PH_WHEEL']); - set_module_setting('googlemap', 'GM_PH_CONTROLS', $_POST['NEW_GM_PH_CONTROLS']); - set_module_setting('googlemap', 'GM_DISP_COUNT', $_POST['NEW_GM_DISP_COUNT']); - - for ($i=1; $i<=9; $i++) { - set_module_setting('googlemap', 'GM_PREFIX_'.$i, $_POST['NEW_GM_PREFIX_'.$i]); - set_module_setting('googlemap', 'GM_POSTFIX_'.$i, $_POST['NEW_GM_POSTFIX_'.$i]); - set_module_setting('googlemap', 'GM_PRE_POST_MODE_'.$i, $_POST['NEW_GM_PRE_POST_MODE_'.$i]); - } - - AddToLog('Googlemap config updated', 'config'); - // read the config file again, to set the vars - require WT_ROOT.'modules/googlemap/defaultconfig.php'; -} - -?> - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- - - -
- - - -
- - - - - - -
- - - -
- - - - - - -
- - - -
- - - -
- - - -
- - - -
- - - -
- - - -
- - - : - : -
- - - - - - - - - - - - - - - - - - - - - - - - -
     -
     -
     -
     -
     -
     -
-
- -
- - - -
- - - - - - -
- -
- -    - -
-
-"; -} diff --git a/modules/googlemap/googlemap.php b/modules/googlemap/googlemap.php index 6524d50662..072012052d 100644 --- a/modules/googlemap/googlemap.php +++ b/modules/googlemap/googlemap.php @@ -622,7 +622,7 @@ function build_indiv_map($indifacts, $famids) { echo "function ResizeMap() {}"; if (WT_USER_IS_ADMIN) { echo ""; - echo "", i18n::translate('Manage GoogleMap configuration'), ""; + echo "", i18n::translate('Manage GoogleMap configuration'), ""; echo ""; } } else { @@ -700,7 +700,7 @@ function build_indiv_map($indifacts, $famids) { if (($markers[$j]["lati"] == NULL) || ($markers[$j]["lng"] == NULL) || (($markers[$j]["lati"] == "0") && ($markers[$j]["lng"] == "0"))) { echo "

", i18n::translate('This place has no coordinates'); if (WT_USER_IS_ADMIN) - echo '
', i18n::translate('Edit geographic location'), ''; + echo '
', i18n::translate('Edit geographic location'), ''; echo "\");"; } else if (!$GOOGLEMAP_COORD) { diff --git a/modules/googlemap/module.php b/modules/googlemap/module.php index 77c951bcf0..7a55256d93 100644 --- a/modules/googlemap/module.php +++ b/modules/googlemap/module.php @@ -49,11 +49,11 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu public function modAction($mod_action) { switch($mod_action) { case 'admin_config': - case 'editconfig': + case 'admin_editconfig': case 'flags': case 'pedigree_map': - case 'placecheck': - case 'places': + case 'admin_placecheck': + case 'admin_places': case 'places_edit': // TODO: these files should be methods in this class require_once WT_ROOT.'modules/googlemap/googlemap.php'; @@ -107,7 +107,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu echo "".i18n::translate('GoogleMap module disabled').""; if (WT_USER_IS_ADMIN) { echo ""; - echo "getName()."&mod_action=editconfig\">".i18n::translate('Manage GoogleMap configuration').""; + echo "getName()."&mod_action=admin_editconfig\">".i18n::translate('Manage GoogleMap configuration').""; echo ""; echo ""; } @@ -149,13 +149,13 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu if (WT_USER_IS_ADMIN) { echo ""; echo ""; echo ""; echo ""; echo "
"; - echo "getName()."&mod_action=editconfig\">".i18n::translate('Manage GoogleMap configuration').""; + echo "getName()."&mod_action=admin_editconfig\">".i18n::translate('Manage GoogleMap configuration').""; echo ""; - echo "getName()."&mod_action=places\">".i18n::translate('Edit geographic place locations').""; + echo "getName()."&mod_action=admin_places\">".i18n::translate('Edit geographic place locations').""; echo ""; - echo "getName()."&mod_action=placecheck\">".i18n::translate('Place Check').""; + echo "getName()."&mod_action=admin_placecheck\">".i18n::translate('Place Check').""; echo "
"; } diff --git a/modules/googlemap/pedigree_map.php b/modules/googlemap/pedigree_map.php index 7cd47c5714..5cb8e5704d 100644 --- a/modules/googlemap/pedigree_map.php +++ b/modules/googlemap/pedigree_map.php @@ -78,7 +78,7 @@ if (!$GOOGLEMAP_ENABLED) { echo "", i18n::translate('GoogleMap module disabled'), "\n"; if (WT_USER_IS_ADMIN) { echo "\n"; - echo "", i18n::translate('Manage GoogleMap configuration'), ""; + echo "", i18n::translate('Manage GoogleMap configuration'), ""; echo "\n"; } echo "
"; @@ -251,13 +251,13 @@ echo " background-image: url('images/loading.gif'); background-position: center; if (WT_USER_IS_ADMIN) { echo ""; echo "\n"; echo "\n"; echo "\n"; echo "
\n"; - echo "", i18n::translate('Manage GoogleMap configuration'), ""; + echo "", i18n::translate('Manage GoogleMap configuration'), ""; echo "\n"; - echo "", i18n::translate('Edit geographic place locations'), ""; + echo "", i18n::translate('Edit geographic place locations'), ""; echo "\n"; - echo "", i18n::translate('Place Check'), ""; + echo "", i18n::translate('Place Check'), ""; echo "
\n"; } diff --git a/modules/googlemap/placecheck.php b/modules/googlemap/placecheck.php deleted file mode 100644 index 5897f26700..0000000000 --- a/modules/googlemap/placecheck.php +++ /dev/null @@ -1,353 +0,0 @@ -

", i18n::translate('Place Check'), "

"; - -//Start of User Defined options -echo ""; -echo ""; -echo ""; -echo ""; -//Show Filter table -if (!isset ($_POST["matching"])) {$matching=0;} else {$matching=1;} -echo ""; - -//Show Key table -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo "
"; -echo ""; -echo ""; -//Option box to select gedcom -echo ""; -echo ""; -//Option box for 'Open in new window' -echo ""; -echo ""; -//Option box to select Country within Gedcom -echo ""; -echo ""; - -//Option box to select level 2 place within the selected Country -if ($country!='XYZ') { - echo ""; - echo ""; -} -echo "
", i18n::translate('PlaceCheck List Options'), "
".i18n::translate('GEDCOM File:')."
".i18n::translate('Open links in')."
", i18n::translate('Country'), "
", /* I18N: Part of a country, state/region/county */ i18n::translate('Subdivision'), "
"; -echo "
"; -echo ""; -echo ""; -echo "
"; -echo "", i18n::translate('List filtering options'), "", help_link('PLACECHECK_FILTER','googlemap'); -echo "
"; -echo i18n::translate('Include fully matched places: '), help_link('PLACECHECK_MATCH','googlemap'); -echo "
"; -echo "
"; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo "
", i18n::translate('Key to colors used below'), "
", translate_fact('PLAC'), "XX", i18n::translate('This place and its coordinates do not exist in the GoogleMap tables.'), "
", translate_fact('PLAC'), "XX", i18n::translate('This place exists in the GoogleMap tables, but has no coordinates.'), "
".i18n::translate('unknown')."XX", i18n::translate('This place level is blank in your GEDCOM file. It should be added to GoogleMap places as "unknown" with coordinates from its parent level before you add any place to the next level.'), "
".i18n::translate('unknown')."N55.0W75.0", i18n::translate('This place level is blank in your GEDCOM file, but exists as "unknown" in the GoogleMap places table with coordinates. No action required until the missing level can be entered.'), "
"; -echo "
"; -echo ""; -echo "
"; -echo "
"; - -switch ($action) { -case 'go': - //Identify gedcom file - echo "", i18n::translate('Place list for GEDCOM file'), ": ", htmlspecialchars(get_gedcom_setting($gedcom_id, 'title')), "

"; - //Select all '2 PLAC ' tags in the file and create array - $place_list=array(); - $ged_data=WT_DB::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_gedcom LIKE ? AND i_file=?") - ->execute(array("%\n2 PLAC %", $gedcom_id)) - ->fetchOneColumn(); - foreach ($ged_data as $ged_datum) { - preg_match_all('/\n2 PLAC (.+)/', $ged_datum, $matches); - foreach ($matches[1] as $match) { - $place_list[$match]=true; - } - } - $ged_data=WT_DB::prepare("SELECT f_gedcom FROM `##families` WHERE f_gedcom LIKE ? AND f_file=?") - ->execute(array("%\n2 PLAC %", $gedcom_id)) - ->fetchOneColumn(); - foreach ($ged_data as $ged_datum) { - preg_match_all('/\n2 PLAC (.+)/', $ged_datum, $matches); - foreach ($matches[1] as $match) { - $place_list[$match]=true; - } - } - // Unique list of places - $place_list=array_keys($place_list); - - // Apply_filter - if ($country=='XYZ') { - $filter='.*$'; - } else { - $filter=preg_quote($country).'$'; - if ($state!='XYZ') { - $filter=preg_quote($state).', '.$filter; - } - } - $place_list=preg_grep('/'.$filter.'/', $place_list); - - //sort the array, limit to unique values, and count them - $place_parts=array(); - usort($place_list, "utf8_strcasecmp"); - $i=count($place_list); - - //calculate maximum no. of levels to display - $x=0; - $max=0; - while ($x<$i) { - $levels=explode(",", $place_list[$x]); - $parts=count($levels); - if ($parts>$max) $max=$parts; - $x++;} - $x=0; - - //scripts for edit, add and refresh - ?> - - "; - echo "", i18n::translate('GEDCOM File Place Data
(2 PLAC tag)'), "
"; - echo "", i18n::translate('GoogleMap Places Table Data'), ""; - echo ""; - while ($cols<$max) { - if ($cols == 0) { - echo "", PrintReady(i18n::translate('Country')), ""; - } else { - echo "", PrintReady(i18n::translate('Level')), " ", $cols+1, ""; - } - $cols++; - } - echo ""; - $cols=0; - while ($cols<$max) { - echo "", translate_fact('PLAC'), "", i18n::translate('Latitude'), "", i18n::translate('Longitude'), ""; - $cols++; - } - echo ""; - $countrows=0; - while ($x<$i) { - $placestr=""; - $levels=explode(",", $place_list[$x]); - $parts=count($levels); - $levels=array_reverse($levels); - $placestr.="$ppart) { - $ppart=urlencode(trim($ppart)); - $placestr.="parent[$pindex]=".$ppart."&"; - } - $placestr.="level=".count($levels); - $placestr.="\">".$place_list[$x].""; - $gedplace="".$placestr.""; - $z=0; - $y=0; - $id=0; - $level=0; - $matched[$x]=0;// used to exclude places where the gedcom place is matched at all levels - $mapstr_edit=""; - $mapstr7="')\">"; - $mapstr8=""; - while ($z<$parts) { - if ($levels[$z]==' ' || $levels[$z]=='') - $levels[$z]="unknown";// GoogleMap module uses "unknown" while GEDCOM uses , , - - $levels[$z]=rtrim(ltrim($levels[$z])); - - $placelist=create_possible_place_names($levels[$z], $z+1); // add the necessary prefix/postfix values to the place name - foreach ($placelist as $key=>$placename) { - $row= - WT_DB::prepare("SELECT pl_id, pl_place, pl_long, pl_lati, pl_zoom FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place") - ->execute(array($z, $id, $placename)) - ->fetchOneRow(PDO::FETCH_ASSOC); - if (!empty($row['pl_id'])) { - $row['pl_placerequested']=$levels[$z]; // keep the actual place name that was requested so we can display that instead of what is in the db - break; - } - } - if ($row['pl_id']!='') { - $id=$row['pl_id']; - } - - if ($row['pl_place']!='') { - $placestr2=$mapstr_edit.$id."&level=".$level.$mapstr3.$mapstr5.i18n::translate('Zoom=').$row['pl_zoom'].$mapstr6.$row['pl_placerequested'].$mapstr8; - if ($row['pl_place']=='unknown') - $matched[$x]++; - } else { - if ($levels[$z]=="unknown") { - $placestr2=$mapstr_add.$id."&level=".$level.$mapstr3.$mapstr7."".rtrim(ltrim(i18n::translate('unknown')))."".$mapstr8;$matched[$x]++; - } else { - $placestr2=$mapstr_add.$id."&place_name=".urlencode($levels[$z])."&level=".$level.$mapstr3.$mapstr7.''.rtrim(ltrim($levels[$z])).''.$mapstr8;$matched[$x]++; - } - } - $plac[$z]="".$placestr2."\n"; - if ($row['pl_lati']=='0') { - $lati[$z]="".$row['pl_lati'].""; - } else if ($row['pl_lati']!='') { - $lati[$z]="".$row['pl_lati'].""; - } else { - $lati[$z]="X";$matched[$x]++; - } - if ($row['pl_long']=='0') { - $long[$z]="".$row['pl_long'].""; - } else if ($row['pl_long']!='') { - $long[$z]="".$row['pl_long'].""; - } else { - $long[$z]="X";$matched[$x]++; - } - $level++; - $mapstr3=$mapstr3."&parent[".$z."]=".addslashes(PrintReady($row['pl_placerequested'])); - $mapstr4=$mapstr4."&parent[".$z."]=".addslashes(PrintReady(rtrim(ltrim($levels[$z])))); - $z++; - } - if ($matching==1) { - $matched[$x]=1; - } - if ($matched[$x]!=0) { - echo $gedplace; - $z=0; - while ($z<$max) { - if ($z<$parts) { - echo $plac[$z]; - echo $lati[$z]; - echo $long[$z]; - } else { - echo "   ";} - $z++; - } - echo ""; - $countrows++; - } - $x++; - } - - // echo final row of table - echo "", i18n::translate('Total unique places'), ": ", $countrows, "

"; - break; -default: - // Do not run until user selects a gedcom/place/etc. - // Instead, show some useful help info. - echo "

", i18n::translate('This will list all the places from the selected GEDCOM file. By default this will NOT INCLUDE places that are fully matched between the GEDCOM file and the GoogleMap tables'), "


"; - break; -} - -//echo footers -echo "
"; -print_footer(); diff --git a/modules/googlemap/placehierarchy.php b/modules/googlemap/placehierarchy.php index 2286a4771e..44abf3abdc 100644 --- a/modules/googlemap/placehierarchy.php +++ b/modules/googlemap/placehierarchy.php @@ -179,13 +179,13 @@ function create_map() { if (WT_USER_IS_ADMIN) { echo ""; echo "\n"; echo "\n"; echo "\n"; echo "
\n"; - echo "", i18n::translate('Manage GoogleMap configuration'), ""; + echo "", i18n::translate('Manage GoogleMap configuration'), ""; echo "\n"; - echo "", i18n::translate('Edit geographic place locations'), ""; + echo "", i18n::translate('Edit geographic place locations'), ""; echo "\n"; - echo "", i18n::translate('Place Check'), ""; + echo "", i18n::translate('Place Check'), ""; echo "
\n"; } @@ -297,7 +297,7 @@ function print_gm_markers($place2, $level, $parent, $levelm, $linklevels, $place } echo "
", i18n::translate('This place has no coordinates'); if (WT_USER_IS_ADMIN) - echo "
", i18n::translate('Edit geographic location'), ""; + echo "
", i18n::translate('Edit geographic location'), ""; echo "\", icon_type, \"", str_replace(array('‎', '‏'), array(WT_UTF8_LRM, WT_UTF8_RLM), addslashes($place2['place'])), "\");\n"; } else { $lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $place2['lati']); @@ -566,7 +566,7 @@ function map_scripts($numfound, $level, $parent, $linklevels, $placelevels, $pla echo "var marker = createMarker(point, \"
"; echo substr($placelevels, 2), "
", i18n::translate('This place has no coordinates'); if (WT_USER_IS_ADMIN) - echo "
", i18n::translate('Edit geographic location'), ""; + echo "
", i18n::translate('Edit geographic location'), ""; echo "
\", icon_type, \"", i18n::translate('Edit geographic location'), "\");\n"; echo "place_map.addOverlay(marker);\n"; echo "bounds.extend(point);\n"; @@ -623,7 +623,7 @@ function map_scripts($numfound, $level, $parent, $linklevels, $placelevels, $pla echo "var marker = createMarker(point, \"
"; echo "
", i18n::translate('This place has no coordinates'); if (WT_USER_IS_ADMIN) - echo "
", i18n::translate('Edit geographic location'), ""; + echo "
", i18n::translate('Edit geographic location'), ""; echo "
\", icon_type, \"", i18n::translate('Edit geographic location'), "\");\n"; echo "place_map.addOverlay(marker);\n"; echo "bounds.extend(point);\n"; diff --git a/modules/googlemap/places.php b/modules/googlemap/places.php deleted file mode 100644 index 229a4b8402..0000000000 --- a/modules/googlemap/places.php +++ /dev/null @@ -1,659 +0,0 @@ - 17 September 2005 - * - * @package webtrees - * @subpackage GoogleMap - * @see config.php - * $Id$ - */ - -if (!defined('WT_WEBTREES')) { - header('HTTP/1.0 403 Forbidden'); - exit; -} - -require WT_ROOT.'modules/googlemap/defaultconfig.php'; - -global $iso3166; -$action=safe_REQUEST($_REQUEST, 'action'); -if (isset($_REQUEST['parent'])) $parent=$_REQUEST['parent']; -if (isset($_REQUEST['display'])) $display=$_REQUEST['display']; -if (isset($_REQUEST['mode'])) $mode=$_REQUEST['mode']; -if (isset($_REQUEST['deleteRecord'])) $deleteRecord=$_REQUEST['deleteRecord']; - -if (!isset($parent)) $parent=0; -if (!isset($display)) $display=""; - -// Take a place id and find its place in the hierarchy -// Input: place ID -// Output: ordered array of id=>name values, starting with the Top Level -// e.g. array(0=>"Top Level", 16=>"England", 19=>"London", 217=>"Westminster"); -// NB This function exists in both places.php and places_edit.php -function place_id_to_hierarchy($id) { - $statement= - WT_DB::prepare("SELECT pl_parent_id, pl_place FROM `##placelocation` WHERE pl_id=?"); - $arr=array(); - while ($id!=0) { - $row=$statement->execute(array($id))->fetchOneRow(); - $arr=array($id=>$row->pl_place)+$arr; - $id=$row->pl_parent_id; - } - return $arr; -} - -// NB This function exists in both places.php and places_edit.php -function getHighestIndex() { - return (int)WT_DB::prepare("SELECT MAX(pl_id) FROM `##placelocation`")->fetchOne(); -} - -function getHighestLevel() { - return (int)WT_DB::prepare("SELECT MAX(pl_level) FROM `##placelocation`")->fetchOne(); -} - -/** - * Find all of the places in the hierarchy - */ -function get_place_list_loc($parent_id, $display='') { - if ($display=="inactive") { - $rows= - WT_DB::prepare("SELECT pl_id, pl_place, pl_lati, pl_long, pl_zoom, pl_icon FROM `##placelocation` WHERE pl_parent_id=? ORDER BY pl_place") - ->execute(array($parent_id)) - ->fetchAll(); - } else { - $rows= - WT_DB::prepare( - "SELECT DISTINCT pl_id, pl_place, pl_lati, pl_long, pl_zoom, pl_icon". - " FROM `##placelocation`". - " INNER JOIN `##places` ON `##placelocation`.pl_place=`##places`.p_place AND `##placelocation`.pl_level=`##places`.p_level". - " WHERE pl_parent_id=? ORDER BY pl_place" - ) - ->execute(array($parent_id)) - ->fetchAll(); - } - - $placelist=array(); - foreach ($rows as $row) { - $placelist[]=array("place_id"=>$row->pl_id, "place"=>$row->pl_place, "lati"=>$row->pl_lati, "long"=>$row->pl_long, "zoom"=>$row->pl_zoom, "icon"=>$row->pl_icon); - } - uasort($placelist, "placesort"); - return $placelist; -} - -function outputLevel($parent_id) { - $tmp = place_id_to_hierarchy($parent_id); - $maxLevel = getHighestLevel(); - if ($maxLevel>8) $maxLevel = 8; - $prefix = implode(';', $tmp); - if ($prefix!='') - $prefix.=';'; - $suffix=str_repeat(';', $maxLevel-count($tmp)); - $level=count($tmp); - - $rows= - WT_DB::prepare("SELECT pl_id, pl_place, pl_long, pl_lati, pl_zoom, pl_icon FROM `##placelocation` WHERE pl_parent_id=? ORDER BY pl_place") - ->execute(array($parent_id)) - ->fetchAll(); - - foreach ($rows as $row) { - echo "{$level};{$prefix}{$row->pl_place}{$suffix};{$row->pl_long};{$row->pl_lati};{$row->pl_zoom};{$row->pl_icon}\r\n"; - if ($level < $maxLevel) - outputLevel($row->pl_id); - } -} - -/** - * recursively find all of the csv files on the server - * - * @param string $path - */ -function findFiles($path) { - global $placefiles; - if (file_exists($path)) { - $dir = dir($path); - while (false !== ($entry = $dir->read())) { - if ($entry!="." && $entry!=".." && $entry!=".svn") { - if (is_dir($path."/".$entry)) { - findFiles($path."/".$entry); - } elseif (strstr($entry, ".csv")!==false) { - $placefiles[] = preg_replace("~modules/googlemap/extra~", "", $path)."/".$entry; - } - } - } - $dir->close(); - } -} - -if (!WT_USER_IS_ADMIN) { - echo "".i18n::translate('Edit geographic place locations')."

"; - echo "\n"; - echo "
", i18n::translate('Page only for Administrators'); - echo "
\n"; - echo "


\n"; - print_footer(); - exit; -} - -global $GOOGLEMAP_MAX_ZOOM; - -if ($action=="ExportFile" && WT_USER_IS_ADMIN) { - $tmp = place_id_to_hierarchy($parent); - $maxLevel = getHighestLevel(); - if ($maxLevel>8) $maxLevel=8; - $tmp[0] = "places"; - $outputFileName=preg_replace('/[:;\/\\\(\)\{\}\[\] $]/', '_', implode('-', $tmp)).'.csv'; - header('Content-Type: application/octet-stream'); - header('Content-Disposition: attachment; filename="'.$outputFileName.'"'); - echo "\"".i18n::translate('Level')."\";\"".i18n::translate('Country')."\";"; - if ($maxLevel>0) echo '"', i18n::translate('State'), '";'; - if ($maxLevel>1) echo '"', i18n::translate('County'), '";'; - if ($maxLevel>2) echo '"', i18n::translate('City'), '";'; - if ($maxLevel>3) echo '"', i18n::translate('Place'), '";'; - if ($maxLevel>4) echo '"', i18n::translate('Place'), '";'; - if ($maxLevel>5) echo '"', i18n::translate('Place'), '";'; - if ($maxLevel>6) echo '"', i18n::translate('Place'), '";'; - if ($maxLevel>7) echo '"', i18n::translate('Place'), '";'; - echo '"', i18n::translate('Longitude'), '";"', i18n::translate('Latitude'), '";'; - echo '"', i18n::translate('Zoom factor'), '";"', i18n::translate('Icon'), WT_EOL; - outputLevel($parent); - exit; -} - -print_header(i18n::translate('Edit geographic place locations')); - -if ($action=="ImportGedcom") { - $placelist=array(); - $j=0; - if ($mode=="all") { - $statement= - WT_DB::prepare("SELECT i_gedcom FROM `##individuals` UNION ALL SELECT f_gedcom FROM `##families`") - ->execute(); - } else { - $statement= - WT_DB::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_file=? UNION ALL SELECT f_gedcom FROM `##families` WHERE f_file=?") - ->execute(array(WT_GED_ID, WT_GED_ID)); - } - while ($gedrec=$statement->fetchColumn()) { - $i = 1; - $placerec = get_sub_record(2, "2 PLAC", $gedrec, $i); - while (!empty($placerec)) { - if (preg_match("/2 PLAC (.+)/", $placerec, $match)) { - $placelist[$j] = array(); - $placelist[$j]["place"] = trim($match[1]); - if (preg_match("/4 LATI (.*)/", $placerec, $match)) { - $placelist[$j]["lati"] = trim($match[1]); - if (($placelist[$j]["lati"][0] != "N") && ($placelist[$j]["lati"][0] != "S")) { - if ($placelist[$j]["lati"] < 0) { - $placelist[$j]["lati"][0] = "S"; - } else { - $placelist[$j]["lati"] = "N".$placelist[$j]["lati"]; - } - } - } - else $placelist[$j]["lati"] = "0"; - if (preg_match("/4 LONG (.*)/", $placerec, $match)) { - $placelist[$j]["long"] = trim($match[1]); - if (($placelist[$j]["long"][0] != "E") && ($placelist[$j]["long"][0] != "W")) { - if ($placelist[$j]["long"] < 0) { - $placelist[$j]["long"][0] = "W"; - } else { - $placelist[$j]["long"] = "E".$placelist[$j]["long"]; - } - } - } - else $placelist[$j]["long"] = "0"; - $j = $j + 1; - } - $i = $i + 1; - $placerec = get_sub_record(2, "2 PLAC", $gedrec, $i); - } - } - asort($placelist); - - $prevPlace = ""; - $prevLati = ""; - $prevLong = ""; - $placelistUniq = array(); - $j = 0; - foreach ($placelist as $k=>$place) { - if ($place["place"] != $prevPlace) { - $placelistUniq[$j] = array(); - $placelistUniq[$j]["place"] = $place["place"]; - $placelistUniq[$j]["lati"] = $place["lati"]; - $placelistUniq[$j]["long"] = $place["long"]; - $j = $j + 1; - } else if (($place["place"] == $prevPlace) && (($place["lati"] != $prevLati) || ($place["long"] != $prevLong))) { - if (($placelistUniq[$j-1]["lati"] == 0) || ($placelistUniq[$j-1]["long"] == 0)) { - $placelistUniq[$j-1]["lati"] = $place["lati"]; - $placelistUniq[$j-1]["long"] = $place["long"]; - } else if (($place["lati"] != "0") || ($place["long"] != "0")) { - echo "Verscil: vorige waarde = $prevPlace, $prevLati, $prevLong, huidige = ", $place["place"], ", ", $place["lati"], ", ", $place["long"], "
"; - } - } - $prevPlace = $place["place"]; - $prevLati = $place["lati"]; - $prevLong = $place["long"]; - } - - $highestIndex = getHighestIndex(); - - $default_zoom_level=array(4, 7, 10, 12); - foreach ($placelistUniq as $k=>$place) { - $parent=preg_split('/ *, */', $place["place"]); - $parent=array_reverse($parent); - $parent_id=0; - for ($i=0; $iexecute(array($i, $parent_id, $escparent)) - ->fetchOneRow(); - if ($i < count($parent)-1) { - // Create higher-level places, if necessary - if (empty($row)) { - $highestIndex++; - WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_zoom) VALUES (?, ?, ?, ?, ?)") - ->execute(array($highestIndex, $parent_id, $i, $escparent, $default_zoom_level[$i])); - echo htmlspecialchars($escparent), '
'; - $parent_id=$highestIndex; - } else { - $parent_id=$row->pl_id; - } - } else { - // Create lowest-level place, if necessary - if (empty($row->pl_id)) { - $highestIndex++; - WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom) VALUES (?, ?, ?, ?, ?, ?, ?)") - ->execute(array($highestIndex, $parent_id, $i, $escparent, $place["long"], $place["lati"], $default_zoom_level[$i])); - echo htmlspecialchars($escparent), '
'; - } else { - if (empty($row->pl_long) && empty($row->pl_lati) && $place['lati']!="0" && $place['long']!="0") { - WT_DB::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=? WHERE pl_id=?") - ->execute(array($place["lati"], $place["long"], $row->pl_id)); - echo htmlspecialchars($escparent), '
'; - } - } - } - } - } - $parent=0; -} - -if ($action=="ImportFile") { - $placefiles = array(); - findFiles("modules/googlemap/extra"); - sort($placefiles); -?> -
- - - - - - - 0) { ?> - - - - - - - - - - - - - - - - - -
- -
-
-
-$value) { - $country_names[$key]=i18n::translate($key); - } - if (isset($_POST["cleardatabase"])) { - WT_DB::exec("DELETE FROM `##placelocation` WHERE 1=1"); - } - if (!empty($_FILES["placesfile"]["tmp_name"])) { - $lines = file($_FILES["placesfile"]["tmp_name"]); - } elseif (!empty($_REQUEST['localfile'])) { - $lines = file("modules/googlemap/extra".$_REQUEST['localfile']); - } - // Strip BYTE-ORDER-MARK, if present - if (!empty($lines[0]) && substr($lines[0], 0, 3)==WT_UTF8_BOM) $lines[0]=substr($lines[0], 3); - asort($lines); - $highestIndex = getHighestIndex(); - $placelist = array(); - $j = 0; - $maxLevel = 0; - foreach ($lines as $p => $placerec) { - $fieldrec = explode(';', $placerec); - if ($fieldrec[0] > $maxLevel) $maxLevel = $fieldrec[0]; - } - $fields = count($fieldrec); - foreach ($lines as $p => $placerec) { - $fieldrec = explode(';', $placerec); - if (is_numeric($fieldrec[0]) && $fieldrec[0]<=$maxLevel) { - $placelist[$j] = array(); - $placelist[$j]["place"] = ""; - for ($ii=$fields-4; $ii>1; $ii--) { - if ($fieldrec[0] > $ii-2) $placelist[$j]["place"] .= $fieldrec[$ii].","; - } - foreach ($country_names as $countrycode => $countryname) { - if ($countrycode == strtoupper($fieldrec[1])) { - $fieldrec[1] = $countryname; - break; - } - } - $placelist[$j]["place"] .= $fieldrec[1]; - $placelist[$j]["long"] = $fieldrec[$fields-4]; - $placelist[$j]["lati"] = $fieldrec[$fields-3]; - $placelist[$j]["zoom"] = $fieldrec[$fields-2]; - $placelist[$j]["icon"] = trim($fieldrec[$fields-1]); - $j = $j + 1; - } - } - - $prevPlace = ""; - $prevLati = ""; - $prevLong = ""; - $placelistUniq = array(); - $j = 0; - foreach ($placelist as $k=>$place) { - if ($place["place"] != $prevPlace) { - $placelistUniq[$j] = array(); - $placelistUniq[$j]["place"] = $place["place"]; - $placelistUniq[$j]["lati"] = $place["lati"]; - $placelistUniq[$j]["long"] = $place["long"]; - $placelistUniq[$j]["zoom"] = $place["zoom"]; - $placelistUniq[$j]["icon"] = $place["icon"]; - $j = $j + 1; - } else if (($place["place"] == $prevPlace) && (($place["lati"] != $prevLati) || ($place["long"] != $prevLong))) { - if (($placelistUniq[$j-1]["lati"] == 0) || ($placelistUniq[$j-1]["long"] == 0)) { - $placelistUniq[$j-1]["lati"] = $place["lati"]; - $placelistUniq[$j-1]["long"] = $place["long"]; - $placelistUniq[$j-1]["zoom"] = $place["zoom"]; - $placelistUniq[$j-1]["icon"] = $place["icon"]; - } else if (($place["lati"] != "0") || ($place["long"] != "0")) { - echo "Differenc: last value = $prevPlace, $prevLati, $prevLong, current = ", $place["place"], ", ", $place["lati"], ", ", $place["long"], "
"; - } - } - $prevPlace = $place["place"]; - $prevLati = $place["lati"]; - $prevLong = $place["long"]; - } - - $default_zoom_level = array(); - $default_zoom_level[0] = 4; - $default_zoom_level[1] = 7; - $default_zoom_level[2] = 10; - $default_zoom_level[3] = 12; - foreach ($placelistUniq as $k=>$place) { - $parent = explode(',', $place["place"]); - $parent = array_reverse($parent); - $parent_id=0; - for ($i=0; $iexecute(array($i, $parent_id, $escparent)) - ->fetchOneRow(); - if (empty($row)) { // this name does not yet exist: create entry - if (!isset($_POST["updateonly"])) { - $highestIndex = $highestIndex + 1; - if (($i+1) == count($parent)) { - $zoomlevel = $place["zoom"]; - } elseif (isset($default_zoom_level[$i])) { - $zoomlevel = $default_zoom_level[$i]; - } else { - $zoomlevel = $GOOGLEMAP_MAX_ZOOM; - } - if (($place["lati"] == "0") || ($place["long"] == "0") || (($i+1) < count($parent))) { - WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?)") - ->execute(array($highestIndex, $parent_id, $i, $escparent, $zoomlevel, $place["icon"])); - } else { - //delete leading zero - $pl_lati = str_replace(array('N', 'S', ','), array('', '-', '.') , $place["lati"]); - $pl_long = str_replace(array('E', 'W', ','), array('', '-', '.') , $place["long"]); - if ($pl_lati >= 0) { - $place["lati"] = "N".abs($pl_lati); - } elseif ($pl_lati < 0) { - $place["lati"] = "S".abs($pl_lati); - } - if ($pl_long >= 0) { - $place["long"] = "E".abs($pl_long); - } elseif ($pl_long < 0) { - $place["long"] = "W".abs($pl_long); - } - WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?, ?, ?)") - ->execute(array($highestIndex, $parent_id, $i, $escparent, $place["long"], $place["lati"], $zoomlevel, $place["icon"])); - } - $parent_id = $highestIndex; - } - } else { - $parent_id = $row->pl_id; - if ((isset($_POST["overwritedata"])) && ($i+1 == count($parent))) { - WT_DB::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=?, pl_zoom=?, pl_icon=? WHERE pl_id=?") - ->execute(array($place["lati"], $place["long"], $place["zoom"], $place["icon"], $parent_id)); - } else { - if ((($row->pl_long == "0") || ($row->pl_long == null)) && (($row->pl_lati == "0") || ($row->pl_lati == null))) { - WT_DB::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=? WHERE pl_id=?") - ->execute(array($place["lati"], $place["long"], $parent_id)); - } - if (empty($row->pl_icon) && !empty($place['icon'])) { - WT_DB::prepare("UPDATE `##placelocation` SET pl_icon=? WHERE pl_id=?") - ->execute(array($place["icon"], $parent_id)); - } - } - } - } - } - $parent=0; -} - -if ($action=="DeleteRecord") { - $exists= - WT_DB::prepare("SELECT 1 FROM `##placelocation` WHERE pl_parent_id=?") - ->execute(array($deleteRecord)) - ->fetchOne(); - - if (!$exists) { - WT_DB::prepare("DELETE FROM `##placelocation` WHERE pl_id=?") - ->execute(array($deleteRecord)); - } else { - echo "
".i18n::translate('Location not removed: this location contains sub-locations')."
"; - } -} - -?> - -".i18n::translate('Edit geographic place locations').": "; -$where_am_i=place_id_to_hierarchy($parent); -foreach (array_reverse($where_am_i, true) as $id=>$place) { - if ($id==$parent) { - if ($place != "Unknown") { - echo PrintReady($place); - } else { - echo i18n::translate('unknown'); - } - } else { - echo ""; - if ($place != "Unknown") { - echo PrintReady($place), ""; - } else { - echo i18n::translate('unknown'), ""; - } - } - echo " - "; -} -echo "".i18n::translate('Top Level').""; -echo "

"; -echo "\n
", i18n::translate('Click here to show inactive places'), ": \n"; -echo help_link('PLE_ACTIVE','googlemap'); -echo "
"; -echo "
"; - -$placelist=get_place_list_loc($parent, $display); - -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -if (count($placelist) == 0) - echo ""; -foreach ($placelist as $place) { - echo ""; - else - echo i18n::translate('unknown'), ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - $noRows= - WT_DB::prepare("SELECT COUNT(pl_id) FROM `##placelocation` WHERE pl_parent_id=?") - ->execute(array($place["place_id"])) - ->fetchOne(); - if ($noRows==0) { ?> - - - - - - -
", translate_fact('PLAC'), "", translate_fact('LATI'), "", translate_fact('LONG'), "".i18n::translate('Zoom factor')."".i18n::translate('Icon').""; -echo i18n::translate('Edit geographic location'), help_link('PL_EDIT_LOCATION','googlemap'), "
", i18n::translate('No places found'), "
"; - if ($place["place"] != "Unknown") - echo PrintReady($place["place"]), "{$place['lati']}{$place['long']}{$place['zoom']}"; - if (($place["icon"] == NULL) || ($place["icon"] == "")) { - if (($place['lati'] == NULL) || ($place['long'] == NULL) || (($place['lati'] == "0") && ($place['long'] == "0"))) { - echo " "; - echo ""; - } - else { - echo " "; - echo ""; - } - } else { - echo ""; - } - echo "", i18n::translate('Edit'), ""; ?><?php echo i18n::translate('Remove'); ?>
- - - - - - - - - - - - - -
-"; - echo i18n::translate('Export current view to file'), ""; - echo help_link('PL_EXPORT_FILE','googlemap'); - } else { - echo " "; - } - echo ""; - echo ""; - echo i18n::translate('Export all locations to file'), ""; - echo help_link('PL_EXPORT_ALL_FILE','googlemap'); - echo "

"; -if (empty($SEARCH_SPIDER)) - print_footer(); -else { - echo i18n::translate('Search Engine Spider Detected'), ": ", $SEARCH_SPIDER; - echo "\n\n\t\n"; -} diff --git a/modules/googlemap/places_edit.php b/modules/googlemap/places_edit.php index bc35dfa2b6..d41528565a 100644 --- a/modules/googlemap/places_edit.php +++ b/modules/googlemap/places_edit.php @@ -89,7 +89,7 @@ function getHighestIndex() { $where_am_i=place_id_to_hierarchy($placeid); $level=count($where_am_i); -$link = 'module.php?mod=googlemap&mod_action=places&parent='.$placeid; +$link = 'module.php?mod=googlemap&mod_action=admin_places&parent='.$placeid; if ($action=='addrecord' && WT_USER_IS_ADMIN) { $statement= diff --git a/modules/sitemap/admin_config.php b/modules/sitemap/admin_config.php deleted file mode 100644 index 734ab8b382..0000000000 --- a/modules/sitemap/admin_config.php +++ /dev/null @@ -1,49 +0,0 @@ - 01 September 2005 - * - * @package webtrees - * @subpackage Admin - * @version $Id$ - */ - -if (!defined('WT_WEBTREES')) { - header('HTTP/1.0 403 Forbidden'); - exit; -} - -if (WT_USER_IS_ADMIN) { ?> - - - - - - -   - - -\n"; + echo "\n"; + + if (isset($welcome)) { + echo " \n"; + echo " ", WT_SERVER_NAME, WT_SCRIPT_PATH, "index.php?ctype=gedcom&ged=", rawurlencode($gedcom_name), "\n"; + echo " ", $welcome_update, "\n"; + echo " 0.", $welcome_priority, "\n"; + echo " \n"; + } + $oldGEDCOM = $GEDCOM; + $GEDCOM = $gedcom_name; + // Create a temporary userid + $sitemap_user_id = createTempUser('#SiteMap#', 'visitor', $gedcom_name); // Create a temporary userid + // Temporarily become this user + $_SESSION["org_user"]=$_SESSION["wt_user"]; + $_SESSION["wt_user"]=$sitemap_user_id; + if (isset($indi_rec)) { + $statement=WT_DB::prepare("SELECT i_id, i_gedcom FROM `##individuals` WHERE i_file=?")->execute(array($index)); + while ($row=$statement->fetch(PDO::FETCH_NUM)) { + if ($no_private_links) { + if (canDisplayRecord($index, $row[1])) { + echo " \n"; + echo " ", WT_SERVER_NAME, WT_SCRIPT_PATH, "individual.php?pid=", $row[0], "&ged=", rawurlencode($gedcom_name), "\n"; + $arec = get_sub_record(1, "1 CHAN", $row[1], 1); + if (!empty($arec) && preg_match("/2 DATE (.*)/", $arec, $datematch)) + echo " ", date("Y-m-d", strtotime($datematch[1])), "\n"; + echo " ", $indirec_update, "\n"; + echo " 0.", $indirec_priority, "\n"; + echo " \n"; + } + } else { + echo " \n"; + echo " ", WT_SERVER_NAME, WT_SCRIPT_PATH, "individual.php?pid=", $row[0], "&ged=", rawurlencode($gedcom_name), "\n"; + $arec = get_sub_record(1, "1 CHAN", $row[1], 1); + if (!empty($arec) && preg_match("/2 DATE (.*)/", $arec, $datematch)) + echo " ", date("Y-m-d", strtotime($datematch[1])), "\n"; + echo " ", $indirec_update, "\n"; + echo " 0.", $indirec_priority, "\n"; + echo " \n"; + } + } + $statement->closeCursor(); + } + + if (isset($fam_rec)) { + $statement=WT_DB::prepare("SELECT f_id, f_gedcom FROM `##families` WHERE f_file=?")->execute(array($index)); + while ($row=$statement->fetch(PDO::FETCH_NUM)) { + if ($no_private_links) { + if (canDisplayRecord($index, $row[1])) { + echo " \n"; + echo " ", WT_SERVER_NAME, WT_SCRIPT_PATH, "family.php?famid=", $row[0], "&ged=", rawurlencode($gedcom_name), "\n"; + $arec = get_sub_record(1, "1 CHAN", $row[1], 1); + if (!empty($arec) && preg_match("/2 DATE (.*)/", $arec, $datematch)) + echo " ", date("Y-m-d", strtotime($datematch[1])), "\n"; + echo " ", $indirec_update, "\n"; + echo " 0.", $indirec_priority, "\n"; + echo " \n"; + } + } else { + echo " \n"; + echo " ", WT_SERVER_NAME, WT_SCRIPT_PATH, "family.php?famid=", $row[0], "&ged=", rawurlencode($gedcom_name), "\n"; + $arec = get_sub_record(1, "1 CHAN", $row[1], 1); + if (!empty($arec) && preg_match("/2 DATE (.*)/", $arec, $datematch)) + echo " ", date("Y-m-d", strtotime($datematch[1])), "\n"; + echo " ", $indirec_update, "\n"; + echo " 0.", $indirec_priority, "\n"; + echo " \n"; + } + } + $statement->closeCursor(); + } + + if (isset($fam_lists)) { + foreach (get_indilist_salpha($SHOW_MARRIED_NAMES, true, $index) as $letter=>$count) { + if ($letter!='@') { + echo " \n"; + echo " ", WT_SERVER_NAME, WT_SCRIPT_PATH, "famlist.php?alpha=", urlencode($letter), "&ged=", rawurlencode($gedcom_name), "\n"; + echo " ", $famlist_update, "\n"; + echo " 0.", $famlist_priority, "\n"; + echo " \n"; + } + } + } + + if (isset($indi_lists)) { + foreach (get_indilist_salpha($SHOW_MARRIED_NAMES, false, $index) as $letter=>$count) { + if ($letter!='@') { + echo " \n"; + echo " ", WT_SERVER_NAME, WT_SCRIPT_PATH, "indilist.php?alpha=", urlencode($letter), "&ged=", rawurlencode($gedcom_name), "\n"; + echo " ", $indilist_update, "\n"; + echo " 0.", $indilist_priority, "\n"; + echo " \n"; + } + } + } + echo ""; + $_SESSION["wt_user"]=$_SESSION["org_user"]; + delete_user($sitemap_user_id); + AddToLog("deleted dummy user -> #SiteMap# <-", 'auth'); + $GEDCOM = $oldGEDCOM; + exit; +} + +if ($action=="sendIndex") { + header('Content-Type: application/octet-stream'); + header('Content-Disposition: attachment; filename="SitemapIndex.xml"'); + + echo "\n"; + echo "\n"; + + + if (isset($filenames)) { + foreach ($filenames as $ged_index=>$ged_name) { + $xml_name = str_ireplace(".ged",".xml", $ged_name); + echo " \n"; + echo " ", WT_SERVER_NAME, WT_SCRIPT_PATH, "SM_", $xml_name, "\n"; + echo " ", date("Y-m-d"), "\n "; + echo " \n"; + } + } + echo "\n"; + exit; +} + +print_header(i18n::translate('Generate Sitemap files')); + +if ($action=="generate") { + echo "

"; + echo i18n::translate('Generate Sitemap files'); + echo help_link('SITEMAP','sitemap'); + echo "

\n"; + echo "\n"; + echo "\n"; + if (isset($_POST["welcome_page"])) echo "\n"; + if (isset($_POST["indi_recs"])) echo "\n"; + if (isset($_POST["indi_list"])) echo "\n"; + if (isset($_POST["fam_recs"])) echo "\n"; + if (isset($_POST["fam_list"])) echo "\n"; + if (isset($_POST["GEDCOM_Privacy"])) echo "\n"; + + echo "\n"; + foreach (get_all_gedcoms() as $ged_id=>$gedcom) { + if (isset($_POST["GEDCOM_{$ged_id}"])) echo "\n"; + } + + echo "\n"; + $filecounter = 0; + foreach (get_all_gedcoms() as $ged_id=>$gedcom) { + if (isset($_POST["GEDCOM_{$ged_id}"])) { + $filecounter += 1; + $sitemapFilename = "SM_".str_ireplace(".ged",".xml",$gedcom); + echo "\n"; + } + } + if ($filecounter > 1) { + echo "\n"; + } + echo "\n"; + echo "
", i18n::translate('Selected items to store in Sitemap:'), "
", i18n::translate('Home page'), "
", i18n::translate('Individual information'), "
", i18n::translate('Individual List'), "
", i18n::translate('Family information'), "
", i18n::translate('Family List'), "
", i18n::translate('No links to private information'), "
", i18n::translate('GEDCOMs to store in Sitemap:'), "
", get_gedcom_setting($ged_id, 'title'), "
", i18n::translate('The following Sitemap files have been generated and can be downloaded:'), "
", $sitemapFilename, "
$gedcom) { + if (isset($_POST["GEDCOM_{$ged_id}"])) { + echo "&filenames[", $ged_id, "]=", $gedcom; + } + } + echo "\">SitemapIndex.xml
", i18n::translate('Place all the files in the root of your webtrees installation.'), "
\n"; + echo "
\n"; +} + +if ($action=="") { +?> + +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+$gedcom) { + echo " ", get_gedcom_setting($ged_id, 'title'), "
\n"; + } +?> +
+ + +
+ +
+ + + + + +
+ + + +
+ + + +
+ + + +
+ + + +
+


+
+ +\n"; - echo "\n"; - - if (isset($welcome)) { - echo " \n"; - echo " ", WT_SERVER_NAME, WT_SCRIPT_PATH, "index.php?command=gedcom&ged=", rawurlencode($gedcom_name), "\n"; - echo " ", $welcome_update, "\n"; - echo " 0.", $welcome_priority, "\n"; - echo " \n"; - } - $oldGEDCOM = $GEDCOM; - $GEDCOM = $gedcom_name; - // Create a temporary userid - $sitemap_user_id = createTempUser('#SiteMap#', 'visitor', $gedcom_name); // Create a temporary userid - // Temporarily become this user - $_SESSION["org_user"]=$_SESSION["wt_user"]; - $_SESSION["wt_user"]=$sitemap_user_id; - if (isset($indi_rec)) { - $statement=WT_DB::prepare("SELECT i_id, i_gedcom FROM `##individuals` WHERE i_file=?")->execute(array($index)); - while ($row=$statement->fetch(PDO::FETCH_NUM)) { - if ($no_private_links) { - if (canDisplayRecord($index, $row[1])) { - echo " \n"; - echo " ", WT_SERVER_NAME, WT_SCRIPT_PATH, "individual.php?pid=", $row[0], "&ged=", rawurlencode($gedcom_name), "\n"; - $arec = get_sub_record(1, "1 CHAN", $row[1], 1); - if (!empty($arec) && preg_match("/2 DATE (.*)/", $arec, $datematch)) - echo " ", date("Y-m-d", strtotime($datematch[1])), "\n"; - echo " ", $indirec_update, "\n"; - echo " 0.", $indirec_priority, "\n"; - echo " \n"; - } - } else { - echo " \n"; - echo " ", WT_SERVER_NAME, WT_SCRIPT_PATH, "individual.php?pid=", $row[0], "&ged=", rawurlencode($gedcom_name), "\n"; - $arec = get_sub_record(1, "1 CHAN", $row[1], 1); - if (!empty($arec) && preg_match("/2 DATE (.*)/", $arec, $datematch)) - echo " ", date("Y-m-d", strtotime($datematch[1])), "\n"; - echo " ", $indirec_update, "\n"; - echo " 0.", $indirec_priority, "\n"; - echo " \n"; - } - } - $statement->closeCursor(); - } - - if (isset($fam_rec)) { - $statement=WT_DB::prepare("SELECT f_id, f_gedcom FROM `##families` WHERE f_file=?")->execute(array($index)); - while ($row=$statement->fetch(PDO::FETCH_NUM)) { - if ($no_private_links) { - if (canDisplayRecord($index, $row[1])) { - echo " \n"; - echo " ", WT_SERVER_NAME, WT_SCRIPT_PATH, "family.php?famid=", $row[0], "&ged=", rawurlencode($gedcom_name), "\n"; - $arec = get_sub_record(1, "1 CHAN", $row[1], 1); - if (!empty($arec) && preg_match("/2 DATE (.*)/", $arec, $datematch)) - echo " ", date("Y-m-d", strtotime($datematch[1])), "\n"; - echo " ", $indirec_update, "\n"; - echo " 0.", $indirec_priority, "\n"; - echo " \n"; - } - } else { - echo " \n"; - echo " ", WT_SERVER_NAME, WT_SCRIPT_PATH, "family.php?famid=", $row[0], "&ged=", rawurlencode($gedcom_name), "\n"; - $arec = get_sub_record(1, "1 CHAN", $row[1], 1); - if (!empty($arec) && preg_match("/2 DATE (.*)/", $arec, $datematch)) - echo " ", date("Y-m-d", strtotime($datematch[1])), "\n"; - echo " ", $indirec_update, "\n"; - echo " 0.", $indirec_priority, "\n"; - echo " \n"; - } - } - $statement->closeCursor(); - } - - if (isset($fam_lists)) { - foreach (get_indilist_salpha($SHOW_MARRIED_NAMES, true, $index) as $letter=>$count) { - if ($letter!='@') { - echo " \n"; - echo " ", WT_SERVER_NAME, WT_SCRIPT_PATH, "famlist.php?alpha=", urlencode($letter), "&ged=", rawurlencode($gedcom_name), "\n"; - echo " ", $famlist_update, "\n"; - echo " 0.", $famlist_priority, "\n"; - echo " \n"; - } - } - } - - if (isset($indi_lists)) { - foreach (get_indilist_salpha($SHOW_MARRIED_NAMES, false, $index) as $letter=>$count) { - if ($letter!='@') { - echo " \n"; - echo " ", WT_SERVER_NAME, WT_SCRIPT_PATH, "indilist.php?alpha=", urlencode($letter), "&ged=", rawurlencode($gedcom_name), "\n"; - echo " ", $indilist_update, "\n"; - echo " 0.", $indilist_priority, "\n"; - echo " \n"; - } - } - } - echo ""; - $_SESSION["wt_user"]=$_SESSION["org_user"]; - delete_user($sitemap_user_id); - AddToLog("deleted dummy user -> #SiteMap# <-", 'auth'); - $GEDCOM = $oldGEDCOM; - exit; -} - -if ($action=="sendIndex") { - header('Content-Type: application/octet-stream'); - header('Content-Disposition: attachment; filename="SitemapIndex.xml"'); - - echo "\n"; - echo "\n"; - - - if (isset($filenames)) { - foreach ($filenames as $ged_index=>$ged_name) { - $xml_name = str_ireplace(".ged",".xml", $ged_name); - echo " \n"; - echo " ", WT_SERVER_NAME, WT_SCRIPT_PATH, "SM_", $xml_name, "\n"; - echo " ", date("Y-m-d"), "\n "; - echo " \n"; - } - } - echo "\n"; - exit; -} - -print_header(i18n::translate('Generate Sitemap files')); - -if ($action=="generate") { - echo "

"; - echo i18n::translate('Generate Sitemap files'); - echo help_link('SITEMAP','sitemap'); - echo "

\n"; - echo "\n"; - echo "\n"; - if (isset($_POST["welcome_page"])) echo "\n"; - if (isset($_POST["indi_recs"])) echo "\n"; - if (isset($_POST["indi_list"])) echo "\n"; - if (isset($_POST["fam_recs"])) echo "\n"; - if (isset($_POST["fam_list"])) echo "\n"; - if (isset($_POST["GEDCOM_Privacy"])) echo "\n"; - - echo "\n"; - foreach (get_all_gedcoms() as $ged_id=>$gedcom) { - if (isset($_POST["GEDCOM_{$ged_id}"])) echo "\n"; - } - - echo "\n"; - $filecounter = 0; - foreach (get_all_gedcoms() as $ged_id=>$gedcom) { - if (isset($_POST["GEDCOM_{$ged_id}"])) { - $filecounter += 1; - $sitemapFilename = "SM_".str_ireplace(".ged",".xml",$gedcom); - echo "\n"; - } - } - if ($filecounter > 1) { - echo "\n"; - } - echo "\n"; - echo "
", i18n::translate('Selected items to store in Sitemap:'), "
", i18n::translate('Home page'), "
", i18n::translate('Individual information'), "
", i18n::translate('Individual List'), "
", i18n::translate('Family information'), "
", i18n::translate('Family List'), "
", i18n::translate('No links to private information'), "
", i18n::translate('GEDCOMs to store in Sitemap:'), "
", get_gedcom_setting($ged_id, 'title'), "
", i18n::translate('The following Sitemap files have been generated and can be downloaded:'), "
", $sitemapFilename, "
$gedcom) { - if (isset($_POST["GEDCOM_{$ged_id}"])) { - echo "&filenames[", $ged_id, "]=", $gedcom; - } - } - echo "\">SitemapIndex.xml
", i18n::translate('Place all the files in the root of your webtrees installation.'), "
\n"; - echo "
\n"; -} - -if ($action=="") { -?> - -

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-$gedcom) { - echo " ", get_gedcom_setting($ged_id, 'title'), "
\n"; - } -?> -
- - -
- -
- - - - - -
- - - -
- - - -
- - - -
- - - -
-


-
- -getName().'/'.$mod_action.'.php'; break; @@ -57,6 +57,6 @@ class sitemap_WT_Module extends WT_Module implements WT_Module_Config{ // Implement WT_Module_Config public function getConfigLink() { - return 'module.php?mod='.$this->getName().'&mod_action=index'; + return 'module.php?mod='.$this->getName().'&mod_action=admin_index'; } } diff --git a/modules/stories/module.php b/modules/stories/module.php index 68c3fae49c..b782189ebf 100644 --- a/modules/stories/module.php +++ b/modules/stories/module.php @@ -46,17 +46,17 @@ class stories_WT_Module extends WT_Module implements WT_Module_Block, WT_Module_ // Extend WT_Module public function modAction($mod_action) { switch($mod_action) { - case 'edit': + case 'admin_edit': $this->edit(); break; - case 'delete': + case 'admin_delete': $this->delete(); $this->config(); break; - case 'config': + case 'admin_config': $this->config(); break; - case 'show_list': + case 'admin_show_list': $this->show_list(); break; default: @@ -66,7 +66,7 @@ class stories_WT_Module extends WT_Module implements WT_Module_Block, WT_Module_ // Implement WT_Module_Config public function getConfigLink() { - return 'module.php?mod='.$this->getName().'&mod_action=config'; + return 'module.php?mod='.$this->getName().'&mod_action=admin_config'; } // Implement class WT_Module_Block @@ -120,14 +120,14 @@ class stories_WT_Module extends WT_Module implements WT_Module_Block, WT_Module_ $html.='
'.get_block_setting($block_id, 'title').'
'; $html.='
'.get_block_setting($block_id, 'story_body').'

'; if (WT_USER_CAN_EDIT) { - $html.='
'; + $html.='
'; } } } if (WT_USER_GEDCOM_ADMIN && !$html) { $html.='
'.$this->getTitle().'
'; - $html.='
'; + $html.='
'; $html.=i18n::translate('Add story').''.help_link('add_story', $this->getName()).'

'; } return $html; @@ -315,7 +315,7 @@ class stories_WT_Module extends WT_Module implements WT_Module_Block, WT_Module_ echo ''; echo ''; if (count($stories)>0) { @@ -334,8 +334,8 @@ class stories_WT_Module extends WT_Module implements WT_Module_Block, WT_Module_ echo ''; - echo ''; - echo ''; + echo ''; } echo '
'; - echo '', i18n::translate('Add story'), ''; + echo '', i18n::translate('Add story'), ''; echo help_link('add_story', $this->getName()); echo '
'; echo get_block_setting($story->block_id, 'title'); echo '', $name, '', i18n::translate('Edit'), '', i18n::translate('Delete'), ''; + echo '', i18n::translate('Edit'), '', i18n::translate('Delete'), ''; echo '
'; @@ -345,7 +345,7 @@ class stories_WT_Module extends WT_Module implements WT_Module_Block, WT_Module_ exit; } } - // Following function allows Story list to be added manually as a menu item in header.php if required, using link such as "module.php?mod=stories&mod_action=show_list" + // Following function allows Story list to be added manually as a menu item in header.php if required, using link such as "module.php?mod=stories&mod_action=admin_show_list" // No privacy restrictions included here though - so use with care! private function show_list() { global $WT_IMAGES, $TEXT_DIRECTION; -- cgit v1.3