noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
Functions
config_file.php File Reference

functions concerning the config file config.inc.php. The domain is not set into the form for security issues More...

Go to the source code of this file.

Functions

 config_file_create ($p_array, $from_setup=1, $p_os=1)
 create the config file
 config_file_form ($p_array=null)
 is_unix ()

Detailed Description

functions concerning the config file config.inc.php. The domain is not set into the form for security issues

Definition in file config_file.php.


Function Documentation

config_file_create ( p_array,
from_setup = 1,
p_os = 1 
)

create the config file

Definition at line 103 of file config_file.php.

References $p_array.

{
    extract ($p_array);
    $add=($from_setup==1)?'..'.DIRECTORY_SEPARATOR:'';
    $hFile=  fopen($add.'..'.DIRECTORY_SEPARATOR.'include'.DIRECTORY_SEPARATOR.'config.inc.php','w');
    fputs($hFile,'<?php ');
    fputs($hFile,"\r\n");
    fputs($hFile, 'date_default_timezone_set (\'Europe/Brussels\');');
    fputs($hFile,"\r\n");
    fputs($hFile, "\$_ENV['TMP']='".$ctmp."';");
    fputs($hFile,"\r\n");
    fputs($hFile, 'define("PG_PATH","'.$cpath.'");');
    fputs($hFile,"\r\n");
    if ( $p_os == 1 )
    {
        fputs($hFile, 'define("PG_RESTORE","'.$cpath.DIRECTORY_SEPARATOR.'pg_restore ");');
        fputs($hFile,"\r\n");
        fputs($hFile, 'define("PG_DUMP","'.$cpath.DIRECTORY_SEPARATOR.'pg_dump ");');
        fputs($hFile,"\r\n");
        fputs($hFile, 'define ("PSQL","'.$cpath.DIRECTORY_SEPARATOR.'psql");');
    }
    else
    {
        fputs($hFile, 'define("PG_RESTORE","pg_restore.exe");');
        fputs($hFile,"\r\n");
        fputs($hFile, 'define("PG_DUMP","pg_dump.exe");');
        fputs($hFile,"\r\n");
        fputs($hFile, 'define ("PSQL","psql.exe");');
    }
    fputs($hFile,"\r\n");
    fputs($hFile, 'define ("noalyss_user","'.$cuser.'");');
    fputs($hFile,"\r\n");
    fputs($hFile, 'define ("noalyss_password","'.$cpasswd.'");');
    fputs($hFile,"\r\n");
    fputs($hFile, 'define ("noalyss_psql_port","'.$cport.'");');
    fputs($hFile,"\r\n");
    fputs($hFile, 'define ("noalyss_psql_host","127.0.0.1");');
    fputs($hFile,"\r\n");

    fputs($hFile, 'define ("LOCALE",'.$clocale.');');
    fputs($hFile,"\r\n");

    fputs($hFile, 'define ("domaine","");');
    fputs($hFile,"\r\n");
    if (isset ($multi)) fputs($hFile, 'define ("MULTI",0);');
    if (! isset ($multi))       fputs($hFile, 'define ("MULTI",1);');
        fputs($hFile,"\r\n");
    fputs($hFile, 'define ("dbname","'.$cdbname.'");');
    fputs($hFile,"\r\n");

    fputs($hFile,'?>');
    fclose($hFile);
}
config_file_form ( p_array = null)
Parameters:
arraywith the index
  • ctmp temporary folder
  • cpath path to postgresql
  • cuser postgresql user
  • cpasswd password of cuser
  • cport port for postgres
Returns:
string with html code

Definition at line 55 of file config_file.php.

References $os, $p_array, and is_unix().

{
        $os=is_unix();
    if ( $p_array == null )
    {

        /* default value */
        $ctmp=($os==1)?'/tmp':'c:/tmp';
        $cpath=($os==1)?'/usr/bin':'c:/noalyss/postgresql/bin';
        $cuser='noalyss_sql';
        $cpasswd='dany';
        $cport=5432;
        $cdomain='';
        $clocale=1;
                $multi=1;
                $cdbname="database_noalyss";

    }
    else extract ($p_array);

    $ictmp=new IText('ctmp',$ctmp);
    $ictmp->size=25;

    $iclocale=new ISelect('clocale');
        $iclocale->value=array(
                array("value"=>1,"label"=>"Activé"),
                array("value"=>0,"label"=>"Désactivé")
        );
        $iclocale->selected=1;

        $icpath=new IText("cpath",$cpath);
        $icpath->size=30;

        $icuser=new IText('cuser',$cuser);
        $icpasswd=new IText('cpasswd',$cpasswd);
        $icport=new IText("cport",$cport);
        /*
         * For version MONO
         */
        $smulti=new ICheckBox('multi');
        $smulti->javascript=' onchange="show_dbname(this)" ';

        $icdbname=new IText('cdbname');

        require 'template_config_form.php';
}
is_unix ( )

Definition at line 30 of file config_file.php.

References $inc_path, and $os.

Referenced by config_file_form().

{
    $inc_path=get_include_path();

    if ( strpos($inc_path,";") != 0 )
    {
        $os=0;                  /* $os is 0 for windoz */
    }
    else
    {
        $os=1;                  /* $os is 1 for unix */
    }
    return $os;
}
 All Data Structures Namespaces Files Functions Variables Enumerations