<?php
/**
 * @author: Sean Colombo
 * @date: 20140529
 *
 * @author: Rami Ismail (Vlambeer) for Legal Text
 *
 * Quick script to speed up the process of Devs granting universal
 * permission to YouTubers to create (and monetize) videos based
 * on reviews, Let's Plays, etc. of their games. About halfway through
 * writing this, I realized that Vlambeer uses something like this, so
 * I'll base our text heavily on theirs.
 *
 * INSTALLATION INSTRUCTIONS FOR DEVELOPERS:
 * - Copy the code from this one file.
 * - Paste the code of this file into a .php file.
 * - Modify the capitalized variables in the CONFIGURATION section at
 *   the top of the script (OFFICER_NAME, DEVELOPER_FULL_NAME, etc.).
 * - Upload the script to your webserver.
 **/

///// CONFIGURATION /////
$OFFICER_NAME "Sean Colombo
Chief Executive Officer"
;
$DEVELOPER_FULL_NAME "BlueLine Game Studios Inc.";
$DEVELOPER_SHORT_NAME "BlueLine";
$GAME_LIST "Coagulate, Heximilate, Hive";
///// CONFIGURATION /////


 
$name = isset($_GET['name']) ? $_GET['name']: "";
$SHOW_CODE "show";
$scriptUrl "http".(!empty($_SERVER['HTTPS'])?"s":"")."://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'];
$pageUrl "{$scriptUrl}?name=".urlencode($name);
$codeLink $_SERVER['SCRIPT_NAME']."?code={$SHOW_CODE}";

?><!DOCTYPE html> 
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>YouTube Permission Statement</title>
        <style>
        body{
            font-family:georgia,tahoma,arial;
        }
        div.permission{
            margin:0 auto;
            width:520px;
            text-align:justify;
            white-space:pre-line;
        }
        footer{
            margin-top:200px;
            font-size:.8em;
            text-align:center;
        }
        </style>
    </head>
    <body>
        <article>
            <?php
            
if(isset($_GET['code']) && ($_GET['code'] == $SHOW_CODE)){
            
                
show_source__FILE__ );
            
            } else if(empty(
$name)){
                
// If no name is entered, display form:
                
?>
                <p>Please enter your username on YouTube (or equivalent) to generate permission:</p>
                <form action="" method="GET">
                    <input type='text' name='name' value=''/>
                    <input type='submit' name='submit' value='Submit'/>
                <form>
                
                <footer>
                    This page is powered by a basic script for granting permission to YouTubers.<br/>
                    <br/>
                    The script was made by <a href='http://bluelinegamestudios.com'>BlueLine Game Studios</a>
                    based on the text of <a href='http://vlambeer.com/monetize/'>Vlambeer's monetize page</a> and is
                    open source, you can <a href='<?= $codeLink?>'>view the source & install it on your own servers</a> in about a minute.
                </footer>
                <?php
            
} else {
                
// Text based on Vlambeer's monetize page.
                
?><div class='permission'>
                    Monetization permission for "<?= $name ?>"
                    
                    I,
                    
                    <?= $OFFICER_NAME ?>
                    
                    at <?= $DEVELOPER_FULL_NAME ?>

                    
                    give my/our explicit and legal permission on <?= date("F d, Y"?> to
                    
                    <strong>"<?= $name ?>"</strong>,

                    a user of your video broadcasting service,

                    to monetize videos of <?= $DEVELOPER_SHORT_NAME ?>-made games including but not limited to <?=
                    $GAME_LIST ?>
 or any other title, prototype or terrible game jam thing developed by <?=
                    $DEVELOPER_SHORT_NAME ?>
 in the past, current or future, on any channel owned by "<?= $name ?>".

                    This permission is (retro-actively) valid from the moment your service has been launched until the end of time / apocalypse. This permission shall not be limited to any territory, planet, solar system, universe or hypothetical alternate realities.

                    Seriously, "<?= $name ?>" is allowed to monetize videos using our games for commercial goals. It's good for us too when people share their opinion about our games, you know. Free marketing and all that, but also a good way for us to lift our moods when we're a bit demotivated - watching videos of people playing our games is really energizing for us. We'd recommend it to engineers and designers over at your place.

                    Either way, if somebody can earn a penny or get filthy rich doing that, we're totally cool with that. That's not upsetting. It'd be upsetting if someone got filthy rich by, say, stealing our game idea and mostly replacing the main character with a ninja or something silly like that.

                    If you need irrefutable proof, please click <a href='<?= $pageUrl ?>'><?= $pageUrl ?></a>, where this exact message is available in full on <?= $DEVELOPER_SHORT_NAME ?>'s official website.
                </div>
                
                <footer>This permission was generated using the monetization permission <a href='<?= $scriptUrl ?>'>generator</a> by <a href='http://bluelinegamestudios.com'>BlueLine Games</a>.</footer>
                <?php
            
}
        
?></article>
    </body>
</html><?php