<?
include_once( "$DOCUMENT_ROOT/FX/FX.php" );
include_once( 
"$DOCUMENT_ROOT/FX/server_data_ext.php" );

$tmpQ = new FX$serverIP'80' );
$tmpQ->SetDBData"Comitas""UnixExtension" );
$tmpQ->SetDBPassword$PWWeb$UNWeb );

switch( 
$actionType ) {
    case 
"add":
        
$q $tmpQ//new FX( $serverIP );
        
$q->SetDBData"Comitas""UnixExtension" );
//        $q->SetDBPassword( $PWWeb, $UNWeb );
        
$q->AddDBParam"unixExtension"$unixExtension );
        
$q->AddDBParam"creator"$creator );
        
$q->AddDBParam"app"$app );
        
$q->AddDBParam"type"$type );
        
$q->AddDBParam"filetype"$filetype );
        
$q->AddDBParam"mimestyle"$mimestyle );
        
$q->AddDBParam"verified""0" );
        
$r $q->FMNew();
        
$info 'As we are not interested in GOAT CHEE SEWI THHE MORR OIDS your new info will be available'
            
.' as soon as it has been verified by the server admin.';
    break;
}
if ( ! isset(
$page)) {
    
$page=1;
}

if ( ! isset(
$prpage)) {
    
$prpage=20;
}

if ( ! isset(
$_REQUEST['verify'])) {
    
$verify=1;
}

$prevpage $page 1;
$nextpage $page 1;

if (
$prevpage 1) {
    
$prevpage 1;
}

$firstline = ($page $prpage) - $prpage 1;
$lastline $page $prpage;

if (
$lastline $count) {
    
$lastline $count;
}

$q $tmpQ//new FX($serverIP);
if ( $skip != ){
    
$q->SetDBData"Comitas""UnixExtension"$prpage );
} else {
    
$q->SetDBData"Comitas""UnixExtension""75" );
}
//$q->SetDBPassword( $PWWeb, $UNWeb );
switch( $_REQUEST['verify'] ) {
    case 
'0':
        
$q->AddDBParam("verified""0""eq");
    break;
    default:
        
$q->AddDBParam("verified""1""eq");
    break;
}

if( 
$actionType == "search" ) {
    if( 
$unixExtension ) {
        
$q->AddDBParam("unixExtension"$unixExtension);
    }
    if (
$mimestyle) {
        
$q->AddDBParam("mimestyle"$mimestyle);
    }
    if (
$filetype) {
        
$q->AddDBParam("filetype"$filetype);
    }
    if (
$type) {
        
$q->AddDBParam("type"$type);
    }
    if (
$app) {
        
$q->AddDBParam("app"$app);
    }
    if (
$creator) {
        
$q->AddDBParam("creator"$creator);
    }
}

$q->AddSortParam("unixExtension");

if ( 
$skip != ) {
    
$q->FMSkipRecords($firstline);
}

$r $q->FMFind();
$currentKey key($r['data']);

$count $r['foundCount'];
if ( 
$skip == ) {
    
$info 'found count = '.$count;
}
$number_of_pages + ($count/$prpage) - ($count%$prpage)/$prpage;

if (
$nextpage >= ($count/$prpage)+1) {
    
$nextpage $page;
}

$pagina='<a href="./?page=1&prpage='.$prpage.'">|&lt;</a>&nbsp;<a href="./?page='.$prevpage.'&prpage='.$prpage.'">&lt;-</a>&nbsp;';

for (
$i 1$i <= $number_of_pages$i++) {
    if (
$i != $page) {
        
$pagina=$pagina.'&nbsp;<a href="./?page='.$i.'&prpage='.$prpage.'">'.$i.'</a>&nbsp;';
    } else {
        
$pagina=$pagina.'&nbsp;'.$i.'&nbsp;';
    }
}

$pagina=$pagina.'&nbsp;<a href="./?page='.$nextpage.'&prpage='.$prpage.'">-></a>&nbsp;<a href="./?page='.$number_of_pages.'&prpage='.$prpage.'">>|</a>';

$row[] = '<th width="40" align=LEFT>.ext</td>'
    
.'<th width="40" align=LEFT>Creator</td>'
    
.'<th width="200" align=LEFT>App</td>'
    
.'<th width="40" align=LEFT>Type</td>'
    
.'<th width="200" align=LEFT>Filetype</td>'
    
.'<th width="200" align=LEFT>mime type</td>'
    
.'<td width="16" align=LEFT></td>'

$row[] = '<form action="./index.php" method="post">'
    
.'<td><input type="TEXT" name="unixExtension" size="15" value=""></td>'
    
.'<td><input type="TEXT" name="creator" size="6" value=""></td>'
    
.'<td><input type="TEXT" name="app" size="15" value=""></td>'
    
.'<td><input type="TEXT" name="type" size="6" value=""></td>'
    
.'<td><input type="TEXT" name="filetype" size="25" value=""></td>'
    
.'<td><input type="TEXT" name="mimestyle" size="25" value=""></td>'
    
.'<td align=LEFT><input type="HIDDEN" name="actionType" value="search"><input type="HIDDEN" name="skip" value="1"><input type="Submit" name="action" value="Search"></td>'
    
.'</form>';

$counter 1;
if( 
$r['foundCount'] > ) {
    foreach( 
$r['data'] as $key => $value ) {
        
$recordID strtok$key'.' );
        
$row[] = '<td align="left" valign="top">'.$value['unixExtension'][0].'</td>'
            
.'<td align="left" valign="top">'.$value['creator'][0].'</td>'
            
.'<td align="left" valign="top">'.$value['app'][0].'</td>'
            
.'<td align="left" valign="top">'.$value['type'][0].'</td>'
            
.'<td align="left" valign="top">'.$value['filetype'][0].'</td>'
            
.'<td align="left" valign="top">'.$value['mimestyle'][0].'</td>';
        ++
$counter;
    }
} else {
    
$row[] = '<tr><td class="advarsel">Found just about nothing</td></tr>';
}
$row[] = '<form action="./index.php" method="post">'
    
.'<td><input type="TEXT" name="unixExtension" size="15" value=""></td>'
    
.'<td><input type="TEXT" name="creator" size="6" value=""></td>'
    
.'<td><input type="TEXT" name="app" size="15" value=""></td>'
    
.'<td><input type="TEXT" name="type" size="6" value=""></td>'
    
.'<td><input type="TEXT" name="filetype" size="25" value=""></td>'
    
.'<td><input type="TEXT" name="mimestyle" size="25" value=""></td>'
    
.'<td align=LEFT><input type="HIDDEN" name="actionType" value="add"><input type="submit" name="action" value="Add"></td>'
    
.'</form>';
$row[] = $row[0];//Copying the first row( The label text )
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <meta http-equiv="content-type" content="text/html;charset=UTF-8">
    <title>Unix extensions and Macintosh Creator/Type mapping database</title>
    <link rel=StyleSheet href="HTTP://www.file-making.com/CSS/1.css" type="text/css">
</head>
<body>
<div align="center">
    <table border="0" cellpadding="0" cellspacing="0" width="900" >
        <TR>
            <td ALIGN=CENTER class="pagina">
<?
if ($skip != 1) {
    echo 
$pagina;
}
?>
            </TH>
        </TR>
        <tr height="70"> 
            <td><div align="center">
                <table border="0" cellspacing="4" cellpadding="1" align="center"><?
echo '<tr>'.implode"</tr>\n<tr>"$row ).'</tr>';?>
                </table></div>
            </td>
        </tr>
        <TR>
            <td ALIGN=CENTER class="pagina">
<?
if( $skip != ) {
    echo 
$pagina;
}
?>
            </TD>
        </TR>
        <TR>
            <TD>
                <p>&nbsp;</p>
            </TD>
        </TR>
        <TR>
            <TD ALIGN=CENTER class="advarsel"><?
if( isset( $info ) ) {
    echo 
$info;
    echo 
'<p>You can take a look at the non-verified purposals right now; <a href="./?verify=0">here</a></p>';
}
?></TD>
        </TR>
        <TR>
            <TD ALIGN=CENTER>
                <p>Written with <a href="HTTP://fx.fmug.org">FX.php</a> by: <a href="mailto:ggt667@gmail.com">ggt667@gmail.com</a></p>
            </TD>
        </TR>
        <TR>
            <TD ALIGN=CENTER>
                <p>Thanx Chris!</p>
            </TD>
        </TR>
        <TR>
            <TD ALIGN=CENTER>
                <p>collect-2-text-file<tm> -option is implemented, you can <a href="./download.php">download</a> the current version.</p>
            </TD>
        </TR>
    </table>
</div>
</body>
</html>