Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Auto-inserted footer comment tag in cPanel -- How to remove?

Discussion in 'cPanel Developers' started by WebOnce, May 25, 2008.

  1. WebOnce

    WebOnce Well-Known Member

    Joined:
    May 20, 2004
    Messages:
    53
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    Lansing, MI, USA
    Here's a fun one for you guys,

    So, I'm working on some cPanel enhancements, and part of one is doing a file download.

    The simplest solution is to be able to pipe the download through the php code... something like:

    Code:
        header('content-transfer-encoding: binary');
        header('content-disposition: inline; filename="file.tar.gz"');
        header('content-type: application/x-tar');
        echo file_get_contents($f);
    
    However, I am running into a minor issue:

    at the bottom of every cpanel generated page, cPanel automatically adds:

    Code:
    <!-- cPanel [<<VERSION>>] Copyright (c) 1997-2008 cPanel, Inc. Licensed on <<HOST>> -->
    
    Is there any way to disable/get around this tag being added? I'd prefer to not have to place the download script in /usr/local/apache/htdocs/ just to get around it.

    It seems to be added after the script is finished running, as I don't see any auto_append's set in php's config.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. cPanelNick

    cPanelNick Administrator
    Staff Member

    Joined:
    Mar 9, 2015
    Messages:
    3,480
    Likes Received:
    30
    Trophy Points:
    158
    cPanel Access Level:
    DataCenter Provider
    You can use the livephp cpanel connector. Here are some basic instructions:

    Code:
    Input (must have the .livephp ext and reside in /usr/local/cpanel/base/frontend/*/...):
    <?php
    
    include("/usr/local/cpanel/php/cpanel.php");
    
    
    $cpanel = &new CPANEL();
    print_r  ( $cpanel->exec('<cpanel print="cow">') );
    print_r  ( $cpanel->api1('print','',array('cow')) );
    print_r  ( $cpanel->exec('<cpanel setvar="debug=0">') );
    print_r  ( $cpanel->api('exec',1,'print','',array('cow')) );
    print_r  ( $cpanel->cpanelprint('$homedir') );
    print_r  ( $cpanel->cpanelprint('$hasvalidshell') );
    print_r  ( $cpanel->cpanelprint('$isreseller') );
    print_r  ( $cpanel->cpanelprint('$isresellerlogin') );
    print_r  ( $cpanel->exec('<cpanel Branding="file(local.css)">') );
    print_r  ( $cpanel->exec('<cpanel Branding="image(ftpaccounts)">') );
    print_r  ( $cpanel->api2('Email','listpopswithdisk',array("acct"=>1) ) ) ;
    print_r  ( $cpanel->fetch('$CPDATA{\'DNS\'}') );
    print_r  ( $cpanel->api2('Ftp','listftpwithdisk',array("skip_acct_types"=>'sub') ) ) ;
    
    if ( $cpanel->cpanelif('$haspostgres') ) { print "Postgres is installed\n"; }
    if ( $cpanel->cpanelif('!$haspostgres') ) { print "Postgres is not installed\n"; }
    if ($cpanel->cpanelfeature("fileman")) {
            print "The file manager feature is enabled\n";
    }
    
    $cpanel->end();
    
    ?>
    
    Result:
    
    Array
    (
        [cpanelresult] => Array
            (
                [command] => print
                [type] => internal
                [source] => internal
                [apiversion] => 1
                [data] => Array
                    (
                        [result] => cow
                    )
    
            )
    
    )
    Array
    (
        [cpanelresult] => Array
            (
                [command] => print
                [type] => internal
                [source] => internal
                [apiversion] => 1
                [data] => Array
                    (
                        [result] => cow
                    )
    
            )
    
    )
    Array
    (
        [cpanelresult] => Array
            (
                [command] => setvar
                [type] => internal
                [source] => internal
                [apiversion] => 1
                [data] => Array
                    (
                        [result] =>
                    )
           )
    
    )
    Array
    (
        [cpanelresult] => Array
            (
                [command] => print
                [type] => internal
                [source] => internal
                [apiversion] => 1
                [data] => Array
                    (
                        [result] => cow
                    )
    
            )
    
    )
    /home/nick011Array
    (
        [cpanelresult] => Array
            (
                [module] => Branding
                [func] => file
                [type] => event
                [source] => module
                [apiversion] => 1
                [data] => Array
                    (
                        [result] => /frontend/x3test/branding//local.css
                    )
    
            )
    
    )
    Array
    (
        [cpanelresult] => Array
            (
                [module] => Branding
                [func] => image
                [type] => event
                [source] => module
                [apiversion] => 1
                [data] => Array
                    (
                        [result] => /frontend/x3test/branding//ftpaccounts.jpg
                    )
    
            )
    
    )
    Array
    (
        [cpanelresult] => Array
            (
                [apiversion] => 2
                [data] => Array
                    (
                        [0] => Array
                            (
                                [_diskquota] => 10.00
                                [_diskused] => 0.00
                                [diskquota] => 10.00
                                [diskused] => 0.00
                                [diskusedpercent] => 0
                                [diskusedpercent20] => 0
                                [domain] => pi.nt
                                [email] => bob@pi.nt
                                [login] => bob@pi.nt
                                [txtdiskquota] => 10.00
                                [user] => bob
                            )
    
                        [1] => Array
                            (
                                [_diskquota] => 10.00
                                [_diskused] => 0.00
                                [diskquota] => 10.00
                                [diskused] => 0.00
                                [diskusedpercent] => 0
                                [diskusedpercent20] => 0
                                [domain] => pi.nt
                                [email] => lkl@pi.nt
                                [login] => lkl@pi.nt
                                [txtdiskquota] => 10.00
                                [user] => lkl
                            )
    
                    )
    
                [func] => listpopswithdisk
                [module] => Email
            )
    
    )
    Array
    (
        [cpanelresult] => Array
            (
                [command] => print
                [type] => internal
                [source] => internal
                [apiversion] => 1
                [data] => Array
                    (
                        [result] => pi.nt
                    )
    
            )
    
    )
    Array
    (
        [cpanelresult] => Array
            (
                [apiversion] => 2
                [data] => Array
                    (
                        [0] => Array
                            (
                                [_diskquota] => 4344.00
                                [_diskused] => 0.00
                                [accttype] => anonymous
                                [deleteable] => 0
                                [dir] => /home/nick/public_ftp
                                [diskquota] => 4344.00
                                [diskused] => 0.00
                                [diskusedpercent] => 0
                                [diskusedpercent20] => 0
                                [htmldir] =>
                                [login] => anonymous
                                [reldir] => public_ftp
                                [serverlogin] => anonymous@pi.nt
                            )
    
                        [1] => Array
                            (
                                [_diskquota] => 4344.00
                                [_diskused] => 0.00
                                [accttype] => anonymous
                                [deleteable] => 0
                                [dir] => /home/nick/public_ftp
                                [diskquota] => 4344.00
                                [diskused] => 0.00
                                [diskusedpercent] => 0
                                [diskusedpercent20] => 0
                                [htmldir] =>
                                [login] => ftp
                                [reldir] => public_ftp
                                [serverlogin] => ftp@pi.nt
                            )
    
                        [2] => Array
                            (
                                [_diskquota] => 0.00
                                [_diskused] => 0.00
                                [accttype] => main
                                [deleteable] => 1
                                [dir] => /home/nick
                                [diskquota] => unlimited
                                [diskused] => 0.00
                                [diskusedpercent] => 0
                                [diskusedpercent20] => 0
                                [htmldir] =>
                                [login] => nick
                                [reldir] =>
                                [serverlogin] => nick
                            )
    
                        [3] => Array
                            (
                                [_diskquota] => 0.00
                                [_diskused] => 0.00
                                [accttype] => logaccess
                                [deleteable] => 1
                                [dir] => /usr/local/apache/domlogs
                                [diskquota] => unlimited
                                [diskused] => 0.00
                                [diskusedpercent] => 0
                                [diskusedpercent20] => 0
                                [htmldir] =>
                                [login] => nick_logs
                                [reldir] => usr/local/apache/domlogs
                                [serverlogin] => nick_logs
                            )
    
                    )
    
                [func] => listftpwithdisk
                [module] => Ftp
            )
    
    )
    Postgres is installed
    The file manager feature is enabled
    
    
     
  3. WebOnce

    WebOnce Well-Known Member

    Joined:
    May 20, 2004
    Messages:
    53
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    Lansing, MI, USA
    Nick,

    That was absolutely what I needed. Just had to change it from .php to .livephp and it works great! Thanks :)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice