summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfisharebest <fisharebest@gmail.com>2010-10-23 14:10:34 +0000
committerfisharebest <fisharebest@gmail.com>2010-10-23 14:10:34 +0000
commit2c1eea7cb82050382cf0c1e4d13936996d1d0a67 (patch)
tree9f43fe3c10516dcee77c4c1a0643a10e6ec471fd
parent31f9a1e414cd1d716a0e17d3260f6eea9085f579 (diff)
downloadwebtrees-2c1eea7cb82050382cf0c1e4d13936996d1d0a67.tar.gz
webtrees-2c1eea7cb82050382cf0c1e4d13936996d1d0a67.tar.bz2
webtrees-2c1eea7cb82050382cf0c1e4d13936996d1d0a67.zip
Relationship privacy - combine the separate gedcom-settings and user-settings into a user-gedcom-setting. This provides more flexibility and is much easier to understand.
-rw-r--r--edit_merge.php6
-rw-r--r--editconfig_gedcom.php33
-rw-r--r--help_text.php25
-rw-r--r--includes/db_schema/db_schema_3_4.php73
-rw-r--r--includes/functions/functions.php49
-rw-r--r--includes/functions/functions_export.php2
-rw-r--r--includes/functions/functions_privacy.php19
-rw-r--r--includes/session.php1
-rw-r--r--includes/set_gedcom_defaults.php4
-rw-r--r--login_register.php5
-rw-r--r--pgv_to_wt.php28
-rw-r--r--useradmin.php109
12 files changed, 211 insertions, 143 deletions
diff --git a/edit_merge.php b/edit_merge.php
index ab4b9c80c8..9c74813cf7 100644
--- a/edit_merge.php
+++ b/edit_merge.php
@@ -188,6 +188,12 @@ if ($action!="choose") {
);
replace_gedrec($id, WT_GED_ID, $newrec);
}
+ // Update any linked user-accounts
+ WT_DB::prepare(
+ "UPDATE `##user_gedcom_setting`".
+ " SET setting_value=?".
+ " WHERE gedcom_id=? AND setting_name='gedcomid' AND setting_value=?"
+ )->execute(array($gid2, WT_GED_ID, $gid1));
// Merge hit counters
$hits=WT_DB::prepare(
diff --git a/editconfig_gedcom.php b/editconfig_gedcom.php
index 46d3659bc9..1059ecb390 100644
--- a/editconfig_gedcom.php
+++ b/editconfig_gedcom.php
@@ -122,7 +122,6 @@ case 'update':
set_gedcom_setting(WT_GED_ID, 'AUTO_GENERATE_THUMBS', safe_POST_bool('NEW_AUTO_GENERATE_THUMBS'));
set_gedcom_setting(WT_GED_ID, 'CALENDAR_FORMAT', safe_POST('NEW_CALENDAR_FORMAT'));
set_gedcom_setting(WT_GED_ID, 'CHART_BOX_TAGS', safe_POST('NEW_CHART_BOX_TAGS'));
- set_gedcom_setting(WT_GED_ID, 'CHECK_MARRIAGE_RELATIONS', safe_POST_bool('CHECK_MARRIAGE_RELATIONS'));
set_gedcom_setting(WT_GED_ID, 'COMMON_NAMES_ADD', str_replace(' ', '', safe_POST('NEW_COMMON_NAMES_ADD')));
set_gedcom_setting(WT_GED_ID, 'COMMON_NAMES_REMOVE', str_replace(' ', '', safe_POST('NEW_COMMON_NAMES_REMOVE')));
set_gedcom_setting(WT_GED_ID, 'COMMON_NAMES_THRESHOLD', safe_POST('NEW_COMMON_NAMES_THRESHOLD', WT_REGEX_INTEGER, 40));
@@ -154,7 +153,6 @@ case 'update':
set_gedcom_setting(WT_GED_ID, 'MAX_ALIVE_AGE', safe_POST('MAX_ALIVE_AGE', WT_REGEX_INTEGER, 100));
set_gedcom_setting(WT_GED_ID, 'MAX_DESCENDANCY_GENERATIONS', safe_POST('NEW_MAX_DESCENDANCY_GENERATIONS'));
set_gedcom_setting(WT_GED_ID, 'MAX_PEDIGREE_GENERATIONS', safe_POST('NEW_MAX_PEDIGREE_GENERATIONS'));
- set_gedcom_setting(WT_GED_ID, 'MAX_RELATION_PATH_LENGTH', safe_POST('MAX_RELATION_PATH_LENGTH'));
set_gedcom_setting(WT_GED_ID, 'MEDIA_DIRECTORY', safe_POST('NEW_MEDIA_DIRECTORY'));
set_gedcom_setting(WT_GED_ID, 'MEDIA_DIRECTORY_LEVELS', safe_POST('NEW_MEDIA_DIRECTORY_LEVELS'));
set_gedcom_setting(WT_GED_ID, 'MEDIA_EXTERNAL', safe_POST_bool('NEW_MEDIA_EXTERNAL'));
@@ -223,7 +221,6 @@ case 'update':
set_gedcom_setting(WT_GED_ID, 'USE_GEONAMES', safe_POST_bool('NEW_USE_GEONAMES'));
set_gedcom_setting(WT_GED_ID, 'USE_MEDIA_FIREWALL', safe_POST_bool('NEW_USE_MEDIA_FIREWALL'));
set_gedcom_setting(WT_GED_ID, 'USE_MEDIA_VIEWER', safe_POST_bool('NEW_USE_MEDIA_VIEWER'));
- set_gedcom_setting(WT_GED_ID, 'USE_RELATIONSHIP_PRIVACY', safe_POST('USE_RELATIONSHIP_PRIVACY'));
set_gedcom_setting(WT_GED_ID, 'USE_RIN', safe_POST_bool('NEW_USE_RIN'));
set_gedcom_setting(WT_GED_ID, 'USE_SILHOUETTE', safe_POST_bool('NEW_USE_SILHOUETTE'));
set_gedcom_setting(WT_GED_ID, 'USE_THUMBS_MAIN', safe_POST_bool('NEW_USE_THUMBS_MAIN'));
@@ -697,36 +694,6 @@ print_header(i18n::translate('GEDCOM configuration'));
</tr>
<tr>
<td class="descriptionbox nowrap">
- <?php echo i18n::translate('Use relationship privacy'), help_link('USE_RELATIONSHIP_PRIVACY'); ?>
- </td>
- <td class="optionbox width60">
- <?php echo edit_field_yes_no('USE_RELATIONSHIP_PRIVACY', get_gedcom_setting(WT_GED_ID, 'USE_RELATIONSHIP_PRIVACY')); ?>
- </td>
- </tr>
- <tr>
- <td class="descriptionbox nowrap"><?php echo i18n::translate('Max. relation path length'), help_link('MAX_RELATION_PATH_LENGTH'); ?></td>
- <td class="optionbox">
- <select size="1" name="MAX_RELATION_PATH_LENGTH"><?php
- for ($y = 1; $y <= 10; $y++) {
- print "<option";
- if (get_gedcom_setting(WT_GED_ID, 'MAX_RELATION_PATH_LENGTH') == $y) print " selected=\"selected\"";
- print ">";
- print $y;
- print "</option>";
- }
- ?></select>
- </td>
- </tr>
- <tr>
- <td class="descriptionbox nowrap">
- <?php echo i18n::translate('Check relationships by marriage'), help_link('CHECK_MARRIAGE_RELATIONS'); ?>
- </td>
- <td class="optionbox width60">
- <?php echo edit_field_yes_no('CHECK_MARRIAGE_RELATIONS', get_gedcom_setting(WT_GED_ID, 'CHECK_MARRIAGE_RELATIONS')); ?>
- </td>
- </tr>
- <tr>
- <td class="descriptionbox nowrap">
<?php echo i18n::translate('Age at which to assume a person is dead'), help_link('MAX_ALIVE_AGE'); ?>
</td>
<td class="optionbox">
diff --git a/help_text.php b/help_text.php
index 258450842d..2c7bd5e30b 100644
--- a/help_text.php
+++ b/help_text.php
@@ -2316,11 +2316,6 @@ case 'MAX_PEDIGREE_GENERATIONS':
$text=i18n::translate('Set the maximum number of generations to display on Pedigree charts.');
break;
-case 'MAX_RELATION_PATH_LENGTH':
- $title=i18n::translate('Maximum relationship path length');
- $text=i18n::translate('If the <i>Use relationship privacy</i> option is enabled, logged-in users will only be able to see or edit individuals within this number of relationship steps.<br /><br />This option sets the default for all users who have access to this genealogical database. The Administrator can override this option for individual users by editing the user\'s account details.');
- break;
-
case 'MEDIA_DIRECTORY_LEVELS':
$title=i18n::translate('Multimedia directory levels to keep');
$text=i18n::translate('A value of 0 will ignore all directories in the file path for the media object. A value of 1 will retain the first directory containing this image. Increasing the numbers increases number of parent directories to retain in the path.<br /><br />For example, if you link an image in your GEDCOM with a path like <b>C:\Documents&nbsp;and&nbsp;Settings\User\My&nbsp;Documents\My&nbsp;Pictures\Genealogy\Surname&nbsp;Line\grandpa.jpg</b>, a value of 0 will translate this path to <b>./media/grandpa.jpg</b>. A value of 1 will translate this to <b>./media/Surname&nbsp;Line/grandpa.jpg</b>, etc. Most people will only need to use a 0. However, it is possible that some media objects kept in different directories have identical names and would overwrite each other when this option is set to 0. Non-zero settings allow you to keep some organization in your media thereby preventing name collisions.');
@@ -2418,6 +2413,16 @@ case 'PEDIGREE_SHOW_GENDER':
$text=i18n::translate('This option controls whether or not to show the individual\'s gender icon on charts.<br /><br />Since the gender is also indicated by the color of the box, this option doesn\'t conceal the gender. The option simply removes some duplicate information from the box.');
break;
+case 'RELATIONSHIP_PATH_LENGTH':
+ $title=i18n::translate('Maximum relationship path length');
+ $text=
+ i18n::translate('Where a user is associated to an individual in the database, you can prevent them from accessing the details of distant relations. You specify the number of relationship steps that the user is allowed to see. This option only affects access to living people, access to dead people is covered by the global privacy settings.').
+ '<br/><br/>'.
+ i18n::translate('For example, if you specify a path length of 2, the person will be able to see their grandson (child, child), their aunt (parent, sibling), their step-daughter (spouse, child), but not their first cousin (parent, sibling, child).').
+ '<br/><br/>'.
+ i18n::translate('Note: longer path lengths require a lot of calculation, which can make your site run slowly for these users.');
+ break;
+
case 'SESSION_TIME':
$title=i18n::translate('Session timeout');
$text=i18n::translate('The time in seconds that a <b>webtrees</b> session remains active before requiring a login. The default is 7200, which is 2 hours.');
@@ -4100,16 +4105,6 @@ case 'useradmin_gedcomid':
$text=i18n::translate('The GEDCOM INDI record ID identifies the user. It has to be set by the administrator.<br /><br />This ID is used as the ID on several pages such as <b>My Individual Record</b> and <b>My Pedigree</b>.<br /><br />You can set the user\'s GEDCOM ID separately for each GEDCOM. If a user does not have a record in a GEDCOM, you leave that box empty.');
break;
-case 'useradmin_path_length':
- $title=i18n::translate('Maximum relationship privacy path length');
- $text=i18n::translate('If <i>Limit access to related people</i> is enabled, this user will only be able to see or edit living individuals within this number of relationship steps.');
- break;
-
-case 'useradmin_relation_priv':
- $title=i18n::translate('Limit access to related people');
- $text=i18n::translate('If this box is checked, the user will only be allowed access to living people that they are related to. They will be able to see anyone who is within the relationship path length set by their <i>Max relationship privacy path length</i> setting. You can require relationship privacy for all of your users by turning on the global option in the GEDCOM privacy settings.<br /><br />This setting requires that the user be associated with a GEDCOM ID before they will be able to see any living people.');
- break;
-
case 'useradmin_rootid':
$title=i18n::translate('Pedigree chart root person');
$text=i18n::translate('For each genealogical database, you can designate a <b>Root Person</b> for the user.<br /><br />This Root Person does not need to be the user himself; it can be anybody. The user will probably want to start the Pedigree chart with himself. You control that, as well as the default Root person on other charts, here.<br /><br />If the user has Edit rights to his own account information, he can change this setting himself.');
diff --git a/includes/db_schema/db_schema_3_4.php b/includes/db_schema/db_schema_3_4.php
new file mode 100644
index 0000000000..3dd5ee74e2
--- /dev/null
+++ b/includes/db_schema/db_schema_3_4.php
@@ -0,0 +1,73 @@
+<?php
+/**
+ * Update the database schema from version 3 to version 4
+ * - update the max_relation_path_length from a separate
+ * user setting and gedcom setting to a combined user-gedcom
+ * setting.
+ *
+ * Also clean out some old/unused values.
+ *
+ * The script should assume that it can be interrupted at
+ * any point, and be able to continue by re-running the script.
+ * Fatal errors, however, should be allowed to throw exceptions,
+ * which will be caught by the framework.
+ * It shouldn't do anything that might take more than a few
+ * seconds, for systems with low timeout values.
+ *
+ * phpGedView: Genealogy Viewer
+ * Copyright (C) 20010 Greg Roach
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * @version $Id$
+ */
+
+if (!defined('WT_WEBTREES')) {
+ header('HTTP/1.0 403 Forbidden');
+ exit;
+}
+
+define('WT_DB_SCHEMA_3_4', '');
+
+self::exec(
+ "INSERT IGNORE INTO wt_user_gedcom_setting (user_id, gedcom_id, setting_name, setting_value)".
+ " SELECT u.user_id, g.gedcom_id, 'RELATIONSHIP_PATH_LENGTH', LEAST(us1.setting_value, gs1.setting_value)".
+ " FROM wt_user u".
+ " CROSS JOIN wt_gedcom g".
+ " LEFT JOIN wt_user_setting us1 ON (u.user_id =us1.user_id AND us1.setting_name='max_relation_path')".
+ " LEFT JOIN wt_user_setting us2 ON (u.user_id =us2.user_id AND us2.setting_name='relationship_privacy')".
+ " LEFT JOIN wt_gedcom_setting gs1 ON (g.gedcom_id=gs1.gedcom_id AND gs1.setting_name='MAX_RELATION_PATH_LENGTH')".
+ " LEFT JOIN wt_gedcom_setting gs2 ON (g.gedcom_id=gs2.gedcom_id AND gs2.setting_name='USE_RELATIONSHIP_PRIVACY')".
+ " WHERE us2.setting_value AND gs2.setting_value"
+);
+
+// Delete old/unused settings
+self::exec(
+ "DELETE FROM `##site_setting` WHERE setting_name IN ('SESSION_SAVE_PATH')"
+);
+self::exec(
+ "DELETE FROM `##gedcom_setting` WHERE setting_name IN ('HOME_SITE_TEXT', 'HOME_SITE_URL', 'CHECK_MARRIAGE_RELATIONS', 'MAX_RELATION_PATH_LENGTH', 'USE_RELATIONSHIP_PRIVACY')"
+);
+self::exec(
+ "DELETE FROM `##user_setting` WHERE setting_name IN ('loggedin', 'relationship_privacy', 'max_relation_path_length')"
+);
+
+// Fix Mc/Mac problems - See SVN9701
+self::exec(
+ "UPDATE `##name` SET n_surn=CONCAT('MC', SUBSTRING(n_surn, 4)) WHERE n_surn LIKE 'MC0%'"
+);
+
+// Update the version to indicate success
+set_site_setting($schema_name, $next_version);
diff --git a/includes/functions/functions.php b/includes/functions/functions.php
index 0c82fa38fb..0a85f59150 100644
--- a/includes/functions/functions.php
+++ b/includes/functions/functions.php
@@ -192,7 +192,6 @@ function load_gedcom_settings($ged_id=WT_GED_ID) {
global $ALLOW_THEME_DROPDOWN; $ALLOW_THEME_DROPDOWN =get_gedcom_setting($ged_id, 'ALLOW_THEME_DROPDOWN');
global $CALENDAR_FORMAT; $CALENDAR_FORMAT =get_gedcom_setting($ged_id, 'CALENDAR_FORMAT');
global $CHART_BOX_TAGS; $CHART_BOX_TAGS =get_gedcom_setting($ged_id, 'CHART_BOX_TAGS');
- global $CHECK_MARRIAGE_RELATIONS; $CHECK_MARRIAGE_RELATIONS =get_gedcom_setting($ged_id, 'CHECK_MARRIAGE_RELATIONS');
global $CONTACT_USER_ID; $CONTACT_USER_ID =get_gedcom_setting($ged_id, 'CONTACT_USER_ID');
global $DEFAULT_PEDIGREE_GENERATIONS; $DEFAULT_PEDIGREE_GENERATIONS =get_gedcom_setting($ged_id, 'DEFAULT_PEDIGREE_GENERATIONS');
global $DISPLAY_JEWISH_GERESHAYIM; $DISPLAY_JEWISH_GERESHAYIM =get_gedcom_setting($ged_id, 'DISPLAY_JEWISH_GERESHAYIM');
@@ -214,7 +213,6 @@ function load_gedcom_settings($ged_id=WT_GED_ID) {
global $MAX_ALIVE_AGE; $MAX_ALIVE_AGE =get_gedcom_setting($ged_id, 'MAX_ALIVE_AGE');
global $MAX_DESCENDANCY_GENERATIONS; $MAX_DESCENDANCY_GENERATIONS =get_gedcom_setting($ged_id, 'MAX_DESCENDANCY_GENERATIONS');
global $MAX_PEDIGREE_GENERATIONS; $MAX_PEDIGREE_GENERATIONS =get_gedcom_setting($ged_id, 'MAX_PEDIGREE_GENERATIONS');
- global $MAX_RELATION_PATH_LENGTH; $MAX_RELATION_PATH_LENGTH =get_gedcom_setting($ged_id, 'MAX_RELATION_PATH_LENGTH');
global $MEDIA_DIRECTORY; $MEDIA_DIRECTORY =get_gedcom_setting($ged_id, 'MEDIA_DIRECTORY');
global $MEDIA_DIRECTORY_LEVELS; $MEDIA_DIRECTORY_LEVELS =get_gedcom_setting($ged_id, 'MEDIA_DIRECTORY_LEVELS');
global $MEDIA_EXTERNAL; $MEDIA_EXTERNAL =get_gedcom_setting($ged_id, 'MEDIA_EXTERNAL');
@@ -270,7 +268,6 @@ function load_gedcom_settings($ged_id=WT_GED_ID) {
global $USE_GEONAMES; $USE_GEONAMES =get_gedcom_setting($ged_id, 'USE_GEONAMES');
global $USE_MEDIA_FIREWALL; $USE_MEDIA_FIREWALL =get_gedcom_setting($ged_id, 'USE_MEDIA_FIREWALL');
global $USE_MEDIA_VIEWER; $USE_MEDIA_VIEWER =get_gedcom_setting($ged_id, 'USE_MEDIA_VIEWER');
- global $USE_RELATIONSHIP_PRIVACY; $USE_RELATIONSHIP_PRIVACY =get_gedcom_setting($ged_id, 'USE_RELATIONSHIP_PRIVACY');
global $USE_RIN; $USE_RIN =get_gedcom_setting($ged_id, 'USE_RIN');
global $USE_SILHOUETTE; $USE_SILHOUETTE =get_gedcom_setting($ged_id, 'USE_SILHOUETTE');
global $USE_THUMBS_MAIN; $USE_THUMBS_MAIN =get_gedcom_setting($ged_id, 'USE_THUMBS_MAIN');
@@ -1315,7 +1312,7 @@ function sort_facts(&$arr) {
$nondated = array();
//-- split the array into dated and non-dated arrays
$order = 0;
- foreach($arr as $event) {
+ foreach ($arr as $event) {
$event->sortOrder = $order;
$order++;
if ($event->getValue("DATE")==NULL || !$event->getDate()->isOk()) $nondated[] = $event;
@@ -1333,7 +1330,7 @@ function sort_facts(&$arr) {
$j = 0;
$k = 0;
// while there is anything in the dated array continue merging
- while($i<$dc) {
+ while ($i<$dc) {
// compare each fact by type to merge them in order
if ($j<$nc && Event::CompareType($dated[$i], $nondated[$j])>0) {
$arr[$k] = $nondated[$j];
@@ -1347,7 +1344,7 @@ function sort_facts(&$arr) {
}
// get anything that might be left in the nondated array
- while($j<$nc) {
+ while ($j<$nc) {
$arr[$k] = $nondated[$j];
$j++;
$k++;
@@ -1375,12 +1372,16 @@ function gedcomsort($a, $b) {
* @param int $path_to_find - which path in the relationship to find, 0 is the shortest path, 1 is the next shortest path, etc
*/
function get_relationship($pid1, $pid2, $followspouse=true, $maxlength=0, $ignore_cache=false, $path_to_find=0) {
- global $start_time, $NODE_CACHE, $NODE_CACHE_LENGTH, $USE_RELATIONSHIP_PRIVACY;
+ global $start_time;
+ static $NODE_CACHE, $NODE_CACHE_LENGTH;
+ if (is_null($NODE_CACHE)) {
+ $NODE_CACHE=array();
+ }
- $time_limit=get_site_setting('MAX_EXECUTION_TIME');
+ $time_limit=ini_get('max_execution_time');
$indirec = find_gedcom_record($pid2, WT_GED_ID, WT_USER_CAN_EDIT);
//-- check the cache
- if ($USE_RELATIONSHIP_PRIVACY && !$ignore_cache) {
+ if (!$ignore_cache) {
if (isset($NODE_CACHE["$pid1-$pid2"])) {
if ($NODE_CACHE["$pid1-$pid2"]=="NOT FOUND") return false;
if (($maxlength==0)||(count($NODE_CACHE["$pid1-$pid2"]["path"])-1<=$maxlength))
@@ -1631,9 +1632,7 @@ function get_relationship($pid1, $pid2, $followspouse=true, $maxlength=0, $ignor
}
} else
$visited[$parents["HUSB"]] = true;
- if ($USE_RELATIONSHIP_PRIVACY) {
- $NODE_CACHE["$pid1-".$node1["pid"]] = $node1;
- }
+ $NODE_CACHE["$pid1-".$node1["pid"]] = $node1;
}
if ((!empty($parents["WIFE"]))&&(!isset($visited[$parents["WIFE"]]))) {
$node1 = $node;
@@ -1651,9 +1650,7 @@ function get_relationship($pid1, $pid2, $followspouse=true, $maxlength=0, $ignor
}
} else
$visited[$parents["WIFE"]] = true;
- if ($USE_RELATIONSHIP_PRIVACY) {
- $NODE_CACHE["$pid1-".$node1["pid"]] = $node1;
- }
+ $NODE_CACHE["$pid1-".$node1["pid"]] = $node1;
}
$ct = preg_match_all("/1 CHIL @(.*)@/", $famrec, $match, PREG_SET_ORDER);
for ($i=0; $i<$ct; $i++) {
@@ -1674,9 +1671,7 @@ function get_relationship($pid1, $pid2, $followspouse=true, $maxlength=0, $ignor
}
} else
$visited[$child] = true;
- if ($USE_RELATIONSHIP_PRIVACY) {
- $NODE_CACHE["$pid1-".$node1["pid"]] = $node1;
- }
+ $NODE_CACHE["$pid1-".$node1["pid"]] = $node1;
}
}
}
@@ -1707,9 +1702,7 @@ function get_relationship($pid1, $pid2, $followspouse=true, $maxlength=0, $ignor
}
} else
$visited[$parents["HUSB"]] = true;
- if ($USE_RELATIONSHIP_PRIVACY) {
- $NODE_CACHE["$pid1-".$node1["pid"]] = $node1;
- }
+ $NODE_CACHE["$pid1-".$node1["pid"]] = $node1;
}
if ((!empty($parents["WIFE"]))&&((!in_arrayr($parents["WIFE"], $node1))||(!isset($visited[$parents["WIFE"]])))) {
$node1 = $node;
@@ -1727,9 +1720,7 @@ function get_relationship($pid1, $pid2, $followspouse=true, $maxlength=0, $ignor
}
} else
$visited[$parents["WIFE"]] = true;
- if ($USE_RELATIONSHIP_PRIVACY) {
- $NODE_CACHE["$pid1-".$node1["pid"]] = $node1;
- }
+ $NODE_CACHE["$pid1-".$node1["pid"]] = $node1;
}
}
$ct = preg_match_all("/1 CHIL @(.*)@/", $famrec, $match, PREG_SET_ORDER);
@@ -1752,9 +1743,7 @@ function get_relationship($pid1, $pid2, $followspouse=true, $maxlength=0, $ignor
} else {
$visited[$child] = true;
}
- if ($USE_RELATIONSHIP_PRIVACY) {
- $NODE_CACHE["$pid1-".$node1["pid"]] = $node1;
- }
+ $NODE_CACHE["$pid1-".$node1["pid"]] = $node1;
}
}
}
@@ -3173,7 +3162,7 @@ function add_ancestors(&$list, $pid, $children=false, $generations=-1, $show_emp
$total_num_skipped++;
if ($children) {
$childs = $family->getChildren();
- foreach($childs as $child) {
+ foreach ($childs as $child) {
$list[$child->getXref()] = $child;
if (isset($list[$id]->generation))
$list[$child->getXref()]->generation = $list[$id]->generation;
@@ -3233,7 +3222,7 @@ function add_descendancy(&$list, $pid, $parents=false, $generations=-1) {
}
}
$children = $family->getChildren();
- foreach($children as $child) {
+ foreach ($children as $child) {
if ($child) {
$list[$child->getXref()] = $child;
if (isset($list[$pid]->generation))
@@ -3243,7 +3232,7 @@ function add_descendancy(&$list, $pid, $parents=false, $generations=-1) {
}
}
if ($generations == -1 || $list[$pid]->generation+1 < $generations) {
- foreach($children as $child) {
+ foreach ($children as $child) {
add_descendancy($list, $child->getXref(), $parents, $generations); // recurse on the childs family
}
}
diff --git a/includes/functions/functions_export.php b/includes/functions/functions_export.php
index f76641acec..51eabc64db 100644
--- a/includes/functions/functions_export.php
+++ b/includes/functions/functions_export.php
@@ -164,8 +164,6 @@ function createTempUser($userID, $rights, $gedcom) {
$tempUserID=create_user($userID, "Dummy User", "dummy@email", md5(rand()));
if (!$tempUserID) return false;
- set_user_setting($tempUserID, 'relationship_privacy', '0');
- set_user_setting($tempUserID, 'max_relation_path', '0');
set_user_setting($tempUserID, 'visibleonline', '0');
set_user_setting($tempUserID, 'contactmethod', 'none');
switch ($rights) {
diff --git a/includes/functions/functions_privacy.php b/includes/functions/functions_privacy.php
index 0b51c18b81..12adfcbe3b 100644
--- a/includes/functions/functions_privacy.php
+++ b/includes/functions/functions_privacy.php
@@ -36,19 +36,6 @@ if (!defined('WT_WEBTREES')) {
define('WT_FUNCTIONS_PRIVACY_PHP', '');
-if ($USE_RELATIONSHIP_PRIVACY) {
- /**
- * store relationship paths in a cache
- *
- * the <var>$NODE_CACHE</var> is an array of nodes that have been previously checked
- * by the relationship calculator. This cache greatly speed up the relationship privacy
- * checking on charts as many relationships on charts are in the same relationship path.
- *
- * See the documentation for the get_relationship() function in the functions.php file.
- */
- $NODE_CACHE = array();
-}
-
/**
* check if a person is dead
*
@@ -218,7 +205,6 @@ function showLivingNameById($pid) {
// Can we display a level 0 record?
function canDisplayRecord($ged_id, $gedrec) {
// TODO - use the privacy settings for $ged_id, not the default gedcom.
- global $USE_RELATIONSHIP_PRIVACY, $CHECK_MARRIAGE_RELATIONS, $MAX_RELATION_PATH_LENGTH;
global $person_privacy, $person_facts, $global_facts, $HIDE_LIVE_PEOPLE, $GEDCOM, $SHOW_DEAD_PEOPLE, $MAX_ALIVE_AGE;
global $PRIVACY_CHECKS, $SHOW_LIVING_NAMES, $KEEP_ALIVE_YEARS_BIRTH, $KEEP_ALIVE_YEARS_DEATH;
@@ -314,9 +300,8 @@ function canDisplayRecord($ged_id, $gedrec) {
}
}
// Consider relationship privacy
- if ($pgv_USER_GEDCOM_ID && get_user_setting(WT_USER_ID, 'relationship_privacy', $USE_RELATIONSHIP_PRIVACY)) {
- $path_length=get_user_setting(WT_USER_ID, 'max_relation_path', $MAX_RELATION_PATH_LENGTH);
- $relationship=get_relationship($pgv_USER_GEDCOM_ID, $xref, $CHECK_MARRIAGE_RELATIONS, $path_length);
+ if ($pgv_USER_GEDCOM_ID && WT_USER_PATH_LENGTH) {
+ $relationship=get_relationship($pgv_USER_GEDCOM_ID, $xref, true, WT_USER_PATH_LENGTH);
return $cache[$cache_key]=($relationship!==false);
}
// No restriction found - show living people to authenticated users only:
diff --git a/includes/session.php b/includes/session.php
index 89337c2c5d..71344a99f8 100644
--- a/includes/session.php
+++ b/includes/session.php
@@ -390,6 +390,7 @@ define('WT_USER_CAN_ACCESS', WT_USER_CAN_EDIT || userCanAccess (WT_USER_I
define('WT_USER_ACCESS_LEVEL', getUserAccessLevel(WT_USER_ID, WT_GED_ID));
define('WT_USER_GEDCOM_ID', getUserGedcomId (WT_USER_ID, WT_GED_ID));
define('WT_USER_ROOT_ID', getUserRootId (WT_USER_ID, WT_GED_ID));
+define('WT_USER_PATH_LENGTH', get_user_gedcom_setting(WT_USER_ID, WT_GED_ID, 'RELATIONSHIP_PATH_LENGTH'));
// If we are logged in, and logout=1 has been added to the URL, log out
if (WT_USER_ID && safe_GET_bool('logout')) {
diff --git a/includes/set_gedcom_defaults.php b/includes/set_gedcom_defaults.php
index 52f66a44a0..0593bade98 100644
--- a/includes/set_gedcom_defaults.php
+++ b/includes/set_gedcom_defaults.php
@@ -46,7 +46,6 @@ set_gedcom_setting($ged_id, 'ALLOW_THEME_DROPDOWN', true);
set_gedcom_setting($ged_id, 'AUTO_GENERATE_THUMBS', true);
set_gedcom_setting($ged_id, 'CALENDAR_FORMAT', 'gregorian');
set_gedcom_setting($ged_id, 'CHART_BOX_TAGS', '');
-set_gedcom_setting($ged_id, 'CHECK_MARRIAGE_RELATIONS', true);
set_gedcom_setting($ged_id, 'COMMON_NAMES_ADD', '');
set_gedcom_setting($ged_id, 'COMMON_NAMES_REMOVE', '');
set_gedcom_setting($ged_id, 'COMMON_NAMES_THRESHOLD', '40');
@@ -78,7 +77,6 @@ set_gedcom_setting($ged_id, 'LINK_ICONS', 'click');
set_gedcom_setting($ged_id, 'MAX_ALIVE_AGE', 120);
set_gedcom_setting($ged_id, 'MAX_DESCENDANCY_GENERATIONS', '15');
set_gedcom_setting($ged_id, 'MAX_PEDIGREE_GENERATIONS', '10');
-set_gedcom_setting($ged_id, 'MAX_RELATION_PATH_LENGTH', 3);
set_gedcom_setting($ged_id, 'MEDIA_DIRECTORY', 'media/');
set_gedcom_setting($ged_id, 'MEDIA_DIRECTORY_LEVELS', '0');
set_gedcom_setting($ged_id, 'MEDIA_EXTERNAL', true);
@@ -181,5 +179,3 @@ $statement->execute(array($ged_id, 'SOUR', 'privacy'));
$statement->execute(array($ged_id, 'REPO', 'privacy'));
$statement->execute(array($ged_id, 'SUBM', 'confidential'));
$statement->execute(array($ged_id, 'SUBN', 'confidential'));
-
-
diff --git a/login_register.php b/login_register.php
index 9879b61768..962d80389a 100644
--- a/login_register.php
+++ b/login_register.php
@@ -112,7 +112,7 @@ switch ($action) {
$passchars = "abcdefghijklmnopqrstuvqxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$user_new_pw = "";
$max = strlen($passchars)-1;
- for($i=0; $i<8; $i++) {
+ for ($i=0; $i<8; $i++) {
$index = rand(0,$max);
$user_new_pw .= $passchars{$index};
}
@@ -351,8 +351,6 @@ switch ($action) {
set_user_setting($user_id, 'defaulttab', get_gedcom_setting(WT_GED_ID, 'GEDCOM_DEFAULT_TAB'));
set_user_setting($user_id, 'visibleonline', 1);
set_user_setting($user_id, 'editaccount', 1);
- set_user_setting($user_id, 'relationship_privacy', $USE_RELATIONSHIP_PRIVACY);
- set_user_setting($user_id, 'max_relation_path', $MAX_RELATION_PATH_LENGTH);
set_user_setting($user_id, 'auto_accept', 0);
set_user_setting($user_id, 'canadmin', 0);
set_user_setting($user_id, 'sessiontime', 0);
@@ -554,4 +552,3 @@ switch ($action) {
}
print_footer();
-?>
diff --git a/pgv_to_wt.php b/pgv_to_wt.php
index 5afe4354cd..d5b3e26f55 100644
--- a/pgv_to_wt.php
+++ b/pgv_to_wt.php
@@ -207,7 +207,7 @@ WT_DB::prepare(
////////////////////////////////////////////////////////////////////////////////
if ($PGV_SCHEMA_VERSION>=12) {
-echo '<p>pgv_gedcom => wt_gedcom ...</p>'; ob_flush(); flush(); usleep(50000);
+ echo '<p>pgv_gedcom => wt_gedcom ...</p>'; ob_flush(); flush(); usleep(50000);
WT_DB::prepare(
"INSERT INTO `##gedcom` (gedcom_id, gedcom_name)".
" SELECT gedcom_id, gedcom_name FROM `{$DBNAME}`.`{$TBLPREFIX}gedcom`"
@@ -324,7 +324,7 @@ echo '<p>pgv_gedcom => wt_gedcom ...</p>'; ob_flush(); flush(); usleep(50000);
" END".
" FROM `{$DBNAME}`.`{$TBLPREFIX}user_setting`".
" JOIN `##user` USING (user_id)".
- " WHERE setting_name NOT IN ('email', 'firstname', 'lastname')"
+ " WHERE setting_name NOT IN ('email', 'firstname', 'lastname', 'loggedin')"
)->execute();
echo '<p>pgv_user_gedcom_setting => wt_user_gedcom_setting ...</p>'; ob_flush(); flush(); usleep(50000);
@@ -590,7 +590,6 @@ foreach (get_all_gedcoms() as $ged_id=>$gedcom) {
@set_gedcom_setting($ged_id, 'AUTO_GENERATE_THUMBS', $AUTO_GENERATE_THUMBS);
@set_gedcom_setting($ged_id, 'CALENDAR_FORMAT', $CALENDAR_FORMAT);
@set_gedcom_setting($ged_id, 'CHART_BOX_TAGS', $CHART_BOX_TAGS);
- @set_gedcom_setting($ged_id, 'CHECK_MARRIAGE_RELATIONS', $CHECK_MARRIAGE_RELATIONS);
@set_gedcom_setting($ged_id, 'COMMON_NAMES_ADD', $COMMON_NAMES_ADD);
@set_gedcom_setting($ged_id, 'COMMON_NAMES_REMOVE', $COMMON_NAMES_REMOVE);
@set_gedcom_setting($ged_id, 'COMMON_NAMES_THRESHOLD', $COMMON_NAMES_THRESHOLD);
@@ -723,6 +722,7 @@ foreach (get_all_gedcoms() as $ged_id=>$gedcom) {
@set_gedcom_setting($ged_id, 'USE_GEONAMES', $USE_GEONAMES);
@set_gedcom_setting($ged_id, 'USE_MEDIA_FIREWALL', $USE_MEDIA_FIREWALL);
@set_gedcom_setting($ged_id, 'USE_MEDIA_VIEWER', $USE_MEDIA_VIEWER);
+ @set_gedcom_setting($ged_id, 'USE_RELATIONSHIP_PRIVACY', $USE_RELATIONSHIP_PRIVACY);
@set_gedcom_setting($ged_id, 'USE_RIN', $USE_RIN);
@set_gedcom_setting($ged_id, 'USE_SILHOUETTE', $USE_SILHOUETTE);
@set_gedcom_setting($ged_id, 'USE_THUMBS_MAIN', $USE_THUMBS_MAIN);
@@ -743,6 +743,28 @@ foreach (get_all_gedcoms() as $ged_id=>$gedcom) {
set_gedcom_setting($ged_id, 'imported', 1);
}
+// webtrees 1.0.5 combines user and gedcom settings for relationship privacy
+// into a combined user-gedcom setting, for more granular control
+WT_DB::exec(
+ "INSERT IGNORE INTO `##user_gedcom_setting` (user_id, gedcom_id, setting_name, setting_value)".
+ " SELECT u.user_id, g.gedcom_id, 'RELATIONSHIP_PATH_LENGTH', LEAST(us1.setting_value, gs1.setting_value)".
+ " FROM `##user` u".
+ " CROSS JOIN `##gedcom` g".
+ " LEFT JOIN `##user_setting` us1 ON (u.user_id =us1.user_id AND us1.setting_name='max_relation_path')".
+ " LEFT JOIN `##user_setting` us2 ON (u.user_id =us2.user_id AND us2.setting_name='relationship_privacy')".
+ " LEFT JOIN `##gedcom_setting` gs1 ON (g.gedcom_id=gs1.gedcom_id AND gs1.setting_name='MAX_RELATION_PATH_LENGTH')".
+ " LEFT JOIN `##gedcom_setting` gs2 ON (g.gedcom_id=gs2.gedcom_id AND gs2.setting_name='USE_RELATIONSHIP_PRIVACY')".
+ " WHERE us2.setting_value AND gs2.setting_value"
+);
+
+self::exec(
+ "DELETE FROM `##gedcom_setting` WHERE setting_name IN ('MAX_RELATION_PATH_LENGTH', 'USE_RELATIONSHIP_PRIVACY')"
+);
+
+self::exec(
+ "DELETE FROM `##user_setting` WHERE setting_name IN ('relationship_privacy', 'max_relation_path_length')"
+);
+
////////////////////////////////////////////////////////////////////////////////
if ($PGV_SCHEMA_VERSION>=13) {
diff --git a/useradmin.php b/useradmin.php
index e51fe499a8..d33c4acb95 100644
--- a/useradmin.php
+++ b/useradmin.php
@@ -81,8 +81,6 @@ $new_contact_method =safe_POST('new_contact_method');
$new_default_tab =safe_POST('new_default_tab', array_keys(WT_Module::getActiveTabs()), get_gedcom_setting(WT_GED_ID, 'GEDCOM_DEFAULT_TAB'));
$new_comment =safe_POST('new_comment', WT_REGEX_UNSAFE);
$new_comment_exp =safe_POST('new_comment_exp' );
-$new_max_relation_path =safe_POST_integer('new_max_relation_path', 1, $MAX_RELATION_PATH_LENGTH, 2);
-$new_relationship_privacy=safe_POST_bool('new_relationship_privacy');
$new_auto_accept =safe_POST_bool('new_auto_accept');
$canadmin =safe_POST_bool('canadmin');
$visibleonline =safe_POST_bool('visibleonline');
@@ -160,8 +158,6 @@ if ($action=='createuser' || $action=='edituser2') {
set_user_setting($user_id, 'defaulttab', $new_default_tab);
set_user_setting($user_id, 'comment', $new_comment);
set_user_setting($user_id, 'comment_exp', $new_comment_exp);
- set_user_setting($user_id, 'max_relation_path', $new_max_relation_path);
- set_user_setting($user_id, 'relationship_privacy', $new_relationship_privacy);
set_user_setting($user_id, 'auto_accept', $new_auto_accept);
set_user_setting($user_id, 'canadmin', $canadmin);
set_user_setting($user_id, 'visibleonline', $visibleonline);
@@ -172,6 +168,12 @@ if ($action=='createuser' || $action=='edituser2') {
set_user_gedcom_setting($user_id, $ged_id, 'gedcomid', safe_POST_xref('gedcomid'.$ged_id));
set_user_gedcom_setting($user_id, $ged_id, 'rootid', safe_POST_xref('rootid'.$ged_id));
set_user_gedcom_setting($user_id, $ged_id, 'canedit', safe_POST('canedit'.$ged_id, array_keys($ALL_EDIT_OPTIONS)));
+ if (safe_POST_xref('gedcomid'.$ged_id)) {
+ set_user_gedcom_setting($user_id, $ged_id, 'RELATIONSHIP_PATH_LENGTH', safe_POST_integer('RELATIONSHIP_PATH_LENGTH'.$ged_id, 0, 10, 0));
+ } else {
+ // Do not allow a path length to be set if the individual ID is not
+ set_user_gedcom_setting($user_id, $ged_id, null);
+ }
}
// If we're verifying a new user, send them a message to let them know
if ($newly_verified && $action=='edituser2') {
@@ -280,16 +282,16 @@ if ($action=="edituser") {
<tr>
<td class="descriptionbox wrap"><?php echo i18n::translate('GEDCOM INDI record ID'), help_link('useradmin_gedcomid'); ?></td>
<td class="optionbox wrap">
- <table class="<?php echo $TEXT_DIRECTION; ?>">
+ <table>
<?php
foreach ($all_gedcoms as $ged_id=>$ged_name) {
$varname='gedcomid'.$ged_id;
?>
<tr valign="top">
- <td><?php echo $ged_name; ?>:&nbsp;&nbsp;</td>
+ <td><?php echo $ged_name; ?></td>
<td><input type="text" name="<?php echo $varname; ?>" id="<?php echo $varname; ?>" value="<?php
$pid=get_user_gedcom_setting($user_id, $ged_id, 'gedcomid');
- echo $pid, "\" />";
+ echo $pid, '" />';
print_findindi_link($varname, "", false, false, $ged_name);
$GEDCOM=$ged_name; // library functions use global variable instead of parameter.
$person=Person::getInstance($pid);
@@ -302,13 +304,13 @@ if ($action=="edituser") {
</table></td></tr><tr>
<td class="descriptionbox wrap"><?php echo i18n::translate('Pedigree chart root person'), help_link('useradmin_rootid'); ?></td>
<td class="optionbox wrap">
- <table class="<?php echo $TEXT_DIRECTION; ?>">
+ <table>
<?php
foreach ($all_gedcoms as $ged_id=>$ged_name) {
$varname='rootid'.$ged_id;
?>
<tr valign="top">
- <td><?php echo $ged_name; ?>:&nbsp;&nbsp;</td>
+ <td><?php echo $ged_name; ?></td>
<td> <input type="text" name="<?php echo $varname; ?>" id="<?php echo $varname; ?>" value="<?php
$pid=get_user_gedcom_setting($user_id, $ged_id, 'rootid');
echo $pid, "\" />";
@@ -341,7 +343,7 @@ if ($action=="edituser") {
<?php
foreach ($all_gedcoms as $ged_id=>$ged_name) {
$varname = 'canedit'.$ged_id;
- echo "<tr><td>$ged_name:&nbsp;&nbsp;</td><td>";
+ echo "<tr><td>$ged_name</td><td>";
echo "<select name=\"{$varname}\" id=\"{$varname}\">";
foreach ($ALL_EDIT_OPTIONS as $EDIT_OPTION=>$desc) {
echo '<option value="', $EDIT_OPTION, '" ';
@@ -356,12 +358,34 @@ if ($action=="edituser") {
</table>
</td>
</tr>
+ <tr>
+ <td class="descriptionbox wrap"><?php echo i18n::translate('Maximum relationship path length'), help_link('RELATIONSHIP_PATH_LENGTH'); ?></td>
+ <td class="optionbox wrap">
+ <table>
+ <?php
+ foreach ($all_gedcoms as $ged_id=>$ged_name) {
+ $varname = 'RELATIONSHIP_PATH_LENGTH'.$ged_id;
+ echo
+ '<tr><td>', $ged_name, '</td><td>',
+ '<select name="', $varname, '" id="', $varname, '"',
+ get_user_gedcom_setting($user_id, $ged_id, 'gedcomid') ? '' : ' disabled="disabled"',
+ '>';
+ for ($n=0; $n<=10; ++$n) {
+ echo
+ '<option value="', $n, '"',
+ get_user_gedcom_setting($user_id, $ged_id, 'RELATIONSHIP_PATH_LENGTH')==$n ? ' selected="selected"' : '',
+ '>',
+ $n ? $n : '',
+ '</option>';
+ }
+ echo "</select></td></tr>";
+ }
+ ?>
+ </table>
+ </td>
+ </tr>
<tr><td class="descriptionbox wrap"><?php echo i18n::translate('Automatically accept changes made by this user'), help_link('useradmin_auto_accept'); ?></td>
<td class="optionbox wrap"><input type="checkbox" name="new_auto_accept" value="1" <?php if (get_user_setting($user_id, 'auto_accept')) echo "checked=\"checked\""; ?> /></td></tr>
- <tr><td class="descriptionbox wrap"><?php echo i18n::translate('Limit access to related people'), help_link('useradmin_relation_priv'); ?></td>
- <td class="optionbox wrap"><input type="checkbox" name="new_relationship_privacy" value="1" <?php if (get_user_setting($user_id, 'relationship_privacy')) echo "checked=\"checked\""; ?> /></td></tr>
- <tr><td class="descriptionbox wrap"><?php echo i18n::translate('Max relationship privacy path length'), help_link('useradmin_path_length'); ?></td>
- <td class="optionbox wrap"><input type="text" name="new_max_relation_path" value="<?php echo get_user_setting($user_id, 'max_relation_path'); ?>" size="5" /></td></tr>
<tr><td class="descriptionbox wrap"><?php echo i18n::translate('Email address'), help_link('useradmin_email'); ?></td><td class="optionbox wrap"><input type="text" name="emailaddress" dir="ltr" value="<?php echo getUserEmail($user_id); ?>" size="50" /></td></tr>
<tr><td class="descriptionbox wrap"><?php echo i18n::translate('User verified himself'), help_link('useradmin_verified'); ?></td><td class="optionbox wrap"><input type="checkbox" name="verified" value="1" <?php if (get_user_setting($user_id, 'verified')) echo "checked=\"checked\""; ?> /></td></tr>
<tr><td class="descriptionbox wrap"><?php echo i18n::translate('User approved by admin'), help_link('useradmin_verbyadmin'); ?></td><td class="optionbox wrap"><input type="checkbox" name="verified_by_admin" value="1" <?php if (get_user_setting($user_id, 'verified_by_admin')) echo "checked=\"checked\""; ?> /></td></tr>
@@ -378,7 +402,7 @@ if ($action=="edituser") {
<select name="user_theme" dir="ltr">
<option value=""><?php echo i18n::translate('&lt;default theme&gt;'); ?></option>
<?php
- foreach(get_theme_names() as $themename=>$themedir) {
+ foreach (get_theme_names() as $themename=>$themedir) {
echo "<option value=\"", $themedir, "\"";
if ($themedir == get_user_setting($user_id, 'theme')) echo " selected=\"selected\"";
echo ">", $themename, "</option>";
@@ -435,7 +459,7 @@ if ($action == "listusers") {
$users = get_all_users("asc", "realname");
// First filter the users, otherwise the javascript to unfold priviledges gets disturbed
- foreach($users as $user_id=>$user_name) {
+ foreach ($users as $user_id=>$user_name) {
if ($filter == "warnings") {
if (get_user_setting($user_id, 'comment_exp')) {
if ((strtotime(get_user_setting($user_id, 'comment_exp')) == "-1") || (strtotime(get_user_setting($user_id, 'comment_exp')) >= time("U"))) unset($users[$user_id]);
@@ -522,7 +546,7 @@ jQuery(document).ready(function(){
<tbody>
<?php
$k++;
- foreach($users as $user_id=>$user_name) {
+ foreach ($users as $user_id=>$user_name) {
echo "<tr>";
echo "<td class=\"optionbox wrap\">";
if ($user_id!=WT_USER_ID && get_user_setting($user_id, 'contactmethod')!='none') {
@@ -703,7 +727,7 @@ if ($action == "createform") {
$varname='gedcomid'.$ged_id;
?>
<tr>
- <td><?php echo $ged_name; ?>:&nbsp;&nbsp;</td>
+ <td><?php echo $ged_name; ?></td>
<td><input type="text" name="<?php echo $varname; ?>" id="<?php echo $varname; ?>" value="<?php
echo "\" />";
print_findindi_link($varname, "", false, false, $ged_name);
@@ -713,13 +737,13 @@ if ($action == "createform") {
</table>
</td></tr>
<tr><td class="descriptionbox wrap"><?php echo i18n::translate('Pedigree chart root person'), help_link('useradmin_rootid'); ?></td><td class="optionbox wrap">
- <table class="<?php echo $TEXT_DIRECTION; ?>">
+ <table>
<?php
foreach ($all_gedcoms as $ged_id=>$ged_name) {
$varname='rootid'.$ged_id;
?>
<tr>
- <td><?php echo $ged_name; ?>:&nbsp;&nbsp;</td>
+ <td><?php echo $ged_name; ?></td>
<td><input type="text" name="<?php echo $varname; ?>" id="<?php echo $varname; ?>" value="<?php
echo "\" />";
print_findindi_link($varname, "", false, false, $ged_name);
@@ -730,11 +754,11 @@ if ($action == "createform") {
</td></tr>
<tr><td class="descriptionbox wrap"><?php echo i18n::translate('User can administer'), help_link('useradmin_can_admin'); ?></td><td class="optionbox wrap"><input type="checkbox" name="canadmin" value="1" /></td></tr>
<tr><td class="descriptionbox wrap"><?php echo i18n::translate('Access level'), help_link('useradmin_can_edit'); ?></td><td class="optionbox wrap">
- <table class="<?php echo $TEXT_DIRECTION; ?>">
+ <table>
<?php
foreach ($all_gedcoms as $ged_id=>$ged_name) {
$varname='canedit'.$ged_id;
- echo "<tr><td>{$ged_name}:&nbsp;&nbsp;</td><td>";
+ echo "<tr><td>{$ged_name}</td><td>";
echo "<select name=\"$varname\">";
echo "<option value=\"none\" selected=\"selected\"";
echo ">", i18n::translate('None'), "</option>";
@@ -751,12 +775,29 @@ if ($action == "createform") {
?>
</table>
</td></tr>
+ <tr>
+ <td class="descriptionbox wrap"><?php echo i18n::translate('Maximum relationship path length'), help_link('RELATIONSHIP_PATH_LENGTH'); ?></td>
+ <td class="optionbox wrap">
+ <table>
+ <?php
+ foreach ($all_gedcoms as $ged_id=>$ged_name) {
+ $varname = 'RELATIONSHIP_PATH_LENGTH'.$ged_id;
+ echo "<tr><td>$ged_name</td><td>";
+ echo "<select name=\"{$varname}\" id=\"{$varname}\">";
+ for ($n=0; $n<=10; ++$n) {
+ echo
+ '<option value="', $n, '">',
+ $n ? $n : '',
+ '</option>';
+ }
+ echo "</select></td></tr>";
+ }
+ ?>
+ </table>
+ </td>
+ </tr>
<tr><td class="descriptionbox wrap"><?php echo i18n::translate('Automatically accept changes made by this user'), help_link('useradmin_auto_accept'); ?></td>
<td class="optionbox wrap"><input type="checkbox" name="new_auto_accept" value="1" /></td></tr>
- <tr><td class="descriptionbox wrap"><?php echo i18n::translate('Limit access to related people'), help_link('useradmin_relation_priv'); ?></td>
- <td class="optionbox wrap"><input type="checkbox" name="new_relationship_privacy" value="1" /></td></tr>
- <tr><td class="descriptionbox wrap"><?php echo i18n::translate('Max relationship privacy path length'), help_link('useradmin_path_length'); ?></td>
- <td class="optionbox wrap"><input type="text" name="new_max_relation_path" value="0" size="5" /></td></tr>
<tr><td class="descriptionbox wrap"><?php echo i18n::translate('Email address'), help_link('useradmin_email'); ?></td><td class="optionbox wrap"><input type="text" name="emailaddress" value="" size="50" /></td></tr>
<tr><td class="descriptionbox wrap"><?php echo i18n::translate('User verified himself'), help_link('useradmin_verified'); ?></td><td class="optionbox wrap"><input type="checkbox" name="verified" value="1" checked="checked" /></td></tr>
<tr><td class="descriptionbox wrap"><?php echo i18n::translate('User approved by admin'), help_link('useradmin_verbyadmin'); ?></td><td class="optionbox wrap"><input type="checkbox" name="verified_by_admin" value="1" checked="checked" /></td></tr>
@@ -769,7 +810,7 @@ if ($action == "createform") {
<select name="new_user_theme">
<option value="" selected="selected"><?php echo i18n::translate('Site Default'); ?></option>
<?php
- foreach(get_theme_names() as $themename=>$themedir) {
+ foreach (get_theme_names() as $themename=>$themedir) {
echo "<option value=\"", $themedir, "\"";
echo ">", $themename, "</option>";
}
@@ -837,7 +878,7 @@ if ($action == "cleanup") {
$month = safe_GET_integer('month', 1, 12, 6);
echo "<tr><td class=\"descriptionbox\">", i18n::translate('Number of months since the last login for a user\'s account to be considered inactive: '), "</td>";
echo "<td class=\"optionbox\"><select onchange=\"document.location=options[selectedIndex].value;\">";
- for($i=1; $i<=12; $i++) {
+ for ($i=1; $i<=12; $i++) {
echo "<option value=\"useradmin.php?action=cleanup&amp;month=$i\"";
if ($i == $month) echo " selected=\"selected\"";
echo " >", $i, "</option>";
@@ -848,7 +889,7 @@ if ($action == "cleanup") {
<?php
// Check users not logged in too long
$ucnt = 0;
- foreach(get_all_users() as $user_id=>$user_name) {
+ foreach (get_all_users() as $user_id=>$user_name) {
$userName = getUserFullName($user_id);
if ((int)get_user_setting($user_id, 'sessiontime') == "0")
$datelogin = (int)get_user_setting($user_id, 'reg_timestamp');
@@ -863,7 +904,7 @@ if ($action == "cleanup") {
}
// Check unverified users
- foreach(get_all_users() as $user_id=>$user_name) {
+ foreach (get_all_users() as $user_id=>$user_name) {
if (((date("U") - (int)get_user_setting($user_id, 'reg_timestamp')) > 604800) && !get_user_setting($user_id, 'verified')) {
$userName = getUserFullName($user_id);
?><tr><td class="descriptionbox"><?php echo $user_name, " - ", $userName, ":&nbsp;&nbsp;", i18n::translate('User didn\'t verify within 7 days.');
@@ -873,7 +914,7 @@ if ($action == "cleanup") {
}
// Check users not verified by admin
- foreach(get_all_users() as $user_id=>$user_name) {
+ foreach (get_all_users() as $user_id=>$user_name) {
if (!get_user_setting($user_id, 'verified_by_admin') && get_user_setting($user_id, 'verified')) {
$userName = getUserFullName($user_id);
?><tr><td class="descriptionbox"><?php echo $user_name, " - ", $userName, ":&nbsp;&nbsp;", i18n::translate('User not verified by administrator.');
@@ -899,7 +940,7 @@ if ($action == "cleanup") {
}
// NOTE: No table parts
if ($action == "cleanup2") {
- foreach(get_all_users() as $user_id=>$user_name) {
+ foreach (get_all_users() as $user_id=>$user_name) {
$var = "del_".str_replace(array(".", "-", " "), array("_", "_", "_"), $user_name);
if (safe_POST($var)=='1') {
delete_user($user_id);
@@ -941,8 +982,6 @@ if ($action == "cleanup2") {
echo "<br />";
}
-// Print main menu
-// NOTE: WORKING
echo '<p class="center"><input TYPE="button" VALUE="', i18n::translate('Return to Administration page'), '" onclick="javascript:window.location=\'admin.php\'" /></p>',
'<h2 class="center">', i18n::translate('User administration'), '</h2>';
?>
@@ -976,7 +1015,7 @@ echo '<p class="center"><input TYPE="button" VALUE="', i18n::translate('Return t
$adminusers = 0; // Administrators
$userlang = array(); // Array for user languages
$gedadmin = array(); // Array for gedcom admins
- foreach(get_all_users() as $user_id=>$user_name) {
+ foreach (get_all_users() as $user_id=>$user_name) {
$totusers = $totusers + 1;
if (((date("U") - (int)get_user_setting($user_id, 'reg_timestamp')) > 604800) && !get_user_setting($user_id, 'verified')) $warnusers++;
else {