diff options
| author | Greg Roach <fisharebest@gmail.com> | 2015-01-18 18:48:48 +0000 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2015-01-18 18:48:48 +0000 |
| commit | ba674c7d21dce3c89217c85b81fc7cbd40df32d5 (patch) | |
| tree | 5913baa5b9e9419d1d1b7a0d8fd820ac97bf7bfe | |
| parent | 34f62eee36c4c50f2335538dbc011be68597a790 (diff) | |
| parent | de28833dea3578d417b90ed41077f34313c1aea6 (diff) | |
| download | webtrees-ba674c7d21dce3c89217c85b81fc7cbd40df32d5.tar.gz webtrees-ba674c7d21dce3c89217c85b81fc7cbd40df32d5.tar.bz2 webtrees-ba674c7d21dce3c89217c85b81fc7cbd40df32d5.zip | |
Merge pull request #371 from fisharebest/scrutinizer-patch-1
Scrutinizer Auto-Fixes
27 files changed, 669 insertions, 664 deletions
diff --git a/modules_v3/todays_events/module.php b/modules_v3/todays_events/module.php index 4eedfd385d..841053ff59 100644 --- a/modules_v3/todays_events/module.php +++ b/modules_v3/todays_events/module.php @@ -37,20 +37,20 @@ class todays_events_WT_Module extends WT_Module implements WT_Module_Block { } /** {@inheritdoc} */ - public function getBlock($block_id, $template=true, $cfg=null) { + public function getBlock($block_id, $template = true, $cfg = null) { global $ctype; - require_once WT_ROOT.'includes/functions/functions_print_lists.php'; + require_once WT_ROOT . 'includes/functions/functions_print_lists.php'; - $filter = get_block_setting($block_id, 'filter', true); - $onlyBDM = get_block_setting($block_id, 'onlyBDM', true); + $filter = get_block_setting($block_id, 'filter', true); + $onlyBDM = get_block_setting($block_id, 'onlyBDM', true); $infoStyle = get_block_setting($block_id, 'infoStyle', 'table'); $sortStyle = get_block_setting($block_id, 'sortStyle', 'alpha'); - $block = get_block_setting($block_id, 'block', true); + $block = get_block_setting($block_id, 'block', true); if ($cfg) { foreach (array('filter', 'onlyBDM', 'infoStyle', 'sortStyle', 'block') as $name) { if (array_key_exists($name, $cfg)) { - $$name=$cfg[$name]; + $$name = $cfg[$name]; } } } @@ -108,38 +108,38 @@ class todays_events_WT_Module extends WT_Module implements WT_Module_Block { /** {@inheritdoc} */ public function configureBlock($block_id) { if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) { - set_block_setting($block_id, 'filter', WT_Filter::postBool('filter')); - set_block_setting($block_id, 'onlyBDM', WT_Filter::postBool('onlyBDM')); + set_block_setting($block_id, 'filter', WT_Filter::postBool('filter')); + set_block_setting($block_id, 'onlyBDM', WT_Filter::postBool('onlyBDM')); set_block_setting($block_id, 'infoStyle', WT_Filter::post('infoStyle', 'list|table', 'table')); set_block_setting($block_id, 'sortStyle', WT_Filter::post('sortStyle', 'alpha|anniv', 'alpha')); - set_block_setting($block_id, 'block', WT_Filter::postBool('block')); + set_block_setting($block_id, 'block', WT_Filter::postBool('block')); exit; } - require_once WT_ROOT.'includes/functions/functions_edit.php'; + require_once WT_ROOT . 'includes/functions/functions_edit.php'; - $filter=get_block_setting($block_id, 'filter', true); + $filter = get_block_setting($block_id, 'filter', true); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Show only events of living individuals?'); echo '</td><td class="optionbox">'; echo edit_field_yes_no('filter', $filter); echo '</td></tr>'; - $onlyBDM=get_block_setting($block_id, 'onlyBDM', true); + $onlyBDM = get_block_setting($block_id, 'onlyBDM', true); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Show only births, deaths, and marriages?'); echo '</td><td class="optionbox">'; echo edit_field_yes_no('onlyBDM', $onlyBDM); echo '</td></tr>'; - $infoStyle=get_block_setting($block_id, 'infoStyle', 'table'); + $infoStyle = get_block_setting($block_id, 'infoStyle', 'table'); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Presentation style'); echo '</td><td class="optionbox">'; echo select_edit_control('infoStyle', array('list'=>WT_I18N::translate('list'), 'table'=>WT_I18N::translate('table')), null, $infoStyle, ''); echo '</td></tr>'; - $sortStyle=get_block_setting($block_id, 'sortStyle', 'alpha'); + $sortStyle = get_block_setting($block_id, 'sortStyle', 'alpha'); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Sort order'); echo '</td><td class="optionbox">'; @@ -149,7 +149,7 @@ class todays_events_WT_Module extends WT_Module implements WT_Module_Block { ), null, $sortStyle, ''); echo '</td></tr>'; - $block=get_block_setting($block_id, 'block', true); + $block = get_block_setting($block_id, 'block', true); echo '<tr><td class="descriptionbox wrap width33">'; echo /* I18N: label for a yes/no option */ WT_I18N::translate('Add a scrollbar when block contents grow'); echo '</td><td class="optionbox">'; diff --git a/modules_v3/todo/help_text.php b/modules_v3/todo/help_text.php index 4613b0da65..75143ed770 100644 --- a/modules_v3/todo/help_text.php +++ b/modules_v3/todo/help_text.php @@ -21,19 +21,19 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -if (!defined('WT_WEBTREES') || !defined('WT_SCRIPT_NAME') || WT_SCRIPT_NAME!='help_text.php') { +if (!defined('WT_WEBTREES') || !defined('WT_SCRIPT_NAME') || WT_SCRIPT_NAME != 'help_text.php') { header('HTTP/1.0 403 Forbidden'); exit; } switch ($help) { case 'todo': - $title=WT_I18N::translate('Research tasks'); - $text=WT_I18N::translate('Research tasks are special events, added to individuals in your family tree, which identify the need for further research. You can use them as a reminder to check facts against more reliable sources, to obtain documents or photographs, to resolve conflicting information, etc.'). - '</p><p class="ui-state-highlight">'. - WT_I18N::translate('To create new research tasks, you must first add “research task” to the list of facts and events in the family tree’s preferences.'). - '</p><p class="ui-state-highlight">'. - WT_I18N::translate('Research tasks are stored using the custom GEDCOM tag “_TODO”. Other genealogy applications may not recognize this tag.'). + $title = WT_I18N::translate('Research tasks'); + $text = WT_I18N::translate('Research tasks are special events, added to individuals in your family tree, which identify the need for further research. You can use them as a reminder to check facts against more reliable sources, to obtain documents or photographs, to resolve conflicting information, etc.') . + '</p><p class="ui-state-highlight">' . + WT_I18N::translate('To create new research tasks, you must first add “research task” to the list of facts and events in the family tree’s preferences.') . + '</p><p class="ui-state-highlight">' . + WT_I18N::translate('Research tasks are stored using the custom GEDCOM tag “_TODO”. Other genealogy applications may not recognize this tag.') . '</p>'; break; } diff --git a/modules_v3/top10_givnnames/module.php b/modules_v3/top10_givnnames/module.php index ca5e5756e0..92817427aa 100644 --- a/modules_v3/top10_givnnames/module.php +++ b/modules_v3/top10_givnnames/module.php @@ -72,8 +72,11 @@ class top10_givnnames_WT_Module extends WT_Module implements WT_Module_Block { //Select List or Table switch ($infoStyle) { case "list": // Output style 1: Simple list style. Better suited to left side of page. - if ($TEXT_DIRECTION=='ltr') $padding = 'padding-left: 15px'; - else $padding = 'padding-right: 15px'; + if ($TEXT_DIRECTION=='ltr') { + $padding = 'padding-left: 15px'; + } else { + $padding = 'padding-right: 15px'; + } $params=array(1,$num,'rcount'); //List Female names $totals=$stats->commonGivenFemaleTotals($params); @@ -125,29 +128,29 @@ class top10_givnnames_WT_Module extends WT_Module implements WT_Module_Block { /** {@inheritdoc} */ public function configureBlock($block_id) { if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) { - set_block_setting($block_id, 'num', WT_Filter::postInteger('num', 1, 10000, 10)); + set_block_setting($block_id, 'num', WT_Filter::postInteger('num', 1, 10000, 10)); set_block_setting($block_id, 'infoStyle', WT_Filter::post('infoStyle', 'list|table', 'table')); - set_block_setting($block_id, 'block', WT_Filter::postBool('block')); + set_block_setting($block_id, 'block', WT_Filter::postBool('block')); exit; } - require_once WT_ROOT.'includes/functions/functions_edit.php'; + require_once WT_ROOT . 'includes/functions/functions_edit.php'; - $num=get_block_setting($block_id, 'num', 10); + $num = get_block_setting($block_id, 'num', 10); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Number of items to show'); echo '</td><td class="optionbox">'; echo '<input type="text" name="num" size="2" value="', $num, '">'; echo '</td></tr>'; - $infoStyle=get_block_setting($block_id, 'infoStyle', 'table'); + $infoStyle = get_block_setting($block_id, 'infoStyle', 'table'); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Presentation style'); echo '</td><td class="optionbox">'; echo select_edit_control('infoStyle', array('list'=>WT_I18N::translate('list'), 'table'=>WT_I18N::translate('table')), null, $infoStyle, ''); echo '</td></tr>'; - $block=get_block_setting($block_id, 'block', false); + $block = get_block_setting($block_id, 'block', false); echo '<tr><td class="descriptionbox wrap width33">'; echo /* I18N: label for a yes/no option */ WT_I18N::translate('Add a scrollbar when block contents grow'); echo '</td><td class="optionbox">'; diff --git a/modules_v3/top10_pageviews/module.php b/modules_v3/top10_pageviews/module.php index 627537eecb..92c42225ba 100644 --- a/modules_v3/top10_pageviews/module.php +++ b/modules_v3/top10_pageviews/module.php @@ -37,16 +37,16 @@ class top10_pageviews_WT_Module extends WT_Module implements WT_Module_Block { } /** {@inheritdoc} */ - public function getBlock($block_id, $template=true, $cfg=null) { + public function getBlock($block_id, $template = true, $cfg = null) { global $ctype; - $count_placement=get_block_setting($block_id, 'count_placement', 'before'); - $num=(int)get_block_setting($block_id, 'num', 10); - $block=get_block_setting($block_id, 'block', false); + $count_placement = get_block_setting($block_id, 'count_placement', 'before'); + $num = (int) get_block_setting($block_id, 'num', 10); + $block = get_block_setting($block_id, 'block', false); if ($cfg) { foreach (array('count_placement', 'num', 'block') as $name) { if (array_key_exists($name, $cfg)) { - $$name=$cfg[$name]; + $$name = $cfg[$name]; } } } @@ -54,7 +54,7 @@ class top10_pageviews_WT_Module extends WT_Module implements WT_Module_Block { $id = $this->getName() . $block_id; $class = $this->getName() . '_block'; if ($ctype === 'gedcom' && WT_USER_GEDCOM_ADMIN || $ctype === 'user' && Auth::check()) { - $title = '<i class="icon-admin" title="'.WT_I18N::translate('Configure').'" onclick="modalDialog(\'block_edit.php?block_id='.$block_id.'\', \''.$this->getTitle().'\');"></i>'; + $title = '<i class="icon-admin" title="' . WT_I18N::translate('Configure') . '" onclick="modalDialog(\'block_edit.php?block_id=' . $block_id . '\', \'' . $this->getTitle() . '\');"></i>'; } else { $title = ''; } @@ -62,10 +62,10 @@ class top10_pageviews_WT_Module extends WT_Module implements WT_Module_Block { $content = ""; // load the lines from the file - $top10=WT_DB::prepare( - "SELECT page_parameter, page_count". - " FROM `##hit_counter`". - " WHERE gedcom_id = :tree_id AND page_name IN ('individual.php','family.php','source.php','repo.php','note.php','mediaviewer.php')". + $top10 = WT_DB::prepare( + "SELECT page_parameter, page_count" . + " FROM `##hit_counter`" . + " WHERE gedcom_id = :tree_id AND page_name IN ('individual.php','family.php','source.php','repo.php','note.php','mediaviewer.php')" . " ORDER BY page_count DESC LIMIT :limit" )->execute(array( 'tree_id' => WT_GED_ID, @@ -79,15 +79,15 @@ class top10_pageviews_WT_Module extends WT_Module implements WT_Module_Block { $content .= "<table>"; } foreach ($top10 as $id=>$count) { - $record=WT_GedcomRecord::getInstance($id); + $record = WT_GedcomRecord::getInstance($id); if ($record && $record->canShow()) { $content .= '<tr valign="top">'; - if ($count_placement=='before') { - $content .= '<td dir="ltr" align="right">['.$count.']</td>'; + if ($count_placement == 'before') { + $content .= '<td dir="ltr" align="right">[' . $count . ']</td>'; } - $content .= '<td class="name2" ><a href="'.$record->getHtmlUrl().'">'.$record->getFullName().'</a></td>'; - if ($count_placement=='after') { - $content .= '<td dir="ltr" align="right">['.$count.']</td>'; + $content .= '<td class="name2" ><a href="' . $record->getHtmlUrl() . '">' . $record->getFullName() . '</a></td>'; + if ($count_placement == 'after') { + $content .= '<td dir="ltr" align="right">[' . $count . ']</td>'; } $content .= '</tr>'; } @@ -122,28 +122,28 @@ class top10_pageviews_WT_Module extends WT_Module implements WT_Module_Block { /** {@inheritdoc} */ public function configureBlock($block_id) { if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) { - set_block_setting($block_id, 'num', WT_Filter::postInteger('num', 1, 10000, 10)); + set_block_setting($block_id, 'num', WT_Filter::postInteger('num', 1, 10000, 10)); set_block_setting($block_id, 'count_placement', WT_Filter::post('count_placement', 'before|after', 'before')); - set_block_setting($block_id, 'block', WT_Filter::postBool('block')); + set_block_setting($block_id, 'block', WT_Filter::postBool('block')); exit; } - require_once WT_ROOT.'includes/functions/functions_edit.php'; + require_once WT_ROOT . 'includes/functions/functions_edit.php'; - $num=get_block_setting($block_id, 'num', 10); + $num = get_block_setting($block_id, 'num', 10); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Number of items to show'); echo '</td><td class="optionbox">'; echo '<input type="text" name="num" size="2" value="', $num, '">'; echo '</td></tr>'; - $count_placement=get_block_setting($block_id, 'count_placement', 'left'); + $count_placement = get_block_setting($block_id, 'count_placement', 'left'); echo "<tr><td class=\"descriptionbox wrap width33\">"; echo WT_I18N::translate('Place counts before or after name?'); echo "</td><td class=\"optionbox\">"; echo select_edit_control('count_placement', array('before'=>WT_I18N::translate('before'), 'after'=>WT_I18N::translate('after')), null, $count_placement, ''); echo '</td></tr>'; - $block=get_block_setting($block_id, 'block', false); + $block = get_block_setting($block_id, 'block', false); echo '<tr><td class="descriptionbox wrap width33">'; echo /* I18N: label for a yes/no option */ WT_I18N::translate('Add a scrollbar when block contents grow'); echo '</td><td class="optionbox">'; diff --git a/modules_v3/tree/class_treeview.php b/modules_v3/tree/class_treeview.php index 71fe0bdb57..86df05ede1 100644 --- a/modules_v3/tree/class_treeview.php +++ b/modules_v3/tree/class_treeview.php @@ -61,7 +61,7 @@ class TreeView { </div> <h2 id="tree-title">' . WT_I18N::translate('Interactive tree of %s', $root_person->getFullName()) . '</h2> <div id="' . $this->name . '_in" class="tv_in" dir="ltr"> - ' . $this->drawPerson($root_person, $generations, 0, null, null, true) .' + ' . $this->drawPerson($root_person, $generations, 0, null, null, true) . ' </div> </div> '; diff --git a/modules_v3/upcoming_events/module.php b/modules_v3/upcoming_events/module.php index 778a88aa89..efbd13a33e 100644 --- a/modules_v3/upcoming_events/module.php +++ b/modules_v3/upcoming_events/module.php @@ -37,21 +37,21 @@ class upcoming_events_WT_Module extends WT_Module implements WT_Module_Block { } /** {@inheritdoc} */ - public function getBlock($block_id, $template=true, $cfg=null) { + public function getBlock($block_id, $template = true, $cfg = null) { global $ctype; - require_once WT_ROOT.'includes/functions/functions_print_lists.php'; + require_once WT_ROOT . 'includes/functions/functions_print_lists.php'; - $days = get_block_setting($block_id, 'days', 7); - $filter = get_block_setting($block_id, 'filter', true); - $onlyBDM = get_block_setting($block_id, 'onlyBDM', false); + $days = get_block_setting($block_id, 'days', 7); + $filter = get_block_setting($block_id, 'filter', true); + $onlyBDM = get_block_setting($block_id, 'onlyBDM', false); $infoStyle = get_block_setting($block_id, 'infoStyle', 'table'); $sortStyle = get_block_setting($block_id, 'sortStyle', 'alpha'); - $block = get_block_setting($block_id, 'block', true); + $block = get_block_setting($block_id, 'block', true); if ($cfg) { foreach (array('days', 'filter', 'onlyBDM', 'infoStyle', 'sortStyle', 'block') as $name) { if (array_key_exists($name, $cfg)) { - $$name=$cfg[$name]; + $$name = $cfg[$name]; } } } @@ -110,47 +110,47 @@ class upcoming_events_WT_Module extends WT_Module implements WT_Module_Block { /** {@inheritdoc} */ public function configureBlock($block_id) { if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) { - set_block_setting($block_id, 'days', WT_Filter::postInteger('days', 1, 30, 7)); - set_block_setting($block_id, 'filter', WT_Filter::postBool('filter')); - set_block_setting($block_id, 'onlyBDM', WT_Filter::postBool('onlyBDM')); + set_block_setting($block_id, 'days', WT_Filter::postInteger('days', 1, 30, 7)); + set_block_setting($block_id, 'filter', WT_Filter::postBool('filter')); + set_block_setting($block_id, 'onlyBDM', WT_Filter::postBool('onlyBDM')); set_block_setting($block_id, 'infoStyle', WT_Filter::post('infoStyle', 'list|table', 'table')); set_block_setting($block_id, 'sortStyle', WT_Filter::post('sortStyle', 'alpha|anniv', 'alpha')); - set_block_setting($block_id, 'block', WT_Filter::postBool('block')); + set_block_setting($block_id, 'block', WT_Filter::postBool('block')); exit; } - require_once WT_ROOT.'includes/functions/functions_edit.php'; + require_once WT_ROOT . 'includes/functions/functions_edit.php'; - $days=get_block_setting($block_id, 'days', 7); + $days = get_block_setting($block_id, 'days', 7); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Number of days to show'); echo '</td><td class="optionbox">'; echo '<input type="text" name="days" size="2" value="', $days, '">'; - echo ' <em>', WT_I18N::plural('maximum %d day', 'maximum %d days', 30, 30) ,'</em>'; + echo ' <em>', WT_I18N::plural('maximum %d day', 'maximum %d days', 30, 30), '</em>'; echo '</td></tr>'; - $filter=get_block_setting($block_id, 'filter', true); + $filter = get_block_setting($block_id, 'filter', true); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Show only events of living individuals?'); echo '</td><td class="optionbox">'; echo edit_field_yes_no('filter', $filter); echo '</td></tr>'; - $onlyBDM=get_block_setting($block_id, 'onlyBDM', false); + $onlyBDM = get_block_setting($block_id, 'onlyBDM', false); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Show only births, deaths, and marriages?'); echo '</td><td class="optionbox">'; echo edit_field_yes_no('onlyBDM', $onlyBDM); echo '</td></tr>'; - $infoStyle=get_block_setting($block_id, 'infoStyle', 'table'); + $infoStyle = get_block_setting($block_id, 'infoStyle', 'table'); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Presentation style'); echo '</td><td class="optionbox">'; echo select_edit_control('infoStyle', array('list'=>WT_I18N::translate('list'), 'table'=>WT_I18N::translate('table')), null, $infoStyle, ''); echo '</td></tr>'; - $sortStyle=get_block_setting($block_id, 'sortStyle', 'alpha'); + $sortStyle = get_block_setting($block_id, 'sortStyle', 'alpha'); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Sort order'); echo '</td><td class="optionbox">'; @@ -160,7 +160,7 @@ class upcoming_events_WT_Module extends WT_Module implements WT_Module_Block { ), null, $sortStyle, ''); echo '</td></tr>'; - $block=get_block_setting($block_id, 'block', true); + $block = get_block_setting($block_id, 'block', true); echo '<tr><td class="descriptionbox wrap width33">'; echo /* I18N: label for a yes/no option */ WT_I18N::translate('Add a scrollbar when block contents grow'); echo '</td><td class="optionbox">'; diff --git a/modules_v3/user_blog/db_schema/db_schema_0_1.php b/modules_v3/user_blog/db_schema/db_schema_0_1.php index 77926052e4..2da9c187d6 100644 --- a/modules_v3/user_blog/db_schema/db_schema_0_1.php +++ b/modules_v3/user_blog/db_schema/db_schema_0_1.php @@ -29,14 +29,14 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##news` (". - " n_id INTEGER AUTO_INCREMENT NOT NULL,". - " n_username VARCHAR(100) NOT NULL,". - " n_date INTEGER NOT NULL,". - " n_title VARCHAR(255) NOT NULL,". - " n_text TEXT NOT NULL,". - " PRIMARY KEY (n_id),". - " KEY ix1 (n_username)". + "CREATE TABLE IF NOT EXISTS `##news` (" . + " n_id INTEGER AUTO_INCREMENT NOT NULL," . + " n_username VARCHAR(100) NOT NULL," . + " n_date INTEGER NOT NULL," . + " n_title VARCHAR(255) NOT NULL," . + " n_text TEXT NOT NULL," . + " PRIMARY KEY (n_id)," . + " KEY ix1 (n_username)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); diff --git a/modules_v3/user_blog/db_schema/db_schema_1_2.php b/modules_v3/user_blog/db_schema/db_schema_1_2.php index 8645cb333d..49ff47cc47 100644 --- a/modules_v3/user_blog/db_schema/db_schema_1_2.php +++ b/modules_v3/user_blog/db_schema/db_schema_1_2.php @@ -28,11 +28,11 @@ // Add new columns try { WT_DB::exec( - "ALTER TABLE `##news`". - " ADD user_id INTEGER NULL AFTER n_id,". - " ADD gedcom_id INTEGER NULL AFTER user_id,". - " ADD updated TIMESTAMP ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP,". - " ADD KEY news_ix1 (user_id, updated),". + "ALTER TABLE `##news`" . + " ADD user_id INTEGER NULL AFTER n_id," . + " ADD gedcom_id INTEGER NULL AFTER user_id," . + " ADD updated TIMESTAMP ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP," . + " ADD KEY news_ix1 (user_id, updated)," . " ADD KEY news_ix2 (gedcom_id, updated)" ); } catch (PDOException $ex) { @@ -42,9 +42,9 @@ try { // Migrate data from the old columns to the new ones try { WT_DB::exec( - "UPDATE `##news` n". - " LEFT JOIN `##gedcom` g ON (n.n_username=g.gedcom_name)". - " LEFT JOIN `##user` u ON (n.n_username=u.user_name)". + "UPDATE `##news` n" . + " LEFT JOIN `##gedcom` g ON (n.n_username=g.gedcom_name)" . + " LEFT JOIN `##user` u ON (n.n_username=u.user_name)" . " SET n.gedcom_id=g.gedcom_id, n.user_id=u.user_id, updated=FROM_UNIXTIME(n_date)" ); } catch (PDOException $ex) { @@ -63,10 +63,10 @@ try { // Delete/rename old columns try { WT_DB::exec( - "ALTER TABLE `##news`". - " DROP n_username, DROP n_date,". - " CHANGE n_id news_id INTEGER NOT NULL AUTO_INCREMENT,". - " CHANGE n_title subject VARCHAR(255) COLLATE utf8_unicode_ci,". + "ALTER TABLE `##news`" . + " DROP n_username, DROP n_date," . + " CHANGE n_id news_id INTEGER NOT NULL AUTO_INCREMENT," . + " CHANGE n_title subject VARCHAR(255) COLLATE utf8_unicode_ci," . " CHANGE n_text body TEXT COLLATE utf8_unicode_ci" ); } catch (PDOException $ex) { diff --git a/modules_v3/user_blog/db_schema/db_schema_2_3.php b/modules_v3/user_blog/db_schema/db_schema_2_3.php index ac0162503f..8136ba7661 100644 --- a/modules_v3/user_blog/db_schema/db_schema_2_3.php +++ b/modules_v3/user_blog/db_schema/db_schema_2_3.php @@ -28,16 +28,16 @@ // Delete any data that might violate the new constraints WT_DB::exec( - "DELETE FROM `##news`". - " WHERE user_id NOT IN (SELECT user_id FROM `##user` )". + "DELETE FROM `##news`" . + " WHERE user_id NOT IN (SELECT user_id FROM `##user` )" . " OR gedcom_id NOT IN (SELECT gedcom_id FROM `##gedcom`)" ); // Add the new constraints try { WT_DB::exec( - "ALTER TABLE `##news`". - " ADD FOREIGN KEY news_fk1 (user_id ) REFERENCES `##user` (user_id) ON DELETE CASCADE,". + "ALTER TABLE `##news`" . + " ADD FOREIGN KEY news_fk1 (user_id ) REFERENCES `##user` (user_id) ON DELETE CASCADE," . " ADD FOREIGN KEY news_fk2 (gedcom_id) REFERENCES `##gedcom` (gedcom_id) ON DELETE CASCADE" ); } catch (PDOException $ex) { diff --git a/modules_v3/user_blog/module.php b/modules_v3/user_blog/module.php index 321c295fda..45b137ef74 100644 --- a/modules_v3/user_blog/module.php +++ b/modules_v3/user_blog/module.php @@ -86,7 +86,7 @@ class user_blog_WT_Module extends WT_Module implements WT_Module_Block { } $content .= $news->body . '<br><br>'; $content .= '<a href="#" onclick="window.open(\'editnews.php?news_id=\'+' . $news->news_id . ', \'_blank\', indx_window_specs); return false;">' . WT_I18N::translate('Edit') . '</a> | '; - $content .= '<a href="index.php?action=deletenews&news_id=' . $news->news_id . '&ctype=' . $ctype .'" onclick="return confirm(\'' . WT_I18N::translate('Are you sure you want to delete this journal entry?') . "');\">" . WT_I18N::translate('Delete') . '</a><br>'; + $content .= '<a href="index.php?action=deletenews&news_id=' . $news->news_id . '&ctype=' . $ctype . '" onclick="return confirm(\'' . WT_I18N::translate('Are you sure you want to delete this journal entry?') . "');\">" . WT_I18N::translate('Delete') . '</a><br>'; $content .= "</div><br>"; } $content .= '<br><a href="#" onclick="window.open(\'editnews.php?user_id=' . Auth::id() . '\', \'_blank\', indx_window_specs); return false;">' . WT_I18N::translate('Add a new journal entry') . '</a>'; diff --git a/modules_v3/user_favorites/module.php b/modules_v3/user_favorites/module.php index 26fe380f5a..bbc081ac68 100644 --- a/modules_v3/user_favorites/module.php +++ b/modules_v3/user_favorites/module.php @@ -55,7 +55,7 @@ class user_favorites_WT_Module extends gedcom_favorites_WT_Module { return WT_DB::prepare( - "SELECT SQL_CACHE favorite_id AS id, user_id, gedcom_id, xref AS gid, favorite_type AS type, title AS title, note AS note, url AS url". + "SELECT SQL_CACHE favorite_id AS id, user_id, gedcom_id, xref AS gid, favorite_type AS type, title AS title, note AS note, url AS url" . " FROM `##favorite` WHERE user_id=? AND gedcom_id=?") ->execute(array($user_id, WT_GED_ID)) ->fetchAll(PDO::FETCH_ASSOC); @@ -63,7 +63,7 @@ class user_favorites_WT_Module extends gedcom_favorites_WT_Module { /** {@inheritdoc} */ public function modAction($modAction) { - switch($modAction) { + switch ($modAction) { case 'menu-add-favorite': // Process the "add to user favorites" menu item on indi/fam/etc. pages $record = WT_GedcomRecord::getInstance(WT_Filter::post('xref', WT_REGEX_XREF)); diff --git a/modules_v3/user_messages/module.php b/modules_v3/user_messages/module.php index e94ee78513..89e285d09b 100644 --- a/modules_v3/user_messages/module.php +++ b/modules_v3/user_messages/module.php @@ -65,7 +65,7 @@ class user_messages_WT_Module extends WT_Module implements WT_Module_Block { $id = $this->getName() . $block_id; $class = $this->getName() . '_block'; $title = WT_I18N::plural('%s message', '%s messages', $count, WT_I18N::number($count)); - $users = array_filter(User::all(), function(User $user){ + $users = array_filter(User::all(), function(User $user) { return $user->getUserId() !== Auth::id() && $user->getPreference('verified_by_admin') && $user->getPreference('contactmethod') !== 'none'; }); @@ -105,7 +105,7 @@ class user_messages_WT_Module extends WT_Module implements WT_Module_Block { $content .= '</tr>'; $content .= '<tr><td class="list_value_wrap" colspan="4"><div id="message' . $message->message_id . '" style="display:none;">'; $content .= '<div dir="auto" style="white-space: pre-wrap;">' . WT_Filter::expandUrls($message->body) . '</div><br>'; - if (strpos($message->subject, /* I18N: When replying to an email, the subject becomes “RE: <subject>” */ WT_I18N::translate('RE: '))!==0) { + if (strpos($message->subject, /* I18N: When replying to an email, the subject becomes “RE: <subject>” */ WT_I18N::translate('RE: ')) !== 0) { $message->subject = WT_I18N::translate('RE: ') . $message->subject; } if ($user) { diff --git a/modules_v3/user_welcome/module.php b/modules_v3/user_welcome/module.php index 7831cd9c8e..77123aeb96 100644 --- a/modules_v3/user_welcome/module.php +++ b/modules_v3/user_welcome/module.php @@ -37,17 +37,17 @@ class user_welcome_WT_Module extends WT_Module implements WT_Module_Block { } /** {@inheritdoc} */ - public function getBlock($block_id, $template=true, $cfg=null) { - $id=$this->getName().$block_id; - $class=$this->getName().'_block'; + public function getBlock($block_id, $template = true, $cfg = null) { + $id = $this->getName() . $block_id; + $class = $this->getName() . '_block'; $title = '<span dir="auto">' . /* I18N: A greeting; %s is the user’s name */ WT_I18N::translate('Welcome %s', Auth::user()->getRealName()) . '</span>'; $content = '<table><tr>'; if (Auth::user()->getPreference('editaccount')) { - $content .= '<td><a href="edituser.php"><i class="icon-mypage"></i><br>'.WT_I18N::translate('My account').'</a></td>'; + $content .= '<td><a href="edituser.php"><i class="icon-mypage"></i><br>' . WT_I18N::translate('My account') . '</a></td>'; } if (WT_USER_GEDCOM_ID) { - $content .= '<td><a href="pedigree.php?rootid='.WT_USER_GEDCOM_ID.'&ged='.WT_GEDURL.'"><i class="icon-pedigree"></i><br>'.WT_I18N::translate('My pedigree').'</a></td>'; - $content .= '<td><a href="individual.php?pid='.WT_USER_GEDCOM_ID.'&ged='.WT_GEDURL.'"><i class="icon-indis"></i><br>'.WT_I18N::translate('My individual record').'</a></td>'; + $content .= '<td><a href="pedigree.php?rootid=' . WT_USER_GEDCOM_ID . '&ged=' . WT_GEDURL . '"><i class="icon-pedigree"></i><br>' . WT_I18N::translate('My pedigree') . '</a></td>'; + $content .= '<td><a href="individual.php?pid=' . WT_USER_GEDCOM_ID . '&ged=' . WT_GEDURL . '"><i class="icon-indis"></i><br>' . WT_I18N::translate('My individual record') . '</a></td>'; } $content .= '</tr></table>'; diff --git a/modules_v3/yahrzeit/help_text.php b/modules_v3/yahrzeit/help_text.php index 3c9d9e39a2..78f354dac0 100644 --- a/modules_v3/yahrzeit/help_text.php +++ b/modules_v3/yahrzeit/help_text.php @@ -21,7 +21,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -if (!defined('WT_WEBTREES') || !defined('WT_SCRIPT_NAME') || WT_SCRIPT_NAME!='help_text.php') { +if (!defined('WT_WEBTREES') || !defined('WT_SCRIPT_NAME') || WT_SCRIPT_NAME != 'help_text.php') { header('HTTP/1.0 403 Forbidden'); exit; } diff --git a/modules_v3/yahrzeit/module.php b/modules_v3/yahrzeit/module.php index ade6462c05..b46382e8eb 100644 --- a/modules_v3/yahrzeit/module.php +++ b/modules_v3/yahrzeit/module.php @@ -39,18 +39,18 @@ class yahrzeit_WT_Module extends WT_Module implements WT_Module_Block { } /** {@inheritdoc} */ - public function getBlock($block_id, $template=true, $cfg=null) { + public function getBlock($block_id, $template = true, $cfg = null) { global $ctype, $controller; - $days = get_block_setting($block_id, 'days', 7); + $days = get_block_setting($block_id, 'days', 7); $infoStyle = get_block_setting($block_id, 'infoStyle', 'table'); - $calendar = get_block_setting($block_id, 'calendar', 'jewish'); - $block = get_block_setting($block_id, 'block', true); + $calendar = get_block_setting($block_id, 'calendar', 'jewish'); + $block = get_block_setting($block_id, 'block', true); if ($cfg) { foreach (array('days', 'infoStyle', 'block') as $name) { if (array_key_exists($name, $cfg)) { - $$name=$cfg[$name]; + $$name = $cfg[$name]; } } } @@ -61,24 +61,24 @@ class yahrzeit_WT_Module extends WT_Module implements WT_Module_Block { $id = $this->getName() . $block_id; $class = $this->getName() . '_block'; if ($ctype === 'gedcom' && WT_USER_GEDCOM_ADMIN || $ctype === 'user' && Auth::check()) { - $title = '<i class="icon-admin" title="'.WT_I18N::translate('Configure').'" onclick="modalDialog(\'block_edit.php?block_id='.$block_id.'\', \''.$this->getTitle().'\');"></i>'; + $title = '<i class="icon-admin" title="' . WT_I18N::translate('Configure') . '" onclick="modalDialog(\'block_edit.php?block_id=' . $block_id . '\', \'' . $this->getTitle() . '\');"></i>'; } else { $title = ''; } $title .= $this->getTitle(); - $content=''; + $content = ''; // The standard anniversary rules cover most of the Yahrzeit rules, we just // need to handle a few special cases. // Fetch normal anniversaries... - $yahrzeits=array(); - for ($jd=$startjd-1; $jd<=$endjd+$days; ++$jd) { + $yahrzeits = array(); + for ($jd = $startjd - 1; $jd <= $endjd + $days; ++$jd) { foreach (get_anniversary_events($jd, 'DEAT _YART') as $fact) { // Exact hebrew dates only $date = $fact->getDate(); - if ($date->MinDate() instanceof WT_Date_Jewish && $date->MinJD()==$date->MaxJD()) { + if ($date->MinDate() instanceof WT_Date_Jewish && $date->MinJD() == $date->MaxJD()) { $fact->jd = $jd; - $yahrzeits[]=$fact; + $yahrzeits[] = $fact; } } } @@ -88,22 +88,22 @@ class yahrzeit_WT_Module extends WT_Module implements WT_Module_Block { foreach ($yahrzeits as $yahrzeit) { if ($yahrzeit->getTag() === 'DEAT') { - $today=new WT_Date_Jewish($yahrzeit->jd); - $hd=$yahrzeit->getDate()->MinDate(); - $hd1=new WT_Date_Jewish($hd); - $hd1->y+=1; + $today = new WT_Date_Jewish($yahrzeit->jd); + $hd = $yahrzeit->getDate()->MinDate(); + $hd1 = new WT_Date_Jewish($hd); + $hd1->y += 1; $hd1->setJdFromYmd(); // Special rules. See http://www.hebcal.com/help/anniv.html // Everything else is taken care of by our standard anniversary rules. - if ($hd->d==30 && $hd->m==2 && $hd->y!=0 && $hd1->daysInMonth()<30) { + if ($hd->d == 30 && $hd->m == 2 && $hd->y != 0 && $hd1->daysInMonth() < 30) { // 30 CSH - Last day in CSH - $yahrzeit->jd = $jewish_calendar->ymdToJd($today->y, 3, 1)-1; - } elseif ($hd->d==30 && $hd->m==3 && $hd->y!=0 && $hd1->daysInMonth()<30) { + $yahrzeit->jd = $jewish_calendar->ymdToJd($today->y, 3, 1) - 1; + } elseif ($hd->d == 30 && $hd->m == 3 && $hd->y != 0 && $hd1->daysInMonth() < 30) { // 30 KSL - Last day in KSL - $yahrzeit->jd = $jewish_calendar->ymdToJd($today->y, 4, 1)-1; - } elseif ($hd->d==30 && $hd->m==6 && $hd->y!=0 && $today->daysInMonth()<30 && !$today->isLeapYear()) { + $yahrzeit->jd = $jewish_calendar->ymdToJd($today->y, 4, 1) - 1; + } elseif ($hd->d == 30 && $hd->m == 6 && $hd->y != 0 && $today->daysInMonth() < 30 && !$today->isLeapYear()) { // 30 ADR - Last day in SHV - $yahrzeit->jd = $jewish_calendar->ymdToJd($today->y, 6, 1)-1; + $yahrzeit->jd = $jewish_calendar->ymdToJd($today->y, 6, 1) - 1; } } } @@ -111,12 +111,12 @@ class yahrzeit_WT_Module extends WT_Module implements WT_Module_Block { switch ($infoStyle) { case 'list': foreach ($yahrzeits as $yahrzeit) - if ($yahrzeit->jd >= $startjd && $yahrzeit->jd < $startjd+$days) { - $ind=$yahrzeit->getParent(); - $content .= "<a href=\"".$ind->getHtmlUrl()."\" class=\"list_item name2\">".$ind->getFullName()."</a>".$ind->getSexImage(); + if ($yahrzeit->jd >= $startjd && $yahrzeit->jd < $startjd + $days) { + $ind = $yahrzeit->getParent(); + $content .= "<a href=\"" . $ind->getHtmlUrl() . "\" class=\"list_item name2\">" . $ind->getFullName() . "</a>" . $ind->getSexImage(); $content .= "<div class=\"indent\">"; $content .= $yahrzeit->getDate()->Display(true); - $content .= ', '.WT_I18N::translate('%s year anniversary', $yahrzeit->anniv); + $content .= ', ' . WT_I18N::translate('%s year anniversary', $yahrzeit->anniv); $content .= "</div>"; } break; @@ -126,9 +126,9 @@ class yahrzeit_WT_Module extends WT_Module implements WT_Module_Block { $controller ->addExternalJavascript(WT_JQUERY_DATATABLES_URL) ->addInlineJavascript(' - jQuery("#'.$table_id.'").dataTable({ + jQuery("#'.$table_id . '").dataTable({ dom: \'t\', - '.WT_I18N::datatablesI18N().', + '.WT_I18N::datatablesI18N() . ', autoWidth: false, paginate: false, lengthChange: false, @@ -146,59 +146,59 @@ class yahrzeit_WT_Module extends WT_Module implements WT_Module_Block { /* 6-YART */ { visible: false } ] }); - jQuery("#'.$table_id.'").css("visibility", "visible"); + jQuery("#'.$table_id . '").css("visibility", "visible"); jQuery(".loading-image").css("display", "none"); '); - $content=''; + $content = ''; $content .= '<div class="loading-image"> </div>'; - $content .= '<table id="'.$table_id.'" class="width100" style="visibility:hidden;">'; + $content .= '<table id="' . $table_id . '" class="width100" style="visibility:hidden;">'; $content .= '<thead><tr>'; - $content .= '<th>'.WT_Gedcom_Tag::getLabel('NAME').'</th>'; - $content .= '<th>'.WT_Gedcom_Tag::getLabel('NAME').'</th>'; - $content .= '<th>'.WT_Gedcom_Tag::getLabel('DEAT').'</th>'; + $content .= '<th>' . WT_Gedcom_Tag::getLabel('NAME') . '</th>'; + $content .= '<th>' . WT_Gedcom_Tag::getLabel('NAME') . '</th>'; + $content .= '<th>' . WT_Gedcom_Tag::getLabel('DEAT') . '</th>'; $content .= '<th>DEAT</th>'; - $content .= '<th><i class="icon-reminder" title="'.WT_I18N::translate('Anniversary').'"></i></th>'; - $content .= '<th>'.WT_Gedcom_Tag::getLabel('_YART').'</th>'; + $content .= '<th><i class="icon-reminder" title="' . WT_I18N::translate('Anniversary') . '"></i></th>'; + $content .= '<th>' . WT_Gedcom_Tag::getLabel('_YART') . '</th>'; $content .= '<th>_YART</th>'; $content .= '</tr></thead><tbody>'; foreach ($yahrzeits as $yahrzeit) { - if ($yahrzeit->jd >= $startjd && $yahrzeit->jd < $startjd+$days) { + if ($yahrzeit->jd >= $startjd && $yahrzeit->jd < $startjd + $days) { $content .= '<tr>'; - $ind=$yahrzeit->getParent(); + $ind = $yahrzeit->getParent(); // Individual name(s) - $name=$ind->getFullName(); - $url=$ind->getHtmlUrl(); + $name = $ind->getFullName(); + $url = $ind->getHtmlUrl(); $content .= '<td>'; - $content .= '<a href="'.$url.'">'.$name.'</a>'; + $content .= '<a href="' . $url . '">' . $name . '</a>'; $content .= $ind->getSexImage(); - $addname=$ind->getAddName(); + $addname = $ind->getAddName(); if ($addname) { - $content .= '<br><a href="'.$url.'">'.$addname.'</a>'; + $content .= '<br><a href="' . $url . '">' . $addname . '</a>'; } $content .= '</td>'; - $content .= '<td>'.$ind->getSortName().'</td>'; + $content .= '<td>' . $ind->getSortName() . '</td>'; // death/yahrzeit event date - $content .= '<td>'.$yahrzeit->getDate()->Display().'</td>'; - $content .= '<td>'.$yahrzeit->getDate()->minJD().'</td>';// sortable date + $content .= '<td>' . $yahrzeit->getDate()->Display() . '</td>'; + $content .= '<td>' . $yahrzeit->getDate()->minJD() . '</td>'; // sortable date // Anniversary - $content .= '<td>'.$yahrzeit->anniv.'</td>'; + $content .= '<td>' . $yahrzeit->anniv . '</td>'; // upcomming yahrzeit dates switch ($calendar) { case 'gregorian': - $today=new WT_Date_Gregorian($yahrzeit->jd); + $today = new WT_Date_Gregorian($yahrzeit->jd); break; case 'jewish': default: - $today=new WT_Date_Jewish($yahrzeit->jd); + $today = new WT_Date_Jewish($yahrzeit->jd); break; } - $td=new WT_Date($today->format('%@ %A %O %E')); - $content .= '<td>'.$td->display().'</td>'; - $content .= '<td>'.$td->minJD().'</td>';// sortable date + $td = new WT_Date($today->format('%@ %A %O %E')); + $content .= '<td>' . $td->display() . '</td>'; + $content .= '<td>' . $td->minJD() . '</td>'; // sortable date $content .= '</tr>'; } @@ -236,31 +236,31 @@ class yahrzeit_WT_Module extends WT_Module implements WT_Module_Block { /** {@inheritdoc} */ public function configureBlock($block_id) { if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) { - set_block_setting($block_id, 'days', WT_Filter::postInteger('days', 1, 30, 7)); + set_block_setting($block_id, 'days', WT_Filter::postInteger('days', 1, 30, 7)); set_block_setting($block_id, 'infoStyle', WT_Filter::post('infoStyle', 'list|table', 'table')); - set_block_setting($block_id, 'calendar', WT_Filter::post('calendar', 'jewish|gregorian', 'jewish')); - set_block_setting($block_id, 'block', WT_Filter::postBool('block')); + set_block_setting($block_id, 'calendar', WT_Filter::post('calendar', 'jewish|gregorian', 'jewish')); + set_block_setting($block_id, 'block', WT_Filter::postBool('block')); exit; } - require_once WT_ROOT.'includes/functions/functions_edit.php'; + require_once WT_ROOT . 'includes/functions/functions_edit.php'; - $days=get_block_setting($block_id, 'days', 7); + $days = get_block_setting($block_id, 'days', 7); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Number of days to show'); echo '</td><td class="optionbox">'; - echo '<input type="text" name="days" size="2" value="'.$days.'">'; - echo ' <em>', WT_I18N::plural('maximum %d day', 'maximum %d days', 30, 30) ,'</em>'; + echo '<input type="text" name="days" size="2" value="' . $days . '">'; + echo ' <em>', WT_I18N::plural('maximum %d day', 'maximum %d days', 30, 30), '</em>'; echo '</td></tr>'; - $infoStyle=get_block_setting($block_id, 'infoStyle', 'table'); + $infoStyle = get_block_setting($block_id, 'infoStyle', 'table'); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Presentation style'); echo '</td><td class="optionbox">'; echo select_edit_control('infoStyle', array('list'=>WT_I18N::translate('list'), 'table'=>WT_I18N::translate('table')), null, $infoStyle, ''); echo '</td></tr>'; - $calendar=get_block_setting($block_id, 'calendar'); + $calendar = get_block_setting($block_id, 'calendar'); echo '<tr><td class="descriptionbox wrap width33">'; echo WT_I18N::translate('Calendar'); echo '</td><td class="optionbox">'; @@ -270,7 +270,7 @@ class yahrzeit_WT_Module extends WT_Module implements WT_Module_Block { ), null, $calendar, ''); echo '</td></tr>'; - $block=get_block_setting($block_id, 'block', true); + $block = get_block_setting($block_id, 'block', true); echo '<tr><td class="descriptionbox wrap width33">'; echo /* I18N: label for a yes/no option */ WT_I18N::translate('Add a scrollbar when block contents grow'); echo '</td><td class="optionbox">'; @@ -24,7 +24,7 @@ define('WT_SCRIPT_NAME', 'note.php'); require './includes/session.php'; -require_once WT_ROOT.'includes/functions/functions_print_lists.php'; +require_once WT_ROOT . 'includes/functions/functions_print_lists.php'; $controller = new WT_Controller_Note; @@ -36,8 +36,8 @@ if ($controller->record && $controller->record->canShow()) { '<p class="ui-state-highlight">', /* I18N: %1$s is “accept”, %2$s is “reject”. These are links. */ WT_I18N::translate( 'This note has been deleted. You should review the deletion and then %1$s or %2$s it.', - '<a href="#" onclick="accept_changes(\''.$controller->record->getXref().'\');">' . WT_I18N::translate_c('You should review the deletion and then accept or reject it.', 'accept') . '</a>', - '<a href="#" onclick="reject_changes(\''.$controller->record->getXref().'\');">' . WT_I18N::translate_c('You should review the deletion and then accept or reject it.', 'reject') . '</a>' + '<a href="#" onclick="accept_changes(\'' . $controller->record->getXref() . '\');">' . WT_I18N::translate_c('You should review the deletion and then accept or reject it.', 'accept') . '</a>', + '<a href="#" onclick="reject_changes(\'' . $controller->record->getXref() . '\');">' . WT_I18N::translate_c('You should review the deletion and then accept or reject it.', 'reject') . '</a>' ), ' ', help_link('pending_changes'), '</p>'; @@ -54,8 +54,8 @@ if ($controller->record && $controller->record->canShow()) { '<p class="ui-state-highlight">', /* I18N: %1$s is “accept”, %2$s is “reject”. These are links. */ WT_I18N::translate( 'This note has been edited. You should review the changes and then %1$s or %2$s them.', - '<a href="#" onclick="accept_changes(\''.$controller->record->getXref().'\');">' . WT_I18N::translate_c('You should review the changes and then accept or reject them.', 'accept') . '</a>', - '<a href="#" onclick="reject_changes(\''.$controller->record->getXref().'\');">' . WT_I18N::translate_c('You should review the changes and then accept or reject them.', 'reject') . '</a>' + '<a href="#" onclick="accept_changes(\'' . $controller->record->getXref() . '\');">' . WT_I18N::translate_c('You should review the changes and then accept or reject them.', 'accept') . '</a>', + '<a href="#" onclick="reject_changes(\'' . $controller->record->getXref() . '\');">' . WT_I18N::translate_c('You should review the changes and then accept or reject them.', 'reject') . '</a>' ), ' ', help_link('pending_changes'), '</p>'; @@ -68,7 +68,7 @@ if ($controller->record && $controller->record->canShow()) { } } } else { - header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found'); + header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'); $controller->pageHeader(); echo '<p class="ui-state-error">', WT_I18N::translate('This note does not exist or you do not have permission to view it.'), '</p>'; exit; diff --git a/notelist.php b/notelist.php index 68c4832cc6..f17dacbad8 100644 --- a/notelist.php +++ b/notelist.php @@ -23,7 +23,7 @@ define('WT_SCRIPT_NAME', 'notelist.php'); require './includes/session.php'; -require_once WT_ROOT.'includes/functions/functions_print_lists.php'; +require_once WT_ROOT . 'includes/functions/functions_print_lists.php'; $controller = new WT_Controller_Page; $controller->setPageTitle(WT_I18N::translate('Shared notes')); diff --git a/pedigree.php b/pedigree.php index f1c5516c4f..04bbb9e7b5 100644 --- a/pedigree.php +++ b/pedigree.php @@ -26,9 +26,9 @@ require './includes/session.php'; require WT_ROOT . 'includes/functions/functions_edit.php'; define("ARROW_WRAPPER", "<div class='ancestorarrow' style='%s:%spx; top:%spx;'>"); -define("MENU_WRAPPER" , "<div id='childarrow' style='%s:%spx; top:%spx'><div><a href='#' class='menuselect %s'></a><div id='childbox'>"); -define("MENU_ITEM" , "<a href='pedigree.php?rootid=%s&show_full=%s&PEDIGREE_GENERATIONS=%s&talloffset=%s' class='%s'>%s</a>"); -define("BOX_WRAPPER" , "<div class='shadow' style='%s:%spx; top:%spx; width:%spx; height:%spx'>"); +define("MENU_WRAPPER", "<div id='childarrow' style='%s:%spx; top:%spx'><div><a href='#' class='menuselect %s'></a><div id='childbox'>"); +define("MENU_ITEM", "<a href='pedigree.php?rootid=%s&show_full=%s&PEDIGREE_GENERATIONS=%s&talloffset=%s' class='%s'>%s</a>"); +define("BOX_WRAPPER", "<div class='shadow' style='%s:%spx; top:%spx; width:%spx; height:%spx'>"); $controller = new WT_Controller_Pedigree; $controller @@ -95,7 +95,7 @@ echo '<div id="pedigree_chart" class="layout', $talloffset, '">'; //-- echo the boxes $curgen = 1; $xoffset = 0; -$yoffset = 0; // -- used to offset the position of each box as it is generated +$yoffset = 0; // -- used to offset the position of each box as it is generated $prevxoffset = 0; // -- used to track the horizontal x position of the previous box $prevyoffset = 0; // -- used to track the vertical y position of the previous box $maxyoffset = 0; @@ -107,7 +107,7 @@ for ($i = ($controller->treesize - 1); $i >= 0; $i--) { $lineDrawx[$i] = $xoffset; $lineDrawy[$i] = $yoffset - 200; // 200 adjustment necessary to move canvas below menus and options. Matched to similar amount on canvas style. // -- check to see if we have moved to the next generation - if ($i < (int)($controller->treesize / (pow(2, $curgen)))) { + if ($i < (int) ($controller->treesize / (pow(2, $curgen)))) { $curgen++; } $prevxoffset = $xoffset; @@ -130,9 +130,9 @@ for ($i = ($controller->treesize - 1); $i >= 0; $i--) { if ($talloffset == 2) { // oldest at top if ($can_go_back) { - printf(ARROW_WRAPPER, $posn, $xoffset + $controller->pbwidth / 2, $yoffset-22); + printf(ARROW_WRAPPER, $posn, $xoffset + $controller->pbwidth / 2, $yoffset - 22); $did = 1; - if ($i > (int)($controller->treesize / 2) + (int)($controller->treesize / 4)) { + if ($i > (int) ($controller->treesize / 2) + (int) ($controller->treesize / 4)) { $did++; } printf(MENU_ITEM, $controller->ancestors[$did]->getXref(), $controller->show_full, $controller->PEDIGREE_GENERATIONS, $talloffset, 'icon-uarrow noprint', ''); @@ -154,7 +154,7 @@ for ($i = ($controller->treesize - 1); $i >= 0; $i--) { print_pedigree_person($controller->ancestors[$i]); if ($can_go_back) { $did = 1; - if ($i > (int)($controller->treesize / 2) + (int)($controller->treesize / 4)) { + if ($i > (int) ($controller->treesize / 2) + (int) ($controller->treesize / 4)) { $did++; } if ($TEXT_DIRECTION == "rtl") { @@ -163,11 +163,11 @@ for ($i = ($controller->treesize - 1); $i >= 0; $i--) { $arrow = 'icon-rarrow'; } if ($talloffset == 3) { - printf(ARROW_WRAPPER, $posn, $controller->pbwidth / 2, $controller->pbheight+5); + printf(ARROW_WRAPPER, $posn, $controller->pbwidth / 2, $controller->pbheight + 5); printf(MENU_ITEM, $controller->ancestors[$did]->getXref(), $controller->show_full, $controller->PEDIGREE_GENERATIONS, $talloffset, 'icon-darrow noprint', ''); echo '</div>'; } elseif ($talloffset < 2) { - printf(ARROW_WRAPPER, $posn, $controller->pbwidth +5, $controller->pbheight / 2 - 10); + printf(ARROW_WRAPPER, $posn, $controller->pbwidth + 5, $controller->pbheight / 2 - 10); printf(MENU_ITEM, $controller->ancestors[$did]->getXref(), $controller->show_full, $controller->PEDIGREE_GENERATIONS, $talloffset, "$arrow noprint", ''); echo '</div>'; } @@ -222,7 +222,7 @@ if (count($famids) > 0) { //-- echo the siblings foreach ($cfamids as $family) { if ($family != null) { - $siblings = array_filter($family->getChildren(), function (WT_Individual $item) use ($controller) { + $siblings = array_filter($family->getChildren(), function(WT_Individual $item) use ($controller) { return $controller->rootid != $item->getXref(); }); $num = count($siblings); @@ -247,7 +247,7 @@ if ($talloffset < 2) { } else { $canvaswidth = pow(2, $PEDIGREE_GENERATIONS - 1) * ($controller->pbwidth + 20); } -echo '<canvas id="pedigree_canvas" width="' . (int)($canvaswidth) . '" height="' . (int)($maxyoffset) . '"><p>No lines between boxes? Unfortunately your browser does not support the HTML5 canvas feature.</p></canvas>'; +echo '<canvas id="pedigree_canvas" width="' . (int) ($canvaswidth) . '" height="' . (int) ($maxyoffset) . '"><p>No lines between boxes? Unfortunately your browser does not support the HTML5 canvas feature.</p></canvas>'; echo '</div>'; //close #pedigree_chart echo '</div>'; //close #pedigree-page diff --git a/placelist.php b/placelist.php index 9b67c476a8..fd221c2cf3 100644 --- a/placelist.php +++ b/placelist.php @@ -23,17 +23,17 @@ define('WT_SCRIPT_NAME', 'placelist.php'); require './includes/session.php'; -require_once WT_ROOT.'includes/functions/functions_print_lists.php'; +require_once WT_ROOT . 'includes/functions/functions_print_lists.php'; $controller = new WT_Controller_Page; -$action = WT_Filter::get('action', 'find|show', 'find'); +$action = WT_Filter::get('action', 'find|show', 'find'); $display = WT_Filter::get('display', 'hierarchy|list', 'hierarchy'); $parent = WT_Filter::getArray('parent'); -$level=count($parent); +$level = count($parent); -if ($display=='hierarchy') { +if ($display == 'hierarchy') { if ($level) { $controller->setPageTitle(WT_I18N::translate('Place hierarchy') . ' - <span dir="auto">' . WT_Filter::escapeHtml(end($parent)) . '</span>'); } else { @@ -50,27 +50,27 @@ echo '<div id="place-hierarchy">'; switch ($display) { case 'list': echo '<h2>', $controller->getPageTitle(), '</h2>'; - $list_places=WT_Place::allPlaces(WT_GED_ID); - $num_places=count($list_places); + $list_places = WT_Place::allPlaces(WT_GED_ID); + $num_places = count($list_places); - if ($num_places==0) { + if ($num_places == 0) { echo '<b>', WT_I18N::translate('No results found.'), '</b><br>'; } else { echo '<table class="list_table">'; echo '<tr><td class="list_label" '; - echo ' colspan="', $num_places>20 ? 3 : 2, '"><i class="icon-place"></i> '; + echo ' colspan="', $num_places > 20 ? 3 : 2, '"><i class="icon-place"></i> '; echo WT_I18N::translate('Place list'); echo '</td></tr><tr><td class="list_value_wrap"><ul>'; foreach ($list_places as $n=>$list_place) { echo '<li><a href="', $list_place->getURL(), '">', $list_place->getReverseName(), '</a></li>'; if ($num_places > 20) { - if ($n == (int)($num_places / 3)) { + if ($n == (int) ($num_places / 3)) { echo '</ul></td><td class="list_value_wrap"><ul>'; } - if ($n == (int)(($num_places / 3) * 2)) { + if ($n == (int) (($num_places / 3) * 2)) { echo '</ul></td><td class="list_value_wrap"><ul>'; } - } elseif ($n == (int)($num_places/2)) { + } elseif ($n == (int) ($num_places / 2)) { echo '</ul></td><td class="list_value_wrap"><ul>'; } } @@ -88,37 +88,37 @@ case 'hierarchy': } // Find this place and its ID - $place=new WT_Place(implode(', ', array_reverse($parent)), WT_GED_ID); - $place_id=$place->getPlaceId(); + $place = new WT_Place(implode(', ', array_reverse($parent)), WT_GED_ID); + $place_id = $place->getPlaceId(); - $child_places=$place->getChildPlaces(); + $child_places = $place->getChildPlaces(); - $numfound=count($child_places); + $numfound = count($child_places); //-- if the number of places found is 0 then automatically redirect to search page - if ($numfound==0) { - $action='show'; + if ($numfound == 0) { + $action = 'show'; } echo '<h2>', $controller->getPageTitle(); // Breadcrumbs if ($place_id) { - $parent_place=$place->getParentPlace(); + $parent_place = $place->getParentPlace(); while ($parent_place->getPlaceId()) { echo ', <a href="', $parent_place->getURL(), '" dir="auto">', $parent_place->getPlaceName(), '</a>'; - $parent_place=$parent_place->getParentPlace(); + $parent_place = $parent_place->getParentPlace(); } echo ', <a href="', WT_SCRIPT_NAME, '">', WT_I18N::translate('Top level'), '</a>'; } echo '</h2>'; if ($gm_module && $gm_module->getSetting('GM_PLACE_HIERARCHY')) { - $linklevels=''; - $placelevels=''; - $place_names=array(); - for ($j=0; $j<$level; $j++) { - $linklevels .= '&parent['.$j.']='.rawurlencode($parent[$j]); - if ($parent[$j]=='') { + $linklevels = ''; + $placelevels = ''; + $place_names = array(); + for ($j = 0; $j < $level; $j++) { + $linklevels .= '&parent[' . $j . ']=' . rawurlencode($parent[$j]); + if ($parent[$j] == '') { $placelevels = ', ' . WT_I18N::translate('unknown') . $placelevels; } else { $placelevels = ', ' . $parent[$j] . $placelevels; @@ -132,7 +132,7 @@ case 'hierarchy': // -- echo the array foreach ($child_places as $n => $child_place) { - if ($n==0) { + if ($n == 0) { echo '<table id="place_hierarchy" class="list_table"><tr><td class="list_label" '; if ($numfound > 20) { echo 'colspan="3"'; @@ -150,24 +150,24 @@ case 'hierarchy': echo '<li><a href="', $child_place->getURL(), '" class="list_item">', $child_place->getPlaceName(), '</a></li>'; if ($gm_module && $gm_module->getSetting('GM_PLACE_HIERARCHY')) { - list($tmp) = explode(', ', $child_place->getGedcomName(), 2); - $place_names[$n]=$tmp; + list($tmp) = explode(', ', $child_place->getGedcomName(), 2); + $place_names[$n] = $tmp; } $n++; if ($numfound > 20) { - if ($n == (int)($numfound / 3)) { + if ($n == (int) ($numfound / 3)) { echo '</ul></td><td class="list_value"><ul>'; } - if ($n == (int)(($numfound / 3) * 2)) { + if ($n == (int) (($numfound / 3) * 2)) { echo '</ul></td><td class="list_value"><ul>'; } - } elseif ($numfound > 4 && $n == (int)($numfound / 2)) { + } elseif ($numfound > 4 && $n == (int) ($numfound / 2)) { echo '</ul></td><td class="list_value"><ul>'; } } if ($child_places) { echo '</ul></td></tr>'; - if ($action=='find' && $place_id) { + if ($action == 'find' && $place_id) { echo '<tr><td class="list_label" '; if ($numfound > 20) { echo 'colspan="3"'; @@ -190,24 +190,24 @@ case 'hierarchy': echo '</table>'; } echo '</td></tr></table>'; - if ($place_id && $action=='show') { + if ($place_id && $action == 'show') { // -- array of names $myindilist = array(); $myfamlist = array(); - $positions= + $positions = WT_DB::prepare("SELECT DISTINCT pl_gid FROM `##placelinks` WHERE pl_p_id=? AND pl_file=?") ->execute(array($place_id, WT_GED_ID)) ->fetchOneColumn(); foreach ($positions as $position) { - $record=WT_GedcomRecord::getInstance($position); + $record = WT_GedcomRecord::getInstance($position); if ($record && $record->canShow()) { if ($record instanceof WT_Individual) { - $myindilist[]=$record; + $myindilist[] = $record; } if ($record instanceof WT_Family) { - $myfamlist[]=$record; + $myfamlist[] = $record; } } } diff --git a/relationship.php b/relationship.php index ec7ae1322c..9006513873 100644 --- a/relationship.php +++ b/relationship.php @@ -265,7 +265,7 @@ if ($person1 && $person2) { $rowNum += $asc; if ($asc==1) { $liney = $yoffset-$lh; - } else { + } else { $liney = $yoffset+$Dbheight; } // need to draw a joining line ? @@ -278,7 +278,7 @@ if ($person1 && $person2) { $linex = $xoffset-$xs/2; if ($asc==-1) { $liney=$yoffset+$Dbheight; - } else { + } else { $liney=$yoffset-$lh; } $joinx = $xoffset-$xs; @@ -288,8 +288,9 @@ if ($person1 && $person2) { $joinx = $joinx+$xs/2; $joiny = $joiny+$asc*$lh; echo "<div id=\"joinb", $index, "\" style=\"position:absolute; ", $TEXT_DIRECTION=='ltr'?'left':'right', ':', $joinx + $Dbxspacing, 'px; top:', $joiny + $Dbyspacing, "px;\" align=\"center\"><img src=\"", Theme::theme()->parameter('image-hline'), "\" align=\"left\" width=\"", $joinw, "\" height=\"", $joinh, "\" alt=\"\"></div>"; + } else { + $change_count=''; } - else $change_count=''; $previous='parent'; break; case 'brother': @@ -328,7 +329,7 @@ if ($person1 && $person2) { $rowNum -= $asc; if ($asc==-1) { $liney = $yoffset-$lh; - } else { + } else { $liney = $yoffset+$Dbheight; } // need to draw a joining line ? @@ -341,7 +342,7 @@ if ($person1 && $person2) { $linex = $xoffset-$xs/2; if ($asc==1) { $liney=$yoffset+$Dbheight; - } else { + } else { $liney=$yoffset-($lh+$Dbyspacing); } $joinx = $xoffset-$xs; @@ -351,8 +352,9 @@ if ($person1 && $person2) { $joinx = $joinx+$xs/2; $joiny = $joiny-$asc*$lh; echo '<div id="joinb', $index, '" style="position:absolute; ', $TEXT_DIRECTION=='ltr'?'left':'right', ':', $joinx+$Dbxspacing, 'px; top:', $joiny+$Dbyspacing, 'px;" align="center"><img src="', Theme::theme()->parameter('image-hline'), '" align="left" width="', $joinw, '" height="', $joinh, '" alt=""></div>'; + } else { + $change_count=''; } - else $change_count=''; $previous='child'; break; } @@ -24,7 +24,7 @@ define('WT_SCRIPT_NAME', 'repo.php'); require './includes/session.php'; -require_once WT_ROOT.'includes/functions/functions_print_lists.php'; +require_once WT_ROOT . 'includes/functions/functions_print_lists.php'; $controller = new WT_Controller_Repository; @@ -36,8 +36,8 @@ if ($controller->record && $controller->record->canShow()) { '<p class="ui-state-highlight">', /* I18N: %1$s is “accept”, %2$s is “reject”. These are links. */ WT_I18N::translate( 'This repository has been deleted. You should review the deletion and then %1$s or %2$s it.', - '<a href="#" onclick="accept_changes(\''.$controller->record->getXref().'\');">' . WT_I18N::translate_c('You should review the deletion and then accept or reject it.', 'accept') . '</a>', - '<a href="#" onclick="reject_changes(\''.$controller->record->getXref().'\');">' . WT_I18N::translate_c('You should review the deletion and then accept or reject it.', 'reject') . '</a>' + '<a href="#" onclick="accept_changes(\'' . $controller->record->getXref() . '\');">' . WT_I18N::translate_c('You should review the deletion and then accept or reject it.', 'accept') . '</a>', + '<a href="#" onclick="reject_changes(\'' . $controller->record->getXref() . '\');">' . WT_I18N::translate_c('You should review the deletion and then accept or reject it.', 'reject') . '</a>' ), ' ', help_link('pending_changes'), '</p>'; @@ -54,8 +54,8 @@ if ($controller->record && $controller->record->canShow()) { '<p class="ui-state-highlight">', /* I18N: %1$s is “accept”, %2$s is “reject”. These are links. */ WT_I18N::translate( 'This repository has been edited. You should review the changes and then %1$s or %2$s them.', - '<a href="#" onclick="accept_changes(\''.$controller->record->getXref().'\');">' . WT_I18N::translate_c('You should review the changes and then accept or reject them.', 'accept') . '</a>', - '<a href="#" onclick="reject_changes(\''.$controller->record->getXref().'\');">' . WT_I18N::translate_c('You should review the changes and then accept or reject them.', 'reject') . '</a>' + '<a href="#" onclick="accept_changes(\'' . $controller->record->getXref() . '\');">' . WT_I18N::translate_c('You should review the changes and then accept or reject them.', 'accept') . '</a>', + '<a href="#" onclick="reject_changes(\'' . $controller->record->getXref() . '\');">' . WT_I18N::translate_c('You should review the changes and then accept or reject them.', 'reject') . '</a>' ), ' ', help_link('pending_changes'), '</p>'; @@ -68,7 +68,7 @@ if ($controller->record && $controller->record->canShow()) { } } } else { - header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found'); + header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'); $controller->pageHeader(); echo '<p class="ui-state-error">', WT_I18N::translate('This repository does not exist or you do not have permission to view it.'), '</p>'; exit; @@ -98,7 +98,7 @@ echo '<div id="repo-tabs"> echo '<div id="repo-edit">'; echo '<table class="facts_table">'; // Fetch the facts - $facts=$controller->record->getFacts(); + $facts = $controller->record->getFacts(); // Sort the facts usort( diff --git a/repolist.php b/repolist.php index 417d8840af..cb15c75eb3 100644 --- a/repolist.php +++ b/repolist.php @@ -23,7 +23,7 @@ define('WT_SCRIPT_NAME', 'repolist.php'); require './includes/session.php'; -require_once WT_ROOT.'includes/functions/functions_print_lists.php'; +require_once WT_ROOT . 'includes/functions/functions_print_lists.php'; $controller = new WT_Controller_Page; $controller->setPageTitle(WT_I18N::translate('Repositories')); @@ -48,11 +48,11 @@ if (!WT_Filter::checkCsrf()) { // The id must be a valid CSS identifier, so it can be used in HTML. // We use "[A-Za-z0-9_]+" separated by "-". -$id=WT_Filter::post('id', '[a-zA-Z0-9_-]+'); -list($table, $id1, $id2, $id3)=explode('-', $id.'---'); +$id = WT_Filter::post('id', '[a-zA-Z0-9_-]+'); +list($table, $id1, $id2, $id3) = explode('-', $id . '---'); // The replacement value. -$value=WT_Filter::post('value'); +$value = WT_Filter::post('value'); // Every switch must have a default case, and every case must end in ok() or fail() @@ -71,7 +71,7 @@ case 'site_access_rule': case 'ip_address_end': WT_DB::prepare("UPDATE `##site_access_rule` SET {$id1}=INET_ATON(?) WHERE site_access_rule_id=?") ->execute(array($value, $id2)); - $value=WT_DB::prepare( + $value = WT_DB::prepare( "SELECT INET_NTOA({$id1}) FROM `##site_access_rule` WHERE site_access_rule_id=?" )->execute(array($id2))->fetchOne(); ok(); @@ -129,7 +129,7 @@ case 'user_gedcom_setting': // ID format: user_gedcom_setting-{user_id}-{gedcom_id}-{setting_name} ////////////////////////////////////////////////////////////////////////////// - switch($id3) { + switch ($id3) { case 'rootid': case 'gedcomid': case 'canedit': @@ -153,7 +153,7 @@ case 'user_setting': $user = User::find($id1); // Authorisation - if (!(Auth::isAdmin() || $user && $user->getPreference('editaccount') && in_array($id2, array('language','visible_online','contact_method')))) { + if (!(Auth::isAdmin() || $user && $user->getPreference('editaccount') && in_array($id2, array('language', 'visible_online', 'contact_method')))) { fail(); } @@ -167,13 +167,13 @@ case 'user_setting': break; case 'verified_by_admin': // Approving for the first time? Send a confirmation email - if ($value && !$user->getPreference('verified_by_admin') && $user->getPreference('sessiontime')==0) { + if ($value && !$user->getPreference('verified_by_admin') && $user->getPreference('sessiontime') == 0) { WT_I18N::init($user->getPreference('language')); WT_Mail::systemMessage( $WT_TREE, $user, - WT_I18N::translate('Approval of account at %s', WT_SERVER_NAME.WT_SCRIPT_PATH), - WT_I18N::translate('The administrator at the webtrees site %s has approved your application for an account. You may now login by accessing the following link: %s', WT_SERVER_NAME.WT_SCRIPT_PATH, WT_SERVER_NAME.WT_SCRIPT_PATH) + WT_I18N::translate('Approval of account at %s', WT_SERVER_NAME . WT_SCRIPT_PATH), + WT_I18N::translate('The administrator at the webtrees site %s has approved your application for an account. You may now login by accessing the following link: %s', WT_SERVER_NAME . WT_SCRIPT_PATH, WT_SERVER_NAME . WT_SCRIPT_PATH) ); } break; @@ -182,7 +182,7 @@ case 'user_setting': case 'verified': case 'visibleonline': case 'max_relation_path': - $value=(int)$value; + $value = (int) $value; break; case 'contactmethod': case 'comment': diff --git a/search.php b/search.php index 0ebc5e384b..761686e66c 100644 --- a/search.php +++ b/search.php @@ -23,7 +23,7 @@ define('WT_SCRIPT_NAME', 'search.php'); require './includes/session.php'; -require_once WT_ROOT.'includes/functions/functions_print_lists.php'; +require_once WT_ROOT . 'includes/functions/functions_print_lists.php'; $controller = new WT_Controller_Search; $controller @@ -78,7 +78,7 @@ echo '<div id="search-page"> <div id="search-page-table">'; //========== General search Form ========== if ($controller->action == "general") { - echo '<div class="label">' , WT_I18N::translate('Search for'), '</div> + echo '<div class="label">', WT_I18N::translate('Search for'), '</div> <div class="value"><input tabindex="1" id="query" type="text" name="query" value="'; if (isset($controller->myquery)) echo $controller->myquery; echo '" size="40" autofocus> ', print_specialchar_link('query'), '</div> @@ -107,7 +107,7 @@ echo '<div id="search-page"> <div class="label">' , WT_I18N::translate('Associates'), '</div> <div class="value"><input type="checkbox" id="showasso" name="showasso" value="on"'; if ($controller->showasso == 'on') echo ' checked="checked"'; - echo '><label for="showasso">' , WT_I18N::translate('Show related individuals/families'), '</label></div>'; + echo '><label for="showasso">', WT_I18N::translate('Show related individuals/families'), '</label></div>'; } //========== Search and replace Search Form ========== if ($controller->action == "replace") { @@ -150,7 +150,7 @@ echo '<div id="search-page"> } //========== Phonetic search Form //========== if ($controller->action == "soundex") { - echo '<div class="label">' , WT_I18N::translate('Given name'), '</div> + echo '<div class="label">', WT_I18N::translate('Given name'), '</div> <div class="value"><input tabindex="3" type="text" data-autocomplete-type="GIVN" name="firstname" value="' , WT_Filter::escapeHtml($controller->firstname), '" autofocus></div> <div class="label">' , WT_I18N::translate('Surname'), '</div> <div class="value"><input tabindex="4" type="text" data-autocomplete-type="SURN" name="lastname" value="' , WT_Filter::escapeHtml($controller->lastname), '"></div> @@ -160,21 +160,21 @@ echo '<div id="search-page"> <div class="value"><input tabindex="6" type="text" name="year" value="' , WT_Filter::escapeHtml($controller->year), '"></div>'; // ---- Soundex type options (Russell, DaitchM) --- - echo '<div class="label">' , WT_I18N::translate('Phonetic algorithm'), '</div> + echo '<div class="label">', WT_I18N::translate('Phonetic algorithm'), '</div> <div class="value"><p> <input type="radio" name="soundex" value="Russell"'; if ($controller->soundex == "Russell") echo ' checked="checked" '; - echo '>' , WT_I18N::translate('Russell'); + echo '>', WT_I18N::translate('Russell'); echo '</p><p> <input type="radio" name="soundex" value="DaitchM"'; if ($controller->soundex == "DaitchM" || $controller->soundex == "") echo ' checked="checked" '; - echo'>' , WT_I18N::translate('Daitch-Mokotoff'); + echo'>', WT_I18N::translate('Daitch-Mokotoff'); echo '</p></div>'; // Associates Section - echo '<div class="label">' , WT_I18N::translate('Associates'), '</div> + echo '<div class="label">', WT_I18N::translate('Associates'), '</div> <div class="value"><input type="checkbox" name="showasso" value="on"'; if ($controller->showasso == "on") echo ' checked="checked" '; - echo '>' , WT_I18N::translate('Show related individuals/families'), + echo '>', WT_I18N::translate('Show related individuals/families'), '</div>'; } // If the search is a general or soundex search then possibly display checkboxes for the gedcoms @@ -182,35 +182,35 @@ echo '<div id="search-page"> // If more than one GEDCOM, switching is allowed AND DB mode is set, let the user select if ((count(WT_Tree::getAll()) > 1) && WT_Site::getPreference('ALLOW_CHANGE_GEDCOM')) { // More Than 3 Gedcom Filess enable elect all & select none buttons - if (count(WT_Tree::getAll())>3) { + if (count(WT_Tree::getAll()) > 3) { echo '<div class="label"> </div> <div class="value"> <input type="button" value="', /* I18N: select all (of the family trees) */ WT_I18N::translate('select all'), '" onclick="jQuery(\'#search_trees :checkbox\').each(function(){jQuery(this).attr(\'checked\', true);});return false;"> <input type="button" value="', /* I18N: select none (of the family trees) */ WT_I18N::translate('select none'), '" onclick="jQuery(\'#search_trees :checkbox\').each(function(){jQuery(this).attr(\'checked\', false);});return false;">'; // More Than 10 Gedcom Files enable invert selection button - if (count(WT_Tree::getAll())>10) { + if (count(WT_Tree::getAll()) > 10) { echo '<input type="button" value="', WT_I18N::translate('invert selection'), '" onclick="jQuery(\'#search_trees :checkbox\').each(function(){jQuery(this).attr(\'checked\', !jQuery(this).attr(\'checked\'));});return false;">'; } echo '</div>'; } - echo '<div class="label">' , WT_I18N::translate('Family trees'), '</div> + echo '<div class="label">', WT_I18N::translate('Family trees'), '</div> <div id="search_trees" class="value">'; //-- sorting menu by gedcom filename foreach (WT_Tree::getAll() as $tree) { - $str = str_replace(array (".", "-", " "), array ("_", "_", "_"), $tree->tree_name); + $str = str_replace(array(".", "-", " "), array("_", "_", "_"), $tree->tree_name); $controller->inputFieldNames[] = "$str"; echo '<p><input type="checkbox" '; if (isset ($_REQUEST["$str"])) { echo 'checked="checked" '; } - echo 'value="yes" id="checkbox_', $tree->tree_id , '" name="', $str, '"><label for="checkbox_', $tree->tree_id , '">', $tree->tree_title_html, '</label></p>', "\n"; + echo 'value="yes" id="checkbox_', $tree->tree_id, '" name="', $str, '"><label for="checkbox_', $tree->tree_id, '">', $tree->tree_title_html, '</label></p>', "\n"; } echo '</div>'; } } // Links to Other Search Options - echo '<div class="label">' , WT_I18N::translate('Other searches'), '</div> + echo '<div class="label">', WT_I18N::translate('Other searches'), '</div> <div class="value">'; if ($controller->action == "general") { echo '<a href="?action=soundex">', WT_I18N::translate('Phonetic search'), '</a> | <a href="search_advanced.php">', WT_I18N::translate('Advanced search'), '</a>'; @@ -234,13 +234,13 @@ echo '<div id="search-page"> //Search buttons echo '<div id="search_submit">'; if ($controller->action == "general") { - echo '<input tabindex="2" type="submit" value="' , WT_I18N::translate('Search'), '">'; + echo '<input tabindex="2" type="submit" value="', WT_I18N::translate('Search'), '">'; } elseif ($controller->action == "replace") { - echo '<input tabindex="2" type="submit" value="' , WT_I18N::translate('Search'), '">'; + echo '<input tabindex="2" type="submit" value="', WT_I18N::translate('Search'), '">'; } elseif ($controller->action == "soundex") { - echo '<input tabindex="7" type="submit" value="' , WT_I18N::translate('Search'), '">'; + echo '<input tabindex="7" type="submit" value="', WT_I18N::translate('Search'), '">'; } - echo '</div>'; // close div id="search_submit" + echo '</div>'; // close div id="search_submit" echo '</form>'; $controller->printResults(); echo '</div>'; // close div id "search-page" diff --git a/search_advanced.php b/search_advanced.php index cc6643bb98..326db8c73f 100644 --- a/search_advanced.php +++ b/search_advanced.php @@ -23,7 +23,7 @@ define('WT_SCRIPT_NAME', 'search_advanced.php'); require './includes/session.php'; -require_once WT_ROOT.'includes/functions/functions_print_lists.php'; +require_once WT_ROOT . 'includes/functions/functions_print_lists.php'; $controller = new WT_Controller_AdvancedSearch; $controller @@ -110,15 +110,15 @@ echo '<script>'; opt = document.createElement('option'); opt.value=''; /* The translation strings use HTML entities, but javascript does not. See bug 687980 */ - opt.text='<?php echo html_entity_decode(WT_I18N::plural('±%d year','±%d years', 2, 2), ENT_COMPAT, 'UTF-8'); ?>'; + opt.text='<?php echo html_entity_decode(WT_I18N::plural('±%d year', '±%d years', 2, 2), ENT_COMPAT, 'UTF-8'); ?>'; sel.appendChild(opt); opt = document.createElement('option'); opt.value='5'; - opt.text='<?php echo html_entity_decode(WT_I18N::plural('±%d year','±%d years', 5, 5), ENT_COMPAT, 'UTF-8'); ?>'; + opt.text='<?php echo html_entity_decode(WT_I18N::plural('±%d year', '±%d years', 5, 5), ENT_COMPAT, 'UTF-8'); ?>'; sel.appendChild(opt); opt = document.createElement('option'); opt.value='10'; - opt.text='<?php echo html_entity_decode(WT_I18N::plural('±%d year','±%d years', 10, 10), ENT_COMPAT, 'UTF-8'); ?>'; + opt.text='<?php echo html_entity_decode(WT_I18N::plural('±%d year', '±%d years', 10, 10), ENT_COMPAT, 'UTF-8'); ?>'; sel.appendChild(opt); var spc = document.createTextNode(' '); elm.appendChild(spc); @@ -137,9 +137,9 @@ echo '</script>'; <!-- // search terms --> <?php $fct = count($controller->fields); - for ($i=0; $i<$fct; $i++) { - if (strpos($controller->getField($i), "FAMC:HUSB:NAME")===0) continue; - if (strpos($controller->getField($i), "FAMC:WIFE:NAME")===0) continue; + for ($i = 0; $i < $fct; $i++) { + if (strpos($controller->getField($i), "FAMC:HUSB:NAME") === 0) continue; + if (strpos($controller->getField($i), "FAMC:WIFE:NAME") === 0) continue; ?> <tr> <td class="list_label"> @@ -150,37 +150,37 @@ echo '</script>'; $currentFieldSearch = $controller->getField($i); // Get this field’s name and the search criterion $currentField = substr($currentFieldSearch, 0, strrpos($currentFieldSearch, ':')); // Get the actual field name ?> - <input tabindex="<?php echo $i+1; ?>" type="text" id="value<?php echo $i; ?>" name="values[<?php echo $i; ?>]" value="<?php echo WT_Filter::escapeHtml($controller->getValue($i)); ?>"<?php echo (substr($controller->getField($i),-4)=='PLAC') ? 'data-autocomplete-type="PLAC"' : ''; ?>> - <?php if (preg_match("/^NAME:/", $currentFieldSearch)>0) { ?> + <input tabindex="<?php echo $i + 1; ?>" type="text" id="value<?php echo $i; ?>" name="values[<?php echo $i; ?>]" value="<?php echo WT_Filter::escapeHtml($controller->getValue($i)); ?>"<?php echo (substr($controller->getField($i), -4) == 'PLAC') ? 'data-autocomplete-type="PLAC"' : ''; ?>> + <?php if (preg_match("/^NAME:/", $currentFieldSearch) > 0) { ?> <select name="fields[<?php echo $i; ?>]"> - <option value="<?php echo $currentField; ?>:EXACT"<?php if (preg_match("/:EXACT$/", $currentFieldSearch)>0) echo " selected=\"selected\""; ?>><?php echo WT_I18N::translate('Exact'); ?></option> - <option value="<?php echo $currentField; ?>:BEGINS"<?php if (preg_match("/:BEGINS$/", $currentFieldSearch)>0) echo " selected=\"selected\""; ?>><?php echo WT_I18N::translate('Begins with'); ?></option> - <option value="<?php echo $currentField; ?>:CONTAINS"<?php if (preg_match("/:CONTAINS$/", $currentFieldSearch)>0) echo " selected=\"selected\""; ?>><?php echo WT_I18N::translate('Contains'); ?></option> - <option value="<?php echo $currentField; ?>:SDX"<?php if (preg_match("/:SDX$/", $currentFieldSearch)>0) echo " selected=\"selected\""; ?>><?php echo WT_I18N::translate('Sounds like'); ?></option> + <option value="<?php echo $currentField; ?>:EXACT"<?php if (preg_match("/:EXACT$/", $currentFieldSearch) > 0) echo " selected=\"selected\""; ?>><?php echo WT_I18N::translate('Exact'); ?></option> + <option value="<?php echo $currentField; ?>:BEGINS"<?php if (preg_match("/:BEGINS$/", $currentFieldSearch) > 0) echo " selected=\"selected\""; ?>><?php echo WT_I18N::translate('Begins with'); ?></option> + <option value="<?php echo $currentField; ?>:CONTAINS"<?php if (preg_match("/:CONTAINS$/", $currentFieldSearch) > 0) echo " selected=\"selected\""; ?>><?php echo WT_I18N::translate('Contains'); ?></option> + <option value="<?php echo $currentField; ?>:SDX"<?php if (preg_match("/:SDX$/", $currentFieldSearch) > 0) echo " selected=\"selected\""; ?>><?php echo WT_I18N::translate('Sounds like'); ?></option> </select> <?php } else { ?> <input type="hidden" name="fields[<?php echo $i; ?>]" value="<?php echo $controller->getField($i); ?>"> <?php } - if (preg_match("/:DATE$/", $currentFieldSearch)>0) { + if (preg_match("/:DATE$/", $currentFieldSearch) > 0) { ?> <select name="plusminus[<?php echo $i; ?>]"> <option value=""><?php echo WT_I18N::translate('Exact date'); ?></option> - <option value="2" <?php if (!empty($controller->plusminus[$i]) && $controller->plusminus[$i]==2) echo " selected=\"selected\""; ?>><?php echo WT_I18N::plural('±%d year','±%d years', 2, 2); ?></option> - <option value="5" <?php if (!empty($controller->plusminus[$i]) && $controller->plusminus[$i]==5) echo "selected=\"selected\""; ?>><?php echo WT_I18N::plural('±%d year','±%d years', 5, 5); ?></option> - <option value="10" <?php if (!empty($controller->plusminus[$i]) && $controller->plusminus[$i]==10) echo "selected=\"selected\""; ?>><?php echo WT_I18N::plural('±%d year','±%d years', 10, 10); ?></option> + <option value="2" <?php if (!empty($controller->plusminus[$i]) && $controller->plusminus[$i] == 2) echo " selected=\"selected\""; ?>><?php echo WT_I18N::plural('±%d year', '±%d years', 2, 2); ?></option> + <option value="5" <?php if (!empty($controller->plusminus[$i]) && $controller->plusminus[$i] == 5) echo "selected=\"selected\""; ?>><?php echo WT_I18N::plural('±%d year', '±%d years', 5, 5); ?></option> + <option value="10" <?php if (!empty($controller->plusminus[$i]) && $controller->plusminus[$i] == 10) echo "selected=\"selected\""; ?>><?php echo WT_I18N::plural('±%d year', '±%d years', 10, 10); ?></option> </select> <?php } ?> </td> <?php //-- relative fields - if ($i==0 && $fct>4) { - $j=$fct; + if ($i == 0 && $fct > 4) { + $j = $fct; // Get the current options for Father’s and Mother’s name searches $fatherGivnOption = 'SDX'; $fatherSurnOption = 'SDX'; $motherGivnOption = 'SDX'; $motherSurnOption = 'SDX'; - for ($k=0; $k<$fct; $k++) { + for ($k = 0; $k < $fct; $k++) { $searchField = $controller->getField($k); $searchOption = substr($searchField, 20); // Assume we have something like "FAMC:HUSB:NAME:GIVN:foo" switch (substr($searchField, 0, 20)) { @@ -213,7 +213,7 @@ echo '</script>'; <?php echo WT_Gedcom_Tag::getLabel('GIVN'); ?> </td> <td class="list_value"> - <input type="text" name="values[<?php echo $j; ?>]" value="<?php echo $controller->getValue($controller->getIndex('FAMC:HUSB:NAME:GIVN:'.$fatherGivnOption)); ?>"> + <input type="text" name="values[<?php echo $j; ?>]" value="<?php echo $controller->getValue($controller->getIndex('FAMC:HUSB:NAME:GIVN:' . $fatherGivnOption)); ?>"> <select name="fields[<?php echo $j; ?>]"> <option value="FAMC:HUSB:NAME:GIVN:EXACT"<?php if ($fatherGivnOption == 'EXACT') echo " selected=\"selected\""; ?>><?php echo WT_I18N::translate('Exact'); ?></option> <option value="FAMC:HUSB:NAME:GIVN:BEGINS"<?php if ($fatherGivnOption == 'BEGINS') echo " selected=\"selected\""; ?>><?php echo WT_I18N::translate('Begins with'); ?></option> @@ -228,7 +228,7 @@ echo '</script>'; <?php echo WT_Gedcom_Tag::getLabel('SURN'); ?> </td> <td class="list_value"> - <input type="text" name="values[<?php echo $j; ?>]" value="<?php echo $controller->getValue($controller->getIndex('FAMC:HUSB:NAME:SURN:'.$fatherSurnOption)); ?>"> + <input type="text" name="values[<?php echo $j; ?>]" value="<?php echo $controller->getValue($controller->getIndex('FAMC:HUSB:NAME:SURN:' . $fatherSurnOption)); ?>"> <select name="fields[<?php echo $j; ?>]"> <option value="FAMC:HUSB:NAME:SURN:EXACT"<?php if ($fatherSurnOption == 'EXACT') echo " selected=\"selected\""; ?>><?php echo WT_I18N::translate('Exact'); ?></option> <option value="FAMC:HUSB:NAME:SURN:BEGINS"<?php if ($fatherSurnOption == 'BEGINS') echo " selected=\"selected\""; ?>><?php echo WT_I18N::translate('Begins with'); ?></option> @@ -250,7 +250,7 @@ echo '</script>'; <?php echo WT_Gedcom_Tag::getLabel('GIVN'); ?> </td> <td class="list_value"> - <input type="text" name="values[<?php echo $j; ?>]" value="<?php echo $controller->getValue($controller->getIndex('FAMC:WIFE:NAME:GIVN:'.$motherGivnOption)); ?>"> + <input type="text" name="values[<?php echo $j; ?>]" value="<?php echo $controller->getValue($controller->getIndex('FAMC:WIFE:NAME:GIVN:' . $motherGivnOption)); ?>"> <select name="fields[<?php echo $j; ?>]"> <option value="FAMC:WIFE:NAME:GIVN:EXACT"<?php if ($motherGivnOption == 'EXACT') echo " selected=\"selected\""; ?>><?php echo WT_I18N::translate('Exact'); ?></option> <option value="FAMC:WIFE:NAME:GIVN:BEGINS"<?php if ($motherGivnOption == 'BEGINS') echo " selected=\"selected\""; ?>><?php echo WT_I18N::translate('Begins with'); ?></option> @@ -265,7 +265,7 @@ echo '</script>'; <?php echo WT_Gedcom_Tag::getLabel('SURN'); ?> </td> <td class="list_value"> - <input type="text" name="values[<?php echo $j; ?>]" value="<?php echo $controller->getValue($controller->getIndex('FAMC:WIFE:NAME:SURN:'.$motherSurnOption)); ?>"> + <input type="text" name="values[<?php echo $j; ?>]" value="<?php echo $controller->getValue($controller->getIndex('FAMC:WIFE:NAME:SURN:' . $motherSurnOption)); ?>"> <select name="fields[<?php echo $j; ?>]"> <option value="FAMC:WIFE:NAME:SURN:EXACT"<?php if ($motherSurnOption == 'EXACT') echo " selected=\"selected\""; ?>><?php echo WT_I18N::translate('Exact'); ?></option> <option value="FAMC:WIFE:NAME:SURN:BEGINS"<?php if ($motherSurnOption == 'BEGINS') echo " selected=\"selected\""; ?>><?php echo WT_I18N::translate('Begins with'); ?></option> @@ -290,7 +290,7 @@ echo '</script>'; <a href="#" onclick="addFields();"><?php echo WT_I18N::translate('Add more fields'); ?></a> </div> <div id="search_submit"> - <input tabindex="<?php echo $i+1; ?>" type="submit" value="<?php echo WT_I18N::translate('Search'); ?>"> + <input tabindex="<?php echo $i + 1; ?>" type="submit" value="<?php echo WT_I18N::translate('Search'); ?>"> </div> </form> </div> @@ -29,33 +29,33 @@ require 'library/autoload.php'; // This script (uniquely) does not load session.php. // session.php won’t run until a configuration file exists… // This next block of code is a minimal version of session.php -define('WT_WEBTREES', 'webtrees'); +define('WT_WEBTREES', 'webtrees'); define('WT_SERVER_NAME', ''); define('WT_SCRIPT_PATH', ''); require 'includes/functions/functions_db.php'; // for get/setSiteSetting() -define('WT_DATA_DIR', 'data/'); -define('WT_DEBUG_SQL', false); +define('WT_DATA_DIR', 'data/'); +define('WT_DEBUG_SQL', false); define('WT_REQUIRED_MYSQL_VERSION', '5.0.13'); -define('WT_REQUIRED_PHP_VERSION', '5.3.2'); +define('WT_REQUIRED_PHP_VERSION', '5.3.2'); define('WT_MODULES_DIR', 'modules_v3/'); define('WT_ROOT', ''); define('WT_GED_ID', null); define('WT_PRIV_PUBLIC', 2); -define('WT_PRIV_USER', 1); -define('WT_PRIV_NONE', 0); -define('WT_PRIV_HIDE', -1); +define('WT_PRIV_USER', 1); +define('WT_PRIV_NONE', 0); +define('WT_PRIV_HIDE', -1); if (file_exists(WT_DATA_DIR . WT_CONFIG_FILE)) { header('Location: index.php'); exit; } -if (version_compare(PHP_VERSION, WT_REQUIRED_PHP_VERSION)<0) { +if (version_compare(PHP_VERSION, WT_REQUIRED_PHP_VERSION) < 0) { // We cannot translate these messages without a modern PHP echo '<h1>Sorry, the setup wizard cannot start.</h1>', '<p>This server is running PHP version ', PHP_VERSION, '</p>', - '<p>PHP ', WT_REQUIRED_PHP_VERSION , ' (or any later version) is required</p>'; + '<p>PHP ', WT_REQUIRED_PHP_VERSION, ' (or any later version) is required</p>'; exit; } @@ -105,25 +105,25 @@ echo '<input type="hidden" name="lang" value="', WT_LOCALE, '">'; if (!isset($_POST['lang'])) { echo '<p>', WT_I18N::translate('Change language'), ' ', - edit_field_language('change_lang', WT_LOCALE, 'onchange="window.location=\'' . WT_SCRIPT_NAME . '?lang=\'+this.value;">'), + edit_field_language('change_lang', WT_LOCALE, 'onchange="window.location=\'' . WT_SCRIPT_NAME . '?lang=\'+this.value;">'), '</p>', '<h2>', WT_I18N::translate('Checking server configuration'), '</h2>'; - $warnings=false; - $errors=false; + $warnings = false; + $errors = false; // Mandatory functions - $disable_functions=preg_split('/ *, */', ini_get('disable_functions')); + $disable_functions = preg_split('/ *, */', ini_get('disable_functions')); foreach (array('parse_ini_file') as $function) { if (in_array($function, $disable_functions)) { - echo '<p class="bad">', /* I18N: %s is a PHP function/module/setting */ WT_I18N::translate('%s is disabled on this server. You cannot install webtrees until it is enabled. Please ask your server’s administrator to enable it.', $function.'()'), '</p>'; - $errors=true; + echo '<p class="bad">', /* I18N: %s is a PHP function/module/setting */ WT_I18N::translate('%s is disabled on this server. You cannot install webtrees until it is enabled. Please ask your server’s administrator to enable it.', $function . '()'), '</p>'; + $errors = true; } } // Mandatory extensions foreach (array('pcre', 'pdo', 'pdo_mysql', 'session', 'iconv') as $extension) { if (!extension_loaded($extension)) { echo '<p class="bad">', WT_I18N::translate('PHP extension “%s” is disabled. You cannot install webtrees until this is enabled. Please ask your server’s administrator to enable it.', $extension), '</p>'; - $errors=true; + $errors = true; } } // Recommended extensions @@ -134,7 +134,7 @@ if (!isset($_POST['lang'])) { ) as $extension=>$features) { if (!extension_loaded($extension)) { echo '<p class="bad">', WT_I18N::translate('PHP extension “%1$s” is disabled. Without it, the following features will not work: %2$s. Please ask your server’s administrator to enable it.', $extension, $features), '</p>'; - $warnings=true; + $warnings = true; } } // Settings @@ -143,7 +143,7 @@ if (!isset($_POST['lang'])) { ) as $setting=>$features) { if (!ini_get($setting)) { echo '<p class="bad">', WT_I18N::translate('PHP setting “%1$s” is disabled. Without it, the following features will not work: %2$s. Please ask your server’s administrator to enable it.', $setting, $features), '</p>'; - $warnings=true; + $warnings = true; } } if (!$warnings && !$errors) { @@ -212,29 +212,29 @@ if ($FAB != 'FAB!') { // Step three - Database connection. //////////////////////////////////////////////////////////////////////////////// -if (!isset($_POST['dbhost'])) $_POST['dbhost']='localhost'; -if (!isset($_POST['dbport'])) $_POST['dbport']='3306'; -if (!isset($_POST['dbuser'])) $_POST['dbuser']=''; -if (!isset($_POST['dbpass'])) $_POST['dbpass']=''; -if (!isset($_POST['dbname'])) $_POST['dbname']=''; -if (!isset($_POST['tblpfx'])) $_POST['tblpfx']='wt_'; +if (!isset($_POST['dbhost'])) $_POST['dbhost'] = 'localhost'; +if (!isset($_POST['dbport'])) $_POST['dbport'] = '3306'; +if (!isset($_POST['dbuser'])) $_POST['dbuser'] = ''; +if (!isset($_POST['dbpass'])) $_POST['dbpass'] = ''; +if (!isset($_POST['dbname'])) $_POST['dbname'] = ''; +if (!isset($_POST['tblpfx'])) $_POST['tblpfx'] = 'wt_'; define('WT_TBLPREFIX', $_POST['tblpfx']); try { - $db_version_ok=false; + $db_version_ok = false; WT_DB::createInstance( $_POST['dbhost'], $_POST['dbport'], - '', // No DBNAME - we will connect to it explicitly + '', // No DBNAME - we will connect to it explicitly $_POST['dbuser'], $_POST['dbpass'] ); WT_DB::exec("SET NAMES 'utf8'"); - $row=WT_DB::prepare("SHOW VARIABLES LIKE 'VERSION'")->fetchOneRow(); + $row = WT_DB::prepare("SHOW VARIABLES LIKE 'VERSION'")->fetchOneRow(); if (version_compare($row->value, WT_REQUIRED_MYSQL_VERSION, '<')) { echo '<p class="bad">', WT_I18N::translate('This database is only running MySQL version %s. You cannot install webtrees here.', $row->value), '</p>'; } else { - $db_version_ok=true; + $db_version_ok = true; } } catch (PDOException $ex) { WT_DB::disconnect(); @@ -293,13 +293,13 @@ if (empty($_POST['dbuser']) || !WT_DB::isConnected() || !$db_version_ok) { // // Other characters may be invalid (objects must be valid filenames on the // MySQL server’s filesystem), so block the usual ones. -$DBNAME =str_replace(array('`', '"', '\'', ':', '/', '\\', '\r', '\n', '\t', '\0'), '', $_POST['dbname']); -$TBLPREFIX=str_replace(array('`', '"', '\'', ':', '/', '\\', '\r', '\n', '\t', '\0'), '', $_POST['tblpfx']); +$DBNAME = str_replace(array('`', '"', '\'', ':', '/', '\\', '\r', '\n', '\t', '\0'), '', $_POST['dbname']); +$TBLPREFIX = str_replace(array('`', '"', '\'', ':', '/', '\\', '\r', '\n', '\t', '\0'), '', $_POST['tblpfx']); // If we have specified a database, and we have not used invalid characters, // try to connect to it. -$dbname_ok=false; -if ($DBNAME && $DBNAME==$_POST['dbname'] && $TBLPREFIX==$_POST['tblpfx']) { +$dbname_ok = false; +if ($DBNAME && $DBNAME == $_POST['dbname'] && $TBLPREFIX == $_POST['tblpfx']) { try { // Try to create the database, if it does not exist. WT_DB::exec("CREATE DATABASE IF NOT EXISTS `{$DBNAME}` COLLATE utf8_unicode_ci"); @@ -309,7 +309,7 @@ if ($DBNAME && $DBNAME==$_POST['dbname'] && $TBLPREFIX==$_POST['tblpfx']) { } try { WT_DB::exec("USE `{$DBNAME}`"); - $dbname_ok=true; + $dbname_ok = true; } catch (PDOException $ex) { echo '<p class="bad">', WT_I18N::translate('Unable to connect using these settings. Your server gave the following error.'), '</p>', @@ -323,9 +323,9 @@ if ($dbname_ok) { try { // PhpGedView (4.2.3 and earlier) and many other applications have a USERS table. // webtrees has a USER table - $dummy=WT_DB::prepare("SELECT COUNT(*) FROM `##users`")->fetchOne(); + $dummy = WT_DB::prepare("SELECT COUNT(*) FROM `##users`")->fetchOne(); echo '<p class="bad">', WT_I18N::translate('This database and table-prefix appear to be used by another application. If you have an existing PhpGedView system, you should create a new webtrees system. You can import your PhpGedView data and settings later.'), '</p>'; - $dbname_ok=false; + $dbname_ok = false; } catch (PDOException $ex) { // Table not found? Good! } @@ -334,9 +334,9 @@ if ($dbname_ok) { try { // PhpGedView (4.2.4 and later) has a site_setting.site_setting_name column. // [We changed the column name in webtrees, so we can tell the difference!] - $dummy=WT_DB::prepare("SELECT site_setting_value FROM `##site_setting` WHERE site_setting_name='PGV_SCHEMA_VERSION'")->fetchOne(); + $dummy = WT_DB::prepare("SELECT site_setting_value FROM `##site_setting` WHERE site_setting_name='PGV_SCHEMA_VERSION'")->fetchOne(); echo '<p class="bad">', WT_I18N::translate('This database and table-prefix appear to be used by another application. If you have an existing PhpGedView system, you should create a new webtrees system. You can import your PhpGedView data and settings later.'), '</p>'; - $dbname_ok=false; + $dbname_ok = false; } catch (PDOException $ex) { // Table/column not found? Good! } @@ -371,18 +371,18 @@ if (!$dbname_ok) { // Step five - site setup data //////////////////////////////////////////////////////////////////////////////// -if (!isset($_POST['wtname' ])) $_POST['wtname' ]=''; -if (!isset($_POST['wtuser' ])) $_POST['wtuser' ]=''; -if (!isset($_POST['wtpass' ])) $_POST['wtpass' ]=''; -if (!isset($_POST['wtpass2' ])) $_POST['wtpass2' ]=''; -if (!isset($_POST['wtemail' ])) $_POST['wtemail' ]=''; +if (!isset($_POST['wtname'])) $_POST['wtname'] = ''; +if (!isset($_POST['wtuser'])) $_POST['wtuser'] = ''; +if (!isset($_POST['wtpass'])) $_POST['wtpass'] = ''; +if (!isset($_POST['wtpass2'])) $_POST['wtpass2'] = ''; +if (!isset($_POST['wtemail'])) $_POST['wtemail'] = ''; -if (empty($_POST['wtname']) || empty($_POST['wtuser']) || strlen($_POST['wtpass'])<6 || strlen($_POST['wtpass2'])<6 || empty($_POST['wtemail']) || $_POST['wtpass']<>$_POST['wtpass2']) { - if (strlen($_POST['wtpass'])>0 && strlen($_POST['wtpass'])<6) { +if (empty($_POST['wtname']) || empty($_POST['wtuser']) || strlen($_POST['wtpass']) < 6 || strlen($_POST['wtpass2']) < 6 || empty($_POST['wtemail']) || $_POST['wtpass'] <> $_POST['wtpass2']) { + if (strlen($_POST['wtpass']) > 0 && strlen($_POST['wtpass']) < 6) { echo '<p class="bad">', WT_I18N::translate('The password needs to be at least six characters long.'), '</p>'; - } elseif ($_POST['wtpass']<>$_POST['wtpass2']) { + } elseif ($_POST['wtpass'] <> $_POST['wtpass2']) { echo '<p class="bad">', WT_I18N::translate('The passwords do not match.'), '</p>'; - } elseif ((empty($_POST['wtname']) || empty($_POST['wtuser']) || empty($_POST['wtpass']) || empty($_POST['wtemail'])) && $_POST['wtname'].$_POST['wtuser'].$_POST['wtpass'].$_POST['wtemail']!='') { + } elseif ((empty($_POST['wtname']) || empty($_POST['wtuser']) || empty($_POST['wtpass']) || empty($_POST['wtemail'])) && $_POST['wtname'] . $_POST['wtuser'] . $_POST['wtpass'] . $_POST['wtemail'] != '') { echo '<p class="bad">', WT_I18N::translate('You must enter all the administrator account fields.'), '</p>'; } echo @@ -433,366 +433,366 @@ if (empty($_POST['wtname']) || empty($_POST['wtuser']) || strlen($_POST['wtpass' try { // These shouldn’t fail. WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##gedcom` (". - " gedcom_id INTEGER AUTO_INCREMENT NOT NULL,". - " gedcom_name VARCHAR(255) NOT NULL,". - " sort_order INTEGER NOT NULL DEFAULT 0,". - " PRIMARY KEY (gedcom_id),". - " UNIQUE KEY `##gedcom_ix1` (gedcom_name),". - " KEY `##gedcom_ix2` (sort_order)". + "CREATE TABLE IF NOT EXISTS `##gedcom` (" . + " gedcom_id INTEGER AUTO_INCREMENT NOT NULL," . + " gedcom_name VARCHAR(255) NOT NULL," . + " sort_order INTEGER NOT NULL DEFAULT 0," . + " PRIMARY KEY (gedcom_id)," . + " UNIQUE KEY `##gedcom_ix1` (gedcom_name)," . + " KEY `##gedcom_ix2` (sort_order)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##site_setting` (". - " setting_name VARCHAR(32) NOT NULL,". - " setting_value VARCHAR(255) NOT NULL,". - " PRIMARY KEY (setting_name)". + "CREATE TABLE IF NOT EXISTS `##site_setting` (" . + " setting_name VARCHAR(32) NOT NULL," . + " setting_value VARCHAR(255) NOT NULL," . + " PRIMARY KEY (setting_name)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##gedcom_setting` (". - " gedcom_id INTEGER NOT NULL,". - " setting_name VARCHAR(32) NOT NULL,". - " setting_value VARCHAR(255) NOT NULL,". - " PRIMARY KEY (gedcom_id, setting_name),". - " FOREIGN KEY `##gedcom_setting_fk1` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE CASCADE */". + "CREATE TABLE IF NOT EXISTS `##gedcom_setting` (" . + " gedcom_id INTEGER NOT NULL," . + " setting_name VARCHAR(32) NOT NULL," . + " setting_value VARCHAR(255) NOT NULL," . + " PRIMARY KEY (gedcom_id, setting_name)," . + " FOREIGN KEY `##gedcom_setting_fk1` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE CASCADE */" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##user` (". - " user_id INTEGER AUTO_INCREMENT NOT NULL,". - " user_name VARCHAR(32) NOT NULL,". - " real_name VARCHAR(64) NOT NULL,". - " email VARCHAR(64) NOT NULL,". - " password VARCHAR(128) NOT NULL,". - " PRIMARY KEY (user_id),". - " UNIQUE KEY `##user_ix1` (user_name),". - " UNIQUE KEY `##user_ix2` (email)". + "CREATE TABLE IF NOT EXISTS `##user` (" . + " user_id INTEGER AUTO_INCREMENT NOT NULL," . + " user_name VARCHAR(32) NOT NULL," . + " real_name VARCHAR(64) NOT NULL," . + " email VARCHAR(64) NOT NULL," . + " password VARCHAR(128) NOT NULL," . + " PRIMARY KEY (user_id)," . + " UNIQUE KEY `##user_ix1` (user_name)," . + " UNIQUE KEY `##user_ix2` (email)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##user_setting` (". - " user_id INTEGER NOT NULL,". - " setting_name VARCHAR(32) NOT NULL,". - " setting_value VARCHAR(255) NOT NULL,". - " PRIMARY KEY (user_id, setting_name),". - " FOREIGN KEY `##user_setting_fk1` (user_id) REFERENCES `##user` (user_id) /* ON DELETE CASCADE */". + "CREATE TABLE IF NOT EXISTS `##user_setting` (" . + " user_id INTEGER NOT NULL," . + " setting_name VARCHAR(32) NOT NULL," . + " setting_value VARCHAR(255) NOT NULL," . + " PRIMARY KEY (user_id, setting_name)," . + " FOREIGN KEY `##user_setting_fk1` (user_id) REFERENCES `##user` (user_id) /* ON DELETE CASCADE */" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##user_gedcom_setting` (". - " user_id INTEGER NOT NULL,". - " gedcom_id INTEGER NOT NULL,". - " setting_name VARCHAR(32) NOT NULL,". - " setting_value VARCHAR(255) NOT NULL,". - " PRIMARY KEY (user_id, gedcom_id, setting_name),". - " FOREIGN KEY `##user_gedcom_setting_fk1` (user_id) REFERENCES `##user` (user_id) /* ON DELETE CASCADE */,". - " FOREIGN KEY `##user_gedcom_setting_fk2` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE CASCADE */". + "CREATE TABLE IF NOT EXISTS `##user_gedcom_setting` (" . + " user_id INTEGER NOT NULL," . + " gedcom_id INTEGER NOT NULL," . + " setting_name VARCHAR(32) NOT NULL," . + " setting_value VARCHAR(255) NOT NULL," . + " PRIMARY KEY (user_id, gedcom_id, setting_name)," . + " FOREIGN KEY `##user_gedcom_setting_fk1` (user_id) REFERENCES `##user` (user_id) /* ON DELETE CASCADE */," . + " FOREIGN KEY `##user_gedcom_setting_fk2` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE CASCADE */" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##log` (". - " log_id INTEGER AUTO_INCREMENT NOT NULL,". - " log_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,". - " log_type ENUM('auth', 'config', 'debug', 'edit', 'error', 'media', 'search') NOT NULL,". - " log_message TEXT NOT NULL,". - " ip_address VARCHAR(40) NOT NULL,". - " user_id INTEGER NULL,". - " gedcom_id INTEGER NULL,". - " PRIMARY KEY (log_id),". - " KEY `##log_ix1` (log_time),". - " KEY `##log_ix2` (log_type),". - " KEY `##log_ix3` (ip_address),". - " FOREIGN KEY `##log_fk1` (user_id) REFERENCES `##user`(user_id) /* ON DELETE SET NULL */,". - " FOREIGN KEY `##log_fk2` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE SET NULL */". + "CREATE TABLE IF NOT EXISTS `##log` (" . + " log_id INTEGER AUTO_INCREMENT NOT NULL," . + " log_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP," . + " log_type ENUM('auth', 'config', 'debug', 'edit', 'error', 'media', 'search') NOT NULL," . + " log_message TEXT NOT NULL," . + " ip_address VARCHAR(40) NOT NULL," . + " user_id INTEGER NULL," . + " gedcom_id INTEGER NULL," . + " PRIMARY KEY (log_id)," . + " KEY `##log_ix1` (log_time)," . + " KEY `##log_ix2` (log_type)," . + " KEY `##log_ix3` (ip_address)," . + " FOREIGN KEY `##log_fk1` (user_id) REFERENCES `##user`(user_id) /* ON DELETE SET NULL */," . + " FOREIGN KEY `##log_fk2` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE SET NULL */" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##change` (". - " change_id INTEGER AUTO_INCREMENT NOT NULL,". - " change_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,". - " status ENUM('accepted', 'pending', 'rejected') NOT NULL DEFAULT 'pending',". - " gedcom_id INTEGER NOT NULL,". - " xref VARCHAR(20) NOT NULL,". - " old_gedcom MEDIUMTEXT NOT NULL,". - " new_gedcom MEDIUMTEXT NOT NULL,". - " user_id INTEGER NOT NULL,". - " PRIMARY KEY (change_id),". - " KEY `##change_ix1` (gedcom_id, status, xref),". - " FOREIGN KEY `##change_fk1` (user_id) REFERENCES `##user` (user_id) /* ON DELETE RESTRICT */,". - " FOREIGN KEY `##change_fk2` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE CASCADE */". + "CREATE TABLE IF NOT EXISTS `##change` (" . + " change_id INTEGER AUTO_INCREMENT NOT NULL," . + " change_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP," . + " status ENUM('accepted', 'pending', 'rejected') NOT NULL DEFAULT 'pending'," . + " gedcom_id INTEGER NOT NULL," . + " xref VARCHAR(20) NOT NULL," . + " old_gedcom MEDIUMTEXT NOT NULL," . + " new_gedcom MEDIUMTEXT NOT NULL," . + " user_id INTEGER NOT NULL," . + " PRIMARY KEY (change_id)," . + " KEY `##change_ix1` (gedcom_id, status, xref)," . + " FOREIGN KEY `##change_fk1` (user_id) REFERENCES `##user` (user_id) /* ON DELETE RESTRICT */," . + " FOREIGN KEY `##change_fk2` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE CASCADE */" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##message` (". - " message_id INTEGER AUTO_INCREMENT NOT NULL,". - " sender VARCHAR(64) NOT NULL,". // username or email address - " ip_address VARCHAR(40) NOT NULL,". // long enough for IPv6 - " user_id INTEGER NOT NULL,". - " subject VARCHAR(255) NOT NULL,". - " body TEXT NOT NULL,". - " created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,". - " PRIMARY KEY (message_id),". - " FOREIGN KEY `##message_fk1` (user_id) REFERENCES `##user` (user_id) /* ON DELETE RESTRICT */". + "CREATE TABLE IF NOT EXISTS `##message` (" . + " message_id INTEGER AUTO_INCREMENT NOT NULL," . + " sender VARCHAR(64) NOT NULL," . // username or email address + " ip_address VARCHAR(40) NOT NULL," . // long enough for IPv6 + " user_id INTEGER NOT NULL," . + " subject VARCHAR(255) NOT NULL," . + " body TEXT NOT NULL," . + " created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP," . + " PRIMARY KEY (message_id)," . + " FOREIGN KEY `##message_fk1` (user_id) REFERENCES `##user` (user_id) /* ON DELETE RESTRICT */" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##default_resn` (". - " default_resn_id INTEGER AUTO_INCREMENT NOT NULL,". - " gedcom_id INTEGER NOT NULL,". - " xref VARCHAR(20) NULL,". - " tag_type VARCHAR(15) NULL,". - " resn ENUM ('none', 'privacy', 'confidential', 'hidden') NOT NULL,". - " comment VARCHAR(255) NULL,". - " updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,". - " PRIMARY KEY (default_resn_id),". - " UNIQUE KEY `##default_resn_ix1` (gedcom_id, xref, tag_type),". - " FOREIGN KEY `##default_resn_fk1` (gedcom_id) REFERENCES `##gedcom` (gedcom_id)". + "CREATE TABLE IF NOT EXISTS `##default_resn` (" . + " default_resn_id INTEGER AUTO_INCREMENT NOT NULL," . + " gedcom_id INTEGER NOT NULL," . + " xref VARCHAR(20) NULL," . + " tag_type VARCHAR(15) NULL," . + " resn ENUM ('none', 'privacy', 'confidential', 'hidden') NOT NULL," . + " comment VARCHAR(255) NULL," . + " updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP," . + " PRIMARY KEY (default_resn_id)," . + " UNIQUE KEY `##default_resn_ix1` (gedcom_id, xref, tag_type)," . + " FOREIGN KEY `##default_resn_fk1` (gedcom_id) REFERENCES `##gedcom` (gedcom_id)" . ") ENGINE=InnoDB COLLATE=utf8_unicode_ci" ); WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##individuals` (". - " i_id VARCHAR(20) NOT NULL,". - " i_file INTEGER NOT NULL,". - " i_rin VARCHAR(20) NOT NULL,". - " i_sex ENUM('U', 'M', 'F') NOT NULL,". - " i_gedcom MEDIUMTEXT NOT NULL,". - " PRIMARY KEY (i_id, i_file),". - " UNIQUE KEY `##individuals_ix1` (i_file, i_id)". + "CREATE TABLE IF NOT EXISTS `##individuals` (" . + " i_id VARCHAR(20) NOT NULL," . + " i_file INTEGER NOT NULL," . + " i_rin VARCHAR(20) NOT NULL," . + " i_sex ENUM('U', 'M', 'F') NOT NULL," . + " i_gedcom MEDIUMTEXT NOT NULL," . + " PRIMARY KEY (i_id, i_file)," . + " UNIQUE KEY `##individuals_ix1` (i_file, i_id)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##families` (". - " f_id VARCHAR(20) NOT NULL,". - " f_file INTEGER NOT NULL,". - " f_husb VARCHAR(20) NULL,". - " f_wife VARCHAR(20) NULL,". - " f_gedcom MEDIUMTEXT NOT NULL,". - " f_numchil INTEGER NOT NULL,". - " PRIMARY KEY (f_id, f_file),". - " UNIQUE KEY `##families_ix1` (f_file, f_id),". - " KEY `##families_ix2` (f_husb),". - " KEY `##families_ix3` (f_wife)". + "CREATE TABLE IF NOT EXISTS `##families` (" . + " f_id VARCHAR(20) NOT NULL," . + " f_file INTEGER NOT NULL," . + " f_husb VARCHAR(20) NULL," . + " f_wife VARCHAR(20) NULL," . + " f_gedcom MEDIUMTEXT NOT NULL," . + " f_numchil INTEGER NOT NULL," . + " PRIMARY KEY (f_id, f_file)," . + " UNIQUE KEY `##families_ix1` (f_file, f_id)," . + " KEY `##families_ix2` (f_husb)," . + " KEY `##families_ix3` (f_wife)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##places` (". - " p_id INTEGER AUTO_INCREMENT NOT NULL,". - " p_place VARCHAR(150) NULL,". - " p_parent_id INTEGER NULL,". - " p_file INTEGER NOT NULL,". - " p_std_soundex TEXT NULL,". - " p_dm_soundex TEXT NULL,". - " PRIMARY KEY (p_id),". - " KEY `##places_ix1` (p_file, p_place),". - " UNIQUE KEY `##places_ix2` (p_parent_id, p_file, p_place)". + "CREATE TABLE IF NOT EXISTS `##places` (" . + " p_id INTEGER AUTO_INCREMENT NOT NULL," . + " p_place VARCHAR(150) NULL," . + " p_parent_id INTEGER NULL," . + " p_file INTEGER NOT NULL," . + " p_std_soundex TEXT NULL," . + " p_dm_soundex TEXT NULL," . + " PRIMARY KEY (p_id)," . + " KEY `##places_ix1` (p_file, p_place)," . + " UNIQUE KEY `##places_ix2` (p_parent_id, p_file, p_place)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##placelinks` (". - " pl_p_id INTEGER NOT NULL,". - " pl_gid VARCHAR(20) NOT NULL,". - " pl_file INTEGER NOT NULL,". - " PRIMARY KEY (pl_p_id, pl_gid, pl_file),". - " KEY `##placelinks_ix1` (pl_p_id),". - " KEY `##placelinks_ix2` (pl_gid),". - " KEY `##placelinks_ix3` (pl_file)". + "CREATE TABLE IF NOT EXISTS `##placelinks` (" . + " pl_p_id INTEGER NOT NULL," . + " pl_gid VARCHAR(20) NOT NULL," . + " pl_file INTEGER NOT NULL," . + " PRIMARY KEY (pl_p_id, pl_gid, pl_file)," . + " KEY `##placelinks_ix1` (pl_p_id)," . + " KEY `##placelinks_ix2` (pl_gid)," . + " KEY `##placelinks_ix3` (pl_file)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##dates` (". - " d_day TINYINT NOT NULL,". - " d_month CHAR(5) NULL,". - " d_mon TINYINT NOT NULL,". - " d_year SMALLINT NOT NULL,". - " d_julianday1 MEDIUMINT NOT NULL,". - " d_julianday2 MEDIUMINT NOT NULL,". - " d_fact VARCHAR(15) NOT NULL,". - " d_gid VARCHAR(20) NOT NULL,". - " d_file INTEGER NOT NULL,". - " d_type ENUM ('@#DGREGORIAN@', '@#DJULIAN@', '@#DHEBREW@', '@#DFRENCH R@', '@#DHIJRI@', '@#DROMAN@', '@#DJALALI@') NOT NULL,". - " KEY `##dates_ix1` (d_day),". - " KEY `##dates_ix2` (d_month),". - " KEY `##dates_ix3` (d_mon),". - " KEY `##dates_ix4` (d_year),". - " KEY `##dates_ix5` (d_julianday1),". - " KEY `##dates_ix6` (d_julianday2),". - " KEY `##dates_ix7` (d_gid),". - " KEY `##dates_ix8` (d_file),". - " KEY `##dates_ix9` (d_type),". - " KEY `##dates_ix10` (d_fact, d_gid)". + "CREATE TABLE IF NOT EXISTS `##dates` (" . + " d_day TINYINT NOT NULL," . + " d_month CHAR(5) NULL," . + " d_mon TINYINT NOT NULL," . + " d_year SMALLINT NOT NULL," . + " d_julianday1 MEDIUMINT NOT NULL," . + " d_julianday2 MEDIUMINT NOT NULL," . + " d_fact VARCHAR(15) NOT NULL," . + " d_gid VARCHAR(20) NOT NULL," . + " d_file INTEGER NOT NULL," . + " d_type ENUM ('@#DGREGORIAN@', '@#DJULIAN@', '@#DHEBREW@', '@#DFRENCH R@', '@#DHIJRI@', '@#DROMAN@', '@#DJALALI@') NOT NULL," . + " KEY `##dates_ix1` (d_day)," . + " KEY `##dates_ix2` (d_month)," . + " KEY `##dates_ix3` (d_mon)," . + " KEY `##dates_ix4` (d_year)," . + " KEY `##dates_ix5` (d_julianday1)," . + " KEY `##dates_ix6` (d_julianday2)," . + " KEY `##dates_ix7` (d_gid)," . + " KEY `##dates_ix8` (d_file)," . + " KEY `##dates_ix9` (d_type)," . + " KEY `##dates_ix10` (d_fact, d_gid)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##media` (". - " m_id VARCHAR(20) NOT NULL,". - " m_ext VARCHAR(6) NULL,". - " m_type VARCHAR(20) NULL,". - " m_titl VARCHAR(255) NULL,". - " m_filename VARCHAR(512) NULL,". - " m_file INTEGER NOT NULL,". - " m_gedcom MEDIUMTEXT NULL,". - " PRIMARY KEY (m_file, m_id),". - " UNIQUE KEY `##media_ix1` (m_id, m_file),". - " KEY `##media_ix2` (m_ext, m_type),". - " KEY `##media_ix3` (m_titl)". + "CREATE TABLE IF NOT EXISTS `##media` (" . + " m_id VARCHAR(20) NOT NULL," . + " m_ext VARCHAR(6) NULL," . + " m_type VARCHAR(20) NULL," . + " m_titl VARCHAR(255) NULL," . + " m_filename VARCHAR(512) NULL," . + " m_file INTEGER NOT NULL," . + " m_gedcom MEDIUMTEXT NULL," . + " PRIMARY KEY (m_file, m_id)," . + " UNIQUE KEY `##media_ix1` (m_id, m_file)," . + " KEY `##media_ix2` (m_ext, m_type)," . + " KEY `##media_ix3` (m_titl)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##next_id` (". - " gedcom_id INTEGER NOT NULL,". - " record_type VARCHAR(15) NOT NULL,". - " next_id DECIMAL(20) NOT NULL,". - " PRIMARY KEY (gedcom_id, record_type),". - " FOREIGN KEY `##next_id_fk1` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE CASCADE */". + "CREATE TABLE IF NOT EXISTS `##next_id` (" . + " gedcom_id INTEGER NOT NULL," . + " record_type VARCHAR(15) NOT NULL," . + " next_id DECIMAL(20) NOT NULL," . + " PRIMARY KEY (gedcom_id, record_type)," . + " FOREIGN KEY `##next_id_fk1` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE CASCADE */" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##other` (". - " o_id VARCHAR(20) NOT NULL,". - " o_file INTEGER NOT NULL,". - " o_type VARCHAR(15) NOT NULL,". - " o_gedcom MEDIUMTEXT NULL,". - " PRIMARY KEY (o_id, o_file),". - " UNIQUE KEY `##other_ix1` (o_file, o_id)". + "CREATE TABLE IF NOT EXISTS `##other` (" . + " o_id VARCHAR(20) NOT NULL," . + " o_file INTEGER NOT NULL," . + " o_type VARCHAR(15) NOT NULL," . + " o_gedcom MEDIUMTEXT NULL," . + " PRIMARY KEY (o_id, o_file)," . + " UNIQUE KEY `##other_ix1` (o_file, o_id)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##sources` (". - " s_id VARCHAR(20) NOT NULL,". - " s_file INTEGER NOT NULL,". - " s_name VARCHAR(255) NOT NULL,". - " s_gedcom MEDIUMTEXT NOT NULL,". - " PRIMARY KEY (s_id, s_file),". - " UNIQUE KEY `##sources_ix1` (s_file, s_id),". - " KEY `##sources_ix2` (s_name)". + "CREATE TABLE IF NOT EXISTS `##sources` (" . + " s_id VARCHAR(20) NOT NULL," . + " s_file INTEGER NOT NULL," . + " s_name VARCHAR(255) NOT NULL," . + " s_gedcom MEDIUMTEXT NOT NULL," . + " PRIMARY KEY (s_id, s_file)," . + " UNIQUE KEY `##sources_ix1` (s_file, s_id)," . + " KEY `##sources_ix2` (s_name)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##link` (". - " l_file INTEGER NOT NULL,". - " l_from VARCHAR(20) NOT NULL,". - " l_type VARCHAR(15) NOT NULL,". - " l_to VARCHAR(20) NOT NULL,". - " PRIMARY KEY (l_from, l_file, l_type, l_to),". - " UNIQUE KEY `##link_ix1` (l_to, l_file, l_type, l_from)". + "CREATE TABLE IF NOT EXISTS `##link` (" . + " l_file INTEGER NOT NULL," . + " l_from VARCHAR(20) NOT NULL," . + " l_type VARCHAR(15) NOT NULL," . + " l_to VARCHAR(20) NOT NULL," . + " PRIMARY KEY (l_from, l_file, l_type, l_to)," . + " UNIQUE KEY `##link_ix1` (l_to, l_file, l_type, l_from)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##name` (". - " n_file INTEGER NOT NULL,". - " n_id VARCHAR(20) NOT NULL,". - " n_num INTEGER NOT NULL,". - " n_type VARCHAR(15) NOT NULL,". - " n_sort VARCHAR(255) NOT NULL,". // e.g. “GOGH,VINCENT WILLEM” - " n_full VARCHAR(255) NOT NULL,". // e.g. “Vincent Willem van GOGH” + "CREATE TABLE IF NOT EXISTS `##name` (" . + " n_file INTEGER NOT NULL," . + " n_id VARCHAR(20) NOT NULL," . + " n_num INTEGER NOT NULL," . + " n_type VARCHAR(15) NOT NULL," . + " n_sort VARCHAR(255) NOT NULL," . // e.g. “GOGH,VINCENT WILLEM” + " n_full VARCHAR(255) NOT NULL," . // e.g. “Vincent Willem van GOGH” // These fields are only used for INDI records - " n_surname VARCHAR(255) NULL,". // e.g. “van GOGH” - " n_surn VARCHAR(255) NULL,". // e.g. “GOGH” - " n_givn VARCHAR(255) NULL,". // e.g. “Vincent Willem” - " n_soundex_givn_std VARCHAR(255) NULL,". - " n_soundex_surn_std VARCHAR(255) NULL,". - " n_soundex_givn_dm VARCHAR(255) NULL,". - " n_soundex_surn_dm VARCHAR(255) NULL,". - " PRIMARY KEY (n_id, n_file, n_num),". - " KEY `##name_ix1` (n_full, n_id, n_file),". - " KEY `##name_ix2` (n_surn, n_file, n_type, n_id),". - " KEY `##name_ix3` (n_givn, n_file, n_type, n_id)". + " n_surname VARCHAR(255) NULL," . // e.g. “van GOGH” + " n_surn VARCHAR(255) NULL," . // e.g. “GOGH” + " n_givn VARCHAR(255) NULL," . // e.g. “Vincent Willem” + " n_soundex_givn_std VARCHAR(255) NULL," . + " n_soundex_surn_std VARCHAR(255) NULL," . + " n_soundex_givn_dm VARCHAR(255) NULL," . + " n_soundex_surn_dm VARCHAR(255) NULL," . + " PRIMARY KEY (n_id, n_file, n_num)," . + " KEY `##name_ix1` (n_full, n_id, n_file)," . + " KEY `##name_ix2` (n_surn, n_file, n_type, n_id)," . + " KEY `##name_ix3` (n_givn, n_file, n_type, n_id)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##module` (". - " module_name VARCHAR(32) NOT NULL,". - " status ENUM('enabled', 'disabled') NOT NULL DEFAULT 'enabled',". - " tab_order INTEGER NULL, ". - " menu_order INTEGER NULL, ". - " sidebar_order INTEGER NULL,". - " PRIMARY KEY (module_name)". + "CREATE TABLE IF NOT EXISTS `##module` (" . + " module_name VARCHAR(32) NOT NULL," . + " status ENUM('enabled', 'disabled') NOT NULL DEFAULT 'enabled'," . + " tab_order INTEGER NULL, " . + " menu_order INTEGER NULL, " . + " sidebar_order INTEGER NULL," . + " PRIMARY KEY (module_name)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##module_setting` (". - " module_name VARCHAR(32) NOT NULL,". - " setting_name VARCHAR(32) NOT NULL,". - " setting_value MEDIUMTEXT NOT NULL,". - " PRIMARY KEY (module_name, setting_name),". - " FOREIGN KEY `##module_setting_fk1` (module_name) REFERENCES `##module` (module_name) /* ON DELETE CASCADE */". + "CREATE TABLE IF NOT EXISTS `##module_setting` (" . + " module_name VARCHAR(32) NOT NULL," . + " setting_name VARCHAR(32) NOT NULL," . + " setting_value MEDIUMTEXT NOT NULL," . + " PRIMARY KEY (module_name, setting_name)," . + " FOREIGN KEY `##module_setting_fk1` (module_name) REFERENCES `##module` (module_name) /* ON DELETE CASCADE */" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##module_privacy` (". - " module_name VARCHAR(32) NOT NULL,". - " gedcom_id INTEGER NOT NULL,". - " component ENUM('block', 'chart', 'menu', 'report', 'sidebar', 'tab', 'theme') NOT NULL,". - " access_level TINYINT NOT NULL,". - " PRIMARY KEY (module_name, gedcom_id, component),". - " FOREIGN KEY `##module_privacy_fk1` (module_name) REFERENCES `##module` (module_name) /* ON DELETE CASCADE */,". - " FOREIGN KEY `##module_privacy_fk2` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE CASCADE */". + "CREATE TABLE IF NOT EXISTS `##module_privacy` (" . + " module_name VARCHAR(32) NOT NULL," . + " gedcom_id INTEGER NOT NULL," . + " component ENUM('block', 'chart', 'menu', 'report', 'sidebar', 'tab', 'theme') NOT NULL," . + " access_level TINYINT NOT NULL," . + " PRIMARY KEY (module_name, gedcom_id, component)," . + " FOREIGN KEY `##module_privacy_fk1` (module_name) REFERENCES `##module` (module_name) /* ON DELETE CASCADE */," . + " FOREIGN KEY `##module_privacy_fk2` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE CASCADE */" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##block` (". - " block_id INTEGER AUTO_INCREMENT NOT NULL,". - " gedcom_id INTEGER NULL,". - " user_id INTEGER NULL,". - " xref VARCHAR(20) NULL,". - " location ENUM('main', 'side') NULL,". - " block_order INTEGER NOT NULL,". - " module_name VARCHAR(32) NOT NULL,". - " PRIMARY KEY (block_id),". - " FOREIGN KEY `##block_fk1` (gedcom_id) REFERENCES `##gedcom` (gedcom_id), /* ON DELETE CASCADE */". - " FOREIGN KEY `##block_fk2` (user_id) REFERENCES `##user` (user_id), /* ON DELETE CASCADE */". - " FOREIGN KEY `##block_fk3` (module_name) REFERENCES `##module` (module_name) /* ON DELETE CASCADE */". + "CREATE TABLE IF NOT EXISTS `##block` (" . + " block_id INTEGER AUTO_INCREMENT NOT NULL," . + " gedcom_id INTEGER NULL," . + " user_id INTEGER NULL," . + " xref VARCHAR(20) NULL," . + " location ENUM('main', 'side') NULL," . + " block_order INTEGER NOT NULL," . + " module_name VARCHAR(32) NOT NULL," . + " PRIMARY KEY (block_id)," . + " FOREIGN KEY `##block_fk1` (gedcom_id) REFERENCES `##gedcom` (gedcom_id), /* ON DELETE CASCADE */" . + " FOREIGN KEY `##block_fk2` (user_id) REFERENCES `##user` (user_id), /* ON DELETE CASCADE */" . + " FOREIGN KEY `##block_fk3` (module_name) REFERENCES `##module` (module_name) /* ON DELETE CASCADE */" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##block_setting` (". - " block_id INTEGER NOT NULL,". - " setting_name VARCHAR(32) NOT NULL,". - " setting_value TEXT NOT NULL,". - " PRIMARY KEY (block_id, setting_name),". - " FOREIGN KEY `##block_setting_fk1` (block_id) REFERENCES `##block` (block_id) /* ON DELETE CASCADE */". + "CREATE TABLE IF NOT EXISTS `##block_setting` (" . + " block_id INTEGER NOT NULL," . + " setting_name VARCHAR(32) NOT NULL," . + " setting_value TEXT NOT NULL," . + " PRIMARY KEY (block_id, setting_name)," . + " FOREIGN KEY `##block_setting_fk1` (block_id) REFERENCES `##block` (block_id) /* ON DELETE CASCADE */" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##hit_counter` (". - " gedcom_id INTEGER NOT NULL,". - " page_name VARCHAR(32) NOT NULL,". - " page_parameter VARCHAR(32) NOT NULL,". - " page_count INTEGER NOT NULL,". - " PRIMARY KEY (gedcom_id, page_name, page_parameter),". - " FOREIGN KEY `##hit_counter_fk1` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE CASCADE */". + "CREATE TABLE IF NOT EXISTS `##hit_counter` (" . + " gedcom_id INTEGER NOT NULL," . + " page_name VARCHAR(32) NOT NULL," . + " page_parameter VARCHAR(32) NOT NULL," . + " page_count INTEGER NOT NULL," . + " PRIMARY KEY (gedcom_id, page_name, page_parameter)," . + " FOREIGN KEY `##hit_counter_fk1` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE CASCADE */" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##ip_address` (". - " ip_address VARCHAR(40) NOT NULL,". // long enough for IPv6 - " category ENUM('banned', 'search-engine', 'allowed') NOT NULL,". - " comment VARCHAR(255) NOT NULL,". - " PRIMARY KEY (ip_address)". + "CREATE TABLE IF NOT EXISTS `##ip_address` (" . + " ip_address VARCHAR(40) NOT NULL," . // long enough for IPv6 + " category ENUM('banned', 'search-engine', 'allowed') NOT NULL," . + " comment VARCHAR(255) NOT NULL," . + " PRIMARY KEY (ip_address)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##session` (". - " session_id CHAR(128) NOT NULL,". - " session_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,". - " user_id INTEGER NOT NULL,". - " ip_address VARCHAR(32) NOT NULL,". - " session_data MEDIUMBLOB NOT NULL,". - " PRIMARY KEY (session_id),". - " KEY `##session_ix1` (session_time),". - " KEY `##session_ix2` (user_id, ip_address)". + "CREATE TABLE IF NOT EXISTS `##session` (" . + " session_id CHAR(128) NOT NULL," . + " session_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP," . + " user_id INTEGER NOT NULL," . + " ip_address VARCHAR(32) NOT NULL," . + " session_data MEDIUMBLOB NOT NULL," . + " PRIMARY KEY (session_id)," . + " KEY `##session_ix1` (session_time)," . + " KEY `##session_ix2` (user_id, ip_address)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##gedcom_chunk` (". - " gedcom_chunk_id INTEGER AUTO_INCREMENT NOT NULL,". - " gedcom_id INTEGER NOT NULL,". - " chunk_data MEDIUMBLOB NOT NULL,". - " imported BOOLEAN NOT NULL DEFAULT FALSE,". - " PRIMARY KEY (gedcom_chunk_id),". - " KEY `##gedcom_chunk_ix1` (gedcom_id, imported),". - " FOREIGN KEY `##gedcom_chunk_fk1` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE CASCADE */". + "CREATE TABLE IF NOT EXISTS `##gedcom_chunk` (" . + " gedcom_chunk_id INTEGER AUTO_INCREMENT NOT NULL," . + " gedcom_id INTEGER NOT NULL," . + " chunk_data MEDIUMBLOB NOT NULL," . + " imported BOOLEAN NOT NULL DEFAULT FALSE," . + " PRIMARY KEY (gedcom_chunk_id)," . + " KEY `##gedcom_chunk_ix1` (gedcom_id, imported)," . + " FOREIGN KEY `##gedcom_chunk_fk1` (gedcom_id) REFERENCES `##gedcom` (gedcom_id) /* ON DELETE CASCADE */" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB" ); //WT_DB::exec( @@ -811,72 +811,72 @@ try { //); WT_DB::exec( - "CREATE TABLE IF NOT EXISTS `##site_access_rule` (". - " site_access_rule_id INTEGER NOT NULL AUTO_INCREMENT,". - " ip_address_start INTEGER UNSIGNED NOT NULL DEFAULT 0,". - " ip_address_end INTEGER UNSIGNED NOT NULL DEFAULT 4294967295,". - " user_agent_pattern VARCHAR(255) NOT NULL,". - " rule ENUM('allow', 'deny', 'robot', 'unknown') NOT NULL DEFAULT 'unknown',". - " comment VARCHAR(255) NOT NULL,". - " updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,". - " PRIMARY KEY (site_access_rule_id),". - " UNIQUE KEY `##site_access_rule_ix1` (ip_address_end, ip_address_start, user_agent_pattern, rule),". - " KEY `##site_access_rule_ix2` (rule)". + "CREATE TABLE IF NOT EXISTS `##site_access_rule` (" . + " site_access_rule_id INTEGER NOT NULL AUTO_INCREMENT," . + " ip_address_start INTEGER UNSIGNED NOT NULL DEFAULT 0," . + " ip_address_end INTEGER UNSIGNED NOT NULL DEFAULT 4294967295," . + " user_agent_pattern VARCHAR(255) NOT NULL," . + " rule ENUM('allow', 'deny', 'robot', 'unknown') NOT NULL DEFAULT 'unknown'," . + " comment VARCHAR(255) NOT NULL," . + " updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP," . + " PRIMARY KEY (site_access_rule_id)," . + " UNIQUE KEY `##site_access_rule_ix1` (ip_address_end, ip_address_start, user_agent_pattern, rule)," . + " KEY `##site_access_rule_ix2` (rule)" . ") ENGINE=InnoDB COLLATE=utf8_unicode_ci" ); WT_DB::exec( - "INSERT IGNORE INTO `##site_access_rule` (user_agent_pattern, rule, comment) VALUES". - " ('Mozilla/5.0 (%) Gecko/% %/%', 'allow', 'Gecko-based browsers'),". - " ('Mozilla/5.0 (%) AppleWebKit/% (KHTML, like Gecko)%', 'allow', 'WebKit-based browsers'),". - " ('Opera/% (%) Presto/% Version/%', 'allow', 'Presto-based browsers'),". - " ('Mozilla/% (compatible; MSIE %', 'allow', 'Trident-based browsers'),". - " ('Mozilla/% (Windows%; Trident%; rv:%) like Gecko', 'allow', 'Modern Internet Explorer'),". + "INSERT IGNORE INTO `##site_access_rule` (user_agent_pattern, rule, comment) VALUES" . + " ('Mozilla/5.0 (%) Gecko/% %/%', 'allow', 'Gecko-based browsers')," . + " ('Mozilla/5.0 (%) AppleWebKit/% (KHTML, like Gecko)%', 'allow', 'WebKit-based browsers')," . + " ('Opera/% (%) Presto/% Version/%', 'allow', 'Presto-based browsers')," . + " ('Mozilla/% (compatible; MSIE %', 'allow', 'Trident-based browsers')," . + " ('Mozilla/% (Windows%; Trident%; rv:%) like Gecko', 'allow', 'Modern Internet Explorer')," . " ('Mozilla/5.0 (compatible; Konqueror/%', 'allow', 'Konqueror browser')" ); WT_DB::prepare( - "INSERT IGNORE INTO `##gedcom` (gedcom_id, gedcom_name) VALUES ". + "INSERT IGNORE INTO `##gedcom` (gedcom_id, gedcom_name) VALUES " . " (-1, 'DEFAULT_TREE')" )->execute(); WT_DB::prepare( - "INSERT IGNORE INTO `##user` (user_id, user_name, real_name, email, password) VALUES ". + "INSERT IGNORE INTO `##user` (user_id, user_name, real_name, email, password) VALUES " . " (-1, 'DEFAULT_USER', 'DEFAULT_USER', 'DEFAULT_USER', 'DEFAULT_USER'), (1, ?, ?, ?, ?)" )->execute(array( $_POST['wtuser'], $_POST['wtname'], $_POST['wtemail'], password_hash($_POST['wtpass'], PASSWORD_DEFAULT) )); WT_DB::prepare( - "INSERT IGNORE INTO `##user_setting` (user_id, setting_name, setting_value) VALUES ". - " (1, 'canadmin', ?),". - " (1, 'language', ?),". - " (1, 'verified', ?),". - " (1, 'verified_by_admin', ?),". - " (1, 'editaccount', ?),". - " (1, 'auto_accept', ?),". + "INSERT IGNORE INTO `##user_setting` (user_id, setting_name, setting_value) VALUES " . + " (1, 'canadmin', ?)," . + " (1, 'language', ?)," . + " (1, 'verified', ?)," . + " (1, 'verified_by_admin', ?)," . + " (1, 'editaccount', ?)," . + " (1, 'auto_accept', ?)," . " (1, 'visibleonline', ?)" )->execute(array( 1, WT_LOCALE, 1, 1, 1, 0, 1 )); WT_DB::prepare( - "INSERT IGNORE INTO `##site_setting` (setting_name, setting_value) VALUES ". - "('WT_SCHEMA_VERSION', '-2'),". - "('INDEX_DIRECTORY', 'data/'),". - "('USE_REGISTRATION_MODULE', '1'),". - "('REQUIRE_ADMIN_AUTH_REGISTRATION', '1'),". - "('ALLOW_USER_THEMES', '1'),". - "('ALLOW_CHANGE_GEDCOM', '1'),". - "('SESSION_TIME', '7200'),". - "('SMTP_ACTIVE', 'internal'),". - "('SMTP_HOST', 'localhost'),". - "('SMTP_PORT', '25'),". - "('SMTP_AUTH', '1'),". - "('SMTP_AUTH_USER', ''),". - "('SMTP_AUTH_PASS', ''),". - "('SMTP_SSL', 'none'),". - "('SMTP_HELO', ?),". + "INSERT IGNORE INTO `##site_setting` (setting_name, setting_value) VALUES " . + "('WT_SCHEMA_VERSION', '-2')," . + "('INDEX_DIRECTORY', 'data/')," . + "('USE_REGISTRATION_MODULE', '1')," . + "('REQUIRE_ADMIN_AUTH_REGISTRATION', '1')," . + "('ALLOW_USER_THEMES', '1')," . + "('ALLOW_CHANGE_GEDCOM', '1')," . + "('SESSION_TIME', '7200')," . + "('SMTP_ACTIVE', 'internal')," . + "('SMTP_HOST', 'localhost')," . + "('SMTP_PORT', '25')," . + "('SMTP_AUTH', '1')," . + "('SMTP_AUTH_USER', '')," . + "('SMTP_AUTH_PASS', '')," . + "('SMTP_SSL', 'none')," . + "('SMTP_HELO', ?)," . "('SMTP_FROM_NAME', ?)" )->execute(array( $_SERVER['SERVER_NAME'], $_SERVER['SERVER_NAME'] @@ -902,13 +902,13 @@ try { // Write the config file. We already checked that this would work. - $config_ini_php= - '; <'.'?php exit; ?'.'> DO NOT DELETE THIS LINE' . PHP_EOL. - 'dbhost="' . addcslashes($_POST['dbhost'], '"') . '"' . PHP_EOL. - 'dbport="' . addcslashes($_POST['dbport'], '"') . '"' . PHP_EOL. - 'dbuser="' . addcslashes($_POST['dbuser'], '"') . '"' . PHP_EOL. - 'dbpass="' . addcslashes($_POST['dbpass'], '"') . '"' . PHP_EOL. - 'dbname="' . addcslashes($_POST['dbname'], '"') . '"' . PHP_EOL. + $config_ini_php = + '; <' . '?php exit; ?' . '> DO NOT DELETE THIS LINE' . PHP_EOL . + 'dbhost="' . addcslashes($_POST['dbhost'], '"') . '"' . PHP_EOL . + 'dbport="' . addcslashes($_POST['dbport'], '"') . '"' . PHP_EOL . + 'dbuser="' . addcslashes($_POST['dbuser'], '"') . '"' . PHP_EOL . + 'dbpass="' . addcslashes($_POST['dbpass'], '"') . '"' . PHP_EOL . + 'dbname="' . addcslashes($_POST['dbname'], '"') . '"' . PHP_EOL . 'tblpfx="' . addcslashes($_POST['tblpfx'], '"') . '"' . PHP_EOL; file_put_contents(WT_DATA_DIR . 'config.ini.php', $config_ini_php); diff --git a/site-offline.php b/site-offline.php index 55b2c8b9d5..b2f48f1b36 100644 --- a/site-offline.php +++ b/site-offline.php @@ -30,7 +30,7 @@ define('WT_SERVER_NAME', ''); define('WT_SCRIPT_PATH', ''); define('WT_ROOT', ''); define('WT_GED_ID', 0); -define('WT_DATA_DIR', realpath('data').DIRECTORY_SEPARATOR); +define('WT_DATA_DIR', realpath('data') . DIRECTORY_SEPARATOR); $WT_SESSION = new stdClass; $WT_SESSION->locale = ''; @@ -39,8 +39,8 @@ require 'includes/functions/functions.php'; define('WT_LOCALE', WT_I18N::init()); -if (file_exists(WT_DATA_DIR.'offline.txt')) { - $offline_txt=file_get_contents(WT_DATA_DIR.'offline.txt'); +if (file_exists(WT_DATA_DIR . 'offline.txt')) { + $offline_txt = file_get_contents(WT_DATA_DIR . 'offline.txt'); } else { // offline.txt has gone - we're back online! header('Location: index.php'); @@ -48,7 +48,7 @@ if (file_exists(WT_DATA_DIR.'offline.txt')) { } header('Content-Type: text/html; charset=UTF-8'); -header($_SERVER['SERVER_PROTOCOL'].' 503 Service Temporarily Unavailable'); +header($_SERVER['SERVER_PROTOCOL'] . ' 503 Service Temporarily Unavailable'); echo '<!DOCTYPE html>', |
