198. File Comparison Report

Produced on Mon May 12 13:05:08 2008 UTC. This report uses XHTML and CSS2, and is best viewed with a reasonably standards compliant browser such as the latest version of Firefox or Internet Explorer. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

198.1 Files compared

# Location File Last Modified
1 Mon May 12 13:05:08 2008 UTC
2 Dolphin-v.6.1.0\inc\classes BxDolPageViewAdmin.php Wed Apr 23 12:26:50 2008 UTC

198.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 0 0
Changed 0 0
Inserted 1 824
Removed 0 0

198.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

198.4 Active regular expressions

No regular expressions were active.

198.5 Comparison detail

    1   <?
    2  
    3   require_on ce( BX_DIR ECTORY_PAT H_ROOT . ' plugins/Se rvices_JSO N.php' );
    4  
    5   class BxDo lPageViewA dmin {
    6       var $a Pages = ar ray();
    7       var $o Page;
    8       var $s Page_db; / /name of c urrent pag e, used fo rm databas e manipula tions
    9       var $s DBTable; / /used data base table
    10       var $b AjaxMode =  false;
    11       var $a Aliases =  array(
    12           'i ndex' => ' Homepage',
    13           'm usic' => ' Shared Mus ic',
    14           'v ideo' => ' Shared Vid eo',
    15           'p hoto' => ' Shared Pho to',
    16           'a ds'   => ' Classified s',
    17           'm ember' =>  'Account',
    18           'p rofile' =>  'Profile'
    19       );
    20       
    21       
    22       functi on BxDolPa geViewAdmi n( $sDBTab le, $sCach eFile ) {
    23           $t his -> sDB Table = $s DBTable;
    24           $t his -> sCa cheFile =  $sCacheFil e;
    25           
    26           $s Page = pro cess_pass_ data( isse t( $_REQUE ST['Page']  ) ? trim(  $_REQUEST ['Page'] )  : '' );
    27           
    28           $t his -> get Pages();
    29           
    30           if ( strlen($ sPage) )
    31                /* @var  $this->oPa ge BxDolPV APage */
    32                $this ->  oPage = n ew BxDolPV APage( $sP age, $this  );
    33           
    34           $t his -> che ckAjaxMode ();
    35           
    36           if ( $this ->  bAjaxMode  and $this  -> oPage  ) {
    37                $this ->  sPage_db  = addslash es( $this  -> oPage - > sName );
    38                
    39                switch(  $_REQUEST[ 'action']  ) {
    40                    case  'load':
    41                         header( 'C ontent-typ e:text/jav ascript' ) ;
    42                         send_heade rs_page_ch anged();
    43                         echo $this  -> oPage  -> getJSON ();
    44                    brea k;
    45                    
    46                    case  'saveCols Widths':
    47                         if( is_arr ay( $_POST ['widths']  ) ) {
    48                             $this  -> saveCol sWidths( $ _POST['wid ths'] );
    49                             $this  -> createC ache();
    50                         }
    51                    brea k;
    52                    
    53                    case  'saveBloc ks':
    54                         if( is_arr ay( $_POST ['columns' ] ) ) {
    55                             $this  -> saveBlo cks( $_POS T['columns '] );
    56                             $this  -> createC ache();
    57                         }
    58                    brea k;
    59                    
    60                    case  'loadEdit Form':
    61                         if( $iBloc kID = (int )$_POST['i d'] )
    62                             $this  -> showPro pForm( $iB lockID );
    63                    brea k;
    64                    
    65                    case  'saveItem ':
    66                         if( (int)$ _POST['id' ] ) {
    67                             $this  -> saveIte m( $_POST  );
    68                             $this  -> createC ache();
    69                         }
    70                    brea k;
    71                    
    72                    case  'deleteBl ock':
    73                         if( $iBloc kID = (int )$_REQUEST ['id'] ) {
    74                             $this  -> deleteB lock( $iBl ockID );
    75                             $this  -> createC ache();
    76                         }
    77                    brea k;
    78                    
    79                    case  'checkNew Block':
    80                         if( $iBloc kID = (int )$_REQUEST ['id'] )
    81                             $this  -> checkNe wBlock( $i BlockID );
    82                    brea k;
    83                    
    84                    case  'savePage Width':
    85                         if( $sPage Width = pr ocess_pass _data( $_P OST['width '] ) ) {
    86                             $this  -> savePag eWidth( $s PageWidth  );
    87                             $this  -> createC ache();
    88                             
    89                             if( $t his -> oPa ge -> sNam e == 'inde x' ) {
    90                                 if ( $sPageWi dth == '10 0%' )
    91                                      setParam ( 'promoWi dth', '960 ' );
    92                                 el se
    93                                      setParam ( 'promoWi dth', (int )$sPageWid th );
    94                                 
    95                                 Re sizeAllPro mos();
    96                             }
    97                         }
    98                    brea k;
    99                    
    100                    case  'saveOthe rPagesWidt h':
    101                         if( $sWidt h = $_REQU EST['width '] ) {
    102                             setPar am( 'main_ div_width' , $sWidth  );
    103                             echo ' OK';
    104                         }
    105                    brea k;
    106                    
    107                    case  'resetPag e':
    108                         $this -> r esetPage() ;
    109                         $this -> c reateCache ();
    110                    brea k;
    111                }
    112                
    113                exit;
    114           }  else {
    115                $this ->  showMainP age();
    116           }
    117       }
    118       
    119       functi on savePag eWidth( $s PageWidth  ) {
    120           $s PageWidth  = addslash es( $sPage Width );
    121           $s Query = "U PDATE `{$t his -> sDB Table}` SE T `PageWid th` = '$sP ageWidth'  WHERE `Pag e` = '{$th is -> sPag e_db}'";
    122           db _res( $sQu ery );
    123           
    124           ec ho 'OK';
    125       }
    126       
    127       functi on createC ache() {
    128           $o Cacher = n ew BxDolPa geViewCach er( $this  -> sDBTabl e, $this - > sCacheFi le );
    129           $o Cacher ->  createCach e();
    130       }
    131  
    132       
    133       functi on checkNe wBlock( $i BlockID )  {
    134           $s Query = "S ELECT `Des c`, `Capti on`, `Func `, `Conten t`, `Visib le` FROM ` {$this ->  sDBTable}`  WHERE `ID ` = $iBloc kID";
    135           $a Block = db _assoc_arr ( $sQuery  );
    136           
    137           if ( $aBlock[ 'Func'] ==  'Sample'  ) {
    138                $sQuery  = "
    139                    INSE RT INTO `{ $this -> s DBTable}`  SET
    140                         `Desc`     = '" . add slashes( $ aBlock['De sc']    )  . "',
    141                         `Caption`  = '" . add slashes( $ aBlock['Ca ption'] )  . "',
    142                         `Func`     = '{$aBloc k['Content ']}',
    143                         `Visible`  = '{$aBloc k['Visible ']}',
    144                         `Page`     = '{$this  -> sPage_d b}'
    145                    ";
    146                db_res(  $sQuery );
    147                
    148                echo mys ql_insert_ id();
    149                
    150                $this ->  createCac he();
    151           }
    152       }
    153       
    154       functi on deleteB lock( $iBl ockID ) {
    155           $s Query = "D ELETE FROM  `{$this - > sDBTable }` WHERE ` Page` = '{ $this -> s Page_db}'  AND `ID` =  $iBlockID ";
    156           db _res( $sQu ery );
    157       }
    158       
    159       functi on resetPa ge() {
    160           if ( $this ->  oPage ->  bResetable  ) {
    161                $sQuery  = "DELETE  FROM `{$th is -> sDBT able}` WHE RE `Page`  = '{$this  -> sPage_d b}'";
    162                db_res($ sQuery);
    163                execSqlF ile( $this  -> oPage  -> sDefaul tSqlFile ) ;
    164                
    165                if( $thi s -> oPage  -> sName  == 'index'  ) {
    166                    setP aram( 'pro moWidth',  '960' );
    167                    Resi zeAllPromo s();
    168                }
    169           }
    170           
    171           ec ho (int)$t his -> oPa ge -> bRes etable;
    172       }
    173       
    174       functi on saveIte m( $aData  ) {
    175           $i ID = (int) $aData['id '];
    176           
    177           $s Query = "S ELECT `Fun c` FROM `{ $this -> s DBTable}`  WHERE `ID`  = $iID";
    178           $s Func  = db _value( $s Query );
    179           if ( !$sFunc  )
    180                return;
    181           
    182           $s Caption =  process_db _input($aD ata['Capti on']);
    183           $s Visible =  implode( ' ,',    $aD ata['Visib le']);
    184           
    185           if ( $sFunc = = 'RSS' )
    186                $sConten tUpd = "`C ontent` =  '" . proce ss_db_inpu t($aData[' Url']) . ' #' . (int) $aData['Nu m'] . "'," ;
    187           el seif( $sFu nc == 'Ech o' )
    188                $sConten tUpd = "`C ontent` =  '" . proce ss_db_inpu t($aData[' Content'])  . "',";
    189           el se
    190                $sConten tUpd = '';
    191           
    192           $s Query = "
    193                UPDATE ` {$this ->  sDBTable}`  SET
    194                    `Cap tion` = '$ sCaption',
    195                    $sCo ntentUpd
    196                    `Vis ible` = '$ sVisible'
    197                WHERE `I D` = $iID
    198           ";
    199           
    200           db _res( $sQu ery );
    201           
    202           ec ho _t( pro cess_pass_ data($aDat a['Caption ']) );
    203       }
    204       
    205       functi on saveCol sWidths( $ aWidths )  {
    206           $i Counter =  0;
    207           fo reach( $aW idths as $ iWidth ) {
    208                $iCounte r ++;
    209                $iWidth  = (int)$iW idth;
    210                
    211                $sQuery  = "UPDATE  `{$this ->  sDBTable} ` SET `Col Width` = $ iWidth WHE RE `Page`  = '{$this  -> sPage_d b}' AND `C olumn` = $ iCounter";
    212                db_res(  $sQuery );
    213           }
    214           
    215           ec ho 'OK';
    216       }
    217       
    218       functi on saveBlo cks( $aCol umns ) {
    219           // reset bloc ks on this  page
    220           $s Query = "U PDATE `{$t his -> sDB Table}` SE T `Column`  = 0, `Ord er` = 0 WH ERE `Page`  = '{$this  -> sPage_ db}'";
    221           db _res( $sQu ery );
    222           
    223           $i ColCounter  = 0;
    224           fo reach( $aC olumns as  $sBlocks )  {
    225                $iColCou nter ++;
    226                
    227                $aBlocks  = explode ( ',', $sB locks );
    228                foreach(  $aBlocks  as $iOrder  => $iBloc kID ) {
    229                    $iBl ockID = (i nt)$iBlock ID;
    230                    $sQu ery = "UPD ATE `{$thi s -> sDBTa ble}` SET  `Column` =  $iColCoun ter, `Orde r` = $iOrd er WHERE ` ID` = $iBl ockID AND  `Page` = ' {$this ->  sPage_db}' ";
    231                    db_r es( $sQuer y );
    232                }
    233           }
    234           
    235           ec ho 'OK';
    236       }
    237       
    238       functi on showMai nPage() {
    239           gl obal $_pag e;
    240           gl obal $site ;
    241           
    242           $_ page['head er']   = ' Page Build er';
    243           $_ page['css_ name'] = ' pageBuilde r.css';
    244           $_ page['extr aCodeInHea d'] = <<<B LAH
    245                    
    246                    <scr ipt type=" text/javas cript" src ="{$site[' plugins']} jquery/jqu ery.js"></ script>
    247                    <scr ipt type=" text/javas cript" src ="{$site[' plugins']} jquery/jqu ery.dimens ions.js">< /script>
    248                    <scr ipt type=" text/javas cript" src ="{$site[' plugins']} jquery/jqu ery.form.j s"></scrip t>
    249                    <scr ipt type=" text/javas cript" src ="{$site[' plugins']} jquery/ui. mouse.js"> </script>
    250                    <scr ipt type=" text/javas cript" src ="{$site[' plugins']} jquery/ui. draggable. js"></scri pt>
    251                    <scr ipt type=" text/javas cript" src ="{$site[' plugins']} jquery/ui. draggable. ext.js"></ script>
    252                    <scr ipt type=" text/javas cript" src ="{$site[' plugins']} jquery/ui. droppable. js"></scri pt>
    253                    <scr ipt type=" text/javas cript" src ="{$site[' plugins']} jquery/ui. sortable.j s"></scrip t>
    254                    <scr ipt type=" text/javas cript" src ="{$site[' plugins']} jquery/ui. sortable.e xt.js"></s cript>
    255                    <scr ipt type=" text/javas cript" src ="{$site[' plugins']} jquery/ui. slider.js" ></script>
    256                    
    257                    <scr ipt type=" text/javas cript" lan guage="jav ascript" s rc="{$site ['url']}in c/js/class es/BxDolPa geBuilder. js"></scri pt>
    258                    
    259                    <!--  tinyMCE g z -->
    260                    <scr ipt type=" text/javas cript" src ="{$site[' plugins']} tiny_mce/t iny_mce_gz ip.js"></s cript>
    261                    <scr ipt type=" text/javas cript">
    262                         tinyMCE_GZ .init({
    263                             plugin s : "style ,layer,tab le,save,ad vhr,advima ge,advlink ,emotions, iespell,in sertdateti me,preview ,media,sea rchreplace ,print,con textmenu,p aste,direc tionality, fullscreen ,noneditab le,visualc hars,nonbr eaking,xht mlxtras",
    264                             themes  : "simple ,advanced" ,
    265                             langua ges : "en" ,
    266                             disk_c ache : tru e,
    267                             debug  : false
    268                         });
    269                    </sc ript>
    270                
    271                    <scr ipt langua ge="javasc ript" type ="text/jav ascript">
    272                         tinyMCE.in it({
    273                             mode :  "textarea s",
    274                             theme  : "advance d",
    275                             
    276                             editor _selector  : "form_in put_html",
    277                             conten t_css : "{ $site['plu gins']}tin y_mce/dolp hin.css",
    278                             
    279                             plugin s : "style ,layer,tab le,save,ad vhr,advima ge,advlink ,emotions, iespell,in sertdateti me,preview ,zoom,medi a,searchre place,prin t,contextm enu,paste, directiona lity,fulls creen,visu alchars,no nbreaking, xhtmlxtras ",
    280                             relati ve_urls :  false,
    281                             
    282                             theme_ advanced_b uttons1 :  "bold,ital ic,underli ne,striket hrough,|,j ustifyleft ,justifyce nter,justi fyright,ju stifyfull, |,fontsele ct,fontsiz eselect",
    283                             theme_ advanced_b uttons2 :  "forecolor ,backcolor ,|,bullist ,numlist,| ,outdent,i ndent,|,li nk,unlink, image,hr,| ,sub,sup,| ,insertdat e,insertti me,|,style props",
    284                             theme_ advanced_b uttons3 :  "charmap,e motions,|, cite,abbr, acronym,at tribs,|,pr eview,remo veformat,| ,code,help ",
    285                             theme_ advanced_b uttons4 :  "table,row _props,cel l_props,de lete_col,d elete_row, delete_tab le,col_aft er,col_bef ore,row_af ter,row_be fore,row_a fter,row_b efore,spli t_cells,me rge_cells" ,
    286                             theme_ advanced_t oolbar_loc ation : "t op",
    287                             theme_ advanced_t oolbar_ali gn : "cent er",
    288                             valid_ elements :  "*[*]"
    289                         });
    290                    </sc ript>
    291   BLAH;
    292           
    293           $_ page['extr aCodeInBod y'] = <<<B LAH
    294                    <div  id="editF ormWrapper "
    295                      st yle="displ ay:none;"  onclick="i f ( ( even t.target | | event.sr cElement )  == this )  $(this).h ide();">
    296                         <div id="e ditFormCon t">
    297                             
    298                         </div>
    299                    </di v>
    300   BLAH;
    301           To pCodeAdmin ();
    302           
    303           $t his -> sho wBuildZone ();
    304           
    305           Bo ttomCode() ;
    306       }
    307       
    308       functi on showBui ldZone() {
    309           gl obal $site ;
    310           ?>
    311                <div id= "buildZone Wrapper">
    312           <?
    313           
    314           $t his -> sho wPageSelec tor();
    315           
    316           if ( $this ->  oPage ) {
    317                ?>
    318                    <div  id="build AreasWrapp er">
    319                         <div class ="block_he ad">Page W idth</div>
    320                         <div class ="block_co nt_nd">
    321                             
    322                             <div i d="pageWid thValue">< /div>
    323                             
    324                             <div i d="pageWid thSlider">
    325                                 <d iv></div>
    326                             </div>
    327                             
    328                             <div c lass="clea r_both"></ div>
    329                         </div>
    330                        
    331                         <div class ="block_he ad">Active  Blocks</d iv>
    332                         <div class ="block_co nt" id="ac tiveAreaWr apper">
    333                             <div i d="pageCon trols">
    334                <?
    335                if( !iss et( $this  -> aAliase s[ $this - > oPage ->  sName ] )  ) {
    336                    ?>
    337                                 <a  href="<?=  $site['ur l'] ?>view Page.php?I D=<?= html specialcha rs( $this  -> oPage - > sName )  ?>"
    338                                    target="_b lank">View  Page</a>
    339                    <?
    340                }
    341                
    342                if( $thi s -> oPage  -> bReset able ) {
    343                    ?>
    344                                 <a  href="#"  onclick="o PB.resetPa ge(); retu rn false;" >Reset Pag e</a>
    345                    <?
    346                }
    347                ?>
    348                                 
    349                             </div>
    350                             
    351                             <div i d="activeB locksArea"  class="bu ildArea">
    352                                 Lo ading...
    353                             </div>
    354                         </div>
    355                        
    356                         <div id="c olumnsSlid er">
    357                             <div>< /div>
    358                         </div>
    359  
    360                         <div class ="block_he ad">Inacti ve Blocks< /div>
    361                         <div class ="block_co nt">
    362                             <div i d="inactiv eBlocksAre a" class=" buildArea" >
    363                                 Lo ading...
    364                             </div>
    365                         </div>
    366                        
    367                         <div class ="block_he ad">Sample s</div>
    368                         <div class ="block_co nt">
    369                             <div i d="samples BlocksArea " class="b uildArea">
    370                                 Lo ading...
    371                             </div>
    372                         </div>
    373                        
    374                         <div class ="block_he ad">Other  Pages Widt h</div>
    375                         <div class ="block_co nt_nd">
    376                             
    377                             <div i d="pageWid thValue1"> </div>
    378                             
    379                             <div i d="pageWid thSlider1" >
    380                                 <d iv></div>
    381                             </div>
    382                             
    383                             <div c lass="clea r_both"></ div>
    384                         </div>
    385                        
    386                    </di v>
    387                    
    388                    <scr ipt langua ge="javasc ript" type ="text/jav ascript">
    389                         $( documen t ).ready(  function( ){
    390                             oPB =  new BxDolP ageBuilder ( {
    391                                 pa rser: '<?=  $_SERVER[ 'PHP_SELF' ] ?>',
    392                                 pa ge: '<?= a ddslashes(  $this ->  oPage -> s Name ) ?>' ,
    393                                 mi nCols: 1,
    394                                 ma xCols: 4,
    395                                 pa geWidth: ' <?= $this  -> oPage - > iPageWid th ?>',
    396                                 ot herPagesWi dth: '<?=  getParam(  'main_div_ width' ) ? >'
    397                             } );
    398                         } );
    399                    </sc ript>
    400                <?
    401           }
    402           
    403           ?>
    404                </div>
    405           <?
    406       }
    407       
    408       functi on showPag eSelector( ) {
    409           ?>
    410           <d iv>
    411                <a href= "#" onclic k="oPB.new Page(); re turn false ;" id="new PageLink"> New Page</ a>
    412                
    413                <ul id=" pageSelect or">
    414           <?
    415           fo reach( $th is -> aPag es as $sPa ge ) {
    416                $sSelect ed = ( $th is -> oPag e -> sName  == $sPage  ) ? 'clas s="current "' : '';
    417                
    418                ?>
    419                    <li  <?= $sSele cted ?>>
    420                         <a href="< ?= $_SERVE R['PHP_SEL F'] ?>?Pag e=<?= html specialcha rs_adv( ur lencode($s Page) ) ?> ">
    421                             <?= ht mlspecialc hars( isse t($this ->  aAliases[ $sPage]) ?  $this ->  aAliases[$ sPage] : $ sPage ) ?>
    422                         </a>
    423                    </li >
    424                <?
    425           }
    426           
    427           ?>
    428                </ul>
    429           </ div>
    430           <?
    431       }
    432       
    433       functi on getPage s() {
    434           $s PagesQuery  = "SELECT  DISTINCT  `Page` FRO M `{$this  -> sDBTabl e}` WHERE  `Page` !=  '' ORDER B Y `Page`";
    435           $r Pages = db _res( $sPa gesQuery ) ;
    436           wh ile( $aPag e = mysql_ fetch_asso c($rPages)  )
    437                $this ->  aPages[]  = $aPage[' Page'];
    438       }
    439       
    440       functi on checkAj axMode() {
    441           if ( isset( $ _SERVER['H TTP_X_REQU ESTED_WITH '] ) and $ _SERVER['H TTP_X_REQU ESTED_WITH '] == 'XML HttpReques t' )
    442                $this ->  bAjaxMode  = true;
    443       }
    444       
    445       functi on showPro pForm( $iB lockID ) {
    446           $s Query = "S ELECT * FR OM `{$this  -> sDBTab le}` WHERE  `Page` =  '{$this ->  sPage_db} ' AND `ID`  = $iBlock ID";
    447           $a Item = db_ assoc_arr( $sQuery);
    448           if ( !$aItem  ) {
    449                ?>
    450                <div sty le="text-a lign:cente r;color:re d;">This b lock has n o properti es</div>
    451                <?
    452                return ;
    453           }
    454           
    455           ?>
    456   <form name ="formItem Edit" id=" formItemEd it" action ="<?=$_SER VER['PHP_S ELF']?>" m ethod="POS T">
    457       <input  type="hid den" name= "Page" val ue="<?= ht mlspecialc hars($this ->oPage->s Name) ?>"  />
    458       <input  type="hid den" name= "id" value ="<?= $iBl ockID ?>"  />
    459       <input  type="hid den" name= "action" v alue="save Item" />
    460       
    461       <table  class="po pup_form_w rapper">
    462           <t r>
    463                <td clas s="corner" ><img src= "images/op _cor_tl.pn g" /></td>
    464                <td clas s="side_ve r"><img sr c="images/ spacer.gif " /></td>
    465                <td clas s="corner" ><img src= "images/op _cor_tr.pn g" /></td>
    466           </ tr>
    467           <t r>
    468                <td clas s="side">< img src="i mages/spac er.gif" /> </td>
    469                
    470                <td clas s="contain er">
    471                    <div  class="ed it_item_ta ble_cont">
    472                    
    473                         <table cla ss="edit_i tem_table"  >
    474                             <tr>
    475                                 <t d class="f orm_label" >Type:</td >
    476                                 <t d>
    477                                      <?
    478                                          swit ch( $aItem ['Func'] )  {
    479                                               case 'PFBl ock': echo  'Profile  Fields'; b reak;
    480                                               case 'Echo ':    echo  'HTML Blo ck'; break ;
    481                                               case 'RSS' :     echo  'RSS Feed '; break;
    482                                               default:         echo  'Special  Block';
    483                                          }
    484                                      ?>
    485                                 </ td>
    486                             </tr>
    487                             <tr>
    488                                 <t d class="f orm_label" >Descripti on:</td>
    489                                 <t d><?= $aIt em['Desc']  ?></td>
    490                             </tr>
    491                             <tr>
    492                                 <t d class="f orm_label" >Caption L ang Key:</ td>
    493                                 <t d>
    494                                      <input t ype="text"  class="fo rm_input_t ext" name= "Caption"  value="<?=  $aItem['C aption'] ? >" />
    495                                 </ td>
    496                             </tr>
    497                             <tr>
    498                                 <t d class="f orm_label" >Visible f or:</td>
    499                                 <t d>
    500                                      <label>
    501                                          <inp ut type="c heckbox" n ame="Visib le[]" valu e="non"
    502                                            <? = ( ( strp os( $aItem ['Visible' ], 'non'   ) === fals e ) ? '' :  'checked= "checked"'  ) ?> />
    503                                          Gues t
    504                                      </label>
    505                                      
    506                                      <label>
    507                                          <inp ut type="c heckbox" n ame="Visib le[]" valu e="memb"
    508                                            <? = ( ( strp os( $aItem ['Visible' ], 'memb'  ) === fals e ) ? '' :  'checked= "checked"'  ) ?> />
    509                                          Memb er
    510                                      </label>
    511                                 </ td>
    512                             </tr>
    513       <?
    514       if( $a Item['Func '] == 'Ech o' ) {
    515           ?>
    516                             <tr>
    517                                 <t d class="f orm_label" >HTML-cont ent:</td>
    518                                 <t d>&nbsp;</ td>
    519                             </tr>
    520                             <tr>
    521                                 <t d class="f orm_colspa n" colspan ="2">
    522                                      <textare a class="f orm_input_ html" id=" form_input _html" nam e="Content "><?= html specialcha rs_adv( $a Item['Cont ent'] ) ?> </textarea >
    523                                 </ td>
    524                             </tr>
    525           <?
    526       } else if( $aItem ['Func'] = = 'RSS' )  {
    527           li st( $sUrl,  $iNum ) =  explode(  '#', $aIte m['Content '] );
    528           $i Num = (int )$iNum;
    529           
    530           ?>
    531                             <tr>
    532                                 <t d class="f orm_label" >Url of RS S feed:</t d>
    533                                 <t d><input t ype="text"  class="fo rm_input_t ext" name= "Url" valu e="<?= $sU rl ?>" />< /td>
    534                             </tr>
    535                             <tr>
    536                                 <t d class="f orm_label" >Number of  RSS items  (0 - all) :</td>
    537                                 <t d><input t ype="text"  class="fo rm_input_t ext" name= "Num" valu e="<?= $iN um ?>" />< /td>
    538                             </tr>
    539           <?
    540       }
    541       ?>
    542                             <tr>
    543                                 <t d class="f orm_colspa n" colspan ="2">
    544                                      <input t ype="submi t" value=" Save" />
    545       <?
    546       if( $a Item['Func '] == 'RSS ' or $aIte m['Func']  == 'Echo'  ) {
    547           ?>
    548                                      <input t ype="reset " value="D elete" nam e="Delete"  />
    549           <?
    550       }
    551       ?>
    552                                      <input t ype="reset " value="C ancel" nam e="Cancel"  />
    553                                 </ td>
    554                             </tr>
    555                         </table>
    556                    
    557                    </di v>
    558                </td>
    559                
    560                <td clas s="side">< img src="i mages/spac er.gif" al t="" /></t d>
    561           </ tr>
    562           <t r>
    563                <td clas s="corner" ><img src= "images/op _cor_bl.pn g" /></td>
    564                <td clas s="side_ve r"><img sr c="images/ spacer.gif " alt="" / ></td>
    565                <td clas s="corner" ><img src= "images/op _cor_br.pn g" onload= "if( navig ator.appNa me == 'Mic rosoft Int ernet Expl orer' && v ersion >=  5.5 && ver sion < 7 )  png_fix() ;" /></td>
    566           </ tr>
    567       </tabl e>
    568   </form>
    569  
    570  
    571           <?
    572       }
    573       
    574   }
    575  
    576   class BxDo lPVAPage {
    577       var $s Name;
    578       var $s Name_db;
    579       var $o Parent;
    580       var $a ColsWidths      = arr ay();
    581       var $a Blocks          = arr ay();
    582       var $a BlocksInac tive = arr ay();
    583       var $a BlocksSamp les  = arr ay();
    584       var $a MinWidths       = arr ay();
    585       var $i PageWidth;
    586       var $b Resetable;  //defines  if the pa ge can be  reset
    587       var $s DefaultSql File; //fi le contain ing defaul t setting  for reset
    588       
    589       var $b New = fals e;
    590       
    591       functi on BxDolPV APage( $sP age, &$oPa rent ) {
    592           gl obal $dir;
    593           gl obal $admi n_dir;
    594           
    595           $t his -> sNa me   = $sP age;
    596           $t his -> sNa me_db = ad dslashes(  $this -> s Name );
    597           
    598           /*  @var $thi s->oParent  BxDolPage ViewAdmin  */
    599           $t his -> oPa rent = &$o Parent;
    600           
    601           $t his -> sDe faultSqlFi le = "{$di r['root']} {$admin_di r}/default _builders/ {$this ->  oParent ->  sDBTable} _{$this ->  sName}.sq l";
    602           $t his -> bRe setable =  file_exist s( $this - > sDefault SqlFile );
    603                    
    604           $t his -> loa dContent() ;
    605       }
    606       
    607       functi on loadCon tent() {
    608           if ( in_array ( $this ->  sName, $t his -> oPa rent -> aP ages ) ) {
    609                //get pa ge width
    610                $sQuery  = "SELECT  `PageWidth ` FROM `{$ this -> oP arent -> s DBTable}`  WHERE `Pag e` = '{$th is -> sNam e_db}' LIM IT 1";
    611                $this ->  iPageWidt h = db_val ue( $sQuer y );
    612                
    613                
    614                //get co lumns widt hs
    615                $sQuery  = "
    616                    SELE CT
    617                         `Column`,
    618                         `ColWidth`
    619                    FROM  `{$this - > oParent  -> sDBTabl e}`
    620                    WHER E
    621                         `Page` = ' {$this ->  sName_db}'  AND
    622                         `Column` ! = 0
    623                    GROU P BY `Colu mn`
    624                    ORDE R BY `Colu mn`
    625                ";
    626                $rColumn s = db_res ( $sQuery  );
    627                while( $ aColumn =  mysql_fetc h_assoc( $ rColumns )  ) {
    628                    $iCo lumn                         = ( int)$aColu mn['Column '];
    629                    $thi s -> aCols Widths[$iC olumn] = ( int)$aColu mn['ColWid th'];
    630                    $thi s -> aBloc ks[$iColum n]     = a rray();
    631                    
    632                    //ge t active b locks
    633                    $sQu eryActive  = "
    634                         SELECT
    635                             `ID`,
    636                             `Capti on`
    637                         FROM `{$th is -> oPar ent -> sDB Table}`
    638                         WHERE
    639                             `Page`  = '{$this  -> sName_ db}' AND
    640                             `Colum n` = $iCol umn
    641                         ORDER BY ` Order`
    642                         ";
    643                    
    644                    $rBl ocks = db_ res( $sQue ryActive ) ;
    645                    
    646                    whil e( $aBlock   = mysql_ fetch_asso c( $rBlock s ) )
    647                         $this -> a Blocks[$iC olumn][ (i nt)$aBlock ['ID'] ] =  _t( $aBlo ck['Captio n'] );
    648                }
    649                
    650                // load  minimal wi dths
    651                $sQuery  = "SELECT  `ID`, `Min Width` FRO M `{$this  -> oParent  -> sDBTab le}` WHERE  `MinWidth ` > 0 AND  `Page`= '{ $this -> s Name_db}'" ;
    652                $rBlocks  = db_res(  $sQuery ) ;
    653                while( $ aBlock = m ysql_fetch _assoc( $r Blocks ) )
    654                    $thi s -> aMinW idths[ (in t)$aBlock[ 'ID'] ] =  (int)$aBlo ck['MinWid th'];
    655                
    656                
    657                $this ->  loadInact iveBlocks( );
    658                
    659           }  else {
    660                $this ->  bNew = tr ue;
    661                $this ->  oParent - > aPages[]  = $this - > sName;
    662                $this ->  loadInact iveBlocks( );
    663                //load f rom post
    664           }
    665       }
    666       
    667       functi on loadIna ctiveBlock s() {
    668           // get inacti ve blocks  and sample s
    669           $s QueryInact ive = "
    670                SELECT
    671                    `ID` ,
    672                    `Cap tion`
    673                FROM `{$ this -> oP arent -> s DBTable}`
    674                WHERE
    675                    `Pag e` = '{$th is -> sNam e_db}' AND
    676                    `Col umn` = 0
    677           ";
    678           
    679           $s QuerySampl es = "
    680                SELECT
    681                    `ID` ,
    682                    `Cap tion`
    683                FROM `{$ this -> oP arent -> s DBTable}`
    684                WHERE
    685                    `Fun c` = 'Samp le'
    686           ";
    687           
    688           $r Inactive =  db_res( $ sQueryInac tive );
    689           $r Samples  =  db_res( $ sQuerySamp les );
    690           
    691           wh ile( $aBlo ck = mysql _fetch_ass oc( $rInac tive ) )
    692                $this ->  aBlocksIn active[ (i nt)$aBlock ['ID'] ] =  _t( $aBlo ck['Captio n'] );
    693           
    694           wh ile( $aBlo ck = mysql _fetch_ass oc( $rSamp les ) )
    695                $this ->  aBlocksSa mples[ (in t)$aBlock[ 'ID'] ] =  _t( $aBloc k['Caption '] );
    696       }
    697       
    698       functi on getJSON () {
    699           $o PVAPageJSO N = new Bx DolPVAPage JSON( $thi s );
    700           $o Json = new  Services_ JSON();
    701           re turn $oJso n -> encod e($oPVAPag eJSON);
    702       }
    703       
    704   }
    705  
    706   /* tempora ry JSON ob ject */
    707   class BxDo lPVAPageJS ON {
    708       var $a ctive;
    709       var $i nactive;
    710       var $s amples;
    711       var $w idths;
    712       var $m in_widths;
    713       
    714       functi on BxDolPV APageJSON(  $oParent  ) {
    715           $t his -> wid ths     =  $oParent - > aColsWid ths;
    716           $t his -> min _widths =  $oParent - > aMinWidt hs;
    717           $t his -> act ive     =  $oParent - > aBlocks;
    718           $t his -> ina ctive   =  $oParent - > aBlocksI nactive;
    719           $t his -> sam ples    =  $oParent - > aBlocksS amples;
    720       }
    721   }
    722  
    723  
    724   class BxDo lPageViewC acher {
    725       var $s CacheFile;
    726       
    727       functi on BxDolPa geViewCach er( $sDBTa ble, $sCac heFile ) {
    728           $t his -> sDB Table = $s DBTable;
    729           $t his -> sCa cheFile =  BX_DIRECTO RY_PATH_IN C . "db_ca ched/$sCac heFile";
    730       }
    731       
    732       functi on createC ache() {
    733           $s CacheStrin g = '';
    734           
    735           $r CacheFile  = @fopen(  $this -> s CacheFile,  'w' );
    736           if ( !$rCache File ) {
    737                echo '<b r /><b>War ning!</b>  Cannot ope n Page Vie w cache fi le (' . $t his -> sCa cheFile .  ') for wri te.';
    738                return f alse;
    739           }
    740           
    741           fw rite( $rCa cheFile, " // cache o f Page Vie w composer \n\nreturn  array(\n   //pages\n " );
    742           
    743           // get pages
    744           $s Query = "S ELECT `Pag e`,`PageWi dth` FROM  `{$this ->  sDBTable} ` WHERE `P age` != ''  GROUP BY  `Page`";
    745           $r Pages = db _res( $sQu ery );
    746           
    747           wh ile( $aPag e = mysql_ fetch_asso c( $rPages  ) ) {
    748                $sPageNa me = $aPag e['Page'];
    749                
    750                fwrite(  $rCacheFil e, "  '$sP ageName' = > array(\n " );
    751                fwrite(  $rCacheFil e, "    'W idth' => ' {$aPage['P ageWidth'] }',\n" );
    752                fwrite(  $rCacheFil e, "    'C olumns' =>  array(\n"  );
    753                
    754                //get co lumns
    755                $sQuery  = "
    756                    SELE CT
    757                         `Column`,
    758                         `ColWidth`
    759                    FROM  `{$this - > sDBTable }`
    760                    WHER E
    761                         `Page` = ' $sPageName ' AND
    762                         `Column` >  0
    763                    GROU P BY `Colu mn`
    764                    ORDE R BY `Colu mn`
    765                ";
    766                $rColumn s = db_res ( $sQuery  );
    767                
    768                while( $ aColumn =  mysql_fetc h_assoc( $ rColumns )  ) {
    769                    $iCo lumn = $aC olumn['Col umn'];
    770                    $iCo lWidth  =  $aColumn[' ColWidth'] ;
    771                    
    772                    fwri te( $rCach eFile, "       $iColu mn => arra y(\n" );
    773                    fwri te( $rCach eFile, "         'Wid th'  => $i ColWidth,\ n" );
    774                    fwri te( $rCach eFile, "         'Blo cks' => ar ray(\n" );
    775                    
    776                    //ge t blocks o f column
    777                    $sQu ery = "
    778                         SELECT
    779                             `ID`,
    780                             `Capti on`,
    781                             `Func` ,
    782                             `Conte nt`,
    783                             `Desig nBox`,
    784                             `Visib le`
    785                         FROM `{$th is -> sDBT able}`
    786                         WHERE
    787                             `Page`  = '$sPage Name' AND
    788                             `Colum n` = $iCol umn
    789                         ORDER BY ` Order` ASC
    790                    ";
    791                    $rBl ocks = db_ res( $sQue ry );
    792                    
    793                    whil e( $aBlock  = mysql_f etch_assoc ( $rBlocks  ) ) {
    794                         fwrite( $r CacheFile,  "           {$aBlock ['ID']} =>  array(\n"  );
    795                        
    796                         fwrite( $r CacheFile,  "             'Func'       => ' {$aBlock[' Func']}',\ n" );
    797                         fwrite( $r CacheFile,  "             'Conte nt'   => ' " . $this  -> addSlas hes( $aBlo ck['Conten t'] ) . "' ,\n" );
    798                         fwrite( $r CacheFile,  "             'Capti on'   => ' " . $this  -> addSlas hes( $aBlo ck['Captio n'] ) . "' ,\n" );
    799                         fwrite( $r CacheFile,  "             'Visib le'   => ' {$aBlock[' Visible']} ',\n" );
    800                         fwrite( $r CacheFile,  "             'Desig nBox' => { $aBlock['D esignBox'] }\n" );
    801                        
    802                         fwrite( $r CacheFile,  "           ),\n" );  //close b lock
    803                    }
    804                    fwri te( $rCach eFile, "         )\n"  ); //clos e blocks
    805                    fwri te( $rCach eFile, "       ),\n"  ); //close  column
    806                }
    807                
    808                fwrite(  $rCacheFil e, "    )\ n" ); //cl ose column s
    809                fwrite(  $rCacheFil e, "  ),\n " ); //clo se page
    810           }
    811           
    812           fw rite( $rCa cheFile, " );\n" ); / /close mai n array
    813           
    814           fc lose( $rCa cheFile );
    815           re turn true;
    816       }
    817       
    818       functi on addSlas hes( $sTex t ) {
    819           $s Text = str _replace(  '\\', '\\\ \', $sText  );
    820           $s Text = str _replace(  '\'', '\\\ '', $sText  );
    821           
    822           re turn $sTex t;
    823       }
    824   }