fisharebest /
webtrees
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * webtrees: online genealogy |
||
| 4 | * Copyright (C) 2017 webtrees development team |
||
| 5 | * This program is free software: you can redistribute it and/or modify |
||
| 6 | * it under the terms of the GNU General Public License as published by |
||
| 7 | * the Free Software Foundation, either version 3 of the License, or |
||
| 8 | * (at your option) any later version. |
||
| 9 | * This program is distributed in the hope that it will be useful, |
||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
| 12 | * GNU General Public License for more details. |
||
| 13 | * You should have received a copy of the GNU General Public License |
||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
||
| 15 | */ |
||
| 16 | namespace Fisharebest\Webtrees; |
||
| 17 | |||
| 18 | use Fisharebest\Webtrees\Controller\DescendancyController; |
||
| 19 | use Fisharebest\Webtrees\Functions\FunctionsEdit; |
||
| 20 | use Fisharebest\Webtrees\Functions\FunctionsPrintLists; |
||
| 21 | |||
| 22 | require 'includes/session.php'; |
||
| 23 | |||
| 24 | $controller = new DescendancyController; |
||
| 25 | $controller->restrictAccess(Module::isActiveChart($controller->tree(), 'descendancy_chart')); |
||
| 26 | |||
| 27 | // Only generate the content for interactive users (not search robots). |
||
| 28 | if (Filter::getBool('ajax') && Session::has('initiated')) { |
||
| 29 | switch ($controller->chart_style) { |
||
| 30 | case 0: // List |
||
| 31 | echo '<ul id="descendancy_chart" class="chart_common">'; |
||
| 32 | $controller->printChildDescendancy($controller->root, $controller->generations); |
||
| 33 | echo '</ul>'; |
||
| 34 | break; |
||
| 35 | case 1: // Booklet |
||
| 36 | $show_cousins = true; |
||
| 37 | echo '<div id="descendancy_booklet">'; |
||
| 38 | $controller->printChildFamily($controller->root, $controller->generations); |
||
| 39 | echo '</div>'; |
||
| 40 | break; |
||
| 41 | case 2: // Individual list |
||
| 42 | $descendants = $controller->individualDescendancy($controller->root, $controller->generations, []); |
||
| 43 | echo '<div id="descendancy-list">', FunctionsPrintLists::individualTable($descendants), '</div>'; |
||
| 44 | break; |
||
| 45 | case 3: // Family list |
||
| 46 | $descendants = $controller->familyDescendancy($controller->root, $controller->generations, []); |
||
| 47 | echo '<div id="descendancy-list">', FunctionsPrintLists::familyTable($descendants), '</div>'; |
||
|
0 ignored issues
–
show
|
|||
| 48 | break; |
||
| 49 | } |
||
| 50 | |||
| 51 | return; |
||
| 52 | } |
||
| 53 | |||
| 54 | $controller |
||
| 55 | ->addInlineJavascript('$(".wt-page-content").load(document.location + "&ajax=1");') |
||
| 56 | ->pageHeader(); |
||
| 57 | |||
| 58 | ?> |
||
| 59 | <h2 class="wt-page-title"><?= $controller->getPageTitle() ?></h2> |
||
| 60 | |||
| 61 | <form class="wt-page-options wt-page-options-descendants-chart hidden-print"> |
||
| 62 | <input type="hidden" name="ged" value="<?= $controller->tree()->getNameHtml() ?>"> |
||
| 63 | |||
| 64 | <div class="row form-group"> |
||
| 65 | <label class="col-sm-3 col-form-label wt-page-options-label" for="rootid"> |
||
| 66 | <?= I18N::translate('Individual') ?> |
||
| 67 | </label> |
||
| 68 | <div class="col-sm-9 wt-page-options-value"> |
||
| 69 | <?= FunctionsEdit::formControlIndividual($controller->root, ['id' => 'rootid', 'name' => 'rootid']) ?> |
||
| 70 | </div> |
||
| 71 | </div> |
||
| 72 | |||
| 73 | <div class="row form-group"> |
||
| 74 | <label class="col-sm-3 col-form-label wt-page-options-label" for="generations"> |
||
| 75 | <?= I18N::translate('Generations') ?> |
||
| 76 | </label> |
||
| 77 | <div class="col-sm-9 wt-page-options-value"> |
||
| 78 | <?= Bootstrap4::select(FunctionsEdit::numericOptions(range(2, $controller->tree()->getPreference('MAX_DESCENDANCY_GENERATIONS'))), $controller->generations, ['id' => 'generations', 'name' => 'generations']) ?> |
||
| 79 | </div> |
||
| 80 | </div> |
||
| 81 | |||
| 82 | <fieldset class="form-group"> |
||
| 83 | <div class="row"> |
||
| 84 | <legend class="col-form-legend col-sm-3 wt-page-options-label"> |
||
| 85 | <?= I18N::translate('Layout') ?> |
||
| 86 | </legend> |
||
| 87 | <div class="col-sm-9 wt-page-options-value"> |
||
| 88 | <?= Bootstrap4::radioButtons('chart_style', ['0' => I18N::translate('List'), '1' => I18N::translate('Booklet'), '2' => I18N::translate('Individuals'), '3' => I18N::translate('Families')], $controller->chart_style, true, ['onclick' => 'statusDisable("show_cousins");']) ?> |
||
| 89 | </div> |
||
| 90 | </div> |
||
| 91 | </fieldset> |
||
| 92 | |||
| 93 | <div class="row form-group"> |
||
| 94 | <div class="col-sm-3 wt-page-options-label"></div> |
||
| 95 | <div class="col-sm-9 wt-page-options-value"> |
||
| 96 | <input class="btn btn-primary" type="submit" value="<?= /* I18N: A button label. */ I18N::translate('view') ?>"> |
||
| 97 | </div> |
||
| 98 | </div> |
||
| 99 | </form> |
||
| 100 | |||
| 101 | <div class="wt-ajax-load wt-page-content wt-chart wt-descendants-chart"></div> |
||
| 102 |
\Fisharebest\Webtrees\Fu...milyTable($descendants)can contain request data and is used in output context(s) leading to a potential security vulnerability.4 paths for user data to reach this point
$_FILES,and$fileis assigned in action.php on line 112$_FILES,and$fileis assignedin action.php on line 112
$gedcomis assignedin action.php on line 148
$gedcomis passed to Tree::createRecord()in action.php on line 158
$gedcomis passed to GedcomRecord::getInstance()in app/Tree.php on line 782
$gedcomis passed to GedcomRecord::__construct()in app/GedcomRecord.php on line 202
in app/GedcomRecord.php on line 80
in app/GedcomRecord.php on line 495
$newgedrecis assignedin app/Report/ReportParserGenerate.php on line 594
in app/Report/ReportParserGenerate.php on line 618
in app/Report/ReportParserGenerate.php on line 1262
in vendor/app/Functions/Functions.php on line 160
$thisSubrecordis assignedin vendor/app/Functions/Functions.php on line 161
in vendor/app/Functions/Functions.php on line 167
in app/Report/ReportParserGenerate.php on line 1262
$valueis assignedin app/Report/ReportParserGenerate.php on line 1308
in app/Report/ReportParserGenerate.php on line 1358
$idis assignedin app/Report/ReportParserGenerate.php on line 827
$idis passed to GedcomRecord::getInstance()in app/Report/ReportParserGenerate.php on line 841
$xrefis passed to GedcomRecord::__construct()in app/GedcomRecord.php on line 202
in app/GedcomRecord.php on line 79
in app/GedcomRecord.php on line 280
in app/GedcomRecord.php on line 351
in app/GedcomRecord.php on line 330
$htmlis assignedin app/Functions/FunctionsPrintLists.php on line 778
in descendancy.php on line 47
$_POST,and$newgedis assigned in edit_interface.php on line 426$_POST,and$newgedis assignedin edit_interface.php on line 426
$newgedis assignedin edit_interface.php on line 446
$newgedis passed through substr(), and$newgedis assignedin edit_interface.php on line 459
$newgedis passed to GedcomRecord::updateFact()in edit_interface.php on line 467
$gedcomis passed through preg_replace(), and$gedcomis assignedin app/GedcomRecord.php on line 1192
$gedcomis passed through trim(), and$gedcomis assignedin app/GedcomRecord.php on line 1193
$new_gedcomis assignedin app/GedcomRecord.php on line 1230
in app/GedcomRecord.php on line 1249
in app/GedcomRecord.php on line 495
$newgedrecis assignedin app/Report/ReportParserGenerate.php on line 594
in app/Report/ReportParserGenerate.php on line 618
in app/Report/ReportParserGenerate.php on line 1262
in vendor/app/Functions/Functions.php on line 160
$thisSubrecordis assignedin vendor/app/Functions/Functions.php on line 161
in vendor/app/Functions/Functions.php on line 167
in app/Report/ReportParserGenerate.php on line 1262
$valueis assignedin app/Report/ReportParserGenerate.php on line 1308
in app/Report/ReportParserGenerate.php on line 1358
$idis assignedin app/Report/ReportParserGenerate.php on line 827
$idis passed to GedcomRecord::getInstance()in app/Report/ReportParserGenerate.php on line 841
$xrefis passed to GedcomRecord::__construct()in app/GedcomRecord.php on line 202
in app/GedcomRecord.php on line 79
in app/GedcomRecord.php on line 280
in app/GedcomRecord.php on line 351
in app/GedcomRecord.php on line 330
$htmlis assignedin app/Functions/FunctionsPrintLists.php on line 778
in descendancy.php on line 47
$_POST,and$newgedis assigned in edit_interface.php on line 430$_POST,and$newgedis assignedin edit_interface.php on line 430
$newgedis assignedin edit_interface.php on line 446
$newgedis passed through substr(), and$newgedis assignedin edit_interface.php on line 459
$newgedis passed to GedcomRecord::updateFact()in edit_interface.php on line 467
$gedcomis passed through preg_replace(), and$gedcomis assignedin app/GedcomRecord.php on line 1192
$gedcomis passed through trim(), and$gedcomis assignedin app/GedcomRecord.php on line 1193
$new_gedcomis assignedin app/GedcomRecord.php on line 1230
in app/GedcomRecord.php on line 1249
in app/GedcomRecord.php on line 495
$newgedrecis assignedin app/Report/ReportParserGenerate.php on line 594
in app/Report/ReportParserGenerate.php on line 618
in app/Report/ReportParserGenerate.php on line 1262
in vendor/app/Functions/Functions.php on line 160
$thisSubrecordis assignedin vendor/app/Functions/Functions.php on line 161
in vendor/app/Functions/Functions.php on line 167
in app/Report/ReportParserGenerate.php on line 1262
$valueis assignedin app/Report/ReportParserGenerate.php on line 1308
in app/Report/ReportParserGenerate.php on line 1358
$idis assignedin app/Report/ReportParserGenerate.php on line 827
$idis passed to GedcomRecord::getInstance()in app/Report/ReportParserGenerate.php on line 841
$xrefis passed to GedcomRecord::__construct()in app/GedcomRecord.php on line 202
in app/GedcomRecord.php on line 79
in app/GedcomRecord.php on line 280
in app/GedcomRecord.php on line 351
in app/GedcomRecord.php on line 330
$htmlis assignedin app/Functions/FunctionsPrintLists.php on line 778
in descendancy.php on line 47
$_POST,and$newgedis assigned in edit_interface.php on line 454$_POST,and$newgedis assignedin edit_interface.php on line 454
$newgedis passed through substr(), and$newgedis assignedin edit_interface.php on line 459
$newgedis passed to GedcomRecord::updateFact()in edit_interface.php on line 467
$gedcomis passed through preg_replace(), and$gedcomis assignedin app/GedcomRecord.php on line 1192
$gedcomis passed through trim(), and$gedcomis assignedin app/GedcomRecord.php on line 1193
$new_gedcomis assignedin app/GedcomRecord.php on line 1230
in app/GedcomRecord.php on line 1249
in app/GedcomRecord.php on line 495
$newgedrecis assignedin app/Report/ReportParserGenerate.php on line 594
in app/Report/ReportParserGenerate.php on line 618
in app/Report/ReportParserGenerate.php on line 1262
in vendor/app/Functions/Functions.php on line 160
$thisSubrecordis assignedin vendor/app/Functions/Functions.php on line 161
in vendor/app/Functions/Functions.php on line 167
in app/Report/ReportParserGenerate.php on line 1262
$valueis assignedin app/Report/ReportParserGenerate.php on line 1308
in app/Report/ReportParserGenerate.php on line 1358
$idis assignedin app/Report/ReportParserGenerate.php on line 827
$idis passed to GedcomRecord::getInstance()in app/Report/ReportParserGenerate.php on line 841
$xrefis passed to GedcomRecord::__construct()in app/GedcomRecord.php on line 202
in app/GedcomRecord.php on line 79
in app/GedcomRecord.php on line 280
in app/GedcomRecord.php on line 351
in app/GedcomRecord.php on line 330
$htmlis assignedin app/Functions/FunctionsPrintLists.php on line 778
in descendancy.php on line 47
Preventing Cross-Site-Scripting Attacks
Cross-Site-Scripting allows an attacker to inject malicious code into your website - in particular Javascript code, and have that code executed with the privileges of a visiting user. This can be used to obtain data, or perform actions on behalf of that visiting user.
In order to prevent this, make sure to escape all user-provided data:
General Strategies to prevent injection
In general, it is advisable to prevent any user-data to reach this point. This can be done by white-listing certain values:
if ( ! in_array($value, array('this-is-allowed', 'and-this-too'), true)) { throw new \InvalidArgumentException('This input is not allowed.'); }For numeric data, we recommend to explicitly cast the data: