<?php
 
/**
 
* Start file.
 
*
 
* @package Turtle
 
* @access public
 
* @desc Start file.
 
* @copyright Marcin Sznyra (c) 2005 <[email protected]>
 
* @author Marcin Sznyra <[email protected]>
 
* @version $Id: _file.class.php,v 1.0 2005/12/29 11:39:23 MarcinSznyra Exp $;
 
* @since Version 1.0
 
*/
 
    if( $_SERVER['REQUEST_METHOD'] == 'POST' && is_dir( $_POST['source'] ) && is_dir( $_POST['target'] ) && is_numeric( $_POST['length'] ) ) 
 
    {
 
        $_CONFIG['classes'] = $_POST['classes'];
 
        $_CONFIG['functions'] = $_POST['functions'];
 
        $_CONFIG['variables'] = $_POST['variables'];
 
        $_CONFIG['comments'] = $_POST['comments'];
 
        $_CONFIG['trim'] = $_POST['trim'];
 
        $_CONFIG['length'] = $_POST['length'];
 
        $_CONFIG['time'] = $_POST['time'];
 
        $_CONFIG['source'] = stripslashes( $_POST['source'] );
 
        $_CONFIG['target'] = stripslashes( $_POST['target'] );
 
        $_CONFIG['smarty'] = $_POST['smarty'];
 
        $_CONFIG['nochange'] = $_POST['nochange'];
 
        
 
        include( realpath( dirname( __FILE__ ) ).'/_file.class.php' );
 
        
 
        $_FILE = new File( );
 
        $_FILE -> open( realpath( dirname( __FILE__ ) ).'/config.dat' );
 
        $_FILE -> clear( );
 
        $_FILE -> write( serialize( $_CONFIG ) );
 
        $_FILE -> close( );
 
        
 
        $_addr = '"'.stripslashes( $_SERVER["SCRIPT_FILENAME"] ).'" -q '.realpath( dirname( __FILE__ ) ).'/begin.php';
 
 
        echo '<h1>Turtle Muddler</h1>';
 
        echo '<p>Please specify method to run Turtle, you can run Turtle in browser window or in terminal window.</p>';
 
        echo '<p>For every projects that have more than 50 files run Turtle via using terminal.</p>';
 
        echo '<p>Click Windows <b>Start</b> than <b>Run</b> and type command <b>cmd</b> inside. Press Enter.</p>';
 
        echo '<p>Inside Terminal window type exacly this : <BR><BR> <b>'.$_addr.'</b><BR><BR> Than press enter and watch the terminal screen.<p>';
 
        echo '<p></p>';
 
        echo '<p>Otherwise you can run Turtle in browser window. Click link below.</p>';    
 
        echo '<p><input type="button" name="run" onClick="javascript:window.location.href(\'begin.php\');" value="Run in browser ( not recommended )"></p>';    
 
    
 
    } else {
 
    
 
        if( $_SERVER['REQUEST_METHOD'] != 'POST' ) { $_POST['source'] = "D:\apache\\test\\"; }
 
        if( $_SERVER['REQUEST_METHOD'] != 'POST' ) { $_POST['target'] = "D:\apache\\trash\\"; }
 
        if( $_SERVER['REQUEST_METHOD'] != 'POST' ) { $_POST['classes'] = true; }
 
        if( $_SERVER['REQUEST_METHOD'] != 'POST' ) { $_POST['functions'] = true; }
 
        if( $_SERVER['REQUEST_METHOD'] != 'POST' ) { $_POST['variables'] = true; }
 
        if( $_SERVER['REQUEST_METHOD'] != 'POST' ) { $_POST['comments'] = true; }
 
        if( $_SERVER['REQUEST_METHOD'] != 'POST' ) { $_POST['trim'] = true; }
 
        if( $_SERVER['REQUEST_METHOD'] != 'POST' ) { $_POST['length'] = 5; }
 
        if( $_SERVER['REQUEST_METHOD'] != 'POST' ) { $_POST['time'] = 30; }
 
        if( $_SERVER['REQUEST_METHOD'] != 'POST' ) { $_POST['smarty'] = false; }
 
        if( $_SERVER['REQUEST_METHOD'] != 'POST' ) { $_POST['nochange'] = null; }
 
        
 
        echo '<h1>Turtle Muddler</h1>';
 
        echo '<p>A php obfuscator.</p>';
 
        
 
        echo '<form name="form" method="post">';
 
        echo '<p>';
 
        echo 'Sorurce directory ( must be existing directory )<BR>';
 
        echo '<input type="text" name="source" value="'.$_POST['source'].'" style="width:400px;"><BR>'; 
 
        echo '</p>';
 
        echo '<p>';
 
        echo 'Target directory ( must be existing directory )<BR>';
 
        echo '<input type="text" name="target" value="'.$_POST['target'].'" style="width:400px;"><BR>'; 
 
        echo '</p>';
 
        echo '<p>';
 
        echo 'Should change classes names ?<BR>';
 
        
 
        if( $_POST['classes'] == true )
 
        {
 
            
 
            echo '<input type="radio" name="classes" value="true" checked>Yes'; 
 
            echo '<input type="radio" name="classes" value="false">No<BR>'; 
 
            
 
        } else {
 
        
 
            echo '<input type="radio" name="classes" value="true">Yes'; 
 
            echo '<input type="radio" name="classes" value="false" checked>No<BR>'; 
 
        
 
        }
 
        echo '</p>';
 
        echo '<p>';
 
        echo 'Should change Functions names ?<BR>';
 
        
 
        if( $_POST['functions'] == true )
 
        {
 
            
 
            echo '<input type="radio" name="functions" value="true" checked>Yes'; 
 
            echo '<input type="radio" name="functions" value="false">No<BR>'; 
 
            
 
        } else {
 
        
 
            echo '<input type="radio" name="functions" value="true">Yes'; 
 
            echo '<input type="radio" name="functions" value="false" checked>No<BR>'; 
 
        
 
        }
 
        echo '</p>';
 
        
 
        echo '<p>';
 
        echo 'Should change Variables names ?<BR>';
 
        
 
        if( $_POST['variables'] == true )
 
        {
 
            
 
            echo '<input type="radio" name="variables" value="true" checked>Yes'; 
 
            echo '<input type="radio" name="variables" value="false">No<BR>'; 
 
            
 
        } else {
 
        
 
            echo '<input type="radio" name="variables" value="true">Yes'; 
 
            echo '<input type="radio" name="variables" value="false" checked>No<BR>'; 
 
        
 
        }
 
        echo '</p>';
 
        
 
        echo '<p>';
 
        echo 'Should clear all comments ?<BR>';
 
        
 
        if( $_POST['comments'] == true )
 
        {
 
            
 
            echo '<input type="radio" name="comments" value="true" checked>Yes'; 
 
            echo '<input type="radio" name="comments" value="false">No<BR>'; 
 
            
 
        } else {
 
        
 
            echo '<input type="radio" name="comments" value="true">Yes'; 
 
            echo '<input type="radio" name="comments" value="false" checked>No<BR>'; 
 
        
 
        }
 
        echo '</p>';
 
        
 
        echo '<p>';
 
        echo 'Should clear all white spaces ?<BR>';
 
        
 
        if( $_POST['trim'] == true )
 
        {
 
            
 
            echo '<input type="radio" name="trim" value="true" checked>Yes'; 
 
            echo '<input type="radio" name="trim" value="false">No<BR>'; 
 
            
 
        } else {
 
        
 
            echo '<input type="radio" name="trim" value="true">Yes'; 
 
            echo '<input type="radio" name="trim" value="false" checked>No<BR>'; 
 
        
 
        }
 
        echo '</p>';
 
        
 
        echo '<p>';
 
        echo 'How many characters should have random name ?<BR>';
 
        echo '<input type="text" name="length" value="'.$_POST['length'].'" maxlength="2" style="width:50px;"><BR>'; 
 
        echo '</p>';
 
        
 
        echo '<p>';
 
        echo 'Time limit for code process ( in minutes )<BR>';
 
        echo '<input type="text" name="time" value="'.$_POST['time'].'" maxlength="4" style="width:50px;"><BR>'; 
 
        echo '</p>';
 
        
 
        echo '<p>';
 
        echo 'Do you use Smarty in your project ?<BR>';
 
        
 
        if( $_POST['smarty'] == true )
 
        {
 
            
 
            echo '<input type="radio" name="smarty" value="true" checked>Yes'; 
 
            echo '<input type="radio" name="smarty" value="false">No<BR>'; 
 
            
 
        } else {
 
        
 
            echo '<input type="radio" name="smarty" value="true">Yes'; 
 
            echo '<input type="radio" name="smarty" value="false" checked>No<BR>'; 
 
        
 
        }
 
        echo '</p>';
 
        
 
        echo '<p>';
 
        echo 'Enter all names that should not be changed ( ex. : mode, name, var )<BR>';
 
        echo '<textarea name="nochange" style="width:400px;height:50px">'.$_POST['nochange'].'</textarea><BR>'; 
 
        echo '</p>';
 
        
 
        echo '<input type="submit" name="submit" value="process files"></form>';
 
    }
 
 
?>
 
 |