Changeset 119 for scrabutility/www


Ignore:
Timestamp:
01/07/08 05:25:37 (10 years ago)
Author:
csnyder
Message:

choice of dictionary

File:
1 edited

Legend:

Unmodified
Added
Removed
  • scrabutility/www/fb.php

    r117 r119  
    3939} 
    4040 
     41// update profile? find current version and dictionary 
     42$update = FALSE; 
     43$current = $fb->api_client->profile_getFBML( $user ); 
     44$vstart = strpos($current, '#')+1; 
     45$vend = strpos($current, '##'); 
     46$vtemp = substr( $current, $vstart, ($vend-$vstart) ); 
     47list( $v, $dict ) = explode( '-', $vtemp ); 
     48if ( empty($v) || !is_numeric($v) || $v < $version ) { 
     49  $update = TRUE; 
     50} 
     51if ( empty($dict) ) { 
     52  $dict = 'SOWPODS'; 
     53} 
     54 
     55// check for update to dict 
     56if ( !empty($_GET['dict']) ) { 
     57  $dict = $_GET['dict']; 
     58  $update = TRUE; 
     59} 
     60 
    4161// build form in FBML 
    4262$version = 2; 
     63 
    4364ob_start(); 
    4465?> 
    45 <!-- #<?=$version?>## --> 
    46 <form action="http://www.scrabutility.com/lookup_SOWPODS.php" method="get" target="_blank"> 
    47 <div class="label">Look up matches in word list:</div> 
     66<!-- #<?=$version?>-<?=$dict?>## --> 
     67<form action="http://www.scrabutility.com/lookup_<?=$dict?>.php" method="get" target="_blank"> 
     68<div class="label">Look up matches in the <?=$dict?> word list:</div> 
    4869<p><input type="text" class="inputtext" name="q" value="" size="12" style="font-family: Courier, monospace; font-size: 14px; color: #444444; padding: 3px 4px 4px 4px;"> <input type="submit" class="inputbutton" value="Lookup" style="padding: 2px 4px 3px 4px;"></p> 
    4970<div style="color: #666666; font-size: 9px; line-height: 11px;"> 
     
    5374<p> 
    5475See all  
    55 <a href="http://www.scrabutility.com/2_SOWPODS.php">two</a>, 
    56 <a href="http://www.scrabutility.com/3_SOWPODS.php">three</a> or 
    57 <a href="http://www.scrabutility.com/4_SOWPODS.php">four</a> letter words. 
     76<a href="http://www.scrabutility.com/2_<?=$dict?>.php">two</a>, 
     77<a href="http://www.scrabutility.com/3_<?=$dict?>.php">three</a> or 
     78<a href="http://www.scrabutility.com/4_<?=$dict?>.php">four</a> letter words. 
    5879</p> 
    5980</form> 
    6081<? 
    6182$form_fbml = ob_get_clean(); 
    62  
    63 // update profile? 
    64 $update = FALSE; 
    65 $current = $fb->api_client->profile_getFBML( $user ); 
    66 $vstart = strpos($current, '#')+1; 
    67 $vend = strpos($current, '##'); 
    68 $v = substr( $current, $vstart, ($vend-$vstart) ); 
    69 if ( empty($v) || !is_numeric($v) || $v < $version ) { 
    70   $update = TRUE; 
    71 } 
    7283 
    7384// get profile url 
     
    7990  $fb->api_client->profile_setFBML( $form_fbml, $user ); 
    8091  ?> 
    81   <p><a href="<?=h($profile_url)?>">Your profile</a> has been updated to include the latest version of the lookup tool.</p> 
     92  <p><a href="<?=h($profile_url)?>">Your profile</a> has been updated to include the latest version of the <?=$dict?> lookup tool.</p> 
    8293  <p>Happy hunting!</p> 
    8394<?}?> 
     
    8899  <?=str_replace( array( '_blank', 'size="12"' ), array( '_self', 'size="18"' ), $form_fbml )?> 
    89100</td> 
     101</tr> 
     102<tr> 
     103  <td>&nbsp;</td> 
     104  <td> 
     105    <form method="get"> 
     106      <p>Dictionary:  
     107      <select name="dict"> 
     108        <option value="SOWPODS" <?if($dict=='SOWPODS'){?>selected="selected"<?}?>>SOWPODS</option> 
     109        <option value="TWL" <?if($dict=='TWL'){?>selected="selected"<?}?>>TWL</option> 
     110      </select> 
     111      <input type="submit" class="inputbutton" value="Change" style="padding: 2px 4px 3px 4px;"> 
     112      </p> 
     113    </form> 
     114   </td> 
    90115</tr> 
    91116</table> 
Note: See TracChangeset for help on using the changeset viewer.