For script contributing, basic headers? Few general Q's [Pls move to /dev, sry]



  • EDIT: Sorry wrong thread! Can someone move me to Development area? Thanks/sorry .. didn't realize there was a section~

    Hi,

    I'm pretty new to php until I started working with PFS. I find myself pretty good at editing, but as for making new files .. not so much:

    #!/usr/local/bin/php -f
    
    1. Is this above code required for all php files within PFS?
    require("config.inc");
    
    1. If I put this up top, this means I can use code from config.inc, right? Like imports from .NET?

    2. I noticed that files are "included" very generally – like 'xx.inc' rather than '/etc/xx/xx.inc' .. does this mean there's a file I need to edit to include any new files for easy importing such as this?

    3. Finally, can any of these files be called from captive portal files? Can a captiveportal-customupload.php call , say, config.inc?

    I think after these Q's are answered, I can get started.

    Thanks~



  • @dylanh724:

    EDIT: Sorry wrong thread! Can someone move me to Development area? Thanks/sorry .. didn't realize there was a section~

    Hi,

    I'm pretty new to php until I started working with PFS. I find myself pretty good at editing, but as for making new files .. not so much:

    #!/usr/local/bin/php -f
    
    1. Is this above code required for all php files within PFS?

    This means you can call the file in shell if you give it +x.

    require("config.inc");
    
    1. If I put this up top, this means I can use code from config.inc, right? Like imports from .NET?

    YES you can call functions on that file.

    1. I noticed that files are "included" very generally – like 'xx.inc' rather than '/etc/xx/xx.inc' .. does this mean there's a file I need to edit to include any new files for easy importing such as this?

    pfSene uses PHP and exploits as much as possible its configuration settings.
    The short way is used since a include path is setup for php where to find things.

    1. Finally, can any of these files be called from captive portal files? Can a captiveportal-customupload.php call , say, config.inc?

    Surely there is nothing preventing that since even the existing page does that.


Log in to reply