Your project should use Doctrine migrations
- Read doc
- Architecture
- Major
More information: https://insight.symfony.com/what-we-analyse/composer.using_migrations
Source code should not contain tasks comments 13
- Read doc
- Bugrisk
- Major
More information: https://insight.symfony.com/what-we-analyse/task_fixme_comment
- class CensusColumnReligion extends AbstractCensusColumn implements CensusColumnInterface
- {
- /**
- * Generate the likely value of this census column, based on available information.
- *
- * @todo Look for RELI tags (or subtags?)
- *
- * @param Individual $individual
- * @param Individual $head
- *
- * @return string
- 'ged' => $tree->name(),
- 'query' => 'QUERY',
- ]),
- ]) . '>';
- /** @TODO - typeaheadjs.css doesn't work in an input-group */
- $html .= view('edit/input-addon-coordinates', ['id' => $id]);
- $html .= view('edit/input-addon-help', ['fact' => 'PLAC']);
- $html .= '</div>';
- } elseif ($fact === 'QUAY') {
- $html .= view('components/select', ['id' => $id, 'name' => $name, 'selected' => $value, 'options' => GedcomCodeQuay::getValues()]);
- $relationship = null;
- $path1 = substr($path, 0, 3);
- $path2 = substr($path, 3);
- while ($path2) {
- // @TODO need the actual people
- // I18N: A complex relationship, such as “third-cousin’s great-uncle”
- $tmp = I18N::translate(
- '%1$s’s %2$s',
- self::getRelationshipNameFromPath($path1),
- self::getRelationshipNameFromPath($path2)
- $user_list[$tmp_user->userName()] = $tmp_user->userName();
- }
- $action = $request->getQueryParams()['action'] ?? '';
- // @TODO This ought to be a POST action
- if ($action === 'delete') {
- $this->changesQuery($request)->delete();
- }
- // First and last change in the database.
- 'n_soundex_surn_dm',
- ])->from('name')
- ->where('n_file', '=', $tree1->id());
- });
- // @TODO placelinks is harder than the others...
- (new Builder(DB::connection()))->from('dates')->insertUsing([
- 'd_file',
- 'd_gid',
- 'd_day',
- $ancestors = $this->allAncestors($self);
- } else {
- $ancestors = [];
- }
- // @TODO - convert this to use views
- $html = view('branches-list', [
- 'branches' => $this->getPatriarchsHtml($tree, $individuals, $ancestors, $surname, $soundex_dm, $soundex_std),
- ]);
- return response($html);
- $individual = Individual::getInstance($xref, $tree);
- Auth::checkIndividualAccess($individual, true);
- // @TODO - Move the name-specific code to this function?
- return app(EditGedcomRecordController::class)->updateFact($request, $tree);
- }
- /**
- * Add a new name record.
- $individual = Individual::getInstance($xref, $tree);
- Auth::checkIndividualAccess($individual, true);
- // @TODO - Move the name-specific code to this function?
- return app(EditGedcomRecordController::class)->updateFact($request, $tree);
- }
- /**
- </div>
- <?php
- $html = ob_get_clean();
- // @TODO convert this to use views
- return $this->viewResponse('individual-list-page', [
- 'content' => $html,
- 'title' => $title,
- ]);
- }
- if (!$media->canShow()) {
- return $this->httpStatusAsImage(StatusCodeInterface::STATUS_FORBIDDEN);
- }
- // @TODO handle SVG files
- foreach ($media->mediaFiles() as $media_file) {
- if ($media_file->factId() === $fact_id) {
- if ($media_file->isExternal()) {
- return redirect($media_file->filename());
- }
- }
- /**
- * Display an icon for this fact.
- *
- * @TODO use CSS for this
- *
- * @param Fact $fact
- *
- * @return string
- */
- $recursion = min($recursion, $max_recursion);
- $paths = $this->calculateRelationships($individual1, $individual2, $recursion, (bool) $ancestors);
- // @TODO - convert to views
- ob_start();
- if (I18N::direction() === 'ltr') {
- $diagonal1 = asset('css/images/dline.png');
- $diagonal2 = asset('css/images/dline2.png');
- } else {
- new FrenchDate($jd),
- new JewishDate($jd),
- new HijriDate($jd),
- ];
- // @TODO - there is a bug in the Persian Calendar that gives zero months for invalid dates
- if ($jd > (new PersianCalendar())->jdStart()) {
- $anniversaries[] = new JalaliDate($jd);
- }
- foreach ($anniversaries as $anniv) {
Code should not be duplicated 27
- Read doc
- Architecture
- Minor
More information: https://insight.symfony.com/what-we-analyse/php.duplicated_code
- ->select(['f_id AS xref', 'f_gedcom AS gedcom', 'd_type', 'd_day', 'd_month', 'd_year', 'd_fact', 'd_type']);
- // Now fetch these events
- $found_facts = [];
- foreach (['INDI' => $ind_query, 'FAM' => $fam_query] as $type => $query) {
- foreach ($query->get() as $row) {
- if ($type === 'INDI') {
- $record = Individual::getInstance($row->xref, $tree, $row->gedcom);
- } else {
- $record = Family::getInstance($row->xref, $tree, $row->gedcom);
- /**
- * The columns of the census.
- *
- * @return CensusColumnInterface[]
- */
- public function columns(): array
- {
- return [
- new CensusColumnFullName($this, 'Jméno', ''),
- new CensusColumnRelationToHead($this, 'Vztah', ''),
- new CensusColumnSexMZ($this, 'Pohlaví', ''),
- /**
- * The columns of the census.
- *
- * @return CensusColumnInterface[]
- */
- public function columns(): array
- {
- return [
- new CensusColumnFullName($this, 'Navn', ''),
- new CensusColumnSexMK($this, 'Køn', ''),
- new CensusColumnAge($this, 'Alder', ''),
- /**
- * The columns of the census.
- *
- * @return CensusColumnInterface[]
- */
- public function columns(): array
- {
- return [
- new CensusColumnFullName($this, 'Navn', 'Samtlige Personers Navn (ogsaa Fornavn). Ved Børn, endnu uden Navn, sættes „Dreng“ eller „Pige“. Midlertidig fraværerade Personer anføres ikke her, men paa Skemaeta Bagside)'),
- new CensusColumnSexMK($this, 'Køn', 'Kjønnet. Mandkøn (M) eller Kvindekøn (K).'),
- new CensusColumnBirthDaySlashMonthYear($this, 'Fødselsdag', 'Føderlsaar og Føderladag.'),
- namespace Fisharebest\Webtrees\Census;
- /**
- * Definitions for a census
- */
- class CensusOfEngland1911 extends CensusOfEngland implements CensusInterface
- {
- /**
- * When did this census occur.
- *
- * @return string
- /**
- * The columns of the census.
- *
- * @return CensusColumnInterface[]
- */
- public function columns(): array
- {
- return [
- new CensusColumnFullName($this, 'Name', 'Name of head of family'),
- new CensusColumnNull($this, 'M0-10', 'Free white males 0-10 years'),
- new CensusColumnNull($this, 'M10-16', 'Free white males 10-16 years'),
- /**
- * The columns of the census.
- *
- * @return CensusColumnInterface[]
- */
- public function columns(): array
- {
- return [
- new CensusColumnFullName($this, 'Name', 'Name of head of family'),
- new CensusColumnNull($this, 'M0', 'Free white males 0-5 years'),
- new CensusColumnNull($this, 'M5', 'Free white males 5-10 years'),
- new CensusColumnFullName($this, 'Name', 'Name'),
- new CensusColumnRelationToHead($this, 'Relation', 'Relationship of each person to the head of the family'),
- new CensusColumnNull($this, 'Home', 'Home owned or rented'),
- new CensusColumnNull($this, 'V/R', 'Value of house, if owned, or monthly rental if rented'),
- new CensusColumnNull($this, 'Radio', 'Radio set'),
- new CensusColumnNull($this, 'Farm', 'Does this family live on a farm'),
- new CensusColumnSexMF($this, 'Sex', 'Sex'),
- new CensusColumnNull($this, 'Race', 'Color or race'),
- new CensusColumnAge($this, 'Age', 'Age at last birthday'),
- new CensusColumnConditionUs($this, 'Cond', 'Whether single, married, widowed, or divorced'),
- new CensusColumnAgeMarried($this, 'AM', 'Age at first marriage'),
- if (self::$currentState === 'LTR') {
- // Move trailing numeric strings to the following RTL text. Include any blanks preceding or following the numeric text too.
- if (I18N::direction() === 'rtl' && self::$previousState === 'RTL' && !$theEnd) {
- $trailingString = '';
- $savedSpan = $textSpan;
- while ($textSpan !== '') {
- // Look for trailing spaces and tentatively move them
- if (substr($textSpan, -1) === ' ') {
- $trailingString = ' ' . $trailingString;
- $textSpan = substr($textSpan, 0, -1);
- continue;
- *
- * @return string[]
- */
- private function tagsForPrivacy(Tree $tree): array
- {
- $tags = array_unique(array_merge(
- explode(',', $tree->getPreference('INDI_FACTS_ADD')),
- explode(',', $tree->getPreference('INDI_FACTS_UNIQUE')),
- explode(',', $tree->getPreference('FAM_FACTS_ADD')),
- explode(',', $tree->getPreference('FAM_FACTS_UNIQUE')),
- explode(',', $tree->getPreference('NOTE_FACTS_ADD')),
- 'managers' => $user_service->managers(),
- 'moderators' => $user_service->moderators(),
- 'unapproved' => $user_service->unapproved(),
- 'unverified' => $user_service->unverified(),
- 'all_trees' => Tree::getAll(),
- 'changes' => $this->totalChanges(),
- 'individuals' => $this->totalIndividuals(),
- 'families' => $this->totalFamilies(),
- 'sources' => $this->totalSources(),
- 'media' => $this->totalMediaObjects(),
- 'repositories' => $this->totalRepositories(),
- *
- * @return ResponseInterface
- */
- public function page(ServerRequestInterface $request, Tree $tree): ResponseInterface
- {
- $cal = $request->getQueryParams()['cal'] ?? '';
- $day = $request->getQueryParams()['day'] ?? '';
- $month = $request->getQueryParams()['month'] ?? '';
- $year = $request->getQueryParams()['year'] ?? '';
- $view = $request->getQueryParams()['view'] ?? 'day';
- $filterev = $request->getQueryParams()['filterev'] ?? 'BIRT-MARR-DEAT';
- $family = Family::getInstance($xref, $tree);
- Auth::checkFamilyAccess($family, true);
- $this->glevels = $params['glevels'] ?? [];
- $this->tag = $params['tag'] ?? [];
- $this->text = $params['text'] ?? [];
- $this->islink = $params['islink'] ?? [];
- // Create the new spouse
- */
- private function updateUserBlocks(int $user_id, array $main_blocks, array $side_blocks): void
- {
- $existing_block_ids = DB::table('block')
- ->where('user_id', '=', $user_id)
- ->pluck('block_id');
- // Deleted blocks
- foreach ($existing_block_ids as $existing_block_id) {
- if (!in_array($existing_block_id, $main_blocks, false) && !in_array($existing_block_id, $side_blocks, false)) {
- DB::table('block_setting')
- {
- $url = $request->getQueryParams()['url'];
- $changes = DB::table('change')
- ->where('gedcom_id', '=', $tree->id())
- ->where('status', '=', 'pending')
- ->orderBy('change_id')
- ->get();
- foreach ($changes as $change) {
- if (empty($change->new_gedcom)) {
- * @return string
- */
- public function chartTitle(Individual $individual): string
- {
- /* I18N: %s is an individual’s name */
- return I18N::translate('Ancestors of %s', $individual->fullName());
- }
- /**
- * A form to request the chart parameters.
- *
- public function getFavorites(Tree $tree): array
- {
- return DB::table('favorite')
- ->where('gedcom_id', '=', $tree->id())
- ->whereNull('user_id')
- ->get()
- ->map(static function (stdClass $row) use ($tree): stdClass {
- if ($row->xref !== null) {
- $row->record = GedcomRecord::getInstance($row->xref, $tree);
- } else {
- $row->record = null;
- {
- $statistics = app(Statistics::class);
- $show_last_update = $this->getBlockSetting($block_id, 'show_last_update', '1');
- $show_common_surnames = $this->getBlockSetting($block_id, 'show_common_surnames', '1');
- $number_of_surnames = (int) $this->getBlockSetting($block_id, 'number_of_surnames', self::DEFAULT_NUMBER_OF_SURNAMES);
- $stat_indi = $this->getBlockSetting($block_id, 'stat_indi', '1');
- $stat_fam = $this->getBlockSetting($block_id, 'stat_fam', '1');
- $stat_sour = $this->getBlockSetting($block_id, 'stat_sour', '1');
- $stat_media = $this->getBlockSetting($block_id, 'stat_media', '1');
- $stat_repo = $this->getBlockSetting($block_id, 'stat_repo', '1');
- 'stat_avg_chil' => $stat_avg_chil,
- 'stats' => $statistics,
- 'surnames' => $surnames,
- ]);
- if ($context !== self::CONTEXT_EMBED) {
- return view('modules/block-template', [
- 'block' => Str::kebab($this->name()),
- 'id' => $block_id,
- 'config_url' => $this->configUrl($tree, $context, $block_id),
- 'title' => $this->title(),
- $facts = $calendar_service->getEventsList($startjd, $endjd, $events_filter, $filter, $sortStyle, $tree);
- if (empty($facts)) {
- $content = view('modules/todays_events/empty');
- } elseif ($infoStyle === 'list') {
- $content = view('lists/anniversaries-list', [
- 'facts' => $facts,
- ]);
- } else {
- $content = view('lists/anniversaries-table', [
- if ($num === 1) {
- // I18N: i.e. most popular given name.
- $title = I18N::translate('Top given name');
- } else {
- // I18N: Title for a list of the most common given names, %s is a number. Note that a separate translation exists when %s is 1
- $title = I18N::plural('Top %s given name', 'Top %s given names', $num, I18N::number($num));
- }
- return view('modules/block-template', [
- 'block' => Str::kebab($this->name()),
- 'id' => $block_id,
- if ($lw >= $this->wrapWidthRemaining || $lfct > 1) {
- $newtext = '';
- $wrapWidthRemaining = $this->wrapWidthRemaining;
- $lines = explode("\n", $this->numText);
- // Go throught the text line by line
- foreach ($lines as $line) {
- // Line width in points + a little margin
- $lw = $renderer->getStringWidth($line);
- // If the line has to be wraped
- if ($lw > $wrapWidthRemaining) {
- $words = explode(' ', $line);
- public function render($renderer)
- {
- // checkFootnote
- $newelements = [];
- $lastelement = [];
- $footnote_element = [];
- // Element counter
- $cE = count($this->elements);
- //-- collapse duplicate elements
- for ($i = 0; $i < $cE; $i++) {
- $element = $this->elements[$i];
- $newelements[] = $lastelement;
- $lastelement = [];
- }
- // Save the Footnote with it’s link number as key for sorting later
- $footnote_element[$element->num] = $element;
- } elseif (!($element instanceof ReportBaseFootnote) || trim($element->getValue()) != '') {
- // Do not keep empty footnotes
- if (!empty($footnote_element)) {
- ksort($footnote_element);
- foreach ($footnote_element as $links) {
- $newelements[] = $links;
- $height = (float) ($attrs['height'] ?? 0.0);
- $person = Individual::getInstance($id, $this->tree);
- $media_file = $person->findHighlightedMediaFile();
- if ($media_file !== null && $media_file->fileExists()) {
- $attributes = getimagesize($media_file->getServerFilename()) ?: [
- 0,
- 0,
- ];
- if ($width > 0 && $height == 0) {
- * @param string|null $color_from
- * @param string|null $color_to
- *
- * @return string
- */
- public function chartBirth(string $color_from = null, string $color_to = null): string
- {
- $chart_color1 = (string) $this->theme->parameter('distribution-chart-no-values');
- $chart_color2 = (string) $this->theme->parameter('distribution-chart-high-values');
- $color_from = $color_from ?? $chart_color1;
- $color_to = $color_to ?? $chart_color2;
- 'NAME' => $match['NAME'],
- 'SURN' => $match['SURN'],
- ]);
- }
- return [
- 'NAME' => '//',
- ];
- }
- /**
Unused method, property, variable or parameter 3
- Read doc
- Deadcode
- Minor
More information: https://insight.symfony.com/what-we-analyse/php.unused_local_variable_or_private_member
- /** @var Place The place of this fact, from the “2 PLAC …” attribute */
- private $place;
- /** @var int Used by Functions::sortFacts() */
- private $sortOrder;
- /**
- * Create an event object from a gedcom fragment.
- * We need the parent object (to check privacy) and a (pseudo) fact ID to
- * identify the fact within the record.
- * @param string $value
- * @param string $gedcom
- *
- * @return void
- */
- protected function addName(string $type, string $value, string $gedcom): void
- {
- $this->getAllNames[] = [
- 'type' => $type,
- 'sort' => preg_replace_callback('/([0-9]+)/', static function (array $matches): string {
- return str_pad($matches[0], 10, '0', STR_PAD_LEFT);
- class AccountController extends AbstractBaseController
- {
- /**
- * @var ModuleService
- */
- private $module_service;
- /**
- * @var UserService
- */
- private $user_service;
Web applications should contain a site.webmanifest file
- Read doc
- Readability
- Minor
More information: https://insight.symfony.com/what-we-analyse/web.missing_web_manifest
-
public
- ckeditor-4.11.2-custom
- css
- js
- webfonts
- browserconfig.xml
- favicon-120.png
- favicon-128.png
- favicon-144.png
- favicon-152.png
- favicon-167.png
- favicon-180.png
- favicon-192.png
- favicon-196.png
- favicon-32.png
- favicon-57.png
- favicon-76.png
- favicon-96.png
- favicon.ico