Members in Chat:
  • Glype Modifications

    Template Edits

    The great thing about Glype is that it works out of the box. The even better thing is that it is extremely easy to edit. Everything is changeable from the Admin CP and your themes folder. In fact, let's explore the 'Themes' folder right now:

    Main.php – This is the template for your proxy index. You will need to change this just like any website template to suit your needs.

    FramedForm.inc.php – This is the template for your proxified pages. It includes the HTML/CSS for your proxy form.

    Config.php – This is a very important file that allows you to use template tags inside of your other files in the themes folder. For example, if you place the following:

    PHP Code:
    $themeReplace['testing'] = <<<OUT
    This is a test variable.
    OUT; 
    inside of your CONFIG file, and then

    PHP Code:
    <!--[testing]--> 
    into one of your other files, then 'This is a test variable.' would appear in it's place. This is a very convenient way of editing things.

    A very important tag in the CONFIG is the

    PHP Code:
    $themeReplace['proxified'] = <<<OUT 
    OUT

    tag. Placing something in between here will make it appear on the proxified pages. CPM ads are good to put in here (see Monetization chapter).

    Adding New Pages

    Just like any other website, the way to add new pages to a proxy is to make a file inside of the root folder (public_html). Now, the problem with this is that that page will not match your site's template, and even if it does, you will not be able to edit it via the CONFIG file.

    There is an easy to way to edit all of your main pages straight from your themes folder. And here's how. Start by making a new file in your public_html folder, we'll call it testfile.php. Next, place the following code inside of this test file:

    PHP Code:
    <?php 
    /******************************************************************* *
    Glype Proxy Script * Copyright (c) 2009, http://www.glype.com/
    ******************************************************************/ 

    require 'includes/init.php'
    sendNoCache(); 
    ob_start('render'); 
    $_SESSION['no_hotlink'] = true
    $toShow = array(); 
    $vars['toShow'] = $toShow
    echo 
    loadTemplate('testfile'$vars); 
    ob_end_flush(); 

    ?>
    Now, if we quickly take a look to see what this does, we will see that it (A) Gets functions from the 'init.php' file, (B) Tells the server how to configure the file, (C) Loads up the variable parser, and (D) Loads the template in your theme folder.

    Now, if you look at the above code, testfile is the name of the template inside of your themes folder. So make sure they match (IE if you name it terms, then you need to make a terms.php inside of your themes folder).

    Once you have configured that up, make a folder in your themes folder (using the name you specified above), and place content in it. You will probably want to use a similar template in your main.php file. You can also add variables to it, so that's where your CONFIG comes in handy. I hope this helps!

    Optimization

    This will be the longest and dullest part of your proxy journey, but also a very essential step. For those of you who haven't noticed, Glype is about 200KB large. Now, multiply that by every proxy you own, and you can tell that its a large file. And here's the thing: about half of it is all white spacing and comments. I looked at the files one day, and I was like, “Wow, what is the point of all of this?” Unless you plan on editing and customizing the main files (not necessary at all), then there is no reason why you can't condense them and remove all of the white space.

    This will be dull, boring, long, and very annoying. Also, make sure you know basic PHP or whatever, because if you make a mistake and don't know what to fix, you will need to reupload the file and you are back to square one. Save the file constantly, check it, try it on a different server.

    I can safely say that after removing just 3/5 of all of the white space (I still got a lot to work on), I reduced the file size down to about 150KB. I estimate I can reduce it all the way down to 100KB if I removed unnecessary theme folders and even more whitespace. Now if I have about 20 proxies, that's about 2MB of file space that I am not using. Not only that, but I will use less bandwidth and my page loading time will increase. I actually did a test on this, I was able to notice the difference in page loading time, it was almost instant.

    Now, I wish I could just give you an optimized version of Glype, but Nick, the guy that wrote Glype, is not giving me redistribution rights. So you're on your own, sorry

    A few other things you should do is implement that cache for popular sites, as this save bandwidth (although may use up some file space), and make sure to delete unneeded logs. They use up more space than you think.

    Summary: Use the CONFIG file and template variable tags to globally edit files, as well as the Main and FramedForm.inc file. You are able to make new pages through the themes folder using a certain PHP code (see above). And finally, get rid of as much whitespace in files as you can, and make use of the cache feature. Your server and visitors will thank you!

    << Monetization