@@ -125,75 +125,75 @@ |
||
125 | 125 | // MySQL supports a wide range of collation conversions. These are ones that |
126 | 126 | // have been encountered "in the wild". |
127 | 127 | switch ($charset) { |
128 | - case 'ASCII': |
|
129 | - Database::prepare( |
|
130 | - "UPDATE `##gedcom_chunk`" . |
|
131 | - " SET chunk_data=CONVERT(CONVERT(chunk_data USING ascii) USING utf8)" . |
|
132 | - " WHERE gedcom_id=?" |
|
133 | - )->execute(array($gedcom_id)); |
|
134 | - break; |
|
135 | - case 'IBMPC': // IBMPC, IBM WINDOWS and MS-DOS could be anything. Mostly it means CP850. |
|
136 | - case 'IBM WINDOWS': |
|
137 | - case 'MS-DOS': |
|
138 | - case 'CP437': |
|
139 | - case 'CP850': |
|
140 | - // CP850 has extra letters with diacritics to replace box-drawing chars in CP437. |
|
141 | - Database::prepare( |
|
142 | - "UPDATE `##gedcom_chunk`" . |
|
143 | - " SET chunk_data=CONVERT(CONVERT(chunk_data USING cp850) USING utf8)" . |
|
144 | - " WHERE gedcom_id=?" |
|
145 | - )->execute(array($gedcom_id)); |
|
146 | - break; |
|
147 | - case 'ANSI': // ANSI could be anything. Most applications seem to treat it as latin1. |
|
148 | - $controller->addInlineJavascript( |
|
149 | - 'jQuery("#import' . $gedcom_id . '").parent().prepend("<div class=\"bg-info\">' . /* I18N: %1$s and %2$s are the names of character encodings, such as ISO-8859-1 or ASCII */ |
|
150 | - I18N::translate('This GEDCOM file is encoded using %1$s. Assume this to mean %2$s.', $charset, 'ISO-8859-1') . '</div>");' |
|
151 | - ); |
|
152 | - // no break; |
|
153 | - case 'WINDOWS': |
|
154 | - case 'CP1252': |
|
155 | - case 'ISO8859-1': |
|
156 | - case 'ISO-8859-1': |
|
157 | - case 'LATIN1': |
|
158 | - case 'LATIN-1': |
|
159 | - // Convert from ISO-8859-1 (western european) to UTF8. |
|
160 | - Database::prepare( |
|
161 | - "UPDATE `##gedcom_chunk`" . |
|
162 | - " SET chunk_data=CONVERT(CONVERT(chunk_data USING latin1) USING utf8)" . |
|
163 | - " WHERE gedcom_id=?" |
|
164 | - )->execute(array($gedcom_id)); |
|
165 | - break; |
|
166 | - case 'CP1250': |
|
167 | - case 'ISO8859-2': |
|
168 | - case 'ISO-8859-2': |
|
169 | - case 'LATIN2': |
|
170 | - case 'LATIN-2': |
|
171 | - // Convert from ISO-8859-2 (eastern european) to UTF8. |
|
172 | - Database::prepare( |
|
173 | - "UPDATE `##gedcom_chunk`" . |
|
174 | - " SET chunk_data=CONVERT(CONVERT(chunk_data USING latin2) USING utf8)" . |
|
175 | - " WHERE gedcom_id=?" |
|
176 | - )->execute(array($gedcom_id)); |
|
177 | - break; |
|
178 | - case 'MACINTOSH': |
|
179 | - // Convert from MAC Roman to UTF8. |
|
180 | - Database::prepare( |
|
181 | - "UPDATE `##gedcom_chunk`" . |
|
182 | - " SET chunk_data=CONVERT(CONVERT(chunk_data USING macroman) USING utf8)" . |
|
183 | - " WHERE gedcom_id=?" |
|
184 | - )->execute(array($gedcom_id)); |
|
185 | - break; |
|
186 | - case 'UTF8': |
|
187 | - case 'UTF-8': |
|
188 | - // Already UTF-8 so nothing to do! |
|
189 | - break; |
|
190 | - case 'ANSEL': |
|
191 | - default: |
|
192 | - Database::rollBack(); |
|
193 | - echo '<span class="error">', I18N::translate('Error: converting GEDCOM files from %s encoding to UTF-8 encoding not currently supported.', $charset), '</span>'; |
|
194 | - $controller->addInlineJavascript('jQuery("#actions' . $gedcom_id . '").removeClass("hidden");'); |
|
195 | - |
|
196 | - return; |
|
128 | + case 'ASCII': |
|
129 | + Database::prepare( |
|
130 | + "UPDATE `##gedcom_chunk`" . |
|
131 | + " SET chunk_data=CONVERT(CONVERT(chunk_data USING ascii) USING utf8)" . |
|
132 | + " WHERE gedcom_id=?" |
|
133 | + )->execute(array($gedcom_id)); |
|
134 | + break; |
|
135 | + case 'IBMPC': // IBMPC, IBM WINDOWS and MS-DOS could be anything. Mostly it means CP850. |
|
136 | + case 'IBM WINDOWS': |
|
137 | + case 'MS-DOS': |
|
138 | + case 'CP437': |
|
139 | + case 'CP850': |
|
140 | + // CP850 has extra letters with diacritics to replace box-drawing chars in CP437. |
|
141 | + Database::prepare( |
|
142 | + "UPDATE `##gedcom_chunk`" . |
|
143 | + " SET chunk_data=CONVERT(CONVERT(chunk_data USING cp850) USING utf8)" . |
|
144 | + " WHERE gedcom_id=?" |
|
145 | + )->execute(array($gedcom_id)); |
|
146 | + break; |
|
147 | + case 'ANSI': // ANSI could be anything. Most applications seem to treat it as latin1. |
|
148 | + $controller->addInlineJavascript( |
|
149 | + 'jQuery("#import' . $gedcom_id . '").parent().prepend("<div class=\"bg-info\">' . /* I18N: %1$s and %2$s are the names of character encodings, such as ISO-8859-1 or ASCII */ |
|
150 | + I18N::translate('This GEDCOM file is encoded using %1$s. Assume this to mean %2$s.', $charset, 'ISO-8859-1') . '</div>");' |
|
151 | + ); |
|
152 | + // no break; |
|
153 | + case 'WINDOWS': |
|
154 | + case 'CP1252': |
|
155 | + case 'ISO8859-1': |
|
156 | + case 'ISO-8859-1': |
|
157 | + case 'LATIN1': |
|
158 | + case 'LATIN-1': |
|
159 | + // Convert from ISO-8859-1 (western european) to UTF8. |
|
160 | + Database::prepare( |
|
161 | + "UPDATE `##gedcom_chunk`" . |
|
162 | + " SET chunk_data=CONVERT(CONVERT(chunk_data USING latin1) USING utf8)" . |
|
163 | + " WHERE gedcom_id=?" |
|
164 | + )->execute(array($gedcom_id)); |
|
165 | + break; |
|
166 | + case 'CP1250': |
|
167 | + case 'ISO8859-2': |
|
168 | + case 'ISO-8859-2': |
|
169 | + case 'LATIN2': |
|
170 | + case 'LATIN-2': |
|
171 | + // Convert from ISO-8859-2 (eastern european) to UTF8. |
|
172 | + Database::prepare( |
|
173 | + "UPDATE `##gedcom_chunk`" . |
|
174 | + " SET chunk_data=CONVERT(CONVERT(chunk_data USING latin2) USING utf8)" . |
|
175 | + " WHERE gedcom_id=?" |
|
176 | + )->execute(array($gedcom_id)); |
|
177 | + break; |
|
178 | + case 'MACINTOSH': |
|
179 | + // Convert from MAC Roman to UTF8. |
|
180 | + Database::prepare( |
|
181 | + "UPDATE `##gedcom_chunk`" . |
|
182 | + " SET chunk_data=CONVERT(CONVERT(chunk_data USING macroman) USING utf8)" . |
|
183 | + " WHERE gedcom_id=?" |
|
184 | + )->execute(array($gedcom_id)); |
|
185 | + break; |
|
186 | + case 'UTF8': |
|
187 | + case 'UTF-8': |
|
188 | + // Already UTF-8 so nothing to do! |
|
189 | + break; |
|
190 | + case 'ANSEL': |
|
191 | + default: |
|
192 | + Database::rollBack(); |
|
193 | + echo '<span class="error">', I18N::translate('Error: converting GEDCOM files from %s encoding to UTF-8 encoding not currently supported.', $charset), '</span>'; |
|
194 | + $controller->addInlineJavascript('jQuery("#actions' . $gedcom_id . '").removeClass("hidden");'); |
|
195 | + |
|
196 | + return; |
|
197 | 197 | } |
198 | 198 | $first_time = false; |
199 | 199 |
@@ -852,528 +852,528 @@ |
||
852 | 852 | echo '<div class="statistics_chart" title="', I18N::translate('Statistics chart'), '">'; |
853 | 853 | |
854 | 854 | switch ($x_axis) { |
855 | -case '1': |
|
856 | - echo $stats->chartDistribution(array(Filter::get('chart_shows'), Filter::get('chart_type'), Filter::get('SURN'))); |
|
857 | - break; |
|
858 | -case '2': |
|
859 | - echo $stats->chartDistribution(array(Filter::get('chart_shows'), 'birth_distribution_chart')); |
|
860 | - break; |
|
861 | -case '3': |
|
862 | - echo $stats->chartDistribution(array(Filter::get('chart_shows'), 'death_distribution_chart')); |
|
863 | - break; |
|
864 | -case '4': |
|
865 | - echo $stats->chartDistribution(array(Filter::get('chart_shows'), 'marriage_distribution_chart')); |
|
866 | - break; |
|
867 | -case '11': |
|
868 | - $monthdata = array(); |
|
869 | - for ($i = 0; $i < 12; ++$i) { |
|
870 | - $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
871 | - } |
|
872 | - $xgiven = true; |
|
873 | - $zgiven = false; |
|
874 | - $title = I18N::translate('Month of birth'); |
|
875 | - $xtitle = I18N::translate('month'); |
|
876 | - $ytitle = I18N::translate('numbers'); |
|
877 | - $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
878 | - $xdata = $monthdata; |
|
879 | - $xmax = 12; |
|
880 | - if ($z_axis !== 300 && $z_axis !== 301) { |
|
881 | - calculate_legend($boundaries_z_axis); |
|
882 | - } |
|
883 | - $percentage = false; |
|
884 | - if ($y_axis === 201) { |
|
855 | + case '1': |
|
856 | + echo $stats->chartDistribution(array(Filter::get('chart_shows'), Filter::get('chart_type'), Filter::get('SURN'))); |
|
857 | + break; |
|
858 | + case '2': |
|
859 | + echo $stats->chartDistribution(array(Filter::get('chart_shows'), 'birth_distribution_chart')); |
|
860 | + break; |
|
861 | + case '3': |
|
862 | + echo $stats->chartDistribution(array(Filter::get('chart_shows'), 'death_distribution_chart')); |
|
863 | + break; |
|
864 | + case '4': |
|
865 | + echo $stats->chartDistribution(array(Filter::get('chart_shows'), 'marriage_distribution_chart')); |
|
866 | + break; |
|
867 | + case '11': |
|
868 | + $monthdata = array(); |
|
869 | + for ($i = 0; $i < 12; ++$i) { |
|
870 | + $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
871 | + } |
|
872 | + $xgiven = true; |
|
873 | + $zgiven = false; |
|
874 | + $title = I18N::translate('Month of birth'); |
|
875 | + $xtitle = I18N::translate('month'); |
|
876 | + $ytitle = I18N::translate('numbers'); |
|
877 | + $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
878 | + $xdata = $monthdata; |
|
879 | + $xmax = 12; |
|
880 | + if ($z_axis !== 300 && $z_axis !== 301) { |
|
881 | + calculate_legend($boundaries_z_axis); |
|
882 | + } |
|
885 | 883 | $percentage = false; |
886 | - $ytitle = I18N::translate('Individuals'); |
|
887 | - } elseif ($y_axis === 202) { |
|
888 | - $percentage = true; |
|
889 | - $ytitle = I18N::translate('percentage'); |
|
890 | - } |
|
891 | - $male_female = false; |
|
892 | - if ($z_axis === 300) { |
|
893 | - $zgiven = false; |
|
894 | - $legend[0] = 'all'; |
|
895 | - $zmax = 1; |
|
896 | - $z_boundaries[0] = 100000; |
|
897 | - } elseif ($z_axis === 301) { |
|
898 | - $male_female = true; |
|
899 | - $zgiven = true; |
|
900 | - $legend[0] = I18N::translate('Male'); |
|
901 | - $legend[1] = I18N::translate('Female'); |
|
902 | - $zmax = 2; |
|
903 | - $xtitle = $xtitle . I18N::translate(' per gender'); |
|
904 | - } elseif ($z_axis === 302) { |
|
905 | - $xtitle = $xtitle . I18N::translate(' per time period'); |
|
906 | - } |
|
907 | - //-- reset the data array |
|
908 | - for ($i = 0; $i < $zmax; $i++) { |
|
909 | - for ($j = 0; $j < $xmax; $j++) { |
|
910 | - $ydata[$i][$j] = 0; |
|
884 | + if ($y_axis === 201) { |
|
885 | + $percentage = false; |
|
886 | + $ytitle = I18N::translate('Individuals'); |
|
887 | + } elseif ($y_axis === 202) { |
|
888 | + $percentage = true; |
|
889 | + $ytitle = I18N::translate('percentage'); |
|
890 | + } |
|
891 | + $male_female = false; |
|
892 | + if ($z_axis === 300) { |
|
893 | + $zgiven = false; |
|
894 | + $legend[0] = 'all'; |
|
895 | + $zmax = 1; |
|
896 | + $z_boundaries[0] = 100000; |
|
897 | + } elseif ($z_axis === 301) { |
|
898 | + $male_female = true; |
|
899 | + $zgiven = true; |
|
900 | + $legend[0] = I18N::translate('Male'); |
|
901 | + $legend[1] = I18N::translate('Female'); |
|
902 | + $zmax = 2; |
|
903 | + $xtitle = $xtitle . I18N::translate(' per gender'); |
|
904 | + } elseif ($z_axis === 302) { |
|
905 | + $xtitle = $xtitle . I18N::translate(' per time period'); |
|
906 | + } |
|
907 | + //-- reset the data array |
|
908 | + for ($i = 0; $i < $zmax; $i++) { |
|
909 | + for ($j = 0; $j < $xmax; $j++) { |
|
910 | + $ydata[$i][$j] = 0; |
|
911 | + } |
|
912 | + } |
|
913 | + $total = month_of_birth($z_axis, $z_boundaries, $stats); |
|
914 | + $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals(); |
|
915 | + my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
916 | + break; |
|
917 | + case '12': |
|
918 | + $monthdata = array(); |
|
919 | + for ($i = 0; $i < 12; ++$i) { |
|
920 | + $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
921 | + } |
|
922 | + $xgiven = true; |
|
923 | + $zgiven = false; |
|
924 | + $title = I18N::translate('Month of death'); |
|
925 | + $xtitle = I18N::translate('month'); |
|
926 | + $ytitle = I18N::translate('numbers'); |
|
927 | + $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
928 | + $xdata = $monthdata; |
|
929 | + $xmax = 12; |
|
930 | + if ($z_axis !== 300 && $z_axis !== 301) { |
|
931 | + calculate_legend($boundaries_z_axis); |
|
911 | 932 | } |
912 | - } |
|
913 | - $total = month_of_birth($z_axis, $z_boundaries, $stats); |
|
914 | - $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals(); |
|
915 | - my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
916 | - break; |
|
917 | -case '12': |
|
918 | - $monthdata = array(); |
|
919 | - for ($i = 0; $i < 12; ++$i) { |
|
920 | - $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
921 | - } |
|
922 | - $xgiven = true; |
|
923 | - $zgiven = false; |
|
924 | - $title = I18N::translate('Month of death'); |
|
925 | - $xtitle = I18N::translate('month'); |
|
926 | - $ytitle = I18N::translate('numbers'); |
|
927 | - $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
928 | - $xdata = $monthdata; |
|
929 | - $xmax = 12; |
|
930 | - if ($z_axis !== 300 && $z_axis !== 301) { |
|
931 | - calculate_legend($boundaries_z_axis); |
|
932 | - } |
|
933 | - $percentage = false; |
|
934 | - if ($y_axis === 201) { |
|
935 | 933 | $percentage = false; |
936 | - $ytitle = I18N::translate('Individuals'); |
|
937 | - } elseif ($y_axis === 202) { |
|
938 | - $percentage = true; |
|
939 | - $ytitle = I18N::translate('percentage'); |
|
940 | - } |
|
941 | - $male_female = false; |
|
942 | - if ($z_axis === 300) { |
|
943 | - $zgiven = false; |
|
944 | - $legend[0] = 'all'; |
|
945 | - $zmax = 1; |
|
946 | - $z_boundaries[0] = 100000; |
|
947 | - } elseif ($z_axis === 301) { |
|
948 | - $male_female = true; |
|
949 | - $zgiven = true; |
|
950 | - $legend[0] = I18N::translate('Male'); |
|
951 | - $legend[1] = I18N::translate('Female'); |
|
952 | - $zmax = 2; |
|
953 | - $xtitle = $xtitle . I18N::translate(' per gender'); |
|
954 | - } elseif ($z_axis === 302) { |
|
955 | - $xtitle = $xtitle . I18N::translate(' per time period'); |
|
956 | - } |
|
957 | - //-- reset the data array |
|
958 | - for ($i = 0; $i < $zmax; $i++) { |
|
959 | - for ($j = 0; $j < $xmax; $j++) { |
|
960 | - $ydata[$i][$j] = 0; |
|
934 | + if ($y_axis === 201) { |
|
935 | + $percentage = false; |
|
936 | + $ytitle = I18N::translate('Individuals'); |
|
937 | + } elseif ($y_axis === 202) { |
|
938 | + $percentage = true; |
|
939 | + $ytitle = I18N::translate('percentage'); |
|
940 | + } |
|
941 | + $male_female = false; |
|
942 | + if ($z_axis === 300) { |
|
943 | + $zgiven = false; |
|
944 | + $legend[0] = 'all'; |
|
945 | + $zmax = 1; |
|
946 | + $z_boundaries[0] = 100000; |
|
947 | + } elseif ($z_axis === 301) { |
|
948 | + $male_female = true; |
|
949 | + $zgiven = true; |
|
950 | + $legend[0] = I18N::translate('Male'); |
|
951 | + $legend[1] = I18N::translate('Female'); |
|
952 | + $zmax = 2; |
|
953 | + $xtitle = $xtitle . I18N::translate(' per gender'); |
|
954 | + } elseif ($z_axis === 302) { |
|
955 | + $xtitle = $xtitle . I18N::translate(' per time period'); |
|
956 | + } |
|
957 | + //-- reset the data array |
|
958 | + for ($i = 0; $i < $zmax; $i++) { |
|
959 | + for ($j = 0; $j < $xmax; $j++) { |
|
960 | + $ydata[$i][$j] = 0; |
|
961 | + } |
|
962 | + } |
|
963 | + $total = month_of_death($z_axis, $z_boundaries, $stats); |
|
964 | + $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals(); |
|
965 | + my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
966 | + break; |
|
967 | + case '13': |
|
968 | + $monthdata = array(); |
|
969 | + for ($i = 0; $i < 12; ++$i) { |
|
970 | + $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
961 | 971 | } |
962 | - } |
|
963 | - $total = month_of_death($z_axis, $z_boundaries, $stats); |
|
964 | - $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals(); |
|
965 | - my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
966 | - break; |
|
967 | -case '13': |
|
968 | - $monthdata = array(); |
|
969 | - for ($i = 0; $i < 12; ++$i) { |
|
970 | - $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
971 | - } |
|
972 | 972 | |
973 | - if ($z_axis === 301) { |
|
974 | - $z_axis = 300; |
|
975 | - } |
|
976 | - $xgiven = true; |
|
977 | - $zgiven = false; |
|
978 | - $title = I18N::translate('Month of marriage'); |
|
979 | - $xtitle = I18N::translate('month'); |
|
980 | - $ytitle = I18N::translate('numbers'); |
|
981 | - $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
982 | - $xdata = $monthdata; |
|
983 | - $xmax = 12; |
|
984 | - if ($z_axis !== 300 && $z_axis !== 301) { |
|
985 | - calculate_legend($boundaries_z_axis); |
|
986 | - } |
|
987 | - $percentage = false; |
|
988 | - if ($y_axis === 201) { |
|
973 | + if ($z_axis === 301) { |
|
974 | + $z_axis = 300; |
|
975 | + } |
|
976 | + $xgiven = true; |
|
977 | + $zgiven = false; |
|
978 | + $title = I18N::translate('Month of marriage'); |
|
979 | + $xtitle = I18N::translate('month'); |
|
980 | + $ytitle = I18N::translate('numbers'); |
|
981 | + $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
982 | + $xdata = $monthdata; |
|
983 | + $xmax = 12; |
|
984 | + if ($z_axis !== 300 && $z_axis !== 301) { |
|
985 | + calculate_legend($boundaries_z_axis); |
|
986 | + } |
|
989 | 987 | $percentage = false; |
990 | - $ytitle = I18N::translate('Families'); |
|
991 | - } elseif ($y_axis === 202) { |
|
992 | - $percentage = true; |
|
993 | - $ytitle = I18N::translate('percentage'); |
|
994 | - } |
|
995 | - $male_female = false; |
|
996 | - if ($z_axis === 300) { |
|
997 | - $zgiven = false; |
|
998 | - $legend[0] = 'all'; |
|
999 | - $zmax = 1; |
|
1000 | - $z_boundaries[0] = 100000; |
|
1001 | - } elseif ($z_axis === 301) { |
|
1002 | - $male_female = true; |
|
1003 | - $zgiven = true; |
|
1004 | - $legend[0] = I18N::translate('Male'); |
|
1005 | - $legend[1] = I18N::translate('Female'); |
|
1006 | - $zmax = 2; |
|
1007 | - $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1008 | - } elseif ($z_axis === 302) { |
|
1009 | - $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1010 | - } |
|
1011 | - //-- reset the data array |
|
1012 | - for ($i = 0; $i < $zmax; $i++) { |
|
1013 | - for ($j = 0; $j < $xmax; $j++) { |
|
1014 | - $ydata[$i][$j] = 0; |
|
988 | + if ($y_axis === 201) { |
|
989 | + $percentage = false; |
|
990 | + $ytitle = I18N::translate('Families'); |
|
991 | + } elseif ($y_axis === 202) { |
|
992 | + $percentage = true; |
|
993 | + $ytitle = I18N::translate('percentage'); |
|
994 | + } |
|
995 | + $male_female = false; |
|
996 | + if ($z_axis === 300) { |
|
997 | + $zgiven = false; |
|
998 | + $legend[0] = 'all'; |
|
999 | + $zmax = 1; |
|
1000 | + $z_boundaries[0] = 100000; |
|
1001 | + } elseif ($z_axis === 301) { |
|
1002 | + $male_female = true; |
|
1003 | + $zgiven = true; |
|
1004 | + $legend[0] = I18N::translate('Male'); |
|
1005 | + $legend[1] = I18N::translate('Female'); |
|
1006 | + $zmax = 2; |
|
1007 | + $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1008 | + } elseif ($z_axis === 302) { |
|
1009 | + $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1010 | + } |
|
1011 | + //-- reset the data array |
|
1012 | + for ($i = 0; $i < $zmax; $i++) { |
|
1013 | + for ($j = 0; $j < $xmax; $j++) { |
|
1014 | + $ydata[$i][$j] = 0; |
|
1015 | + } |
|
1016 | + } |
|
1017 | + $total = month_of_marriage($z_axis, $z_boundaries, $stats); |
|
1018 | + $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalFamilies(); |
|
1019 | + my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1020 | + break; |
|
1021 | + case '14': |
|
1022 | + $monthdata = array(); |
|
1023 | + for ($i = 0; $i < 12; ++$i) { |
|
1024 | + $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
1025 | + } |
|
1026 | + $xgiven = true; |
|
1027 | + $zgiven = false; |
|
1028 | + $title = I18N::translate('Month of birth of first child in a relation'); |
|
1029 | + $xtitle = I18N::translate('month'); |
|
1030 | + $ytitle = I18N::translate('numbers'); |
|
1031 | + $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
1032 | + $xdata = $monthdata; |
|
1033 | + $xmax = 12; |
|
1034 | + if ($z_axis !== 300 && $z_axis !== 301) { |
|
1035 | + calculate_legend($boundaries_z_axis); |
|
1015 | 1036 | } |
1016 | - } |
|
1017 | - $total = month_of_marriage($z_axis, $z_boundaries, $stats); |
|
1018 | - $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalFamilies(); |
|
1019 | - my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1020 | - break; |
|
1021 | -case '14': |
|
1022 | - $monthdata = array(); |
|
1023 | - for ($i = 0; $i < 12; ++$i) { |
|
1024 | - $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
1025 | - } |
|
1026 | - $xgiven = true; |
|
1027 | - $zgiven = false; |
|
1028 | - $title = I18N::translate('Month of birth of first child in a relation'); |
|
1029 | - $xtitle = I18N::translate('month'); |
|
1030 | - $ytitle = I18N::translate('numbers'); |
|
1031 | - $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
1032 | - $xdata = $monthdata; |
|
1033 | - $xmax = 12; |
|
1034 | - if ($z_axis !== 300 && $z_axis !== 301) { |
|
1035 | - calculate_legend($boundaries_z_axis); |
|
1036 | - } |
|
1037 | - $percentage = false; |
|
1038 | - if ($y_axis === 201) { |
|
1039 | 1037 | $percentage = false; |
1040 | - $ytitle = I18N::translate('Children'); |
|
1041 | - } elseif ($y_axis === 202) { |
|
1042 | - $percentage = true; |
|
1043 | - $ytitle = I18N::translate('percentage'); |
|
1044 | - } |
|
1045 | - $male_female = false; |
|
1046 | - if ($z_axis === 300) { |
|
1047 | - $zgiven = false; |
|
1048 | - $legend[0] = 'all'; |
|
1049 | - $zmax = 1; |
|
1050 | - $z_boundaries[0] = 100000; |
|
1051 | - } elseif ($z_axis === 301) { |
|
1052 | - $male_female = true; |
|
1053 | - $zgiven = true; |
|
1054 | - $legend[0] = I18N::translate('Male'); |
|
1055 | - $legend[1] = I18N::translate('Female'); |
|
1056 | - $zmax = 2; |
|
1057 | - $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1058 | - } elseif ($z_axis === 302) { |
|
1059 | - $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1060 | - } |
|
1061 | - //-- reset the data array |
|
1062 | - for ($i = 0; $i < $zmax; $i++) { |
|
1063 | - for ($j = 0; $j < $xmax; $j++) { |
|
1064 | - $ydata[$i][$j] = 0; |
|
1038 | + if ($y_axis === 201) { |
|
1039 | + $percentage = false; |
|
1040 | + $ytitle = I18N::translate('Children'); |
|
1041 | + } elseif ($y_axis === 202) { |
|
1042 | + $percentage = true; |
|
1043 | + $ytitle = I18N::translate('percentage'); |
|
1044 | + } |
|
1045 | + $male_female = false; |
|
1046 | + if ($z_axis === 300) { |
|
1047 | + $zgiven = false; |
|
1048 | + $legend[0] = 'all'; |
|
1049 | + $zmax = 1; |
|
1050 | + $z_boundaries[0] = 100000; |
|
1051 | + } elseif ($z_axis === 301) { |
|
1052 | + $male_female = true; |
|
1053 | + $zgiven = true; |
|
1054 | + $legend[0] = I18N::translate('Male'); |
|
1055 | + $legend[1] = I18N::translate('Female'); |
|
1056 | + $zmax = 2; |
|
1057 | + $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1058 | + } elseif ($z_axis === 302) { |
|
1059 | + $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1060 | + } |
|
1061 | + //-- reset the data array |
|
1062 | + for ($i = 0; $i < $zmax; $i++) { |
|
1063 | + for ($j = 0; $j < $xmax; $j++) { |
|
1064 | + $ydata[$i][$j] = 0; |
|
1065 | + } |
|
1066 | + } |
|
1067 | + $total = month_of_birth_of_first_child($z_axis, $z_boundaries, $stats); |
|
1068 | + $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalFamilies(); |
|
1069 | + my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1070 | + break; |
|
1071 | + case '15': |
|
1072 | + $monthdata = array(); |
|
1073 | + for ($i = 0; $i < 12; ++$i) { |
|
1074 | + $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
1065 | 1075 | } |
1066 | - } |
|
1067 | - $total = month_of_birth_of_first_child($z_axis, $z_boundaries, $stats); |
|
1068 | - $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalFamilies(); |
|
1069 | - my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1070 | - break; |
|
1071 | -case '15': |
|
1072 | - $monthdata = array(); |
|
1073 | - for ($i = 0; $i < 12; ++$i) { |
|
1074 | - $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
1075 | - } |
|
1076 | 1076 | |
1077 | - if ($z_axis === 301) { |
|
1078 | - $z_axis = 300; |
|
1079 | - } |
|
1080 | - $xgiven = true; |
|
1081 | - $zgiven = false; |
|
1082 | - $title = I18N::translate('Month of first marriage'); |
|
1083 | - $xtitle = I18N::translate('month'); |
|
1084 | - $ytitle = I18N::translate('numbers'); |
|
1085 | - $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
1086 | - $xdata = $monthdata; |
|
1087 | - $xmax = 12; |
|
1088 | - if ($z_axis !== 300 && $z_axis !== 301) { |
|
1089 | - calculate_legend($boundaries_z_axis); |
|
1090 | - } |
|
1091 | - $percentage = false; |
|
1092 | - if ($y_axis === 201) { |
|
1093 | - $percentage = false; |
|
1094 | - $ytitle = I18N::translate('Families'); |
|
1095 | - } elseif ($y_axis === 202) { |
|
1096 | - $percentage = true; |
|
1097 | - $ytitle = I18N::translate('percentage'); |
|
1098 | - } |
|
1099 | - $male_female = false; |
|
1100 | - if ($z_axis === 300) { |
|
1101 | - $zgiven = false; |
|
1102 | - $legend[0] = 'all'; |
|
1103 | - $zmax = 1; |
|
1104 | - $z_boundaries[0] = 100000; |
|
1105 | - } elseif ($z_axis === 301) { |
|
1106 | - $male_female = true; |
|
1107 | - $zgiven = true; |
|
1108 | - $legend[0] = I18N::translate('Male'); |
|
1109 | - $legend[1] = I18N::translate('Female'); |
|
1110 | - $zmax = 2; |
|
1111 | - $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1112 | - } elseif ($z_axis === 302) { |
|
1113 | - $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1114 | - } |
|
1115 | - //-- reset the data array |
|
1116 | - for ($i = 0; $i < $zmax; $i++) { |
|
1117 | - for ($j = 0; $j < $xmax; $j++) { |
|
1118 | - $ydata[$i][$j] = 0; |
|
1077 | + if ($z_axis === 301) { |
|
1078 | + $z_axis = 300; |
|
1079 | + } |
|
1080 | + $xgiven = true; |
|
1081 | + $zgiven = false; |
|
1082 | + $title = I18N::translate('Month of first marriage'); |
|
1083 | + $xtitle = I18N::translate('month'); |
|
1084 | + $ytitle = I18N::translate('numbers'); |
|
1085 | + $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
1086 | + $xdata = $monthdata; |
|
1087 | + $xmax = 12; |
|
1088 | + if ($z_axis !== 300 && $z_axis !== 301) { |
|
1089 | + calculate_legend($boundaries_z_axis); |
|
1119 | 1090 | } |
1120 | - } |
|
1121 | - $total = month_of_first_marriage($z_axis, $z_boundaries, $stats); |
|
1122 | - $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalFamilies(); |
|
1123 | - my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1124 | - break; |
|
1125 | -case '17': |
|
1126 | - $monthdata = array(); |
|
1127 | - for ($i = 0; $i < 12; ++$i) { |
|
1128 | - $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
1129 | - } |
|
1130 | - $xgiven = false; |
|
1131 | - $zgiven = false; |
|
1132 | - $title = I18N::translate('Age related to birth year'); |
|
1133 | - $xtitle = I18N::translate('age'); |
|
1134 | - $ytitle = I18N::translate('numbers'); |
|
1135 | - $boundaries_x_axis = Filter::get('x-axis-boundaries-ages'); |
|
1136 | - $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
1137 | - calculate_axis($boundaries_x_axis); |
|
1138 | - if ($z_axis !== 300 && $z_axis !== 301) { |
|
1139 | - calculate_legend($boundaries_z_axis); |
|
1140 | - } |
|
1141 | - $percentage = false; |
|
1142 | - if ($y_axis === 201) { |
|
1143 | 1091 | $percentage = false; |
1144 | - $ytitle = I18N::translate('Individuals'); |
|
1145 | - } elseif ($y_axis === 202) { |
|
1146 | - $percentage = true; |
|
1147 | - $ytitle = I18N::translate('percentage'); |
|
1148 | - } |
|
1149 | - $male_female = false; |
|
1150 | - if ($z_axis === 300) { |
|
1151 | - $zgiven = false; |
|
1152 | - $legend[0] = 'all'; |
|
1153 | - $zmax = 1; |
|
1154 | - $z_boundaries[0] = 100000; |
|
1155 | - } elseif ($z_axis === 301) { |
|
1156 | - $male_female = true; |
|
1157 | - $zgiven = true; |
|
1158 | - $legend[0] = I18N::translate('Male'); |
|
1159 | - $legend[1] = I18N::translate('Female'); |
|
1160 | - $zmax = 2; |
|
1161 | - $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1162 | - } elseif ($z_axis === 302) { |
|
1163 | - $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1164 | - } |
|
1165 | - //-- reset the data array |
|
1166 | - for ($i = 0; $i < $zmax; $i++) { |
|
1167 | - for ($j = 0; $j < $xmax; $j++) { |
|
1168 | - $ydata[$i][$j] = 0; |
|
1092 | + if ($y_axis === 201) { |
|
1093 | + $percentage = false; |
|
1094 | + $ytitle = I18N::translate('Families'); |
|
1095 | + } elseif ($y_axis === 202) { |
|
1096 | + $percentage = true; |
|
1097 | + $ytitle = I18N::translate('percentage'); |
|
1098 | + } |
|
1099 | + $male_female = false; |
|
1100 | + if ($z_axis === 300) { |
|
1101 | + $zgiven = false; |
|
1102 | + $legend[0] = 'all'; |
|
1103 | + $zmax = 1; |
|
1104 | + $z_boundaries[0] = 100000; |
|
1105 | + } elseif ($z_axis === 301) { |
|
1106 | + $male_female = true; |
|
1107 | + $zgiven = true; |
|
1108 | + $legend[0] = I18N::translate('Male'); |
|
1109 | + $legend[1] = I18N::translate('Female'); |
|
1110 | + $zmax = 2; |
|
1111 | + $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1112 | + } elseif ($z_axis === 302) { |
|
1113 | + $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1114 | + } |
|
1115 | + //-- reset the data array |
|
1116 | + for ($i = 0; $i < $zmax; $i++) { |
|
1117 | + for ($j = 0; $j < $xmax; $j++) { |
|
1118 | + $ydata[$i][$j] = 0; |
|
1119 | + } |
|
1120 | + } |
|
1121 | + $total = month_of_first_marriage($z_axis, $z_boundaries, $stats); |
|
1122 | + $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalFamilies(); |
|
1123 | + my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1124 | + break; |
|
1125 | + case '17': |
|
1126 | + $monthdata = array(); |
|
1127 | + for ($i = 0; $i < 12; ++$i) { |
|
1128 | + $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
1129 | + } |
|
1130 | + $xgiven = false; |
|
1131 | + $zgiven = false; |
|
1132 | + $title = I18N::translate('Age related to birth year'); |
|
1133 | + $xtitle = I18N::translate('age'); |
|
1134 | + $ytitle = I18N::translate('numbers'); |
|
1135 | + $boundaries_x_axis = Filter::get('x-axis-boundaries-ages'); |
|
1136 | + $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
1137 | + calculate_axis($boundaries_x_axis); |
|
1138 | + if ($z_axis !== 300 && $z_axis !== 301) { |
|
1139 | + calculate_legend($boundaries_z_axis); |
|
1169 | 1140 | } |
1170 | - } |
|
1171 | - $total = lifespan_by_birth_year($z_axis, $z_boundaries, $stats); |
|
1172 | - $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals(); |
|
1173 | - my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1174 | - break; |
|
1175 | -case '18': |
|
1176 | - $monthdata = array(); |
|
1177 | - for ($i = 0; $i < 12; ++$i) { |
|
1178 | - $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
1179 | - } |
|
1180 | - $xgiven = false; |
|
1181 | - $zgiven = false; |
|
1182 | - $title = I18N::translate('Age related to death year'); |
|
1183 | - $xtitle = I18N::translate('age'); |
|
1184 | - $ytitle = I18N::translate('numbers'); |
|
1185 | - $boundaries_x_axis = Filter::get('x-axis-boundaries-ages'); |
|
1186 | - $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
1187 | - calculate_axis($boundaries_x_axis); |
|
1188 | - if ($z_axis !== 300 && $z_axis !== 301) { |
|
1189 | - calculate_legend($boundaries_z_axis); |
|
1190 | - } |
|
1191 | - $percentage = false; |
|
1192 | - if ($y_axis === 201) { |
|
1193 | 1141 | $percentage = false; |
1194 | - $ytitle = I18N::translate('Individuals'); |
|
1195 | - } elseif ($y_axis === 202) { |
|
1196 | - $percentage = true; |
|
1197 | - $ytitle = I18N::translate('percentage'); |
|
1198 | - } |
|
1199 | - $male_female = false; |
|
1200 | - if ($z_axis === 300) { |
|
1201 | - $zgiven = false; |
|
1202 | - $legend[0] = 'all'; |
|
1203 | - $zmax = 1; |
|
1204 | - $z_boundaries[0] = 100000; |
|
1205 | - } elseif ($z_axis === 301) { |
|
1206 | - $male_female = true; |
|
1207 | - $zgiven = true; |
|
1208 | - $legend[0] = I18N::translate('Male'); |
|
1209 | - $legend[1] = I18N::translate('Female'); |
|
1210 | - $zmax = 2; |
|
1211 | - $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1212 | - } elseif ($z_axis === 302) { |
|
1213 | - $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1214 | - } |
|
1215 | - //-- reset the data array |
|
1216 | - for ($i = 0; $i < $zmax; $i++) { |
|
1217 | - for ($j = 0; $j < $xmax; $j++) { |
|
1218 | - $ydata[$i][$j] = 0; |
|
1142 | + if ($y_axis === 201) { |
|
1143 | + $percentage = false; |
|
1144 | + $ytitle = I18N::translate('Individuals'); |
|
1145 | + } elseif ($y_axis === 202) { |
|
1146 | + $percentage = true; |
|
1147 | + $ytitle = I18N::translate('percentage'); |
|
1148 | + } |
|
1149 | + $male_female = false; |
|
1150 | + if ($z_axis === 300) { |
|
1151 | + $zgiven = false; |
|
1152 | + $legend[0] = 'all'; |
|
1153 | + $zmax = 1; |
|
1154 | + $z_boundaries[0] = 100000; |
|
1155 | + } elseif ($z_axis === 301) { |
|
1156 | + $male_female = true; |
|
1157 | + $zgiven = true; |
|
1158 | + $legend[0] = I18N::translate('Male'); |
|
1159 | + $legend[1] = I18N::translate('Female'); |
|
1160 | + $zmax = 2; |
|
1161 | + $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1162 | + } elseif ($z_axis === 302) { |
|
1163 | + $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1164 | + } |
|
1165 | + //-- reset the data array |
|
1166 | + for ($i = 0; $i < $zmax; $i++) { |
|
1167 | + for ($j = 0; $j < $xmax; $j++) { |
|
1168 | + $ydata[$i][$j] = 0; |
|
1169 | + } |
|
1170 | + } |
|
1171 | + $total = lifespan_by_birth_year($z_axis, $z_boundaries, $stats); |
|
1172 | + $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals(); |
|
1173 | + my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1174 | + break; |
|
1175 | + case '18': |
|
1176 | + $monthdata = array(); |
|
1177 | + for ($i = 0; $i < 12; ++$i) { |
|
1178 | + $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
1179 | + } |
|
1180 | + $xgiven = false; |
|
1181 | + $zgiven = false; |
|
1182 | + $title = I18N::translate('Age related to death year'); |
|
1183 | + $xtitle = I18N::translate('age'); |
|
1184 | + $ytitle = I18N::translate('numbers'); |
|
1185 | + $boundaries_x_axis = Filter::get('x-axis-boundaries-ages'); |
|
1186 | + $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
1187 | + calculate_axis($boundaries_x_axis); |
|
1188 | + if ($z_axis !== 300 && $z_axis !== 301) { |
|
1189 | + calculate_legend($boundaries_z_axis); |
|
1219 | 1190 | } |
1220 | - } |
|
1221 | - $total = lifespan_by_death_year($z_axis, $z_boundaries, $stats); |
|
1222 | - $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals(); |
|
1223 | - my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1224 | - break; |
|
1225 | -case '19': |
|
1226 | - $monthdata = array(); |
|
1227 | - for ($i = 0; $i < 12; ++$i) { |
|
1228 | - $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
1229 | - } |
|
1230 | - $xgiven = false; |
|
1231 | - $zgiven = false; |
|
1232 | - $title = I18N::translate('Age in year of marriage'); |
|
1233 | - $xtitle = I18N::translate('age'); |
|
1234 | - $ytitle = I18N::translate('numbers'); |
|
1235 | - $boundaries_x_axis = Filter::get('x-axis-boundaries-ages_m'); |
|
1236 | - $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
1237 | - calculate_axis($boundaries_x_axis); |
|
1238 | - if ($z_axis !== 300 && $z_axis !== 301) { |
|
1239 | - calculate_legend($boundaries_z_axis); |
|
1240 | - } |
|
1241 | - $percentage = false; |
|
1242 | - if ($y_axis === 201) { |
|
1243 | 1191 | $percentage = false; |
1244 | - $ytitle = I18N::translate('Individuals'); |
|
1245 | - } elseif ($y_axis === 202) { |
|
1246 | - $percentage = true; |
|
1247 | - $ytitle = I18N::translate('percentage'); |
|
1248 | - } |
|
1249 | - $male_female = false; |
|
1250 | - $z_boundaries[0] = 100000; |
|
1251 | - if ($z_axis === 300) { |
|
1252 | - $zgiven = false; |
|
1253 | - $legend[0] = 'all'; |
|
1254 | - $zmax = 1; |
|
1255 | - } elseif ($z_axis === 301) { |
|
1256 | - $male_female = true; |
|
1257 | - $zgiven = true; |
|
1258 | - $legend[0] = I18N::translate('Male'); |
|
1259 | - $legend[1] = I18N::translate('Female'); |
|
1260 | - $zmax = 2; |
|
1261 | - $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1262 | - } elseif ($z_axis === 302) { |
|
1263 | - $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1264 | - } |
|
1265 | - //-- reset the data array |
|
1266 | - for ($i = 0; $i < $zmax; $i++) { |
|
1267 | - for ($j = 0; $j < $xmax; $j++) { |
|
1268 | - $ydata[$i][$j] = 0; |
|
1192 | + if ($y_axis === 201) { |
|
1193 | + $percentage = false; |
|
1194 | + $ytitle = I18N::translate('Individuals'); |
|
1195 | + } elseif ($y_axis === 202) { |
|
1196 | + $percentage = true; |
|
1197 | + $ytitle = I18N::translate('percentage'); |
|
1198 | + } |
|
1199 | + $male_female = false; |
|
1200 | + if ($z_axis === 300) { |
|
1201 | + $zgiven = false; |
|
1202 | + $legend[0] = 'all'; |
|
1203 | + $zmax = 1; |
|
1204 | + $z_boundaries[0] = 100000; |
|
1205 | + } elseif ($z_axis === 301) { |
|
1206 | + $male_female = true; |
|
1207 | + $zgiven = true; |
|
1208 | + $legend[0] = I18N::translate('Male'); |
|
1209 | + $legend[1] = I18N::translate('Female'); |
|
1210 | + $zmax = 2; |
|
1211 | + $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1212 | + } elseif ($z_axis === 302) { |
|
1213 | + $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1214 | + } |
|
1215 | + //-- reset the data array |
|
1216 | + for ($i = 0; $i < $zmax; $i++) { |
|
1217 | + for ($j = 0; $j < $xmax; $j++) { |
|
1218 | + $ydata[$i][$j] = 0; |
|
1219 | + } |
|
1220 | + } |
|
1221 | + $total = lifespan_by_death_year($z_axis, $z_boundaries, $stats); |
|
1222 | + $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals(); |
|
1223 | + my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1224 | + break; |
|
1225 | + case '19': |
|
1226 | + $monthdata = array(); |
|
1227 | + for ($i = 0; $i < 12; ++$i) { |
|
1228 | + $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
1229 | + } |
|
1230 | + $xgiven = false; |
|
1231 | + $zgiven = false; |
|
1232 | + $title = I18N::translate('Age in year of marriage'); |
|
1233 | + $xtitle = I18N::translate('age'); |
|
1234 | + $ytitle = I18N::translate('numbers'); |
|
1235 | + $boundaries_x_axis = Filter::get('x-axis-boundaries-ages_m'); |
|
1236 | + $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
1237 | + calculate_axis($boundaries_x_axis); |
|
1238 | + if ($z_axis !== 300 && $z_axis !== 301) { |
|
1239 | + calculate_legend($boundaries_z_axis); |
|
1269 | 1240 | } |
1270 | - } |
|
1271 | - $total = age_at_marriage($z_axis, $z_boundaries, $stats); |
|
1272 | - $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals(); |
|
1273 | - my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1274 | - break; |
|
1275 | -case '20': |
|
1276 | - $monthdata = array(); |
|
1277 | - for ($i = 0; $i < 12; ++$i) { |
|
1278 | - $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
1279 | - } |
|
1280 | - $xgiven = false; |
|
1281 | - $zgiven = false; |
|
1282 | - $title = I18N::translate('Age in year of first marriage'); |
|
1283 | - $xtitle = I18N::translate('age'); |
|
1284 | - $ytitle = I18N::translate('numbers'); |
|
1285 | - $boundaries_x_axis = Filter::get('x-axis-boundaries-ages_m'); |
|
1286 | - $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
1287 | - calculate_axis($boundaries_x_axis); |
|
1288 | - if ($z_axis !== 300 && $z_axis !== 301) { |
|
1289 | - calculate_legend($boundaries_z_axis); |
|
1290 | - } |
|
1291 | - $percentage = false; |
|
1292 | - if ($y_axis === 201) { |
|
1293 | 1241 | $percentage = false; |
1294 | - $ytitle = I18N::translate('Individuals'); |
|
1295 | - } elseif ($y_axis === 202) { |
|
1296 | - $percentage = true; |
|
1297 | - $ytitle = I18N::translate('percentage'); |
|
1298 | - } |
|
1299 | - $male_female = false; |
|
1300 | - if ($z_axis === 300) { |
|
1301 | - $zgiven = false; |
|
1302 | - $legend[0] = 'all'; |
|
1303 | - $zmax = 1; |
|
1242 | + if ($y_axis === 201) { |
|
1243 | + $percentage = false; |
|
1244 | + $ytitle = I18N::translate('Individuals'); |
|
1245 | + } elseif ($y_axis === 202) { |
|
1246 | + $percentage = true; |
|
1247 | + $ytitle = I18N::translate('percentage'); |
|
1248 | + } |
|
1249 | + $male_female = false; |
|
1304 | 1250 | $z_boundaries[0] = 100000; |
1305 | - } elseif ($z_axis === 301) { |
|
1306 | - $male_female = true; |
|
1307 | - $zgiven = true; |
|
1308 | - $legend[0] = I18N::translate('Male'); |
|
1309 | - $legend[1] = I18N::translate('Female'); |
|
1310 | - $zmax = 2; |
|
1311 | - $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1312 | - } elseif ($z_axis === 302) { |
|
1313 | - $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1314 | - } |
|
1315 | - //-- reset the data array |
|
1316 | - for ($i = 0; $i < $zmax; $i++) { |
|
1317 | - for ($j = 0; $j < $xmax; $j++) { |
|
1318 | - $ydata[$i][$j] = 0; |
|
1251 | + if ($z_axis === 300) { |
|
1252 | + $zgiven = false; |
|
1253 | + $legend[0] = 'all'; |
|
1254 | + $zmax = 1; |
|
1255 | + } elseif ($z_axis === 301) { |
|
1256 | + $male_female = true; |
|
1257 | + $zgiven = true; |
|
1258 | + $legend[0] = I18N::translate('Male'); |
|
1259 | + $legend[1] = I18N::translate('Female'); |
|
1260 | + $zmax = 2; |
|
1261 | + $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1262 | + } elseif ($z_axis === 302) { |
|
1263 | + $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1264 | + } |
|
1265 | + //-- reset the data array |
|
1266 | + for ($i = 0; $i < $zmax; $i++) { |
|
1267 | + for ($j = 0; $j < $xmax; $j++) { |
|
1268 | + $ydata[$i][$j] = 0; |
|
1269 | + } |
|
1270 | + } |
|
1271 | + $total = age_at_marriage($z_axis, $z_boundaries, $stats); |
|
1272 | + $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals(); |
|
1273 | + my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1274 | + break; |
|
1275 | + case '20': |
|
1276 | + $monthdata = array(); |
|
1277 | + for ($i = 0; $i < 12; ++$i) { |
|
1278 | + $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
1279 | + } |
|
1280 | + $xgiven = false; |
|
1281 | + $zgiven = false; |
|
1282 | + $title = I18N::translate('Age in year of first marriage'); |
|
1283 | + $xtitle = I18N::translate('age'); |
|
1284 | + $ytitle = I18N::translate('numbers'); |
|
1285 | + $boundaries_x_axis = Filter::get('x-axis-boundaries-ages_m'); |
|
1286 | + $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
1287 | + calculate_axis($boundaries_x_axis); |
|
1288 | + if ($z_axis !== 300 && $z_axis !== 301) { |
|
1289 | + calculate_legend($boundaries_z_axis); |
|
1319 | 1290 | } |
1320 | - } |
|
1321 | - $total = age_at_first_marriage($z_axis, $z_boundaries, $stats); |
|
1322 | - $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals(); |
|
1323 | - my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1324 | - break; |
|
1325 | -case '21': |
|
1326 | - $monthdata = array(); |
|
1327 | - for ($i = 0; $i < 12; ++$i) { |
|
1328 | - $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
1329 | - } |
|
1330 | - $xgiven = false; |
|
1331 | - $zgiven = false; |
|
1332 | - $title = I18N::translate('Number of children'); |
|
1333 | - $xtitle = I18N::translate('children'); |
|
1334 | - $ytitle = I18N::translate('numbers'); |
|
1335 | - $boundaries_x_axis = Filter::get('x-axis-boundaries-numbers'); |
|
1336 | - $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
1337 | - calculate_axis($boundaries_x_axis); |
|
1338 | - if ($z_axis !== 300 && $z_axis !== 301) { |
|
1339 | - calculate_legend($boundaries_z_axis); |
|
1340 | - } |
|
1341 | - $percentage = false; |
|
1342 | - if ($y_axis === 201) { |
|
1343 | 1291 | $percentage = false; |
1344 | - $ytitle = I18N::translate('Families'); |
|
1345 | - } elseif ($y_axis === 202) { |
|
1346 | - $percentage = true; |
|
1347 | - $ytitle = I18N::translate('percentage'); |
|
1348 | - } |
|
1349 | - $male_female = false; |
|
1350 | - if ($z_axis === 300) { |
|
1351 | - $zgiven = false; |
|
1352 | - $legend[0] = 'all'; |
|
1353 | - $zmax = 1; |
|
1354 | - $z_boundaries[0] = 100000; |
|
1355 | - } elseif ($z_axis === 301) { |
|
1356 | - $male_female = true; |
|
1357 | - $zgiven = true; |
|
1358 | - $legend[0] = I18N::translate('Male'); |
|
1359 | - $legend[1] = I18N::translate('Female'); |
|
1360 | - $zmax = 2; |
|
1361 | - $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1362 | - } elseif ($z_axis === 302) { |
|
1363 | - $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1364 | - } |
|
1365 | - //-- reset the data array |
|
1366 | - for ($i = 0; $i < $zmax; $i++) { |
|
1367 | - for ($j = 0; $j < $xmax; $j++) { |
|
1368 | - $ydata[$i][$j] = 0; |
|
1292 | + if ($y_axis === 201) { |
|
1293 | + $percentage = false; |
|
1294 | + $ytitle = I18N::translate('Individuals'); |
|
1295 | + } elseif ($y_axis === 202) { |
|
1296 | + $percentage = true; |
|
1297 | + $ytitle = I18N::translate('percentage'); |
|
1369 | 1298 | } |
1370 | - } |
|
1371 | - $total = number_of_children($z_axis, $z_boundaries, $stats); |
|
1372 | - $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalChildren(); |
|
1373 | - my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1374 | - break; |
|
1375 | -default: |
|
1376 | - echo '<i class="icon-loading-large"></i>'; |
|
1377 | - break; |
|
1299 | + $male_female = false; |
|
1300 | + if ($z_axis === 300) { |
|
1301 | + $zgiven = false; |
|
1302 | + $legend[0] = 'all'; |
|
1303 | + $zmax = 1; |
|
1304 | + $z_boundaries[0] = 100000; |
|
1305 | + } elseif ($z_axis === 301) { |
|
1306 | + $male_female = true; |
|
1307 | + $zgiven = true; |
|
1308 | + $legend[0] = I18N::translate('Male'); |
|
1309 | + $legend[1] = I18N::translate('Female'); |
|
1310 | + $zmax = 2; |
|
1311 | + $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1312 | + } elseif ($z_axis === 302) { |
|
1313 | + $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1314 | + } |
|
1315 | + //-- reset the data array |
|
1316 | + for ($i = 0; $i < $zmax; $i++) { |
|
1317 | + for ($j = 0; $j < $xmax; $j++) { |
|
1318 | + $ydata[$i][$j] = 0; |
|
1319 | + } |
|
1320 | + } |
|
1321 | + $total = age_at_first_marriage($z_axis, $z_boundaries, $stats); |
|
1322 | + $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals(); |
|
1323 | + my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1324 | + break; |
|
1325 | + case '21': |
|
1326 | + $monthdata = array(); |
|
1327 | + for ($i = 0; $i < 12; ++$i) { |
|
1328 | + $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false); |
|
1329 | + } |
|
1330 | + $xgiven = false; |
|
1331 | + $zgiven = false; |
|
1332 | + $title = I18N::translate('Number of children'); |
|
1333 | + $xtitle = I18N::translate('children'); |
|
1334 | + $ytitle = I18N::translate('numbers'); |
|
1335 | + $boundaries_x_axis = Filter::get('x-axis-boundaries-numbers'); |
|
1336 | + $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0'); |
|
1337 | + calculate_axis($boundaries_x_axis); |
|
1338 | + if ($z_axis !== 300 && $z_axis !== 301) { |
|
1339 | + calculate_legend($boundaries_z_axis); |
|
1340 | + } |
|
1341 | + $percentage = false; |
|
1342 | + if ($y_axis === 201) { |
|
1343 | + $percentage = false; |
|
1344 | + $ytitle = I18N::translate('Families'); |
|
1345 | + } elseif ($y_axis === 202) { |
|
1346 | + $percentage = true; |
|
1347 | + $ytitle = I18N::translate('percentage'); |
|
1348 | + } |
|
1349 | + $male_female = false; |
|
1350 | + if ($z_axis === 300) { |
|
1351 | + $zgiven = false; |
|
1352 | + $legend[0] = 'all'; |
|
1353 | + $zmax = 1; |
|
1354 | + $z_boundaries[0] = 100000; |
|
1355 | + } elseif ($z_axis === 301) { |
|
1356 | + $male_female = true; |
|
1357 | + $zgiven = true; |
|
1358 | + $legend[0] = I18N::translate('Male'); |
|
1359 | + $legend[1] = I18N::translate('Female'); |
|
1360 | + $zmax = 2; |
|
1361 | + $xtitle = $xtitle . I18N::translate(' per gender'); |
|
1362 | + } elseif ($z_axis === 302) { |
|
1363 | + $xtitle = $xtitle . I18N::translate(' per time period'); |
|
1364 | + } |
|
1365 | + //-- reset the data array |
|
1366 | + for ($i = 0; $i < $zmax; $i++) { |
|
1367 | + for ($j = 0; $j < $xmax; $j++) { |
|
1368 | + $ydata[$i][$j] = 0; |
|
1369 | + } |
|
1370 | + } |
|
1371 | + $total = number_of_children($z_axis, $z_boundaries, $stats); |
|
1372 | + $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalChildren(); |
|
1373 | + my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend); |
|
1374 | + break; |
|
1375 | + default: |
|
1376 | + echo '<i class="icon-loading-large"></i>'; |
|
1377 | + break; |
|
1378 | 1378 | } |
1379 | 1379 | echo '</div>'; |
@@ -780,69 +780,69 @@ discard block |
||
780 | 780 | $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'INDI_FACTS_QUICK', $INDI_FACTS_QUICK)); |
781 | 781 | $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'INDI_FACTS_UNIQUE', $INDI_FACTS_UNIQUE)); |
782 | 782 | switch ($LANGUAGE) { |
783 | - case 'catalan': |
|
784 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'ca')); |
|
785 | - break; |
|
786 | - case 'english-uk': |
|
787 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'en-GB')); |
|
788 | - break; |
|
789 | - case 'polish': |
|
790 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'pl')); |
|
791 | - break; |
|
792 | - case 'italian': |
|
793 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'it')); |
|
794 | - break; |
|
795 | - case 'spanish': |
|
796 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'es')); |
|
797 | - break; |
|
798 | - case 'finnish': |
|
799 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'fi')); |
|
800 | - break; |
|
801 | - case 'french': |
|
802 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'fr')); |
|
803 | - break; |
|
804 | - case 'german': |
|
805 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'de')); |
|
806 | - break; |
|
807 | - case 'danish': |
|
808 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'da')); |
|
809 | - break; |
|
810 | - case 'portuguese': |
|
811 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'pt')); |
|
812 | - break; |
|
813 | - case 'hebrew': |
|
814 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'he')); |
|
815 | - break; |
|
816 | - case 'estonian': |
|
817 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'et')); |
|
818 | - break; |
|
819 | - case 'turkish': |
|
820 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'tr')); |
|
821 | - break; |
|
822 | - case 'dutch': |
|
823 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'nl')); |
|
824 | - break; |
|
825 | - case 'slovak': |
|
826 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'sk')); |
|
827 | - break; |
|
828 | - case 'norwegian': |
|
829 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'nn')); |
|
830 | - break; |
|
831 | - case 'slovenian': |
|
832 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'sl')); |
|
833 | - break; |
|
834 | - case 'hungarian': |
|
835 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'hu')); |
|
836 | - break; |
|
837 | - case 'swedish': |
|
838 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'sv')); |
|
839 | - break; |
|
840 | - case 'russian': |
|
841 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'ru')); |
|
842 | - break; |
|
843 | - default: |
|
844 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'en-US')); |
|
845 | - break; |
|
783 | + case 'catalan': |
|
784 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'ca')); |
|
785 | + break; |
|
786 | + case 'english-uk': |
|
787 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'en-GB')); |
|
788 | + break; |
|
789 | + case 'polish': |
|
790 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'pl')); |
|
791 | + break; |
|
792 | + case 'italian': |
|
793 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'it')); |
|
794 | + break; |
|
795 | + case 'spanish': |
|
796 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'es')); |
|
797 | + break; |
|
798 | + case 'finnish': |
|
799 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'fi')); |
|
800 | + break; |
|
801 | + case 'french': |
|
802 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'fr')); |
|
803 | + break; |
|
804 | + case 'german': |
|
805 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'de')); |
|
806 | + break; |
|
807 | + case 'danish': |
|
808 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'da')); |
|
809 | + break; |
|
810 | + case 'portuguese': |
|
811 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'pt')); |
|
812 | + break; |
|
813 | + case 'hebrew': |
|
814 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'he')); |
|
815 | + break; |
|
816 | + case 'estonian': |
|
817 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'et')); |
|
818 | + break; |
|
819 | + case 'turkish': |
|
820 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'tr')); |
|
821 | + break; |
|
822 | + case 'dutch': |
|
823 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'nl')); |
|
824 | + break; |
|
825 | + case 'slovak': |
|
826 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'sk')); |
|
827 | + break; |
|
828 | + case 'norwegian': |
|
829 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'nn')); |
|
830 | + break; |
|
831 | + case 'slovenian': |
|
832 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'sl')); |
|
833 | + break; |
|
834 | + case 'hungarian': |
|
835 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'hu')); |
|
836 | + break; |
|
837 | + case 'swedish': |
|
838 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'sv')); |
|
839 | + break; |
|
840 | + case 'russian': |
|
841 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'ru')); |
|
842 | + break; |
|
843 | + default: |
|
844 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'LANGUAGE', 'en-US')); |
|
845 | + break; |
|
846 | 846 | } |
847 | 847 | $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'MAX_ALIVE_AGE', $MAX_ALIVE_AGE)); |
848 | 848 | $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'MAX_DESCENDANCY_GENERATIONS', $MAX_DESCENDANCY_GENERATIONS)); |
@@ -902,26 +902,26 @@ discard block |
||
902 | 902 | $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'SURNAME_LIST_STYLE', $SURNAME_LIST_STYLE)); |
903 | 903 | $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'SURNAME_TRADITION', $SURNAME_TRADITION)); |
904 | 904 | switch ($THEME_DIR) { |
905 | - case '': |
|
906 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', '')); |
|
907 | - break; |
|
908 | - case 'themes/cloudy/': |
|
909 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', 'clouds')); |
|
910 | - break; |
|
911 | - case 'themes/minimal/': |
|
912 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', 'minimal')); |
|
913 | - break; |
|
914 | - case 'themes/simplyblue/': |
|
915 | - case 'themes/simplygreen/': |
|
916 | - case 'themes/simplyred/': |
|
917 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', 'colors')); |
|
918 | - break; |
|
919 | - case 'themes/xenea/': |
|
920 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', 'xenea')); |
|
921 | - break; |
|
922 | - default: |
|
923 | - $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', 'webtrees')); |
|
924 | - break; |
|
905 | + case '': |
|
906 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', '')); |
|
907 | + break; |
|
908 | + case 'themes/cloudy/': |
|
909 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', 'clouds')); |
|
910 | + break; |
|
911 | + case 'themes/minimal/': |
|
912 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', 'minimal')); |
|
913 | + break; |
|
914 | + case 'themes/simplyblue/': |
|
915 | + case 'themes/simplygreen/': |
|
916 | + case 'themes/simplyred/': |
|
917 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', 'colors')); |
|
918 | + break; |
|
919 | + case 'themes/xenea/': |
|
920 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', 'xenea')); |
|
921 | + break; |
|
922 | + default: |
|
923 | + $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THEME_DIR', 'webtrees')); |
|
924 | + break; |
|
925 | 925 | } |
926 | 926 | $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'THUMBNAIL_WIDTH', $THUMBNAIL_WIDTH)); |
927 | 927 | $stmt_gedcom_setting->execute(array($GED_DATA['id'], 'USE_RELATIONSHIP_PRIVACY', $USE_RELATIONSHIP_PRIVACY)); |
@@ -31,471 +31,471 @@ |
||
31 | 31 | $type = Filter::get('field'); |
32 | 32 | |
33 | 33 | switch ($type) { |
34 | -case 'ASSO': // Associates of an individuals, whose name contains the search terms |
|
35 | - $data = array(); |
|
36 | - // Fetch all data, regardless of privacy |
|
37 | - $rows = Database::prepare( |
|
38 | - "SELECT 'INDI' AS type, i_id AS xref, i_gedcom AS gedcom, n_full" . |
|
39 | - " FROM `##individuals`" . |
|
40 | - " JOIN `##name` ON i_id = n_id AND i_file = n_file" . |
|
41 | - " WHERE (n_full LIKE CONCAT('%', REPLACE(:term_1, ' ', '%'), '%') OR n_surn LIKE CONCAT('%', REPLACE(:term_2, ' ', '%'), '%')) AND i_file = :tree_id" . |
|
42 | - " ORDER BY n_full COLLATE :collate" |
|
43 | - )->execute(array( |
|
44 | - 'term_1' => $term, |
|
45 | - 'term_2' => $term, |
|
46 | - 'tree_id' => $WT_TREE->getTreeId(), |
|
47 | - 'collate' => I18N::collation(), |
|
48 | - ))->fetchAll(); |
|
49 | - |
|
50 | - // Filter for privacy and whether they could be alive at the right time |
|
51 | - $event_date = Filter::get('extra'); |
|
52 | - $date = new Date($event_date); |
|
53 | - $event_jd = $date->julianDay(); |
|
54 | - foreach ($rows as $row) { |
|
55 | - $person = Individual::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
56 | - if ($person->canShow()) { |
|
57 | - if ($event_jd) { |
|
58 | - // Exclude individuals who were born after the event. |
|
59 | - $person_birth_jd = $person->getEstimatedBirthDate()->minimumJulianDay(); |
|
60 | - if ($person_birth_jd && $person_birth_jd > $event_jd) { |
|
61 | - continue; |
|
34 | + case 'ASSO': // Associates of an individuals, whose name contains the search terms |
|
35 | + $data = array(); |
|
36 | + // Fetch all data, regardless of privacy |
|
37 | + $rows = Database::prepare( |
|
38 | + "SELECT 'INDI' AS type, i_id AS xref, i_gedcom AS gedcom, n_full" . |
|
39 | + " FROM `##individuals`" . |
|
40 | + " JOIN `##name` ON i_id = n_id AND i_file = n_file" . |
|
41 | + " WHERE (n_full LIKE CONCAT('%', REPLACE(:term_1, ' ', '%'), '%') OR n_surn LIKE CONCAT('%', REPLACE(:term_2, ' ', '%'), '%')) AND i_file = :tree_id" . |
|
42 | + " ORDER BY n_full COLLATE :collate" |
|
43 | + )->execute(array( |
|
44 | + 'term_1' => $term, |
|
45 | + 'term_2' => $term, |
|
46 | + 'tree_id' => $WT_TREE->getTreeId(), |
|
47 | + 'collate' => I18N::collation(), |
|
48 | + ))->fetchAll(); |
|
49 | + |
|
50 | + // Filter for privacy and whether they could be alive at the right time |
|
51 | + $event_date = Filter::get('extra'); |
|
52 | + $date = new Date($event_date); |
|
53 | + $event_jd = $date->julianDay(); |
|
54 | + foreach ($rows as $row) { |
|
55 | + $person = Individual::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
56 | + if ($person->canShow()) { |
|
57 | + if ($event_jd) { |
|
58 | + // Exclude individuals who were born after the event. |
|
59 | + $person_birth_jd = $person->getEstimatedBirthDate()->minimumJulianDay(); |
|
60 | + if ($person_birth_jd && $person_birth_jd > $event_jd) { |
|
61 | + continue; |
|
62 | + } |
|
63 | + // Exclude individuals who died before the event. |
|
64 | + $person_death_jd = $person->getEstimatedDeathDate()->maximumJulianDay(); |
|
65 | + if ($person_death_jd && $person_death_jd < $event_jd) { |
|
66 | + continue; |
|
67 | + } |
|
62 | 68 | } |
63 | - // Exclude individuals who died before the event. |
|
64 | - $person_death_jd = $person->getEstimatedDeathDate()->maximumJulianDay(); |
|
65 | - if ($person_death_jd && $person_death_jd < $event_jd) { |
|
66 | - continue; |
|
69 | + // Add the age (if we have it) or the lifespan (if we do not). |
|
70 | + $label = $person->getFullName(); |
|
71 | + if ($event_jd && $person->getBirthDate()->isOK()) { |
|
72 | + $label .= ', <span class="age">(' . I18N::translate('Age') . ' ' . Date::getAge($person->getBirthDate(), $date, 0) . ')</span>'; |
|
73 | + } else { |
|
74 | + $label .= ', <i>' . $person->getLifeSpan() . '</i>'; |
|
67 | 75 | } |
68 | - } |
|
69 | - // Add the age (if we have it) or the lifespan (if we do not). |
|
70 | - $label = $person->getFullName(); |
|
71 | - if ($event_jd && $person->getBirthDate()->isOK()) { |
|
72 | - $label .= ', <span class="age">(' . I18N::translate('Age') . ' ' . Date::getAge($person->getBirthDate(), $date, 0) . ')</span>'; |
|
73 | - } else { |
|
74 | - $label .= ', <i>' . $person->getLifeSpan() . '</i>'; |
|
75 | - } |
|
76 | - $data[$row->xref] = array('value' => $row->xref, 'label' => $label); |
|
77 | - } |
|
78 | - } |
|
79 | - echo json_encode($data); |
|
80 | - |
|
81 | - return; |
|
82 | - |
|
83 | -case 'CEME': // Cemetery fields, that contain the search term |
|
84 | - $data = array(); |
|
85 | - // Fetch all data, regardless of privacy |
|
86 | - $rows = Database::prepare( |
|
87 | - "SELECT SQL_CACHE i_id AS xref, i_gedcom AS gedcom" . |
|
88 | - " FROM `##individuals`" . |
|
89 | - " WHERE i_gedcom LIKE '%\n2 CEME %' AND i_file = :tree_id" . |
|
90 | - " ORDER BY SUBSTRING_INDEX(i_gedcom, '\n2 CEME ', -1) COLLATE :collation" |
|
91 | - )->execute(array( |
|
92 | - 'tree_id' => $WT_TREE->getTreeId(), |
|
93 | - 'collation' => I18N::collation(), |
|
94 | - ))->fetchAll(); |
|
95 | - // Filter for privacy |
|
96 | - foreach ($rows as $row) { |
|
97 | - $person = Individual::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
98 | - if (preg_match('/\n2 CEME (.*' . preg_quote($term, '/') . '.*)/i', $person->getGedcom(), $match)) { |
|
99 | - if (!in_array($match[1], $data)) { |
|
100 | - $data[] = $match[1]; |
|
76 | + $data[$row->xref] = array('value' => $row->xref, 'label' => $label); |
|
101 | 77 | } |
102 | 78 | } |
103 | - } |
|
104 | - echo json_encode($data); |
|
105 | - |
|
106 | - return; |
|
107 | - |
|
108 | -case 'FAM': // Families, whose name contains the search terms |
|
109 | - $data = array(); |
|
110 | - // Fetch all data, regardless of privacy |
|
111 | - $rows = get_FAM_rows($WT_TREE, $term); |
|
112 | - // Filter for privacy |
|
113 | - foreach ($rows as $row) { |
|
114 | - $family = Family::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
115 | - if ($family->canShowName()) { |
|
116 | - $marriage_year = $family->getMarriageYear(); |
|
117 | - if ($marriage_year) { |
|
118 | - $data[] = array('value' => $family->getXref(), 'label' => $family->getFullName() . ', <i>' . $marriage_year . '</i>'); |
|
119 | - } else { |
|
120 | - $data[] = array('value' => $family->getXref(), 'label' => $family->getFullName()); |
|
121 | - } |
|
122 | - } |
|
123 | - } |
|
124 | - echo json_encode($data); |
|
125 | - |
|
126 | - return; |
|
127 | - |
|
128 | -case 'GIVN': // Given names, that start with the search term |
|
129 | - // Do not filter by privacy. Given names on their own do not identify individuals. |
|
130 | - echo json_encode( |
|
131 | - Database::prepare( |
|
132 | - "SELECT SQL_CACHE DISTINCT n_givn" . |
|
133 | - " FROM `##name`" . |
|
134 | - " WHERE n_givn LIKE CONCAT(:term, '%') AND n_file = :tree_id" . |
|
135 | - " ORDER BY n_givn COLLATE :collation" |
|
79 | + echo json_encode($data); |
|
80 | + |
|
81 | + return; |
|
82 | + |
|
83 | + case 'CEME': // Cemetery fields, that contain the search term |
|
84 | + $data = array(); |
|
85 | + // Fetch all data, regardless of privacy |
|
86 | + $rows = Database::prepare( |
|
87 | + "SELECT SQL_CACHE i_id AS xref, i_gedcom AS gedcom" . |
|
88 | + " FROM `##individuals`" . |
|
89 | + " WHERE i_gedcom LIKE '%\n2 CEME %' AND i_file = :tree_id" . |
|
90 | + " ORDER BY SUBSTRING_INDEX(i_gedcom, '\n2 CEME ', -1) COLLATE :collation" |
|
136 | 91 | )->execute(array( |
137 | - 'term' => $term, |
|
138 | 92 | 'tree_id' => $WT_TREE->getTreeId(), |
139 | 93 | 'collation' => I18N::collation(), |
140 | - ))->fetchOneColumn() |
|
141 | - ); |
|
142 | - |
|
143 | - return; |
|
144 | - |
|
145 | -case 'INDI': // Individuals, whose name contains the search terms |
|
146 | - $data = array(); |
|
147 | - // Fetch all data, regardless of privacy |
|
148 | - $rows = Database::prepare( |
|
149 | - "SELECT i_id AS xref, i_gedcom AS gedcom, n_full" . |
|
150 | - " FROM `##individuals`" . |
|
151 | - " JOIN `##name` ON i_id = n_id AND i_file = n_file" . |
|
152 | - " WHERE (n_full LIKE CONCAT('%', REPLACE(:term_1, ' ', '%'), '%') OR n_surn LIKE CONCAT('%', REPLACE(:term_2, ' ', '%'), '%')) AND i_file = :tree_id" . |
|
153 | - " ORDER BY n_full COLLATE :collation" |
|
154 | - )->execute(array( |
|
155 | - 'term_1' => $term, |
|
156 | - 'term_2' => $term, |
|
157 | - 'tree_id' => $WT_TREE->getTreeId(), |
|
158 | - 'collation' => I18N::collation(), |
|
159 | - ))->fetchAll(); |
|
160 | - // Filter for privacy |
|
161 | - foreach ($rows as $row) { |
|
162 | - $person = Individual::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
163 | - if ($person->canShowName()) { |
|
164 | - $data[] = array('value' => $row->xref, 'label' => str_replace(array('@N.N.', '@P.N.'), array(I18N::translateContext('Unknown surname', '…'), I18N::translateContext('Unknown given name', '…')), $row->n_full) . ', <i>' . $person->getLifeSpan() . '</i>'); |
|
165 | - } |
|
166 | - } |
|
167 | - echo json_encode($data); |
|
168 | - |
|
169 | - return; |
|
170 | - |
|
171 | -case 'NOTE': // Notes which contain the search terms |
|
172 | - $data = array(); |
|
173 | - // Fetch all data, regardless of privacy |
|
174 | - $rows = get_NOTE_rows($WT_TREE, $term); |
|
175 | - // Filter for privacy |
|
176 | - foreach ($rows as $row) { |
|
177 | - $note = Note::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
178 | - if ($note->canShowName()) { |
|
179 | - $data[] = array('value' => $note->getXref(), 'label' => $note->getFullName()); |
|
180 | - } |
|
181 | - } |
|
182 | - echo json_encode($data); |
|
183 | - |
|
184 | - return; |
|
185 | - |
|
186 | -case 'OBJE': |
|
187 | - $data = array(); |
|
188 | - // Fetch all data, regardless of privacy |
|
189 | - $rows = get_OBJE_rows($WT_TREE, $term); |
|
190 | - // Filter for privacy |
|
191 | - foreach ($rows as $row) { |
|
192 | - $media = Media::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
193 | - if ($media->canShowName()) { |
|
194 | - $data[] = array('value' => $row->xref, 'label' => '<img src="' . $media->getHtmlUrlDirect() . '" width="25"> ' . $media->getFullName()); |
|
195 | - } |
|
196 | - } |
|
197 | - echo json_encode($data); |
|
198 | - |
|
199 | - return; |
|
200 | - |
|
201 | -case 'PLAC': // Place names (with hierarchy), that include the search term |
|
202 | - // Do not filter by privacy. Place names on their own do not identify individuals. |
|
203 | - $data = array(); |
|
204 | - foreach (Place::findPlaces($term, $WT_TREE) as $place) { |
|
205 | - $data[] = $place->getGedcomName(); |
|
206 | - } |
|
207 | - if (!$data && $WT_TREE->getPreference('GEONAMES_ACCOUNT')) { |
|
208 | - // No place found? Use an external gazetteer |
|
209 | - $url = |
|
210 | - "http://api.geonames.org/searchJSON" . |
|
211 | - "?name_startsWith=" . urlencode($term) . |
|
212 | - "&lang=" . WT_LOCALE . |
|
213 | - "&fcode=CMTY&fcode=ADM4&fcode=PPL&fcode=PPLA&fcode=PPLC" . |
|
214 | - "&style=full" . |
|
215 | - "&username=" . $WT_TREE->getPreference('GEONAMES_ACCOUNT'); |
|
216 | - // try to use curl when file_get_contents not allowed |
|
217 | - if (ini_get('allow_url_fopen')) { |
|
218 | - $json = file_get_contents($url); |
|
219 | - } elseif (function_exists('curl_init')) { |
|
220 | - $ch = curl_init(); |
|
221 | - curl_setopt($ch, CURLOPT_URL, $url); |
|
222 | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
223 | - $json = curl_exec($ch); |
|
224 | - curl_close($ch); |
|
225 | - } else { |
|
226 | - return $data; |
|
94 | + ))->fetchAll(); |
|
95 | + // Filter for privacy |
|
96 | + foreach ($rows as $row) { |
|
97 | + $person = Individual::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
98 | + if (preg_match('/\n2 CEME (.*' . preg_quote($term, '/') . '.*)/i', $person->getGedcom(), $match)) { |
|
99 | + if (!in_array($match[1], $data)) { |
|
100 | + $data[] = $match[1]; |
|
101 | + } |
|
102 | + } |
|
227 | 103 | } |
228 | - $places = json_decode($json, true); |
|
229 | - if (isset($places['geonames']) && is_array($places['geonames'])) { |
|
230 | - foreach ($places['geonames'] as $k => $place) { |
|
231 | - $data[] = $place['name'] . ', ' . $place['adminName2'] . ', ' . $place['adminName1'] . ', ' . $place['countryName']; |
|
104 | + echo json_encode($data); |
|
105 | + |
|
106 | + return; |
|
107 | + |
|
108 | + case 'FAM': // Families, whose name contains the search terms |
|
109 | + $data = array(); |
|
110 | + // Fetch all data, regardless of privacy |
|
111 | + $rows = get_FAM_rows($WT_TREE, $term); |
|
112 | + // Filter for privacy |
|
113 | + foreach ($rows as $row) { |
|
114 | + $family = Family::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
115 | + if ($family->canShowName()) { |
|
116 | + $marriage_year = $family->getMarriageYear(); |
|
117 | + if ($marriage_year) { |
|
118 | + $data[] = array('value' => $family->getXref(), 'label' => $family->getFullName() . ', <i>' . $marriage_year . '</i>'); |
|
119 | + } else { |
|
120 | + $data[] = array('value' => $family->getXref(), 'label' => $family->getFullName()); |
|
121 | + } |
|
232 | 122 | } |
233 | 123 | } |
234 | - } |
|
235 | - echo json_encode($data); |
|
236 | - |
|
237 | - return; |
|
238 | - |
|
239 | -case 'PLAC2': // Place names (without hierarchy), that include the search term |
|
240 | - // Do not filter by privacy. Place names on their own do not identify individuals. |
|
241 | - echo json_encode( |
|
242 | - Database::prepare( |
|
243 | - "SELECT SQL_CACHE p_place" . |
|
244 | - " FROM `##places`" . |
|
245 | - " WHERE p_place LIKE CONCAT('%', :term, '%') AND p_file = :tree_id" . |
|
246 | - " ORDER BY p_place COLLATE :collation" |
|
124 | + echo json_encode($data); |
|
125 | + |
|
126 | + return; |
|
127 | + |
|
128 | + case 'GIVN': // Given names, that start with the search term |
|
129 | + // Do not filter by privacy. Given names on their own do not identify individuals. |
|
130 | + echo json_encode( |
|
131 | + Database::prepare( |
|
132 | + "SELECT SQL_CACHE DISTINCT n_givn" . |
|
133 | + " FROM `##name`" . |
|
134 | + " WHERE n_givn LIKE CONCAT(:term, '%') AND n_file = :tree_id" . |
|
135 | + " ORDER BY n_givn COLLATE :collation" |
|
136 | + )->execute(array( |
|
137 | + 'term' => $term, |
|
138 | + 'tree_id' => $WT_TREE->getTreeId(), |
|
139 | + 'collation' => I18N::collation(), |
|
140 | + ))->fetchOneColumn() |
|
141 | + ); |
|
142 | + |
|
143 | + return; |
|
144 | + |
|
145 | + case 'INDI': // Individuals, whose name contains the search terms |
|
146 | + $data = array(); |
|
147 | + // Fetch all data, regardless of privacy |
|
148 | + $rows = Database::prepare( |
|
149 | + "SELECT i_id AS xref, i_gedcom AS gedcom, n_full" . |
|
150 | + " FROM `##individuals`" . |
|
151 | + " JOIN `##name` ON i_id = n_id AND i_file = n_file" . |
|
152 | + " WHERE (n_full LIKE CONCAT('%', REPLACE(:term_1, ' ', '%'), '%') OR n_surn LIKE CONCAT('%', REPLACE(:term_2, ' ', '%'), '%')) AND i_file = :tree_id" . |
|
153 | + " ORDER BY n_full COLLATE :collation" |
|
247 | 154 | )->execute(array( |
248 | - 'term' => $term, |
|
155 | + 'term_1' => $term, |
|
156 | + 'term_2' => $term, |
|
249 | 157 | 'tree_id' => $WT_TREE->getTreeId(), |
250 | 158 | 'collation' => I18N::collation(), |
251 | - ))->fetchOneColumn() |
|
252 | - ); |
|
253 | - |
|
254 | - return; |
|
255 | - |
|
256 | -case 'REPO': // Repositories, that include the search terms |
|
257 | - $data = array(); |
|
258 | - // Fetch all data, regardless of privacy |
|
259 | - $rows = get_REPO_rows($WT_TREE, $term); |
|
260 | - // Filter for privacy |
|
261 | - foreach ($rows as $row) { |
|
262 | - $record = Repository::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
263 | - if ($record->canShowName()) { |
|
264 | - foreach ($record->getFacts('NAME') as $fact) { |
|
265 | - $data[] = array('value' => $record->getXref(), 'label' => $fact->getValue()); |
|
159 | + ))->fetchAll(); |
|
160 | + // Filter for privacy |
|
161 | + foreach ($rows as $row) { |
|
162 | + $person = Individual::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
163 | + if ($person->canShowName()) { |
|
164 | + $data[] = array('value' => $row->xref, 'label' => str_replace(array('@N.N.', '@P.N.'), array(I18N::translateContext('Unknown surname', '…'), I18N::translateContext('Unknown given name', '…')), $row->n_full) . ', <i>' . $person->getLifeSpan() . '</i>'); |
|
266 | 165 | } |
267 | 166 | } |
268 | - } |
|
269 | - echo json_encode($data); |
|
270 | - |
|
271 | - return; |
|
272 | - |
|
273 | -case 'REPO_NAME': // Repository names, that include the search terms |
|
274 | - $data = array(); |
|
275 | - // Fetch all data, regardless of privacy |
|
276 | - $rows = get_REPO_rows($WT_TREE, $term); |
|
277 | - // Filter for privacy |
|
278 | - foreach ($rows as $row) { |
|
279 | - $record = Repository::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
280 | - if ($record->canShowName()) { |
|
281 | - $data[] = strip_tags($record->getFullName()); |
|
167 | + echo json_encode($data); |
|
168 | + |
|
169 | + return; |
|
170 | + |
|
171 | + case 'NOTE': // Notes which contain the search terms |
|
172 | + $data = array(); |
|
173 | + // Fetch all data, regardless of privacy |
|
174 | + $rows = get_NOTE_rows($WT_TREE, $term); |
|
175 | + // Filter for privacy |
|
176 | + foreach ($rows as $row) { |
|
177 | + $note = Note::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
178 | + if ($note->canShowName()) { |
|
179 | + $data[] = array('value' => $note->getXref(), 'label' => $note->getFullName()); |
|
180 | + } |
|
282 | 181 | } |
283 | - } |
|
284 | - echo json_encode($data); |
|
285 | - |
|
286 | - return; |
|
287 | - |
|
288 | -case 'SOUR': // Sources, that include the search terms |
|
289 | - $data = array(); |
|
290 | - // Fetch all data, regardless of privacy |
|
291 | - $rows = get_SOUR_rows($WT_TREE, $term); |
|
292 | - // Filter for privacy |
|
293 | - foreach ($rows as $row) { |
|
294 | - $record = Source::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
295 | - if ($record->canShowName()) { |
|
296 | - foreach ($record->getFacts('TITL') as $fact) { |
|
297 | - $data[] = array('value' => $record->getXref(), 'label' => $fact->getValue()); |
|
182 | + echo json_encode($data); |
|
183 | + |
|
184 | + return; |
|
185 | + |
|
186 | + case 'OBJE': |
|
187 | + $data = array(); |
|
188 | + // Fetch all data, regardless of privacy |
|
189 | + $rows = get_OBJE_rows($WT_TREE, $term); |
|
190 | + // Filter for privacy |
|
191 | + foreach ($rows as $row) { |
|
192 | + $media = Media::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
193 | + if ($media->canShowName()) { |
|
194 | + $data[] = array('value' => $row->xref, 'label' => '<img src="' . $media->getHtmlUrlDirect() . '" width="25"> ' . $media->getFullName()); |
|
298 | 195 | } |
299 | 196 | } |
300 | - } |
|
301 | - echo json_encode($data); |
|
197 | + echo json_encode($data); |
|
302 | 198 | |
303 | - return; |
|
199 | + return; |
|
304 | 200 | |
305 | -case 'PAGE': // Citation details, for a given source, that contain the search term |
|
306 | - $data = array(); |
|
307 | - $sid = Filter::get('extra', WT_REGEX_XREF); |
|
308 | - // Fetch all data, regardless of privacy |
|
309 | - $rows = Database::prepare( |
|
310 | - "SELECT SQL_CACHE i_id AS xref, i_gedcom AS gedcom" . |
|
311 | - " FROM `##individuals`" . |
|
312 | - " WHERE i_gedcom LIKE CONCAT('%\n_ SOUR @', :xref, '@%', REPLACE(:term, ' ', '%'), '%') AND i_file = :tree_id" |
|
313 | - )->execute(array( |
|
314 | - 'xref' => $sid, |
|
315 | - 'term' => $term, |
|
316 | - 'tree_id' => $WT_TREE->getTreeId(), |
|
317 | - ))->fetchAll(); |
|
318 | - // Filter for privacy |
|
319 | - foreach ($rows as $row) { |
|
320 | - $person = Individual::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
321 | - if (preg_match('/\n1 SOUR @' . $sid . '@(?:\n[2-9].*)*\n2 PAGE (.*' . str_replace(' ', '.+', preg_quote($term, '/')) . '.*)/i', $person->getGedcom(), $match)) { |
|
322 | - $data[] = $match[1]; |
|
201 | + case 'PLAC': // Place names (with hierarchy), that include the search term |
|
202 | + // Do not filter by privacy. Place names on their own do not identify individuals. |
|
203 | + $data = array(); |
|
204 | + foreach (Place::findPlaces($term, $WT_TREE) as $place) { |
|
205 | + $data[] = $place->getGedcomName(); |
|
323 | 206 | } |
324 | - if (preg_match('/\n2 SOUR @' . $sid . '@(?:\n[3-9].*)*\n3 PAGE (.*' . str_replace(' ', '.+', preg_quote($term, '/')) . '.*)/i', $person->getGedcom(), $match)) { |
|
325 | - $data[] = $match[1]; |
|
207 | + if (!$data && $WT_TREE->getPreference('GEONAMES_ACCOUNT')) { |
|
208 | + // No place found? Use an external gazetteer |
|
209 | + $url = |
|
210 | + "http://api.geonames.org/searchJSON" . |
|
211 | + "?name_startsWith=" . urlencode($term) . |
|
212 | + "&lang=" . WT_LOCALE . |
|
213 | + "&fcode=CMTY&fcode=ADM4&fcode=PPL&fcode=PPLA&fcode=PPLC" . |
|
214 | + "&style=full" . |
|
215 | + "&username=" . $WT_TREE->getPreference('GEONAMES_ACCOUNT'); |
|
216 | + // try to use curl when file_get_contents not allowed |
|
217 | + if (ini_get('allow_url_fopen')) { |
|
218 | + $json = file_get_contents($url); |
|
219 | + } elseif (function_exists('curl_init')) { |
|
220 | + $ch = curl_init(); |
|
221 | + curl_setopt($ch, CURLOPT_URL, $url); |
|
222 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
223 | + $json = curl_exec($ch); |
|
224 | + curl_close($ch); |
|
225 | + } else { |
|
226 | + return $data; |
|
227 | + } |
|
228 | + $places = json_decode($json, true); |
|
229 | + if (isset($places['geonames']) && is_array($places['geonames'])) { |
|
230 | + foreach ($places['geonames'] as $k => $place) { |
|
231 | + $data[] = $place['name'] . ', ' . $place['adminName2'] . ', ' . $place['adminName1'] . ', ' . $place['countryName']; |
|
232 | + } |
|
233 | + } |
|
326 | 234 | } |
327 | - } |
|
328 | - // Fetch all data, regardless of privacy |
|
329 | - $rows = Database::prepare( |
|
330 | - "SELECT SQL_CACHE f_id AS xref, f_gedcom AS gedcom" . |
|
331 | - " FROM `##families`" . |
|
332 | - " WHERE f_gedcom LIKE CONCAT('%\n_ SOUR @', :xref, '@%', REPLACE(:term, ' ', '%'), '%') AND f_file = :tree_id" |
|
333 | - )->execute(array( |
|
334 | - 'xref' => $sid, |
|
335 | - 'term' => $term, |
|
336 | - 'tree_id' => $WT_TREE->getTreeId(), |
|
337 | - ))->fetchAll(); |
|
338 | - // Filter for privacy |
|
339 | - foreach ($rows as $row) { |
|
340 | - $family = Family::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
341 | - if (preg_match('/\n1 SOUR @' . $sid . '@(?:\n[2-9].*)*\n2 PAGE (.*' . str_replace(' ', '.+', preg_quote($term, '/')) . '.*)/i', $family->getGedcom(), $match)) { |
|
342 | - $data[] = $match[1]; |
|
235 | + echo json_encode($data); |
|
236 | + |
|
237 | + return; |
|
238 | + |
|
239 | + case 'PLAC2': // Place names (without hierarchy), that include the search term |
|
240 | + // Do not filter by privacy. Place names on their own do not identify individuals. |
|
241 | + echo json_encode( |
|
242 | + Database::prepare( |
|
243 | + "SELECT SQL_CACHE p_place" . |
|
244 | + " FROM `##places`" . |
|
245 | + " WHERE p_place LIKE CONCAT('%', :term, '%') AND p_file = :tree_id" . |
|
246 | + " ORDER BY p_place COLLATE :collation" |
|
247 | + )->execute(array( |
|
248 | + 'term' => $term, |
|
249 | + 'tree_id' => $WT_TREE->getTreeId(), |
|
250 | + 'collation' => I18N::collation(), |
|
251 | + ))->fetchOneColumn() |
|
252 | + ); |
|
253 | + |
|
254 | + return; |
|
255 | + |
|
256 | + case 'REPO': // Repositories, that include the search terms |
|
257 | + $data = array(); |
|
258 | + // Fetch all data, regardless of privacy |
|
259 | + $rows = get_REPO_rows($WT_TREE, $term); |
|
260 | + // Filter for privacy |
|
261 | + foreach ($rows as $row) { |
|
262 | + $record = Repository::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
263 | + if ($record->canShowName()) { |
|
264 | + foreach ($record->getFacts('NAME') as $fact) { |
|
265 | + $data[] = array('value' => $record->getXref(), 'label' => $fact->getValue()); |
|
266 | + } |
|
267 | + } |
|
343 | 268 | } |
344 | - if (preg_match('/\n2 SOUR @' . $sid . '@(?:\n[3-9].*)*\n3 PAGE (.*' . str_replace(' ', '.+', preg_quote($term, '/')) . '.*)/i', $family->getGedcom(), $match)) { |
|
345 | - $data[] = $match[1]; |
|
269 | + echo json_encode($data); |
|
270 | + |
|
271 | + return; |
|
272 | + |
|
273 | + case 'REPO_NAME': // Repository names, that include the search terms |
|
274 | + $data = array(); |
|
275 | + // Fetch all data, regardless of privacy |
|
276 | + $rows = get_REPO_rows($WT_TREE, $term); |
|
277 | + // Filter for privacy |
|
278 | + foreach ($rows as $row) { |
|
279 | + $record = Repository::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
280 | + if ($record->canShowName()) { |
|
281 | + $data[] = strip_tags($record->getFullName()); |
|
282 | + } |
|
346 | 283 | } |
347 | - } |
|
348 | - // array_unique() converts the keys from integer to string, which breaks |
|
349 | - // the JSON encoding - so need to call array_values() to convert them |
|
350 | - // back into integers. |
|
351 | - $data = array_values(array_unique($data)); |
|
352 | - echo json_encode($data); |
|
353 | - |
|
354 | - return; |
|
355 | - |
|
356 | -case 'SOUR_TITL': // Source titles, that include the search terms |
|
357 | - $data = array(); |
|
358 | - // Fetch all data, regardless of privacy |
|
359 | - $rows = Database::prepare( |
|
360 | - "SELECT s_id AS xref, s_gedcom AS gedcom, s_name" . |
|
361 | - " FROM `##sources`" . |
|
362 | - " WHERE s_name LIKE CONCAT('%', REPLACE(:term, ' ', '%'), '%') AND s_file = :tree_id" . |
|
363 | - " ORDER BY s_name COLLATE :collation" |
|
364 | - )->execute(array( |
|
365 | - 'term' => $term, |
|
366 | - 'tree_id' => $WT_TREE->getTreeId(), |
|
367 | - 'collation' => I18N::collation(), |
|
368 | - ))->fetchAll(); |
|
369 | - // Filter for privacy |
|
370 | - foreach ($rows as $row) { |
|
371 | - $source = Source::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
372 | - if ($source->canShowName()) { |
|
373 | - $data[] = $row->s_name; |
|
284 | + echo json_encode($data); |
|
285 | + |
|
286 | + return; |
|
287 | + |
|
288 | + case 'SOUR': // Sources, that include the search terms |
|
289 | + $data = array(); |
|
290 | + // Fetch all data, regardless of privacy |
|
291 | + $rows = get_SOUR_rows($WT_TREE, $term); |
|
292 | + // Filter for privacy |
|
293 | + foreach ($rows as $row) { |
|
294 | + $record = Source::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
295 | + if ($record->canShowName()) { |
|
296 | + foreach ($record->getFacts('TITL') as $fact) { |
|
297 | + $data[] = array('value' => $record->getXref(), 'label' => $fact->getValue()); |
|
298 | + } |
|
299 | + } |
|
374 | 300 | } |
375 | - } |
|
376 | - echo json_encode($data); |
|
377 | - |
|
378 | - return; |
|
379 | - |
|
380 | -case 'SURN': // Surnames, that start with the search term |
|
381 | - // Do not filter by privacy. Surnames on their own do not identify individuals. |
|
382 | - echo json_encode( |
|
383 | - Database::prepare( |
|
384 | - "SELECT SQL_CACHE DISTINCT n_surname" . |
|
385 | - " FROM `##name`" . |
|
386 | - " WHERE n_surname LIKE CONCAT(:term, '%') AND n_file = :tree_id" . |
|
387 | - " ORDER BY n_surname COLLATE :collation" |
|
301 | + echo json_encode($data); |
|
302 | + |
|
303 | + return; |
|
304 | + |
|
305 | + case 'PAGE': // Citation details, for a given source, that contain the search term |
|
306 | + $data = array(); |
|
307 | + $sid = Filter::get('extra', WT_REGEX_XREF); |
|
308 | + // Fetch all data, regardless of privacy |
|
309 | + $rows = Database::prepare( |
|
310 | + "SELECT SQL_CACHE i_id AS xref, i_gedcom AS gedcom" . |
|
311 | + " FROM `##individuals`" . |
|
312 | + " WHERE i_gedcom LIKE CONCAT('%\n_ SOUR @', :xref, '@%', REPLACE(:term, ' ', '%'), '%') AND i_file = :tree_id" |
|
313 | + )->execute(array( |
|
314 | + 'xref' => $sid, |
|
315 | + 'term' => $term, |
|
316 | + 'tree_id' => $WT_TREE->getTreeId(), |
|
317 | + ))->fetchAll(); |
|
318 | + // Filter for privacy |
|
319 | + foreach ($rows as $row) { |
|
320 | + $person = Individual::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
321 | + if (preg_match('/\n1 SOUR @' . $sid . '@(?:\n[2-9].*)*\n2 PAGE (.*' . str_replace(' ', '.+', preg_quote($term, '/')) . '.*)/i', $person->getGedcom(), $match)) { |
|
322 | + $data[] = $match[1]; |
|
323 | + } |
|
324 | + if (preg_match('/\n2 SOUR @' . $sid . '@(?:\n[3-9].*)*\n3 PAGE (.*' . str_replace(' ', '.+', preg_quote($term, '/')) . '.*)/i', $person->getGedcom(), $match)) { |
|
325 | + $data[] = $match[1]; |
|
326 | + } |
|
327 | + } |
|
328 | + // Fetch all data, regardless of privacy |
|
329 | + $rows = Database::prepare( |
|
330 | + "SELECT SQL_CACHE f_id AS xref, f_gedcom AS gedcom" . |
|
331 | + " FROM `##families`" . |
|
332 | + " WHERE f_gedcom LIKE CONCAT('%\n_ SOUR @', :xref, '@%', REPLACE(:term, ' ', '%'), '%') AND f_file = :tree_id" |
|
333 | + )->execute(array( |
|
334 | + 'xref' => $sid, |
|
335 | + 'term' => $term, |
|
336 | + 'tree_id' => $WT_TREE->getTreeId(), |
|
337 | + ))->fetchAll(); |
|
338 | + // Filter for privacy |
|
339 | + foreach ($rows as $row) { |
|
340 | + $family = Family::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
341 | + if (preg_match('/\n1 SOUR @' . $sid . '@(?:\n[2-9].*)*\n2 PAGE (.*' . str_replace(' ', '.+', preg_quote($term, '/')) . '.*)/i', $family->getGedcom(), $match)) { |
|
342 | + $data[] = $match[1]; |
|
343 | + } |
|
344 | + if (preg_match('/\n2 SOUR @' . $sid . '@(?:\n[3-9].*)*\n3 PAGE (.*' . str_replace(' ', '.+', preg_quote($term, '/')) . '.*)/i', $family->getGedcom(), $match)) { |
|
345 | + $data[] = $match[1]; |
|
346 | + } |
|
347 | + } |
|
348 | + // array_unique() converts the keys from integer to string, which breaks |
|
349 | + // the JSON encoding - so need to call array_values() to convert them |
|
350 | + // back into integers. |
|
351 | + $data = array_values(array_unique($data)); |
|
352 | + echo json_encode($data); |
|
353 | + |
|
354 | + return; |
|
355 | + |
|
356 | + case 'SOUR_TITL': // Source titles, that include the search terms |
|
357 | + $data = array(); |
|
358 | + // Fetch all data, regardless of privacy |
|
359 | + $rows = Database::prepare( |
|
360 | + "SELECT s_id AS xref, s_gedcom AS gedcom, s_name" . |
|
361 | + " FROM `##sources`" . |
|
362 | + " WHERE s_name LIKE CONCAT('%', REPLACE(:term, ' ', '%'), '%') AND s_file = :tree_id" . |
|
363 | + " ORDER BY s_name COLLATE :collation" |
|
388 | 364 | )->execute(array( |
389 | 365 | 'term' => $term, |
390 | 366 | 'tree_id' => $WT_TREE->getTreeId(), |
391 | 367 | 'collation' => I18N::collation(), |
392 | - ))->fetchOneColumn() |
|
393 | - ); |
|
394 | - |
|
395 | - return; |
|
396 | - |
|
397 | -case 'IFSRO': |
|
398 | - $data = array(); |
|
399 | - // Fetch all data, regardless of privacy |
|
400 | - $rows = get_INDI_rows($WT_TREE, $term); |
|
401 | - // Filter for privacy |
|
402 | - foreach ($rows as $row) { |
|
403 | - $person = Individual::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
404 | - if ($person->canShowName()) { |
|
405 | - $data[] = array('value' => $person->getXref(), 'label' => str_replace(array('@N.N.', '@P.N.'), array(I18N::translateContext('Unknown surname', '…'), I18N::translateContext('Unknown given name', '…')), $row->n_full) . ', <i>' . $person->getLifeSpan() . '</i>'); |
|
368 | + ))->fetchAll(); |
|
369 | + // Filter for privacy |
|
370 | + foreach ($rows as $row) { |
|
371 | + $source = Source::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
372 | + if ($source->canShowName()) { |
|
373 | + $data[] = $row->s_name; |
|
374 | + } |
|
406 | 375 | } |
407 | - } |
|
408 | - // Fetch all data, regardless of privacy |
|
409 | - $rows = get_SOUR_rows($WT_TREE, $term); |
|
410 | - // Filter for privacy |
|
411 | - foreach ($rows as $row) { |
|
412 | - $source = Source::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
413 | - if ($source->canShowName()) { |
|
414 | - $data[] = array('value' => $source->getXref(), 'label' => $source->getFullName()); |
|
376 | + echo json_encode($data); |
|
377 | + |
|
378 | + return; |
|
379 | + |
|
380 | + case 'SURN': // Surnames, that start with the search term |
|
381 | + // Do not filter by privacy. Surnames on their own do not identify individuals. |
|
382 | + echo json_encode( |
|
383 | + Database::prepare( |
|
384 | + "SELECT SQL_CACHE DISTINCT n_surname" . |
|
385 | + " FROM `##name`" . |
|
386 | + " WHERE n_surname LIKE CONCAT(:term, '%') AND n_file = :tree_id" . |
|
387 | + " ORDER BY n_surname COLLATE :collation" |
|
388 | + )->execute(array( |
|
389 | + 'term' => $term, |
|
390 | + 'tree_id' => $WT_TREE->getTreeId(), |
|
391 | + 'collation' => I18N::collation(), |
|
392 | + ))->fetchOneColumn() |
|
393 | + ); |
|
394 | + |
|
395 | + return; |
|
396 | + |
|
397 | + case 'IFSRO': |
|
398 | + $data = array(); |
|
399 | + // Fetch all data, regardless of privacy |
|
400 | + $rows = get_INDI_rows($WT_TREE, $term); |
|
401 | + // Filter for privacy |
|
402 | + foreach ($rows as $row) { |
|
403 | + $person = Individual::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
404 | + if ($person->canShowName()) { |
|
405 | + $data[] = array('value' => $person->getXref(), 'label' => str_replace(array('@N.N.', '@P.N.'), array(I18N::translateContext('Unknown surname', '…'), I18N::translateContext('Unknown given name', '…')), $row->n_full) . ', <i>' . $person->getLifeSpan() . '</i>'); |
|
406 | + } |
|
415 | 407 | } |
416 | - } |
|
417 | - // Fetch all data, regardless of privacy |
|
418 | - $rows = get_REPO_rows($WT_TREE, $term); |
|
419 | - // Filter for privacy |
|
420 | - foreach ($rows as $row) { |
|
421 | - $repository = Repository::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
422 | - if ($repository->canShowName()) { |
|
423 | - $data[] = array('value' => $repository->getXref(), 'label' => $repository->getFullName()); |
|
408 | + // Fetch all data, regardless of privacy |
|
409 | + $rows = get_SOUR_rows($WT_TREE, $term); |
|
410 | + // Filter for privacy |
|
411 | + foreach ($rows as $row) { |
|
412 | + $source = Source::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
413 | + if ($source->canShowName()) { |
|
414 | + $data[] = array('value' => $source->getXref(), 'label' => $source->getFullName()); |
|
415 | + } |
|
424 | 416 | } |
425 | - } |
|
426 | - // Fetch all data, regardless of privacy |
|
427 | - $rows = get_OBJE_rows($WT_TREE, $term); |
|
428 | - // Filter for privacy |
|
429 | - foreach ($rows as $row) { |
|
430 | - $media = Media::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
431 | - if ($media->canShowName()) { |
|
432 | - $data[] = array('value' => $media->getXref(), 'label' => '<img src="' . $media->getHtmlUrlDirect() . '" width="25"> ' . $media->getFullName()); |
|
417 | + // Fetch all data, regardless of privacy |
|
418 | + $rows = get_REPO_rows($WT_TREE, $term); |
|
419 | + // Filter for privacy |
|
420 | + foreach ($rows as $row) { |
|
421 | + $repository = Repository::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
422 | + if ($repository->canShowName()) { |
|
423 | + $data[] = array('value' => $repository->getXref(), 'label' => $repository->getFullName()); |
|
424 | + } |
|
433 | 425 | } |
434 | - } |
|
435 | - // Fetch all data, regardless of privacy |
|
436 | - $rows = get_FAM_rows($WT_TREE, $term); |
|
437 | - // Filter for privacy |
|
438 | - foreach ($rows as $row) { |
|
439 | - $family = Family::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
440 | - if ($family->canShowName()) { |
|
441 | - $marriage_year = $family->getMarriageYear(); |
|
442 | - if ($marriage_year) { |
|
443 | - $data[] = array('value' => $family->getXref(), 'label' => $family->getFullName() . ', <i>' . $marriage_year . '</i>'); |
|
444 | - } else { |
|
445 | - $data[] = array('value' => $family->getXref(), 'label' => $family->getFullName()); |
|
426 | + // Fetch all data, regardless of privacy |
|
427 | + $rows = get_OBJE_rows($WT_TREE, $term); |
|
428 | + // Filter for privacy |
|
429 | + foreach ($rows as $row) { |
|
430 | + $media = Media::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
431 | + if ($media->canShowName()) { |
|
432 | + $data[] = array('value' => $media->getXref(), 'label' => '<img src="' . $media->getHtmlUrlDirect() . '" width="25"> ' . $media->getFullName()); |
|
433 | + } |
|
434 | + } |
|
435 | + // Fetch all data, regardless of privacy |
|
436 | + $rows = get_FAM_rows($WT_TREE, $term); |
|
437 | + // Filter for privacy |
|
438 | + foreach ($rows as $row) { |
|
439 | + $family = Family::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
440 | + if ($family->canShowName()) { |
|
441 | + $marriage_year = $family->getMarriageYear(); |
|
442 | + if ($marriage_year) { |
|
443 | + $data[] = array('value' => $family->getXref(), 'label' => $family->getFullName() . ', <i>' . $marriage_year . '</i>'); |
|
444 | + } else { |
|
445 | + $data[] = array('value' => $family->getXref(), 'label' => $family->getFullName()); |
|
446 | + } |
|
446 | 447 | } |
447 | 448 | } |
448 | - } |
|
449 | - // Fetch all data, regardless of privacy |
|
450 | - $rows = get_NOTE_rows($WT_TREE, $term); |
|
451 | - // Filter for privacy |
|
452 | - foreach ($rows as $row) { |
|
453 | - $note = Note::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
454 | - if ($note->canShowName()) { |
|
455 | - $data[] = array('value' => $note->getXref(), 'label' => $note->getFullName()); |
|
449 | + // Fetch all data, regardless of privacy |
|
450 | + $rows = get_NOTE_rows($WT_TREE, $term); |
|
451 | + // Filter for privacy |
|
452 | + foreach ($rows as $row) { |
|
453 | + $note = Note::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
454 | + if ($note->canShowName()) { |
|
455 | + $data[] = array('value' => $note->getXref(), 'label' => $note->getFullName()); |
|
456 | + } |
|
456 | 457 | } |
457 | - } |
|
458 | - echo json_encode($data); |
|
459 | - |
|
460 | - return; |
|
461 | - |
|
462 | -case 'IFS': |
|
463 | - $data = array(); |
|
464 | - // Fetch all data, regardless of privacy |
|
465 | - $rows = get_INDI_rows($WT_TREE, $term); |
|
466 | - // Filter for privacy |
|
467 | - foreach ($rows as $row) { |
|
468 | - $person = Individual::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
469 | - if ($person->canShowName()) { |
|
470 | - $data[] = array('value' => $person->getXref(), 'label' => str_replace(array('@N.N.', '@P.N.'), array(I18N::translateContext('Unknown surname', '…'), I18N::translateContext('Unknown given name', '…')), $row->n_full) . ', <i>' . $person->getLifeSpan() . '</i>'); |
|
458 | + echo json_encode($data); |
|
459 | + |
|
460 | + return; |
|
461 | + |
|
462 | + case 'IFS': |
|
463 | + $data = array(); |
|
464 | + // Fetch all data, regardless of privacy |
|
465 | + $rows = get_INDI_rows($WT_TREE, $term); |
|
466 | + // Filter for privacy |
|
467 | + foreach ($rows as $row) { |
|
468 | + $person = Individual::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
469 | + if ($person->canShowName()) { |
|
470 | + $data[] = array('value' => $person->getXref(), 'label' => str_replace(array('@N.N.', '@P.N.'), array(I18N::translateContext('Unknown surname', '…'), I18N::translateContext('Unknown given name', '…')), $row->n_full) . ', <i>' . $person->getLifeSpan() . '</i>'); |
|
471 | + } |
|
471 | 472 | } |
472 | - } |
|
473 | - // Fetch all data, regardless of privacy |
|
474 | - $rows = get_SOUR_rows($WT_TREE, $term); |
|
475 | - // Filter for privacy |
|
476 | - foreach ($rows as $row) { |
|
477 | - $source = Source::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
478 | - if ($source->canShowName()) { |
|
479 | - $data[] = array('value' => $source->getXref(), 'label' => $source->getFullName()); |
|
473 | + // Fetch all data, regardless of privacy |
|
474 | + $rows = get_SOUR_rows($WT_TREE, $term); |
|
475 | + // Filter for privacy |
|
476 | + foreach ($rows as $row) { |
|
477 | + $source = Source::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
478 | + if ($source->canShowName()) { |
|
479 | + $data[] = array('value' => $source->getXref(), 'label' => $source->getFullName()); |
|
480 | + } |
|
480 | 481 | } |
481 | - } |
|
482 | - // Fetch all data, regardless of privacy |
|
483 | - $rows = get_FAM_rows($WT_TREE, $term); |
|
484 | - // Filter for privacy |
|
485 | - foreach ($rows as $row) { |
|
486 | - $family = Family::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
487 | - if ($family->canShowName()) { |
|
488 | - $marriage_year = $family->getMarriageYear(); |
|
489 | - if ($marriage_year) { |
|
490 | - $data[] = array('value' => $family->getXref(), 'label' => $family->getFullName() . ', <i>' . $marriage_year . '</i>'); |
|
491 | - } else { |
|
492 | - $data[] = array('value' => $family->getXref(), 'label' => $family->getFullName()); |
|
482 | + // Fetch all data, regardless of privacy |
|
483 | + $rows = get_FAM_rows($WT_TREE, $term); |
|
484 | + // Filter for privacy |
|
485 | + foreach ($rows as $row) { |
|
486 | + $family = Family::getInstance($row->xref, $WT_TREE, $row->gedcom); |
|
487 | + if ($family->canShowName()) { |
|
488 | + $marriage_year = $family->getMarriageYear(); |
|
489 | + if ($marriage_year) { |
|
490 | + $data[] = array('value' => $family->getXref(), 'label' => $family->getFullName() . ', <i>' . $marriage_year . '</i>'); |
|
491 | + } else { |
|
492 | + $data[] = array('value' => $family->getXref(), 'label' => $family->getFullName()); |
|
493 | + } |
|
493 | 494 | } |
494 | 495 | } |
495 | - } |
|
496 | - echo json_encode($data); |
|
496 | + echo json_encode($data); |
|
497 | 497 | |
498 | - return; |
|
498 | + return; |
|
499 | 499 | } |
500 | 500 | |
501 | 501 | /** |
@@ -38,75 +38,75 @@ discard block |
||
38 | 38 | |
39 | 39 | // Form actions |
40 | 40 | switch (Filter::post('action')) { |
41 | -case 'save': |
|
42 | - if (Filter::checkCsrf()) { |
|
43 | - $site_access_rule_id = Filter::postInteger('site_access_rule_id'); |
|
44 | - $ip_address_start = Filter::post('ip_address_start', WT_REGEX_IPV4); |
|
45 | - $ip_address_end = Filter::post('ip_address_end', WT_REGEX_IPV4); |
|
46 | - $user_agent_pattern = Filter::post('user_agent_pattern'); |
|
47 | - $rule = Filter::post('rule', 'allow|deny|robot'); |
|
48 | - $comment = Filter::post('comment'); |
|
49 | - $user_agent_string = Filter::server('HTTP_USER_AGENT'); |
|
50 | - $ip_address = WT_CLIENT_IP; |
|
51 | - |
|
52 | - if ($ip_address_start !== null && $ip_address_end !== null && $user_agent_pattern !== null && $rule !== null) { |
|
53 | - // This doesn't work with named placeholders. The :user_agent_string parameter is not recognised. |
|
54 | - $oops = $rule !== 'allow' && Database::prepare( |
|
55 | - "SELECT INET_ATON(:ip_address) BETWEEN INET_ATON(:ip_address_start) AND INET_ATON(:ip_address_end)" . |
|
56 | - " AND :user_agent_string LIKE :user_agent_pattern" |
|
57 | - )->execute(array( |
|
58 | - 'ip_address' => $ip_address, |
|
59 | - 'ip_address_start' => $ip_address_start, |
|
60 | - 'ip_address_end' => $ip_address_end, |
|
61 | - 'user_agent_string' => $user_agent_string, |
|
62 | - 'user_agent_pattern' => $user_agent_pattern, |
|
63 | - ))->fetchOne(); |
|
64 | - |
|
65 | - if ($oops) { |
|
66 | - FlashMessages::addMessage(I18N::translate('You cannot create a rule which would prevent yourself from accessing the website.'), 'danger'); |
|
67 | - } elseif ($site_access_rule_id === null) { |
|
68 | - Database::prepare( |
|
69 | - "INSERT INTO `##site_access_rule` (ip_address_start, ip_address_end, user_agent_pattern, rule, comment) VALUES (INET_ATON(:ip_address_start), INET_ATON(:ip_address_end), :user_agent_pattern, :rule, :comment)" |
|
70 | - )->execute(array( |
|
71 | - 'ip_address_start' => $ip_address_start, |
|
72 | - 'ip_address_end' => $ip_address_end, |
|
73 | - 'user_agent_pattern' => $user_agent_pattern, |
|
74 | - 'rule' => $rule, |
|
75 | - 'comment' => $comment, |
|
76 | - )); |
|
77 | - FlashMessages::addMessage(I18N::translate('The website access rule has been created.'), 'success'); |
|
78 | - } else { |
|
79 | - Database::prepare( |
|
80 | - "UPDATE `##site_access_rule` SET ip_address_start = INET_ATON(:ip_address_start), ip_address_end = INET_ATON(:ip_address_end), user_agent_pattern = :user_agent_pattern, rule = :rule, comment = :comment WHERE site_access_rule_id = :site_access_rule_id" |
|
41 | + case 'save': |
|
42 | + if (Filter::checkCsrf()) { |
|
43 | + $site_access_rule_id = Filter::postInteger('site_access_rule_id'); |
|
44 | + $ip_address_start = Filter::post('ip_address_start', WT_REGEX_IPV4); |
|
45 | + $ip_address_end = Filter::post('ip_address_end', WT_REGEX_IPV4); |
|
46 | + $user_agent_pattern = Filter::post('user_agent_pattern'); |
|
47 | + $rule = Filter::post('rule', 'allow|deny|robot'); |
|
48 | + $comment = Filter::post('comment'); |
|
49 | + $user_agent_string = Filter::server('HTTP_USER_AGENT'); |
|
50 | + $ip_address = WT_CLIENT_IP; |
|
51 | + |
|
52 | + if ($ip_address_start !== null && $ip_address_end !== null && $user_agent_pattern !== null && $rule !== null) { |
|
53 | + // This doesn't work with named placeholders. The :user_agent_string parameter is not recognised. |
|
54 | + $oops = $rule !== 'allow' && Database::prepare( |
|
55 | + "SELECT INET_ATON(:ip_address) BETWEEN INET_ATON(:ip_address_start) AND INET_ATON(:ip_address_end)" . |
|
56 | + " AND :user_agent_string LIKE :user_agent_pattern" |
|
81 | 57 | )->execute(array( |
82 | - 'ip_address_start' => $ip_address_start, |
|
83 | - 'ip_address_end' => $ip_address_end, |
|
84 | - 'user_agent_pattern' => $user_agent_pattern, |
|
85 | - 'rule' => $rule, |
|
86 | - 'comment' => $comment, |
|
87 | - 'site_access_rule_id' => $site_access_rule_id, |
|
88 | - )); |
|
89 | - FlashMessages::addMessage(I18N::translate('The website access rule has been updated.'), 'success'); |
|
58 | + 'ip_address' => $ip_address, |
|
59 | + 'ip_address_start' => $ip_address_start, |
|
60 | + 'ip_address_end' => $ip_address_end, |
|
61 | + 'user_agent_string' => $user_agent_string, |
|
62 | + 'user_agent_pattern' => $user_agent_pattern, |
|
63 | + ))->fetchOne(); |
|
64 | + |
|
65 | + if ($oops) { |
|
66 | + FlashMessages::addMessage(I18N::translate('You cannot create a rule which would prevent yourself from accessing the website.'), 'danger'); |
|
67 | + } elseif ($site_access_rule_id === null) { |
|
68 | + Database::prepare( |
|
69 | + "INSERT INTO `##site_access_rule` (ip_address_start, ip_address_end, user_agent_pattern, rule, comment) VALUES (INET_ATON(:ip_address_start), INET_ATON(:ip_address_end), :user_agent_pattern, :rule, :comment)" |
|
70 | + )->execute(array( |
|
71 | + 'ip_address_start' => $ip_address_start, |
|
72 | + 'ip_address_end' => $ip_address_end, |
|
73 | + 'user_agent_pattern' => $user_agent_pattern, |
|
74 | + 'rule' => $rule, |
|
75 | + 'comment' => $comment, |
|
76 | + )); |
|
77 | + FlashMessages::addMessage(I18N::translate('The website access rule has been created.'), 'success'); |
|
78 | + } else { |
|
79 | + Database::prepare( |
|
80 | + "UPDATE `##site_access_rule` SET ip_address_start = INET_ATON(:ip_address_start), ip_address_end = INET_ATON(:ip_address_end), user_agent_pattern = :user_agent_pattern, rule = :rule, comment = :comment WHERE site_access_rule_id = :site_access_rule_id" |
|
81 | + )->execute(array( |
|
82 | + 'ip_address_start' => $ip_address_start, |
|
83 | + 'ip_address_end' => $ip_address_end, |
|
84 | + 'user_agent_pattern' => $user_agent_pattern, |
|
85 | + 'rule' => $rule, |
|
86 | + 'comment' => $comment, |
|
87 | + 'site_access_rule_id' => $site_access_rule_id, |
|
88 | + )); |
|
89 | + FlashMessages::addMessage(I18N::translate('The website access rule has been updated.'), 'success'); |
|
90 | + } |
|
90 | 91 | } |
91 | 92 | } |
92 | - } |
|
93 | - header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME); |
|
93 | + header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME); |
|
94 | 94 | |
95 | - return; |
|
95 | + return; |
|
96 | 96 | |
97 | -case 'delete': |
|
98 | - if (Filter::checkCsrf()) { |
|
99 | - $site_access_rule_id = Filter::postInteger('site_access_rule_id'); |
|
100 | - Database::prepare( |
|
101 | - "DELETE FROM `##site_access_rule` WHERE site_access_rule_id = :site_access_rule_id" |
|
102 | - )->execute(array( |
|
103 | - 'site_access_rule_id' => $site_access_rule_id, |
|
104 | - )); |
|
105 | - FlashMessages::addMessage(I18N::translate('The website access rule has been deleted.'), 'success'); |
|
106 | - } |
|
107 | - header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME); |
|
97 | + case 'delete': |
|
98 | + if (Filter::checkCsrf()) { |
|
99 | + $site_access_rule_id = Filter::postInteger('site_access_rule_id'); |
|
100 | + Database::prepare( |
|
101 | + "DELETE FROM `##site_access_rule` WHERE site_access_rule_id = :site_access_rule_id" |
|
102 | + )->execute(array( |
|
103 | + 'site_access_rule_id' => $site_access_rule_id, |
|
104 | + )); |
|
105 | + FlashMessages::addMessage(I18N::translate('The website access rule has been deleted.'), 'success'); |
|
106 | + } |
|
107 | + header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME); |
|
108 | 108 | |
109 | - return; |
|
109 | + return; |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | // Delete any "unknown" visitors that are now "known". |
@@ -128,50 +128,50 @@ discard block |
||
128 | 128 | |
129 | 129 | $action = Filter::get('action'); |
130 | 130 | switch ($action) { |
131 | -case 'load': |
|
132 | - // AJAX callback for datatables |
|
133 | - $search = Filter::get('search'); |
|
134 | - $search = $search['value']; |
|
135 | - $start = Filter::getInteger('start'); |
|
136 | - $length = Filter::getInteger('length'); |
|
137 | - |
|
138 | - $sql = |
|
139 | - "SELECT SQL_CACHE SQL_CALC_FOUND_ROWS" . |
|
140 | - " '', INET_NTOA(ip_address_start), ip_address_start, INET_NTOA(ip_address_end), ip_address_end, user_agent_pattern, rule, comment, site_access_rule_id" . |
|
141 | - " FROM `##site_access_rule`"; |
|
142 | - $args = array(); |
|
143 | - |
|
144 | - if ($search) { |
|
145 | - $sql .= |
|
146 | - " WHERE (INET_ATON(:search_1) BETWEEN ip_address_start AND ip_address_end" . |
|
147 | - " OR INET_NTOA(ip_address_start) LIKE CONCAT('%', :search_2, '%')" . |
|
148 | - " OR INET_NTOA(ip_address_end) LIKE CONCAT('%', :search_3, '%')" . |
|
149 | - " OR user_agent_pattern LIKE CONCAT('%', :search_4, '%')" . |
|
150 | - " OR comment LIKE CONCAT('%', :search_5, '%'))"; |
|
151 | - $args['search_1'] = Filter::escapeLike($search); |
|
152 | - $args['search_2'] = Filter::escapeLike($search); |
|
153 | - $args['search_3'] = Filter::escapeLike($search); |
|
154 | - $args['search_4'] = Filter::escapeLike($search); |
|
155 | - $args['search_5'] = Filter::escapeLike($search); |
|
156 | - } |
|
131 | + case 'load': |
|
132 | + // AJAX callback for datatables |
|
133 | + $search = Filter::get('search'); |
|
134 | + $search = $search['value']; |
|
135 | + $start = Filter::getInteger('start'); |
|
136 | + $length = Filter::getInteger('length'); |
|
137 | + |
|
138 | + $sql = |
|
139 | + "SELECT SQL_CACHE SQL_CALC_FOUND_ROWS" . |
|
140 | + " '', INET_NTOA(ip_address_start), ip_address_start, INET_NTOA(ip_address_end), ip_address_end, user_agent_pattern, rule, comment, site_access_rule_id" . |
|
141 | + " FROM `##site_access_rule`"; |
|
142 | + $args = array(); |
|
143 | + |
|
144 | + if ($search) { |
|
145 | + $sql .= |
|
146 | + " WHERE (INET_ATON(:search_1) BETWEEN ip_address_start AND ip_address_end" . |
|
147 | + " OR INET_NTOA(ip_address_start) LIKE CONCAT('%', :search_2, '%')" . |
|
148 | + " OR INET_NTOA(ip_address_end) LIKE CONCAT('%', :search_3, '%')" . |
|
149 | + " OR user_agent_pattern LIKE CONCAT('%', :search_4, '%')" . |
|
150 | + " OR comment LIKE CONCAT('%', :search_5, '%'))"; |
|
151 | + $args['search_1'] = Filter::escapeLike($search); |
|
152 | + $args['search_2'] = Filter::escapeLike($search); |
|
153 | + $args['search_3'] = Filter::escapeLike($search); |
|
154 | + $args['search_4'] = Filter::escapeLike($search); |
|
155 | + $args['search_5'] = Filter::escapeLike($search); |
|
156 | + } |
|
157 | 157 | |
158 | - $order = Filter::getArray('order'); |
|
159 | - $sql .= ' ORDER BY'; |
|
160 | - if ($order) { |
|
161 | - foreach ($order as $key => $value) { |
|
162 | - if ($key > 0) { |
|
163 | - $sql .= ','; |
|
164 | - } |
|
165 | - // Datatables numbers columns 0, 1, 2 |
|
166 | - // MySQL numbers columns 1, 2, 3 |
|
167 | - switch ($value['dir']) { |
|
168 | - case 'asc': |
|
169 | - $sql .= " :col_" . $key . " ASC"; |
|
170 | - break; |
|
171 | - case 'desc': |
|
172 | - $sql .= " :col_" . $key . " DESC"; |
|
173 | - break; |
|
174 | - } |
|
158 | + $order = Filter::getArray('order'); |
|
159 | + $sql .= ' ORDER BY'; |
|
160 | + if ($order) { |
|
161 | + foreach ($order as $key => $value) { |
|
162 | + if ($key > 0) { |
|
163 | + $sql .= ','; |
|
164 | + } |
|
165 | + // Datatables numbers columns 0, 1, 2 |
|
166 | + // MySQL numbers columns 1, 2, 3 |
|
167 | + switch ($value['dir']) { |
|
168 | + case 'asc': |
|
169 | + $sql .= " :col_" . $key . " ASC"; |
|
170 | + break; |
|
171 | + case 'desc': |
|
172 | + $sql .= " :col_" . $key . " DESC"; |
|
173 | + break; |
|
174 | + } |
|
175 | 175 | $args['col_' . $key] = 1 + $value['column']; |
176 | 176 | } |
177 | 177 | } else { |
@@ -210,31 +210,31 @@ discard block |
||
210 | 210 | )); |
211 | 211 | break; |
212 | 212 | |
213 | -case 'edit': |
|
214 | -case 'create': |
|
215 | - if (Filter::get('action') === 'edit') { |
|
216 | - $controller->setPageTitle(I18N::translate('Edit a website access rule')); |
|
217 | - } else { |
|
218 | - $controller->setPageTitle(I18N::translate('Create a website access rule')); |
|
219 | - } |
|
213 | + case 'edit': |
|
214 | + case 'create': |
|
215 | + if (Filter::get('action') === 'edit') { |
|
216 | + $controller->setPageTitle(I18N::translate('Edit a website access rule')); |
|
217 | + } else { |
|
218 | + $controller->setPageTitle(I18N::translate('Create a website access rule')); |
|
219 | + } |
|
220 | 220 | |
221 | - $controller->pageHeader(); |
|
221 | + $controller->pageHeader(); |
|
222 | 222 | |
223 | - $site_access_rule = Database::prepare( |
|
224 | - "SELECT site_access_rule_id, INET_NTOA(ip_address_start) AS ip_address_start, INET_NTOA(ip_address_end) AS ip_address_end, user_agent_pattern, rule, comment" . |
|
225 | - " FROM `##site_access_rule` WHERE site_access_rule_id = :site_access_rule_id" |
|
226 | - )->execute(array( |
|
227 | - 'site_access_rule_id' => Filter::getInteger('site_access_rule_id'), |
|
228 | - ))->fetchOneRow(); |
|
223 | + $site_access_rule = Database::prepare( |
|
224 | + "SELECT site_access_rule_id, INET_NTOA(ip_address_start) AS ip_address_start, INET_NTOA(ip_address_end) AS ip_address_end, user_agent_pattern, rule, comment" . |
|
225 | + " FROM `##site_access_rule` WHERE site_access_rule_id = :site_access_rule_id" |
|
226 | + )->execute(array( |
|
227 | + 'site_access_rule_id' => Filter::getInteger('site_access_rule_id'), |
|
228 | + ))->fetchOneRow(); |
|
229 | 229 | |
230 | - $site_access_rule_id = $site_access_rule ? $site_access_rule->site_access_rule_id : null; |
|
231 | - $ip_address_start = $site_access_rule ? $site_access_rule->ip_address_start : '0.0.0.0'; |
|
232 | - $ip_address_end = $site_access_rule ? $site_access_rule->ip_address_end : '255.255.255.255'; |
|
233 | - $user_agent_pattern = $site_access_rule ? $site_access_rule->user_agent_pattern : '%'; |
|
234 | - $rule = $site_access_rule ? $site_access_rule->rule : 'allow'; |
|
235 | - $comment = $site_access_rule ? $site_access_rule->comment : ''; |
|
230 | + $site_access_rule_id = $site_access_rule ? $site_access_rule->site_access_rule_id : null; |
|
231 | + $ip_address_start = $site_access_rule ? $site_access_rule->ip_address_start : '0.0.0.0'; |
|
232 | + $ip_address_end = $site_access_rule ? $site_access_rule->ip_address_end : '255.255.255.255'; |
|
233 | + $user_agent_pattern = $site_access_rule ? $site_access_rule->user_agent_pattern : '%'; |
|
234 | + $rule = $site_access_rule ? $site_access_rule->rule : 'allow'; |
|
235 | + $comment = $site_access_rule ? $site_access_rule->comment : ''; |
|
236 | 236 | |
237 | - ?> |
|
237 | + ?> |
|
238 | 238 | <ol class="breadcrumb small"> |
239 | 239 | <li><a href="admin.php"><?php echo I18N::translate('Control panel'); ?></a></li> |
240 | 240 | <li><a href="admin_site_access.php"><?php echo I18N::translate('Website access rules'); ?></a></li> |
@@ -311,12 +311,12 @@ discard block |
||
311 | 311 | </form> |
312 | 312 | |
313 | 313 | <?php |
314 | - break; |
|
314 | + break; |
|
315 | 315 | |
316 | -default: |
|
317 | - $controller |
|
318 | - ->pageHeader() |
|
319 | - ->addInlineJavascript(' |
|
316 | + default: |
|
317 | + $controller |
|
318 | + ->pageHeader() |
|
319 | + ->addInlineJavascript(' |
|
320 | 320 | jQuery.fn.dataTableExt.oSort["unicode-asc" ]=function(a,b) {return a.replace(/<[^<]*>/, "").localeCompare(b.replace(/<[^<]*>/, ""))}; |
321 | 321 | jQuery.fn.dataTableExt.oSort["unicode-desc"]=function(a,b) {return b.replace(/<[^<]*>/, "").localeCompare(a.replace(/<[^<]*>/, ""))}; |
322 | 322 | jQuery(".table-site-access-rules").dataTable({ |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | }); |
341 | 341 | '); |
342 | 342 | |
343 | - ?> |
|
343 | + ?> |
|
344 | 344 | <ol class="breadcrumb small"> |
345 | 345 | <li><a href="admin.php"><?php echo I18N::translate('Control panel'); ?></a></li> |
346 | 346 | <li class="active"><?php echo $controller->getPageTitle(); ?></li> |
@@ -381,5 +381,5 @@ discard block |
||
381 | 381 | } |
382 | 382 | </script> |
383 | 383 | <?php |
384 | - break; |
|
384 | + break; |
|
385 | 385 | } |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | |
47 | 47 | $show_marnm = Filter::get('show_marnm', 'no|yes'); |
48 | 48 | switch ($show_marnm) { |
49 | -case 'no': |
|
50 | -case 'yes': |
|
51 | - Auth::user()->setPreference(WT_SCRIPT_NAME . '_show_marnm', $show_marnm); |
|
52 | - break; |
|
53 | -default: |
|
54 | - $show_marnm = Auth::user()->getPreference(WT_SCRIPT_NAME . '_show_marnm'); |
|
49 | + case 'no': |
|
50 | + case 'yes': |
|
51 | + Auth::user()->setPreference(WT_SCRIPT_NAME . '_show_marnm', $show_marnm); |
|
52 | + break; |
|
53 | + default: |
|
54 | + $show_marnm = Auth::user()->getPreference(WT_SCRIPT_NAME . '_show_marnm'); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | // Make sure selections are consistent. |
@@ -91,16 +91,16 @@ discard block |
||
91 | 91 | } |
92 | 92 | $url = WT_SCRIPT_NAME . '?surname=' . rawurlencode($surname) . '&ged=' . $WT_TREE->getNameUrl(); |
93 | 93 | switch ($falpha) { |
94 | - case '': |
|
95 | - break; |
|
96 | - case '@': |
|
97 | - $legend .= ', ' . I18N::translateContext('Unknown given name', '…'); |
|
98 | - $url .= '&falpha=' . rawurlencode($falpha) . '&ged=' . $WT_TREE->getNameUrl(); |
|
99 | - break; |
|
100 | - default: |
|
101 | - $legend .= ', ' . Filter::escapeHtml($falpha) . '…'; |
|
102 | - $url .= '&falpha=' . rawurlencode($falpha) . '&ged=' . $WT_TREE->getNameUrl(); |
|
103 | - break; |
|
94 | + case '': |
|
95 | + break; |
|
96 | + case '@': |
|
97 | + $legend .= ', ' . I18N::translateContext('Unknown given name', '…'); |
|
98 | + $url .= '&falpha=' . rawurlencode($falpha) . '&ged=' . $WT_TREE->getNameUrl(); |
|
99 | + break; |
|
100 | + default: |
|
101 | + $legend .= ', ' . Filter::escapeHtml($falpha) . '…'; |
|
102 | + $url .= '&falpha=' . rawurlencode($falpha) . '&ged=' . $WT_TREE->getNameUrl(); |
|
103 | + break; |
|
104 | 104 | } |
105 | 105 | $show = 'indi'; // SURN list makes no sense here |
106 | 106 | } elseif ($alpha === '@') { |
@@ -136,15 +136,15 @@ discard block |
||
136 | 136 | $list = array(); |
137 | 137 | foreach (QueryName::surnameAlpha($WT_TREE, $show_marnm === 'yes', true) as $letter => $count) { |
138 | 138 | switch ($letter) { |
139 | - case '@': |
|
140 | - $html = I18N::translateContext('Unknown surname', '…'); |
|
141 | - break; |
|
142 | - case ',': |
|
143 | - $html = I18N::translate('None'); |
|
144 | - break; |
|
145 | - default: |
|
146 | - $html = Filter::escapeHtml($letter); |
|
147 | - break; |
|
139 | + case '@': |
|
140 | + $html = I18N::translateContext('Unknown surname', '…'); |
|
141 | + break; |
|
142 | + case ',': |
|
143 | + $html = I18N::translate('None'); |
|
144 | + break; |
|
145 | + default: |
|
146 | + $html = Filter::escapeHtml($letter); |
|
147 | + break; |
|
148 | 148 | } |
149 | 149 | if ($count) { |
150 | 150 | if ($letter == $alpha) { |
@@ -194,16 +194,16 @@ discard block |
||
194 | 194 | if ($show === 'surn') { |
195 | 195 | // Show the surname list |
196 | 196 | switch ($WT_TREE->getPreference('SURNAME_LIST_STYLE')) { |
197 | - case 'style1': |
|
198 | - echo FunctionsPrintLists::surnameList($surns, 3, true, WT_SCRIPT_NAME, $WT_TREE); |
|
199 | - break; |
|
200 | - case 'style3': |
|
201 | - echo FunctionsPrintLists::surnameTagCloud($surns, WT_SCRIPT_NAME, true, $WT_TREE); |
|
202 | - break; |
|
203 | - case 'style2': |
|
204 | - default: |
|
205 | - echo FunctionsPrintLists::surnameTable($surns, WT_SCRIPT_NAME, $WT_TREE); |
|
206 | - break; |
|
197 | + case 'style1': |
|
198 | + echo FunctionsPrintLists::surnameList($surns, 3, true, WT_SCRIPT_NAME, $WT_TREE); |
|
199 | + break; |
|
200 | + case 'style3': |
|
201 | + echo FunctionsPrintLists::surnameTagCloud($surns, WT_SCRIPT_NAME, true, $WT_TREE); |
|
202 | + break; |
|
203 | + case 'style2': |
|
204 | + default: |
|
205 | + echo FunctionsPrintLists::surnameTable($surns, WT_SCRIPT_NAME, $WT_TREE); |
|
206 | + break; |
|
207 | 207 | } |
208 | 208 | } else { |
209 | 209 | // Show the list |
@@ -226,12 +226,12 @@ discard block |
||
226 | 226 | $list = array(); |
227 | 227 | foreach ($givn_initials as $givn_initial => $count) { |
228 | 228 | switch ($givn_initial) { |
229 | - case '@': |
|
230 | - $html = I18N::translateContext('Unknown given name', '…'); |
|
231 | - break; |
|
232 | - default: |
|
233 | - $html = Filter::escapeHtml($givn_initial); |
|
234 | - break; |
|
229 | + case '@': |
|
230 | + $html = I18N::translateContext('Unknown given name', '…'); |
|
231 | + break; |
|
232 | + default: |
|
233 | + $html = Filter::escapeHtml($givn_initial); |
|
234 | + break; |
|
235 | 235 | } |
236 | 236 | if ($count) { |
237 | 237 | if ($show === 'indi' && $givn_initial === $falpha && $show_all_firstnames === 'no') { |
@@ -92,23 +92,23 @@ discard block |
||
92 | 92 | public function getTarget() { |
93 | 93 | $xref = trim($this->getValue(), '@'); |
94 | 94 | switch ($this->tag) { |
95 | - case 'FAMC': |
|
96 | - case 'FAMS': |
|
97 | - return Family::getInstance($xref, $this->getParent()->getTree()); |
|
98 | - case 'HUSB': |
|
99 | - case 'WIFE': |
|
100 | - case 'CHIL': |
|
101 | - return Individual::getInstance($xref, $this->getParent()->getTree()); |
|
102 | - case 'SOUR': |
|
103 | - return Source::getInstance($xref, $this->getParent()->getTree()); |
|
104 | - case 'OBJE': |
|
105 | - return Media::getInstance($xref, $this->getParent()->getTree()); |
|
106 | - case 'REPO': |
|
107 | - return Repository::getInstance($xref, $this->getParent()->getTree()); |
|
108 | - case 'NOTE': |
|
109 | - return Note::getInstance($xref, $this->getParent()->getTree()); |
|
110 | - default: |
|
111 | - return GedcomRecord::getInstance($xref, $this->getParent()->getTree()); |
|
95 | + case 'FAMC': |
|
96 | + case 'FAMS': |
|
97 | + return Family::getInstance($xref, $this->getParent()->getTree()); |
|
98 | + case 'HUSB': |
|
99 | + case 'WIFE': |
|
100 | + case 'CHIL': |
|
101 | + return Individual::getInstance($xref, $this->getParent()->getTree()); |
|
102 | + case 'SOUR': |
|
103 | + return Source::getInstance($xref, $this->getParent()->getTree()); |
|
104 | + case 'OBJE': |
|
105 | + return Media::getInstance($xref, $this->getParent()->getTree()); |
|
106 | + case 'REPO': |
|
107 | + return Repository::getInstance($xref, $this->getParent()->getTree()); |
|
108 | + case 'NOTE': |
|
109 | + return Note::getInstance($xref, $this->getParent()->getTree()); |
|
110 | + default: |
|
111 | + return GedcomRecord::getInstance($xref, $this->getParent()->getTree()); |
|
112 | 112 | } |
113 | 113 | } |
114 | 114 | |
@@ -262,15 +262,15 @@ discard block |
||
262 | 262 | */ |
263 | 263 | public function getLabel() { |
264 | 264 | switch ($this->tag) { |
265 | - case 'EVEN': |
|
266 | - case 'FACT': |
|
267 | - if ($this->getAttribute('TYPE')) { |
|
268 | - // Custom FACT/EVEN - with a TYPE |
|
269 | - return I18N::translate(Filter::escapeHtml($this->getAttribute('TYPE'))); |
|
270 | - } |
|
271 | - // no break - drop into next case |
|
272 | - default: |
|
273 | - return GedcomTag::getLabel($this->tag, $this->parent); |
|
265 | + case 'EVEN': |
|
266 | + case 'FACT': |
|
267 | + if ($this->getAttribute('TYPE')) { |
|
268 | + // Custom FACT/EVEN - with a TYPE |
|
269 | + return I18N::translate(Filter::escapeHtml($this->getAttribute('TYPE'))); |
|
270 | + } |
|
271 | + // no break - drop into next case |
|
272 | + default: |
|
273 | + return GedcomTag::getLabel($this->tag, $this->parent); |
|
274 | 274 | } |
275 | 275 | } |
276 | 276 |
@@ -34,85 +34,85 @@ discard block |
||
34 | 34 | */ |
35 | 35 | private static function getAlphabetForLocale($locale) { |
36 | 36 | switch ($locale) { |
37 | - case 'ar': |
|
38 | - return array( |
|
39 | - 'ا', 'ب', 'ت', 'ث', 'ج', 'ح', 'خ', 'د', 'ذ', 'ر', 'ز', 'س', 'ش', 'ص', 'ض', 'ط', 'ظ', 'ع', 'غ', 'ف', 'ق', 'ك', 'ل', 'م', 'ن', 'ه', 'و', 'ي', 'آ', 'ة', 'ى', 'ی', |
|
40 | - ); |
|
41 | - case 'cs': |
|
42 | - return array( |
|
43 | - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'CH', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', |
|
44 | - ); |
|
45 | - case 'da': |
|
46 | - case 'nb': |
|
47 | - case 'nn': |
|
48 | - return array( |
|
49 | - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Æ', 'Ø', 'Å', |
|
50 | - ); |
|
51 | - case 'el': |
|
52 | - return array( |
|
53 | - 'Α', 'Β', 'Γ', 'Δ', 'Ε', 'Ζ', 'Η', 'Θ', 'Ι', 'Κ', 'Λ', 'Μ', 'Ν', 'Ξ', 'Ο', 'Π', 'Ρ', 'Σ', 'Τ', 'Υ', 'Φ', 'Χ', 'Ψ', 'Ω', |
|
54 | - ); |
|
55 | - case 'es': |
|
56 | - return array( |
|
57 | - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'Ñ', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', |
|
58 | - ); |
|
59 | - case 'et': |
|
60 | - return array( |
|
61 | - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Š', 'Z', 'Ž', 'T', 'U', 'V', 'W', 'Õ', 'Ä', 'Ö', 'Ü', 'X', 'Y', |
|
62 | - ); |
|
63 | - case 'fi': |
|
64 | - case 'sv': |
|
65 | - return array( |
|
66 | - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Å', 'Ä', 'Ö', |
|
67 | - ); |
|
68 | - case 'he': |
|
69 | - return array( |
|
70 | - 'א', 'ב', 'ג', 'ד', 'ה', 'ו', 'ז', 'ח', 'ט', 'י', 'כ', 'ל', 'מ', 'נ', 'ס', 'ע', 'פ', 'צ', 'ק', 'ר', 'ש', 'ת', |
|
71 | - ); |
|
72 | - case 'hu': |
|
73 | - return array( |
|
74 | - 'A', 'B', 'C', 'CS', 'D', 'DZ', 'DZS', 'E', 'F', 'G', 'GY', 'H', 'I', 'J', 'K', 'L', 'LY', 'M', 'N', 'NY', 'O', 'Ö', 'P', 'Q', 'R', 'S', 'SZ', 'T', 'TY', 'U', 'Ü', 'V', 'W', 'X', 'Y', 'Z', 'ZS', |
|
75 | - ); |
|
76 | - case 'lt': |
|
77 | - return array( |
|
78 | - 'A', 'Ą', 'B', 'C', 'Č', 'D', 'E', 'Ę', 'Ė', 'F', 'G', 'H', 'I', 'Y', 'Į', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'R', 'S', 'Š', 'T', 'U', 'Ų', 'Ū', 'V', 'Z', 'Ž', |
|
79 | - ); |
|
80 | - case 'nl': |
|
81 | - return array( |
|
82 | - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'IJ', |
|
83 | - ); |
|
84 | - case 'pl': |
|
85 | - return array( |
|
86 | - 'A', 'B', 'C', 'Ć', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'Ł', 'M', 'N', 'O', 'Ó', 'P', 'Q', 'R', 'S', 'Ś', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Ź', 'Ż', |
|
87 | - ); |
|
88 | - case 'ro': |
|
89 | - return array( |
|
90 | - 'A', 'Ă', 'Â', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'Î', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Ş', 'T', 'Ţ', 'U', 'V', 'W', 'X', 'Y', 'Z', |
|
91 | - ); |
|
92 | - case 'ru': |
|
93 | - return array( |
|
94 | - 'А', 'Б', 'В', 'Г', 'Д', 'Е', 'Ё', 'Ж', 'З', 'И', 'Й', 'К', 'Л', 'М', 'Н', 'О', 'П', 'Р', 'С', 'Т', 'У', 'Ф', 'Х', 'Ц', 'Ч', 'Ш', 'Щ', 'Ъ', 'Ы', 'Ь', 'Э', 'Ю', 'Я', |
|
95 | - ); |
|
96 | - case 'sk': |
|
97 | - return array( |
|
98 | - 'A', 'Á', 'Ä', 'B', 'C', 'Č', 'D', 'Ď', 'E', 'É', 'F', 'G', 'H', 'I', 'Í', 'J', 'K', 'L', 'Ľ', 'Ĺ', 'M', 'N', 'Ň', 'O', 'Ó', 'Ô', 'P', 'Q', 'R', 'Ŕ', 'S', 'Š', 'T', 'Ť', 'U', 'Ú', 'V', 'W', 'X', 'Y', 'Ý', 'Z', 'Ž', |
|
99 | - ); |
|
100 | - case 'sl': |
|
101 | - return array( |
|
102 | - 'A', 'B', 'C', 'Č', 'Ć', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Š', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Ž', |
|
103 | - ); |
|
104 | - case 'sr': |
|
105 | - return array( |
|
106 | - 'A', 'B', 'C', 'Č', 'Ć', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Š', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Ž', |
|
107 | - ); |
|
108 | - case 'tr': |
|
109 | - return array( |
|
110 | - 'A', 'B', 'C', 'Ç', 'D', 'E', 'F', 'G', 'Ğ', 'H', 'I', 'İ', 'J', 'K', 'L', 'M', 'N', 'O', 'Ö', 'P', 'R', 'S', 'Ş', 'T', 'U', 'Ü', 'V', 'Y', 'Z', |
|
111 | - ); |
|
112 | - default: |
|
113 | - return array( |
|
114 | - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', |
|
115 | - ); |
|
37 | + case 'ar': |
|
38 | + return array( |
|
39 | + 'ا', 'ب', 'ت', 'ث', 'ج', 'ح', 'خ', 'د', 'ذ', 'ر', 'ز', 'س', 'ش', 'ص', 'ض', 'ط', 'ظ', 'ع', 'غ', 'ف', 'ق', 'ك', 'ل', 'م', 'ن', 'ه', 'و', 'ي', 'آ', 'ة', 'ى', 'ی', |
|
40 | + ); |
|
41 | + case 'cs': |
|
42 | + return array( |
|
43 | + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'CH', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', |
|
44 | + ); |
|
45 | + case 'da': |
|
46 | + case 'nb': |
|
47 | + case 'nn': |
|
48 | + return array( |
|
49 | + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Æ', 'Ø', 'Å', |
|
50 | + ); |
|
51 | + case 'el': |
|
52 | + return array( |
|
53 | + 'Α', 'Β', 'Γ', 'Δ', 'Ε', 'Ζ', 'Η', 'Θ', 'Ι', 'Κ', 'Λ', 'Μ', 'Ν', 'Ξ', 'Ο', 'Π', 'Ρ', 'Σ', 'Τ', 'Υ', 'Φ', 'Χ', 'Ψ', 'Ω', |
|
54 | + ); |
|
55 | + case 'es': |
|
56 | + return array( |
|
57 | + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'Ñ', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', |
|
58 | + ); |
|
59 | + case 'et': |
|
60 | + return array( |
|
61 | + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Š', 'Z', 'Ž', 'T', 'U', 'V', 'W', 'Õ', 'Ä', 'Ö', 'Ü', 'X', 'Y', |
|
62 | + ); |
|
63 | + case 'fi': |
|
64 | + case 'sv': |
|
65 | + return array( |
|
66 | + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Å', 'Ä', 'Ö', |
|
67 | + ); |
|
68 | + case 'he': |
|
69 | + return array( |
|
70 | + 'א', 'ב', 'ג', 'ד', 'ה', 'ו', 'ז', 'ח', 'ט', 'י', 'כ', 'ל', 'מ', 'נ', 'ס', 'ע', 'פ', 'צ', 'ק', 'ר', 'ש', 'ת', |
|
71 | + ); |
|
72 | + case 'hu': |
|
73 | + return array( |
|
74 | + 'A', 'B', 'C', 'CS', 'D', 'DZ', 'DZS', 'E', 'F', 'G', 'GY', 'H', 'I', 'J', 'K', 'L', 'LY', 'M', 'N', 'NY', 'O', 'Ö', 'P', 'Q', 'R', 'S', 'SZ', 'T', 'TY', 'U', 'Ü', 'V', 'W', 'X', 'Y', 'Z', 'ZS', |
|
75 | + ); |
|
76 | + case 'lt': |
|
77 | + return array( |
|
78 | + 'A', 'Ą', 'B', 'C', 'Č', 'D', 'E', 'Ę', 'Ė', 'F', 'G', 'H', 'I', 'Y', 'Į', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'R', 'S', 'Š', 'T', 'U', 'Ų', 'Ū', 'V', 'Z', 'Ž', |
|
79 | + ); |
|
80 | + case 'nl': |
|
81 | + return array( |
|
82 | + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'IJ', |
|
83 | + ); |
|
84 | + case 'pl': |
|
85 | + return array( |
|
86 | + 'A', 'B', 'C', 'Ć', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'Ł', 'M', 'N', 'O', 'Ó', 'P', 'Q', 'R', 'S', 'Ś', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Ź', 'Ż', |
|
87 | + ); |
|
88 | + case 'ro': |
|
89 | + return array( |
|
90 | + 'A', 'Ă', 'Â', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'Î', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Ş', 'T', 'Ţ', 'U', 'V', 'W', 'X', 'Y', 'Z', |
|
91 | + ); |
|
92 | + case 'ru': |
|
93 | + return array( |
|
94 | + 'А', 'Б', 'В', 'Г', 'Д', 'Е', 'Ё', 'Ж', 'З', 'И', 'Й', 'К', 'Л', 'М', 'Н', 'О', 'П', 'Р', 'С', 'Т', 'У', 'Ф', 'Х', 'Ц', 'Ч', 'Ш', 'Щ', 'Ъ', 'Ы', 'Ь', 'Э', 'Ю', 'Я', |
|
95 | + ); |
|
96 | + case 'sk': |
|
97 | + return array( |
|
98 | + 'A', 'Á', 'Ä', 'B', 'C', 'Č', 'D', 'Ď', 'E', 'É', 'F', 'G', 'H', 'I', 'Í', 'J', 'K', 'L', 'Ľ', 'Ĺ', 'M', 'N', 'Ň', 'O', 'Ó', 'Ô', 'P', 'Q', 'R', 'Ŕ', 'S', 'Š', 'T', 'Ť', 'U', 'Ú', 'V', 'W', 'X', 'Y', 'Ý', 'Z', 'Ž', |
|
99 | + ); |
|
100 | + case 'sl': |
|
101 | + return array( |
|
102 | + 'A', 'B', 'C', 'Č', 'Ć', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Š', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Ž', |
|
103 | + ); |
|
104 | + case 'sr': |
|
105 | + return array( |
|
106 | + 'A', 'B', 'C', 'Č', 'Ć', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Š', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Ž', |
|
107 | + ); |
|
108 | + case 'tr': |
|
109 | + return array( |
|
110 | + 'A', 'B', 'C', 'Ç', 'D', 'E', 'F', 'G', 'Ğ', 'H', 'I', 'İ', 'J', 'K', 'L', 'M', 'N', 'O', 'Ö', 'P', 'R', 'S', 'Ş', 'T', 'U', 'Ü', 'V', 'Y', 'Z', |
|
111 | + ); |
|
112 | + default: |
|
113 | + return array( |
|
114 | + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', |
|
115 | + ); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
@@ -126,44 +126,44 @@ discard block |
||
126 | 126 | public static function initialLetter($name) { |
127 | 127 | $name = I18N::strtoupper($name); |
128 | 128 | switch (WT_LOCALE) { |
129 | - case 'cs': |
|
130 | - if (substr($name, 0, 2) == 'CH') { |
|
131 | - return 'CH'; |
|
132 | - } |
|
133 | - break; |
|
134 | - case 'da': |
|
135 | - case 'nb': |
|
136 | - case 'nn': |
|
137 | - if (substr($name, 0, 2) == 'AA') { |
|
138 | - return 'Å'; |
|
139 | - } |
|
140 | - break; |
|
141 | - case 'hu': |
|
142 | - if (substr($name, 0, 2) == 'CS') { |
|
143 | - return 'CS'; |
|
144 | - } elseif (substr($name, 0, 3) == 'DZS') { |
|
145 | - return 'DZS'; |
|
146 | - } elseif (substr($name, 0, 2) == 'DZ') { |
|
147 | - return 'DZ'; |
|
148 | - } elseif (substr($name, 0, 2) == 'GY') { |
|
149 | - return 'GY'; |
|
150 | - } elseif (substr($name, 0, 2) == 'LY') { |
|
151 | - return 'LY'; |
|
152 | - } elseif (substr($name, 0, 2) == 'NY') { |
|
153 | - return 'NY'; |
|
154 | - } elseif (substr($name, 0, 2) == 'SZ') { |
|
155 | - return 'SZ'; |
|
156 | - } elseif (substr($name, 0, 2) == 'TY') { |
|
157 | - return 'TY'; |
|
158 | - } elseif (substr($name, 0, 2) == 'ZS') { |
|
159 | - return 'ZS'; |
|
160 | - } |
|
161 | - break; |
|
162 | - case 'nl': |
|
163 | - if (substr($name, 0, 2) == 'IJ') { |
|
164 | - return 'IJ'; |
|
165 | - } |
|
166 | - break; |
|
129 | + case 'cs': |
|
130 | + if (substr($name, 0, 2) == 'CH') { |
|
131 | + return 'CH'; |
|
132 | + } |
|
133 | + break; |
|
134 | + case 'da': |
|
135 | + case 'nb': |
|
136 | + case 'nn': |
|
137 | + if (substr($name, 0, 2) == 'AA') { |
|
138 | + return 'Å'; |
|
139 | + } |
|
140 | + break; |
|
141 | + case 'hu': |
|
142 | + if (substr($name, 0, 2) == 'CS') { |
|
143 | + return 'CS'; |
|
144 | + } elseif (substr($name, 0, 3) == 'DZS') { |
|
145 | + return 'DZS'; |
|
146 | + } elseif (substr($name, 0, 2) == 'DZ') { |
|
147 | + return 'DZ'; |
|
148 | + } elseif (substr($name, 0, 2) == 'GY') { |
|
149 | + return 'GY'; |
|
150 | + } elseif (substr($name, 0, 2) == 'LY') { |
|
151 | + return 'LY'; |
|
152 | + } elseif (substr($name, 0, 2) == 'NY') { |
|
153 | + return 'NY'; |
|
154 | + } elseif (substr($name, 0, 2) == 'SZ') { |
|
155 | + return 'SZ'; |
|
156 | + } elseif (substr($name, 0, 2) == 'TY') { |
|
157 | + return 'TY'; |
|
158 | + } elseif (substr($name, 0, 2) == 'ZS') { |
|
159 | + return 'ZS'; |
|
160 | + } |
|
161 | + break; |
|
162 | + case 'nl': |
|
163 | + if (substr($name, 0, 2) == 'IJ') { |
|
164 | + return 'IJ'; |
|
165 | + } |
|
166 | + break; |
|
167 | 167 | } |
168 | 168 | // No special rules - just take the first character |
169 | 169 | return mb_substr($name, 0, 1); |
@@ -191,37 +191,37 @@ discard block |
||
191 | 191 | */ |
192 | 192 | private static function getInitialSql($field, $letter) { |
193 | 193 | switch (WT_LOCALE) { |
194 | - case 'cs': |
|
195 | - switch ($letter) { |
|
196 | - case 'C': return $field . " LIKE 'C%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'CH%' COLLATE " . I18N::collation(); |
|
197 | - } |
|
194 | + case 'cs': |
|
195 | + switch ($letter) { |
|
196 | + case 'C': return $field . " LIKE 'C%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'CH%' COLLATE " . I18N::collation(); |
|
197 | + } |
|
198 | 198 | break; |
199 | - case 'da': |
|
200 | - case 'nb': |
|
201 | - case 'nn': |
|
202 | - switch ($letter) { |
|
203 | - // AA gets listed under Å |
|
204 | - case 'A': return $field . " LIKE 'A%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'AA%' COLLATE " . I18N::collation(); |
|
205 | - case 'Å': return "(" . $field . " LIKE 'Å%' COLLATE " . I18N::collation() . " OR " . $field . " LIKE 'AA%' COLLATE " . I18N::collation() . ")"; |
|
206 | - } |
|
199 | + case 'da': |
|
200 | + case 'nb': |
|
201 | + case 'nn': |
|
202 | + switch ($letter) { |
|
203 | + // AA gets listed under Å |
|
204 | + case 'A': return $field . " LIKE 'A%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'AA%' COLLATE " . I18N::collation(); |
|
205 | + case 'Å': return "(" . $field . " LIKE 'Å%' COLLATE " . I18N::collation() . " OR " . $field . " LIKE 'AA%' COLLATE " . I18N::collation() . ")"; |
|
206 | + } |
|
207 | 207 | break; |
208 | - case 'hu': |
|
209 | - switch ($letter) { |
|
210 | - case 'C': return $field . " LIKE 'C%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'CS%' COLLATE " . I18N::collation(); |
|
211 | - case 'D': return $field . " LIKE 'D%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'DZ%' COLLATE " . I18N::collation(); |
|
212 | - case 'DZ': return $field . " LIKE 'DZ%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'DZS%' COLLATE " . I18N::collation(); |
|
213 | - case 'G': return $field . " LIKE 'G%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'GY%' COLLATE " . I18N::collation(); |
|
214 | - case 'L': return $field . " LIKE 'L%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'LY%' COLLATE " . I18N::collation(); |
|
215 | - case 'N': return $field . " LIKE 'N%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'NY%' COLLATE " . I18N::collation(); |
|
216 | - case 'S': return $field . " LIKE 'S%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'SZ%' COLLATE " . I18N::collation(); |
|
217 | - case 'T': return $field . " LIKE 'T%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'TY%' COLLATE " . I18N::collation(); |
|
218 | - case 'Z': return $field . " LIKE 'Z%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'ZS%' COLLATE " . I18N::collation(); |
|
219 | - } |
|
208 | + case 'hu': |
|
209 | + switch ($letter) { |
|
210 | + case 'C': return $field . " LIKE 'C%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'CS%' COLLATE " . I18N::collation(); |
|
211 | + case 'D': return $field . " LIKE 'D%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'DZ%' COLLATE " . I18N::collation(); |
|
212 | + case 'DZ': return $field . " LIKE 'DZ%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'DZS%' COLLATE " . I18N::collation(); |
|
213 | + case 'G': return $field . " LIKE 'G%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'GY%' COLLATE " . I18N::collation(); |
|
214 | + case 'L': return $field . " LIKE 'L%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'LY%' COLLATE " . I18N::collation(); |
|
215 | + case 'N': return $field . " LIKE 'N%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'NY%' COLLATE " . I18N::collation(); |
|
216 | + case 'S': return $field . " LIKE 'S%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'SZ%' COLLATE " . I18N::collation(); |
|
217 | + case 'T': return $field . " LIKE 'T%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'TY%' COLLATE " . I18N::collation(); |
|
218 | + case 'Z': return $field . " LIKE 'Z%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'ZS%' COLLATE " . I18N::collation(); |
|
219 | + } |
|
220 | 220 | break; |
221 | - case 'nl': |
|
222 | - switch ($letter) { |
|
223 | - case 'I': return $field . " LIKE 'I%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'IJ%' COLLATE " . I18N::collation(); |
|
224 | - } |
|
221 | + case 'nl': |
|
222 | + switch ($letter) { |
|
223 | + case 'I': return $field . " LIKE 'I%' COLLATE " . I18N::collation() . " AND " . $field . " NOT LIKE 'IJ%' COLLATE " . I18N::collation(); |
|
224 | + } |
|
225 | 225 | break; |
226 | 226 | } |
227 | 227 |
@@ -104,17 +104,17 @@ discard block |
||
104 | 104 | |
105 | 105 | // Include / exclude subfolders (but always include external) |
106 | 106 | switch ($subfolders) { |
107 | - case 'include': |
|
108 | - $sql .= " AND (m_filename LIKE CONCAT(?, '%') $sql_external)"; |
|
109 | - $args[] = Filter::escapeLike($folder); |
|
110 | - break; |
|
111 | - case 'exclude': |
|
112 | - $sql .= " AND (m_filename LIKE CONCAT(?, '%') AND m_filename NOT LIKE CONCAT(?, '%/%') $sql_external)"; |
|
113 | - $args[] = Filter::escapeLike($folder); |
|
114 | - $args[] = Filter::escapeLike($folder); |
|
115 | - break; |
|
116 | - default: |
|
117 | - throw new \Exception('Bad argument (subfolders=' . $subfolders . ') in QueryMedia::mediaList()'); |
|
107 | + case 'include': |
|
108 | + $sql .= " AND (m_filename LIKE CONCAT(?, '%') $sql_external)"; |
|
109 | + $args[] = Filter::escapeLike($folder); |
|
110 | + break; |
|
111 | + case 'exclude': |
|
112 | + $sql .= " AND (m_filename LIKE CONCAT(?, '%') AND m_filename NOT LIKE CONCAT(?, '%/%') $sql_external)"; |
|
113 | + $args[] = Filter::escapeLike($folder); |
|
114 | + $args[] = Filter::escapeLike($folder); |
|
115 | + break; |
|
116 | + default: |
|
117 | + throw new \Exception('Bad argument (subfolders=' . $subfolders . ') in QueryMedia::mediaList()'); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | // Apply search terms |
@@ -130,14 +130,14 @@ discard block |
||
130 | 130 | } |
131 | 131 | |
132 | 132 | switch ($sort) { |
133 | - case 'file': |
|
134 | - $sql .= " ORDER BY m_filename"; |
|
135 | - break; |
|
136 | - case 'title': |
|
137 | - $sql .= " ORDER BY m_titl"; |
|
138 | - break; |
|
139 | - default: |
|
140 | - throw new \Exception('Bad argument (sort=' . $sort . ') in QueryMedia::mediaList()'); |
|
133 | + case 'file': |
|
134 | + $sql .= " ORDER BY m_filename"; |
|
135 | + break; |
|
136 | + case 'title': |
|
137 | + $sql .= " ORDER BY m_titl"; |
|
138 | + break; |
|
139 | + default: |
|
140 | + throw new \Exception('Bad argument (sort=' . $sort . ') in QueryMedia::mediaList()'); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | $rows = Database::prepare($sql)->execute($args)->fetchAll(); |