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

WebOnce

Well-Known Member
May 20, 2004
53
0
156
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.
 

cPanelNick

Administrator
Staff member
Mar 9, 2015
3,481
35
208
cPanel Access Level
DataCenter Provider
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:

Also Here: http://httpupdate.cpanel.net/cpanelsync/EDGE/cpanel/php/README.TXT

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 bei
Code:
ng 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.
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] => [email protected]
                            [login] => [email protected]
                            [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] => [email protected]
                            [login] => [email protected]
                            [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] => [email protected]
                        )

                    [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] => [email protected]
                        )

                    [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
 

WebOnce

Well-Known Member
May 20, 2004
53
0
156
Lansing, MI, USA
Nick,

That was absolutely what I needed. Just had to change it from .php to .livephp and it works great! Thanks :)