73. File Comparison Report

Produced on Mon May 12 13:04:40 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.

73.1 Files compared

# Location File Last Modified
1 Mon May 12 13:04:40 2008 UTC
2 Dolphin-v.6.1.0\admin preValues.php Sat Apr 19 12:05:02 2008 UTC

73.2 Comparison summary

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

73.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

73.4 Active regular expressions

No regular expressions were active.

73.5 Comparison detail

    1   <?php
    2  
    3   /********* ********** ********** ********** ********** ********** ********** ******
    4   *                              D olphin Sma rt Communi ty Builder
    5   *                                 --------- --------
    6   *     begi n                 : M on Mar 23  2006
    7   *     copy right             : ( C) 2006 Bo onEx Group
    8   *     webs ite               : h ttp://www. boonex.com /
    9   * This fil e is part  of Dolphin  - Smart C ommunity B uilder
    10   *
    11   * Dolphin  is free so ftware. Th is work is  licensed  under a Cr eative Com mons Attri bution 3.0  License. 
    12   * http://c reativecom mons.org/l icenses/by /3.0/
    13   *
    14   * Dolphin  is distrib uted in th e hope tha t it will  be useful,  but WITHO UT ANY WAR RANTY;
    15   * without  even the i mplied war ranty of   MERCHANTAB ILITY or F ITNESS FOR  A PARTICU LAR PURPOS E.
    16   * See the  Creative C ommons Att ribution 3 .0 License  for more  details. 
    17   * You shou ld have re ceived a c opy of the  Creative  Commons At tribution  3.0 Licens e along wi th Dolphin
    18   * see lice nse.txt fi le; if not , write to  marketing @boonex.co m
    19   ********** ********** ********** ********** ********** ********** ********** *****/
    20  
    21   require_on ce( '../in c/header.i nc.php' );
    22   require_on ce( BX_DIR ECTORY_PAT H_INC . 'd esign.inc. php' );
    23   require_on ce( BX_DIR ECTORY_PAT H_INC . 'a dmin_desig n.inc.php'  );
    24  
    25  
    26   $logged['a dmin'] = m ember_auth ( 1, true,  true );
    27  
    28  
    29  
    30  
    31  
    32   $_page['cs s_name'] =  'preValue s.css';
    33  
    34   $_page['he ader'] = ' Predefined  Lists';
    35  
    36   $_page['ex traCodeInH ead'] = << <EOJ
    37   <script ty pe="text/j avascript"  src="{$si te['plugin s']}jquery /jquery.js "></script >
    38   EOJ;
    39  
    40  
    41  
    42  
    43   $aFields =  array(
    44       'Value '  => 'The  value sto red in the  database' ,
    45       'LKey'    => 'Pri mary langu age key us ed for dis playing',
    46       'LKey2 '  => 'Sec ondary lan guage key  used for d isplaying  in some ot her places ',
    47       'LKey3 '  => 'Mis celaniuos  language k ey used fo r displayi ng in some  other pla ces.',
    48       'Extra '  => 'Ext ra paramet er. Used f or example  as link t o profile  image for  Sex list.' ,
    49       'Extra 2' => 'Mis celanious  extra para meter',
    50       'Extra 3' => 'Mis celanious  extra para meter'
    51   );
    52  
    53  
    54  
    55  
    56  
    57  
    58   if( isset(  $_REQUEST ['popup']  ) and $_RE QUEST['pop up'] == 1  ) {
    59       $iAmIn Popup = tr ue;
    60       TopCod eAdminPopu p();
    61       PageCo mpPageMain Code();
    62       Bottom CodeAdminP opup();
    63   } else {
    64       $iAmIn Popup = fa lse;
    65       TopCod eAdmin();
    66       PageCo mpPageMain Code();
    67       Bottom Code();
    68   }
    69  
    70   function P ageCompPag eMainCode( ) {
    71       global  $iAmInPop up;
    72       global  $aFields;
    73       
    74       $sPopu pAdd = $iA mInPopup ?  '&popup=1 ' : '';
    75       
    76       if( is set( $_POS T['action' ] ) and $_ POST['acti on'] == 'S ave' and i sset( $_PO ST['PreLis t'] ) and  is_array(  $_POST['Pr eList'] )  ) {
    77           sa veList( $_ POST['list '], $_POST ['PreList' ] );
    78           re turn;
    79       }
    80       
    81       //get  lists
    82       $aList s = array(  '' => '-  Select -'  );
    83       $sQuer y = "SELEC T DISTINCT  `Key` FRO M `PreValu es`";
    84       $rList s = db_res ( $sQuery  );
    85       while(  $aList =  mysql_fetc h_assoc( $ rLists ) )  {
    86           $a Lists[ $aL ist['Key']  ] = $aLis t['Key'];
    87       }
    88       
    89       if( is set( $_REQ UEST['list '] ) ) {
    90           $s List_db =  process_db _input(  $ _REQUEST[' list'] );
    91           $s List    =  process_pa ss_data( $ _REQUEST[' list'] );
    92           
    93           $s Query = "S ELECT * FR OM `PreVal ues` WHERE  `Key` = ' $sList_db'  ORDER BY  `Order`";
    94           $r Values = d b_res( $sQ uery );
    95           
    96           if ( !mysql_n um_rows( $ rValues )  ) //if no  rows retur ned...
    97                $aLists[  $sList ]  = $sList;  //create n ew list
    98       } else  {
    99           $s List = '';
    100       }
    101       
    102       ?>
    103       <scrip t type="te xt/javascr ipt">
    104           fu nction cre ateNewList () {
    105                var sNew List = pro mpt( 'Plea se enter n ame of new  list' );
    106                
    107                if( sNew List == nu ll )
    108                    retu rn false;
    109                
    110                sNewList  = $.trim(  sNewList  );
    111                
    112                if( !sNe wList.leng th ) {
    113                    aler t( 'You sh ould enter  correct n ame' );
    114                    retu rn false;
    115                }
    116                
    117                window.l ocation =  '<?= $_SER VER['PHP_S ELF'] ?>?l ist=' + en codeURICom ponent( sN ewList ) +  '<?= $sPo pupAdd ?>' ;
    118           }
    119           
    120           fu nction add Row( eImg  ) {
    121                $( eImg  ).parent() .parent(). before(
    122                    '<tr >' +
    123                    <?
    124                    fore ach( $aFie lds as $sF ield => $s Help ) {
    125                         ?>
    126                         '<td><inpu t type="te xt" class= "value_inp ut" name=" PreList['  + iNextInd  + '][<?=  $sField ?> ]" value=" " /></td>'  +
    127                         <?
    128                    }
    129                    ?>
    130                         '<th>' +
    131                             '<img  src="image s/minus1.g if"     cl ass="row_c ontrol" ti tle="Delet e"    alt= "Delete" o nclick="de lRow( this  );" />' +
    132                             '<img  src="image s/arrow_up .gif"   cl ass="row_c ontrol" ti tle="Move  up"   alt= "Delete" o nclick="mo veUpRow( t his );" /> ' +
    133                             '<img  src="image s/arrow_do wn.gif" cl ass="row_c ontrol" ti tle="Move  down" alt= "Delete" o nclick="mo veDownRow(  this );"  />' +
    134                         '</th>' +
    135                    '</t r>'
    136                );
    137                
    138                iNextInd  ++;
    139                
    140                sortZebr a();
    141           }
    142           
    143           fu nction del Row( eImg  ) {
    144                $( eImg  ).parent() .parent(). remove();
    145                sortZebr a();
    146           }
    147           
    148           fu nction mov eUpRow( eI mg ) {
    149                var oCur  = $( eImg  ).parent( ).parent() ;
    150                var oPre v = oCur.p rev( ':not (.headers) ' );
    151                if( !oPr ev.length  )
    152                    retu rn;
    153                
    154                // swap  elements v alues
    155                var oCur Elems  = $ ('input',  oCur.get(0 ));
    156                var oPre vElems = $ ('input',  oPrev.get( 0));
    157                
    158                oCurElem s.each( fu nction(iIn d) {
    159                    var  oCurElem   = $( this  );
    160                    var  oPrevElem  = oPrevEle ms.filter(  ':eq(' +  iInd + ')'  );
    161                    
    162                    // s wap them
    163                    var  sCurValue  = oCurElem .val();
    164                    oCur Elem.val(  oPrevElem. val() );
    165                    oPre vElem.val(  sCurValue  );
    166                } );
    167           }
    168           
    169           fu nction mov eDownRow(  eImg ) {
    170                var oCur  = $( eImg  ).parent( ).parent() ;
    171                var oPre v = oCur.n ext( ':not (.headers) ' );
    172                if( !oPr ev.length  )
    173                    retu rn;
    174                
    175                // swap  elements v alues
    176                var oCur Elems  = $ ('input',  oCur.get(0 ));
    177                var oPre vElems = $ ('input',  oPrev.get( 0));
    178                
    179                oCurElem s.each( fu nction(iIn d) {
    180                    var  oCurElem   = $( this  );
    181                    var  oPrevElem  = oPrevEle ms.filter(  ':eq(' +  iInd + ')'  );
    182                    
    183                    // s wap them
    184                    var  sCurValue  = oCurElem .val();
    185                    oCur Elem.val(  oPrevElem. val() );
    186                    oPre vElem.val(  sCurValue  );
    187                } );
    188           }
    189           
    190           fu nction sor tZebra() {
    191                $( '#lis tEdit tr:e ven' ).rem oveClass(  'even odd'  ).addClas s( 'even'  );
    192                $( '#lis tEdit tr:o dd'  ).rem oveClass(  'even odd'  ).addClas s( 'odd'   );
    193           }
    194           
    195           // just a des ign
    196           $(  document  ).ready( s ortZebra ) ;
    197       </scri pt>
    198       
    199       <form  action="<? = $_SERVER ['PHP_SELF '] ?>" met hod="post" >
    200           <t able id="l istEdit" c ellpadding ="0" cells pacing="0" >
    201                <tr>
    202                    <th  colspan="< ?= count(  $aFields )  + 1 ?>">
    203                         Select a l ist:
    204                         <select na me="list"
    205                           onchange ="if( this .value !=  '' ) windo w.location  = '<?= $_ SERVER['PH P_SELF'] ? >' + '?lis t=' + enco deURICompo nent( this .value ) +  '<?= $sPo pupAdd ?>' ;">
    206                             <?= ge nListOptio ns( $aList s, $sList  ) ?>
    207                         </select>
    208                         <input typ e="button"  value="Cr eate New"  onclick="c reateNewLi st();" />
    209                    </th >
    210                </tr>
    211       <?
    212       if( $s List !== ' ' ) {
    213           $i NextInd =  genListRow s( $sList_ db );
    214           ?>
    215                <tr>
    216                    <th  colspan="8 ">
    217                         <input typ e="hidden"  name="pop up" value= "<?= $iAmI nPopup ?>"  />
    218                         <input typ e="submit"  name="act ion" value ="Save" />
    219                    </th >
    220                </tr>
    221           <?
    222       } else
    223           $i NextInd =  0;
    224       ?>
    225           </ table>
    226           
    227           <s cript type ="text/jav ascript">
    228                iNextInd  = <?= $iN extInd ?>;
    229           </ script>
    230       </form >
    231       <?
    232   }
    233  
    234   function g enListOpti ons( $aLis ts, $sActi ve ) {
    235       $sRet  = '';
    236       foreac h( $aLists  as $sKey  => $sValue  ) {
    237           $s Ret .= '
    238                <option  value="' .
    239                htmlspec ialchars(  $sKey ) .
    240                '"' . (  ( $sKey ==  $sActive  ) ? ' sele cted="sele cted"' : ' ' ) .
    241                '>' . ht mlspecialc hars( $sVa lue ) . '< /option>';
    242       }
    243       
    244       return  $sRet;
    245   }
    246  
    247   function g enListRows ( $sList_d b ) {
    248       global  $aFields;
    249       
    250       $sQuer y = "SELEC T * FROM ` PreValues`  WHERE `Ke y` = '$sLi st_db' ORD ER BY `Ord er`";
    251       $rList  = db_res(  $sQuery ) ;
    252       
    253       ?>
    254           <t r class="h eaders">
    255       <?
    256       foreac h( $aField s as $sFie ld => $sHe lp ) {
    257           ?>
    258                <th>
    259                    <spa n class="t ableLabel"
    260                      on mouseover= "showFloat Desc( '<?=  addslashe s( htmlspe cialchars(  $sHelp )  ) ?>' );"
    261                      on mousemove= "moveFloat Desc( even t );"
    262                      on mouseout=" hideFloatD esc();">
    263                         <?= $sFiel d ?>
    264                    </sp an>
    265                </th>
    266           <?
    267       }
    268       ?>
    269                <th>&nbs p;</th>
    270           </ tr>
    271       <?
    272       
    273       $iCoun ter = 0;
    274       
    275       while(  $aRow = m ysql_fetch _assoc( $r List ) ) {
    276           ?>
    277           <t r>
    278           <?
    279           fo reach( $aF ields as $ sField =>  $sHelp ) {
    280                ?>
    281                <td>
    282                    <inp ut type="t ext" class ="value_in put" name= "PreList[< ?= $iCount er ?>][<?=  $sField ? >]" value= "<?= htmls pecialchar s( $aRow[$ sField] )  ?>" />
    283                </td>
    284                <?
    285           }
    286           ?>
    287                <th>
    288                    <img  src="imag es/minus1. gif"     c lass="row_ control" t itle="Dele te"    alt ="Delete"  onclick="d elRow( thi s );" />
    289                    <img  src="imag es/arrow_u p.gif"   c lass="row_ control" t itle="Move  up"   alt ="Delete"  onclick="m oveUpRow(  this );" / >
    290                    <img  src="imag es/arrow_d own.gif" c lass="row_ control" t itle="Move  down" alt ="Delete"  onclick="m oveDownRow ( this );"  />
    291                </th>
    292           </ tr>
    293           <?
    294           
    295           $i Counter ++ ;
    296       }
    297       ?>
    298           <t r class="h eaders">
    299                <td cols pan="<?= c ount( $aFi elds ) ?>" >&nbsp;</t d>
    300                <th>
    301                    <img  src="imag es/plus1.g if" class= "row_contr ol" title= "Add" alt= "Add" oncl ick="addRo w( this ); " />
    302                </th>
    303           </ tr>
    304       <?
    305       
    306       return  $iCounter ;
    307   }
    308  
    309  
    310   function s aveList( $ sList, $aD ata ) {
    311       global  $aFields;
    312       global  $iAmInPop up;
    313       
    314       $sList _db = trim ( process_ db_input(  $sList ) ) ;
    315       
    316       if( $s List_db ==  '' )
    317           re turn false ;
    318       
    319       $sQuer y = "DELET E FROM `Pr eValues` W HERE `Key`  = '$sList _db'";
    320       
    321       db_res ( $sQuery  );
    322       
    323       $sValu esAlter =  '';
    324       
    325       foreac h( $aData  as $iInd = > $aRow )  {
    326           $a Row['Value '] = str_r eplace( ', ', '', tri m( $aRow[' Value'] )  );
    327           
    328           if ( $aRow['V alue'] ==  '' )
    329                continue ;
    330           
    331           $s ValuesAlte r .= "'" .  process_d b_input( $ aRow['Valu e'] ) . "' , ";
    332           
    333           $s InsFields  = '';
    334           $s InsValues  = '';
    335           fo reach( $aF ields as $ sField =>  $sTemp ) {
    336                $sValue  = trim( pr ocess_db_i nput( $aRo w[$sField]  ) );
    337                
    338                $sInsFie lds .= "`$ sField`, " ;
    339                $sInsVal ues .= "'$ sValue', " ;
    340           }
    341           
    342           $s InsFields  = substr(  $sInsField s, 0, -2 ) ; //remove  ', '
    343           $s InsValues  = substr(  $sInsValue s, 0, -2 ) ;
    344           
    345           $s Query = "I NSERT INTO  `PreValue s` ( `Key` , $sInsFie lds, `Orde r` ) VALUE S ( '$sLis t_db', $sI nsValues,  $iInd )";
    346           
    347           // echo $sQue ry . "<br  />\n";
    348           db _res( $sQu ery );
    349       }
    350       
    351       //alte r Profiles  table
    352       $sValu esAlter =  substr( $s ValuesAlte r, 0, -2 ) ; //remove  ', '
    353       $sQuer y = "SELEC T `Name` F ROM `Profi leFields`  WHERE `Typ e` = 'sele ct_set' AN D `Values`  = '#!{$sL ist_db}'";
    354       $rFiel ds = db_re s( $sQuery  );
    355       while(  $aField =  mysql_fet ch_assoc(  $rFields )  ) {
    356           $s Field = $a Field['Nam e'];
    357           
    358           $s Query = "A LTER TABLE  `Profiles ` CHANGE ` $sField` ` $sField` s et($sValue sAlter) NO T NULL def ault ''";
    359           db _res( $sQu ery );
    360       }
    361       
    362       compil ePreValues ();
    363       
    364       if( $i AmInPopup  ) {
    365           ?>
    366           <s cript type ="text/jav ascript">w indow.clos e()</scrip t>
    367           <?
    368       } else  {
    369           ?>
    370           <d iv style=" text-align :center;co lor:green; ">
    371                Saved.
    372                <a href= "<?= $_SER VER['PHP_S ELF'] ?>?l ist=<?= ur lencode( p rocess_pas s_data( $s List ) ) ? >">
    373                    Retu rn back
    374                </a>
    375           </ div>
    376           <?
    377       }
    378   }
    379  
    380   function c ompilePreV alues() {
    381       global  $dir;
    382       
    383       $sQuer y = "SELEC T DISTINCT  `Key` FRO M `PreValu es`";
    384       $rKeys  = db_res(  $sQuery ) ;
    385       
    386       $rProf  = @fopen(  "{$dir['i nc']}prof. inc.php",  'w' );
    387       if( !$ rProf ) {
    388           ec ho '<b>War ning!</b>  Couldn\'t  compile pr of.inc.php . Please c heck permi ssions.';
    389           re turn false ;
    390       }
    391           
    392       
    393       fwrite ( $rProf,  "<?\n\$aPr eValues =  array(\n"  );
    394       
    395       while(  $aKey = m ysql_fetch _assoc( $r Keys ) ) {
    396           $s Key    = $ aKey['Key' ];
    397           $s Key_db = a ddslashes(  $sKey );
    398           
    399           fw rite( $rPr of, "  '$s Key_db' =>  array(\n"  );
    400           
    401           $s Query = "S ELECT * FR OM `PreVal ues` WHERE  `Key` = ' $sKey_db'  ORDER BY ` Order`";
    402           $r Rows  = db _res( $sQu ery );
    403           
    404           wh ile( $aRow  = mysql_f etch_assoc ( $rRows )  ) {
    405                $sValue_ db = addsl ashes( $aR ow['Value' ] );
    406                fwrite(  $rProf, "     '{$sVal ue_db}' =>  array( "  );
    407                
    408                foreach(  $aRow as  $sValKey = > $sValue  ) {
    409                    if(  $sValKey = = 'Key' or  $sValKey  == 'Value'  or $sValK ey == 'Ord er' )
    410                         continue;  //skip key , value an d order. t hey alread y used
    411                    
    412                    if(  !strlen( $ sValue ) )
    413                         continue;  //skip emp ty values
    414                    
    415                    fwri te( $rProf , "'$sValK ey' => '"  . addslash es( $sValu e ) . "',  " );
    416                }
    417                
    418                fwrite(  $rProf, ") ,\n" );
    419           }
    420           
    421           fw rite( $rPr of, "  ),\ n" );
    422       }
    423       
    424       fwrite ( $rProf,  ");\n" );
    425       fwrite ( $rProf,  '
    426   $aPreValue s[\'Countr y\'] = sor tArrByLang ( $aPreVal ues[\'Coun try\'] );
    427  
    428   function s ortArrByLa ng( $aArr  ) {
    429       if( !f unction_ex ists( \'_t \' ) )
    430           re turn $aArr ;
    431       
    432       $aSort Arr = arra y();
    433       foreac h( $aArr a s $sKey =>  $aValue )
    434           $a SortArr[$s Key] = _t(  $aValue[\ 'LKey\'] ) ;
    435       
    436       asort(  $aSortArr  );
    437       
    438       $aNewA rr = array ();
    439       foreac h( $aSortA rr as $sKe y => $sVal  )
    440           $a NewArr[$sK ey] = $aAr r[$sKey];
    441       
    442       return  $aNewArr;
    443   }
    444       ' );
    445  
    446       fclose ( $rProf ) ;
    447       
    448       return  true;
    449   }