Subversion-Projekte lars-tiefland.php_share

Revision

Blame | Letzte Änderung | Log anzeigen | RSS feed

<?php
    #==============================================================================
    # Änderungen nur in diesem Bereich vornehmen!
    define( 'CUST_ID', 'KUNDENNUMMER' ); # Kundennummer
    define( 'CUST_KEY', 'CRYPT-KEY' ); # Crypt-Key
    #==============================================================================

    #Version 1.3
    define( 'CLSERVER', 'http://mycliplister.com/cliplister/' );
    define( 'REQ_BASE_EMBD', CLSERVER . "play/" . CUST_ID . "/" );
    define( 'REQ_BASE_PBTN', CLSERVER . "playBtn/" . CUST_ID . "/" );
    define( 'REQ_BASE_CPLAY', CLSERVER . "plist/" . CUST_ID . "/" );

    define( 'tagPbtn',
        '<iframe onload="cliplister()" id="clipBtn__PRODUKT_" style="Z-INDEX: 999;" scrolling="no" width="34px" height="34px" scrolling="no" frameborder="0" src="_URL_"></iframe>' );

    define( 'tagHidden',
        '<iframe id="cliplister__PRODUKT_"  frameborder="0"  vspace="0"  hspace="0"  marginwidth="0"  marginheight="0" ' .
        ' style="Z-INDEX: 999;  visibility:hidden; width:_WIDTH_px; height:_HEIGHT_px; " scrolling="no" ' .
        'name="_URL_" ></iframe>' );

    define( 'tagNotHidden',
        '<iframe onload="cliplister()" id="cliplister__PRODUKT_"  frameborder="0"  vspace="0"  hspace="0"  marginwidth="0"  marginheight="0" ' .
        ' scrolling="no" style="Z-INDEX: 999;  visibility:visible; width:_WIDTH_px; height:_HEIGHT_px;"' .
        ' src="_URL_" ></iframe>' );

    function encrypt( $request )
    {
        $iv = 'c1191573-clip-07';
        $td = mcrypt_module_open( "rijndael-128", "", "cbc", $iv );
        mcrypt_generic_init( $td, CUST_KEY, $iv );
        $result = bin2hex( mcrypt_generic( $td, $request ) );
        mcrypt_generic_deinit( $td );
        mcrypt_module_close( $td );

        return "1" . $result;
    }



    function cliplister( $productKey, $prodKeyType = 0, $quality = "320x240",
        $fsk = 16, $lang = "de,##", $refId = "" )
    {
        if ( !isset( $prodKeyType ) )
            $prodKeyType = 0;

        if ( isset( $refId ) )
            $refId = str_replace( '-', '&ndash;', $refId );

        $seqNum = substr( microtime(), 2, 5 );




        $reqString = REQ_BASE_PBTN . encrypt( $seqNum . "-" . time() . "-" .
            str_replace( '-', '&ndash;', $productKey ) . "-" . $prodKeyType .
            "-" . $quality . "-" . $fsk . "-" . $lang . "-" . $refId );


        $html = str_replace( "_URL_", $reqString, tagPbtn );
        $html = str_replace( "_PRODUKT_", $productKey, $html );

        if ( !serverAvailable( $reqString ) )
            $html = "";
        return $html;
    }
    ;



    function cliplisterDivEmbed( $productKey, $prodKeyType = 0, $width = 320,
        $height = 240, $quality = "320x240", $hidden = 0, $indirect = 0, $fsk =
        16, $lang = "de,##", $refId = "", $BannerId = "1" )
    {

        if ( !isset( $prodKeyType ) )
            $prodKeyType = 0;

        if ( isset( $refId ) )
        {
            $refId = str_replace( '-', '&ndash;', $refId );
        }


        $seqNum = substr( microtime(), 2, 5 );


        $reqString = REQ_BASE_EMBD . encrypt( $seqNum . "-" . time() . "-" .
            str_replace( '-', '&ndash;', $productKey ) . "-" . $prodKeyType .
            "-" . $quality . "-" . $fsk . "-" . $lang . "-" . $refId );



        if ( $indirect != 0 )
        {
            $reqString = $reqString . "/ind";
        }

        $reqString = $reqString . "?h=" . $height . "&w=" . $width .
            "&BANNERID=" . $BannerId;
        $html = "<script src=" . $reqString .
            " type='text/javascript'></script>";
        if ( !serverAvailable( $reqString ) )
            $html = "";
        return $html;
    }
    ;


    function cliplisterEmbed( $productKey, $prodKeyType = 0, $width = 320, $height =
        240, $quality = "320x240", $hidden = 0, $indirect = 0, $fsk = 16, $lang =
        "de,##", $refId = "" )
    {

        if ( !isset( $prodKeyType ) )
            $prodKeyType = 0;

        if ( $hidden == 0 )
        {
            $html = tagNotHidden;
        }
        else
        {
            $html = tagHidden;
        }

        if ( isset( $refId ) )
            $refId = str_replace( '-', '&ndash;', $refId );


        $seqNum = substr( microtime(), 2, 5 );
        $reqString = REQ_BASE_EMBD . encrypt( $seqNum . "-" . time() . "-" .
            str_replace( '-', '&ndash;', $productKey ) . "-" . $prodKeyType .
            "-" . $quality . "-" . $fsk . "-" . $lang . "-" . $refId );

        if ( $indirect != 0 )
        {
            $reqString = $reqString . "/ind";
        }
        $html = str_replace( "_URL_", $reqString, $html );
        $html = str_replace( "_WIDTH_", $width, $html );
        $html = str_replace( "_HEIGHT_", $height, $html );
        $html = str_replace( "_PRODUKT_", $productKey, $html );

        if ( !serverAvailable( $reqString ) )
            $html = "";
        return $html;
    }


    function cliplisterCliplistEmbed( $cliplistId, $prodKeyType = 0, $width =
        320, $height = 240, $quality = "320x240", $hidden = 0, $indirect = 0,
        $fsk = 16, $lang = "de,##", $refId = "" )
    {

        if ( !isset( $prodKeyType ) )
            $prodKeyType = 0;

        if ( $hidden == 0 )
        {
            $html = tagNotHidden;
        }
        else
        {
            $html = tagHidden;
        }

        if ( isset( $refId ) )
            $refId = str_replace( '-', '&ndash;', $refId );


        $seqNum = substr( microtime(), 2, 5 );
        $prodKeyType = 100 * 2 + ( int )$prodKeyType;
        $reqString = REQ_BASE_EMBD . encrypt( $seqNum . "-" . time() . "-" .
            $cliplistId . "-" . $prodKeyType . "-" . $quality . "-" . $fsk .
            "-" . $lang . "-" . $refId );

        if ( $indirect != 0 )
        {
            $reqString = $reqString . "/ind";
        }
        ;

        $html = str_replace( "_URL_", $reqString, $html );
        $html = str_replace( "_WIDTH_", $width, $html );
        $html = str_replace( "_HEIGHT_", $height, $html );

        if ( !serverAvailable( $reqString ) )
            $html = "";
        return $html;
    }


    function cliplisterCliplistDivEmbed( $cliplistId, $prodKeyType = 0, $width =
        320, $height = 240, $quality = "320x240", $hidden = 0, $indirect = 0,
        $fsk = 16, $lang = "de,##", $refId = "", $BannerId = "1" )
    {

        if ( !isset( $prodKeyType ) )
            $prodKeyType = 0;

        if ( isset( $refId ) )
        {
            $refId = str_replace( '-', '&ndash;', $refId );
        }

        $seqNum = substr( microtime(), 2, 5 );
        $prodKeyType = 100 * 2 + ( int )$prodKeyType;
        $reqString = REQ_BASE_EMBD . encrypt( $seqNum . "-" . time() . "-" .
            $cliplistId . "-" . $prodKeyType . "-" . $quality . "-" . $fsk .
            "-" . $lang . "-" . $refId );

        if ( $indirect != 0 )
        {
            $reqString = $reqString . "/ind";
        }
        $reqString = $reqString . "?h=" . $height . "&w=" . $width .
            "&BANNERID=" . $BannerId;

        $html = "<script src=" . $reqString .
            " type='text/javascript'></script>";
        if ( !serverAvailable( $reqString ) )
            $html = "";
        return $html;
    }
    ;





    function serverAvailable( $url )
    {
        $url = parse_url( CLSERVER );
        $fp = @fsockopen( $url['host'], 80, $errno, $errstr, 10 );
        if ( !$fp )
        {
            return false;
        }
        else
        {
            return true;
            fclose( $fp );
        }
    }
?>
  <script language="javascript" type="text/javascript">
  // <!--
        function clHandleFrame(iframe)
        {
                if( iframe.id.substr(0,10)=="cliplister" || iframe.id.substr(0,7)=="clipBtn") {
                        var test = new Image();
                        test.onload = function() {
                                if (test.width<2) {
                                        iframe.style.height="0";
                                        iframe.style.width="0";
                                        iframe.style.visibility="hidden";
                                }
                        }
                        var s = iframe.src.replace(/\/ind/g,"");
                        test.src = s.replace(/playBtn/g,"play")+"/cx";
                }
        }

        function cliplister()
        {
                var iframes = document.getElementsByTagName("iframe");
                var i;
                for(i=0;i<iframes.length;i++) {
                        clHandleFrame(iframes[i]);
                }
        }
  // -->
  </script>