diff options
| author | Greg Roach <fisharebest@gmail.com> | 2013-11-01 18:17:25 +0000 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2013-11-01 18:17:25 +0000 |
| commit | 677b8aa47ed770807b6f61f8b001f3fb2ffad6a2 (patch) | |
| tree | cce217cefc89dbf20c085c51a67272b919a8be7e /library | |
| parent | b1457a6c7c6aea70f6e1298a537433a630cf85ac (diff) | |
| download | webtrees-677b8aa47ed770807b6f61f8b001f3fb2ffad6a2.tar.gz webtrees-677b8aa47ed770807b6f61f8b001f3fb2ffad6a2.tar.bz2 webtrees-677b8aa47ed770807b6f61f8b001f3fb2ffad6a2.zip | |
Tidy up trailing whitespace
Diffstat (limited to 'library')
47 files changed, 256 insertions, 256 deletions
diff --git a/library/WT/Controller/AdvancedSearch.php b/library/WT/Controller/AdvancedSearch.php index 075979bae6..1f32cd1f25 100644 --- a/library/WT/Controller/AdvancedSearch.php +++ b/library/WT/Controller/AdvancedSearch.php @@ -36,7 +36,7 @@ class WT_Controller_AdvancedSearch extends WT_Controller_Search { parent::__construct(); $this->setPageTitle(WT_I18N::translate('Advanced search')); - + if (empty($_REQUEST['action'])) { $this->action="advanced"; } diff --git a/library/WT/Controller/Ajax.php b/library/WT/Controller/Ajax.php index 5cc42f15de..1864c0de5d 100644 --- a/library/WT/Controller/Ajax.php +++ b/library/WT/Controller/Ajax.php @@ -33,13 +33,13 @@ class WT_Controller_Ajax extends WT_Controller_Base { $this->page_header=true; return $this; } - + public function pageFooter() { // Ajax responses may have Javascript echo $this->getJavascript(); return $this; } - + // Restrict access public function requireManagerLogin($ged_id=WT_GED_ID) { if ( diff --git a/library/WT/Controller/Ancestry.php b/library/WT/Controller/Ancestry.php index d8da058056..25ee93af34 100644 --- a/library/WT/Controller/Ancestry.php +++ b/library/WT/Controller/Ancestry.php @@ -62,7 +62,7 @@ class WT_Controller_Ancestry extends WT_Controller_Chart { $Dbheight=($box_width*$bheight)/100; $bwidth=$Dbwidth; $bheight=$Dbheight; - + // -- adjust size of the compact box if (!$this->show_full) { $bwidth = $cbwidth; diff --git a/library/WT/Controller/Base.php b/library/WT/Controller/Base.php index 689ada7efc..d9c7ac2d42 100644 --- a/library/WT/Controller/Base.php +++ b/library/WT/Controller/Base.php @@ -103,7 +103,7 @@ class WT_Controller_Base { $TMP_HTML.='<script src="' . $script_name . '"></script>'; } $load_js='[' . implode(',', $load_js) . ']'; - + // Process the scripts, in priority order, after the libraries have loaded $complete_js=''; if ($this->inline_javascript) { diff --git a/library/WT/Controller/Branches.php b/library/WT/Controller/Branches.php index d2a536711f..32a5f47ae0 100644 --- a/library/WT/Controller/Branches.php +++ b/library/WT/Controller/Branches.php @@ -155,7 +155,7 @@ class WT_Controller_Branches extends WT_Controller_Page { $sosa_class = ''; $sosa_html = ''; } - + // Generate HTML for this individual, and all their descendants $indi_html = $individual->getSexImage() . '<a class="' . $sosa_class . '" href="' . $individual->getHtmlUrl() . '">' . $person_name . '</a> ' . $individual->getLifeSpan() . $sosa_html; @@ -172,7 +172,7 @@ class WT_Controller_Branches extends WT_Controller_Page { $indi_html = '<span class="red">'.WT_Gedcom_Code_Pedi::getValue($pedi, $individual).'</span> ' . $indi_html; } } - + // spouses and children $spouse_families = $individual->getSpouseFamilies(); if ($spouse_families) { diff --git a/library/WT/Controller/Chart.php b/library/WT/Controller/Chart.php index 9b7176b4e3..8d22af0385 100644 --- a/library/WT/Controller/Chart.php +++ b/library/WT/Controller/Chart.php @@ -39,7 +39,7 @@ class WT_Controller_Chart extends WT_Controller_Page { $this->root = $this->getSignificantIndividual(); $this->rootid = $this->root->getXref(); } - + if (!$this->root || !$this->root->canShowName()) { header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden'); $this->error_message=WT_I18N::translate('This individual does not exist or you do not have permission to view it.'); diff --git a/library/WT/Controller/Compact.php b/library/WT/Controller/Compact.php index 5d21848056..2f61fbc488 100644 --- a/library/WT/Controller/Compact.php +++ b/library/WT/Controller/Compact.php @@ -49,7 +49,7 @@ class WT_Controller_Compact extends WT_Controller_Chart { } $this->treeid=ancestry_array($this->rootid, 5); } - + function sosa_person($n) { global $SHOW_HIGHLIGHT_IMAGES; diff --git a/library/WT/Controller/Descendancy.php b/library/WT/Controller/Descendancy.php index fd554a9a7b..0b4de75735 100644 --- a/library/WT/Controller/Descendancy.php +++ b/library/WT/Controller/Descendancy.php @@ -72,13 +72,13 @@ class WT_Controller_Descendancy extends WT_Controller_Chart { $Dbheight = ($this->box_width*$bheight)/100; $bwidth = $Dbwidth; $bheight = $Dbheight; - + // -- adjust size of the compact box if (!$this->show_full) { $bwidth = $cbwidth; $bheight = $cbheight; } - + $pbwidth = $bwidth+12; $pbheight = $bheight+14; @@ -128,7 +128,7 @@ class WT_Controller_Descendancy extends WT_Controller_Chart { */ function print_child_descendancy($person, $depth) { global $WT_IMAGES, $Dindent, $personcount; - + if (is_null($person)) return; //print_r($person); echo "<li>"; @@ -140,7 +140,7 @@ class WT_Controller_Descendancy extends WT_Controller_Chart { } print_pedigree_person($person, 1, 0, $personcount); echo '</td>'; - + // check if child has parents and add an arrow echo '<td> </td>'; echo '<td>'; @@ -152,7 +152,7 @@ class WT_Controller_Descendancy extends WT_Controller_Chart { break; } } - + // d'Aboville child number $level =$this->generations-$depth; if ($this->show_full) echo '<br><br> '; @@ -172,14 +172,14 @@ class WT_Controller_Descendancy extends WT_Controller_Chart { echo "</td></tr>"; echo "</table>"; echo "</li>"; - + // loop for each spouse foreach ($person->getSpouseFamilies() as $family) { $personcount++; $this->print_family_descendancy($person, $family, $depth); } } - + /** * print a family descendancy * @@ -189,10 +189,10 @@ class WT_Controller_Descendancy extends WT_Controller_Chart { */ function print_family_descendancy($person, $family, $depth) { global $GEDCOM, $WT_IMAGES, $Dindent, $personcount; - + if (is_null($family)) return; if (is_null($person)) return; - + // print marriage info echo '<li>'; echo '<img src="', $WT_IMAGES['spacer'], '" height="2" width="', ($Dindent+4), '" alt="">'; @@ -204,7 +204,7 @@ class WT_Controller_Descendancy extends WT_Controller_Chart { } } echo '</span>'; - + // print spouse $spouse=$family->getSpouse($person); echo '<ul style="list-style:none; display:block;" id="'.$family->getXref().$personcount.'">'; @@ -212,7 +212,7 @@ class WT_Controller_Descendancy extends WT_Controller_Chart { echo '<table border="0" cellpadding="0" cellspacing="0"><tr><td>'; print_pedigree_person($spouse, 1, 0, $personcount); echo '</td>'; - + // check if spouse has parents and add an arrow echo '<td> </td>'; echo '<td>'; @@ -228,7 +228,7 @@ class WT_Controller_Descendancy extends WT_Controller_Chart { } if ($this->show_full) echo '<br><br> '; echo '</td></tr>'; - + // children $children = $family->getChildren(); echo '<tr><td colspan="3" class="details1" > '; diff --git a/library/WT/Controller/Familybook.php b/library/WT/Controller/Familybook.php index 47438a4a98..5a8dcd2d16 100644 --- a/library/WT/Controller/Familybook.php +++ b/library/WT/Controller/Familybook.php @@ -52,12 +52,12 @@ class WT_Controller_Familybook extends WT_Controller_Chart { $this->box_width = WT_Filter::getInteger('box_width', 50, 300, 100); // Box sizes are set globally in the theme. Modify them here. - global $bwidth, $bheight, $cbwidth, $cbheight, $Dbwidth, $bhalfheight, $Dbheight; + global $bwidth, $bheight, $cbwidth, $cbheight, $Dbwidth, $bhalfheight, $Dbheight; $Dbwidth =$this->box_width * $bwidth / 100; $Dbheight=$this->box_width * $bheight / 100; $bwidth =$Dbwidth; $bheight =$Dbheight; - + // -- adjust size of the compact box if (!$this->show_full) { $bwidth = $this->box_width * $cbwidth / 100; @@ -76,7 +76,7 @@ class WT_Controller_Familybook extends WT_Controller_Chart { $this->dgenerations = $this->max_descendency_generations($this->pid, 0); if ($this->dgenerations<1) $this->dgenerations=1; } - + /** * Prints descendency of passed in person */ @@ -96,7 +96,7 @@ class WT_Controller_Familybook extends WT_Controller_Chart { $famNum = 0; $lh = 0; // if real person load child array - if ($person) { + if ($person) { $sfamilies=$person->getSpouseFamilies(); $children = array(); //count is position from center to left, dgenerations is number of generations @@ -135,7 +135,7 @@ class WT_Controller_Familybook extends WT_Controller_Chart { $h= round(((($bheight)*$kids)/2)+10); //-- adjust for other vertical columns if ($kids>1) $h = ((($kids-1)*4)+$h); - + //echo '<td class="tdtop">', // '<img class="bvertline" src="',$WT_IMAGES["vline"],'" width="3" height="',$h,'" alt=""></td>'; } else { @@ -173,7 +173,7 @@ class WT_Controller_Familybook extends WT_Controller_Chart { $h= round(((($bheight)*$kids)/2)+10); //-- adjust for other vertical columns if ($kids>1) $h = ((($kids-1)*4)+$h); - + echo '<td class="tdtop">', '<img class="bvertline" id="vline_',$chil,'" src="',$WT_IMAGES["vline"],'" height="',$h,'" alt=""></td>'; } else { @@ -188,12 +188,12 @@ class WT_Controller_Familybook extends WT_Controller_Chart { echo '</td>'; echo '<td width="',$bwidth,'">'; } - + if ($numkids==0) { $numkids = 1; } echo '<table><tr><td>'; - if ($person) { + if ($person) { print_pedigree_person($person); echo '</td><td>', '<img class="line2" src="',$WT_IMAGES["hline"],'" width="7" height="3" alt="">'; @@ -202,7 +202,7 @@ class WT_Controller_Familybook extends WT_Controller_Chart { '</td><td width="7">'; } //----- Print the spouse - if ($count==1 ) { + if ($count==1 ) { if ($this->show_spouse) { foreach ($sfamilies as $family) { $spouse = $family->getSpouse($person); @@ -225,7 +225,7 @@ class WT_Controller_Familybook extends WT_Controller_Chart { echo '</table>'; return $numkids; } - + /** * Prints pedigree of the person passed in */ @@ -240,7 +240,7 @@ class WT_Controller_Familybook extends WT_Controller_Chart { //Prints empty table columns for children w/o parents up to the max generation //This allows vertical line spacing to be consistent // - if (count($person->getChildFamilies())==0) { + if (count($person->getChildFamilies())==0) { echo '<table>'; $this->printEmptyBox($bwidth, $bheight); @@ -257,7 +257,7 @@ class WT_Controller_Familybook extends WT_Controller_Chart { '<td>', '</tr></table>'; } - + //Empty box section done, now for regular pedigree foreach ($person->getChildFamilies() as $family) { echo '<table>', @@ -277,7 +277,7 @@ class WT_Controller_Familybook extends WT_Controller_Chart { echo '</td>'; } else { echo '<td>'; - for ($i=$count; $i<$genoffset-1; $i++) { + for ($i=$count; $i<$genoffset-1; $i++) { echo '<table>'; $this->printEmptyBox($bwidth, $bheight); echo '</tr>'; @@ -299,7 +299,7 @@ class WT_Controller_Familybook extends WT_Controller_Chart { echo '</td>'; } else { echo '<td>'; - for ($i=$count; $i<$genoffset-1; $i++) { + for ($i=$count; $i<$genoffset-1; $i++) { echo '<table>'; '<tr>'; $this->printEmptyBox($bwidth, $bheight); @@ -313,7 +313,7 @@ class WT_Controller_Familybook extends WT_Controller_Chart { break; } } - + /** * Calculates number of generations a person has */ diff --git a/library/WT/Controller/Fanchart.php b/library/WT/Controller/Fanchart.php index 2606857ad4..a87592f565 100644 --- a/library/WT/Controller/Fanchart.php +++ b/library/WT/Controller/Fanchart.php @@ -36,7 +36,7 @@ class WT_Controller_Fanchart extends WT_Controller_Chart { public function __construct() { parent::__construct(); - + $default_generations=get_gedcom_setting(WT_GED_ID, 'DEFAULT_PEDIGREE_GENERATIONS'); // Extract the request parameters diff --git a/library/WT/Controller/GedcomRecord.php b/library/WT/Controller/GedcomRecord.php index 372a624c67..8a8b3c9e22 100644 --- a/library/WT/Controller/GedcomRecord.php +++ b/library/WT/Controller/GedcomRecord.php @@ -44,10 +44,10 @@ class WT_Controller_GedcomRecord extends WT_Controller_Page { } parent::__construct(); - + // We want robots to index this page $this->setMetaRobots('index,follow'); - + // Set a page title if ($this->record) { $this->setCanonicalUrl($this->record->getHtmlUrl()); diff --git a/library/WT/Controller/Hourglass.php b/library/WT/Controller/Hourglass.php index f662aa9604..6a60a2859d 100644 --- a/library/WT/Controller/Hourglass.php +++ b/library/WT/Controller/Hourglass.php @@ -71,13 +71,13 @@ class WT_Controller_Hourglass extends WT_Controller_Chart { $this->left_arrow='icon-larrow'; $this->right_arrow='icon-larrow'; } - + // -- size of the detailed boxes based upon optional width parameter $Dbwidth=($this->box_width*$bwidth)/100; $Dbheight=($this->box_width*$bheight)/100; $bwidth=$Dbwidth; $bheight=$Dbheight; - + // -- adjust size of the compact box if (!$this->show_full) { $bwidth = $this->box_width * $cbwidth / 100; @@ -85,14 +85,14 @@ class WT_Controller_Hourglass extends WT_Controller_Chart { } $bhalfheight = (int)($bheight / 2); - + // Validate parameters $this->hourPerson = WT_Individual::getInstance($this->pid); if (!$this->hourPerson) { $this->hourPerson=$this->getSignificantIndividual(); $this->pid=$this->hourPerson->getXref(); } - + $this->name=$this->hourPerson->getFullName(); //Checks how many generations of descendency is for the person for formatting purposes @@ -122,14 +122,14 @@ class WT_Controller_Hourglass extends WT_Controller_Chart { //Prints empty table columns for children w/o parents up to the max generation //This allows vertical line spacing to be consistent // - if (count($person->getChildFamilies())==0) { + if (count($person->getChildFamilies())==0) { echo '<table>', '<tr>', '<td>', '<div style="width:',$bwidth,'px; height:',$bheight,'px;"></div>'; echo '</td>'; echo '<td>'; - + //-- recursively get the father's family $this->print_person_pedigree($person, $count+1); echo '</td>'; @@ -182,7 +182,7 @@ class WT_Controller_Hourglass extends WT_Controller_Chart { if ($count==$this->generations-1 && $family->getWife()->getChildFamilies()) { echo "<a href=\"#\" onclick=\"ChangeDiv('td_".$ARID."','".$ARID."','".$this->show_full."','".$this->show_spouse."','".$this->box_width."'); return false;\" class=\"".$this->right_arrow."\"></a> "; } - + //-- recursively print the mother's family $this->print_person_pedigree($family->getWife(), $count+1); echo "</td>"; diff --git a/library/WT/Controller/Individual.php b/library/WT/Controller/Individual.php index a7e3fc4cfc..e545ede121 100644 --- a/library/WT/Controller/Individual.php +++ b/library/WT/Controller/Individual.php @@ -50,7 +50,7 @@ class WT_Controller_Individual extends WT_Controller_GedcomRecord { $this->tabs = WT_Module::getActiveTabs(); - // If we can display the details, add them to the page header + // If we can display the details, add them to the page header if ($this->record && $this->record->canShow()) { $this->setPageTitle($this->record->getFullName() . ' ' . $this->record->getLifespan()); } @@ -103,7 +103,7 @@ class WT_Controller_Individual extends WT_Controller_GedcomRecord { Zend_Session::writeClose(); echo $mod->getTabContent(); - + if (WT_DEBUG_SQL) { echo WT_DB::getQueryLog(); } @@ -129,7 +129,7 @@ class WT_Controller_Individual extends WT_Controller_GedcomRecord { ); $all_names=$dummy->getAllNames(); $primary_name=$all_names[0]; - + $this->name_count++; if ($this->name_count >1) { echo '<h3 class="name_two">',$dummy->getFullName(), '</h3>'; } //Other names accordion element echo '<div class="indi_name_details'; @@ -275,7 +275,7 @@ class WT_Controller_Individual extends WT_Controller_GedcomRecord { $menu->addOnclick("return edit_name('".$this->record->getXref() . "', '" . $fact->getFactId() . "');"); break; } - + $submenu = new WT_Menu(WT_I18N::translate('Add a new name'), '#', 'menu-indi-addname'); $submenu->addOnclick("return add_name('".$this->record->getXref()."');"); $menu->addSubmenu($submenu); diff --git a/library/WT/Controller/Media.php b/library/WT/Controller/Media.php index 17c9aa98cb..6f71d48693 100644 --- a/library/WT/Controller/Media.php +++ b/library/WT/Controller/Media.php @@ -132,7 +132,7 @@ class WT_Controller_Media extends WT_Controller_GedcomRecord { sort_facts($facts); return $facts; } - + /** * edit menu items used in album tab and media list */ diff --git a/library/WT/Controller/Page.php b/library/WT/Controller/Page.php index 67c9ffd57c..a9252847dc 100644 --- a/library/WT/Controller/Page.php +++ b/library/WT/Controller/Page.php @@ -162,7 +162,7 @@ class WT_Controller_Page extends WT_Controller_Base { var WT_SCRIPT_NAME = "'.WT_SCRIPT_NAME.'"; var WT_LOCALE = "'.WT_LOCALE.'"; ', self::JS_PRIORITY_HIGH); - + // Temporary fix for access to main menu hover elements on android/blackberry touch devices $this->addInlineJavascript(' if(navigator.userAgent.match(/Android|PlayBook/i)) { @@ -170,12 +170,12 @@ class WT_Controller_Page extends WT_Controller_Base { jQuery("a.icon_arrow").attr("href", "#"); } '); - + // Tell IE to use standards mode instead of compatability mode. if ($BROWSERTYPE=='msie') { header("X-UA-Compatible: IE=Edge"); } - + header('Content-Type: text/html; charset=UTF-8'); require WT_ROOT.$headerfile; diff --git a/library/WT/Controller/Pedigree.php b/library/WT/Controller/Pedigree.php index 59c67d70bf..a7929ddc40 100644 --- a/library/WT/Controller/Pedigree.php +++ b/library/WT/Controller/Pedigree.php @@ -53,13 +53,13 @@ class WT_Controller_Pedigree extends WT_Controller_Chart { global $BROWSER_TYPE, $show_full, $talloffset; parent::__construct(); - + $this->linewidth = $linewidth; $this->shadowcolor = $shadowcolor; $this->shadowblur = $shadowblur; $this->shadowoffsetX = $shadowoffsetX; $this->shadowoffsetY = $shadowoffsetY; - + $this->show_full = WT_Filter::getInteger('show_full', 0, 1, $PEDIGREE_FULL_DETAILS); $this->talloffset = WT_Filter::getInteger('talloffset', 0, 3, $PEDIGREE_LAYOUT); $this->box_width = WT_Filter::getInteger('box_width', 50, 300, 100); @@ -72,7 +72,7 @@ class WT_Controller_Pedigree extends WT_Controller_Chart { // Passing a function parameter would be much better. global $PEDIGREE_GENERATIONS; $PEDIGREE_GENERATIONS=$this->PEDIGREE_GENERATIONS; - + // This is passed as a global. A parameter would be better... $this->show_full = ($this->show_full) ? 1 : 0; // Make SURE this is an integer if ($this->talloffset>3) { diff --git a/library/WT/Controller/Simple.php b/library/WT/Controller/Simple.php index 150ab409a5..1afc367d52 100644 --- a/library/WT/Controller/Simple.php +++ b/library/WT/Controller/Simple.php @@ -38,7 +38,7 @@ class WT_Controller_Simple extends WT_Controller_Page { parent::pageHeader(); return $this; } - + // Restrict access public function requireAdminLogin() { if (!WT_USER_IS_ADMIN) { @@ -47,7 +47,7 @@ class WT_Controller_Simple extends WT_Controller_Page { } return $this; } - + // Restrict access public function requireManagerLogin($ged_id=WT_GED_ID) { if ( @@ -59,7 +59,7 @@ class WT_Controller_Simple extends WT_Controller_Page { } return $this; } - + // Restrict access public function requireMemberLogin() { if (!WT_USER_ID) { diff --git a/library/WT/Controller/Timeline.php b/library/WT/Controller/Timeline.php index eb6a64ba09..70c29da68e 100644 --- a/library/WT/Controller/Timeline.php +++ b/library/WT/Controller/Timeline.php @@ -47,7 +47,7 @@ class WT_Controller_Timeline extends WT_Controller_Page { parent::__construct(); $this->setPageTitle(WT_I18N::translate('Timeline')); - + $this->baseyear = date("Y"); //-- new pid $newpid = WT_Filter::get('newpid', WT_REGEX_XREF); diff --git a/library/WT/DB.php b/library/WT/DB.php index fc3b899ba1..1978982b61 100644 --- a/library/WT/DB.php +++ b/library/WT/DB.php @@ -230,7 +230,7 @@ class WT_DB { $need_to_delete_old_files=false; $need_to_update_config_data=false; $need_to_update_stored_procedures=false; - + // During installation, the current version is set to a special value of // -1 (v1.2.5 to v1.2.7) or -2 (v1.3.0 onwards). This indicates that the tables have // been created, but that we still need to install/update configuration data diff --git a/library/WT/Date.php b/library/WT/Date.php index 5f1c928e90..fa258da632 100644 --- a/library/WT/Date.php +++ b/library/WT/Date.php @@ -118,7 +118,7 @@ class WT_Date { $cal='@#DHIJRI@'; // This is a WT extension } else { if (preg_match('/^(FARVA|ORDIB|KHORD|TIR|MORDA|SHAHR|MEHR|ABAN|AZAR|DEY|BAHMA|ESFAN)$/', $m)) { - $cal='@#DJALALI@'; // This is a WT extension + $cal='@#DJALALI@'; // This is a WT extension } elseif (preg_match('/^\d{1,4}( B\.C\.)|\d\d\d\d\/\d\d$/', $y)) { $cal='@#DJULIAN@'; } diff --git a/library/WT/Date/Jalali.php b/library/WT/Date/Jalali.php index 51b6fbda44..7faaf02459 100644 --- a/library/WT/Date/Jalali.php +++ b/library/WT/Date/Jalali.php @@ -140,7 +140,7 @@ class WT_Date_Jalali extends WT_Date_Calendar { static function YMDtoJD($year, $month, $day) { $epbase = $year - (($year >= 0) ? 474 : 473); $epyear = 474 + $epbase % 2820; - + return $day + (($month <= 7) ? (($month - 1) * 31) : @@ -154,7 +154,7 @@ class WT_Date_Jalali extends WT_Date_Calendar { static function JDtoYMD($jd) { $jd = (int)($jd) + 0.5; - + $depoch = $jd - self::YMDtoJD(475, 1, 1); $cycle = (int)($depoch / 1029983); $cyear = $depoch % 1029983; diff --git a/library/WT/Date/Jewish.php b/library/WT/Date/Jewish.php index fd02320972..1be5e7be0b 100644 --- a/library/WT/Date/Jewish.php +++ b/library/WT/Date/Jewish.php @@ -35,7 +35,7 @@ class WT_Date_Jewish extends WT_Date_Calendar { const CAL_START_JD = 347998; // 01 TSH 0001 = @#JULIAN@ 7 OCT 3761B.C. static $MONTH_ABBREV = array( ''=>0, 'TSH'=>1, 'CSH'=>2, 'KSL'=>3, 'TVT'=>4, 'SHV'=>5, 'ADR'=>6, 'ADS'=>7, 'NSN'=>8, 'IYR'=>9, 'SVN'=>10, 'TMZ'=>11, 'AAV'=>12, 'ELL'=>13 - ); + ); static function calendarName() { return /* I18N: The Hebrew/Jewish calendar */ WT_I18N::translate('Jewish'); diff --git a/library/WT/Debug.php b/library/WT/Debug.php index 6f0f84b338..46e587f017 100644 --- a/library/WT/Debug.php +++ b/library/WT/Debug.php @@ -38,7 +38,7 @@ class WT_Debug { '['=>'⟨', ']'=>'⟩', '('=>'⟨', ')'=>'⟩', '{'=>'⟨', '}'=>'⟩', '.'=>'·', ':'=>'˸' ); - + // Pseudo-tranlsate a string. Give it the attributes of a foreign language, // while leaving it understandable by an English speaking developer. public static function pseudoTranslate($text) { diff --git a/library/WT/Filter.php b/library/WT/Filter.php index e628e9b351..c1793a6e89 100644 --- a/library/WT/Filter.php +++ b/library/WT/Filter.php @@ -43,14 +43,14 @@ class WT_Filter { return htmlspecialchars($string, ENT_QUOTES, 'UTF-8'); } } - + ////////////////////////////////////////////////////////////////////////////// // Escape a string for use in a URL ////////////////////////////////////////////////////////////////////////////// public static function escapeUrl($string) { return rawurlencode($string); } - + ////////////////////////////////////////////////////////////////////////////// // Escape a string for use in Javascript ////////////////////////////////////////////////////////////////////////////// diff --git a/library/WT/Gedcom/Code/Adop.php b/library/WT/Gedcom/Code/Adop.php index 79bf9537e8..904bc3c912 100644 --- a/library/WT/Gedcom/Code/Adop.php +++ b/library/WT/Gedcom/Code/Adop.php @@ -24,7 +24,7 @@ if (!defined('WT_WEBTREES')) { } class WT_Gedcom_Code_Adop { - + private static $TYPES=array('BOTH', 'HUSB', 'WIFE'); // Translate a code, for an (optional) record diff --git a/library/WT/Gedcom/Code/Pedi.php b/library/WT/Gedcom/Code/Pedi.php index 4faa3a4b7f..d9b316536b 100644 --- a/library/WT/Gedcom/Code/Pedi.php +++ b/library/WT/Gedcom/Code/Pedi.php @@ -24,7 +24,7 @@ if (!defined('WT_WEBTREES')) { } class WT_Gedcom_Code_Pedi { - + private static $TYPES=array('adopted', 'birth', 'foster', 'rada', 'sealing'); // Translate a code, for an optional record diff --git a/library/WT/Gedcom/Code/Rela.php b/library/WT/Gedcom/Code/Rela.php index 1fc4067598..f0dc612f65 100644 --- a/library/WT/Gedcom/Code/Rela.php +++ b/library/WT/Gedcom/Code/Rela.php @@ -24,7 +24,7 @@ if (!defined('WT_WEBTREES')) { } class WT_Gedcom_Code_Rela { - + private static $TYPES=array( 'attendant', 'attending', 'best_man', 'bridesmaid', 'buyer', 'circumciser', 'civil_registrar', 'employee', 'employer', 'foster_child', diff --git a/library/WT/Gedcom/Tag.php b/library/WT/Gedcom/Tag.php index b15c0f3317..41fc8bb428 100644 --- a/library/WT/Gedcom/Tag.php +++ b/library/WT/Gedcom/Tag.php @@ -864,7 +864,7 @@ class WT_Gedcom_Tag { uasort($facts, 'utf8_strcasecmp'); return $facts; } - + ////////////////////////////////////////////////////////////////////////////// // Definitions for Object, File, Format, Types ////////////////////////////////////////////////////////////////////////////// diff --git a/library/WT/GedcomRecord.php b/library/WT/GedcomRecord.php index 8e4479beb8..bf3a03a855 100755 --- a/library/WT/GedcomRecord.php +++ b/library/WT/GedcomRecord.php @@ -232,7 +232,7 @@ class WT_GedcomRecord { public function getXref() { return $this->xref; } - + // GEDCOM ID public function getGedcomId() { return $this->gedcom_id; @@ -335,7 +335,7 @@ class WT_GedcomRecord { // Can the details of this record be shown? public function canShow($access_level=WT_USER_ACCESS_LEVEL) { - // CACHING: this function can take three different parameters, + // CACHING: this function can take three different parameters, // and therefore needs three different caches for the result. switch ($access_level) { case WT_PRIV_PUBLIC: // visitor @@ -718,7 +718,7 @@ class WT_GedcomRecord { " WHERE o_file=? AND o_type='NOTE' AND l_type=? AND l_to=?". " ORDER BY n_sort COLLATE '".WT_I18N::$collation."'" )->execute(array($this->gedcom_id, $link, $this->xref))->fetchAll(); - + $list = array(); foreach ($rows as $row) { $record = WT_Note::getInstance($row->xref, $row->gedcom_id, $row->gedcom); @@ -848,7 +848,7 @@ class WT_GedcomRecord { } return $chan_user; } - + ////////////////////////////////////////////////////////////////////////////// // CRUD operations ////////////////////////////////////////////////////////////////////////////// @@ -898,7 +898,7 @@ class WT_GedcomRecord { if ($update_chan) { $new_gedcom .= "\n1 CHAN\n2 DATE " . date('d M Y') . "\n3 TIME " . date('H:i:s') . "\n2 _WT_USER " . WT_USER_NAME; } - + // Adding a new fact if (!$fact_id) { $new_gedcom .= "\n" . $gedcom; @@ -926,7 +926,7 @@ class WT_GedcomRecord { } $this->parseFacts(); } - + static public function createRecord($gedcom, $gedcom_id) { if (preg_match('/^0 @(' . WT_REGEX_XREF . ')@ (' . WT_REGEX_TAG . ')/', $gedcom, $match)) { $xref = $match[1]; diff --git a/library/WT/Individual.php b/library/WT/Individual.php index 47dd06e91a..c0ecff4274 100644 --- a/library/WT/Individual.php +++ b/library/WT/Individual.php @@ -1033,7 +1033,7 @@ class WT_Individual extends WT_GedcomRecord { global $bwidth, $SHOW_HIGHLIGHT_IMAGES, $UNKNOWN_NN, $UNKNOWN_PN; // Estimate number of characters that can fit in box. Calulates to 28 characters in webtrees theme, or 34 if no thumbnail used. if ($SHOW_HIGHLIGHT_IMAGES) { - $char = intval(($bwidth-40)/6.5); + $char = intval(($bwidth-40)/6.5); } else { $char = ($bwidth/6.5); } diff --git a/library/WT/Mail.php b/library/WT/Mail.php index ae4c563c8e..d7c6ebb726 100644 --- a/library/WT/Mail.php +++ b/library/WT/Mail.php @@ -68,7 +68,7 @@ class WT_Mail { $message ); } - + // Create a transport mechanism for sending mail public static function transport() { diff --git a/library/WT/Media.php b/library/WT/Media.php index 17cf7c8132..7f32b2fcf0 100644 --- a/library/WT/Media.php +++ b/library/WT/Media.php @@ -400,7 +400,7 @@ class WT_Media extends WT_GedcomRecord { $imgsize = getimagesize($this->getServerFilename('thumb')); // Use a thumbnail image $image = - '<img' . + '<img' . ' dir="' . 'auto' . '"' . // For the tool-tip ' src="' . $this->getHtmlUrlDirect('thumb') . '"' . ' alt="' . strip_tags($this->getFullName()) . '"' . diff --git a/library/WT/Menu.php b/library/WT/Menu.php index c3a381c9e8..cb93949969 100644 --- a/library/WT/Menu.php +++ b/library/WT/Menu.php @@ -95,7 +95,7 @@ class WT_Menu { $this->submenus[] = $obj; } - // + // public function __toString() { return $this->getMenuAsList(); } diff --git a/library/WT/MenuBar.php b/library/WT/MenuBar.php index 24f4634067..a976bef347 100644 --- a/library/WT/MenuBar.php +++ b/library/WT/MenuBar.php @@ -82,7 +82,7 @@ class WT_MenuBar { //-- admin submenu $submenu = new WT_Menu(WT_I18N::translate('Administration'), 'admin.php', 'menu-admin'); $menu->addSubmenu($submenu); - } + } return $menu; } @@ -282,7 +282,7 @@ class WT_MenuBar { // The top level menu shows the individual list $menu=new WT_Menu(WT_I18N::translate('Lists'), 'indilist.php?ged='.WT_GEDURL, 'menu-list'); - + // Do not show empty lists $row=WT_DB::prepare( "SELECT SQL_CACHE". @@ -528,7 +528,7 @@ class WT_MenuBar { $submenu=new WT_Menu(WT_I18N::translate('Add to favorites'), '#'); $submenu->addOnclick("jQuery.post('module.php?mod=user_favorites&mod_action=menu-add-favorite',{xref:'".$controller->record->getXref()."'},function(){location.reload();})"); $menu->addSubMenu($submenu); - } + } } return $menu; } diff --git a/library/WT/Module.php b/library/WT/Module.php index e8c5031e00..6991c5f505 100644 --- a/library/WT/Module.php +++ b/library/WT/Module.php @@ -82,7 +82,7 @@ abstract class WT_Module { } return $this->_title; } - + // Each module must provide the following functions abstract public function getTitle(); // To label tabs, etc. abstract public function getDescription(); // A sentence describing what this module does @@ -107,7 +107,7 @@ abstract class WT_Module { // Sorting is slow, so only do it when requested. static $modules=null; static $sorted =false; - + if ($modules===null) { $module_names=WT_DB::prepare( "SELECT SQL_CACHE module_name FROM `##module` WHERE status='enabled'" diff --git a/library/WT/Note.php b/library/WT/Note.php index b2bdd9940a..7e3c58891d 100644 --- a/library/WT/Note.php +++ b/library/WT/Note.php @@ -52,7 +52,7 @@ class WT_Note extends WT_GedcomRecord { return false; } } - + // Apply default behaviour return parent::_canShowByType($access_level); } @@ -72,7 +72,7 @@ class WT_Note extends WT_GedcomRecord { return $statement->execute(array($xref, $gedcom_id))->fetchOne(); } - + // The 'name' of a note record is the first line. This can be // somewhat unwieldy if lots of CONC records are used. Limit to 100 chars protected function _addName($type, $value, $gedrec) { diff --git a/library/WT/Query/Media.php b/library/WT/Query/Media.php index 82fde1044c..813a239bf8 100644 --- a/library/WT/Query/Media.php +++ b/library/WT/Query/Media.php @@ -64,7 +64,7 @@ class WT_Query_Media { // Generate a filtered, sourced, privacy-checked list of media objects - for the media list. public static function mediaList($folder, $subfolders, $sort, $filter) { // All files in the folder, plus external files - $sql = + $sql = "SELECT m_id AS xref, m_file AS gedcom_id, m_gedcom AS gedcom" . " FROM `##media`" . " WHERE m_file=?"; diff --git a/library/WT/Query/Name.php b/library/WT/Query/Name.php index acfb40a97e..28625536be 100644 --- a/library/WT/Query/Name.php +++ b/library/WT/Query/Name.php @@ -345,7 +345,7 @@ class WT_Query_Name { " JOIN (SELECT n_surn, n_file FROM `##name`". " WHERE n_file={$ged_id}". ($marnm ? "" : " AND n_type!='_MARNM'"); - + if ($surn) { $sql.=" AND n_surn COLLATE '".WT_I18N::$collation."' =".WT_DB::quote($surn); } elseif ($salpha==',') { @@ -362,7 +362,7 @@ class WT_Query_Name { if (!$marnm) { $sql.=" AND n_type!='_MARNM'"; } - + $list=array(); foreach (WT_DB::prepare($sql)->fetchAll() as $row) { $list[utf8_strtoupper($row->n_surn)][$row->n_surname][$row->n_id]=true; @@ -391,7 +391,7 @@ class WT_Query_Name { ($fams ? "JOIN `##link` ON (n_id=l_from AND n_file=l_file AND l_type='FAMS') " : ""). "WHERE n_file={$ged_id} ". ($marnm ? "" : "AND n_type!='_MARNM'"); - + if ($surn) { $sql.=" AND n_surn COLLATE '".WT_I18N::$collation."'=".WT_DB::quote($surn); } elseif ($salpha==',') { @@ -407,9 +407,9 @@ class WT_Query_Name { if ($galpha) { $sql.=" AND ".self::_getInitialSql('n_givn', $galpha); } - + $sql.=" ORDER BY CASE n_surn WHEN '@N.N.' THEN 1 ELSE 0 END, n_surn COLLATE '".WT_I18N::$collation."', CASE n_givn WHEN '@P.N.' THEN 1 ELSE 0 END, n_givn COLLATE '".WT_I18N::$collation."'"; - + $list=array(); $rows=WT_DB::prepare($sql)->fetchAll(); foreach ($rows as $row) { diff --git a/library/WT/Report/Base.php b/library/WT/Report/Base.php index 7627c01abd..9d605d5824 100644 --- a/library/WT/Report/Base.php +++ b/library/WT/Report/Base.php @@ -1972,7 +1972,7 @@ echo "<br>".$addname."<br>"; for ($ii=0; $ii<=strlen($addname); $ii++) echo substr($addname, $ii, 1)." "; */ - $addname = preg_replace(array('/<span class="starredname">/','/<\/span><\/span>/','/<\/span>/'), array('«','','»'), $addname); + $addname = preg_replace(array('/<span class="starredname">/','/<\/span><\/span>/','/<\/span>/'), array('«','','»'), $addname); if (!WT_RNEW) { $addname = strip_tags($addname); //@@ unknown printed in other alignment with ... on wrong side } diff --git a/library/WT/Report/HTML.php b/library/WT/Report/HTML.php index 9bf59c61af..e40a0c04e1 100644 --- a/library/WT/Report/HTML.php +++ b/library/WT/Report/HTML.php @@ -510,7 +510,7 @@ class WT_Report_HTML extends WT_Report_Base { // Calculate the line width $lw = (int)($width / ($this->getCurrentStyleHeight() / 2)); // Wordwrap each line - //@@ indi source texts, note text, indi sub-titles, footer texts + //@@ indi source texts, note text, indi sub-titles, footer texts $lines = explode("\n", $str); // Line Feed counter $lfct = count($lines); @@ -546,7 +546,7 @@ class WT_Report_HTML extends WT_Report_Base { $htmlcode .= " style=\"color:$color;\""; } } - + $htmlcode .= ">$text</span>"; $htmlcode = str_replace(array("\n", "> ", " <"), array("<br>", "> ", " <"), $htmlcode); echo $htmlcode; @@ -589,7 +589,7 @@ class CellHTML extends Cell { * @param WT_Report_HTML &$html */ function render(&$html) { - //@@ report title, indi report sub-titles, total indis, generated by & date, indi note text - why is the text printed on 2 lines?? What adds \n? + //@@ report title, indi report sub-titles, total indis, generated by & date, indi note text - why is the text printed on 2 lines?? What adds \n? if (strpos($this->text, "{{:ptp:}}") !== false) { return; @@ -1281,7 +1281,7 @@ class FootnoteHTML extends Footnote { echo "<a href=\"#footnote", $this->num, "\"><sup>"; // working $html->write($html->entityRTL. $this->num); - //@@ Source numbers + //@@ Source numbers echo "</sup></a>\n"; } @@ -1300,7 +1300,7 @@ class FootnoteHTML extends Footnote { $temptext = str_replace("#PAGENUM#", $html->PageNo(), $this->text); // underline «title» part of Source item $temptext = str_replace(array('«', '»'), array('<u>', '</u>'), $temptext); -//$temptext.="SS"; //@@ +//$temptext.="SS"; //@@ echo "\n<div><a name=\"footnote", $this->num, "\"></a>"; $html->write($this->num. ". ". $temptext); echo "</div>"; @@ -1472,7 +1472,7 @@ class ImageHTML extends Image { } // Image alignment - //@@ Indi picture + //@@ Indi picture switch($this->align) { case "L": echo "<div style=\"position:absolute;top:", $this->y, "pt;left:0pt;width:", $html->getRemainingWidth(), "pt;text-align:left;\">\n"; @@ -1558,6 +1558,6 @@ class LineHTML extends Line { // One or the other will be higher... lasy mans way... $html->addMaxY($this->y1); $html->addMaxY($this->y2); -//echo "<br>AA";//@@ +//echo "<br>AA";//@@ } } //-- END Line diff --git a/library/WT/Report/PDF.php b/library/WT/Report/PDF.php index 8f0bb65703..dd8c21dc49 100644 --- a/library/WT/Report/PDF.php +++ b/library/WT/Report/PDF.php @@ -54,7 +54,7 @@ class WT_Report_PDF extends WT_Report_Base { const unicode = true; /** * FALSE means that the full font is embedded, TRUE means only the used chars - * in TCPDF v5.9 font subsetting is a very slow process, this leads to larger files + * in TCPDF v5.9 font subsetting is a very slow process, this leads to larger files * @var boolean const */ const subsetting = false; @@ -489,7 +489,7 @@ class PDF extends TCPDF { $this->currentStyle = $s; $style = $this->wt_report->getStyle($s); $this->SetFont($style['font'], $style['style'], $style['size']); - } + } /** * Get the style -PDF @@ -1068,7 +1068,7 @@ class TextBoxPDF extends TextBox { // Draw the border if (!empty($cS)) { if (!$pdf->getRTL()) { - $cXM = $cX; + $cXM = $cX; } else { $cXM=($pdf->getPageWidth())-$cX-$cW; } @@ -1082,7 +1082,7 @@ class TextBoxPDF extends TextBox { $pdf->SetY($cY + $cM['padding_top']); } else { - $pdf->SetY($cY + $cM['cell']); + $pdf->SetY($cY + $cM['cell']); } } } @@ -1093,7 +1093,7 @@ class TextBoxPDF extends TextBox { $pdf->SetLeftMargin($cX + $cM['padding_left']); } else { - $pdf->SetLeftMargin($cX + $cM['cell']); + $pdf->SetLeftMargin($cX + $cM['cell']); } $pdf->SetRightMargin($pdf->getRemainingWidthPDF() - $cW + $cM['right']); } @@ -1184,7 +1184,7 @@ class TextPDF extends Text { $temptext = str_replace("#PAGENUM#", $pdf->PageNo(), $this->text); // underline «title» part of Source item $temptext = str_replace(array('«', '»'), array('<u>', '</u>'), $temptext); - + // Paint the text color or they might use inherited colors by the previous function $match = array(); if (preg_match("/#?(..)(..)(..)/", $this->color, $match)) { diff --git a/library/WT/Repository.php b/library/WT/Repository.php index bfccaead43..054b214726 100644 --- a/library/WT/Repository.php +++ b/library/WT/Repository.php @@ -41,7 +41,7 @@ class WT_Repository extends WT_GedcomRecord { return $statement->execute(array($xref, $gedcom_id))->fetchOne(); } - + // Generate a private version of this record protected function createPrivateGedcomRecord($access_level) { return '0 @' . $this->xref . "@ REPO\n1 NAME " . WT_I18N::translate('Private'); diff --git a/library/WT/Site.php b/library/WT/Site.php index 3f497c33ec..3f3b90f69a 100644 --- a/library/WT/Site.php +++ b/library/WT/Site.php @@ -25,7 +25,7 @@ if (!defined('WT_WEBTREES')) { class WT_Site { static $setting=null; - + // Get and Set the site's configuration settings public static function preference($setting_name, $setting_value=null) { // There are lots of settings, and we need to fetch lots of them on every page diff --git a/library/WT/Soundex.php b/library/WT/Soundex.php index 52ab2ddf32..04bc0a2706 100644 --- a/library/WT/Soundex.php +++ b/library/WT/Soundex.php @@ -643,7 +643,7 @@ class WT_Soundex { 'ى'=>array('1', '1','',''), ); - private static function DMSoundex($name) { + private static function DMSoundex($name) { // Apply special transformation rules to the input string $name = utf8_strtoupper($name); foreach (self::$transformNameTable as $transformRule) { diff --git a/library/WT/Stats.php b/library/WT/Stats.php index 8bddf9adaa..50753ee0f0 100644 --- a/library/WT/Stats.php +++ b/library/WT/Stats.php @@ -2266,7 +2266,7 @@ class WT_Stats { function lastDivorceYear() { return $this->_mortalityQuery('year', 'DESC', 'DIV'); } function lastDivorceName() { return $this->_mortalityQuery('name', 'DESC', 'DIV'); } function lastDivorcePlace() { return $this->_mortalityQuery('place', 'DESC', 'DIV'); } - + function statsDiv($params=null) {return $this->_statsDiv(true, false, -1, -1, $params);} function _statsMarrAge($simple=true, $sex='M', $year1=-1, $year2=-1, $params=null) { @@ -2423,7 +2423,7 @@ class WT_Stats { function oldestMarriageMale() { return $this->_marriageQuery('full', 'DESC', 'M'); } function oldestMarriageMaleName() { return $this->_marriageQuery('name', 'DESC', 'M'); } function oldestMarriageMaleAge($show_years=false) { return $this->_marriageQuery('age', 'DESC', 'M', $show_years); } - + function statsMarrAge($params=null) { return $this->_statsMarrAge(true, 'BOTH', -1, -1, $params); } function ageBetweenSpousesMF ($params=null) { return $this->_ageBetweenSpousesQuery($type='nolist', $age_dir='DESC', $params=null); } @@ -2664,7 +2664,7 @@ class WT_Stats { } return $top10; } - + function _monthFirstChildQuery($simple=true, $sex=false, $year1=-1, $year2=-1, $params=null) { global $WT_STATS_S_CHART_X, $WT_STATS_S_CHART_Y, $WT_STATS_CHART_COLOR1, $WT_STATS_CHART_COLOR2; if ($params === null) {$params = array();} @@ -3456,8 +3456,8 @@ class WT_Stats { return getUserName(); } else { if (is_array($params) && isset($params[0]) && $params[0] != '') { - # if #username:visitor# was specified, then "visitor" will be returned when the user is not logged in - return $params[0]; + # if #username:visitor# was specified, then "visitor" will be returned when the user is not logged in + return $params[0]; } else return null; } @@ -3552,7 +3552,7 @@ class WT_Stats { } else { // indi/fam/sour/etc. } - + $count=WT_DB::prepare( "SELECT SQL_NO_CACHE page_count FROM `##hit_counter`". " WHERE gedcom_id=? AND page_name=? AND page_parameter=?" diff --git a/library/WT/Tree.php b/library/WT/Tree.php index 80548d1d31..ef9d7d8c23 100644 --- a/library/WT/Tree.php +++ b/library/WT/Tree.php @@ -85,7 +85,7 @@ class WT_Tree { return $this; } } - + // Get and Set the tree's configuration settings public function userPreference($user_id, $setting_name, $setting_value=null) { // There are lots of settings, and we need to fetch lots of them on every page @@ -115,7 +115,7 @@ class WT_Tree { return $this; } } - + // Can a user accept changes for this tree? public function canAcceptChanges($user_id) { return @@ -247,7 +247,7 @@ class WT_Tree { set_gedcom_setting($tree_id, 'MAX_PEDIGREE_GENERATIONS', '10'); set_gedcom_setting($tree_id, 'MEDIA_DIRECTORY', 'media/'); set_gedcom_setting($tree_id, 'MEDIA_ID_PREFIX', 'M'); - set_gedcom_setting($tree_id, 'MEDIA_UPLOAD', WT_PRIV_USER); + set_gedcom_setting($tree_id, 'MEDIA_UPLOAD', WT_PRIV_USER); set_gedcom_setting($tree_id, 'META_DESCRIPTION', ''); set_gedcom_setting($tree_id, 'META_TITLE', WT_WEBTREES); set_gedcom_setting($tree_id, 'NOTE_FACTS_ADD', 'SOUR,RESN'); @@ -348,7 +348,7 @@ class WT_Tree { // Delete everything relating to a tree public static function delete($tree_id) { - // If this is the default tree, then unset + // If this is the default tree, then unset if (WT_Site::preference('DEFAULT_GEDCOM')==self::getNameFromId($tree_id)) { WT_Site::preference('DEFAULT_GEDCOM', ''); } diff --git a/library/pclzip.lib.php b/library/pclzip.lib.php index 55b61c238a..4bc05df19c 100644 --- a/library/pclzip.lib.php +++ b/library/pclzip.lib.php @@ -32,7 +32,7 @@ if (!defined('WT_WEBTREES')) { if (!defined('PCLZIP_READ_BLOCK_SIZE')) { define( 'PCLZIP_READ_BLOCK_SIZE', 2048 ); } - + // ----- File list separator // In version 1.x of PclZip, the separator for file list is a space // (which is not a very smart choice, specifically for windows paths !). @@ -71,7 +71,7 @@ if (!defined('WT_WEBTREES')) { // ----- Optional threshold ratio for use of temporary files // Pclzip sense the size of the file to add/extract and decide to - // use or not temporary file. The algorythm is looking for + // use or not temporary file. The algorythm is looking for // memory_limit of PHP and apply a ratio. // threshold = memory_limit * ratio. // Recommended values are under 0.5. Default 0.47. @@ -155,7 +155,7 @@ if (!defined('WT_WEBTREES')) { define( 'PCLZIP_OPT_ADD_TEMP_FILE_ON', 77021 ); // alias define( 'PCLZIP_OPT_TEMP_FILE_OFF', 77022 ); define( 'PCLZIP_OPT_ADD_TEMP_FILE_OFF', 77022 ); // alias - + // ----- File description attributes define( 'PCLZIP_ATT_FILE_NAME', 79001 ); define( 'PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002 ); @@ -201,7 +201,7 @@ if (!defined('WT_WEBTREES')) { // ----- Internal error handling var $error_code = 1; var $error_string = ''; - + // ----- Current status of the magic_quotes_runtime // This value store the php configuration for magic_quotes // The class can then disable the magic_quotes and reset it after @@ -335,7 +335,7 @@ if (!defined('WT_WEBTREES')) { } } } - + // ----- Look for default option values $this->privOptionDefaultThreshold($v_options); @@ -344,16 +344,16 @@ if (!defined('WT_WEBTREES')) { $v_att_list = array(); $v_filedescr_list = array(); $p_result_list = array(); - + // ----- Look if the $p_filelist is really an array if (is_array($p_filelist)) { - + // ----- Look if the first element is also an array // This will mean that this is a file description entry if (isset($p_filelist[0]) && is_array($p_filelist[0])) { $v_att_list = $p_filelist; } - + // ----- The list is a list of string names else { $v_string_list = $p_filelist; @@ -371,7 +371,7 @@ if (!defined('WT_WEBTREES')) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_filelist"); return 0; } - + // ----- Reformat the string list if (sizeof($v_string_list) != 0) { foreach ($v_string_list as $v_string) { @@ -382,7 +382,7 @@ if (!defined('WT_WEBTREES')) { } } } - + // ----- For each file in the list check the attributes $v_supported_attributes = array ( PCLZIP_ATT_FILE_NAME => 'mandatory' @@ -531,16 +531,16 @@ if (!defined('WT_WEBTREES')) { $v_att_list = array(); $v_filedescr_list = array(); $p_result_list = array(); - + // ----- Look if the $p_filelist is really an array if (is_array($p_filelist)) { - + // ----- Look if the first element is also an array // This will mean that this is a file description entry if (isset($p_filelist[0]) && is_array($p_filelist[0])) { $v_att_list = $p_filelist; } - + // ----- The list is a list of string names else { $v_string_list = $p_filelist; @@ -558,14 +558,14 @@ if (!defined('WT_WEBTREES')) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type '".gettype($p_filelist)."' for p_filelist"); return 0; } - + // ----- Reformat the string list if (sizeof($v_string_list) != 0) { foreach ($v_string_list as $v_string) { $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string; } } - + // ----- For each file in the list check the attributes $v_supported_attributes = array ( PCLZIP_ATT_FILE_NAME => 'mandatory' @@ -999,7 +999,7 @@ if (!defined('WT_WEBTREES')) { // Options : // PCLZIP_OPT_BY_INDEX : // PCLZIP_OPT_BY_NAME : - // PCLZIP_OPT_BY_EREG : + // PCLZIP_OPT_BY_EREG : // PCLZIP_OPT_BY_PREG : // Return Values : // 0 on failure, @@ -1067,7 +1067,7 @@ if (!defined('WT_WEBTREES')) { // -------------------------------------------------------------------------------- function deleteByIndex($p_index) { - + $p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index); // ----- Return @@ -1117,7 +1117,7 @@ if (!defined('WT_WEBTREES')) { if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0) { $this->privSwapBackMagicQuotes(); - + // ----- Error log PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode'); @@ -1429,7 +1429,7 @@ if (!defined('WT_WEBTREES')) { function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options=false) { $v_result=1; - + // ----- Read the options $i=0; while ($i<$p_size) { @@ -1469,13 +1469,13 @@ if (!defined('WT_WEBTREES')) { PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'"); return PclZip::errorCode(); } - + // ----- Check for incompatible options if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'"); return PclZip::errorCode(); } - + // ----- Check the value $v_value = $p_options_list[$i+1]; if ((!is_integer($v_value)) || ($v_value<0)) { @@ -1494,7 +1494,7 @@ if (!defined('WT_WEBTREES')) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'"); return PclZip::errorCode(); } - + $v_result_list[$p_options_list[$i]] = true; break; @@ -1509,7 +1509,7 @@ if (!defined('WT_WEBTREES')) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_THRESHOLD'"); return PclZip::errorCode(); } - + $v_result_list[$p_options_list[$i]] = true; break; @@ -1658,7 +1658,7 @@ if (!defined('WT_WEBTREES')) { // ----- Return return PclZip::errorCode(); } - + // ----- Reduce the index list // each index item in the list must be a couple with a start and // an end value : [0,3], [5-5], [8-10], ... @@ -1669,10 +1669,10 @@ if (!defined('WT_WEBTREES')) { // ----- Explode the item $v_item_list = explode("-", $v_work_list[$j]); $v_size_item_list = sizeof($v_item_list); - + // ----- TBC : Here we might check that each item is a // real integer ... - + // ----- Look for single value if ($v_size_item_list == 1) { // ----- Set the option value @@ -1706,7 +1706,7 @@ if (!defined('WT_WEBTREES')) { } $v_sort_value = $v_result_list[$p_options_list[$i]][$j]['start']; } - + // ----- Sort the items if ($v_sort_flag) { // TBC : To Be Completed @@ -1809,10 +1809,10 @@ if (!defined('WT_WEBTREES')) { } } } - + // ----- Look for default values if (!isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) { - + } // ----- Return @@ -1829,17 +1829,17 @@ if (!defined('WT_WEBTREES')) { function privOptionDefaultThreshold(&$p_options) { $v_result=1; - + if (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) || isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) { return $v_result; } - + // ----- Get 'memory_limit' configuration value $v_memory_limit = ini_get('memory_limit'); $v_memory_limit = trim($v_memory_limit); $last = strtolower(substr($v_memory_limit, -1)); - + if($last == 'g') //$v_memory_limit = $v_memory_limit*1024*1024*1024; $v_memory_limit = $v_memory_limit*1073741824; @@ -1848,15 +1848,15 @@ if (!defined('WT_WEBTREES')) { $v_memory_limit = $v_memory_limit*1048576; if($last == 'k') $v_memory_limit = $v_memory_limit*1024; - + $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit*PCLZIP_TEMPORARY_FILE_RATIO); - + // ----- Sanity check : No threshold if value lower than 1M if ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] < 1048576) { unset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]); } - + // ----- Return return $v_result; } @@ -1873,10 +1873,10 @@ if (!defined('WT_WEBTREES')) { function privFileDescrParseAtt(&$p_file_list, &$p_filedescr, $v_options, $v_requested_options=false) { $v_result=1; - + // ----- For each file in the list check the attributes foreach ($p_file_list as $v_key => $v_value) { - + // ----- Check if the option is supported if (!isset($v_requested_options[$v_key])) { // ----- Error log @@ -1895,7 +1895,7 @@ if (!defined('WT_WEBTREES')) { } $p_filedescr['filename'] = PclZipUtilPathReduction($v_value); - + if ($p_filedescr['filename'] == '') { PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '".PclZipUtilOptionText($v_key)."'"); return PclZip::errorCode(); @@ -1976,10 +1976,10 @@ if (!defined('WT_WEBTREES')) { } } } - + // end foreach } - + // ----- Return return $v_result; } @@ -1992,7 +1992,7 @@ if (!defined('WT_WEBTREES')) { // or a string to be added as file. For any other type of files (link, other) // just ignore the item. // Then prepare the information that will be stored for that file. - // When its a folder, expand the folder with all the files that are in that + // When its a folder, expand the folder with all the files that are in that // folder (recursively). // Parameters : // Return Values : @@ -2002,20 +2002,20 @@ if (!defined('WT_WEBTREES')) { function privFileDescrExpand(&$p_filedescr_list, &$p_options) { $v_result=1; - + // ----- Create a result list $v_result_list = array(); - + // ----- Look each entry for ($i=0; $i<sizeof($p_filedescr_list); $i++) { - + // ----- Get filedescr $v_descr = $p_filedescr_list[$i]; - + // ----- Reduce the filename $v_descr['filename'] = PclZipUtilTranslateWinPath($v_descr['filename'], false); $v_descr['filename'] = PclZipUtilPathReduction($v_descr['filename']); - + // ----- Look for real file or folder if (file_exists($v_descr['filename'])) { if (@is_file($v_descr['filename'])) { @@ -2033,12 +2033,12 @@ if (!defined('WT_WEBTREES')) { continue; } } - + // ----- Look for string added as file else if (isset($v_descr['content'])) { $v_descr['type'] = 'virtual_file'; } - + // ----- Missing file else { // ----- Error log @@ -2047,13 +2047,13 @@ if (!defined('WT_WEBTREES')) { // ----- Return return PclZip::errorCode(); } - + // ----- Calculate the stored filename $this->privCalculateStoredFilename($v_descr, $p_options); - + // ----- Add the descriptor in result list $v_result_list[sizeof($v_result_list)] = $v_descr; - + // ----- Look for folder if ($v_descr['type'] == 'folder') { // ----- List of items in folder @@ -2066,10 +2066,10 @@ if (!defined('WT_WEBTREES')) { if (($v_item_handler == '.') || ($v_item_handler == '..')) { continue; } - + // ----- Compose the full filename $v_dirlist_descr[$v_dirlist_nb]['filename'] = $v_descr['filename'].'/'.$v_item_handler; - + // ----- Look for different stored filename // Because the name of the folder was changed, the name of the // files/sub-folders also change @@ -2082,34 +2082,34 @@ if (!defined('WT_WEBTREES')) { $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_item_handler; } } - + $v_dirlist_nb++; } - + @closedir($v_folder_handler); } else { // TBC : unable to open folder in read mode } - + // ----- Expand each element of the list if ($v_dirlist_nb != 0) { // ----- Expand if (($v_result = $this->privFileDescrExpand($v_dirlist_descr, $p_options)) != 1) { return $v_result; } - + // ----- Concat the resulting list $v_result_list = array_merge($v_result_list, $v_dirlist_descr); } else { } - + // ----- Free local array unset($v_dirlist_descr); } } - + // ----- Get the result list $p_filedescr_list = $v_result_list; @@ -2128,7 +2128,7 @@ if (!defined('WT_WEBTREES')) { { $v_result=1; $v_list_detail = array(); - + // ----- Magic quotes trick $this->privDisableMagicQuotes(); @@ -2458,7 +2458,7 @@ if (!defined('WT_WEBTREES')) { // Function : privAddFileList() // Description : // Parameters : - // $p_filedescr_list : An array containing the file description + // $p_filedescr_list : An array containing the file description // or directory names to add in the zip // $p_result_list : list of added files with their properties (specially the status field) // Return Values : @@ -2476,7 +2476,7 @@ if (!defined('WT_WEBTREES')) { // ----- Format the filename $p_filedescr_list[$j]['filename'] = PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false); - + // ----- Skip empty file names // TBC : Can this be possible ? not checked in DescrParseAtt ? @@ -2528,7 +2528,7 @@ if (!defined('WT_WEBTREES')) { function privAddFile($p_filedescr, &$p_header, &$p_options) { $v_result=1; - + // ----- Working variable $p_filename = $p_filedescr['filename']; @@ -2540,8 +2540,8 @@ if (!defined('WT_WEBTREES')) { // ----- Return return PclZip::errorCode(); } - - // ----- Look for a stored different filename + + // ----- Look for a stored different filename /* TBC : Removed if (isset($p_filedescr['stored_filename'])) { $v_stored_filename = $p_filedescr['stored_filename']; @@ -2576,20 +2576,20 @@ if (!defined('WT_WEBTREES')) { $p_header['external'] = 0x00000000; $p_header['size'] = filesize($p_filename); } - + // ----- Look for regular folder else if ($p_filedescr['type']=='folder') { $p_header['external'] = 0x00000010; $p_header['mtime'] = filemtime($p_filename); $p_header['size'] = filesize($p_filename); } - + // ----- Look for virtual file else if ($p_filedescr['type'] == 'virtual_file') { $p_header['external'] = 0x00000000; $p_header['size'] = strlen($p_filedescr['content']); } - + // ----- Look for filetime if (isset($p_filedescr['mtime'])) { @@ -2641,7 +2641,7 @@ if (!defined('WT_WEBTREES')) { if ($p_header['stored_filename'] == "") { $p_header['status'] = "filtered"; } - + // ----- Check the path length if (strlen($p_header['stored_filename']) > 0xFF) { $p_header['status'] = 'filename_too_long'; @@ -2653,7 +2653,7 @@ if (!defined('WT_WEBTREES')) { // ----- Look for a file if ($p_filedescr['type'] == 'file') { // ----- Look for using temporary file to zip - if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) + if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON]) || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_header['size'])) ) ) { @@ -2662,7 +2662,7 @@ if (!defined('WT_WEBTREES')) { return $v_result; } } - + // ----- Use "in memory" zip algo else { @@ -2680,14 +2680,14 @@ if (!defined('WT_WEBTREES')) { // ----- Calculate the CRC $p_header['crc'] = @crc32($v_content); - + // ----- Look for no compression if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) { // ----- Set header parameters $p_header['compressed_size'] = $p_header['size']; $p_header['compression'] = 0; } - + // ----- Look for normal compression else { // ----- Compress the content @@ -2697,7 +2697,7 @@ if (!defined('WT_WEBTREES')) { $p_header['compressed_size'] = strlen($v_content); $p_header['compression'] = 8; } - + // ----- Call the header generation if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { @fclose($v_file); @@ -2713,19 +2713,19 @@ if (!defined('WT_WEBTREES')) { // ----- Look for a virtual file (a file from string) else if ($p_filedescr['type'] == 'virtual_file') { - + $v_content = $p_filedescr['content']; // ----- Calculate the CRC $p_header['crc'] = @crc32($v_content); - + // ----- Look for no compression if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) { // ----- Set header parameters $p_header['compressed_size'] = $p_header['size']; $p_header['compression'] = 0; } - + // ----- Look for normal compression else { // ----- Compress the content @@ -2735,7 +2735,7 @@ if (!defined('WT_WEBTREES')) { $p_header['compressed_size'] = strlen($v_content); $p_header['compression'] = 8; } - + // ----- Call the header generation if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { @fclose($v_file); @@ -2801,7 +2801,7 @@ if (!defined('WT_WEBTREES')) { function privAddFileUsingTempFile($p_filedescr, &$p_header, &$p_options) { $v_result=PCLZIP_ERR_NO_ERROR; - + // ----- Working variable $p_filename = $p_filedescr['filename']; @@ -2896,7 +2896,7 @@ if (!defined('WT_WEBTREES')) { // ----- Unlink the temporary file @unlink($v_gzip_temp_name); - + // ----- Return return $v_result; } @@ -2913,7 +2913,7 @@ if (!defined('WT_WEBTREES')) { function privCalculateStoredFilename(&$p_filedescr, &$p_options) { $v_result=1; - + // ----- Working variables $p_filename = $p_filedescr['filename']; if (isset($p_options[PCLZIP_OPT_ADD_PATH])) { @@ -2941,7 +2941,7 @@ if (!defined('WT_WEBTREES')) { // ----- Remove drive letter if any $v_stored_filename = PclZipUtilTranslateWinPath($p_filedescr['new_full_name']); } - + // ----- Look for path and/or short name change else { @@ -2971,7 +2971,7 @@ if (!defined('WT_WEBTREES')) { if ( (substr($p_filename, 0, 2) == "./") || (substr($p_remove_dir, 0, 2) == "./")) { - + if ( (substr($p_filename, 0, 2) == "./") && (substr($p_remove_dir, 0, 2) != "./")) { $p_remove_dir = "./".$p_remove_dir; @@ -2994,10 +2994,10 @@ if (!defined('WT_WEBTREES')) { } } } - + // ----- Remove drive letter if any $v_stored_filename = PclZipUtilTranslateWinPath($v_stored_filename); - + // ----- Look for path to add if ($p_add_dir != "") { if (substr($p_add_dir, -1) == "/") @@ -3010,7 +3010,7 @@ if (!defined('WT_WEBTREES')) { // ----- Filename (reduce the path of stored name) $v_stored_filename = PclZipUtilPathReduction($v_stored_filename); $p_filedescr['stored_filename'] = $v_stored_filename; - + // ----- Return return $v_result; } @@ -3161,7 +3161,7 @@ if (!defined('WT_WEBTREES')) { { // ----- Magic quotes trick $this->privSwapBackMagicQuotes(); - + // ----- Error log PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode'); @@ -3392,7 +3392,7 @@ if (!defined('WT_WEBTREES')) { // ----- Look for extract by ereg rule // ereg() is deprecated with PHP 5.3 - /* + /* else if ( (isset($p_options[PCLZIP_OPT_BY_EREG])) && ($p_options[PCLZIP_OPT_BY_EREG] != "")) { @@ -3414,7 +3414,7 @@ if (!defined('WT_WEBTREES')) { // ----- Look for extract by index rule else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX])) && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) { - + // ----- Look if the index is in the list for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) { @@ -3447,7 +3447,7 @@ if (!defined('WT_WEBTREES')) { && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { $this->privSwapBackMagicQuotes(); - + PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION, "Filename '".$v_header['stored_filename']."' is " ."compressed by an unsupported compression " @@ -3456,7 +3456,7 @@ if (!defined('WT_WEBTREES')) { return PclZip::errorCode(); } } - + // ----- Check encrypted files if (($v_extract) && (($v_header['flag'] & 1) == 1)) { $v_header['status'] = 'unsupported_encryption'; @@ -3488,7 +3488,7 @@ if (!defined('WT_WEBTREES')) { $v_extract = false; } - + // ----- Look for real extraction if ($v_extract) { @@ -3537,7 +3537,7 @@ if (!defined('WT_WEBTREES')) { // ----- Next extracted file $v_nb_extracted++; - + // ----- Look for user callback abort if ($v_result1 == 2) { break; @@ -3673,12 +3673,12 @@ if (!defined('WT_WEBTREES')) { if ($p_path != '') { $p_entry['filename'] = $p_path."/".$p_entry['filename']; } - + // ----- Check a base_dir_restriction if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) { $v_inclusion = PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION], - $p_entry['filename']); + $p_entry['filename']); if ($v_inclusion == 0) { PclZip::privErrorLog(PCLZIP_ERR_DIRECTORY_RESTRICTION, @@ -3706,7 +3706,7 @@ if (!defined('WT_WEBTREES')) { $p_entry['status'] = "skipped"; $v_result = 1; } - + // ----- Look for abort result if ($v_result == 2) { // ----- This status is internal and will be changed in 'skipped' @@ -3733,7 +3733,7 @@ if (!defined('WT_WEBTREES')) { // ----- Change the file status $p_entry['status'] = "already_a_directory"; - + // ----- Look for PCLZIP_OPT_STOP_ON_ERROR // For historical reason first PclZip implementation does not stop // when this kind of error occurs. @@ -3806,10 +3806,10 @@ if (!defined('WT_WEBTREES')) { $v_dir_to_check = dirname($p_entry['filename']); if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) { - + // ----- Change the file status $p_entry['status'] = "path_creation_fail"; - + // ----- Return //return $v_result; $v_result = 1; @@ -3848,7 +3848,7 @@ if (!defined('WT_WEBTREES')) { $v_binary_data = pack('a'.$v_read_size, $v_buffer); @fwrite($v_dest_file, $v_binary_data, $v_read_size); */ - @fwrite($v_dest_file, $v_buffer, $v_read_size); + @fwrite($v_dest_file, $v_buffer, $v_read_size); $v_size -= $v_read_size; } @@ -3857,7 +3857,7 @@ if (!defined('WT_WEBTREES')) { // ----- Change the file mtime touch($p_entry['filename'], $p_entry['mtime']); - + } else { @@ -3870,7 +3870,7 @@ if (!defined('WT_WEBTREES')) { // ----- Look for using temporary file to unzip - if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) + if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON]) || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_entry['size'])) ) ) { @@ -3879,42 +3879,42 @@ if (!defined('WT_WEBTREES')) { return $v_result; } } - + // ----- Look for extract in memory else { - + // ----- Read the compressed file in a buffer (one shot) $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); - + // ----- Decompress the file $v_file_content = @gzinflate($v_buffer); unset($v_buffer); if ($v_file_content === FALSE) { - + // ----- Change the file status // TBC $p_entry['status'] = "error"; - + return $v_result; } - + // ----- Opening destination file if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) { - + // ----- Change the file status $p_entry['status'] = "write_error"; - + return $v_result; } - + // ----- Write the uncompressed data @fwrite($v_dest_file, $v_file_content, $p_entry['size']); unset($v_file_content); - + // ----- Closing the destination file @fclose($v_dest_file); - + } // ----- Change the file mtime @@ -3935,7 +3935,7 @@ if (!defined('WT_WEBTREES')) { if ($p_entry['status'] == "aborted") { $p_entry['status'] = "skipped"; } - + // ----- Look for post-extract callback elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { @@ -3969,7 +3969,7 @@ if (!defined('WT_WEBTREES')) { function privExtractFileUsingTempFile(&$p_entry, &$p_options) { $v_result=1; - + // ----- Creates a temporary file $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz'; if (($v_dest_file = @fopen($v_gzip_temp_name, "wb")) == 0) { @@ -4030,7 +4030,7 @@ if (!defined('WT_WEBTREES')) { // ----- Delete the temporary file @unlink($v_gzip_temp_name); - + // ----- Return return $v_result; } @@ -4108,7 +4108,7 @@ if (!defined('WT_WEBTREES')) { // ----- Read the compressed file in a buffer (one shot) $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); - + // ----- Decompress the file $v_file_content = gzinflate($v_buffer); unset($v_buffer); @@ -4189,7 +4189,7 @@ if (!defined('WT_WEBTREES')) { $p_entry['status'] = "skipped"; $v_result = 1; } - + // ----- Look for abort result if ($v_result == 2) { // ----- This status is internal and will be changed in 'skipped' @@ -4219,7 +4219,7 @@ if (!defined('WT_WEBTREES')) { // ----- Reading the file $v_data = @fread($this->zip_fd, $p_entry['compressed_size']); - + // ----- Decompress the file if (($p_string = @gzinflate($v_data)) === FALSE) { // TBC @@ -4238,14 +4238,14 @@ if (!defined('WT_WEBTREES')) { if ($p_entry['status'] == "aborted") { $p_entry['status'] = "skipped"; } - + // ----- Look for post-extract callback elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { // ----- Generate a local information $v_local_header = array(); $this->privConvertHeader2FileInfo($p_entry, $v_local_header); - + // ----- Swap the content to header $v_local_header['content'] = $p_string; $p_string = ''; @@ -4506,7 +4506,7 @@ if (!defined('WT_WEBTREES')) { } if ($p_local_header['filename_len'] != $p_central_header['filename_len']) { } - + // ----- Look for flag bit 3 if (($p_local_header['flag'] & 8) == 8) { $p_local_header['size'] = $p_central_header['size']; @@ -4592,9 +4592,9 @@ if (!defined('WT_WEBTREES')) { // ----- Add the byte //$v_bytes = ($v_bytes << 8) | Ord($v_byte); - // Note we mask the old value down such that once shifted we can never end up with more than a 32bit number - // Otherwise on systems where we have 64bit integers the check below for the magic number will fail. - $v_bytes = ( ($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte); + // Note we mask the old value down such that once shifted we can never end up with more than a 32bit number + // Otherwise on systems where we have 64bit integers the check below for the magic number will fail. + $v_bytes = ( ($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte); // ----- Compare the bytes if ($v_bytes == 0x504b0506) @@ -4872,7 +4872,7 @@ if (!defined('WT_WEBTREES')) { // ----- Return return $v_result; } - + // ----- Check that local file header is same as central file header if ($this->privCheckFileHeaders($v_local_header, $v_header_list[$i]) != 1) { @@ -4956,11 +4956,11 @@ if (!defined('WT_WEBTREES')) { // TBC : I should test the result ... //@rename($v_zip_temp_name, $this->zipname); PclZipUtilRename($v_zip_temp_name, $this->zipname); - + // ----- Destroy the temporary archive unset($v_temp_zip); } - + // ----- Remove every files : reset the file else if ($v_central_dir['entries'] != 0) { $this->privCloseFd(); @@ -5027,7 +5027,7 @@ if (!defined('WT_WEBTREES')) { // ----- Create the directory if (!@mkdir($p_dir, WT_PERM_EXE)) - + { // ----- Error log PclZip::privErrorLog(PCLZIP_ERR_DIR_CREATE_FAIL, "Unable to create directory '$p_dir'"); @@ -5448,7 +5448,7 @@ if (!defined('WT_WEBTREES')) { } } } - + // ----- Look for skip if ($v_skip > 0) { while ($v_skip > 0) { @@ -5481,7 +5481,7 @@ if (!defined('WT_WEBTREES')) { function PclZipUtilPathInclusion($p_dir, $p_path) { $v_result = 1; - + // ----- Look for path beginning by ./ if ( ($p_dir == '.') || ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) { @@ -5649,7 +5649,7 @@ if (!defined('WT_WEBTREES')) { // -------------------------------------------------------------------------------- function PclZipUtilOptionText($p_option) { - + $v_list = get_defined_constants(); for (reset($v_list); $v_key = key($v_list); next($v_list)) { $v_prefix = substr($v_key, 0, 10); @@ -5660,7 +5660,7 @@ if (!defined('WT_WEBTREES')) { return $v_key; } } - + $v_result = 'Unknown'; return $v_result; |
