Location: PHPKode > projects > PHD Help Desk > phd_2_00/setup/eng/make_checks.inc
<?PHP
/*
    Name: make_checks.inc
    Author: Julio Tuozzo
    Function: Install controls.
    Ver: 2.00
*/



## 1. Verify that are available the MySQL and GD functions.

if (!function_exists('mysql_connect'))
    { echo "<p class='danger'>ERROR - Do not available the access functions to the MySQL data base from PHP.<br/>
            Verify your server instalation.</p>
            <p class = 'danger'> <b>PHD Help Desk</b> configuration procces suspended, solve the problem and continue. </p> ";
      exit();
    }

if (!function_exists('gd_info'))
    { echo "<p class='danger'>ERROR - Do not available the graphics library GD.<br/>
            Verify your server instalation.</p>
            <p class = 'danger'> <b>PHD Help Desk</b> configuration procces suspended, solve the problem and continue. </p> ";
      exit();
    }



## 2. Verify that include_path note to where are phd.inc y lang.inc

$path_phd_inc=$path_lang="";
$a_include = explode( PATH_SEPARATOR, ini_get('include_path') );
$a_long=count($a_include);

for ($I=0; $I<$a_long; $I++)
    {$f_path=str_replace("\\","/",$a_include[$I]);
     if (substr($f_path,-1)!='/')
        {$f_path.='/';
        }
     if (is_readable($f_path."phd.inc"))
        {if (strlen($path_phd_inc)>0)
                {echo "<p class='danger'><b>ERROR - THERE ARE AT LEAST TWO FILES <i>phd.inc</i></p>
                 <p class='ok'>One is place in <i>$path_phd_inc</i> and other in <i>$f_path</i>.<br />
                 Make sure that are only one accesible in the variable <i>include_path</i> of the file
                 phd.inc that are inicialy in <i>/phd_2_00/include/.</i></p>
                 <p class = 'danger'> <b>PHD Help Desk</b> configuration procces suspended, solve the problem and continue. </p>  ";
                 exit();
                }
           else
              {$path_phd_inc=$f_path;
              }
        }
     if (is_readable($f_path."lang.inc"))
        { if (strlen($path_lang)>0)
                {echo "<p class='danger'><b>ERROR - THERE ARE AT LEAST TWO FILES <i>lang.inc</i></p>
                 <p class='ok'>One is place in <i>$path_lang</i> and other in <i>$f_path</i>.<br />
                 Make sure that are only one accesible in the variable <i>include_path</i> of the file
                 lang.inc that are inicialy in <i>/phd_2_00/include/.</i></p>
                 <p class = 'danger'> <b>PHD Help Desk</b> configuration procces suspended, solve the problem and continue. </p>  ";
                 exit();
                }
           else
              {$path_lang=$f_path;
              }
        }
    }

if (strlen($path_phd_inc)<1)
    { $incl_path=str_replace(PATH_SEPARATOR,PATH_SEPARATOR." ",ini_get('include_path'));
      echo "
     <p class = 'danger'> Error: there not access to the file <b>phd.inc</b> </p>
     <p>The content of the variable <i>\"include_path\"</i> in <i>php.ini</i> is <b>$incl_path</b>,
     inside this directories there isn't <b>phd.inc</b>. </p>
    <p>Verify that exists the file phd.inc, inicialy it's in the folder <b>/phd_2_00/include/</b></p>
    <p>Put in <i>\"include_path\"</i> the path were are the <b>.inc</b> files of <b>PHD Help Desk</b> or move the <b>.inc</b> files thats are in the folder <b>/phd_2_00/include/</b> to some of the subdirectories specified in <i>\"include_path\"</i>.</p>
     <p class = 'danger'> <b>PHD Help Desk</b> configuration procces suspended, solve the problem and continue. </p>    ";
    exit();
    }

if (strlen($path_lang)<1)
    { $incl_path=str_replace(PATH_SEPARATOR,PATH_SEPARATOR." ",ini_get('include_path'));
      echo "
     <p class = 'danger'> Error: there not access to the file <b>lang.inc</b> </p>
     <p>The content of the variable <i>\"include_path\"</i> in <i>php.ini</i> is <b>$incl_path</b>,
     inside this directories there isn't <b>lang.inc</b>. </p>
    <p>Verify that exists the file lang.inc, inicialy it's in the folder <b>/phd_2_00/include/</b></p>
    <p>Put in <i>\"include_path\"</i> the path were are the <b>.inc</b> files of <b>PHD Help Desk</b> or move the <b>.inc</b> files thats are in the folder <b>/phd_2_00/include/</b> to some of the subdirectories specified in <i>\"include_path\"</i>.</p>
     <p class = 'danger'> <b>PHD Help Desk</b> configuration procces suspended, solve the problem and continue. </p>


    ";
    exit();
    }

require('lang.inc');
require('phd.inc');

## 3. Verify that the files phd.inc and lang.inc corresponding to ver. 2.00

if ($VPHD!="2.00")
    {echo "<p class='danger'> Error: the file $path_phd_inc phd.inc do not corresponding to the ver. 2.00 of <b>PHD Help Desk</b></p>
    <p> May be you have other instalation of <b>PHD Help Desk</b> in your server and the variable <i>include_path</i> of file <i>php.ini</i> is configure to this directory.</p>
     <p class = 'danger'> <b>PHD Help Desk</b> configuration procces suspended, solve the problem and continue. </p>";

    exit();
    }

if ($Vlang!="2.00")
    {echo "<p class='danger'> Error: the file $path_lang lang.inc do not corresponding to the ver. 2.00 of <b>PHD Help Desk</b></p>
    <p> May be you have other instalation of <b>PHD Help Desk</b> in your server and the variable <i>include_path</i> of file <i>php.ini</i> is configure to this directory.</p>
       <p class = 'danger'> <b>PHD Help Desk</b> configuration procces suspended, solve the problem and continue. </p>";
    exit();
    }

## 4. Verify that the language is configured

    if (!isset($Contact) or !isset($Process) or !isset($State) or !isset($Type))
        { $c_lang='now';
          $c_base_dato=$c_param=$c_create=$c_mail=$c_admin=$c_atrib='danger';
        }
    else
        {$c_lang='ok';

## 5. Verify the data base access parameters.
         if(!@mysql_connect($Host,$Usuario,$Contrasena) or !@mysql_select_db($Base))
            {$c_base_dato='now';
             $c_param=$c_create=$c_mail=$c_admin=$c_atrib='danger';
            }
         else
            { $c_base_dato='ok';


## 6. Verify that the tables are created.
              $tablas="(area)(atributo)(ticket)(hist_pass)(operador)(parametros)(sector)(sigo_ticket)(solicitud)(usuario)";
              $query="SHOW TABLES";
              $result=mysql_query($query) or die ("<p class='danger'> QUERY ERROR </p>".mysql_error());
              while ($row = mysql_fetch_array($result))
                    {$tablas=str_replace("(".$row[0].")","",$tablas);
                    }
              if (strlen($tablas)>1)
                    {$c_create='now';
                     $c_param=$c_mail=$c_admin=$c_atrib='danger';
                    }
              else
                    {$c_create='ok';


## 7. Verify the e-mail server access parameters.

              if ($Mail_host == 'your.mail.server.com' or $Mail_usuario == 'hide@address.com')
                    {$c_mail='now';
                     $c_param=$c_admin=$c_atrib='danger';
                    }
              else
                    {$c_mail='ok';



## 8. Verify that there are an administrator operator.
                     $query="SELECT * FROM operador WHERE nivel>=20";
                     $result=mysql_query($query) or die ("<p class='danger'> QUERY ERROR </p>".mysql_error());
                     $q_admin=mysql_num_rows($result);

                     if ($q_admin<1)
                        {$c_admin='now';
                         $c_param=$c_atrib='danger';
                        }
                     else
                        {$c_admin='ok';

## 9. Verifico que se hayan ingresado atributos.

                         if ($PHD_Ins=="NO")
                            {$c_atrib='now';
                             $c_param='danger';
                            }
                         else
                            {$c_atrib='ok';
## 10. Verifiy that are configured the general parameters.
                             $query="SELECT * FROM parametros";
                             $result=mysql_query($query) or die ("<p class='danger'> QUERY ERROR </p>".mysql_error());
                             $q_param=mysql_num_rows($result);

                             if($q_param<1)
                                {$c_param='now';
                                }
                             else
                                {$c_param='ok';


                                }
                            }
                        }
                    }
                }
            }
        }



?>
Return current item: PHD Help Desk