diff options
| author | fisharebest <fisharebest@gmail.com> | 2010-10-30 19:40:24 +0000 |
|---|---|---|
| committer | fisharebest <fisharebest@gmail.com> | 2010-10-30 19:40:24 +0000 |
| commit | 1b31889382cf05c88218446919a18b377b17a96b (patch) | |
| tree | 28a9ef7f8c82824f8481c3a6d07cc8162449f8fc /includes | |
| parent | fe8b71f311753b6bb7be62b697035e420fb5f056 (diff) | |
| download | webtrees-1b31889382cf05c88218446919a18b377b17a96b.tar.gz webtrees-1b31889382cf05c88218446919a18b377b17a96b.tar.bz2 webtrees-1b31889382cf05c88218446919a18b377b17a96b.zip | |
Diffstat (limited to 'includes')
44 files changed, 702 insertions, 702 deletions
diff --git a/includes/authentication.php b/includes/authentication.php index 43d98bf27d..fbf06000ee 100644 --- a/includes/authentication.php +++ b/includes/authentication.php @@ -86,7 +86,7 @@ function authenticateUser($user_name, $password, $basic=false) { */ function basicHTTPAuthenticateUser() { $user_id = getUserId(); - if (empty($user_id)){ //not logged in. + if (empty($user_id)) { //not logged in. if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) || (! authenticateUser($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'], true))) { header('WWW-Authenticate: Basic realm="' . i18n::translate('webtrees Authentication System') . '"'); @@ -380,7 +380,7 @@ function addMessage($message) { $email1 .= $fromFullName."\r\n\r\n".$message["body"]; } if (!isset($message["no_from"])) { - if (stristr($from, $WEBTREES_EMAIL)){ + if (stristr($from, $WEBTREES_EMAIL)) { $from = getUserEmail(get_gedcom_setting(WT_GED_ID, 'WEBMASTER_USER_ID')); } if (!$user_id_from) { diff --git a/includes/classes/class_date.php b/includes/classes/class_date.php index 6119b8d3e7..0db8a0c7f8 100644 --- a/includes/classes/class_date.php +++ b/includes/classes/class_date.php @@ -1013,12 +1013,12 @@ class HebrewDate extends JewishDate { $thousands = $num / 1000; //get # thousands $sb = ""; //append thousands to String - if($num % 1000 == 0) { // in year is 5000, 4000 etc + if ($num % 1000 == 0) { // in year is 5000, 4000 etc $sb .= $jOnes[$thousands]; $sb .= self::GERSH; $sb .= " "; $sb .= self::ALAFIM; //add # of thousands plus word thousand (overide alafim boolean) - } else if($DISPLAY_JEWISH_THOUSANDS) { // if alafim boolean display thousands + } else if ($DISPLAY_JEWISH_THOUSANDS) { // if alafim boolean display thousands $sb .= $jOnes[$thousands]; $sb .= self::GERSH; //append thousands quote $sb .= " "; @@ -1027,14 +1027,14 @@ class HebrewDate extends JewishDate { $hundreds = $num / 100; // # of hundreds $sb .= $jHundreds[$hundreds]; //add hundreds to String $num = $num % 100; //remove 100s - if($num == 15) { //special case 15 + if ($num == 15) { //special case 15 $sb .= $tavTaz[0]; - } else if($num == 16) { //special case 16 + } else if ($num == 16) { //special case 16 $sb .= $tavTaz[1]; } else { $tens = $num / 10; - if($num % 10 == 0) { // if evenly divisable by 10 - if($singleDigitYear == false) { + if ($num % 10 == 0) { // if evenly divisable by 10 + if ($singleDigitYear == false) { $sb .= $jTenEnds[$tens]; // use end letters so that for example 5750 will end with an end nun } else { $sb .= $jTens[$tens]; // use standard letters so that for example 5050 will end with a regular nun diff --git a/includes/classes/class_event.php b/includes/classes/class_event.php index 4b90f74437..70c99b754b 100644 --- a/includes/classes/class_event.php +++ b/includes/classes/class_event.php @@ -271,7 +271,7 @@ class Event { if (!$this->canShow()) return ""; $data = ""; - if ($this->gedcomRecord != "1 DEAT"){ + if ($this->gedcomRecord != "1 DEAT") { $data .= "<span class=\"details_label\">".$this->getLabel($ABBREVIATE_CHART_LABELS)."</span> "; } $emptyfacts = array("BIRT","CHR","DEAT","BURI","CREM","ADOP","BAPM","BARM","BASM","BLES","CHRA","CONF","FCOM","ORDN","NATU","EMIG","IMMI","CENS","PROB","WILL","GRAD","RETI","BAPL","CONL","ENDL","SLGC","EVEN","MARR","SLGS","MARL","ANUL","CENS","DIV","DIVF","ENGA","MARB","MARC","MARS","OBJE","CHAN","_SEPR","RESI", "DATA", "MAP"); diff --git a/includes/classes/class_family.php b/includes/classes/class_family.php index 0354a4d090..8023d2d5a4 100644 --- a/includes/classes/class_family.php +++ b/includes/classes/class_family.php @@ -185,12 +185,12 @@ class Family extends GedcomRecord { if ($this->children_loaded) return; $this->childrenIds = array(); $this->numChildren = preg_match_all('/1\s*CHIL\s*@(.*)@/', $this->gedrec, $smatch, PREG_SET_ORDER); - for($i=0; $i<$this->numChildren; $i++) { + for ($i=0; $i<$this->numChildren; $i++) { //-- get the childs ids $chil = trim($smatch[$i][1]); $this->childrenIds[] = $chil; } - foreach($this->childrenIds as $t=>$chil) { + foreach ($this->childrenIds as $t=>$chil) { $child=Person::getInstance($chil); if (!is_null($child)) $this->children[] = $child; } @@ -249,7 +249,7 @@ class Family extends GedcomRecord { function hasChild(&$person) { if (is_null($person)) return false; $this->loadChildren(); - foreach($this->children as $key=>$child) { + foreach ($this->children as $key=>$child) { if ($person->equals($child)) return true; } return false; @@ -311,7 +311,7 @@ class Family extends GedcomRecord { * get the marriage year * @return string */ - function getMarriageYear($est = true, $cal = ''){ + function getMarriageYear($est = true, $cal = '') { // TODO - change the design to use julian days, not gregorian years. $mdate = $this->getMarriageDate(); $mdate = $mdate->MinDate(); @@ -323,7 +323,7 @@ class Family extends GedcomRecord { * get the marriage month * @return string */ - function getMarriageMonth($est = true, $cal = ''){ + function getMarriageMonth($est = true, $cal = '') { // TODO - change the design to use julian days, not gregorian years. $mdate = $this->getMarriageDate(); $mdate=$mdate->MinDate(); diff --git a/includes/classes/class_gedcomrecord.php b/includes/classes/class_gedcomrecord.php index df529b8d9f..0e5ed61e57 100644 --- a/includes/classes/class_gedcomrecord.php +++ b/includes/classes/class_gedcomrecord.php @@ -809,7 +809,7 @@ class GedcomRecord { $factrec = ''; // -- complete fact record $line = ''; // -- temporary line buffer $linenum=1; - for($i=1; $i<=$lct; $i++) { + for ($i=1; $i<=$lct; $i++) { if ($i<$lct) { $line = $indilines[$i]; } else { @@ -819,7 +819,7 @@ class GedcomRecord { $line=' '; } if ($i==$lct||$line{0}==1) { - if ($i>1){ + if ($i>1) { $event = new Event($factrec, $linenum); $fact = $event->getTag(); if ($nfacts==NULL || !in_array($fact, $nfacts)) { @@ -847,9 +847,9 @@ class GedcomRecord { $diff->parseFacts(); //-- update old facts - foreach($this->facts as $key=>$event) { + foreach ($this->facts as $key=>$event) { $found = false; - foreach($diff->facts as $indexval => $newevent) { + foreach ($diff->facts as $indexval => $newevent) { $newfact = $newevent->getGedcomRecord(); $newfact=preg_replace("/\\\/", '/', $newfact); if (trim($newfact)==trim($event->getGedcomRecord())) { @@ -862,9 +862,9 @@ class GedcomRecord { } } //-- look for new facts - foreach($diff->facts as $key=>$newevent) { + foreach ($diff->facts as $key=>$newevent) { $found = false; - foreach($this->facts as $indexval => $event) { + foreach ($this->facts as $indexval => $event) { $newfact = $newevent->getGedcomRecord(); $newfact=preg_replace("/\\\/", '/', $newfact); if (trim($newfact)==trim($event->getGedcomRecord())) { diff --git a/includes/classes/class_localclient.php b/includes/classes/class_localclient.php index 958d3540b9..6aaf812c33 100644 --- a/includes/classes/class_localclient.php +++ b/includes/classes/class_localclient.php @@ -107,12 +107,12 @@ class LocalClient extends ServiceClient { $search_results = search_indis(array($query), array($this->gedfile), 'AND', true); // loop thru the returned result of the method call - foreach($search_results as $gid=>$indi) + foreach ($search_results as $gid=>$indi) { // privatize the gedcoms returned $gedrec = privatize_gedcom($indi["gedcom"]); // set the fields that exist and return all the results that are not private - if(preg_match("~".$query."~i",$gedrec)>0) + if (preg_match("~".$query."~i",$gedrec)>0) { $person = new SOAP_Value('person', 'person', ""); $person->PID = $gid; diff --git a/includes/classes/class_media.php b/includes/classes/class_media.php index eafc23f754..a0c578bedc 100644 --- a/includes/classes/class_media.php +++ b/includes/classes/class_media.php @@ -74,7 +74,7 @@ class Media extends GedcomRecord { * get the media note * @return string */ - function getNote(){ + function getNote() { if (is_null($this->note)) { $this->note=get_gedcom_value('NOTE', 1, $this->getGedcomRecord()); } @@ -114,7 +114,7 @@ class Media extends GedcomRecord { if ($this->serverfilename) return $this->serverfilename; $localfilename = $this->getLocalFilename(); if (!empty($localfilename)) { - if (file_exists($localfilename)){ + if (file_exists($localfilename)) { // found image in unprotected directory $this->fileexists = 2; $this->serverfilename = $localfilename; @@ -122,7 +122,7 @@ class Media extends GedcomRecord { } if ($USE_MEDIA_FIREWALL) { $protectedfilename = get_media_firewall_path($localfilename); - if (file_exists($protectedfilename)){ + if (file_exists($protectedfilename)) { // found image in protected directory $this->fileexists = 3; $this->serverfilename = $protectedfilename; diff --git a/includes/classes/class_menu.php b/includes/classes/class_menu.php index 94dc04d39a..92f4f82d7e 100644 --- a/includes/classes/class_menu.php +++ b/includes/classes/class_menu.php @@ -300,7 +300,7 @@ class Menu { } } $output .= "\" onmouseover=\"show_submenu('{$this->parentmenu}'); show_submenu('{$submenuid}');\" onmouseout=\"timeout_submenu('menu{$id}_subs');\">\n"; - foreach($this->submenus as $submenu) { + foreach ($this->submenus as $submenu) { $submenu->parentmenu = $submenuid; $output .= $submenu->getMenu(); } diff --git a/includes/classes/class_menubar.php b/includes/classes/class_menubar.php index 4bbe432bc8..58d488e856 100644 --- a/includes/classes/class_menubar.php +++ b/includes/classes/class_menubar.php @@ -120,7 +120,7 @@ class MenuBar { $submenu->addClass("submenuitem$ff", "submenuitem_hover$ff", "", "icon_small_indis"); $menu->addSubmenu($submenu); } - if (WT_USER_GEDCOM_ADMIN){ + if (WT_USER_GEDCOM_ADMIN) { $menu->addSeparator(); //-- admin submenu $submenu = new Menu(i18n::translate('Administration'), "admin.php"); @@ -211,7 +211,7 @@ class MenuBar { asort($menuList); // Produce the submenus in localized name order - foreach($menuList as $menuType => $menuName) { + foreach ($menuList as $menuType => $menuName) { switch ($menuType) { case "pedigree": //-- pedigree @@ -300,7 +300,7 @@ class MenuBar { asort($menuList); // Produce the submenus in localized name order - foreach($menuList as $menuType => $menuName) { + foreach ($menuList as $menuType => $menuName) { switch ($menuType) { case "parentTimeLine": // charts / parents_timeline @@ -511,7 +511,7 @@ class MenuBar { // Produce the submenus in localized name order - foreach($menuList as $menuType => $menuName) { + foreach ($menuList as $menuType => $menuName) { switch ($menuType) { case "individual": //-- indi list sub menu @@ -771,7 +771,7 @@ class MenuBar { //-- add contact links to help menu $menu->addSeparator(); $menuitems = contact_menus(); - foreach($menuitems as $menuitem) { + foreach ($menuitems as $menuitem) { $submenu = new Menu($menuitem["label"], $menuitem["link"]); $submenu->addIcon('mypage'); $submenu->addClass("submenuitem$ff", "submenuitem_hover$ff", "", "icon_small_contact"); diff --git a/includes/classes/class_person.php b/includes/classes/class_person.php index 455a629edd..1bf8f98686 100644 --- a/includes/classes/class_person.php +++ b/includes/classes/class_person.php @@ -196,7 +196,7 @@ class Person extends GedcomRecord { * get the birth year * @return string the year of birth */ - function getBirthYear(){ + function getBirthYear() { return $this->getBirthDate()->MinDate()->Format('%Y'); } @@ -925,12 +925,12 @@ class Person extends GedcomRecord { } } } - if($otherfacts){ + if ($otherfacts) { if (!$hasdiv && !is_null($spouse)) $this->add_spouse_facts($spouse, $family->getGedcomRecord()); $this->add_children_facts($family); } } - if($otherfacts){ + if ($otherfacts) { $this->add_parents_facts($this); $this->add_historical_facts(); $this->add_asso_facts(); @@ -1132,13 +1132,13 @@ class Person extends GedcomRecord { if ($option=='_NEPH') { $rela='sibchi'; $parent_sex = Person::getInstance($except)->getSex(); - if ($sex=='F') { $rela='sibdau'; - if ($parent_sex=='F'){ $rela='sisdau'; $op='_NIE1';} - if ($parent_sex=='M'){ $rela='brodau'; $op='_NIE2';} + if ($sex=='F') { $rela='sibdau'; + if ($parent_sex=='F') { $rela='sisdau'; $op='_NIE1';} + if ($parent_sex=='M') { $rela='brodau'; $op='_NIE2';} } - if ($sex=='M') { $rela='sibson'; - if ($parent_sex=='F'){ $rela='sisson'; $op='_NEP1';} - if ($parent_sex=='M'){ $rela='broson'; $op='_NEP2';} + if ($sex=='M') { $rela='sibson'; + if ($parent_sex=='F') { $rela='sisson'; $op='_NEP1';} + if ($parent_sex=='M') { $rela='broson'; $op='_NEP2';} } } // add child birth @@ -1404,7 +1404,7 @@ class Person extends GedcomRecord { break; } } - if (!$found){ + if (!$found) { $event = new Event($factrec); $event->setParentObject($this); $this->indifacts[] = $event; diff --git a/includes/classes/class_reportbase.php b/includes/classes/class_reportbase.php index 5232e9e4b2..b14b0d9cd8 100644 --- a/includes/classes/class_reportbase.php +++ b/includes/classes/class_reportbase.php @@ -49,7 +49,7 @@ $ascii_langs = array("en", "da", "nl", "fr", "he", "hu", "de", "nn", "es"); //-- setup special characters array to force embedded fonts $SpecialOrds = $RTLOrd; -for($i=195; $i<215; $i++) $SpecialOrds[] = $i; +for ($i=195; $i<215; $i++) $SpecialOrds[] = $i; if (!isset($embed_fonts)) { if (in_array(WT_LOCALE, $ascii_langs)) { @@ -493,7 +493,7 @@ class Element { function addText($t) { global $embed_fonts, $SpecialOrds, $wt_report, $reportTitle, $reportDescription; - foreach($SpecialOrds as $ord) { + foreach ($SpecialOrds as $ord) { if (strpos($t, chr($ord))!==false) { $embed_fonts = true; } @@ -569,7 +569,7 @@ class Html extends Element { function getStart() { $str = "<".$this->tag." "; - foreach($this->attrs as $key=>$value) { + foreach ($this->attrs as $key=>$value) { $str .= $key."=\"".$value."\" "; } $str .= ">"; @@ -1010,7 +1010,7 @@ class Footnote extends Element { function addText($t) { global $embed_fonts, $SpecialOrds; - foreach($SpecialOrds as $ord) { + foreach ($SpecialOrds as $ord) { if (strpos($t, chr($ord))!==false) { $embed_fonts = true; } @@ -1428,7 +1428,7 @@ function startElement($parser, $name, $attrs) { $newattrs = array(); $match = array(); - foreach($attrs as $key=>$value) { + foreach ($attrs as $key=>$value) { if (preg_match("/^\\$(\w+)$/", $value, $match)) { if ((isset($vars[$match[1]]["id"]))&&(!isset($vars[$match[1]]["gedcom"]))) { $value = $vars[$match[1]]["id"]; @@ -1890,7 +1890,7 @@ function GedcomSHandler($attrs) { if (empty($newgedrec)) { $tgedrec = $gedrec; $newgedrec = ""; - foreach($tags as $tag) { + foreach ($tags as $tag) { if (preg_match("/\\$(.+)/", $tag, $match)) { if (isset($vars[$match[1]]["gedcom"])) { $newgedrec = $vars[$match[1]]["gedcom"]; @@ -2176,9 +2176,9 @@ function GetPersonNameSHandler($attrs) { $name = preg_replace("/\(.*\) ?/", "", $name); //removes () and text inbetween - what about ", [ and { etc? $words = explode(" ", $name); $name = $words[count($words)-1]; - for($i=count($words)-2; $i>=0; $i--) { + for ($i=count($words)-2; $i>=0; $i--) { $len = utf8_strlen($name); - for($j=count($words)-3; $j>=0; $j--) { + for ($j=count($words)-3; $j>=0; $j--) { $len += utf8_strlen($words[$j]); } if ($len>$attrs["truncate"]) { @@ -2361,12 +2361,12 @@ function RepeatTagEHandler() { // @deprecated //$line = xml_get_current_line_number($parser)-1; $lineoffset = 0; - foreach($repeatsStack as $rep) { + foreach ($repeatsStack as $rep) { $lineoffset += $rep[1]; } //-- read the xml from the file $lines = file($report); - while(strpos($lines[$lineoffset + $repeatBytes], "<RepeatTag")===false) { + while (strpos($lines[$lineoffset + $repeatBytes], "<RepeatTag")===false) { $lineoffset--; } $lineoffset++; @@ -2374,7 +2374,7 @@ function RepeatTagEHandler() { $line_nr = $lineoffset + $repeatBytes; // RepeatTag Level counter $count = 1; - while(0 < $count) { + while (0 < $count) { if (strstr($lines[$line_nr], "<RepeatTag")!==false) { $count++; } elseif (strstr($lines[$line_nr], "</RepeatTag")!==false) { @@ -2391,11 +2391,11 @@ function RepeatTagEHandler() { // Save original values array_push($parserStack, $parser); $oldgedrec = $gedrec; - // PHP 5.2.3 has a bug with foreach(), so don't use that here, while 5.2.3 is on the market - // while() has the fastest execution speed + // PHP 5.2.3 has a bug with foreach (), so don't use that here, while 5.2.3 is on the market + // while () has the fastest execution speed $count = count($repeats); $i = 0; - while($i < $count) { + while ($i < $count) { $gedrec = $repeats[$i]; //-- start the sax parser $repeat_parser = xml_parser_create(); @@ -2544,7 +2544,7 @@ function FactsSHandler($attrs) { } sort_facts($facts); $repeats = array(); - foreach($facts as $event) { + foreach ($facts as $event) { if (strpos($tag.",", $event->getTag())===false) { $repeats[]=$event->getGedComRecord(); } @@ -2599,20 +2599,20 @@ function FactsEHandler() { $line = xml_get_current_line_number($parser)-1; $lineoffset = 0; - foreach($repeatsStack as $rep) { + foreach ($repeatsStack as $rep) { $lineoffset += $rep[1]; } //-- read the xml from the file $lines = file($report); - while(($lineoffset + $repeatBytes > 0) and (strpos($lines[$lineoffset + $repeatBytes], "<Facts ")) === false) { + while (($lineoffset + $repeatBytes > 0) and (strpos($lines[$lineoffset + $repeatBytes], "<Facts ")) === false) { $lineoffset--; } $lineoffset++; $reportxml = "<tempdoc>\n"; $i = $line + $lineoffset; $line_nr = $repeatBytes + $lineoffset; - while($line_nr < $i) { + while ($line_nr < $i) { $reportxml .= $lines[$line_nr]; $line_nr++; } @@ -2625,7 +2625,7 @@ function FactsEHandler() { $count = count($repeats); $i = 0; $match = array(); - while($i < $count) { + while ($i < $count) { $gedrec = $repeats[$i]; $fact = ""; $desc = ""; @@ -2703,7 +2703,7 @@ function SetVarSHandler($attrs) { } $count = preg_match_all("/\\$(\w+)/", $value, $match, PREG_SET_ORDER); $i=0; - while($i<$count) { + while ($i<$count) { $t = $vars[$match[$i][1]]["id"]; $value = preg_replace("/\\$".$match[$i][1]."/", $t, $value, 1); $i++; @@ -2760,7 +2760,7 @@ function ifSHandler($attrs) { $match = array(); $count = preg_match_all("/@([\w:\.]+)/", $condition, $match, PREG_SET_ORDER); $i = 0; - while( $i < $count ) { + while ( $i < $count ) { $id = $match[$i][1]; $value="\"\""; if ($id=="ID") { @@ -3196,19 +3196,19 @@ function ListSHandler($attrs) { $sql_order_by[]="{$attr}.d_julianday1"; } unset($attrs[$attr]); // This filter has been fully processed - } elseif (($listname=="individual") && (preg_match('/^NAME CONTAINS (.*)$/', $value, $match))){ + } elseif (($listname=="individual") && (preg_match('/^NAME CONTAINS (.*)$/', $value, $match))) { // Do nothing, unless you have to - if (($match[1] != "") or ($sortby=="NAME")){ + if (($match[1] != "") or ($sortby=="NAME")) { $sql_join[]="JOIN `##name` AS {$attr} ON (n_file={$sql_col_prefix}file AND n_id={$sql_col_prefix}id)"; // Search the DB only if there is any name supplied - if ($match[1] != ""){ + if ($match[1] != "") { $names = explode(" ", $match[1]); - foreach ($names as $name){ + foreach ($names as $name) { $sql_where[]="{$attr}.n_full LIKE ".WT_DB::quote(utf8_strtoupper("%{$name}%")); } } // Let the DB do the name sorting even when no name was entered - if ($sortby=="NAME"){ + if ($sortby=="NAME") { $sortby=""; $sql_order_by[]="{$attr}.n_sort"; } @@ -3236,7 +3236,7 @@ function ListSHandler($attrs) { * Place any other filter before these filters because they will pick up any filters that has not been processed * Also, do not unset() these two filters. These are just the first primary filters to reduce the returned list from the DB */ - elseif (($listname=="individual") and (preg_match('/^(\w*):*(\w*) CONTAINS (.*)$/', $value, $match))){ + elseif (($listname=="individual") and (preg_match('/^(\w*):*(\w*) CONTAINS (.*)$/', $value, $match))) { $query = ""; // Level 1 tag if ($match[1] != "") $query .= "%1 {$match[1]}%"; @@ -3246,7 +3246,7 @@ function ListSHandler($attrs) { if ($match[3] != "") $query .= "%{$match[3]}%"; $sql_where[] = "i_gedcom LIKE ".WT_DB::quote(utf8_strtoupper($query)); unset($query); - } elseif (($listname=="family") and (preg_match('/^(\w*):*(\w*) CONTAINS (.*)$/', $value, $match))){ + } elseif (($listname=="family") and (preg_match('/^(\w*):*(\w*) CONTAINS (.*)$/', $value, $match))) { $query = ""; // Level 1 tag if ($match[1] != "") $query .= "%1 {$match[1]}%"; @@ -3276,7 +3276,7 @@ function ListSHandler($attrs) { $filters = array(); $filters2 = array(); if ((isset($attrs["filter1"])) and (count($list) > 0)) { - foreach($attrs as $key=>$value) { + foreach ($attrs as $key=>$value) { if (preg_match("/filter(\d)/", $key)) { $condition = $value; if (preg_match("/@(\w+)/", $condition, $match)) { @@ -3311,7 +3311,7 @@ function ListSHandler($attrs) { //-- only limit to a level number if we are specifically looking at a level if (count($tags)>1) { $level = 1; - foreach($tags as $t) { + foreach ($tags as $t) { if (!empty($searchstr)) { $searchstr.="[^\n]*(\n[2-9][^\n]*)*\n"; } @@ -3361,11 +3361,11 @@ function ListSHandler($attrs) { } if ($filters2) { $mylist = array(); - foreach($list as $indi) { + foreach ($list as $indi) { $key=$indi->getXref(); $grec=$indi->getGedcomRecord(); $keep = true; - foreach($filters2 as $filter) { + foreach ($filters2 as $filter) { if ($keep) { $tag = $filter["tag"]; $expr = $filter["expr"]; @@ -3476,12 +3476,12 @@ function ListEHandler() { // @deprecated //$line = xml_get_current_line_number($parser)-1; $lineoffset = 0; - foreach($repeatsStack as $rep) { + foreach ($repeatsStack as $rep) { $lineoffset += $rep[1]; } //-- read the xml from the file $lines = file($report); - while((strpos($lines[$lineoffset + $repeatBytes], "<List")===false) && (($lineoffset + $repeatBytes) > 0)) { + while ((strpos($lines[$lineoffset + $repeatBytes], "<List")===false) && (($lineoffset + $repeatBytes) > 0)) { $lineoffset--; } $lineoffset++; @@ -3489,7 +3489,7 @@ function ListEHandler() { $line_nr = $lineoffset + $repeatBytes; // List Level counter $count = 1; - while(0 < $count) { + while (0 < $count) { if (strpos($lines[$line_nr], "<List")!==false) { $count++; } elseif (strpos($lines[$line_nr], "</List")!==false) { @@ -3612,7 +3612,7 @@ function RelativesSHandler($attrs) { switch ($group) { case "child-family": $famids = $person->getChildFamilies(); - foreach($famids as $family) { + foreach ($famids as $family) { $husband = $family->getHusband(); $wife = $family->getWife(); if (!empty($husband)) { @@ -3622,14 +3622,14 @@ function RelativesSHandler($attrs) { $list[$wife->getXref()] = $wife; } $children = $family->getChildren(); - foreach($children as $child) { + foreach ($children as $child) { if (!empty($child)) $list[$child->getXref()] = $child; } } break; case "spouse-family": $famids = $person->getSpouseFamilies(); - foreach($famids as $family) { + foreach ($famids as $family) { $husband = $family->getHusband(); $wife = $family->getWife(); if (!empty($husband)) { @@ -3639,7 +3639,7 @@ function RelativesSHandler($attrs) { $list[$wife->getXref()] = $wife; } $children = $family->getChildren(); - foreach($children as $child) { + foreach ($children as $child) { if (!empty($child)) $list[$child->getXref()] = $child; } } @@ -3717,12 +3717,12 @@ function RelativesEHandler() { // @deprecated //$line = xml_get_current_line_number($parser)-1; $lineoffset = 0; - foreach($repeatsStack as $rep) { + foreach ($repeatsStack as $rep) { $lineoffset += $rep[1]; } //-- read the xml from the file $lines = file($report); - while((strpos($lines[$lineoffset + $repeatBytes], "<Relatives")===false) && (($lineoffset + $repeatBytes) > 0)) { + while ((strpos($lines[$lineoffset + $repeatBytes], "<Relatives")===false) && (($lineoffset + $repeatBytes) > 0)) { $lineoffset--; } $lineoffset++; @@ -3730,7 +3730,7 @@ function RelativesEHandler() { $line_nr = $lineoffset + $repeatBytes; // Relatives Level counter $count = 1; - while(0 < $count) { + while (0 < $count) { if (strpos($lines[$line_nr], "<Relatives")!==false) { $count++; } elseif (strpos($lines[$line_nr], "</Relatives")!==false) { @@ -3750,7 +3750,7 @@ function RelativesEHandler() { $list_total = count($list); $list_private = 0; - foreach($list as $key => $value) { + foreach ($list as $key => $value) { if (isset($value->generation)) { $generation = $value->generation; } diff --git a/includes/classes/class_reporthtml.php b/includes/classes/class_reporthtml.php index 0b84575982..66f9022f1f 100644 --- a/includes/classes/class_reporthtml.php +++ b/includes/classes/class_reporthtml.php @@ -162,7 +162,7 @@ class ReportBaseHTML extends ReportBase { } function runPageHeader() { - foreach($this->pageHeaderElements as $element) { + foreach ($this->pageHeaderElements as $element) { if (is_object($element)) { $element->render($this); } elseif (is_string($element) && $element=="footnotetexts") { @@ -175,8 +175,8 @@ class ReportBaseHTML extends ReportBase { function Footnotes() { $this->currentStyle = ""; - if(!empty($this->printedfootnotes)) { - foreach($this->printedfootnotes as $element) { + if (!empty($this->printedfootnotes)) { + foreach ($this->printedfootnotes as $element) { $element->renderFootnote($this); } } @@ -205,7 +205,7 @@ class ReportBaseHTML extends ReportBase { // Setting up the styles echo "\n<style type=\"text/css\">\n"; - foreach($this->Styles as $class => $style) { + foreach ($this->Styles as $class => $style) { echo ".", $class, "{\n"; if ($style["font"]=="dejavusans") { $style["font"] = $this->defaultFont; @@ -226,7 +226,7 @@ class ReportBaseHTML extends ReportBase { </head>\n<body> <div id=\"headermargin\" style=\"position:relative; top:auto; height:", $this->headermargin, "pt; width:", $this->noMarginWidth, "pt;\"></div> <div id=\"headerdiv\" style=\"position:relative; top:auto; width:", $this->noMarginWidth, "pt;\">"; - foreach($this->headerElements as $element) { + foreach ($this->headerElements as $element) { if (is_object($element)) { $element->render($this); } elseif (is_string($element) && $element=="footnotetexts") { @@ -242,7 +242,7 @@ class ReportBaseHTML extends ReportBase { $this->Y = 0; $this->maxY = 0; $this->runPageHeader(); - foreach($this->bodyElements as $element) { + foreach ($this->bodyElements as $element) { if (is_object($element)) { $element->render($this); } elseif (is_string($element) && $element=="footnotetexts") { @@ -259,7 +259,7 @@ class ReportBaseHTML extends ReportBase { $this->Y = 0; $this->X = 0; $this->maxY = 0; - foreach($this->footerElements as $element) { + foreach ($this->footerElements as $element) { if (is_object($element)) { $element->render($this); } elseif (is_string($element) && $element=="footnotetexts") { @@ -382,7 +382,7 @@ class ReportBaseHTML extends ReportBase { $ct = count($this->printedfootnotes); $i = 0; $val = $footnote->getValue(); - while($i < $ct) { + while ($i < $ct) { if ($this->printedfootnotes[$i]->getValue() == $val) { // If this footnote already exist then set up the numbers for this object $footnote->setNum($i + 1); @@ -431,7 +431,7 @@ class ReportBaseHTML extends ReportBase { function getFootnotesHeight($cellWidth) { $h = 0; - foreach($this->printedfootnotes as $element) { + foreach ($this->printedfootnotes as $element) { $h += $element->getFootnoteHeight($this, $cellWidth); } return $h; @@ -540,7 +540,7 @@ class ReportBaseHTML extends ReportBase { // Line Feed counter $lfct = count($lines); $wraptext = ''; - foreach($lines as $line) { + foreach ($lines as $line) { $wtext = ''; $wtext = utf8_wordwrap($line, $lw, "\n", true); $wraptext .= $wtext; @@ -821,7 +821,7 @@ class HtmlHTML extends Html { if (!empty($this->attrs["pgvrstyle"])) $html->setCurrentStyle($this->attrs["pgvrstyle"]); $this->text = $this->getStart(). $this->text; - foreach($this->elements as $element) { + foreach ($this->elements as $element) { if (is_string($element) && $element=="footnotetexts") { $html->Footnotes(); } elseif (is_string($element) && $element=="addpage") { @@ -872,35 +872,35 @@ class TextBoxHTML extends TextBox { // Element counter $cE = count($this->elements); //-- collapse duplicate elements - for($i = 0; $i < $cE; $i++){ + for ($i = 0; $i < $cE; $i++) { $element = $this->elements[$i]; - if (is_object($element)){ - if ($element->get_type() == "Text"){ - if (!empty($footnote_element)){ + if (is_object($element)) { + if ($element->get_type() == "Text") { + if (!empty($footnote_element)) { ksort($footnote_element); - foreach ($footnote_element as $links){ + foreach ($footnote_element as $links) { $newelements[] = $links; } $footnote_element = array(); } - if (empty($lastelement)){ + if (empty($lastelement)) { $lastelement = $element; } else { // Checking if the Text has the same style - if ($element->getStyleName() == $lastelement->getStyleName()){ + if ($element->getStyleName() == $lastelement->getStyleName()) { $lastelement->addText(str_replace("\n", "<br />", $element->getValue())); - } elseif (!empty($lastelement)){ + } elseif (!empty($lastelement)) { $newelements[] = $lastelement; $lastelement = $element; } } } // Collect the Footnote links - elseif ($element->get_type() == "Footnote"){ + elseif ($element->get_type() == "Footnote") { // Check if the Footnote has been set with it's link number $html->checkFootnote($element); // Save first the last element if any - if (!empty($lastelement)){ + if (!empty($lastelement)) { $newelements[] = $lastelement; $lastelement = array(); } @@ -908,28 +908,28 @@ class TextBoxHTML extends TextBox { $footnote_element[$element->num] = $element; } //-- do not keep empty footnotes - elseif (($element->get_type() != "Footnote") || (trim($element->getValue()) != "")){ - if (!empty($footnote_element)){ + elseif (($element->get_type() != "Footnote") || (trim($element->getValue()) != "")) { + if (!empty($footnote_element)) { ksort($footnote_element); - foreach ($footnote_element as $links){ + foreach ($footnote_element as $links) { $newelements[] = $links; } $footnote_element = array(); } - if (!empty($lastelement)){ + if (!empty($lastelement)) { $newelements[] = $lastelement; $lastelement = array(); } $newelements[] = $element; } } else { - if (!empty($lastelement)){ + if (!empty($lastelement)) { $newelements[] = $lastelement; $lastelement = array(); } - if (!empty($footnote_element)){ + if (!empty($footnote_element)) { ksort($footnote_element); - foreach ($footnote_element as $links){ + foreach ($footnote_element as $links) { $newelements[] = $links; } $footnote_element = array(); @@ -937,12 +937,12 @@ class TextBoxHTML extends TextBox { $newelements[] = $element; } } - if (!empty($lastelement)){ + if (!empty($lastelement)) { $newelements[] = $lastelement; } - if (!empty($footnote_element)){ + if (!empty($footnote_element)) { ksort($footnote_element); - foreach ($footnote_element as $links){ + foreach ($footnote_element as $links) { $newelements[] = $links; } } @@ -1003,7 +1003,7 @@ class TextBoxHTML extends TextBox { $lw = array(); // Element counter $cE = count($this->elements); - for($i = 0; $i < $cE; $i++) { + for ($i = 0; $i < $cE; $i++) { if (is_object($this->elements[$i])) { $ew = $this->elements[$i]->setWrapWidth($cW - $w - 2, $cW); if ($ew == $cW) @@ -1093,7 +1093,7 @@ class TextBoxHTML extends TextBox { $html->SetXY(0, 0); // Print the text elements - foreach($this->elements as $element) { + foreach ($this->elements as $element) { if (is_object($element)) { $element->render($html, $cX, false); } elseif (is_string($element) && $element=="footnotetexts") { @@ -1228,7 +1228,7 @@ class TextHTML extends Text { $wrapWidthRemaining = $this->wrapWidthRemaining; $lines = explode("\n", $this->text); // Go throught the text line by line - foreach($lines as $line) { + foreach ($lines as $line) { // Line width in points + a little margin $lw = $html->GetStringWidth($line); // If the line has to be wraped @@ -1236,7 +1236,7 @@ class TextHTML extends Text { $words = explode(" ", $line); $addspace = count($words); $lw = 0; - foreach($words as $word) { + foreach ($words as $word) { $addspace--; $lw += $html->GetStringWidth($word." "); if ($lw <= $wrapWidthRemaining) { @@ -1368,7 +1368,7 @@ class FootnoteHTML extends Footnote { } // Returns the Object if already numbered else false - if (empty($this->num)){ + if (empty($this->num)) { $html->checkFootnote($this); } @@ -1384,7 +1384,7 @@ class FootnoteHTML extends Footnote { $wrapWidthRemaining = $this->wrapWidthRemaining; $lines = explode("\n", $this->numText); // Go throught the text line by line - foreach($lines as $line) { + foreach ($lines as $line) { // Line width in points + a little margin $lw = $html->GetStringWidth($line); // If the line has to be wraped @@ -1392,7 +1392,7 @@ class FootnoteHTML extends Footnote { $words = explode(" ", $line); $addspace = count($words); $lw = 0; - foreach($words as $word) { + foreach ($words as $word) { $addspace--; $lw += $html->GetStringWidth($word." "); if ($lw <= $wrapWidthRemaining) { @@ -1452,7 +1452,7 @@ class PageHeaderHTML extends PageHeader { function render(&$html) { $html->clearPageHeader(); - foreach($this->elements as $element) { + foreach ($this->elements as $element) { $html->addPageHeader($element); } } diff --git a/includes/classes/class_reportpdf.php b/includes/classes/class_reportpdf.php index bdcf6024a4..791bd8cb33 100644 --- a/includes/classes/class_reportpdf.php +++ b/includes/classes/class_reportpdf.php @@ -320,7 +320,7 @@ class PDF extends TCPDF { * PDF Header -PDF */ function Header() { - foreach($this->headerElements as $element) { + foreach ($this->headerElements as $element) { if (is_object($element)) { $element->render($this); } elseif (is_string($element) && $element=="footnotetexts") { @@ -329,7 +329,7 @@ class PDF extends TCPDF { $this->newPage(); } } - foreach($this->pageHeaderElements as $element) { + foreach ($this->pageHeaderElements as $element) { if (is_object($element)) { $element->render($this); } elseif (is_string($element) && $element=="footnotetexts") { @@ -345,7 +345,7 @@ class PDF extends TCPDF { */ function Body() { $this->AddPage(); - foreach($this->bodyElements as $key => $element) { + foreach ($this->bodyElements as $key => $element) { if (is_object($element)) { $element->render($this); } elseif (is_string($element) && $element=="footnotetexts") { @@ -362,7 +362,7 @@ class PDF extends TCPDF { * PDF Footnotes -PDF */ function Footnotes() { - foreach($this->printedfootnotes as $element) { + foreach ($this->printedfootnotes as $element) { if (($this->GetY() + $element->getFootnoteHeight($this)) > $this->getPageHeight()) { $this->AddPage(); } @@ -377,7 +377,7 @@ class PDF extends TCPDF { * PDF Footer -PDF */ function Footer() { - foreach($this->footerElements as $element) { + foreach ($this->footerElements as $element) { if (is_object($element)) { $element->render($this); } elseif (is_string($element) && $element=="footnotetexts") { @@ -519,7 +519,7 @@ class PDF extends TCPDF { */ function getMaxLineWidth() { $m = $this->getMargins(); - if ($this->getRTL()){ + if ($this->getRTL()) { return ($this->getRemainingWidth() + $m["right"]); } else { return ($this->getRemainingWidth() + $m["left"]); @@ -528,7 +528,7 @@ class PDF extends TCPDF { function getFootnotesHeight() { $h=0; - foreach($this->printedfootnotes as $element) { + foreach ($this->printedfootnotes as $element) { $h+=$element->getHeight($this); } return $h; @@ -556,7 +556,7 @@ class PDF extends TCPDF { $ct = count($this->printedfootnotes); $val = $footnote->getValue(); $i = 0; - while($i < $ct) { + while ($i < $ct) { if ($this->printedfootnotes[$i]->getValue() == $val) { // If this footnote already exist then set up the numbers for this object $footnote->setNum($i + 1); @@ -577,7 +577,7 @@ class PDF extends TCPDF { * This function will make sure that images will not be overwritten */ function newPage() { - if ($this->lastpicpage > $this->getPage()){ + if ($this->lastpicpage > $this->getPage()) { $this->setPage($this->lastpicpage); } $this->AddPage(); @@ -775,7 +775,7 @@ class HtmlPDF extends Html { } $this->text = $this->getStart().$this->text; - foreach($this->elements as $element) { + foreach ($this->elements as $element) { if (is_string($element) && $element=="footnotetexts") { $pdf->Footnotes(); } elseif (is_string($element) && $element=="addpage") { @@ -835,35 +835,35 @@ class TextBoxPDF extends TextBox { // Element counter $cE = count($this->elements); //-- collapse duplicate elements - for($i = 0; $i < $cE; $i++){ + for ($i = 0; $i < $cE; $i++) { $element = $this->elements[$i]; - if (is_object($element)){ - if ($element->get_type() == "Text"){ - if (!empty($footnote_element)){ + if (is_object($element)) { + if ($element->get_type() == "Text") { + if (!empty($footnote_element)) { ksort($footnote_element); - foreach ($footnote_element as $links){ + foreach ($footnote_element as $links) { $newelements[] = $links; } $footnote_element = array(); } - if (empty($lastelement)){ + if (empty($lastelement)) { $lastelement = $element; } else { // Checking if the Text has the same style - if ($element->getStyleName() == $lastelement->getStyleName()){ + if ($element->getStyleName() == $lastelement->getStyleName()) { $lastelement->addText(str_replace("\n", "<br />", $element->getValue())); - } elseif (!empty($lastelement)){ + } elseif (!empty($lastelement)) { $newelements[] = $lastelement; $lastelement = $element; } } } // Collect the Footnote links - elseif ($element->get_type() == "Footnote"){ + elseif ($element->get_type() == "Footnote") { // Check if the Footnote has been set with it's link number $pdf->checkFootnote($element); // Save first the last element if any - if (!empty($lastelement)){ + if (!empty($lastelement)) { $newelements[] = $lastelement; $lastelement = array(); } @@ -871,28 +871,28 @@ class TextBoxPDF extends TextBox { $footnote_element[$element->num] = $element; } //-- do not keep empty footnotes - elseif (($element->get_type() != "Footnote") || (trim($element->getValue()) != "")){ - if (!empty($footnote_element)){ + elseif (($element->get_type() != "Footnote") || (trim($element->getValue()) != "")) { + if (!empty($footnote_element)) { ksort($footnote_element); - foreach ($footnote_element as $links){ + foreach ($footnote_element as $links) { $newelements[] = $links; } $footnote_element = array(); } - if (!empty($lastelement)){ + if (!empty($lastelement)) { $newelements[] = $lastelement; $lastelement = array(); } $newelements[] = $element; } } else { - if (!empty($lastelement)){ + if (!empty($lastelement)) { $newelements[] = $lastelement; $lastelement = array(); } - if (!empty($footnote_element)){ + if (!empty($footnote_element)) { ksort($footnote_element); - foreach ($footnote_element as $links){ + foreach ($footnote_element as $links) { $newelements[] = $links; } $footnote_element = array(); @@ -900,12 +900,12 @@ class TextBoxPDF extends TextBox { $newelements[] = $element; } } - if (!empty($lastelement)){ + if (!empty($lastelement)) { $newelements[] = $lastelement; } - if (!empty($footnote_element)){ + if (!empty($footnote_element)) { ksort($footnote_element); - foreach ($footnote_element as $links){ + foreach ($footnote_element as $links) { $newelements[] = $links; } } @@ -964,7 +964,7 @@ class TextBoxPDF extends TextBox { // Element counter $cE = count($this->elements); //-- calculate the text box height + width - for($i = 0; $i < $cE; $i++) { + for ($i = 0; $i < $cE; $i++) { if (is_object($this->elements[$i])) { $ew = $this->elements[$i]->setWrapWidth($cWT - $w, $cWT); if ($ew == $cWT) { @@ -1059,7 +1059,7 @@ class TextBoxPDF extends TextBox { } // Change the margins X, Width if (!$pdf->getRTL()) { - if ($this->padding){ + if ($this->padding) { $pdf->SetLeftMargin($cX + $cM["cell"]); $pdf->SetRightMargin($pdf->getRemainingWidthPDF() - $cW + $cM["right"]); } @@ -1068,7 +1068,7 @@ class TextBoxPDF extends TextBox { $pdf->SetRightMargin($pdf->getRemainingWidthPDF() - $cW + $cM["right"]); } } else { - if ($this->padding){ + if ($this->padding) { $pdf->SetRightMargin($cX + $cM["cell"]); $pdf->SetLeftMargin($pdf->getRemainingWidthPDF() - $cW + $cM["left"]); } else { @@ -1080,7 +1080,7 @@ class TextBoxPDF extends TextBox { $cPN = $pdf->getPage(); // Render the elements (write text, print picture...) - foreach($this->elements as $element) { + foreach ($this->elements as $element) { if (is_object($element)) { $element->render($pdf); } elseif (is_string($element) and $element == "footnotetexts") { @@ -1201,7 +1201,7 @@ class TextPDF extends Text { $newtext = ""; $lines = explode("\n", $this->text); // Go throught the text line by line - foreach($lines as $line) { + foreach ($lines as $line) { // Line width in points + a little margin $lw = $pdf->GetStringWidth($line); // If the line has to be wraped @@ -1209,7 +1209,7 @@ class TextPDF extends Text { $words = explode(" ", $line); $addspace = count($words); $lw = 0; - foreach($words as $word) { + foreach ($words as $word) { $addspace--; $lw += $pdf->GetStringWidth($word." "); if ($lw <= $wrapWidthRemaining) { @@ -1337,7 +1337,7 @@ class FootnotePDF extends Footnote { } // Returns the Object if already numbered else false - if (empty($this->num)){ + if (empty($this->num)) { $pdf->checkFootnote($this); } @@ -1354,7 +1354,7 @@ class FootnotePDF extends Footnote { $newtext = ""; $lines = explode("\n", $this->numText); // Go throught the text line by line - foreach($lines as $line) { + foreach ($lines as $line) { // Line width in points $lw = ceil($pdf->GetStringWidth($line)); // If the line has to be wraped @@ -1362,7 +1362,7 @@ class FootnotePDF extends Footnote { $words = explode(" ", $line); $addspace = count($words); $lw = 0; - foreach($words as $word) { + foreach ($words as $word) { $addspace--; $lw += ceil($pdf->GetStringWidth($word." ")); if ($lw < $wrapWidthRemaining) { @@ -1426,7 +1426,7 @@ class PageHeaderPDF extends PageHeader { */ function render(&$pdf) { $pdf->clearPageHeader(); - foreach($this->elements as $element) { + foreach ($this->elements as $element) { $pdf->addPageHeader($element); } } diff --git a/includes/classes/class_serviceclient.php b/includes/classes/class_serviceclient.php index bc4e09b6be..17aa414b13 100644 --- a/includes/classes/class_serviceclient.php +++ b/includes/classes/class_serviceclient.php @@ -162,7 +162,7 @@ class ServiceClient extends GedcomRecord { $this->authenticate(); $info = $this->soapClient->ServiceInfo(); //print_r($info); - foreach($info->gedcoms as $ind=>$gedobj) { + foreach ($info->gedcoms as $ind=>$gedobj) { if ($gedobj->ID==$this->gedfile) break; } $this->title = $gedobj->title; @@ -183,20 +183,20 @@ class ServiceClient extends GedcomRecord { $newrecs = array(); //-- make sure we don't get circular links - foreach($remoterecs as $ind2=>$subrec2) { + foreach ($remoterecs as $ind2=>$subrec2) { if (strpos($subrec2, "1 RFN")===false) { $newrecs[] = $subrec2; } } - foreach($localrecs as $ind=>$subrec) { + foreach ($localrecs as $ind=>$subrec) { $found = false; if (strpos($subrec, "1 CHAN")===false) { $subrec = trim($subrec); $orig_subrec = $subrec; $subrec = preg_replace("/\s+/", " ", $subrec); - foreach($remoterecs as $ind2=>$subrec2) { + foreach ($remoterecs as $ind2=>$subrec2) { $subrec2 = trim($subrec2); $subrec2 = preg_replace("/\s+/", " ", $subrec2); @@ -222,7 +222,7 @@ class ServiceClient extends GedcomRecord { $ct = preg_match("/0 @(.*)@ (\w*)/", $record2, $match); if ($ct>0) $localrec = preg_replace("/0 @(.*)@ (\w*)/", "0 @$1@ ".trim($match[2]), $localrec); //-- add all of the new records - foreach($newrecs as $ind=>$subrec) { + foreach ($newrecs as $ind=>$subrec) { $localrec .= trim($subrec)."\n"; } $localrec = trim($localrec); @@ -252,7 +252,7 @@ class ServiceClient extends GedcomRecord { /** * Updates Family Records such as children, spouse, and parents */ - function UpdateFamily($record1,$record2){ + function UpdateFamily($record1,$record2) { // This makes sure there is a record in both the server and client else it returns the record that // exist if any if (empty($record1)) { @@ -268,7 +268,7 @@ class ServiceClient extends GedcomRecord { if ($ct>0) { $personId1 = $match[1]; $type1 = trim($match[2]); - if ($type1!="INDI"){ + if ($type1!="INDI") { return $record1; } } @@ -276,7 +276,7 @@ class ServiceClient extends GedcomRecord { if ($ct>0) { $personId2 = $match[1]; $type2 = trim($match[2]); - if ($type2!="INDI"){ + if ($type2!="INDI") { return $record1; } } @@ -297,22 +297,22 @@ class ServiceClient extends GedcomRecord { $firstTimeFamily=true; // starting the comparisons for family as child - if(empty($List1FamilyChildID)){ + if (empty($List1FamilyChildID)) { //-- add all remote ids - foreach($List2FamilyChildID as $famc=>$famCild2){ + foreach ($List2FamilyChildID as $famc=>$famCild2) { $FamilyListChild[] = $famCild2; } - } elseif(empty($List2FamilyChildID)){ + } elseif (empty($List2FamilyChildID)) { //-- nothing to do if there are no remote families } else { // Creating the first family - foreach($List1FamilyChildID as $famc=>$famCild1){ - if(!empty($famCild1)){ + foreach ($List1FamilyChildID as $famc=>$famCild1) { + if (!empty($famCild1)) { // Creating the Secound Family - foreach($List2FamilyChildID as $famc=>$famCild2){ - if(!empty($famCild2)){ - if(!$this->CompairForUpdateFamily($famCild1,$famCild2)){ - if($firstTimeFamily){ + foreach ($List2FamilyChildID as $famc=>$famCild2) { + if (!empty($famCild2)) { + if (!$this->CompairForUpdateFamily($famCild1,$famCild2)) { + if ($firstTimeFamily) { $FamilyListChild[] = $famCild2; } } else { @@ -324,24 +324,24 @@ class ServiceClient extends GedcomRecord { } } // starting the comparisons for family as spouse - if(empty($List1FamilySpouseID)){ + if (empty($List1FamilySpouseID)) { //-- add all remote ids - foreach($List2FamilySpouseID as $fams=>$famSpouse2){ - if(!empty($famSpouse2)){ + foreach ($List2FamilySpouseID as $fams=>$famSpouse2) { + if (!empty($famSpouse2)) { $FamilyListSpouse[] = $famSpouse2; } } - } elseif(empty($List2FamilySpouseID)){ + } elseif (empty($List2FamilySpouseID)) { //-- don't do anything if there are no remote families } else { // Creating the first family - foreach($List1FamilySpouseID as $fams=>$famSpouse1){ - if(!empty($famSpouse1)){ + foreach ($List1FamilySpouseID as $fams=>$famSpouse1) { + if (!empty($famSpouse1)) { // Creating the Secound Family - foreach($List2FamilySpouseID as $fams=>$famSpouse2){ - if(!empty($famSpouse2)){ - if(!$this->CompairForUpdateFamily($famSpouse1,$famSpouse2)){ - if($firstTimeFamily){ + foreach ($List2FamilySpouseID as $fams=>$famSpouse2) { + if (!empty($famSpouse2)) { + if (!$this->CompairForUpdateFamily($famSpouse1,$famSpouse2)) { + if ($firstTimeFamily) { $FamilyListSpouse[] = $famSpouse2; } } else { @@ -353,15 +353,15 @@ class ServiceClient extends GedcomRecord { } } // This Adds any new familys to the person. - if (count($FamilyListChild)>0){ - for ($i=0;$i<count($FamilyListChild);$i++){ + if (count($FamilyListChild)>0) { + for ($i=0;$i<count($FamilyListChild);$i++) { $record1.="\n1 FAMC @"; if (strpos($FamilyListChild[$i], $this->xref)!==0) $record1 .= $this->xref.":"; $record1 .= $FamilyListChild[$i]."@"; } } - if(count($FamilyListSpouse)>0){ - for($i=0;$i<count($FamilyListSpouse);$i++){ + if (count($FamilyListSpouse)>0) { + for ($i=0;$i<count($FamilyListSpouse);$i++) { $record1.="\n1 FAMS @"; if (strpos($FamilyListSpouse[$i], $this->xref)!==0) $record1 .= $this->xref.":"; $record1 .= $FamilyListSpouse[$i]."@"; @@ -373,7 +373,7 @@ class ServiceClient extends GedcomRecord { /** * This mergest the the two familys together */ - function MergeForUpdateFamily($Family1,$Family2,$Familylist,&$FamilyListReturn){ + function MergeForUpdateFamily($Family1,$Family2,$Familylist,&$FamilyListReturn) { global $GEDCOM; require_once WT_ROOT.'includes/functions/functions_edit.php'; @@ -408,40 +408,40 @@ class ServiceClient extends GedcomRecord { $children1=$family1->getChildren(); $children2=$family2->getChildren(); - if(count($FamilyListReturn)>0){ // removes the updated family from the list so it does not get added later. + if (count($FamilyListReturn)>0) { // removes the updated family from the list so it does not get added later. $index=null; - for($i=0; $i<count($FamilyListReturn); $i++){ - if($FamilyListReturn[$i]==$Family2){ + for ($i=0; $i<count($FamilyListReturn); $i++) { + if ($FamilyListReturn[$i]==$Family2) { $ndex=$i; break; } } - if($index!=null){ + if ($index!=null) { unset($FamilyListReturn[$index]); } } $famupdated = false; // Merging starts here, the merging of children. - if(empty($children1)) { + if (empty($children1)) { $children1=$children2; - } elseif(empty($children2)) { + } elseif (empty($children2)) { } else { // Children are looped to see if they need to be added or merged to an esisting child - foreach($children2 as $childID2=>$Child2){ - if(!empty($Child2)) { + foreach ($children2 as $childID2=>$Child2) { + if (!empty($Child2)) { //echo "<br/>child 2 Xref ".$Child2->getXref()."-".$childID2; $found = false; //-- compare to children in local family - foreach($children1 as $childID1=>$Child1){ - if(!empty($Child1)){ + foreach ($children1 as $childID1=>$Child1) { + if (!empty($Child1)) { //echo "<br/>child 2 Xref ".$Child2->getXref()." == ".$Child1->getXref(); $found=$this->ComparePeople($Child1,$Child2); if ($found) break; } } - if($found){ + if ($found) { $childrec = $Child1->getGedcomRecord(); if (strpos($childrec, "1 RFN ".$this->xref.":")===false) { $childrec .= "\n1 RFN ".$Child2->getXref(); @@ -469,15 +469,15 @@ class ServiceClient extends GedcomRecord { } // Merge Father basicly they just add the rfn numer and let the merge handle it latter - if(empty($father1)){ - if(!empty($father2)){ + if (empty($father1)) { + if (!empty($father2)) { $father1=$father2; $famrec1 .="\n1 HUSB @".$father1->getXref()."@"; //echo "<br/> adding for fahter ".$father1->getXref(); replace_gedrec($family1->getXref(), WT_GED_ID, $famrec1); } - } elseif(!empty($father2)){ - if($this->ComparePeople($father1,$father2)){ + } elseif (!empty($father2)) { + if ($this->ComparePeople($father1,$father2)) { $fatherrec = $father1->getGedcomRecord(); if (strpos($fatherrec, "1 RFN ".$this->xref.":")===false) { $fatherrec .= "\n1 RFN ".$father2->getXref(); @@ -488,15 +488,15 @@ class ServiceClient extends GedcomRecord { } } // Merge Mother - if(empty($mother1)){ - if(!empty($mother2)){ + if (empty($mother1)) { + if (!empty($mother2)) { $mother1=$mother2; $famrec1 .="\n1 WIFE @".$mother1->getXref()."@"; //echo "<br/> adding for mother ".$mother1->getXref(); replace_gedrec($family1->getXref(), WT_GED_ID, $famrec1); } - } else if(!empty($mother2)){ - if($this->ComparePeople($mother1,$mother2)){ + } else if (!empty($mother2)) { + if ($this->ComparePeople($mother1,$mother2)) { $motherrec = $mother1->getGedcomRecord(); if (strpos($motherrec, "1 RFN ".$this->xref.":")===false) { $motherrec .= "\n1 RFN ".$mother2->getXref(); @@ -544,11 +544,11 @@ class ServiceClient extends GedcomRecord { } $father2 = $family2->getHusband(); $CountFamily2+=1.0; - if(empty($father1)){ + if (empty($father1)) { unset($father1); $CountFamily1-=1.0; } - if(empty($father2)){ + if (empty($father2)) { unset($father2); $CountFamily2-=1.0; } @@ -556,11 +556,11 @@ class ServiceClient extends GedcomRecord { // Creat the mothers if their is some $mother2=$family2->getWife(); $CountFamily2+=1.0; - if(empty($mother1)){ + if (empty($mother1)) { unset($mother1); $CountFamily1-=1.0; } - if(empty($mother2)){ + if (empty($mother2)) { unset($mother2); $CountFamily2-=1.0; } @@ -572,11 +572,11 @@ class ServiceClient extends GedcomRecord { // finds the probablity that they are the same family Bassed of both sites information $CountFamily1 += count($children1); $CountFamily2 += count($children2); - foreach($children1 as $childID1=>$Person1){ + foreach ($children1 as $childID1=>$Person1) { if (!empty($Person1)) { - foreach($children2 as $childID2=>$Person2){ - if(!empty($Person2)){ - if($this->ComparePeople($Person1,$Person2)){ + foreach ($children2 as $childID2=>$Person2) { + if (!empty($Person2)) { + if ($this->ComparePeople($Person1,$Person2)) { $ChanceSameFamily+=1.0; //echo "<br />".$Person1->getXref()." equals ".$Person2->getXref(); break; @@ -586,27 +586,27 @@ class ServiceClient extends GedcomRecord { } } - if(empty($father1)) { - } elseif(empty($father2)){ + if (empty($father1)) { + } elseif (empty($father2)) { } else { - if($this->ComparePeople($father1,$father2)){ + if ($this->ComparePeople($father1,$father2)) { $ChanceSameFamily+=1.0; } } - if(empty($mother1)) { - } elseif(empty($mother2)) { + if (empty($mother1)) { + } elseif (empty($mother2)) { } else { - if($this->ComparePeople($mother1,$mother2)){ + if ($this->ComparePeople($mother1,$mother2)) { $ChanceSameFamily+=1.0; } } - if($CountFamily1!=0&&$CountFamily2!=0){ + if ($CountFamily1!=0&&$CountFamily2!=0) { $ChanceSame=(($ChanceSameFamily/$CountFamily1)+($ChanceSameFamily/$CountFamily2))/2; //echo "<br />chancesame=".$ChanceSameFamily." count1=".$CountFamily1." count2=".$CountFamily2." ".$family1->getXref()." compared to ".$family2->getXref()." is ".$ChanceSame; } else return false; - if($ChanceSame<0.5){ // If the probabilty is less then 0.5 or 50% then the current family is stored here to be added later + if ($ChanceSame<0.5) { // If the probabilty is less then 0.5 or 50% then the current family is stored here to be added later return false; } else { return true; } } @@ -636,7 +636,7 @@ class ServiceClient extends GedcomRecord { * false if they are not. It only compares the name, sex birthdate, and deathdate * of the person */ - static function ComparePeople(&$Person1,&$Person2){ + static function ComparePeople(&$Person1,&$Person2) { $PersonName1=$Person1->getFullName(); $PersonSex1=$Person1->getSex(); $PersonBirth1=$Person1->getEstimatedBirthDate(); @@ -649,9 +649,9 @@ class ServiceClient extends GedcomRecord { $count=0; $Probability=0; - if (!empty($PersonName1)&&!empty($PersonName2)){ + if (!empty($PersonName1)&&!empty($PersonName2)) { $lev = levenshtein(utf8_strtolower($PersonName1), utf8_strtolower($PersonName2)); - if($lev<4){ + if ($lev<4) { $Probability+=2; } else $Probability-=2; @@ -686,7 +686,7 @@ class ServiceClient extends GedcomRecord { } $prob=$Probability/$count; - if($prob<0.5){ + if ($prob<0.5) { return false; } else { return true; @@ -702,7 +702,7 @@ class ServiceClient extends GedcomRecord { function checkIds($gedrec) { $ids_checked = array(); $ct = preg_match_all("/@(".$this->xref.":.*)@/", $gedrec, $match, PREG_SET_ORDER); - for($i=0; $i<$ct; $i++) { + for ($i=0; $i<$ct; $i++) { $id = trim($match[$i][1]); if (isset($ids_checked[$id])) continue; $ids_checked[$id]=true; @@ -870,7 +870,7 @@ class ServiceClient extends GedcomRecord { if (isset($namespace[0]) && isset($wsdl->bindings[$namespace[0]]['operations'])) { $operations = array_keys($wsdl->bindings[$namespace[0]]['operations']); - for($i = 0; $i<count($operations); $i++) { + for ($i = 0; $i<count($operations); $i++) { $wsdl->bindings[$namespace[0]]['operations'][$operations[$i]]['input']['use'] = 'literal'; $wsdl->bindings[$namespace[0]]['operations'][$operations[$i]]['output']['use'] = 'literal'; } diff --git a/includes/classes/class_stats.php b/includes/classes/class_stats.php index 830ab8357f..7d622a5d19 100644 --- a/includes/classes/class_stats.php +++ b/includes/classes/class_stats.php @@ -389,9 +389,9 @@ class stats { function chartIndisWithSources($params=null) { global $WT_STATS_CHART_COLOR1, $WT_STATS_CHART_COLOR2, $WT_STATS_S_CHART_X, $WT_STATS_S_CHART_Y; if ($params === null) {$params = array();} - if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);}else{$size = $WT_STATS_S_CHART_X."x".$WT_STATS_S_CHART_Y;} - if (isset($params[1]) && $params[1] != '') {$color_from = strtolower($params[1]);}else{$color_from = $WT_STATS_CHART_COLOR1;} - if (isset($params[2]) && $params[2] != '') {$color_to = strtolower($params[2]);}else{$color_to = $WT_STATS_CHART_COLOR2;} + if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);} else {$size = $WT_STATS_S_CHART_X."x".$WT_STATS_S_CHART_Y;} + if (isset($params[1]) && $params[1] != '') {$color_from = strtolower($params[1]);} else {$color_from = $WT_STATS_CHART_COLOR1;} + if (isset($params[2]) && $params[2] != '') {$color_to = strtolower($params[2]);} else {$color_to = $WT_STATS_CHART_COLOR2;} $sizes = explode('x', $size); $tot_indi = $this->totalIndividuals(); if ($tot_indi==0) { @@ -428,9 +428,9 @@ class stats { function chartFamsWithSources($params=null) { global $WT_STATS_CHART_COLOR1, $WT_STATS_CHART_COLOR2, $WT_STATS_S_CHART_X, $WT_STATS_S_CHART_Y; if ($params === null) {$params = array();} - if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);}else{$size = $WT_STATS_S_CHART_X."x".$WT_STATS_S_CHART_Y;} - if (isset($params[1]) && $params[1] != '') {$color_from = strtolower($params[1]);}else{$color_from = $WT_STATS_CHART_COLOR1;} - if (isset($params[2]) && $params[2] != '') {$color_to = strtolower($params[2]);}else{$color_to = $WT_STATS_CHART_COLOR2;} + if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);} else {$size = $WT_STATS_S_CHART_X."x".$WT_STATS_S_CHART_Y;} + if (isset($params[1]) && $params[1] != '') {$color_from = strtolower($params[1]);} else {$color_from = $WT_STATS_CHART_COLOR1;} + if (isset($params[2]) && $params[2] != '') {$color_to = strtolower($params[2]);} else {$color_to = $WT_STATS_CHART_COLOR2;} $sizes = explode('x', $size); $tot_fam = $this->totalFamilies(); $tot_sfam = $this->totalFamsWithSources(); @@ -634,10 +634,10 @@ class stats { function chartSex($params=null) { global $TEXT_DIRECTION, $WT_STATS_S_CHART_X, $WT_STATS_S_CHART_Y; if ($params === null) {$params = array();} - if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);}else{$size = $WT_STATS_S_CHART_X."x".$WT_STATS_S_CHART_Y;} - if (isset($params[1]) && $params[1] != '') {$color_female = strtolower($params[1]);}else{$color_female = 'ffd1dc';} - if (isset($params[2]) && $params[2] != '') {$color_male = strtolower($params[2]);}else{$color_male = '84beff';} - if (isset($params[3]) && $params[3] != '') {$color_unknown = strtolower($params[3]);}else{$color_unknown = '777777';} + if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);} else {$size = $WT_STATS_S_CHART_X."x".$WT_STATS_S_CHART_Y;} + if (isset($params[1]) && $params[1] != '') {$color_female = strtolower($params[1]);} else {$color_female = 'ffd1dc';} + if (isset($params[2]) && $params[2] != '') {$color_male = strtolower($params[2]);} else {$color_male = '84beff';} + if (isset($params[3]) && $params[3] != '') {$color_unknown = strtolower($params[3]);} else {$color_unknown = '777777';} $sizes = explode('x', $size); $tot_f = $this->totalSexFemalesPercentage(); $tot_m = $this->totalSexMalesPercentage(); @@ -708,10 +708,10 @@ class stats { function chartMortality($params=null) { global $TEXT_DIRECTION, $WT_STATS_S_CHART_X, $WT_STATS_S_CHART_Y; if ($params === null) {$params = array();} - if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);}else{$size = $WT_STATS_S_CHART_X."x".$WT_STATS_S_CHART_Y;} - if (isset($params[1]) && $params[1] != '') {$color_living = strtolower($params[1]);}else{$color_living = 'ffffff';} - if (isset($params[2]) && $params[2] != '') {$color_dead = strtolower($params[2]);}else{$color_dead = 'cccccc';} - if (isset($params[3]) && $params[3] != '') {$color_unknown = strtolower($params[3]);}else{$color_unknown = '777777';} + if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);} else {$size = $WT_STATS_S_CHART_X."x".$WT_STATS_S_CHART_Y;} + if (isset($params[1]) && $params[1] != '') {$color_living = strtolower($params[1]);} else {$color_living = 'ffffff';} + if (isset($params[2]) && $params[2] != '') {$color_dead = strtolower($params[2]);} else {$color_dead = 'cccccc';} + if (isset($params[3]) && $params[3] != '') {$color_unknown = strtolower($params[3]);} else {$color_unknown = '777777';} $sizes = explode('x', $size); $tot_l = $this->totalLivingPercentage(); $tot_d = $this->totalDeceasedPercentage(); @@ -806,9 +806,9 @@ class stats { function chartMedia($params=null) { global $TEXT_DIRECTION, $WT_STATS_CHART_COLOR1, $WT_STATS_CHART_COLOR2, $WT_STATS_S_CHART_X, $WT_STATS_S_CHART_Y, $MEDIA_TYPES; if ($params === null) {$params = array();} - if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);}else{$size = $WT_STATS_S_CHART_X."x".$WT_STATS_S_CHART_Y;} - if (isset($params[1]) && $params[1] != '') {$color_from = strtolower($params[1]);}else{$color_from = $WT_STATS_CHART_COLOR1;} - if (isset($params[2]) && $params[2] != '') {$color_to = strtolower($params[2]);}else{$color_to = $WT_STATS_CHART_COLOR2;} + if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);} else {$size = $WT_STATS_S_CHART_X."x".$WT_STATS_S_CHART_Y;} + if (isset($params[1]) && $params[1] != '') {$color_from = strtolower($params[1]);} else {$color_from = $WT_STATS_CHART_COLOR1;} + if (isset($params[2]) && $params[2] != '') {$color_to = strtolower($params[2]);} else {$color_to = $WT_STATS_CHART_COLOR2;} $sizes = explode('x', $size); $tot = $this->_totalMediaType('all'); // Beware divide by zero @@ -1305,9 +1305,9 @@ class stats { } $rows=self::_runSQL($sql); if ($simple) { - if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);}else{$size = $WT_STATS_S_CHART_X."x".$WT_STATS_S_CHART_Y;} - if (isset($params[1]) && $params[1] != '') {$color_from = strtolower($params[1]);}else{$color_from = $WT_STATS_CHART_COLOR1;} - if (isset($params[2]) && $params[2] != '') {$color_to = strtolower($params[2]);}else{$color_to = $WT_STATS_CHART_COLOR2;} + if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);} else {$size = $WT_STATS_S_CHART_X."x".$WT_STATS_S_CHART_Y;} + if (isset($params[1]) && $params[1] != '') {$color_from = strtolower($params[1]);} else {$color_from = $WT_STATS_CHART_COLOR1;} + if (isset($params[2]) && $params[2] != '') {$color_to = strtolower($params[2]);} else {$color_to = $WT_STATS_CHART_COLOR2;} $sizes = explode('x', $size); $tot = 0; foreach ($rows as $values) { @@ -1363,9 +1363,9 @@ class stats { } $rows=self::_runSQL($sql); if ($simple) { - if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);}else{$size = $WT_STATS_S_CHART_X."x".$WT_STATS_S_CHART_Y;} - if (isset($params[1]) && $params[1] != '') {$color_from = strtolower($params[1]);}else{$color_from = $WT_STATS_CHART_COLOR1;} - if (isset($params[2]) && $params[2] != '') {$color_to = strtolower($params[2]);}else{$color_to = $WT_STATS_CHART_COLOR2;} + if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);} else {$size = $WT_STATS_S_CHART_X."x".$WT_STATS_S_CHART_Y;} + if (isset($params[1]) && $params[1] != '') {$color_from = strtolower($params[1]);} else {$color_from = $WT_STATS_CHART_COLOR1;} + if (isset($params[2]) && $params[2] != '') {$color_to = strtolower($params[2]);} else {$color_to = $WT_STATS_CHART_COLOR2;} $sizes = explode('x', $size); $tot = 0; foreach ($rows as $values) { @@ -1527,7 +1527,7 @@ class stats { } else { $sex_search = ''; } - if ($params !== null && isset($params[0])) {$total = $params[0];}else{$total = 10;} + if ($params !== null && isset($params[0])) {$total = $params[0];} else {$total = 10;} $total=(int)$total; $rows=self::_runSQL('' .' SELECT ' @@ -1599,7 +1599,7 @@ class stats { } else { $sex_search = ''; } - if ($params !== null && isset($params[0])) {$total = $params[0];}else{$total = 10;} + if ($params !== null && isset($params[0])) {$total = $params[0];} else {$total = 10;} $total=(int)$total; $rows=self::_runSQL('' .' SELECT' @@ -1700,7 +1700,7 @@ class stats { function statsAge($simple=true, $related='BIRT', $sex='BOTH', $year1=-1, $year2=-1, $params=null) { if ($simple) { - if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);}else{$size = '230x250';} + if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);} else {$size = '230x250';} $sizes = explode('x', $size); $rows=self::_runSQL('' .' SELECT' @@ -1763,7 +1763,7 @@ class stats { } else { $offset = 0; $counter = array(); - while($offset = strpos($title, " ", $offset + 1)){ + while ($offset = strpos($title, " ", $offset + 1)) { $counter[] = $offset; } $half = floor(count($counter)/2); @@ -1957,7 +1957,7 @@ class stats { * Query the database for marriage tags. */ function _marriageQuery($type='full', $age_dir='ASC', $sex='F', $show_years=false) { - if ($sex == 'F') {$sex_field = 'f_wife';}else{$sex_field = 'f_husb';} + if ($sex == 'F') {$sex_field = 'f_wife';} else {$sex_field = 'f_husb';} if ($age_dir != 'ASC') {$age_dir = 'DESC';} $rows=self::_runSQL('' /* //old @@ -2079,7 +2079,7 @@ class stats { function _ageOfMarriageQuery($type='list', $age_dir='ASC', $params=null) { global $TEXT_DIRECTION; - if ($params !== null && isset($params[0])) {$total = $params[0];}else{$total = 10;} + if ($params !== null && isset($params[0])) {$total = $params[0];} else {$total = 10;} if ($age_dir != 'ASC') {$age_dir = 'DESC';} $hrows=self::_runSQL('' .' SELECT DISTINCT' @@ -2211,7 +2211,7 @@ class stats { function _ageBetweenSpousesQuery($type='list', $age_dir='DESC', $params=null) { global $TEXT_DIRECTION; - if ($params !== null && isset($params[0])) {$total = $params[0];}else{$total = 10;} + if ($params !== null && isset($params[0])) {$total = $params[0];} else {$total = 10;} if ($age_dir=='DESC') { $query1 = ' MIN(wifebirth.d_julianday2-husbbirth.d_julianday1) AS age'; $query2 = ' wifebirth.d_julianday2 >= husbbirth.d_julianday1 AND' @@ -2281,7 +2281,7 @@ class stats { } function _parentsQuery($type='full', $age_dir='ASC', $sex='F', $show_years=false) { - if ($sex == 'F') {$sex_field = 'WIFE';}else{$sex_field = 'HUSB';} + if ($sex == 'F') {$sex_field = 'WIFE';} else {$sex_field = 'HUSB';} if ($age_dir != 'ASC') {$age_dir = 'DESC';} $rows=self::_runSQL('' .' SELECT' @@ -2396,9 +2396,9 @@ class stats { $rows=self::_runSQL($sql); if (!isset($rows)) {return 0;} if ($simple) { - if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);}else{$size = $WT_STATS_S_CHART_X."x".$WT_STATS_S_CHART_Y;} - if (isset($params[1]) && $params[1] != '') {$color_from = strtolower($params[1]);}else{$color_from = $WT_STATS_CHART_COLOR1;} - if (isset($params[2]) && $params[2] != '') {$color_to = strtolower($params[2]);}else{$color_to = $WT_STATS_CHART_COLOR2;} + if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);} else {$size = $WT_STATS_S_CHART_X."x".$WT_STATS_S_CHART_Y;} + if (isset($params[1]) && $params[1] != '') {$color_from = strtolower($params[1]);} else {$color_from = $WT_STATS_CHART_COLOR1;} + if (isset($params[2]) && $params[2] != '') {$color_to = strtolower($params[2]);} else {$color_to = $WT_STATS_CHART_COLOR2;} $sizes = explode('x', $size); $tot = 0; foreach ($rows as $values) { @@ -2472,9 +2472,9 @@ class stats { $rows=self::_runSQL($sql); if (!isset($rows)) {return 0;} if ($simple) { - if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);}else{$size = $WT_STATS_S_CHART_X."x".$WT_STATS_S_CHART_Y;} - if (isset($params[1]) && $params[1] != '') {$color_from = strtolower($params[1]);}else{$color_from = $WT_STATS_CHART_COLOR1;} - if (isset($params[2]) && $params[2] != '') {$color_to = strtolower($params[2]);}else{$color_to = $WT_STATS_CHART_COLOR2;} + if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);} else {$size = $WT_STATS_S_CHART_X."x".$WT_STATS_S_CHART_Y;} + if (isset($params[1]) && $params[1] != '') {$color_from = strtolower($params[1]);} else {$color_from = $WT_STATS_CHART_COLOR1;} + if (isset($params[2]) && $params[2] != '') {$color_to = strtolower($params[2]);} else {$color_to = $WT_STATS_CHART_COLOR2;} $sizes = explode('x', $size); $tot = 0; foreach ($rows as $values) { @@ -2523,7 +2523,7 @@ class stats { function statsMarrAge($simple=true, $sex='M', $year1=-1, $year2=-1, $params=null) { if ($simple) { - if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);}else{$size = '200x250';} + if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);} else {$size = '200x250';} $sizes = explode('x', $size); $rows=self::_runSQL('' .' SELECT' @@ -2607,7 +2607,7 @@ class stats { } else { $offset = 0; $counter = array(); - while($offset = strpos(i18n::translate('Average age in century of marriage'), " ", $offset + 1)){ + while ($offset = strpos(i18n::translate('Average age in century of marriage'), " ", $offset + 1)) { $counter[] = $offset; } $half = floor(count($counter)/2); @@ -2789,7 +2789,7 @@ class stats { function _topTenFamilyQuery($type='list', $params=null) { global $TEXT_DIRECTION; - if ($params !== null && isset($params[0])) {$total = $params[0];}else{$total = 10;} + if ($params !== null && isset($params[0])) {$total = $params[0];} else {$total = 10;} $total=(int)$total; $rows=self::_runSQL('' .' SELECT' @@ -2803,7 +2803,7 @@ class stats { .' tot DESC LIMIT '.$total ); if (!isset($rows[0])) {return '';} - if(count($rows) < $total){$total = count($rows);} + if (count($rows) < $total) {$total = count($rows);} $top10 = array(); for ($c = 0; $c < $total; $c++) { $family=Family::getInstance($rows[$c]['id']); @@ -2832,8 +2832,8 @@ class stats { function _ageBetweenSiblingsQuery($type='list', $params=null) { global $TEXT_DIRECTION; if ($params === null) {$params = array();} - if (isset($params[0])) {$total = $params[0];}else{$total = 10;} - if (isset($params[1])) {$one = $params[1];}else{$one = false;} // each family only once if true + if (isset($params[0])) {$total = $params[0];} else {$total = 10;} + if (isset($params[1])) {$one = $params[1];} else {$one = false;} // each family only once if true $total=(int)$total; $rows=self::_runSQL('' .' SELECT DISTINCT' @@ -2950,10 +2950,10 @@ class stats { function chartLargestFamilies($params=null) { global $WT_STATS_CHART_COLOR1, $WT_STATS_CHART_COLOR2, $WT_STATS_L_CHART_X, $WT_STATS_S_CHART_Y; if ($params === null) {$params = array();} - if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);}else{$size = $WT_STATS_L_CHART_X."x".$WT_STATS_S_CHART_Y;} - if (isset($params[1]) && $params[1] != '') {$color_from = strtolower($params[1]);}else{$color_from = $WT_STATS_CHART_COLOR1;} - if (isset($params[2]) && $params[2] != '') {$color_to = strtolower($params[2]);}else{$color_to = $WT_STATS_CHART_COLOR2;} - if (isset($params[3]) && $params[3] != '') {$total = strtolower($params[3]);}else{$total = 10;} + if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);} else {$size = $WT_STATS_L_CHART_X."x".$WT_STATS_S_CHART_Y;} + if (isset($params[1]) && $params[1] != '') {$color_from = strtolower($params[1]);} else {$color_from = $WT_STATS_CHART_COLOR1;} + if (isset($params[2]) && $params[2] != '') {$color_to = strtolower($params[2]);} else {$color_to = $WT_STATS_CHART_COLOR2;} + if (isset($params[3]) && $params[3] != '') {$total = strtolower($params[3]);} else {$total = 10;} $sizes = explode('x', $size); $total=(int)$total; $rows=self::_runSQL('' @@ -2972,7 +2972,7 @@ class stats { foreach ($rows as $row) {$tot += $row['tot'];} $chd = ''; $chl = array(); - foreach ($rows as $row){ + foreach ($rows as $row) { $family=Family::getInstance($row['id']); if ($family->canDisplayDetails()) { if ($tot==0) { @@ -3004,7 +3004,7 @@ class stats { function statsChildren($simple=true, $sex='BOTH', $year1=-1, $year2=-1, $params=null) { if ($simple) { - if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);}else{$size = '220x200';} + if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);} else {$size = '220x200';} $sizes = explode('x', $size); $max = 0; $rows=self::_runSQL('' @@ -3139,7 +3139,7 @@ class stats { } function chartNoChildrenFamilies($year1=-1, $year2=-1, $params=null) { - if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);}else{$size = '220x200';} + if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);} else {$size = '220x200';} $sizes = explode('x', $size); if ($year1>=0 && $year2>=0) { $years = " married.d_year BETWEEN '{$year1}' AND '{$year2}' AND"; @@ -3207,7 +3207,7 @@ class stats { function _topTenGrandFamilyQuery($type='list', $params=null) { global $TEXT_DIRECTION; - if ($params !== null && isset($params[0])) {$total = $params[0];}else{$total = 10;} + if ($params !== null && isset($params[0])) {$total = $params[0];} else {$total = 10;} $total=(int)$total; $rows=self::_runSQL('' .' SELECT' @@ -3271,9 +3271,9 @@ class stats { global $TEXT_DIRECTION, $SURNAME_LIST_STYLE, $GEDCOM; $ged_id=get_id_from_gedcom($GEDCOM); - if (is_array($params) && isset($params[0]) && $params[0] != '') {$threshold = strtolower($params[0]);}else{$threshold = get_gedcom_setting($ged_id, 'COMMON_NAMES_THRESHOLD');} - if(is_array($params) && isset($params[1]) && $params[1] != '' && $params[1] >= 0){$maxtoshow = strtolower($params[1]);}else{$maxtoshow = false;} - if(is_array($params) && isset($params[2]) && $params[2] != ''){$sorting = strtolower($params[2]);}else{$sorting = 'alpha';} + if (is_array($params) && isset($params[0]) && $params[0] != '') {$threshold = strtolower($params[0]);} else {$threshold = get_gedcom_setting($ged_id, 'COMMON_NAMES_THRESHOLD');} + if (is_array($params) && isset($params[1]) && $params[1] != '' && $params[1] >= 0) {$maxtoshow = strtolower($params[1]);} else {$maxtoshow = false;} + if (is_array($params) && isset($params[2]) && $params[2] != '') {$sorting = strtolower($params[2]);} else {$sorting = 'alpha';} $surname_list = get_common_surnames($threshold); if (count($surname_list) == 0) return ''; uasort($surname_list, array('stats', '_name_total_rsort')); @@ -3317,11 +3317,11 @@ class stats { function chartCommonSurnames($params=null) { global $WT_STATS_CHART_COLOR1, $WT_STATS_CHART_COLOR2, $WT_STATS_S_CHART_X, $WT_STATS_S_CHART_Y; if ($params === null) {$params = array();} - if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);}else{$size = $WT_STATS_S_CHART_X."x".$WT_STATS_S_CHART_Y;} - if (isset($params[1]) && $params[1] != '') {$color_from = strtolower($params[1]);}else{$color_from = $WT_STATS_CHART_COLOR1;} - if (isset($params[2]) && $params[2] != '') {$color_to = strtolower($params[2]);}else{$color_to = $WT_STATS_CHART_COLOR2;} - if (isset($params[3]) && $params[3] != '') {$threshold = strtolower($params[3]);}else{$threshold = get_gedcom_setting($this->_ged_id, 'COMMON_NAMES_THRESHOLD');} - if (isset($params[4]) && $params[4] != '') {$maxtoshow = strtolower($params[4]);}else{$maxtoshow = 7;} + if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);} else {$size = $WT_STATS_S_CHART_X."x".$WT_STATS_S_CHART_Y;} + if (isset($params[1]) && $params[1] != '') {$color_from = strtolower($params[1]);} else {$color_from = $WT_STATS_CHART_COLOR1;} + if (isset($params[2]) && $params[2] != '') {$color_to = strtolower($params[2]);} else {$color_to = $WT_STATS_CHART_COLOR2;} + if (isset($params[3]) && $params[3] != '') {$threshold = strtolower($params[3]);} else {$threshold = get_gedcom_setting($this->_ged_id, 'COMMON_NAMES_THRESHOLD');} + if (isset($params[4]) && $params[4] != '') {$maxtoshow = strtolower($params[4]);} else {$maxtoshow = 7;} $sizes = explode('x', $size); $tot_indi = $this->totalIndividuals(); $surnames = get_common_surnames($threshold); @@ -3383,9 +3383,9 @@ class stats { static $sort_types = array('count'=>'asort', 'rcount'=>'arsort', 'alpha'=>'ksort', 'ralpha'=>'krsort'); static $sort_flags = array('count'=>SORT_NUMERIC, 'rcount'=>SORT_NUMERIC, 'alpha'=>SORT_STRING, 'ralpha'=>SORT_STRING); - if(is_array($params) && isset($params[0]) && $params[0] != '' && $params[0] >= 0){$threshold = strtolower($params[0]);}else{$threshold = 1;} - if(is_array($params) && isset($params[1]) && $params[1] != '' && $params[1] >= 0){$maxtoshow = strtolower($params[1]);}else{$maxtoshow = 10;} - if(is_array($params) && isset($params[2]) && $params[2] != '' && isset($sort_types[strtolower($params[2])])){$sorting = strtolower($params[2]);}else{$sorting = 'rcount';} + if (is_array($params) && isset($params[0]) && $params[0] != '' && $params[0] >= 0) {$threshold = strtolower($params[0]);} else {$threshold = 1;} + if (is_array($params) && isset($params[1]) && $params[1] != '' && $params[1] >= 0) {$maxtoshow = strtolower($params[1]);} else {$maxtoshow = 10;} + if (is_array($params) && isset($params[2]) && $params[2] != '' && isset($sort_types[strtolower($params[2])])) {$sorting = strtolower($params[2]);} else {$sorting = 'rcount';} switch ($sex) { case 'M': @@ -3426,7 +3426,7 @@ class stats { if ($type=='chart') return $nameList; $common = array(); foreach ($nameList as $given=>$total) { - if ($maxtoshow !== -1) {if($maxtoshow-- <= 0){break;}} + if ($maxtoshow !== -1) {if ($maxtoshow-- <= 0) {break;}} if ($total < $threshold) {break;} if ($show_tot) { $tot = PrintReady("[{$total}]"); @@ -3468,38 +3468,38 @@ class stats { } } - static function commonGiven($params=array(1,10,'alpha')){return self::_commonGivenQuery('B', 'nolist', false, $params);} - static function commonGivenTotals($params=array(1,10,'rcount')){return self::_commonGivenQuery('B', 'nolist', true, $params);} - static function commonGivenList($params=array(1,10,'alpha')){return self::_commonGivenQuery('B', 'list', false, $params);} - static function commonGivenListTotals($params=array(1,10,'rcount')){return self::_commonGivenQuery('B', 'list', true, $params);} - static function commonGivenTable($params=array(1,10,'rcount')){return self::_commonGivenQuery('B', 'table', false, $params);} + static function commonGiven($params=array(1,10,'alpha')) {return self::_commonGivenQuery('B', 'nolist', false, $params);} + static function commonGivenTotals($params=array(1,10,'rcount')) {return self::_commonGivenQuery('B', 'nolist', true, $params);} + static function commonGivenList($params=array(1,10,'alpha')) {return self::_commonGivenQuery('B', 'list', false, $params);} + static function commonGivenListTotals($params=array(1,10,'rcount')) {return self::_commonGivenQuery('B', 'list', true, $params);} + static function commonGivenTable($params=array(1,10,'rcount')) {return self::_commonGivenQuery('B', 'table', false, $params);} - static function commonGivenFemale($params=array(1,10,'alpha')){return self::_commonGivenQuery('F', 'nolist', false, $params);} - static function commonGivenFemaleTotals($params=array(1,10,'rcount')){return self::_commonGivenQuery('F', 'nolist', true, $params);} - static function commonGivenFemaleList($params=array(1,10,'alpha')){return self::_commonGivenQuery('F', 'list', false, $params);} - static function commonGivenFemaleListTotals($params=array(1,10,'rcount')){return self::_commonGivenQuery('F', 'list', true, $params);} - static function commonGivenFemaleTable($params=array(1,10,'rcount')){return self::_commonGivenQuery('F', 'table', false, $params);} + static function commonGivenFemale($params=array(1,10,'alpha')) {return self::_commonGivenQuery('F', 'nolist', false, $params);} + static function commonGivenFemaleTotals($params=array(1,10,'rcount')) {return self::_commonGivenQuery('F', 'nolist', true, $params);} + static function commonGivenFemaleList($params=array(1,10,'alpha')) {return self::_commonGivenQuery('F', 'list', false, $params);} + static function commonGivenFemaleListTotals($params=array(1,10,'rcount')) {return self::_commonGivenQuery('F', 'list', true, $params);} + static function commonGivenFemaleTable($params=array(1,10,'rcount')) {return self::_commonGivenQuery('F', 'table', false, $params);} - static function commonGivenMale($params=array(1,10,'alpha')){return self::_commonGivenQuery('M', 'nolist', false, $params);} - static function commonGivenMaleTotals($params=array(1,10,'rcount')){return self::_commonGivenQuery('M', 'nolist', true, $params);} - static function commonGivenMaleList($params=array(1,10,'alpha')){return self::_commonGivenQuery('M', 'list', false, $params);} - static function commonGivenMaleListTotals($params=array(1,10,'rcount')){return self::_commonGivenQuery('M', 'list', true, $params);} - static function commonGivenMaleTable($params=array(1,10,'rcount')){return self::_commonGivenQuery('M', 'table', false, $params);} + static function commonGivenMale($params=array(1,10,'alpha')) {return self::_commonGivenQuery('M', 'nolist', false, $params);} + static function commonGivenMaleTotals($params=array(1,10,'rcount')) {return self::_commonGivenQuery('M', 'nolist', true, $params);} + static function commonGivenMaleList($params=array(1,10,'alpha')) {return self::_commonGivenQuery('M', 'list', false, $params);} + static function commonGivenMaleListTotals($params=array(1,10,'rcount')) {return self::_commonGivenQuery('M', 'list', true, $params);} + static function commonGivenMaleTable($params=array(1,10,'rcount')) {return self::_commonGivenQuery('M', 'table', false, $params);} - static function commonGivenUnknown($params=array(1,10,'alpha')){return self::_commonGivenQuery('U', 'nolist', false, $params);} - static function commonGivenUnknownTotals($params=array(1,10,'rcount')){return self::_commonGivenQuery('U', 'nolist', true, $params);} - static function commonGivenUnknownList($params=array(1,10,'alpha')){return self::_commonGivenQuery('U', 'list', false, $params);} - static function commonGivenUnknownListTotals($params=array(1,10,'rcount')){return self::_commonGivenQuery('U', 'list', true, $params);} - static function commonGivenUnknownTable($params=array(1,10,'rcount')){return self::_commonGivenQuery('U', 'table', false, $params);} + static function commonGivenUnknown($params=array(1,10,'alpha')) {return self::_commonGivenQuery('U', 'nolist', false, $params);} + static function commonGivenUnknownTotals($params=array(1,10,'rcount')) {return self::_commonGivenQuery('U', 'nolist', true, $params);} + static function commonGivenUnknownList($params=array(1,10,'alpha')) {return self::_commonGivenQuery('U', 'list', false, $params);} + static function commonGivenUnknownListTotals($params=array(1,10,'rcount')) {return self::_commonGivenQuery('U', 'list', true, $params);} + static function commonGivenUnknownTable($params=array(1,10,'rcount')) {return self::_commonGivenQuery('U', 'table', false, $params);} function chartCommonGiven($params=null) { global $WT_STATS_CHART_COLOR1, $WT_STATS_CHART_COLOR2, $WT_STATS_S_CHART_X, $WT_STATS_S_CHART_Y; if ($params === null) {$params = array();} - if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);}else{$size = $WT_STATS_S_CHART_X."x".$WT_STATS_S_CHART_Y;} - if (isset($params[1]) && $params[1] != '') {$color_from = strtolower($params[1]);}else{$color_from = $WT_STATS_CHART_COLOR1;} - if (isset($params[2]) && $params[2] != '') {$color_to = strtolower($params[2]);}else{$color_to = $WT_STATS_CHART_COLOR2;} - if (isset($params[3]) && $params[3] != '') {$threshold = strtolower($params[3]);}else{$threshold = get_gedcom_setting($this->_ged_id, 'COMMON_NAMES_THRESHOLD');} - if (isset($params[4]) && $params[4] != '') {$maxtoshow = strtolower($params[4]);}else{$maxtoshow = 7;} + if (isset($params[0]) && $params[0] != '') {$size = strtolower($params[0]);} else {$size = $WT_STATS_S_CHART_X."x".$WT_STATS_S_CHART_Y;} + if (isset($params[1]) && $params[1] != '') {$color_from = strtolower($params[1]);} else {$color_from = $WT_STATS_CHART_COLOR1;} + if (isset($params[2]) && $params[2] != '') {$color_to = strtolower($params[2]);} else {$color_to = $WT_STATS_CHART_COLOR2;} + if (isset($params[3]) && $params[3] != '') {$threshold = strtolower($params[3]);} else {$threshold = get_gedcom_setting($this->_ged_id, 'COMMON_NAMES_THRESHOLD');} + if (isset($params[4]) && $params[4] != '') {$maxtoshow = strtolower($params[4]);} else {$maxtoshow = 7;} $sizes = explode('x', $size); $tot_indi = $this->totalIndividuals(); $given = self::_commonGivenQuery('B', 'chart'); @@ -3601,11 +3601,11 @@ class stats { $visible = 0; $x = get_logged_in_users(); foreach ($x as $user_id=>$user_name) { - if (WT_USER_IS_ADMIN || get_user_setting($user_id, 'visibleonline')) {$visible++;}else{$anon++;} + if (WT_USER_IS_ADMIN || get_user_setting($user_id, 'visibleonline')) {$visible++;} else {$anon++;} } if ($type == 'anon') {return $anon;} elseif ($type == 'visible') {return $visible;} - else{return $visible + $anon;} + else {return $visible + $anon;} } static function usersLoggedIn() {return self::_usersLoggedIn('nolist');} @@ -3636,24 +3636,24 @@ class stats { case 'fullname': return getUserFullName($user_id); case 'regdate': - if(is_array($params) && isset($params[0]) && $params[0] != ''){$datestamp = $params[0];}else{$datestamp = $DATE_FORMAT;} + if (is_array($params) && isset($params[0]) && $params[0] != '') {$datestamp = $params[0];} else {$datestamp = $DATE_FORMAT;} return timestamp_to_gedcom_date(get_user_setting($user_id, 'reg_timestamp'))->Display(false, $datestamp); case 'regtime': - if(is_array($params) && isset($params[0]) && $params[0] != ''){$datestamp = $params[0];}else{$datestamp = str_replace('%', '', $TIME_FORMAT);} + if (is_array($params) && isset($params[0]) && $params[0] != '') {$datestamp = $params[0];} else {$datestamp = str_replace('%', '', $TIME_FORMAT);} return date($datestamp, get_user_setting($user_id, 'reg_timestamp')); case 'loggedin': - if(is_array($params) && isset($params[0]) && $params[0] != ''){$yes = $params[0];}else{$yes = i18n::translate('Yes');} - if(is_array($params) && isset($params[1]) && $params[1] != ''){$no = $params[1];}else{$no = i18n::translate('No');} + if (is_array($params) && isset($params[0]) && $params[0] != '') {$yes = $params[0];} else {$yes = i18n::translate('Yes');} + if (is_array($params) && isset($params[1]) && $params[1] != '') {$no = $params[1];} else {$no = i18n::translate('No');} return WT_DB::prepare("SELECT 1 FROM `##session` WHERE user_id=? LIMIT 1")->execute(array($user_id))->fetchOne() ? $yes : $no; } } - static function latestUserId(){return self::_getLatestUserData('userid');} - static function latestUserName(){return self::_getLatestUserData('username');} - static function latestUserFullName(){return self::_getLatestUserData('fullname');} - static function latestUserRegDate($params=null){return self::_getLatestUserData('regdate', $params);} - static function latestUserRegTime($params=null){return self::_getLatestUserData('regtime', $params);} - static function latestUserLoggedin($params=null){return self::_getLatestUserData('loggedin', $params);} + static function latestUserId() {return self::_getLatestUserData('userid');} + static function latestUserName() {return self::_getLatestUserData('username');} + static function latestUserFullName() {return self::_getLatestUserData('fullname');} + static function latestUserRegDate($params=null) {return self::_getLatestUserData('regdate', $params);} + static function latestUserRegTime($params=null) {return self::_getLatestUserData('regtime', $params);} + static function latestUserLoggedin($params=null) {return self::_getLatestUserData('loggedin', $params);} /////////////////////////////////////////////////////////////////////////////// // Contact // @@ -3764,11 +3764,11 @@ class stats { return ob_get_clean(); } - static function gedcomFavorites(){return self::_getFavorites(true);} - static function userFavorites(){return self::_getFavorites(false);} + static function gedcomFavorites() {return self::_getFavorites(true);} + static function userFavorites() {return self::_getFavorites(false);} - static function totalGedcomFavorites(){return count(gedcom_favorites_WT_Module::getUserFavorites(WT_GEDCOM));} - static function totalUserFavorites(){return count(user_favorites_WT_Module::getUserFavorites(WT_USER_NAME));} + static function totalGedcomFavorites() {return count(gedcom_favorites_WT_Module::getUserFavorites(WT_GEDCOM));} + static function totalUserFavorites() {return count(user_favorites_WT_Module::getUserFavorites(WT_USER_NAME));} /////////////////////////////////////////////////////////////////////////////// // Other blocks // @@ -3777,8 +3777,8 @@ class stats { static function callBlock($params=null) { global $ctype; - if ($params === null){return '';} - if (isset($params[0]) && $params[0] != ''){$block = $params[0];}else{return '';} + if ($params === null) {return '';} + if (isset($params[0]) && $params[0] != '') {$block = $params[0];} else {return '';} $all_blocks=array(); foreach (WT_Module::getActiveBlocks() as $name=>$active_block) { if ($ctype=='user' && $active_block->isUserBlock() || $ctype=='gedcom' && $active_block->isGedcomBlock()) { @@ -3792,7 +3792,7 @@ class stats { $cfg = array(); foreach ($params as $config) { $bits = explode('=', $config); - if(count($bits) < 2){continue;} + if (count($bits) < 2) {continue;} $v = array_shift($bits); $cfg[$v] = join('=', $bits); } @@ -3802,7 +3802,7 @@ class stats { return $content; } - function totalUserMessages(){return count(getUserMessages(WT_USER_NAME));} - function totalUserJournal(){ return count(getUserNews(WT_USER_ID));} - function totalGedcomNews(){ return count(getUserNews(WT_GEDCOM));} + function totalUserMessages() {return count(getUserMessages(WT_USER_NAME));} + function totalUserJournal() { return count(getUserNews(WT_USER_ID));} + function totalGedcomNews() { return count(getUserNews(WT_GEDCOM));} } diff --git a/includes/classes/class_treenav.php b/includes/classes/class_treenav.php index 1d383d6b5b..4e2363ae25 100644 --- a/includes/classes/class_treenav.php +++ b/includes/classes/class_treenav.php @@ -81,7 +81,7 @@ class TreeNav { $this->drawViewport($rootid, $w, $h); $output = ob_get_clean(); $lines = preg_split("/\r?\n/", $output); - foreach($lines as $line) + foreach ($lines as $line) echo "document.writeln('".str_replace("'", "\\'", $line)."');"; exit; } @@ -265,7 +265,7 @@ class TreeNav { } else { $fams = $person->getSpouseFamilies(); - foreach($fams as $fam) { + foreach ($fams as $fam) { $families[] = $fam; } } @@ -273,7 +273,7 @@ class TreeNav { else { if ($this->allSpouses) { $fams = $person->getSpouseFamilies(); - foreach($fams as $fam) { + foreach ($fams as $fam) { $families[] = $fam; } } @@ -320,7 +320,7 @@ class TreeNav { </div> <br /> <span class="name1"><?php - foreach($families as $family) { + foreach ($families as $family) { if (!empty($family)) $spouse = $family->getSpouse($person); if (!empty($spouse)) { $name = $spouse->getFullName(); @@ -376,7 +376,7 @@ class TreeNav { function drawChildren(&$family, $gen=2) { if (!empty($family) && $gen>0) { $children = $family->getChildren(); - foreach($children as $ci=>$child) { + foreach ($children as $ci=>$child) { $fam = null; $this->drawPerson($child, $gen-1, -1, $fam); } @@ -391,10 +391,10 @@ class TreeNav { function drawAllChildren(&$person, $gen=2) { if (!empty($person) && $gen>0) { $fams = $person->getSpouseFamilies(); - foreach($fams as $famid=>$family) { + foreach ($fams as $famid=>$family) { $children = $family->getChildren(); $indichilds = array(); - foreach($children as $ci=>$child) { + foreach ($children as $ci=>$child) { if (!in_array($child, $indichilds)) { $fam = null; $this->drawPersonAllSpouses($child, $gen-1, -1); @@ -468,7 +468,7 @@ class TreeNav { $fams = $person->getSpouseFamilies(); $fams = array_reverse($fams); //-- find the last spouse family that has a known spouse - foreach($fams as $family) { + foreach ($fams as $family) { if (!empty($family)) $spouse = $family->getSpouse($person); if (!empty($spouse)) { $mcfamily = $spouse->getPrimaryChildFamily(); @@ -511,7 +511,7 @@ class TreeNav { ?><br /> <?php $fams = $person->getSpouseFamilies(); - foreach($fams as $famid=>$family) { + foreach ($fams as $famid=>$family) { $spouse = $family->getSpouse($person); if (!is_null($spouse)) { $name = $spouse->getFullName(); @@ -545,7 +545,7 @@ class TreeNav { </tr> <?php $fams = $person->getSpouseFamilies(); - foreach($fams as $famid=>$family) { + foreach ($fams as $famid=>$family) { $spouse = $family->getSpouse($person); $mother = null; if ($spouse!=null) { diff --git a/includes/controllers/advancedsearch_ctrl.php b/includes/controllers/advancedsearch_ctrl.php index 9637d2fbab..5f3a189927 100644 --- a/includes/controllers/advancedsearch_ctrl.php +++ b/includes/controllers/advancedsearch_ctrl.php @@ -139,7 +139,7 @@ class AdvancedSearchController extends SearchController { $newvalues = array(); $newplus = array(); $rels = array(); - foreach($this->fields as $j=>$field) { + foreach ($this->fields as $j=>$field) { if (strpos($this->fields[$j], "FAMC:HUSB:NAME")===0 || strpos($this->fields[$j], "FAMC:WIFE:NAME")===0) { $rels[$this->fields[$j]] = $this->values[$j]; continue; @@ -152,7 +152,7 @@ class AdvancedSearchController extends SearchController { $this->fields = $newfields; $this->values = $newvalues; $this->plusminus = $newplus; - foreach($rels as $field=>$value) { + foreach ($rels as $field=>$value) { $this->fields[] = $field; $this->values[] = $value; } @@ -178,7 +178,7 @@ class AdvancedSearchController extends SearchController { $sqltables = " FROM `##".$table."`"; $sqlwhere = " WHERE ".$prefix."_file=".WT_GED_ID; $keepfields = $this->fields; - for($i=0; $i<$fct; $i++) { + for ($i=0; $i<$fct; $i++) { $field = $this->fields[$i]; if (empty($field)) continue; $value=''; @@ -324,7 +324,7 @@ class AdvancedSearchController extends SearchController { } //-- alter the fields and recurse to generate a subquery for spouse/parent fields $oldfields = $this->fields; - for($j=0; $j<$fct; $j++) { + for ($j=0; $j<$fct; $j++) { //-- if it doesn't start with FAMS or FAMC then remove that field if (preg_match("/^".$parts[0].":/", $this->fields[$j])==0) { $this->fields[$j]=''; @@ -336,7 +336,7 @@ class AdvancedSearchController extends SearchController { $sqlwhere .= " AND ROW(FAMS.f_id, FAMS.f_file) IN (".$subsql.")"; $this->fields = $oldfields; //-- remove all of the fam fields so they don't show up again - for($j=0; $j<$fct; $j++) { + for ($j=0; $j<$fct; $j++) { //-- if it does start with FAMS or FAMC then remove that field if (preg_match("/^".$parts[0].":/", $this->fields[$j])>0) { $this->fields[$j]=''; @@ -351,7 +351,7 @@ class AdvancedSearchController extends SearchController { } //-- alter the fields and recurse to generate a subquery for spouse/parent fields $oldfields = $this->fields; - for($j=0; $j<$fct; $j++) { + for ($j=0; $j<$fct; $j++) { //-- if it doesn't start with FAMS or FAMC then remove that field if (preg_match("/^".$parts[0].":/", $this->fields[$j])==0) { $this->fields[$j]=''; @@ -363,7 +363,7 @@ class AdvancedSearchController extends SearchController { $sqlwhere .= " AND ROW(FAMC.f_id, FAMC.f_file) IN (".$subsql.")"; $this->fields = $oldfields; //-- remove all of the fam fields so they don't show up again - for($j=0; $j<$fct; $j++) { + for ($j=0; $j<$fct; $j++) { //-- if it does start with FAMS or FAMC then remove that field if (preg_match("/^".$parts[0].":/", $this->fields[$j])>0) { $this->fields[$j]=''; @@ -378,7 +378,7 @@ class AdvancedSearchController extends SearchController { } //-- alter the fields and recurse to generate a subquery for spouse/parent fields $oldfields = $this->fields; - for($j=0; $j<$fct; $j++) { + for ($j=0; $j<$fct; $j++) { //-- if it doesn't start with FAMS or FAMC then remove that field if (preg_match("/^".$parts[0].":/", $this->fields[$j])==0) { $this->fields[$j]=''; @@ -390,7 +390,7 @@ class AdvancedSearchController extends SearchController { if ($parts[0]=='WIFE') $sqlwhere .= " AND ROW(f_wife, f_file) IN (".$subsql.")"; $this->fields = $oldfields; //-- remove all of the fam fields so they don't show up again - for($j=0; $j<$fct; $j++) { + for ($j=0; $j<$fct; $j++) { //-- if it does start with HUSB or WIFE then remove that field if (preg_match("/^".$parts[0].":/", $this->fields[$j])>0) { $this->fields[$j]=''; @@ -403,7 +403,7 @@ class AdvancedSearchController extends SearchController { $ct = count($parts); $liketmp=''; - for($j=0; $j<$ct; $j++) { + for ($j=0; $j<$ct; $j++) { $liketmp.= "%".($j+1)." ".$parts[$j]." %"; //if ($j<$ct-1) { //$sqlwhere .= "%"; @@ -418,7 +418,7 @@ class AdvancedSearchController extends SearchController { //echo $sql; if ($justSql) return $sql; $rows=WT_DB::prepare($sql)->fetchAll(PDO::FETCH_ASSOC); - foreach ($rows as $row){ + foreach ($rows as $row) { $row['xref']=$row['i_id']; $row['ged_id']=$row['i_file']; $row['type'] = 'INDI'; diff --git a/includes/controllers/ancestry_ctrl.php b/includes/controllers/ancestry_ctrl.php index ee3a4960e8..d0de373820 100644 --- a/includes/controllers/ancestry_ctrl.php +++ b/includes/controllers/ancestry_ctrl.php @@ -140,7 +140,7 @@ class AncestryController extends BaseController { $parents = false; $famrec = ""; $famid = ""; - foreach($famids as $famid=>$family) { + foreach ($famids as $famid=>$family) { if (!is_null($family)) { $famrec = $family->getGedcomRecord(); $parents = find_parents_in_record($famrec); diff --git a/includes/controllers/descendancy_ctrl.php b/includes/controllers/descendancy_ctrl.php index 353014206c..a3de123406 100644 --- a/includes/controllers/descendancy_ctrl.php +++ b/includes/controllers/descendancy_ctrl.php @@ -128,7 +128,7 @@ class DescendancyController extends BaseController { if (is_null($person)) return; $families = $person->getSpouseFamilies(); if ($depth<2) return; - foreach($families as $famid => $family) { + foreach ($families as $famid => $family) { print_sosa_family($family->getXref(), "", -1, $label, $person->getXref(), $gpid, $personcount); $personcount++; $children = $family->getChildren(); @@ -164,7 +164,7 @@ function print_child_descendancy(&$person, $depth) { echo "<td> </td>"; echo "<td>"; $sfamids = $person->getChildFamilies(); - foreach($sfamids as $famid => $family) { + foreach ($sfamids as $famid => $family) { $parents = find_parents($famid); if ($parents) { $parid=$parents["HUSB"]; @@ -250,7 +250,7 @@ function print_family_descendancy(&$person, &$family, $depth) { echo "<td> </td>"; echo "<td>"; $sfamids = find_family_ids($id); - foreach($sfamids as $indexval => $sfamid) { + foreach ($sfamids as $indexval => $sfamid) { $parents = find_parents($sfamid); if ($parents) { $parid=$parents["HUSB"]; diff --git a/includes/controllers/family_ctrl.php b/includes/controllers/family_ctrl.php index 92c573848a..c3e39f4bbb 100644 --- a/includes/controllers/family_ctrl.php +++ b/includes/controllers/family_ctrl.php @@ -75,10 +75,10 @@ class FamilyController extends BaseController { } } //-- if no record was found create a default empty one - if (find_updated_record($this->famid, WT_GED_ID)!==null){ + if (find_updated_record($this->famid, WT_GED_ID)!==null) { $this->famrec = "0 @".$this->famid."@ FAM\n"; $this->family = new Family($this->famrec); - } else if (!$this->family){ + } else if (!$this->family) { return false; } } @@ -256,7 +256,7 @@ class FamilyController extends BaseController { // Produce the submenus in localized name order - foreach($menuList as $menuType => $menuName) { + foreach ($menuList as $menuType => $menuName) { switch ($menuType) { case "parentTimeLine": // charts / parents_timeline diff --git a/includes/controllers/hourglass_ctrl.php b/includes/controllers/hourglass_ctrl.php index c2c8ce782a..cb7f78df8b 100644 --- a/includes/controllers/hourglass_ctrl.php +++ b/includes/controllers/hourglass_ctrl.php @@ -135,7 +135,7 @@ class HourglassController extends BaseController { $families = $person->getChildFamilies(); //-- calculate how tall the lines should be $lh = ($bhalfheight+3) * pow(2, ($this->generations-$count-1)); - foreach($families as $famid => $family) { + foreach ($families as $famid => $family) { echo "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"empty-cells: show;\">"; $parents = find_parents($famid); $height="100%"; @@ -220,16 +220,16 @@ class HourglassController extends BaseController { $children = array(); if ($count < $this->dgenerations) { //-- put all of the children in a common array - foreach($families as $famid => $family) { + foreach ($families as $famid => $family) { $famNum ++; $chs = $family->getChildren(); - foreach($chs as $c=>$child) $children[] = $child; + foreach ($chs as $c=>$child) $children[] = $child; } $ct = count($children); if ($ct>0) { echo "<table style=\"position: relative; top: auto; text-align: $tablealign;\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">"; - for($i=0; $i<$ct; $i++) { + for ($i=0; $i<$ct; $i++) { if (($i>0)&&($i<$ct-1)) $rowspan=1; /* @var $person2 Person */ $person2 = $children[$i]; @@ -273,18 +273,18 @@ class HourglassController extends BaseController { if ($count==$this->dgenerations) { $numkids = 1; $tbwidth = $bwidth+16; - for($j=$count; $j<$this->dgenerations; $j++) { + for ($j=$count; $j<$this->dgenerations; $j++) { echo "<div style=\"width: ".($tbwidth)."px;\"><br /></div></td><td width=\"$bwidth\">"; } $kcount = 0; - foreach($families as $famid=>$family) $kcount+=$family->getNumberOfChildren(); + foreach ($families as $famid=>$family) $kcount+=$family->getNumberOfChildren(); if ($kcount==0) { echo "<div style=\"width: ".($this->arrwidth)."px;\"><br /></div></td><td width=\"$bwidth\">"; } else { echo "<div style=\"width: ".($this->arrwidth)."px;\"><a href=\"$pid\" onclick=\"return ChangeDis('td_".$pid."','".$pid."','".$this->show_full."','".$this->show_spouse."','".$this->box_width."')\"><img src=\"".$WT_IMAGES["larrow"]."\" border=\"0\" alt=\"\" /></a></div>"; //-- move the arrow up to line up with the correct box if ($this->show_spouse) { - foreach($families as $famid => $family) { + foreach ($families as $famid => $family) { /* @var $family Family */ if (!is_null($family)) { $spouse = $family->getSpouse($person); @@ -304,7 +304,7 @@ class HourglassController extends BaseController { //----- Print the spouse if ($this->show_spouse) { - foreach($families as $famid => $family) { + foreach ($families as $famid => $family) { /* @var $family Family */ if (!is_null($family)) { $spouse = $family->getSpouse($person); @@ -337,7 +337,7 @@ class HourglassController extends BaseController { //-- make sure there is more than 1 child in the family with parents $cfamids = $person->getChildFamilies(); $num=0; - foreach($cfamids as $famid=>$family) { + foreach ($cfamids as $famid=>$family) { if (!is_null($family)) { $num += $family->getNumberOfChildren(); } @@ -352,7 +352,7 @@ class HourglassController extends BaseController { echo "<div id=\"childbox\" dir=\"".$TEXT_DIRECTION."\" style=\"width:".$bwidth."px; height:".$bheight."px; visibility: hidden;\">"; echo "<table class=\"person_box\"><tr><td>"; - foreach($famids as $famid=>$family) { + foreach ($famids as $famid=>$family) { if (!is_null($family)) { $spouse = $family->getSpouse($person); if (!empty($spouse)) { @@ -369,7 +369,7 @@ class HourglassController extends BaseController { } $children = $family->getChildren(); - foreach($children as $id=>$child) { + foreach ($children as $id=>$child) { $cid = $child->getXref(); echo " <a href=\"hourglass.php?pid={$cid}&show_spouse={$this->show_spouse}&show_full={$this->show_full}&generations={$this->generations}&box_width={$this->box_width}\"><span "; $name = $child->getFullName(); @@ -388,9 +388,9 @@ class HourglassController extends BaseController { echo "<img src=\"".$WT_IMAGES["rarrow"]."\" border=\"0\" alt=\"\" /> "; //-- print the siblings - foreach($cfamids as $famid=>$family) { + foreach ($cfamids as $famid=>$family) { if (!is_null($family)) { - if(!is_null($family->getHusband()) || !is_null($family->getWife())) { + if (!is_null($family->getHusband()) || !is_null($family->getWife())) { echo "<span class=\"name1\"><br />".i18n::translate('Parents')."<br /></span>"; $husb = $family->getHusband(); if (!empty($husb)) { @@ -421,7 +421,7 @@ class HourglassController extends BaseController { $num = $family->getNumberOfChildren(); if ($num>2) echo "<span class=\"name1\"><br />".i18n::translate('Siblings')."<br /></span>"; if ($num==2) echo "<span class=\"name1\"><br />".i18n::translate('Sibling')."<br /></span>"; - foreach($children as $id=>$child) { + foreach ($children as $id=>$child) { $cid = $child->getXref(); if ($cid!=$pid) { echo " <a href=\"hourglass.php?pid={$cid}&show_spouse={$this->show_spouse}&show_full={$this->show_full}&generations={$this->generations}&box_width={$this->box_width}\"><span "; @@ -463,9 +463,9 @@ class HourglassController extends BaseController { $famids = $person->getSpouseFamilies(); if ($person->getNumberOfChildren()==0) return $depth-1; $maxdc = $depth; - foreach($famids as $famid => $family){ + foreach ($famids as $famid => $family) { $ct = preg_match_all("/1 CHIL @(.*)@/", $family->getGedcomRecord(), $match, PREG_SET_ORDER); - for($i=0; $i<$ct; $i++) { + for ($i=0; $i<$ct; $i++) { $chil = trim($match[$i][1]); $dc = $this->max_descendency_generations($chil, $depth+1); if ($dc >= $this->generations) return $dc; @@ -529,7 +529,7 @@ class HourglassController extends BaseController { function sizeLines() { var vlines; vlines = document.getElementsByName("tvertline"); - for(i=0; i < vlines.length; i++) { + for (i=0; i < vlines.length; i++) { var pid = vlines[i].id.substr(vlines[i].id.indexOf("_")+1); var hline = document.getElementById("table_"+pid); var hline2 = document.getElementById("table2_"+pid); @@ -538,7 +538,7 @@ class HourglassController extends BaseController { } vlines = document.getElementsByName("bvertline"); - for(i=0; i < vlines.length; i++) { + for (i=0; i < vlines.length; i++) { var pid = vlines[i].id.substr(vlines[i].id.indexOf("_")+1); var hline = document.getElementById("table_"+pid); var hline2 = document.getElementById("table2_"+pid); @@ -547,7 +547,7 @@ class HourglassController extends BaseController { vlines = document.getElementsByName("pvline"); //alert(vlines[0].parentNode.parentNode.parentNode); - for(i=0; i < vlines.length; i++) { + for (i=0; i < vlines.length; i++) { //vlines[i].parentNode.style.height="50%"; vlines[i].style.height=(vlines[i].parentNode.offsetHeight/2)+'px'; } diff --git a/includes/controllers/individual_ctrl.php b/includes/controllers/individual_ctrl.php index 8200b445f0..43dd2b676e 100644 --- a/includes/controllers/individual_ctrl.php +++ b/includes/controllers/individual_ctrl.php @@ -93,10 +93,10 @@ class IndividualController extends BaseController { $this->default_tab=get_gedcom_setting(WT_GED_ID, 'GEDCOM_DEFAULT_TAB'); } - if (find_person_record($this->pid, WT_GED_ID) || find_updated_record($this->pid, WT_GED_ID)!==null){ + if (find_person_record($this->pid, WT_GED_ID) || find_updated_record($this->pid, WT_GED_ID)!==null) { $this->indi = new Person($gedrec, false); $this->indi->ged_id=WT_GED_ID; // This record is from a file - } else if (!$this->indi){ + } else if (!$this->indi) { return false; } @@ -197,7 +197,7 @@ class IndividualController extends BaseController { // Initialise tabs $this->tabs = WT_Module::getActiveTabs(); - foreach($this->tabs as $mod) { + foreach ($this->tabs as $mod) { $mod->setController($this); if ($mod->hasTabContent()) { if (empty($this->default_tab)) { @@ -384,7 +384,7 @@ class IndividualController extends BaseController { echo '</dl>'; echo '</div>'; $ct = preg_match_all('/\n2 (\w+) (.*)/', $factrec, $nmatch, PREG_SET_ORDER); - for($i=0; $i<$ct; $i++) { + for ($i=0; $i<$ct; $i++) { echo '<div>'; $fact = trim($nmatch[$i][1]); if (($fact!="SOUR")&&($fact!="NOTE")&&($fact!="GIVN")&&($fact!="SURN")&&($fact!="SPFX")) { @@ -678,7 +678,7 @@ class IndividualController extends BaseController { $labels["sister"] = i18n::translate('Sister'); $labels["brother"] = i18n::translate('Brother'); } - if ($type=="step"){ + if ($type=="step") { $labels["parent"] = i18n::translate('Step-Parent'); $labels["mother"] = i18n::translate('Step-Mother'); $labels["father"] = i18n::translate('Step-Father'); @@ -733,7 +733,7 @@ class IndividualController extends BaseController { //-- step families : set the label for the common parent if ($type=="step") { $fams = $this->indi->getChildFamilies(); - foreach($fams as $key=>$fam) { + foreach ($fams as $key=>$fam) { if ($fam->hasParent($husb)) $labels["father"] = i18n::translate('Father'); if ($fam->hasParent($wife)) $labels["mother"] = i18n::translate('Mother'); } @@ -801,11 +801,11 @@ class IndividualController extends BaseController { $merged_children = array(); $new_children = $newfamily->getChildren(); $num = count($children); - for($i=0; $i<$num; $i++) { + for ($i=0; $i<$num; $i++) { $child = $children[$i]; if (!is_null($child)) { $found = false; - foreach($new_children as $key=>$newchild) { + foreach ($new_children as $key=>$newchild) { if (!is_null($newchild)) { if ($child->equals($newchild)) { $found = true; @@ -817,10 +817,10 @@ class IndividualController extends BaseController { else $merged_children[] = $child; } } - foreach($new_children as $key=>$newchild) { + foreach ($new_children as $key=>$newchild) { if (!is_null($newchild)) { $found = false; - foreach($children as $key1=>$child) { + foreach ($children as $key1=>$child) { if (!is_null($child)) { if ($child->equals($newchild)) { $found = true; @@ -836,7 +836,7 @@ class IndividualController extends BaseController { } //-- set the labels for the children $num = count($children); - for($i=0; $i<$num; $i++) { + for ($i=0; $i<$num; $i++) { if (!is_null($children[$i])) { $label = $labels["sibling"]; $sex = $children[$i]->getSex(); @@ -860,7 +860,7 @@ class IndividualController extends BaseController { } } $num = count($newchildren); - for($i=0; $i<$num; $i++) { + for ($i=0; $i<$num; $i++) { $label = $labels["sibling"]; $sex = $newchildren[$i]->getSex(); if ($sex=="F") { @@ -877,7 +877,7 @@ class IndividualController extends BaseController { $newchildren[$i]->setLabel($label); } $num = count($delchildren); - for($i=0; $i<$num; $i++) { + for ($i=0; $i<$num; $i++) { $label = $labels["sibling"]; $sex = $delchildren[$i]->getSex(); if ($sex=="F") { diff --git a/includes/controllers/lifespan_ctrl.php b/includes/controllers/lifespan_ctrl.php index 2f52a9b301..8ab83cd62c 100644 --- a/includes/controllers/lifespan_ctrl.php +++ b/includes/controllers/lifespan_ctrl.php @@ -116,7 +116,7 @@ class LifespanController extends BaseController { } //-- gets the immediate family for the individual being added if the include immediate family checkbox is checked. - if (safe_GET('addFamily', 'yes')=='yes'){ + if (safe_GET('addFamily', 'yes')=='yes') { if (isset($newpid)) $this->addFamily($newpid); } @@ -204,7 +204,7 @@ class LifespanController extends BaseController { $this->timelineMaxYear=max($this->timelineMaxYear, $ddate->gregorianYear() ? $ddate->gregorianYear() : date('Y')); } - if($this->timelineMaxYear > $this->currentYear){ + if ($this->timelineMaxYear > $this->currentYear) { $this->timelineMaxYear = $this->currentYear; } @@ -229,31 +229,31 @@ class LifespanController extends BaseController { $this->pids[] = $newpid; $families = $person->getSpouseFamilies(); //-- foreach gets the spouse and children of the individual. - foreach($families as $famID => $family){ - if($newpid != $family->getHusbId()) { + foreach ($families as $famID => $family) { + if ($newpid != $family->getHusbId()) { if ($gen>0) $this->pids[] = addFamily($family->getHusbId(), $gen-1); else $this->pids[] = $family->getHusbId(); } - if($newpid != $family->getWifeId()) { + if ($newpid != $family->getWifeId()) { if ($gen>0) $this->pids[] = addFamily($family->getWifeId(), $gen-1); else $this->pids[] = $family->getWifeId(); } $children = $family->getChildren(); - foreach($children as $childID => $child){ + foreach ($children as $childID => $child) { if ($gen>0) $this->pids[] = addFamily($child->getXref(), $gen-1); else $this->pids[] = $child->getXref(); } } $families = $person->getChildFamilies(); //-- foreach gets the father, mother and sibblings of the individual. - foreach($families as $famID => $family){ + foreach ($families as $famID => $family) { if ($gen>0) $this->pids[] = addFamily($family->getHusbId(), $gen-1); else $this->pids[] = $family->getHusbId(); if ($gen>0) $this->pids[] = addFamily($family->getWifeId(), $gen-1); else $this->pids[] = $family->getWifeId(); $children = $family->getChildren(); - foreach($children as $childID => $child){ - if($newpid != $child->getXref()) { + foreach ($children as $childID => $child) { + if ($newpid != $child->getXref()) { if ($gen>0) $this->pids[] = addFamily($child->getXref(), $gen-1); else $this->pids[] = $child->getXref(); } @@ -269,7 +269,7 @@ class LifespanController extends BaseController { case 1 : //rounds beginning year $this->birthMod = ($year % 5); $year = $year - ($this->birthMod); - if($temp == $year){ + if ($temp == $year) { $this->modTest = 0; } else $this->modTest = 1; @@ -277,7 +277,7 @@ class LifespanController extends BaseController { case 2 : //rounds end year $this->deathMod = ($year % 5); //Only executed if the year needs to be modified - if($this->deathMod > 0) { + if ($this->deathMod > 0) { $this->endMod = (5 - ($this->deathMod)); } else { @@ -319,7 +319,7 @@ class LifespanController extends BaseController { $rows = array(); $modFix = 0; - if($this->modTest == 1){ + if ($this->modTest == 1) { $modFix = (9 * $this->birthMod); } //base case @@ -329,7 +329,7 @@ class LifespanController extends BaseController { foreach ($ar as $key => $value) { //Creates appropriate color scheme to show relationships $this->currentsex = $value->getSex(); - if ($this->currentsex == "M"){ + if ($this->currentsex == "M") { $this->Mcolorindex++; if (!isset($this->malecolorR[$this->Mcolorindex])) $this->Mcolorindex=0; $this->malecolorR[$this->Mcolorindex]; @@ -338,16 +338,16 @@ class LifespanController extends BaseController { $this->malecolorG[$this->Mcolorindex]; $red = dechex($this->malecolorR[$this->Mcolorindex]); $green =dechex($this->malecolorR[$this->Mcolorindex]); - if(strlen($red)<2){ + if (strlen($red)<2) { $red = "0".$red; } - if(strlen($green)<2){ + if (strlen($green)<2) { $green = "0".$green; } $this->color = "#".$red.$green.dechex($this->malecolorB); } - else if($this->currentsex == "F"){ + else if ($this->currentsex == "F") { $this->Fcolorindex++; if (!isset($this->femalecolorG[$this->Fcolorindex])) $this->Fcolorindex = 0; $this->femalecolorG[$this->Fcolorindex]; @@ -356,7 +356,7 @@ class LifespanController extends BaseController { $this->femalecolorB[$this->Fcolorindex]; $this->color = "#".dechex($this->femalecolorR).dechex($this->femalecolorG[$this->Fcolorindex]).dechex($this->femalecolorB[$this->Fcolorindex]); } - else{ + else { $this->color = $this->colors[$this->colorindex]; } @@ -400,7 +400,7 @@ class LifespanController extends BaseController { $Y = $top; $Z = $zindex; $ready = false; - while(!$ready) { + while (!$ready) { if (!isset($rows[$Y])) { $ready = true; $rows[$Y]["x1"] = $startPos; @@ -437,7 +437,7 @@ class LifespanController extends BaseController { $eventinformation = Array(); $eventspacing = Array(); - foreach($unparsedEvents as $index=>$val) { + foreach ($unparsedEvents as $index=>$val) { $date = $val->getDate(); if (!empty($date)) { $fact = $val->getTag(); @@ -466,7 +466,7 @@ class LifespanController extends BaseController { $ddate=$value->getEstimatedDeathDate(); if ($width > ($minlength +110)) { echo "<div id=\"bar_", $value->getXref(), "\" style=\"position: absolute; top:", $Y, "px; left:", $startPos, "px; width:", $width, "px; height:", $height, "px; background-color:", $this->color, "; border: solid blue 1px; z-index:$Z;\">"; - foreach($eventinformation as $evtwidth=>$val){ + foreach ($eventinformation as $evtwidth=>$val) { echo "<div style=\"position:absolute; left:", $evtwidth, ";\"><a class=\"showit\" href=\"#\" style=\"top:-2px; font-size:10px;\"><b>"; $text = explode("-fact, ", $val); $fact = $text[0]; @@ -494,7 +494,7 @@ class LifespanController extends BaseController { } else { if ($width > $minlength +5) { echo "<div style=\"text-align: left; position: absolute; top:", $Y, "px; left:", $startPos, "px; width:", $width, "px; height:", $height, "px; background-color:", $this->color, "; border: solid blue 1px; z-index:$Z;\">"; - foreach($eventinformation as $evtwidth=>$val){ + foreach ($eventinformation as $evtwidth=>$val) { echo "<div style=\"position:absolute; left:".$evtwidth." \"><a class=\"showit\" href=\"#\" style=\"top:-2px; font-size:10px;\"><b>"; $text = explode("-fact,", $val); $fact = $text[0]; @@ -526,7 +526,7 @@ class LifespanController extends BaseController { echo "<a class=\"showit\" href=\"".$value->getHtmlUrl()."\"><b>"; echo abbreviate_fact('BIRT'); echo "</b><span>".$value->getSexImage().$indiName."<br/>".translate_fact('BIRT')." ".strip_tags($bdate->Display(false))." ".PrintReady($value->getBirthPlace())."<br/>"; - foreach($eventinformation as $evtwidth=>$val){ + foreach ($eventinformation as $evtwidth=>$val) { $text = explode("-fact,", $val); $val = $text[1]; echo $val."<br />"; diff --git a/includes/controllers/media_ctrl.php b/includes/controllers/media_ctrl.php index a860df4fb6..beaa2679b1 100644 --- a/includes/controllers/media_ctrl.php +++ b/includes/controllers/media_ctrl.php @@ -68,10 +68,10 @@ class MediaController extends BaseController{ } //Checks to see if the File Name ($filename) exists - if (!empty($filename)){ + if (!empty($filename)) { //If the File Name ($filename) is set, then it will call the method to get the Media ID ($this->mid) from the File Name ($filename) $this->mid = get_media_id_from_file($filename); - if (!$this->mid){ + if (!$this->mid) { //This will set the Media ID to be false if the File given doesn't match to anything in the database $this->mid = false; // create a very basic gedcom record for this file so that the functions of the media object will work @@ -81,7 +81,7 @@ class MediaController extends BaseController{ } //checks to see if the Media ID ($this->mid) is set. If the Media ID isn't set then there isn't any information avaliable for that picture the picture doesn't exist. - if ($this->mid){ + if ($this->mid) { //This creates a Media Object from the getInstance method of the Media Class. It takes the Media ID ($this->mid) and creates the object. $this->mediaobject = Media::getInstance($this->mid); //This sets the controller ID to be the Media ID @@ -337,9 +337,9 @@ class MediaController extends BaseController{ else $newfacts[] = new Event("1 TYPE ".i18n::translate('Other')); //-- loop through new facts and add them to the list if they are any changes //-- compare new and old facts of the Personal Fact and Details tab 1 - for($i=0; $i<count($facts); $i++) { + for ($i=0; $i<count($facts); $i++) { $found=false; - foreach($newfacts as $indexval => $newfact) { + foreach ($newfacts as $indexval => $newfact) { if (trim($newfact->gedcomRecord)==trim($facts[$i]->gedcomRecord)) { $found=true; break; @@ -349,9 +349,9 @@ class MediaController extends BaseController{ $facts[$i]->gedcomRecord.="\nWT_OLD\n"; } } - foreach($newfacts as $indexval => $newfact) { + foreach ($newfacts as $indexval => $newfact) { $found=false; - foreach($facts as $indexval => $fact) { + foreach ($facts as $indexval => $fact) { if (trim($fact->gedcomRecord)==trim($newfact->gedcomRecord)) { $found=true; break; diff --git a/includes/controllers/pedigree_ctrl.php b/includes/controllers/pedigree_ctrl.php index 8e4af5c92f..19d5bcdd96 100644 --- a/includes/controllers/pedigree_ctrl.php +++ b/includes/controllers/pedigree_ctrl.php @@ -118,7 +118,7 @@ class PedigreeController extends BaseController { $this->treesize = pow(2, (int)($this->PEDIGREE_GENERATIONS))-1; //-- ancestry_array puts everyone at $i+1 - for($i=0; $i<$this->treesize; $i++) { + for ($i=0; $i<$this->treesize; $i++) { $this->treeid[$i] = $this->treeid[$i+1]; } @@ -157,7 +157,7 @@ class PedigreeController extends BaseController { if ($this->treesize<3) $this->treesize=3; // -- loop through all of id's in the array starting at the last and working to the first //-- calculation the box positions - for($i=($this->treesize-1); $i>=0; $i--) { + for ($i=($this->treesize-1); $i>=0; $i--) { // -- check to see if we have moved to the next generation if ($i < floor($this->treesize / (pow(2, $this->curgen)))) { $this->curgen++; @@ -191,13 +191,13 @@ class PedigreeController extends BaseController { if ($i%2 == 0) $this->yoffset=$this->yoffset - (($boxspacing/2) * ($this->curgen-1)); else $this->yoffset=$this->yoffset + (($boxspacing/2) * ($this->curgen-1)); $pgen = $this->curgen; - while($parent>0) { + while ($parent>0) { if ($parent%2 == 0) $this->yoffset=$this->yoffset - (($boxspacing/2) * $pgen); else $this->yoffset=$this->yoffset + (($boxspacing/2) * $pgen); $pgen++; if ($pgen>3) { $temp=0; - for($j=1; $j<($pgen-2); $j++) $temp += (pow(2, $j)-1); + for ($j=1; $j<($pgen-2); $j++) $temp += (pow(2, $j)-1); if ($parent%2 == 0) $this->yoffset=$this->yoffset - (($boxspacing/2) * $temp); else $this->yoffset=$this->yoffset + (($boxspacing/2) * $temp); } @@ -205,7 +205,7 @@ class PedigreeController extends BaseController { } if ($this->curgen>3) { $temp=0; - for($j=1; $j<($this->curgen-2); $j++) $temp += (pow(2, $j)-1); + for ($j=1; $j<($this->curgen-2); $j++) $temp += (pow(2, $j)-1); if ($i%2 == 0) $this->yoffset=$this->yoffset - (($boxspacing/2) * $temp); else $this->yoffset=$this->yoffset + (($boxspacing/2) * $temp); } @@ -238,7 +238,7 @@ class PedigreeController extends BaseController { //-- calculate the smallest yoffset and adjust the tree to that offset $minyoffset = 0; - for($i=0; $i<count($this->treeid); $i++) { + for ($i=0; $i<count($this->treeid); $i++) { if ($SHOW_EMPTY_BOXES || !empty($treeid[$i])) { if (!empty($offsetarray[$i])) { if (($minyoffset==0)||($minyoffset>$this->offsetarray[$i]["y"])) $minyoffset = $this->offsetarray[$i]["y"]; @@ -287,7 +287,7 @@ class PedigreeController extends BaseController { if (empty($treeid[$index])) { $pgen=$curgen; $genoffset=0; - while($pgen<=$this->PEDIGREE_GENERATIONS) { + while ($pgen<=$this->PEDIGREE_GENERATIONS) { $genoffset += pow(2, ($this->PEDIGREE_GENERATIONS-$pgen)); $pgen++; } diff --git a/includes/controllers/search_ctrl.php b/includes/controllers/search_ctrl.php index dda24feffa..a9a20e0e0f 100644 --- a/includes/controllers/search_ctrl.php +++ b/includes/controllers/search_ctrl.php @@ -127,10 +127,10 @@ class SearchController extends BaseController { if (isset ($_REQUEST["replace"])) { $this->replace = $_REQUEST["replace"]; - if(isset($_REQUEST["replaceNames"])) $this->replaceNames = true; - if(isset($_REQUEST["replacePlaces"])) $this->replacePlaces = true; - if(isset($_REQUEST["replacePlacesWord"])) $this->replacePlacesWord = true; - if(isset($_REQUEST["replaceAll"])) $this->replaceAll = true; + if (isset($_REQUEST["replaceNames"])) $this->replaceNames = true; + if (isset($_REQUEST["replacePlaces"])) $this->replacePlaces = true; + if (isset($_REQUEST["replacePlacesWord"])) $this->replacePlacesWord = true; + if (isset($_REQUEST["replaceAll"])) $this->replaceAll = true; } // Aquire all the variables values from the $_REQUEST @@ -316,9 +316,9 @@ class SearchController extends BaseController { foreach ($varNames as $key => $varName) { if (isset ($_REQUEST[$varName])) { - if($varName == "action") - if($_REQUEST[$varName] == "replace") - if(!WT_USER_CAN_ACCEPT) + if ($varName == "action") + if ($_REQUEST[$varName] == "replace") + if (!WT_USER_CAN_ACCEPT) { $this->action = "general"; continue; @@ -491,47 +491,47 @@ class SearchController extends BaseController { $adv_name_tags = preg_split("/[\s,;: ]+/", $ADVANCED_NAME_FACTS); $name_tags = array_unique(array_merge($STANDARD_NAME_FACTS, $adv_name_tags)); $name_tags[] = "_MARNM"; - foreach($this->myindilist as $id=>$individual) { + foreach ($this->myindilist as $id=>$individual) { $indirec=find_gedcom_record($individual->getXref(), WT_GED_ID, true); $oldRecord = $indirec; $newRecord = $indirec; - if($this->replaceAll) { + if ($this->replaceAll) { $newRecord = preg_replace("~".$oldquery."~i", $this->replace, $newRecord); } else { - if($this->replaceNames) { - foreach($name_tags as $f=>$tag) { + if ($this->replaceNames) { + foreach ($name_tags as $f=>$tag) { $newRecord = preg_replace("~(\d) ".$tag." (.*)".$oldquery."(.*)~i", "$1 ".$tag." $2".$this->replace."$3", $newRecord); } } - if($this->replacePlaces) { + if ($this->replacePlaces) { if ($this->replacePlacesWord) $newRecord = preg_replace('~(\d) PLAC (.*)([,\W\s])'.$oldquery.'([,\W\s])~i', "$1 PLAC $2$3".$this->replace."$4",$newRecord); else $newRecord = preg_replace("~(\d) PLAC (.*)".$oldquery."(.*)~i", "$1 PLAC $2".$this->replace."$3",$newRecord); } } //-- if the record changed replace the record otherwise remove it from the search results - if($newRecord != $oldRecord) { + if ($newRecord != $oldRecord) { replace_gedrec($individual->getXref(), WT_GED_ID, $newRecord); } else { unset($this->myindilist[$id]); } } - foreach($this->myfamlist as $id=>$family) { + foreach ($this->myfamlist as $id=>$family) { $indirec=find_gedcom_record($family->getXref(), WT_GED_ID, true); $oldRecord = $indirec; $newRecord = $indirec; - if($this->replaceAll) { + if ($this->replaceAll) { $newRecord = preg_replace("~".$oldquery."~i", $this->replace, $newRecord); } else { - if($this->replacePlaces) { + if ($this->replacePlaces) { if ($this->replacePlacesWord) $newRecord = preg_replace('~(\d) PLAC (.*)([,\W\s])'.$oldquery.'([,\W\s])~i', "$1 PLAC $2$3".$this->replace."$4",$newRecord); else $newRecord = preg_replace("~(\d) PLAC (.*)".$oldquery."(.*)~i", "$1 PLAC $2".$this->replace."$3",$newRecord); } } //-- if the record changed replace the record otherwise remove it from the search results - if($newRecord != $oldRecord) { + if ($newRecord != $oldRecord) { replace_gedrec($family->getXref(), WT_GED_ID, $newRecord); } else { unset($this->myfamlist[$id]); @@ -546,17 +546,17 @@ class SearchController extends BaseController { if ($this->replaceAll) { $newRecord = preg_replace("~".$oldquery."~i", $this->replace, $newRecord); } else { - if($this->replaceNames) { + if ($this->replaceNames) { $newRecord = preg_replace("~(\d) TITL (.*)".$oldquery."(.*)~i", "$1 TITL $2".$this->replace."$3", $newRecord); $newRecord = preg_replace("~(\d) ABBR (.*)".$oldquery."(.*)~i", "$1 ABBR $2".$this->replace."$3", $newRecord); } - if($this->replacePlaces) { + if ($this->replacePlaces) { if ($this->replacePlacesWord) $newRecord = preg_replace('~(\d) PLAC (.*)([,\W\s])'.$oldquery.'([,\W\s])~i', "$1 PLAC $2$3".$this->replace."$4",$newRecord); else $newRecord = preg_replace("~(\d) PLAC (.*)".$oldquery."(.*)~i", "$1 PLAC $2".$this->replace."$3",$newRecord); } } //-- if the record changed replace the record otherwise remove it from the search results - if($newRecord != $oldRecord) { + if ($newRecord != $oldRecord) { replace_gedrec($source->getXref(), WT_GED_ID, $newRecord); } else { unset($this->mysourcelist[$id]); @@ -572,7 +572,7 @@ class SearchController extends BaseController { $newRecord = preg_replace("~".$oldquery."~i", $this->replace, $newRecord); } //-- if the record changed replace the record otherwise remove it from the search results - if($newRecord != $oldRecord) { + if ($newRecord != $oldRecord) { replace_gedrec($note->getXref(), WT_GED_ID, $newRecord); } else { unset($this->mynotelist[$id]); @@ -1016,7 +1016,7 @@ class SearchController extends BaseController { } } $tempURL .= "&resultsPageNum={$pageNum}"; - foreach($this->sgeds as $i=>$key) { + foreach ($this->sgeds as $i=>$key) { $str = str_replace(array (".", "-", " "), array ("_", "_", "_"), $key); $tempURL .= "&{$str}=yes"; } diff --git a/includes/controllers/timeline_ctrl.php b/includes/controllers/timeline_ctrl.php index dbb73b7299..57f39435ab 100644 --- a/includes/controllers/timeline_ctrl.php +++ b/includes/controllers/timeline_ctrl.php @@ -84,7 +84,7 @@ class TimelineController extends BaseController { $remove = safe_GET_xref('remove'); //-- cleanup user input $newpids = array(); - foreach($this->pids as $key=>$value) { + foreach ($this->pids as $key=>$value) { if ($value!=$remove) { $newpids[] = $value; $person = Person::getInstance($value); @@ -94,7 +94,7 @@ class TimelineController extends BaseController { $this->pids = $newpids; $this->pidlinks = ""; /* @var $indi Person */ - foreach($this->people as $p=>$indi) { + foreach ($this->people as $p=>$indi) { if (!is_null($indi) && $indi->canDisplayDetails()) { //-- setup string of valid pids for links $this->pidlinks .= "pids[]=".$indi->getXref()."&"; @@ -110,7 +110,7 @@ class TimelineController extends BaseController { } // find all the fact information $indi->add_family_facts(false); - foreach($indi->getIndiFacts() as $event) { + foreach ($indi->getIndiFacts() as $event) { //-- get the fact type $fact = $event->getTag(); if (!in_array($fact, $this->nonfacts)) { @@ -148,7 +148,7 @@ class TimelineController extends BaseController { */ function checkPrivacy() { $printed = false; - for($i=0; $i<count($this->people); $i++) { + for ($i=0; $i<count($this->people); $i++) { if (!is_null($this->people[$i])) { if (!$this->people[$i]->canDisplayDetails()) { if ($this->people[$i]->canDisplayName()) { @@ -198,7 +198,7 @@ class TimelineController extends BaseController { $i=1; $j=0; $tyoffset = 0; - while(isset($placements[$place])) { + while (isset($placements[$place])) { if ($i==$j) { $tyoffset = $this->bheight * $i; $i++; @@ -234,7 +234,7 @@ class TimelineController extends BaseController { $husbid=$family->getHusbId(); $wifeid=$family->getWifeId(); //-- Retrieve husband and wife age - for($p=0; $p<count($this->pids); $p++) { + for ($p=0; $p<count($this->pids); $p++) { if ($this->pids[$p]==$husbid) { $husb=$family->getHusband(); if (is_null($husb)) $husb = new Person(''); @@ -269,7 +269,7 @@ class TimelineController extends BaseController { if ($place!=null) { if ($desc!=null) echo " - "; $plevels = explode(',', $place); - for($plevel=0; $plevel<$SHOW_PEDIGREE_PLACES; $plevel++) { + for ($plevel=0; $plevel<$SHOW_PEDIGREE_PLACES; $plevel++) { if (!empty($plevels[$plevel])) { if ($plevel>0) echo ", "; echo PrintReady($plevels[$plevel]); @@ -280,7 +280,7 @@ class TimelineController extends BaseController { //-- print spouse name for marriage events $spouse = Person::getInstance($event->getSpouseId()); if ($spouse) { - for($p=0; $p<count($this->pids); $p++) { + for ($p=0; $p<count($this->pids); $p++) { if ($this->pids[$p]==$spouse->getXref()) break; } if ($p==count($this->pids)) $p = $event->temp; diff --git a/includes/family_nav.php b/includes/family_nav.php index 40881edad2..067b041314 100644 --- a/includes/family_nav.php +++ b/includes/family_nav.php @@ -52,7 +52,7 @@ $show_full="1"; // Gets current clicked tab to set $tabno ----------- if (isset($_COOKIE['lastclick'])) { $tabno=$_COOKIE['lastclick']-1; -}else{ +} else { $tabno=0; } @@ -72,7 +72,7 @@ if (isset($_COOKIE['lastclick'])) { $families = $this->indi->getChildFamilies(); //-- parent families ------------------------------------------------------------- - foreach($families as $famid=>$family) { + foreach ($families as $famid=>$family) { $label = $this->indi->getChildFamilyLabel($family); $people = $this->buildFamilyList($family, "parents"); $styleadd = ""; @@ -91,7 +91,7 @@ if (isset($_COOKIE['lastclick'])) { $menu = new Menu(" " . $people["husb"]->getLabel()); if ($TEXT_DIRECTION=="ltr") { $menu->addClass("", "", "submenu flyout"); - }else{ + } else { $menu->addClass("", "", "submenu flyoutrtl"); } $slabel = "</a>".print_pedigree_person_nav($people["husb"]->getXref(), 2, 0, $personcount++); @@ -99,8 +99,8 @@ if (isset($_COOKIE['lastclick'])) { $submenu = new Menu($slabel); $menu->addSubMenu($submenu); - if (PrintReady($people["husb"]->getDeathYear()) == 0) { $DeathYr = ""; }else{ $DeathYr = PrintReady($people["husb"]->getDeathYear()); } - if (PrintReady($people["husb"]->getBirthYear()) == 0) { $BirthYr = ""; }else{ $BirthYr = PrintReady($people["husb"]->getBirthYear()); } + if (PrintReady($people["husb"]->getDeathYear()) == 0) { $DeathYr = ""; } else { $DeathYr = PrintReady($people["husb"]->getDeathYear()); } + if (PrintReady($people["husb"]->getBirthYear()) == 0) { $BirthYr = ""; } else { $BirthYr = PrintReady($people["husb"]->getBirthYear()); } ?> <tr> <td class="facts_label<?php echo $styleadd; ?>" nowrap="nowrap"> @@ -122,7 +122,7 @@ if (isset($_COOKIE['lastclick'])) { $menu = new Menu(" " . $people["wife"]->getLabel()); if ($TEXT_DIRECTION=="ltr") { $menu->addClass("", "", "submenu flyout"); - }else{ + } else { $menu->addClass("", "", "submenu flyoutrtl"); } $slabel = "</a>".print_pedigree_person_nav($people["wife"]->getXref(), 2, 0, $personcount++); @@ -130,8 +130,8 @@ if (isset($_COOKIE['lastclick'])) { $submenu = new Menu($slabel); $menu->addSubMenu($submenu); - if (PrintReady($people["wife"]->getDeathYear()) == 0) { $DeathYr = ""; }else{ $DeathYr = PrintReady($people["wife"]->getDeathYear()); } - if (PrintReady($people["wife"]->getBirthYear()) == 0) { $BirthYr = ""; }else{ $BirthYr = PrintReady($people["wife"]->getBirthYear()); } + if (PrintReady($people["wife"]->getDeathYear()) == 0) { $DeathYr = ""; } else { $DeathYr = PrintReady($people["wife"]->getDeathYear()); } + if (PrintReady($people["wife"]->getBirthYear()) == 0) { $BirthYr = ""; } else { $BirthYr = PrintReady($people["wife"]->getBirthYear()); } ?> <tr> <td class="facts_label<?php echo $styleadd; ?>"> @@ -151,13 +151,13 @@ if (isset($_COOKIE['lastclick'])) { if (isset($people["children"])) { $elderdate = $family->getMarriageDate(); - foreach($people["children"] as $key=>$child) { - if ($pid == $child->getXref() ){ - }else{ + foreach ($people["children"] as $key=>$child) { + if ($pid == $child->getXref()) { + } else { $menu = new Menu($child->getLabel()); if ($TEXT_DIRECTION=="ltr") { $menu->addClass("", "", "submenu flyout"); - }else{ + } else { $menu->addClass("", "", "submenu flyoutrtl"); } $slabel = "</a>".print_pedigree_person_nav($child->getXref(), 2, 0, $personcount++); @@ -165,8 +165,8 @@ if (isset($_COOKIE['lastclick'])) { $submenu = new Menu($slabel); $menu->addSubMenu($submenu); } - if (PrintReady($child->getDeathYear()) == 0) { $DeathYr = ""; }else{ $DeathYr = PrintReady($child->getDeathYear()); } - if (PrintReady($child->getBirthYear()) == 0) { $BirthYr = ""; }else{ $BirthYr = PrintReady($child->getBirthYear()); } + if (PrintReady($child->getDeathYear()) == 0) { $DeathYr = ""; } else { $DeathYr = PrintReady($child->getDeathYear()); } + if (PrintReady($child->getBirthYear()) == 0) { $BirthYr = ""; } else { $BirthYr = PrintReady($child->getBirthYear()); } ?> <tr> @@ -184,7 +184,7 @@ if (isset($_COOKIE['lastclick'])) { if ($pid == $child->getXref()) { echo PrintReady($child->getFullName()); echo "<font size=\"1\"><br />" . $BirthYr . " - " . $DeathYr . "</font>"; - }else{ + } else { echo "<a href=\"".$child->getHtmlUrl()."&tab={$tabno}"."\">"; echo PrintReady($child->getFullName()); echo "<font size=\"1\"><br />" . $BirthYr . " - " . $DeathYr . "</font>"; @@ -200,10 +200,10 @@ if (isset($_COOKIE['lastclick'])) { } //-- step families ---------------------------------------------------------------- - foreach($this->indi->getStepFamilies() as $famid=>$family) { + foreach ($this->indi->getStepFamilies() as $famid=>$family) { $label = $this->indi->getStepFamilyLabel($family); $people = $this->buildFamilyList($family, "step"); - if ($people){ + if ($people) { echo "<tr><td><br /></td><td></td></tr>"; } $styleadd = ""; @@ -225,12 +225,12 @@ if (isset($_COOKIE['lastclick'])) { $menu = new Menu(); if ($people["husb"]->getLabel() == ".") { $menu->addLabel(" " . i18n::translate('Step-Father')); - }else{ + } else { $menu->addLabel(" " . $people["husb"]->getLabel()); } if ($TEXT_DIRECTION=="ltr") { $menu->addClass("", "", "submenu flyout"); - }else{ + } else { $menu->addClass("", "", "submenu flyoutrtl"); } $slabel = "</a>".print_pedigree_person_nav($people["husb"]->getXref(), 2, 0, $personcount++); @@ -238,8 +238,8 @@ if (isset($_COOKIE['lastclick'])) { $submenu = new Menu($slabel); $menu->addSubMenu($submenu); - if (PrintReady($people["husb"]->getDeathYear()) == 0) { $DeathYr = ""; }else{ $DeathYr = PrintReady($people["husb"]->getDeathYear()); } - if (PrintReady($people["husb"]->getBirthYear()) == 0) { $BirthYr = ""; }else{ $BirthYr = PrintReady($people["husb"]->getBirthYear()); } + if (PrintReady($people["husb"]->getDeathYear()) == 0) { $DeathYr = ""; } else { $DeathYr = PrintReady($people["husb"]->getDeathYear()); } + if (PrintReady($people["husb"]->getBirthYear()) == 0) { $BirthYr = ""; } else { $BirthYr = PrintReady($people["husb"]->getBirthYear()); } ?> <tr> @@ -265,12 +265,12 @@ if (isset($_COOKIE['lastclick'])) { $menu = new Menu(); if ($people["wife"]->getLabel() == ".") { $menu->addLabel(" " . i18n::translate('Step-Mother')); - }else{ + } else { $menu->addLabel(" " . $people["wife"]->getLabel()); } if ($TEXT_DIRECTION=="ltr") { $menu->addClass("", "", "submenu flyout"); - }else{ + } else { $menu->addClass("", "", "submenu flyoutrtl"); } $slabel = "</a>".print_pedigree_person_nav($people["wife"]->getXref(), 2, 0, $personcount++); @@ -278,8 +278,8 @@ if (isset($_COOKIE['lastclick'])) { $submenu = new Menu($slabel); $menu->addSubMenu($submenu); - if (PrintReady($people["wife"]->getDeathYear()) == 0) { $DeathYr = ""; }else{ $DeathYr = PrintReady($people["wife"]->getDeathYear()); } - if (PrintReady($people["wife"]->getBirthYear()) == 0) { $BirthYr = ""; }else{ $BirthYr = PrintReady($people["wife"]->getBirthYear()); } + if (PrintReady($people["wife"]->getDeathYear()) == 0) { $DeathYr = ""; } else { $DeathYr = PrintReady($people["wife"]->getDeathYear()); } + if (PrintReady($people["wife"]->getBirthYear()) == 0) { $BirthYr = ""; } else { $BirthYr = PrintReady($people["wife"]->getBirthYear()); } ?> <tr> <td class="facts_label<?php echo $styleadd; ?>" nowrap="nowrap"> @@ -300,11 +300,11 @@ if (isset($_COOKIE['lastclick'])) { $styleadd = ""; if (isset($people["children"])) { $elderdate = $family->getMarriageDate(); - foreach($people["children"] as $key=>$child) { + foreach ($people["children"] as $key=>$child) { $menu = new Menu($child->getLabel()); if ($TEXT_DIRECTION=="ltr") { $menu->addClass("", "", "submenu flyout"); - }else{ + } else { $menu->addClass("", "", "submenu flyoutrtl"); } $slabel = "</a>".print_pedigree_person_nav($child->getXref(), 2, 0, $personcount++); @@ -312,8 +312,8 @@ if (isset($_COOKIE['lastclick'])) { $submenu = new Menu($slabel); $menu->addSubMenu($submenu); - if (PrintReady($child->getDeathYear()) == 0) { $DeathYr = ""; }else{ $DeathYr = PrintReady($child->getDeathYear()); } - if (PrintReady($child->getBirthYear()) == 0) { $BirthYr = ""; }else{ $BirthYr = PrintReady($child->getBirthYear()); } + if (PrintReady($child->getDeathYear()) == 0) { $DeathYr = ""; } else { $DeathYr = PrintReady($child->getDeathYear()); } + if (PrintReady($child->getBirthYear()) == 0) { $BirthYr = ""; } else { $BirthYr = PrintReady($child->getBirthYear()); } ?> <tr> <td class="facts_label<?php echo $styleadd; ?>" nowrap="nowrap"> @@ -336,7 +336,7 @@ if (isset($_COOKIE['lastclick'])) { //-- spouse and children -------------------------------------------------- $families = $this->indi->getSpouseFamilies(); - foreach($families as $famid=>$family) { + foreach ($families as $famid=>$family) { echo "<tr><td><br /></td><td></td></tr>"; ?> <tr> @@ -352,17 +352,17 @@ if (isset($_COOKIE['lastclick'])) { //$personcount = 0; $people = $this->buildFamilyList($family, "spouse"); - if ($this->indi->equals($people["husb"])){ + if ($this->indi->equals($people["husb"])) { $spousetag = 'WIFE'; - }else{ + } else { $spousetag = 'HUSB'; } $styleadd = ""; - if ( isset($people["husb"]) && $spousetag == 'HUSB' ) { + if (isset($people["husb"]) && $spousetag == 'HUSB') { $menu = new Menu(" " . $people["husb"]->getLabel()); if ($TEXT_DIRECTION=="ltr") { $menu->addClass("", "", "submenu flyout"); - }else{ + } else { $menu->addClass("", "", "submenu flyoutrtl"); } $slabel = "</a>".print_pedigree_person_nav($people["husb"]->getXref(), 2, 0, $personcount++); @@ -370,8 +370,8 @@ if (isset($_COOKIE['lastclick'])) { $submenu = new Menu($slabel); $menu->addSubMenu($submenu); - if (PrintReady($people["husb"]->getDeathYear()) == 0) { $DeathYr = ""; }else{ $DeathYr = PrintReady($people["husb"]->getDeathYear()); } - if (PrintReady($people["husb"]->getBirthYear()) == 0) { $BirthYr = ""; }else{ $BirthYr = PrintReady($people["husb"]->getBirthYear()); } + if (PrintReady($people["husb"]->getDeathYear()) == 0) { $DeathYr = ""; } else { $DeathYr = PrintReady($people["husb"]->getDeathYear()); } + if (PrintReady($people["husb"]->getBirthYear()) == 0) { $BirthYr = ""; } else { $BirthYr = PrintReady($people["husb"]->getBirthYear()); } ?> <tr> <td class="facts_label<?php echo $styleadd; ?>" nowrap="nowrap"> @@ -382,7 +382,7 @@ if (isset($_COOKIE['lastclick'])) { if ($pid == $people["husb"]->getXref()) { echo PrintReady($people["husb"]->getFullName()); echo "<font size=\"1\"><br />" . $BirthYr . " - " . $DeathYr . "</font>"; - }else{ + } else { echo "<a href=\"".$people["husb"]->getHtmlUrl()."&tab={$tabno}"."\">"; echo PrintReady($people["husb"]->getFullName()); echo "<font size=\"1\"><br />" . $BirthYr . " - " . $DeathYr . "</font>"; @@ -394,11 +394,11 @@ if (isset($_COOKIE['lastclick'])) { <?php } - if ( isset($people["wife"]) && $spousetag == 'WIFE') { + if (isset($people["wife"]) && $spousetag == 'WIFE') { $menu = new Menu(" " . $people["wife"]->getLabel()); if ($TEXT_DIRECTION=="ltr") { $menu->addClass("", "", "submenu flyout"); - }else{ + } else { $menu->addClass("", "", "submenu flyoutrtl"); } $slabel = "</a>".print_pedigree_person_nav($people["wife"]->getXref(), 2, 0, $personcount++); @@ -406,8 +406,8 @@ if (isset($_COOKIE['lastclick'])) { $submenu = new Menu($slabel); $menu->addSubMenu($submenu); - if (PrintReady($people["wife"]->getDeathYear()) == 0) { $DeathYr = ""; }else{ $DeathYr = PrintReady($people["wife"]->getDeathYear()); } - if (PrintReady($people["wife"]->getBirthYear()) == 0) { $BirthYr = ""; }else{ $BirthYr = PrintReady($people["wife"]->getBirthYear()); } + if (PrintReady($people["wife"]->getDeathYear()) == 0) { $DeathYr = ""; } else { $DeathYr = PrintReady($people["wife"]->getDeathYear()); } + if (PrintReady($people["wife"]->getBirthYear()) == 0) { $BirthYr = ""; } else { $BirthYr = PrintReady($people["wife"]->getBirthYear()); } ?> <tr> <td class="facts_label<?php echo $styleadd; ?>" nowrap="nowrap"> @@ -418,7 +418,7 @@ if (isset($_COOKIE['lastclick'])) { if ($pid == $people["wife"]->getXref()) { echo PrintReady($people["wife"]->getFullName()); echo "<font size=\"1\"><br />" . $BirthYr . " - " . $DeathYr . "</font>"; - }else{ + } else { echo "<a href=\"".$people["wife"]->getHtmlUrl()."&tab={$tabno}"."\">"; echo PrintReady($people["wife"]->getFullName()); echo "<font size=\"1\"><br />" . $BirthYr . " - " . $DeathYr . "</font>"; @@ -432,11 +432,11 @@ if (isset($_COOKIE['lastclick'])) { $styleadd = ""; if (isset($people["children"])) { - foreach($people["children"] as $key=>$child) { + foreach ($people["children"] as $key=>$child) { $menu = new Menu(" " . $child->getLabel()); if ($TEXT_DIRECTION=="ltr") { $menu->addClass("", "", "submenu flyout"); - }else{ + } else { $menu->addClass("", "", "submenu flyoutrtl"); } $slabel = "</a>".print_pedigree_person_nav($child->getXref(), 2, 0, $personcount++); @@ -444,8 +444,8 @@ if (isset($_COOKIE['lastclick'])) { $submenu = new Menu($slabel); $menu->addSubmenu($submenu); - if (PrintReady($child->getDeathYear()) == 0) { $DeathYr = ""; }else{ $DeathYr = PrintReady($child->getDeathYear()); } - if (PrintReady($child->getBirthYear()) == 0) { $BirthYr = ""; }else{ $BirthYr = PrintReady($child->getBirthYear()); } + if (PrintReady($child->getDeathYear()) == 0) { $DeathYr = ""; } else { $DeathYr = PrintReady($child->getDeathYear()); } + if (PrintReady($child->getBirthYear()) == 0) { $BirthYr = ""; } else { $BirthYr = PrintReady($child->getBirthYear()); } ?> <tr> <td class="facts_label<?php echo $styleadd; ?>" nowrap="nowrap"> @@ -533,7 +533,7 @@ function print_pedigree_person_nav($pid, $style=1, $count=0, $personcount="1") { //-- parent families -------------------------------------- $fams = $person->getChildFamilies(); - foreach($fams as $famid=>$family) { + foreach ($fams as $famid=>$family) { if (!is_null($family)) { $husb = $family->getHusband($person); @@ -570,7 +570,7 @@ function print_pedigree_person_nav($pid, $style=1, $count=0, $personcount="1") { //-- step families ----------------------------------------- $fams = $person->getStepFamilies(); - foreach($fams as $famid=>$family) { + foreach ($fams as $famid=>$family) { if (!is_null($family)) { $husb = $family->getHusband($person); $wife = $family->getWife($person); @@ -579,7 +579,7 @@ function print_pedigree_person_nav($pid, $style=1, $count=0, $personcount="1") { $num = count($children); if ($natdad == "yes") { - }else{ + } else { // Husband ----------------------- if ($husb || $num>0) { if ($husb) { @@ -593,7 +593,7 @@ function print_pedigree_person_nav($pid, $style=1, $count=0, $personcount="1") { } if ($natmom == "yes") { - }else{ + } else { // Wife ---------------------------- if ($wife || $num>0) { if ($wife) { @@ -610,7 +610,7 @@ function print_pedigree_person_nav($pid, $style=1, $count=0, $personcount="1") { // Spouse Families -------------------------------------- @var $family Family $fams = $person->getSpouseFamilies(); - foreach($fams as $famid=>$family) { + foreach ($fams as $famid=>$family) { if (!is_null($family)) { $spouse = $family->getSpouse($person); $children = $family->getChildren(); @@ -629,7 +629,7 @@ function print_pedigree_person_nav($pid, $style=1, $count=0, $personcount="1") { } $spouselinks .= "<ul class=\"clist ".$TEXT_DIRECTION."\">"; // Children ------------------------------ @var $child Person - foreach($children as $c=>$child) { + foreach ($children as $c=>$child) { if ($child) { $persons="Yes"; $spouselinks .= "<li>"; diff --git a/includes/functions/functions_charts.php b/includes/functions/functions_charts.php index 7f22cf2bdc..1340a192ad 100644 --- a/includes/functions/functions_charts.php +++ b/includes/functions/functions_charts.php @@ -152,7 +152,7 @@ function print_family_parents($famid, $sosa = 0, $label="", $parid="", $gparid=" echo "<td rowspan=\"2\"><img src=\"".$WT_IMAGES["hline"]."\" alt=\"\" /></td><td rowspan=\"2\"><img src=\"".$WT_IMAGES["vline"]."\" width=\"3\" height=\"" . ($pbheight) . "\" alt=\"\" /></td>"; echo "<td><img src=\"".$WT_IMAGES["hline"]."\" alt=\"\" /></td><td>"; $hparents = false; - foreach($hfams as $hfamid=>$hfamily) { + foreach ($hfams as $hfamid=>$hfamily) { if (!is_null($hfamily)) { $hparents = find_parents_in_record($hfamily->getGedcomRecord()); $upfamid = $hfamid; @@ -225,7 +225,7 @@ function print_family_parents($famid, $sosa = 0, $label="", $parid="", $gparid=" echo "<td rowspan=\"2\"><img src=\"".$WT_IMAGES["hline"]."\" alt=\"\" /></td><td rowspan=\"2\"><img src=\"".$WT_IMAGES["vline"]."\" width=\"3\" height=\"" . ($pbheight) . "\" alt=\"\" /></td>"; echo "<td><img src=\"".$WT_IMAGES["hline"]."\" alt=\"\" /></td><td>"; $j = 0; - foreach($hfams as $hfamid=>$hfamily) { + foreach ($hfams as $hfamid=>$hfamily) { if (!is_null($hfamily)) { $hparents = find_parents_in_record($hfamily->getGedcomRecord()); $upfamid = $hfamid; @@ -314,17 +314,17 @@ function print_family_children($famid, $childid = "", $sosa = 0, $label="", $per $ct = preg_match_all("/1 CHIL @(.*)@/", $newrec, $match, PREG_SET_ORDER); if ($ct > 0) { $oldchil = array(); - for($i = 0; $i < $ct; $i++) { + for ($i = 0; $i < $ct; $i++) { if (!in_array($match[$i][1], $children)) $newchildren[] = $match[$i][1]; else $oldchil[] = $match[$i][1]; } - foreach($children as $indexval => $chil) { + foreach ($children as $indexval => $chil) { if (!in_array($chil, $oldchil)) $oldchildren[] = $chil; } //-- if there are no old or new children then the children were reordered if ((count($newchildren)==0)&&(count($oldchildren)==0)) { $children = array(); - for($i = 0; $i < $ct; $i++) { + for ($i = 0; $i < $ct; $i++) { $children[] = $match[$i][1]; } } @@ -333,7 +333,7 @@ function print_family_children($famid, $childid = "", $sosa = 0, $label="", $per } $nchi=1; if ((count($children) > 0) || (count($newchildren) > 0) || (count($oldchildren) > 0)) { - foreach($children as $indexval => $chil) { + foreach ($children as $indexval => $chil) { if (!in_array($chil, $oldchildren)) { echo "<tr>"; if ($sosa != 0) { @@ -411,14 +411,14 @@ function print_family_children($famid, $childid = "", $sosa = 0, $label="", $per echo "</tr>"; } } - foreach($newchildren as $indexval => $chil) { + foreach ($newchildren as $indexval => $chil) { echo "<tr >"; echo "<td valign=\"top\" class=\"facts_valueblue\" style=\"width: " . ($pbwidth) . "px; height: " . $pbheight . "px;\">"; print_pedigree_person($chil, 1, 0, $personcount); $personcount++; echo "</td></tr>"; } - foreach($oldchildren as $indexval => $chil) { + foreach ($oldchildren as $indexval => $chil) { echo "<tr >"; echo "<td valign=\"top\" class=\"facts_valuered\" style=\"width: " . ($pbwidth) . "px; height: " . $pbheight . "px;\">"; print_pedigree_person($chil, 1, 0, $personcount); @@ -487,7 +487,7 @@ function print_family_facts(&$family, $sosa = 0) { } // do not print otheritems for sosa if ($sosa == 0) { - foreach($indifacts as $key => $value) { + foreach ($indifacts as $key => $value) { $fact = $value->getTag(); // -- handle special source fact case if ($fact == "SOUR") { @@ -644,7 +644,7 @@ function ancestry_array($rootid, $maxgen=0) { $treeid[0] = ""; $treeid[1] = $rootid; // -- fill in the id array - for($i = 1; $i < ($treesize / 2); $i++) { + for ($i = 1; $i < ($treesize / 2); $i++) { $treeid[($i * 2)] = false; // -- father $treeid[($i * 2) + 1] = false; // -- mother if (!empty($treeid[$i])) { diff --git a/includes/functions/functions_db.php b/includes/functions/functions_db.php index f6d5c12420..361d351c05 100644 --- a/includes/functions/functions_db.php +++ b/includes/functions/functions_db.php @@ -1653,7 +1653,7 @@ function get_top_surnames($ged_id, $min, $max) { /** * get a list of remote servers */ -function get_server_list($ged_id=WT_GED_ID){ +function get_server_list($ged_id=WT_GED_ID) { $sitelist = array(); $rows=WT_DB::prepare("SELECT s_id, s_name, s_gedcom, s_file FROM `##sources` WHERE s_file=? AND s_dbid=? ORDER BY s_name") diff --git a/includes/functions/functions_edit.php b/includes/functions/functions_edit.php index b7e77d3ea3..e6024b9123 100644 --- a/includes/functions/functions_edit.php +++ b/includes/functions/functions_edit.php @@ -304,7 +304,7 @@ function replace_gedrec($gid, $ged_id, $gedrec, $chan=true) { if (isset($pgv_private_records[$gid])) { $privatedata = trim(get_last_private_data($gid)); $subs = get_all_subrecords("\n".$privatedata, '', false, false); - foreach($subs as $s=>$sub) { + foreach ($subs as $s=>$sub) { if (strstr($gedrec, $sub)===false) $gedrec = trim($gedrec)."\n".$sub; } unset($pgv_private_records[$gid]); @@ -441,7 +441,7 @@ function check_gedcom($gedrec, $chan=true) { //-- remove any empty lines $lines = explode("\n", $gedrec); $newrec = ''; - foreach($lines as $ind=>$line) { + foreach ($lines as $ind=>$line) { //-- remove any whitespace $line = trim($line); if (!empty($line)) $newrec .= $line."\n"; @@ -467,12 +467,12 @@ function remove_subrecord($oldrecord, $tag, $gid='', $num=0) { $n = 0; $matchstr = $tag; if (!empty($gid)) $matchstr .= " @".$gid."@"; - for($i=0; $i<count($gedlines); $i++) { + for ($i=0; $i<count($gedlines); $i++) { if (preg_match("/".$matchstr."/", $gedlines[$i])>0) { if ($num==-1 || $n==$num) { $glevel = $gedlines[$i]{0}; $i++; - while((isset($gedlines[$i]))&&(strlen($gedlines[$i])<4 || $gedlines[$i]{0}>$glevel)) $i++; + while ((isset($gedlines[$i]))&&(strlen($gedlines[$i])<4 || $gedlines[$i]{0}>$glevel)) $i++; $i--; } else $n++; @@ -494,7 +494,7 @@ function remove_subline($oldrecord, $linenum) { $newrec = ''; $gedlines = explode("\n", $oldrecord); - for($i=0; $i<$linenum; $i++) { + for ($i=0; $i<$linenum; $i++) { if (trim($gedlines[$i])!='') $newrec .= $gedlines[$i]."\n"; } if (isset($gedlines[$linenum])) { @@ -503,8 +503,8 @@ function remove_subline($oldrecord, $linenum) { $i++; if ($i<count($gedlines)) { //-- don't put empty lines in the record - while((isset($gedlines[$i]))&&(strlen($gedlines[$i])<4 || $gedlines[$i]{0}>$glevel)) $i++; - while($i<count($gedlines)) { + while ((isset($gedlines[$i]))&&(strlen($gedlines[$i])<4 || $gedlines[$i]{0}>$glevel)) $i++; + while ($i<count($gedlines)) { if (trim($gedlines[$i])!='') $newrec .= $gedlines[$i]."\n"; $i++; } @@ -759,12 +759,12 @@ function print_indi_form($nextaction, $famid, $linenum='', $namerec='', $famtag= do { if (!isset($name_fields[$type]) && !isset($adv_name_fields[$type])) { $text = ''; - for($j=2; $j<count($fields); $j++) { + for ($j=2; $j<count($fields); $j++) { if ($j>2) $text .= ' '; $text .= $fields[$j]; } $iscont = false; - while(($i+1<count($gedlines))&&(preg_match("/".($level+1)." (CON[CT]) ?(.*)/", $gedlines[$i+1], $cmatch)>0)) { + while (($i+1<count($gedlines))&&(preg_match("/".($level+1)." (CON[CT]) ?(.*)/", $gedlines[$i+1], $cmatch)>0)) { $iscont=true; if ($cmatch[1]=="CONT") $text.="\n"; if ($WORD_WRAPPED_NOTES) $text .= ' '; @@ -1338,7 +1338,7 @@ function add_simple_tag($tag, $upperlevel='', $label='', $readOnly='', $noClose= if (in_array($fact, $subnamefacts) || $fact=="LATI" || $fact=="LONG") { echo "<td class=\"optionbox $TEXT_DIRECTION wrap width25\">"; - }else{ + } else { echo "<td class=\"descriptionbox $TEXT_DIRECTION wrap width25\">"; } @@ -1350,13 +1350,13 @@ function add_simple_tag($tag, $upperlevel='', $label='', $readOnly='', $noClose= // tag name if (!empty($label)) { - if ($label=="Note" && $islink){ + if ($label=="Note" && $islink) { echo i18n::translate('Shared note'); } else { echo $label; } } else { - if ($fact=="NOTE" && $islink){ + if ($fact=="NOTE" && $islink) { echo translate_fact('SHARED_NOTE'); /* if (file_exists(WT_ROOT.'modules/GEDFact_assistant/_CENS/census_1_ctrl.php') && $pid && $label=="GEDFact Assistant") { @@ -1374,16 +1374,16 @@ function add_simple_tag($tag, $upperlevel='', $label='', $readOnly='', $noClose= // If using GEDFact-assistant window if ($action=="addnewnote_assisted") { // Do not print on GEDFact Assistant window - }else{ + } else { if (!in_array($fact, $emptyfacts)) { if ($fact=="DATE") { echo help_link('def_gedcom_date'); } elseif ($fact=="FORM" && $upperlevel!='OBJE') { echo help_link('FORM'); - } elseif ($fact=="NOTE" && $islink){ + } elseif ($fact=="NOTE" && $islink) { if (file_exists(WT_ROOT.'modules/GEDFact_assistant/_CENS/census_1_ctrl.php') && $pid && $label=="GEDFact Assistant") { echo help_link('edit_add_GEDFact_ASSISTED'); - }else{ + } else { echo help_link('edit_add_SHARED_NOTE'); } } else { @@ -1546,7 +1546,7 @@ function add_simple_tag($tag, $upperlevel='', $label='', $readOnly='', $noClose= // If using GEDFact-assistant window if ($action=="addnewnote_assisted") { echo "<input type=\"text\" id=\"", $element_id, "\" name=\"", $element_name, "\" value=\"", PrintReady(htmlspecialchars($value)), "\" style=\"width:4.1em;\" dir=\"ltr\""; - }else{ + } else { echo "<input type=\"text\" id=\"", $element_id, "\" name=\"", $element_name, "\" value=\"", PrintReady(htmlspecialchars($value)), "\" size=\"", $cols, "\" dir=\"ltr\""; } echo " class=\"{$fact}\""; @@ -2129,7 +2129,7 @@ function handle_updates($newged, $levelOverride="no") { if ($levelOverride=="no" || count($glevels)==0) $levelAdjust = 0; else $levelAdjust = $levelOverride - $glevels[0]; - for($j=0; $j<count($glevels); $j++) { + for ($j=0; $j<count($glevels); $j++) { // Look for empty SOUR reference with non-empty sub-records. // This can happen when the SOUR entry is deleted but its sub-records @@ -2138,7 +2138,7 @@ function handle_updates($newged, $levelOverride="no") { if ($tag[$j]=="SOUR" && ($text[$j]=="@@" || $text[$j]=='')) { $text[$j] = ''; $k = $j+1; - while(($k<count($glevels))&&($glevels[$k]>$glevels[$j])) { + while (($k<count($glevels))&&($glevels[$k]>$glevels[$j])) { $text[$k] = ''; $k++; } @@ -2152,7 +2152,7 @@ function handle_updates($newged, $levelOverride="no") { //-- this section checks if they have subrecords $k=$j+1; $pass=false; - while(($k<count($glevels))&&($glevels[$k]>$glevels[$j])) { + while (($k<count($glevels))&&($glevels[$k]>$glevels[$j])) { if ($text[$k]!='') { if (($tag[$j]!="OBJE")||($tag[$k]=="FILE")) { $pass=true; @@ -2243,7 +2243,7 @@ function unlinkMedia($linktoid, $linenum, $mediaid, $level=1, $chan=true) { //-- $linenum comes as an OBJE and the $mediaid to delete should be set if (!is_numeric($linenum)) { $newged = remove_subrecord($gedrec, $linenum, $mediaid); - }else{ + } else { $newged = remove_subline($gedrec, $linenum); } replace_gedrec($linktoid, WT_GED_ID, $newged, $chan); @@ -2370,12 +2370,12 @@ function create_edit_form($gedrec, $linenum, $level0type) { $label=implode(':', array_slice($stack, 1, $level)); $text = ''; - for($j=2; $j<count($fields); $j++) { + for ($j=2; $j<count($fields); $j++) { if ($j>2) $text .= ' '; $text .= $fields[$j]; } $text = rtrim($text); - while(($i+1<count($gedlines))&&(preg_match("/".($level+1)." CONT ?(.*)/", $gedlines[$i+1], $cmatch)>0)) { + while (($i+1<count($gedlines))&&(preg_match("/".($level+1)." CONT ?(.*)/", $gedlines[$i+1], $cmatch)>0)) { $text.="\n".$cmatch[1]; $i++; } @@ -2383,7 +2383,7 @@ function create_edit_form($gedrec, $linenum, $level0type) { if ($type=="SOUR") { $inSource = true; $levelSource = $level; - } elseif ($levelSource>=$level){ + } elseif ($levelSource>=$level) { $inSource = false; } @@ -2554,14 +2554,14 @@ function delete_person($pid, $gedrec='') { if (!empty($gedrec)) { $success = true; $ct = preg_match_all("/1 FAM. @(.*)@/", $gedrec, $match, PREG_SET_ORDER); - for($i=0; $i<$ct; $i++) { + for ($i=0; $i<$ct; $i++) { $famid = $match[$i][1]; $famrec = find_gedcom_record($famid, WT_GED_ID, true); if (!empty($famrec)) { $lines = explode("\n", $famrec); $newfamrec = ''; $lastlevel = -1; - foreach($lines as $indexval => $line) { + foreach ($lines as $indexval => $line) { $ct = preg_match("/^(\d+)/", $line, $levelmatch); if ($ct>0) $level = $levelmatch[1]; else $level = 1; @@ -2577,7 +2577,7 @@ function delete_person($pid, $gedrec='') { if ($pt<2) { for ($j=0; $j<$pt; $j++) { $xref = $pmatch[$j][1]; - if($xref!=$pid) { + if ($xref!=$pid) { $indirec = find_gedcom_record($xref, WT_GED_ID, true); $indirec = preg_replace("/1.*@$famid@.*/", '', $indirec); if (WT_DEBUG) { @@ -2608,7 +2608,7 @@ function delete_family($pid, $gedrec='') { if (!empty($gedrec)) { $success = true; $ct = preg_match_all("/1 (\w+) @(.*)@/", $gedrec, $match, PREG_SET_ORDER); - for($i=0; $i<$ct; $i++) { + for ($i=0; $i<$ct; $i++) { $type = $match[$i][1]; $id = $match[$i][2]; if (WT_DEBUG) { @@ -2619,7 +2619,7 @@ function delete_family($pid, $gedrec='') { $lines = explode("\n", $indirec); $newindirec = ''; $lastlevel = -1; - foreach($lines as $indexval => $line) { + foreach ($lines as $indexval => $line) { $lct = preg_match("/^(\d+)/", $line, $levelmatch); if ($lct>0) $level = $levelmatch[1]; else $level = 1; diff --git a/includes/functions/functions_mail.php b/includes/functions/functions_mail.php index ac682987a6..41d3fecee6 100644 --- a/includes/functions/functions_mail.php +++ b/includes/functions/functions_mail.php @@ -130,7 +130,7 @@ function webtreesMail($to, $from, $subject, $message) { $mail_object = new PHPMailer(); $mail_object->IsSMTP(); $mail_object->SetLanguage(WT_LOCALE, WT_ROOT.'library/phpmailer/language/'); - if ( $SMTP_AUTH && ( $SMTP_AUTH_USER && $SMTP_AUTH_PASS ) ) { + if ($SMTP_AUTH && $SMTP_AUTH_USER && $SMTP_AUTH_PASS) { $mail_object->SMTPAuth = $SMTP_AUTH; $mail_object->Username = $SMTP_AUTH_USER; $mail_object->Password = $SMTP_AUTH_PASS; @@ -161,25 +161,25 @@ function webtreesMail($to, $from, $subject, $message) { $mail_object->FromName = $SMTP_FROM_NAME; } $mail_object->AddAddress($to); - } else if (!empty($from_name)){ + } else if (!empty($from_name)) { $mail_object->FromName = $from_name; } else { $mail_object->FromName = $mail_object->AddAddress($to); } $mail_object->Subject = hex4email( $subject, 'UTF-8'); $mail_object->ContentType = $mailFormatText; - if ( $mailFormat != "multipart" ) { + if ($mailFormat!="multipart") { $mail_object->ContentType = $mailFormatText . '; format="flowed"'; $mail_object->CharSet = 'UTF-8'; $mail_object->Encoding = '8bit'; } - if ( $mailFormat == "html" || $mailFormat == "multipart" ) { + if ($mailFormat == "html" || $mailFormat == "multipart") { $mail_object->AddCustomHeader( 'Mime-Version: 1.0' ); $mail_object->IsHTML(true); } $mail_object->Body = $message; // attempt to send mail - if ( ! $mail_object->Send() ) { + if (!$mail_object->Send()) { echo i18n::translate('Message was not sent'), '<br />'; echo /* I18N: %s is an error message */ i18n::translate('Mailer error: %s', $mail_object->ErrorInfo), '<br />'; return false; diff --git a/includes/functions/functions_media_reorder.php b/includes/functions/functions_media_reorder.php index bbf9e43d3e..db033f1cad 100644 --- a/includes/functions/functions_media_reorder.php +++ b/includes/functions/functions_media_reorder.php @@ -126,7 +126,7 @@ function media_reorder_row($rtype, $rowm, $pid) { echo "</table>"; if (!isset($j)) { $j=0; - }else{ + } else { $j=$j; } $media_data = $rowm['m_media']; diff --git a/includes/functions/functions_mediadb.php b/includes/functions/functions_mediadb.php index 7565d86adc..a2aeaca64b 100644 --- a/includes/functions/functions_mediadb.php +++ b/includes/functions/functions_mediadb.php @@ -206,7 +206,7 @@ function get_medialist($currentdir = false, $directory = "", $linkonly = false, foreach ($rows as $row) { $fileName = check_media_depth($row->m_file, "NOTRUNC", "QUIET"); $isExternal = isFileExternal($fileName); - if ( $isExternal && (!$MEDIA_EXTERNAL || !$includeExternal) ) { + if ($isExternal && (!$MEDIA_EXTERNAL || !$includeExternal)) { continue; } if ($isExternal || !$currentdir || $directory == dirname($fileName) . "/") { @@ -885,7 +885,7 @@ function process_uploadMedia_form() { echo "<table class=\"list_table $TEXT_DIRECTION width100\">"; echo "<tr><td class=\"messagebox wrap\">"; - for($i=1; $i<6; $i++) { + for ($i=1; $i<6; $i++) { if (!empty($_FILES['mediafile'.$i]["name"]) || !empty($_FILES['thumbnail'.$i]["name"])) { $folderName = trim(trim(safe_POST('folder'.$i, WT_REGEX_NOSCRIPT)), '/'); // Validate and correct folder names @@ -1041,7 +1041,7 @@ function show_mediaUpload_form($URL='media.php', $showthumb=false) { echo '</td></tr>'; // Print 5 forms for uploading images - for($i=1; $i<6; $i++) { + for ($i=1; $i<6; $i++) { echo '<tr><td class="descriptionbox ', $TEXT_DIRECTION, ' wrap width25">'; echo i18n::translate('Media file to upload'), help_link('upload_media_file'); echo '</td>'; @@ -1606,14 +1606,14 @@ function PrintMediaLinks($links, $size = "small") { return true; } -function get_media_id_from_file($filename){ +function get_media_id_from_file($filename) { return WT_DB::prepare("SELECT m_media FROM `##media` WHERE m_file LIKE ?") ->execute(array("%{$filename}")) ->fetchOne(); } //returns an array of rows from the database containing the Person ID's for the people associated with this picture -function get_media_relations($mid){ +function get_media_relations($mid) { global $medialist; //-- check in the medialist cache first @@ -1676,7 +1676,7 @@ function picture_clip($person_id, $image_id, $filename, $thumbDir) return ""; } -function cropImage($image, $dest_image, $left, $top, $right, $bottom){ //$image is the string location of the original image, $dest_image is the string file location of the new image, $fx is the..., $fy is the... +function cropImage($image, $dest_image, $left, $top, $right, $bottom) { //$image is the string location of the original image, $dest_image is the string file location of the new image, $fx is the..., $fy is the... global $THUMBNAIL_WIDTH; $ims = @getimagesize($image); $cwidth = ($ims[0]-$right)-$left; @@ -1734,8 +1734,8 @@ function media_exists($filename) { if (empty($filename)) { return false; } if (isFileExternal($filename)) { return 1; } $filename = filename_decode($filename); - if ( file_exists($filename) ) { return 2; } - if ( $USE_MEDIA_FIREWALL && file_exists(get_media_firewall_path($filename)) ) { return 3; } + if (file_exists($filename)) { return 2; } + if ($USE_MEDIA_FIREWALL && file_exists(get_media_firewall_path($filename))) { return 3; } return false; } @@ -1751,12 +1751,12 @@ function media_filesize($filename) { // returns path to file on server function get_server_filename($filename) { global $USE_MEDIA_FIREWALL; - if (file_exists($filename)){ + if (file_exists($filename)) { return($filename); } if ($USE_MEDIA_FIREWALL) { $protectedfilename = get_media_firewall_path($filename); - if (file_exists($protectedfilename)){ + if (file_exists($protectedfilename)) { return($protectedfilename); } } @@ -1783,13 +1783,13 @@ function get_media_standard_path($path) { // recursively make directories // taken from http://us3.php.net/manual/en/function.mkdir.php#60861 function mkdirs($dir, $mode = WT_PERM_EXE, $recursive = true) { - if( is_null($dir) || $dir === "" ){ + if (is_null($dir) || $dir==="") { return FALSE; } - if( is_dir($dir) || $dir === "/" ){ + if (is_dir($dir) || $dir==="/") { return TRUE; } - if( mkdirs(dirname($dir), $mode, $recursive) ){ + if (mkdirs(dirname($dir), $mode, $recursive)) { return mkdir($dir, $mode); } return FALSE; @@ -1920,7 +1920,7 @@ function generate_thumbnail($filename, $thumbnail) { if ($fp = @fopen(filename_decode($filename), "rb")) { if ($fp===false) return false; $conts = ""; - while(!feof($fp)) { + while (!feof($fp)) { $conts .= fread($fp, 4098); } fclose($fp); diff --git a/includes/functions/functions_name.php b/includes/functions/functions_name.php index c368439767..fdaa4235f2 100644 --- a/includes/functions/functions_name.php +++ b/includes/functions/functions_name.php @@ -75,7 +75,7 @@ function get_common_surnames($min) { * @param string $lastname The name to strip * @return string The updated name */ -function strip_prefix($lastname){ +function strip_prefix($lastname) { $name = preg_replace(array('/ [jJsS][rR]\.?,/', '/ I+,/', '/^([a-z]{1,4}[\. \_\-\(\[])+/'), array(',',',',''), $lastname); $name = trim($name); if ($name=='') return $lastname; @@ -93,7 +93,7 @@ function check_NN($names) { $fullname = ''; - if (!is_array($names)){ + if (!is_array($names)) { $script = utf8_script($names); $NN = $UNKNOWN_NN[$script]; $names = preg_replace(array('~ /~','~/,~','~/~'), array(' ', ',', ' '), $names); @@ -106,10 +106,10 @@ function check_NN($names) { $names = preg_replace('/([^ ]+)\*/', '<span class="starredname">$1</span>', $names); return $names; } - if (count($names) == 2 && stristr($names[0], '@N.N') && stristr($names[1], '@N.N')){ + if (count($names) == 2 && stristr($names[0], '@N.N') && stristr($names[1], '@N.N')) { $fullname = i18n::translate('(unknown)'). ' + '. i18n::translate('(unknown)'); } else { - for($i=0; $i<count($names); $i++) { + for ($i=0; $i<count($names); $i++) { $script = utf8_script($names[$i]); $unknown = false; if (stristr($names[$i], '@N.N')) { @@ -169,7 +169,7 @@ function DMSoundex($name) { // Apply special transformation rules to the input string $name = utf8_strtoupper($name); - foreach($transformNameTable as $transformRule) { + foreach ($transformNameTable as $transformRule) { $name = str_replace($transformRule[0], $transformRule[1], $name); } @@ -218,13 +218,13 @@ function DMSoundex($name) { while ($state < count($soundTableEntry)) { if ($soundTableEntry[$state] == '') { // empty means 'ignore this sound in this state' - foreach($workingResult as $workingEntry) { + foreach ($workingResult as $workingEntry) { $tempEntry = $workingEntry; $tempEntry[count($tempEntry)-1] .= '!'; // Prevent false 'doubles' $partialResult[] = $tempEntry; } } else { - foreach($workingResult as $workingEntry) { + foreach ($workingResult as $workingEntry) { if ($soundTableEntry[$state] !== $workingEntry[count($workingEntry)-1]) { // Incoming sound isn't a duplicate of the previous sound $workingEntry[] = $soundTableEntry[$state]; diff --git a/includes/functions/functions_places.php b/includes/functions/functions_places.php index 814dece2d4..1f72dda7b5 100644 --- a/includes/functions/functions_places.php +++ b/includes/functions/functions_places.php @@ -148,7 +148,7 @@ function setup_place_subfields($element_id) { pdir='places/'+ctry+'/'; // select current country in the list sel=document.getElementsByName(place_tag+'_PLAC_CTRY_select')[0]; - for(i=0;i<sel.length;++i) if (sel.options[i].value==ctry) sel.options[i].selected=true; + for (i=0;i<sel.length;++i) if (sel.options[i].value==ctry) sel.options[i].selected=true; // refresh country flag var img=document.getElementsByName(place_tag+'_PLAC_CTRY_flag')[0]; var ctryFlag = 'places/flags/'+ctry+'.gif'; @@ -382,7 +382,7 @@ function get_place_short($gedcom_place) { $gedcom_place = trim($gedcom_place, " ,"); $exp = explode(",", $gedcom_place); $place = ""; - for($i=0; $i<$SHOW_LIST_PLACES && $i<count($exp); $i++) { + for ($i=0; $i<$SHOW_LIST_PLACES && $i<count($exp); $i++) { if ($i>0) $place .= ", "; $place.=trim($exp[$i]); } diff --git a/includes/functions/functions_print.php b/includes/functions/functions_print.php index a62fe6c2d0..59ca6b4f02 100644 --- a/includes/functions/functions_print.php +++ b/includes/functions/functions_print.php @@ -137,7 +137,7 @@ function print_pedigree_person($pid, $style=1, $count=0, $personcount="1") { $fams = $person->getSpouseFamilies(); /* @var $family Family */ - foreach($fams as $famid=>$family) { + foreach ($fams as $famid=>$family) { if (!is_null($family)) { $spouse = $family->getSpouse($person); @@ -153,7 +153,7 @@ function print_pedigree_person($pid, $style=1, $count=0, $personcount="1") { } } /* @var $child Person */ - foreach($children as $c=>$child) { + foreach ($children as $c=>$child) { $personlinks .= " <a href=\"".$child->getHtmlUrl()."\" $mouseAction1>"; if ($child->canDisplayName()) $personlinks .= PrintReady($child->getFullName()); else $personlinks .= i18n::translate('Private'); @@ -297,7 +297,7 @@ function print_pedigree_person($pid, $style=1, $count=0, $personcount="1") { $indirec = $person->getGedcomRecord(); $cssfacts = array("BIRT", "CHR", "DEAT", "BURI", "CREM", "ADOP", "BAPM", "BARM", "BASM", "BLES", "CHRA", "CONF", "FCOM", "ORDN", "NATU", "EMIG", "IMMI", "CENS", "PROB", "WILL", "GRAD", "RETI", "CAST", "DSCR", "EDUC", "IDNO", "NATI", "NCHI", "NMR", "OCCU", "PROP", "RELI", "RESI", "SSN", "TITL", "BAPL", "CONL", "ENDL", "SLGC", "_MILI"); - foreach($cssfacts as $indexval => $fact) { + foreach ($cssfacts as $indexval => $fact) { if (strpos($indirec, "1 $fact")!==false) $classfacts .= " $fact"; } if ($PEDIGREE_SHOW_GENDER) @@ -792,7 +792,7 @@ function print_favorite_selector($option=0) { $menu->addSubMenu($submenu); } - foreach($userfavs as $key=>$favorite) { + foreach ($userfavs as $key=>$favorite) { $GEDCOM = $favorite["file"]; $submenu = new Menu(); if ($favorite["type"]=="URL" && !empty($favorite["url"])) { @@ -819,7 +819,7 @@ function print_favorite_selector($option=0) { $submenu = new Menu("<strong>".i18n::translate('This GEDCOM\'s Favorites')."</strong>", "#", "right"); $submenu->addClass("favsubmenuitem", "favsubmenuitem_hover"); $menu->addSubMenu($submenu); - foreach($gedcomfavs as $key=>$favorite) { + foreach ($gedcomfavs as $key=>$favorite) { $GEDCOM = $favorite["file"]; $submenu = new Menu(); if ($favorite["type"]=="URL" && !empty($favorite["url"])) { @@ -853,7 +853,7 @@ function print_favorite_selector($option=0) { if ($gid!='') { echo "<option value=\"add\">- ", i18n::translate('Add to My Favorites'), " -</option>"; } - foreach($userfavs as $key=>$favorite) { + foreach ($userfavs as $key=>$favorite) { $GEDCOM = $favorite["file"]; if ($favorite["type"]=="URL" && !empty($favorite["url"])) { echo "<option value=\"", $favorite["url"], "\">", PrintReady($favorite["title"]); @@ -891,7 +891,7 @@ function print_favorite_selector($option=0) { } if (count($gedcomfavs)>0) { echo "<optgroup label=\"", i18n::translate('This GEDCOM\'s Favorites'), "\">"; - foreach($gedcomfavs as $key=>$favorite) { + foreach ($gedcomfavs as $key=>$favorite) { if ($favorite["type"]=="URL" && !empty($favorite["url"])) { echo "<option value=\"", $favorite["url"], "\">", PrintReady($favorite["title"]); echo "</option>"; @@ -944,7 +944,7 @@ function print_note_record($text, $nlevel, $nrec, $textOnly=false, $return=false } else { $text = get_cont($nlevel, $nrec); } - } else{ + } else { $text .= get_cont($nlevel, $nrec); } $text = str_replace("~~", "<br />", $text); @@ -982,7 +982,7 @@ function print_note_record($text, $nlevel, $nrec, $textOnly=false, $return=false // Check if Shared Note ----------------------------- if (preg_match('/^0 @'.WT_REGEX_XREF.'@ NOTE/', $nrec)) { $data .= i18n::translate('Shared note').": </span> "; - }else{ + } else { $data .= i18n::translate('Note').": </span>"; } } @@ -1005,7 +1005,7 @@ function print_note_record($text, $nlevel, $nrec, $textOnly=false, $return=false if (!$return) { echo $data; return true; - }else{ + } else { return $data; } @@ -1027,7 +1027,7 @@ function print_fact_notes($factrec, $level, $textOnly=false, $return=false) { $data = ""; $nlevel = $level+1; $ct = preg_match_all("/$level NOTE(.*)/", $factrec, $match, PREG_SET_ORDER); - for($j=0; $j<$ct; $j++) { + for ($j=0; $j<$ct; $j++) { $spos1 = strpos($factrec, $match[$j][0]); $spos2 = strpos($factrec."\n$level", "\n$level", $spos1+1); if (!$spos2) $spos2 = strlen($factrec); @@ -1062,7 +1062,7 @@ function print_fact_notes($factrec, $level, $textOnly=false, $return=false) { } } /* - if($closeSpan){ + if ($closeSpan) { if ($j==$ct-1 || $textOnly==false) { $data .= "</span>"; } else { @@ -1235,7 +1235,7 @@ function PrintReady($text, $InHeaders=false, $trim=true) { $queries = explode(" ", $query); $newtext = $text; $hasallhits = true; - foreach($queries as $index=>$query1) { + foreach ($queries as $index=>$query1) { $query1esc=preg_quote($query1, '/'); if (@preg_match("/(".$query1esc.")/i", $text)) { // Use @ as user-supplied query might be invalid. $newtext = preg_replace("/(".$query1esc.")/i", "\x01$1\x02", $newtext); @@ -1254,7 +1254,7 @@ function PrintReady($text, $InHeaders=false, $trim=true) { $queries = explode(" ", $firstname); $newtext = $text; $hasallhits = true; - foreach($queries as $index=>$query1) { + foreach ($queries as $index=>$query1) { $query1esc=preg_quote($query1, '/'); if (preg_match("/(".$query1esc.")/i", $text)) { $newtext = preg_replace("/(".$query1esc.")/i", "\x01$1\x02", $newtext); @@ -1273,7 +1273,7 @@ function PrintReady($text, $InHeaders=false, $trim=true) { $queries = explode(" ", $lastname); $newtext = $text; $hasallhits = true; - foreach($queries as $index=>$query1) { + foreach ($queries as $index=>$query1) { $query1esc=preg_quote($query1, '/'); if (preg_match("/(".$query1esc.")/i", $text)) { $newtext = preg_replace("/(".$query1esc.")/i", "\x01$1\x02", $newtext); @@ -1292,7 +1292,7 @@ function PrintReady($text, $InHeaders=false, $trim=true) { $queries = explode(" ", $place); $newtext = $text; $hasallhits = true; - foreach($queries as $index=>$query1) { + foreach ($queries as $index=>$query1) { $query1esc=preg_quote($query1, '/'); if (preg_match("/(".$query1esc.")/i", $text)) { $newtext = preg_replace("/(".$query1esc.")/i", "\x01$1\x02", $newtext); @@ -1311,7 +1311,7 @@ function PrintReady($text, $InHeaders=false, $trim=true) { $queries = explode(" ", $year); $newtext = $text; $hasallhits = true; - foreach($queries as $index=>$query1) { + foreach ($queries as $index=>$query1) { $query1=preg_quote($query1, '/'); if (preg_match("/(".$query1.")/i", $text)) { $newtext = preg_replace("/(".$query1.")/i", "\x01$1\x02", $newtext); @@ -1716,7 +1716,7 @@ function format_fact_place(&$eventObj, $anchor=false, $sub=false, $lds=false) { // reverse the array so that we get the top level first $levels = array_reverse($levels); $tempURL = "placelist.php?action=show&"; - foreach($levels as $pindex=>$ppart) { + foreach ($levels as $pindex=>$ppart) { $tempURL .= "parent[{$pindex}]=".rawurlencode($ppart).'&'; } $tempURL .= 'level='.count($levels); @@ -1830,7 +1830,7 @@ function format_first_major_fact($key, $majorfacts = array("BIRT", "CHR", "BAPM" * If the fact already exists in the second array, delete it from the first one. */ function CheckFactUnique($uniquefacts, $recfacts, $type) { - foreach($recfacts as $indexval => $factarray) { + foreach ($recfacts as $indexval => $factarray) { $fact=false; if (is_object($factarray)) { /* @var $factarray Event */ @@ -1865,7 +1865,7 @@ function print_add_new_fact($id, $usedfacts, $type) { // -- Add from clipboard if (!empty($_SESSION["clipboard"])) { $newRow = true; - foreach(array_reverse($_SESSION["clipboard"], true) as $key=>$fact) { + foreach (array_reverse($_SESSION["clipboard"], true) as $key=>$fact) { if ($fact["type"]==$type || $fact["type"]=='all') { if ($newRow) { $newRow = false; @@ -1938,13 +1938,13 @@ function print_add_new_fact($id, $usedfacts, $type) { echo "<td class=\"optionbox wrap ", $TEXT_DIRECTION, "\">"; echo "<form method=\"get\" name=\"newfactform\" action=\"\" onsubmit=\"return false;\">"; echo "<select id=\"newfact\" name=\"newfact\">"; - foreach($translated_addfacts as $fact=>$fact_name) { + foreach ($translated_addfacts as $fact=>$fact_name) { echo '<option value="', $fact, '">', i18n::translate('%1$s [%2$s]', $fact_name, $fact), '</option>'; } if (($type == "INDI") || ($type == "FAM")) echo "<option value=\"EVEN\">", i18n::translate('Custom Event'), " [EVEN]</option>"; echo "</select>"; echo " <input type=\"button\" value=\"", i18n::translate('Add'), "\" onclick=\"add_record('$id', 'newfact');\" /> "; - foreach($quickfacts as $fact) echo " <small><a href='javascript://$fact' onclick=\"add_new_record('$id', '$fact');return false;\">", translate_fact($fact), "</a></small> "; + foreach ($quickfacts as $fact) echo " <small><a href='javascript://$fact' onclick=\"add_new_record('$id', '$fact');return false;\">", translate_fact($fact), "</a></small> "; echo "</form>"; echo "</td></tr>"; } @@ -2148,7 +2148,7 @@ function get_lds_glance($indirec) { else $text .= "_"; $found = false; $ct = preg_match_all("/1 FAMS @(.*)@/", $indirec, $match, PREG_SET_ORDER); - for($i=0; $i<$ct; $i++) { + for ($i=0; $i<$ct; $i++) { $famrec = find_family_record($match[$i][1], $ged_id); if ($famrec) { $ord = get_sub_record(1, "1 SLGS", $famrec); diff --git a/includes/functions/functions_print_facts.php b/includes/functions/functions_print_facts.php index b287458f91..c2388f788a 100644 --- a/includes/functions/functions_print_facts.php +++ b/includes/functions/functions_print_facts.php @@ -379,7 +379,7 @@ function print_fact(&$eventObj, $noedit=false) { "TIME", "TYPE", "WWW", "_EMAIL", "_WT_USER", "URL", "AGE", "_WTS", "_WTFS"); $ct = preg_match_all("/\n2 (\w+) (.*)/", $factrec, $match, PREG_SET_ORDER); if ($ct>0) echo "<br />"; - for($i=0; $i<$ct; $i++) { + for ($i=0; $i<$ct; $i++) { $factref = $match[$i][1]; if (!in_array($factref, $special_facts)) { $label = translate_fact($fact.':'.$factref, $label_person); @@ -462,7 +462,7 @@ function print_fact_sources($factrec, $level, $return=false) { // -- Systems not using source records [ 1046971 ] $ct = preg_match_all("/$level SOUR (.*)/", $factrec, $match, PREG_SET_ORDER); - for($j=0; $j<$ct; $j++) { + for ($j=0; $j<$ct; $j++) { if (strpos($match[$j][1], "@")===false) { $srec = get_sub_record($level, "$level SOUR ", $factrec, $j+1); $srec = substr($srec, 6); // remove "2 SOUR" @@ -474,7 +474,7 @@ function print_fact_sources($factrec, $level, $return=false) { // -- find source for each fact $ct = preg_match_all("/$level SOUR @(.*)@/", $factrec, $match, PREG_SET_ORDER); $spos2 = 0; - for($j=0; $j<$ct; $j++) { + for ($j=0; $j<$ct; $j++) { $sid = $match[$j][1]; if (canDisplayRecord(WT_GED_ID, find_source_record($sid, WT_GED_ID))) { $spos1 = strpos($factrec, "$level SOUR @".$sid."@", $spos2); @@ -612,12 +612,12 @@ function print_media_links($factrec, $level, $pid='') { echo "</a>"; } echo "</td><td>"; - if(empty($SEARCH_SPIDER)) { + if (empty($SEARCH_SPIDER)) { echo "<a href=\"mediaviewer.php?mid={$media_id}\">"; } if ($TEXT_DIRECTION=="rtl" && !hasRTLText($mediaTitle)) echo "<i>" , getLRM() , PrintReady($mediaTitle), "</i>"; else echo "<i>", PrintReady($mediaTitle), "</i><br />"; - if(empty($SEARCH_SPIDER)) { + if (empty($SEARCH_SPIDER)) { echo "</a>"; } // NOTE: echo the notes of the media @@ -625,7 +625,7 @@ function print_media_links($factrec, $level, $pid='') { // NOTE: echo the format of the media if (!empty($row["m_ext"])) { echo "<br /><span class=\"label\">", translate_fact('FORM'), ": </span> <span class=\"field\">", $row["m_ext"], "</span>"; - if($imgsize[2]!==false) { + if ($imgsize[2]!==false) { echo "<span class=\"label\"><br />", i18n::translate('Image Dimensions'), ": </span> <span class=\"field\" style=\"direction: ltr;\">" , $imgsize[0] , ($TEXT_DIRECTION =="rtl"?(" " . getRLM() . "x" . getRLM() . " ") : " x ") , $imgsize[1] , "</span>"; } } @@ -664,7 +664,7 @@ function print_media_links($factrec, $level, $pid='') { $ct = preg_match("/WT_FAMILY_ID: (.*)/", $factrec, $match); if ($ct>0) { $famid = trim($match[1]); - if(empty($SEARCH_SPIDER)) { + if (empty($SEARCH_SPIDER)) { echo "<a href=\"family.php?famid={$famid}\">", i18n::translate('View Family'); echo "</a>"; } @@ -696,7 +696,7 @@ function print_address_structure($factrec, $level) { $nlevel = $level+1; $ct = preg_match_all("/$level ADDR(.*)/", $factrec, $omatch, PREG_SET_ORDER); - for($i=0; $i<$ct; $i++) { + for ($i=0; $i<$ct; $i++) { $arec = get_sub_record($level, "$level ADDR", $factrec, $i+1); $resultText = ""; if ($level>1) $resultText .= "<span class=\"label\">".translate_fact('ADDR').": </span><br /><div class=\"indent\">"; @@ -766,7 +766,7 @@ function print_address_structure($factrec, $level) { $resultText .= "<table>"; $ct = preg_match_all("/$level PHON (.*)/", $factrec, $omatch, PREG_SET_ORDER); if ($ct>0) { - for($i=0; $i<$ct; $i++) { + for ($i=0; $i<$ct; $i++) { $resultText .= "<tr>"; $resultText .= "<td><span class=\"label\"><b>".translate_fact('PHON').": </b></span></td><td><span class=\"field\">"; $resultText .= getLRM() . $omatch[$i][1] . getLRM(); @@ -775,7 +775,7 @@ function print_address_structure($factrec, $level) { } $ct = preg_match_all("/$level FAX (.*)/", $factrec, $omatch, PREG_SET_ORDER); if ($ct>0) { - for($i=0; $i<$ct; $i++) { + for ($i=0; $i<$ct; $i++) { $resultText .= "<tr>"; $resultText .= "<td><span class=\"label\"><b>".translate_fact('FAX').": </b></span></td><td><span class=\"field\">"; $resultText .= getLRM() . $omatch[$i][1] . getLRM(); @@ -784,7 +784,7 @@ function print_address_structure($factrec, $level) { } $ct = preg_match_all("/$level EMAIL (.*)/", $factrec, $omatch, PREG_SET_ORDER); if ($ct>0) { - for($i=0; $i<$ct; $i++) { + for ($i=0; $i<$ct; $i++) { $resultText .= "<tr>"; $resultText .= "<td><span class=\"label\"><b>".translate_fact('EMAIL').": </b></span></td><td><span class=\"field\">"; $resultText .= "<a href=\"mailto:".$omatch[$i][1]."\">".$omatch[$i][1]."</a>"; @@ -793,7 +793,7 @@ function print_address_structure($factrec, $level) { } $ct = preg_match_all("/$level (WWW|URL) (.*)/", $factrec, $omatch, PREG_SET_ORDER); if ($ct>0) { - for($i=0; $i<$ct; $i++) { + for ($i=0; $i<$ct; $i++) { $resultText .= "<tr>"; $resultText .= "<td><span class=\"label\"><b>".translate_fact($omatch[$i][1]).": </b></span></td><td><span class=\"field\">"; $resultText .= "<a href=\"".$omatch[$i][2]."\" target=\"_blank\">".$omatch[$i][2]."</a>"; @@ -818,7 +818,7 @@ function print_main_sources($factrec, $level, $pid, $linenum, $noedit=false) { // -- find source for each fact $ct = preg_match_all("/$level SOUR @(.*)@/", $factrec, $match, PREG_SET_ORDER); $spos2 = 0; - for($j=0; $j<$ct; $j++) { + for ($j=0; $j<$ct; $j++) { $sid = $match[$j][1]; $spos1 = strpos($factrec, "$level SOUR @".$sid."@", $spos2); $spos2 = strpos($factrec, "\n$level", $spos1); @@ -925,7 +925,7 @@ function printSourceStructure($textSOUR) { $date=new GedcomDate($textSOUR['DATE']); $html.='<div class="indent"><span class="label">'.translate_fact('DATA:DATE').':</span> <span class="field">'.$date->Display(false).'</span></div>'; } - foreach($textSOUR['TEXT'] as $text) { + foreach ($textSOUR['TEXT'] as $text) { $html.='<div class="indent"><span class="label">'.translate_fact('TEXT').':</span> <span class="field">'.PrintReady(expand_urls($text)).'</span></div>'; } } @@ -1007,7 +1007,7 @@ function print_main_notes($factrec, $level, $pid, $linenum, $noedit=false) { if (strpos($factrec, "WT_OLD")!==false) $styleadd="change_old"; $nlevel = $level+1; $ct = preg_match_all("/$level NOTE(.*)/", $factrec, $match, PREG_SET_ORDER); - for($j=0; $j<$ct; $j++) { + for ($j=0; $j<$ct; $j++) { $nrec = get_sub_record($level, "$level NOTE", $factrec, $j+1); if (!canDisplayFact($pid, $ged_id, $factrec)) return false; $nt = preg_match("/\d NOTE @(.*)@/", $match[$j][0], $nmatch); @@ -1062,7 +1062,7 @@ function print_main_notes($factrec, $level, $pid, $linenum, $noedit=false) { } else { echo translate_fact($factname, $parent); } - } else if ($factname != "NOTE"){ + } else if ($factname != "NOTE") { // Note is already printed echo translate_fact($factname, $parent); } @@ -1087,7 +1087,7 @@ function print_main_notes($factrec, $level, $pid, $linenum, $noedit=false) { $centitl = str_replace("~~", "", trim($n1match[1])); $centitl = str_replace("<br />", "", $centitl); $centitl = "<a href=\"note.php?nid=$nid\">".$centitl."</a>"; - }else{ + } else { $text = preg_replace("/~~/", "<br />", trim($n1match[1])); } } @@ -1095,9 +1095,9 @@ function print_main_notes($factrec, $level, $pid, $linenum, $noedit=false) { $text = expand_urls($text); $text = PrintReady($text)." <br />"; // If Census assistant installed, and if Formatted Shared Note (using pipe "|" as delimiter) ------- - if ( strstr($text, "|") && file_exists(WT_ROOT.'modules/GEDFact_assistant/_CENS/census_note_decode.php') ) { + if (strstr($text, "|") && file_exists(WT_ROOT.'modules/GEDFact_assistant/_CENS/census_note_decode.php')) { require WT_ROOT.'modules/GEDFact_assistant/_CENS/census_note_decode.php'; - }else{ + } else { $text = $centitl."".$text; } } @@ -1142,7 +1142,7 @@ function print_main_media($pid, $level=1, $related=false, $noedit=false) { //-- find all of the related ids if ($related) { $ct = preg_match_all("/1 FAMS @(.*)@/", $gedrec, $match, PREG_SET_ORDER); - for($i=0; $i<$ct; $i++) { + for ($i=0; $i<$ct; $i++) { $ids[] = trim($match[$i][1]); } } @@ -1152,7 +1152,7 @@ function print_main_media($pid, $level=1, $related=false, $noedit=false) { if ($level>0) $sort_regexp = "/".$level." _WT_OBJE_SORT @(.*)@/"; else $sort_regexp = "/_WT_OBJE_SORT @(.*)@/"; $sort_ct = preg_match_all($sort_regexp, $gedrec, $sort_match, PREG_SET_ORDER); - for($i=0; $i<$sort_ct; $i++) { + for ($i=0; $i<$sort_ct; $i++) { if (!isset($sort_current_objes[$sort_match[$i][1]])) $sort_current_objes[$sort_match[$i][1]] = 1; else $sort_current_objes[$sort_match[$i][1]]++; $sort_obje_links[$sort_match[$i][1]][] = $sort_match[$i][0]; @@ -1172,7 +1172,7 @@ function print_main_media($pid, $level=1, $related=false, $noedit=false) { if ($level>0) $regexp = "/".$level." OBJE @(.*)@/"; else $regexp = "/OBJE @(.*)@/"; $ct = preg_match_all($regexp, $gedrec, $match, PREG_SET_ORDER); - for($i=0; $i<$ct; $i++) { + for ($i=0; $i<$ct; $i++) { if (!isset($current_objes[$match[$i][1]])) $current_objes[$match[$i][1]] = 1; else $current_objes[$match[$i][1]]++; $obje_links[$match[$i][1]][] = $match[$i][0]; @@ -1184,7 +1184,7 @@ function print_main_media($pid, $level=1, $related=false, $noedit=false) { $sqlmm .= "mm_gid IN ("; $vars=array(); $i=0; - foreach($ids as $key=>$id) { + foreach ($ids as $key=>$id) { if ($i>0) $sqlmm .= ", "; $sqlmm .= "?"; $vars[]=$id; @@ -1201,7 +1201,7 @@ function print_main_media($pid, $level=1, $related=false, $noedit=false) { // LBox --- media sort ------------------------------------- if ($sort_ct>0) { $sqlmm .= $orderbylist; - }else{ + } else { $sqlmm .= " ORDER BY mm_gid DESC "; } // --------------------------------------------------------------- @@ -1265,7 +1265,7 @@ function print_main_media($pid, $level=1, $related=false, $noedit=false) { } } } - foreach($rows as $rtype => $rowm) { + foreach ($rows as $rtype => $rowm) { $res = print_main_media_row($rtype, $rowm, $pid); $media_found = $media_found || $res; $foundObjs[$rowm['m_media']]=true; @@ -1276,8 +1276,8 @@ function print_main_media($pid, $level=1, $related=false, $noedit=false) { //-- objects are removed from the $current_objes list as they are printed //-- any objects left in the list are new objects recently added to the gedcom //-- but not yet accepted into the database. We will print them too. - foreach($current_objes as $media_id=>$value) { - while($value>0) { + foreach ($current_objes as $media_id=>$value) { + while ($value>0) { $objSubrec = array_pop($obje_links[$media_id]); //-- check if we need to get the object from a remote location $ct = preg_match("/(.*):(.*)/", $media_id, $match); @@ -1410,7 +1410,7 @@ function print_main_media_row($rtype, $rowm, $pid) { echo ' alt="', PrintReady(htmlspecialchars($name)), '" title="', PrintReady(htmlspecialchars($name)), '" /></a>'; } - if(empty($SEARCH_SPIDER)) { + if (empty($SEARCH_SPIDER)) { echo "<a href=\"mediaviewer.php?mid={$rowm['m_media']}\">"; } if ($TEXT_DIRECTION=="rtl" && !hasRTLText($mediaTitle)) { @@ -1425,14 +1425,14 @@ function print_main_media_row($rtype, $rowm, $pid) { if (empty($addtitle)) $addtitle = get_gedcom_value("TITL:ROMN", 1, $rowm["m_gedrec"]); if (!empty($addtitle)) echo "<br />", PrintReady(htmlspecialchars($addtitle)); echo "</i>"; - if(empty($SEARCH_SPIDER)) { + if (empty($SEARCH_SPIDER)) { echo "</a>"; } // NOTE: echo the format of the media if (!empty($rowm["m_ext"])) { echo "<br /><span class=\"label\">", translate_fact('FORM'), ": </span> <span class=\"field\">", $rowm["m_ext"], "</span>"; - if(isset($imgsize) and $imgsize[2]!==false) { + if (isset($imgsize) and $imgsize[2]!==false) { echo "<span class=\"label\"><br />", i18n::translate('Image Dimensions'), ": </span> <span class=\"field\" style=\"direction: ltr;\">", $imgsize[0], $TEXT_DIRECTION =="rtl"?(" " . getRLM() . "x" . getRLM(). " ") : " x ", $imgsize[1], "</span>"; } } @@ -1475,7 +1475,7 @@ function print_main_media_row($rtype, $rowm, $pid) { } echo "</a>"; } - if(empty($SEARCH_SPIDER)) { + if (empty($SEARCH_SPIDER)) { if ($spouse) echo " - "; $famid = $rowm['mm_gid']; echo "<a href=\"family.php?famid={$famid}\">", i18n::translate('View Family'); diff --git a/includes/functions/functions_print_lists.php b/includes/functions/functions_print_lists.php index 950f652367..82de3892b7 100644 --- a/includes/functions/functions_print_lists.php +++ b/includes/functions/functions_print_lists.php @@ -134,7 +134,7 @@ function print_indi_table($datalist, $legend="", $option="") { $d100y=new GedcomDate(date('Y')-100); // 100 years ago $dateY = date("Y"); $unique_indis=array(); // Don't double-count indis with multiple names. - foreach($datalist as $key => $value) { + foreach ($datalist as $key => $value) { if (is_object($value)) { // Array of objects $person=$value; } elseif (!is_array($value)) { // Array of IDs @@ -503,7 +503,7 @@ function print_fam_table($datalist, $legend="", $option="") { $hidden = 0; $num = 0; $d100y=new GedcomDate(date('Y')-100); // 100 years ago - foreach($datalist as $key => $value) { + foreach ($datalist as $key => $value) { if (is_object($value)) { // Array of objects $family=$value; } elseif (!is_array($value)) { // Array of IDs @@ -1492,7 +1492,7 @@ function print_events_table($startjd, $endjd, $events='BIRT MARR DEAT', $only_li uasort($filtered_events, 'event_sort_name'); } - foreach($filtered_events as $value) { + foreach ($filtered_events as $value) { $return .= "<tr>"; //-- Record name(s) $name = $value['name']; @@ -1647,7 +1647,7 @@ function print_events_list($startjd, $endjd, $events='BIRT MARR DEAT', $only_liv uasort($filtered_events, 'event_sort_name'); } - foreach($filtered_events as $value) { + foreach ($filtered_events as $value) { $return .= "<a href=\"".$value['url']."\" class=\"list_item name2\" dir=\"".$TEXT_DIRECTION."\">".PrintReady($value['name'])."</a>".$value['sex']; $return .= "<br /><div class=\"indent\">"; $return .= translate_fact($value['fact']).' - '.$value['date']->Display(true); diff --git a/includes/functions/functions_rtl.php b/includes/functions/functions_rtl.php index 35c33a86dd..69346a4461 100644 --- a/includes/functions/functions_rtl.php +++ b/includes/functions/functions_rtl.php @@ -49,11 +49,11 @@ $numberPrefix = '+-'; // Treat these like numbers when at beginning or end of nu $numberPunctuation = '- ,.:/'; // Treat these like numbers when inside numeric strings $punctuation = ',.:;?!'; -function getLRM(){ +function getLRM() { return "‎"; } -function getRLM(){ +function getRLM() { return "‏"; } @@ -338,7 +338,7 @@ function spanLTRRTL($inputText, $direction='BOTH', $class='') { $result .= $waitingText; $waitingText = ''; - foreach($openParDirection as $index => $value) { + foreach ($openParDirection as $index => $value) { // Since we now know the proper direction, remember it for all waiting opening parentheses if ($value == '?') { $openParDirection[$index] = $currentState; @@ -1080,7 +1080,7 @@ function bidi_text($text) { //מספר מזהה (SSN) $found = false; - foreach($RTLOrd as $indexval => $ord) { + foreach ($RTLOrd as $indexval => $ord) { if (strpos($text, chr($ord))!==false) $found=true; } if (!$found) return $text; @@ -1091,7 +1091,7 @@ function bidi_text($text) { $temp = ""; $state = 0; $p = 0; - for($i=0; $i<strlen($text); $i++) { + for ($i=0; $i<strlen($text); $i++) { $letter = $text{$i}; //print $letter.ord($letter).","; //-- handle Hebrew chars @@ -1151,7 +1151,7 @@ function bidi_text($text) { //-- loop through and check if parenthesis are correct... if parenthesis were broken by //-- rtl text then they need to be reversed - for($i=0; $i<count($parts); $i++) { + for ($i=0; $i<count($parts); $i++) { $bef = ""; $aft = ""; $wt = preg_match("/^(\s*).*(\s*)$/", $parts[$i], $match); diff --git a/includes/functions/functions_tools.php b/includes/functions/functions_tools.php index dd8b1336e2..7f4d97edae 100644 --- a/includes/functions/functions_tools.php +++ b/includes/functions/functions_tools.php @@ -51,7 +51,7 @@ function need_place_cleanup() //$ct = preg_match("/SOUR.+(Family Tree Maker|FTW)/", $fcontents); //if ($ct==0) return false; $ct = preg_match_all ("/^1 (CAST|DSCR|IDNO|NATI|NCHI|NMR|OCCU|PROP|RELI|SSN|TITL|_FA1|_FA2|_FA3|_FA4|_FA5|_FA6)(\s*)$[\s]+(^2 TYPE(.*)[\s]+)?(^2 DATE(.*)[\s]+)?^2 PLAC (.*)$/m",$fcontents,$matches, PREG_SET_ORDER); - if($ct>0) + if ($ct>0) return $matches[0]; return false; } @@ -81,12 +81,12 @@ function fixreplaceval($val1,$val7,$val3,$val5) $val = "1 ".$val1." ".trim($val7)."\n"; //trim off trailing spaces $val3 = rtrim($val3); - if(!empty($val3)) + if (!empty($val3)) $val = $val.$val3; //trim off trailing spaces $val5 = rtrim($val5); - if(!empty($val5)) + if (!empty($val5)) { $val = $val.$val5; } @@ -110,25 +110,25 @@ function need_date_cleanup() { global $fcontents; $ct = preg_match_all ("/\n\d DATE[^\d]+(\d\d\d\d)[\/\\\\\-\.](\d\d)[\/\\\\\-\.](\d\d)/",$fcontents,$matches, PREG_SET_ORDER); - if($ct>0) { + if ($ct>0) { return $matches[0]; } else { $ct = preg_match_all ("/\n\d DATE[^\d]+(\d\d)[\/\\\\\-\.](\d\d)[\/\\\\\-\.](\d\d\d\d)/",$fcontents,$matches, PREG_SET_ORDER); - if($ct>0) { + if ($ct>0) { // The user needs to choose between DMY and MDY $matches[0]["choose"] = true; return $matches[0]; } else { $ct = preg_match_all ("/\n\d DATE ([^\d]+) [0-9]{1,2}, (\d\d\d\d)/",$fcontents,$matches, PREG_SET_ORDER); - if($ct>0) { + if ($ct>0) { return $matches[0]; } else { $ct = preg_match_all("/\n\d DATE (\d\d)[^\s]([^\d]+)[^\s](\d\d\d\d)/", $fcontents, $matches, PREG_SET_ORDER); - if($ct>0) { + if ($ct>0) { return $matches[0]; } else { if (preg_match_all("/^\d DATE (BET|FROM) \d\d? (AND|TO) \d\d? \w\w\w \d\d\d\d/m", $fcontents, $matches, PREG_SET_ORDER)) { @@ -143,18 +143,18 @@ function need_date_cleanup() function changemonth($monval) { - if($monval=="01") return "JAN"; - elseif($monval=="02") return "FEB"; - elseif($monval=="03") return "MAR"; - elseif($monval=="04") return "APR"; - elseif($monval=="05") return "MAY"; - elseif($monval=="06") return "JUN"; - elseif($monval=="07") return "JUL"; - elseif($monval=="08") return "AUG"; - elseif($monval=="09") return "SEP"; - elseif($monval=="10") return "OCT"; - elseif($monval=="11") return "NOV"; - elseif($monval=="12") return "DEC"; + if ($monval=="01") return "JAN"; + elseif ($monval=="02") return "FEB"; + elseif ($monval=="03") return "MAR"; + elseif ($monval=="04") return "APR"; + elseif ($monval=="05") return "MAY"; + elseif ($monval=="06") return "JUN"; + elseif ($monval=="07") return "JUL"; + elseif ($monval=="08") return "AUG"; + elseif ($monval=="09") return "SEP"; + elseif ($monval=="10") return "OCT"; + elseif ($monval=="11") return "NOV"; + elseif ($monval=="12") return "DEC"; return $monval; } @@ -213,12 +213,12 @@ function xref_change($tag="RIN") //-- find all of the XREFS in the file $ct = preg_match_all("/0 @(.*)@ INDI/", $fcontents, $match, PREG_SET_ORDER); - for($i=0; $i<$ct; $i++) { + for ($i=0; $i<$ct; $i++) { $xref = trim($match[$i][1]); $indirec = find_gedcom_record($xref, $ged_id, true); if ($indirec) { $rt = preg_match("/1 NAME (.*)/", $indirec, $rmatch); - if($rt>0) + if ($rt>0) { $name = trim($rmatch[1])." (".$xref.")"; $name = str_replace("/","",$name); diff --git a/includes/media_reorder.php b/includes/media_reorder.php index f7d37a32ad..9b37238244 100644 --- a/includes/media_reorder.php +++ b/includes/media_reorder.php @@ -69,7 +69,7 @@ require_once WT_ROOT.'includes/functions/functions_print_facts.php'; $ids = array($pid); if ($related) { $ct = preg_match_all("/1 FAMS @(.*)@/", $gedrec, $match, PREG_SET_ORDER); - for($i=0; $i<$ct; $i++) { + for ($i=0; $i<$ct; $i++) { $ids[] = trim($match[$i][1]); } } @@ -162,7 +162,7 @@ require_once WT_ROOT.'includes/functions/functions_print_facts.php'; $rows = array(); $rows['normal'] = $rowm; if (isset($current_objes[$rowm['m_media']])) $current_objes[$rowm['m_media']]--; - foreach($rows as $rtype => $rowm) { + foreach ($rows as $rtype => $rowm) { $res = media_reorder_row($rtype, $rowm, $pid); $media_found = $media_found || $res; $foundObjs[$rowm['m_media']] = true; diff --git a/includes/media_reorder_count.php b/includes/media_reorder_count.php index e6484a43b0..62c5b78f13 100644 --- a/includes/media_reorder_count.php +++ b/includes/media_reorder_count.php @@ -42,7 +42,7 @@ $gedrec = find_gedcom_record($pid, WT_GED_ID); $level=0; $regexp = "/OBJE @(.*)@/"; $ct_indi = preg_match_all($regexp, $gedrec, $match, PREG_SET_ORDER); -for($i=0; $i<$ct_indi; $i++) { +for ($i=0; $i<$ct_indi; $i++) { if (!isset($current_objes[$match[$i][1]])) $current_objes[$match[$i][1]] = 1; else $current_objes[$match[$i][1]]++; $obje_links[$match[$i][1]][] = $match[$i][0]; @@ -54,7 +54,7 @@ if ($ct>0) { $related=true; if ($related) { $ct = preg_match_all("/1 FAMS @(.*)@/", $gedrec, $match, PREG_SET_ORDER); - for($i=0; $i<$ct; $i++) { + for ($i=0; $i<$ct; $i++) { $ids[] = trim($match[$i][1]); } } @@ -64,7 +64,7 @@ if ($ct>0) { $sqlmm .= "mm_gid IN ("; $vars=array(); $i=0; - foreach($ids as $key=>$id) { + foreach ($ids as $key=>$id) { if ($i>0) $sqlmm .= ","; $sqlmm .= "?"; $vars[]=$id; @@ -79,7 +79,7 @@ if ($ct>0) { // Get related media item count $ct_db = count($rows); //else if indi not related -}else{ +} else { // Get related media item count $ct_db = 0; } @@ -87,7 +87,7 @@ if ($ct>0) { // Gedcom media count -------------------------------- if (isset($current_objes)) { $ct_objs = count($current_objes); -}else{ +} else { $ct_objs = 0; } //Total Media count diff --git a/includes/session_spider.php b/includes/session_spider.php index c8c335f1ac..3d3384522c 100644 --- a/includes/session_spider.php +++ b/includes/session_spider.php @@ -49,11 +49,11 @@ function gen_spider_session_name($bot_name, $bot_language) { $outname = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; $bot_limit = strlen($bot_name); - if($bot_limit > 27) { + if ($bot_limit > 27) { $bot_limit = 27; } - for($x=0; $x < $bot_limit; $x++) { - if(preg_match('/^[a-zA-Z0-9]+$/', $bot_name{$x})) { + for ($x=0; $x < $bot_limit; $x++) { + if (preg_match('/^[a-zA-Z0-9]+$/', $bot_name{$x})) { $outname{$x+2} = strtoupper($bot_name{$x}); } elseif ($bot_name{$x} == '.') { $outname{$x+2} = 'd'; @@ -213,8 +213,8 @@ $spider_name = ' // If you want to disable spider detection, set real to true here. $real = false; -if($ua != "") { - foreach($real_browsers as $browser_check) { +if ($ua != "") { + foreach ($real_browsers as $browser_check) { if (strpos($ua, $browser_check)!==false) { $real = true; break; @@ -239,7 +239,7 @@ else { $real = true; } -if(!$real) { +if (!$real) { $bot_name = $ua; // strip out several common strings that clutter the User Agent. $bot_name = preg_replace("/Mozilla\/... \(compatible;/i", "", $bot_name); @@ -252,15 +252,15 @@ if(!$real) { $y = 0; $valid_char = false; $bot_limit = strlen($bot_name); - for($x=0; $x < $bot_limit; $x++) { - if(preg_match('/^[a-zA-Z]+$/', $bot_name{$x})) { + for ($x=0; $x < $bot_limit; $x++) { + if (preg_match('/^[a-zA-Z]+$/', $bot_name{$x})) { $spider_name{$y} = $bot_name{$x}; $valid_char = true; $y++; if ($y > 70) break; } else if ($bot_name{$x} == ' ') { - if($valid_char) { + if ($valid_char) { $spider_name{$y} = ' '; $valid_char = false; $y++; @@ -268,7 +268,7 @@ if(!$real) { } } else if ($bot_name{$x} == '.') { - if($valid_char) { + if ($valid_char) { $spider_name{$y} = '.'; $valid_char = true; $y++; @@ -300,7 +300,7 @@ if(!$real) { if ($y > 70) break; } else { // Compress consecutive invalids down to one space char. - if($valid_char) { + if ($valid_char) { $spider_name{$y} = ' '; $valid_char = false; $y++; @@ -339,10 +339,10 @@ try { // Initial installation? Site Down? Fail silently. } -if((empty($SEARCH_SPIDER)) && (!empty($_SESSION['last_spider_name']))) // user following a search engine listing in, +if ((empty($SEARCH_SPIDER)) && (!empty($_SESSION['last_spider_name']))) // user following a search engine listing in, Zend_Session::regenerateId(); -if(!empty($SEARCH_SPIDER)) { +if (!empty($SEARCH_SPIDER)) { $spidertime = time(); $spiderdate = date("d.m.Y", $spidertime); // Do we need to log this spider access? @@ -355,7 +355,7 @@ if(!empty($SEARCH_SPIDER)) { break; } } - if(isset($_SESSION['spider_count'])) + if (isset($_SESSION['spider_count'])) $spidercount = $_SESSION['spider_count'] + 1; else { $spidercount = 1; @@ -365,8 +365,8 @@ if(!empty($SEARCH_SPIDER)) { AddToLog("New search engine encountered: ->".$outstr."<- UA>{$ua}< >{$_SERVER["REQUEST_URI"]}<", 'auth'); } } - if(isset($_SESSION['last_spider_date'])) { - if($spiderdate != $_SESSION['last_spider_date']) { + if (isset($_SESSION['last_spider_date'])) { + if ($spiderdate != $_SESSION['last_spider_date']) { //adds a message to the log that a new spider session is starting if ($logSpider) { require_once WT_ROOT.'includes/authentication.php'; // -- Loaded early so AddToLog works @@ -378,10 +378,10 @@ if(!empty($SEARCH_SPIDER)) { } $_SESSION['last_spider_date'] = $spiderdate; $_SESSION['spider_count'] = $spidercount; - if(isset($_SERVER['REMOTE_ADDR'])) + if (isset($_SERVER['REMOTE_ADDR'])) $_SESSION['last_spider_ip'] = $_SERVER['REMOTE_ADDR']; $_SESSION['last_spider_name'] = $SEARCH_SPIDER; - if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) + if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) $_SESSION['last_spider_lang'] = $_SERVER['HTTP_ACCEPT_LANGUAGE']; $_SESSION['wt_user'] = ""; // Don't allow search engine into user/admin mode. |
