phpBMS

Show
Ignore:
Timestamp:
12/31/09 13:36:45 (2 years ago)
Author:
brieb
Message:
  • Introduced administratively changeable settings to indvidual reports
  • Modified all reports to work with new settings system
  • Altered invoice and line item total reports to accept parameters from reportsettings: You can now bypass the grouping/column dialog by providing the infrmation administratively
  • Altered all sales order PDF reports to accept parameters from reportsettings: You can now administratively change certain aspects of the print outs, including what parts of the top of the report to show, and what to title the report
  • Altered label reports to accept parameters from reportsettings: printed data as well

as label measurements and layout are now defined by administratively

  • Altered export and tableprint reports to accept parameters from reportsettings: You can specify individual columns and from table instead of just the defaults (all fields, main table only)
  • Added var_dump-esque 'debug' function for development purposes to common functions
  • Integrated FPDI functionality with sales order PDF reports: It is now possible to use a PDF saved in the files table as a background template for your invoices (e.g. watermarks)
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/phpbms/fpdf/font/makefont/makefont.php

    r667 r693  
    22/******************************************************************************* 
    33* Utility to generate font definition files                                    * 
    4 * Version: 1.13                                                                * 
    5 * Date:    2004-12-31                                                          * 
     4*                                                                              * 
     5* Version: 1.14                                                                * 
     6* Date:    2008-08-03                                                          * 
     7* Author:  Olivier PLATHEY                                                     * 
    68*******************************************************************************/ 
    79 
     
    1214        $a=file($file); 
    1315        if(empty($a)) 
    14                 die('<B>Error:</B> encoding not found: '.$enc); 
     16                die('<b>Error:</b> encoding not found: '.$enc); 
    1517        $cc2gn=array(); 
    1618        foreach($a as $l) 
    1719        { 
    18                 if($l{0}=='!') 
     20                if($l[0]=='!') 
    1921                { 
    2022                        $e=preg_split('/[ \\t]+/',rtrim($l)); 
     
    3234} 
    3335 
    34 function ReadAFM($file,&$map) 
     36function ReadAFM($file, &$map) 
    3537{ 
    3638        //Read a font metric file 
     
    115117                if(!isset($widths['.notdef'])) 
    116118                        $widths['.notdef']=600; 
    117                 if(!isset($widths['Delta']) and isset($widths['increment'])) 
     119                if(!isset($widths['Delta']) && isset($widths['increment'])) 
    118120                        $widths['Delta']=$widths['increment']; 
    119121                //Order widths according to map 
     
    122124                        if(!isset($widths[$map[$i]])) 
    123125                        { 
    124                                 echo '<B>Warning:</B> character '.$map[$i].' is missing<br />'; 
     126                                echo '<b>Warning:</b> character '.$map[$i].' is missing<br>'; 
    125127                                $widths[$i]=$widths['.notdef']; 
    126128                        } 
     
    133135} 
    134136 
    135 function MakeFontDescriptor($fm,$symbolic) 
     137function MakeFontDescriptor($fm, $symbolic) 
    136138{ 
    137139        //Ascent 
     
    151153        //Flags 
    152154        $flags=0; 
    153         if(isset($fm['IsFixedPitch']) and $fm['IsFixedPitch']) 
     155        if(isset($fm['IsFixedPitch']) && $fm['IsFixedPitch']) 
    154156                $flags+=1<<0; 
    155157        if($symbolic) 
     
    157159        if(!$symbolic) 
    158160                $flags+=1<<5; 
    159         if(isset($fm['ItalicAngle']) and $fm['ItalicAngle']!=0) 
     161        if(isset($fm['ItalicAngle']) && $fm['ItalicAngle']!=0) 
    160162                $flags+=1<<6; 
    161163        $fd.=",'Flags'=>".$flags; 
     
    164166                $fbb=$fm['FontBBox']; 
    165167        else 
    166                 $fbb=array(0,$des-100,1000,$asc+100); 
     168                $fbb=array(0,$desc-100,1000,$asc+100); 
    167169        $fd.=",'FontBBox'=>'[".$fbb[0].' '.$fbb[1].' '.$fbb[2].' '.$fbb[3]."]'"; 
    168170        //ItalicAngle 
     
    172174        if(isset($fm['StdVW'])) 
    173175                $stemv=$fm['StdVW']; 
    174         elseif(isset($fm['Weight']) && preg_match('/(bold|black)/i',$fm['Weight'])) 
     176        elseif(isset($fm['Weight']) && preg_match('/bold|black/i',$fm['Weight'])) 
    175177                $stemv=120; 
    176178        else 
     
    195197                elseif(chr($i)=="\\") 
    196198                        $s.="'\\\\'"; 
    197                 elseif($i>=32 and $i<=126) 
     199                elseif($i>=32 && $i<=126) 
    198200                        $s.="'".chr($i)."'"; 
    199201                else 
     
    228230} 
    229231 
    230 function SaveToFile($file,$s,$mode='t') 
     232function SaveToFile($file, $s, $mode) 
    231233{ 
    232234        $f=fopen($file,'w'.$mode); 
     
    254256        $f=fopen($file,'rb'); 
    255257        if(!$f) 
    256                 die('<B>Error:</B> Can\'t open '.$file); 
     258                die('<b>Error:</b> Can\'t open '.$file); 
    257259        //Extract number of tables 
    258260        fseek($f,4,SEEK_CUR); 
     
    285287        $e=($fsType & 0x08)!=0; 
    286288        fclose($f); 
    287         if($rl and !$pp and !$e) 
    288                 echo '<B>Warning:</B> font license does not allow embedding'; 
     289        if($rl && !$pp && !$e) 
     290                echo '<b>Warning:</b> font license does not allow embedding'; 
    289291} 
    290292 
    291293/******************************************************************************* 
    292 * $fontfile : chemin du fichier TTF (ou chaîne vide si pas d'incorporation)    * 
    293 * $afmfile :  chemin du fichier AFM                                            * 
    294 * $enc :      encodage (ou chaîne vide si la police est symbolique)            * 
    295 * $patch :    patch optionnel pour l'encodage                                  * 
    296 * $type :     type de la police si $fontfile est vide                          * 
     294* fontfile: path to TTF file (or empty string if not to be embedded)           * 
     295* afmfile:  path to AFM file                                                   * 
     296* enc:      font encoding (or empty string for symbolic fonts)                 * 
     297* patch:    optional patch for encoding                                        * 
     298* type:     font type if fontfile is empty                                     * 
    297299*******************************************************************************/ 
    298 function MakeFont($fontfile,$afmfile,$enc='cp1252',$patch=array(),$type='TrueType') 
     300function MakeFont($fontfile, $afmfile, $enc='cp1252', $patch=array(), $type='TrueType') 
    299301{ 
    300302        //Generate a font definition file 
    301         set_magic_quotes_runtime(0); 
     303        if(get_magic_quotes_runtime()) 
     304                @set_magic_quotes_runtime(0); 
    302305        ini_set('auto_detect_line_endings','1'); 
    303306        if($enc) 
     
    310313                $map=array(); 
    311314        if(!file_exists($afmfile)) 
    312                 die('<B>Error:</B> AFM file not found: '.$afmfile); 
     315                die('<b>Error:</b> AFM file not found: '.$afmfile); 
    313316        $fm=ReadAFM($afmfile,$map); 
    314317        if($enc) 
     
    326329                        $type='Type1'; 
    327330                else 
    328                         die('<B>Error:</B> unrecognized font file extension: '.$ext); 
    329         } 
    330         else 
    331         { 
    332                 if($type!='TrueType' and $type!='Type1') 
    333                         die('<B>Error:</B> incorrect font type: '.$type); 
     331                        die('<b>Error:</b> unrecognized font file extension: '.$ext); 
     332        } 
     333        else 
     334        { 
     335                if($type!='TrueType' && $type!='Type1') 
     336                        die('<b>Error:</b> incorrect font type: '.$type); 
    334337        } 
    335338        //Start generation 
     
    353356                //Embedded font 
    354357                if(!file_exists($fontfile)) 
    355                         die('<B>Error:</B> font file not found: '.$fontfile); 
     358                        die('<b>Error:</b> font file not found: '.$fontfile); 
    356359                if($type=='TrueType') 
    357360                        CheckTTF($fontfile); 
    358361                $f=fopen($fontfile,'rb'); 
    359362                if(!$f) 
    360                         die('<B>Error:</B> Can\'t open '.$fontfile); 
     363                        die('<b>Error:</b> Can\'t open '.$fontfile); 
    361364                $file=fread($f,filesize($fontfile)); 
    362365                fclose($f); 
     
    364367                { 
    365368                        //Find first two sections and discard third one 
    366                         $header=(ord($file{0})==128); 
     369                        $header=(ord($file[0])==128); 
    367370                        if($header) 
    368371                        { 
     
    372375                        $pos=strpos($file,'eexec'); 
    373376                        if(!$pos) 
    374                                 die('<B>Error:</B> font file does not seem to be valid Type1'); 
     377                                die('<b>Error:</b> font file does not seem to be valid Type1'); 
    375378                        $size1=$pos+6; 
    376                         if($header and ord($file{$size1})==128) 
     379                        if($header && ord($file[$size1])==128) 
    377380                        { 
    378381                                //Strip second binary header 
     
    381384                        $pos=strpos($file,'00000000'); 
    382385                        if(!$pos) 
    383                                 die('<B>Error:</B> font file does not seem to be valid Type1'); 
     386                                die('<b>Error:</b> font file does not seem to be valid Type1'); 
    384387                        $size2=$pos-$size1; 
    385388                        $file=substr($file,0,$size1+$size2); 
     
    390393                        SaveToFile($cmp,gzcompress($file),'b'); 
    391394                        $s.='$file=\''.$cmp."';\n"; 
    392                         echo 'Font file compressed ('.$cmp.')<br />'; 
     395                        echo 'Font file compressed ('.$cmp.')<br>'; 
    393396                } 
    394397                else 
    395398                { 
    396399                        $s.='$file=\''.basename($fontfile)."';\n"; 
    397                         echo '<B>Notice:</B> font file could not be compressed (zlib extension not available)<br />'; 
     400                        echo '<b>Notice:</b> font file could not be compressed (zlib extension not available)<br>'; 
    398401                } 
    399402                if($type=='Type1') 
     
    411414        } 
    412415        $s.="?>\n"; 
    413         SaveToFile($basename.'.php',$s); 
    414         echo 'Font definition file generated ('.$basename.'.php'.')<br />'; 
     416        SaveToFile($basename.'.php',$s,'t'); 
     417        echo 'Font definition file generated ('.$basename.'.php'.')<br>'; 
    415418} 
    416419?> 
phpBMS vulnerability assesment provided by Orvant Inc. Copyright © 2010 Kreotek, LLC. All Rights reserved.