Subversion Repositories Applications.projet

Rev

Rev 11 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 11 Rev 431
1
<?php
1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
3
// +------------------------------------------------------------------------------------------------------+
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
7
// +------------------------------------------------------------------------------------------------------+
8
// | This library is free software; you can redistribute it and/or                                        |
8
// | This library is free software; you can redistribute it and/or                                        |
9
// | modify it under the terms of the GNU General Public                                                  |
9
// | modify it under the terms of the GNU General Public                                                  |
10
// | License as published by the Free Software Foundation; either                                         |
10
// | License as published by the Free Software Foundation; either                                         |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
12
// |                                                                                                      |
12
// |                                                                                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
16
// | General Public License for more details.                                                             |
16
// | General Public License for more details.                                                             |
17
// |                                                                                                      |
17
// |                                                                                                      |
18
// | You should have received a copy of the GNU General Public                                            |
18
// | You should have received a copy of the GNU General Public                                            |
19
// | License along with this library; if not, write to the Free Software                                  |
19
// | License along with this library; if not, write to the Free Software                                  |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
21
// +------------------------------------------------------------------------------------------------------+
22
// CVS : $Id: commande_serveur.class.php,v 1.2 2005-09-27 16:37:40 alexandre_tb Exp $
22
// CVS : $Id: commande_serveur.class.php,v 1.2 2005/09/27 16:37:40 alexandre_tb Exp $
23
/**
23
/**
24
* Application projet
24
* Application projet
25
*
25
*
26
* La classe commande_serveur
26
* La classe commande_serveur
27
*
27
*
28
*@package projet
28
*@package projet
29
//Auteur original :
29
//Auteur original :
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
31
//Autres auteurs :
31
//Autres auteurs :
32
*@author        Aucun
32
*@author        Aucun
33
*@copyright     Tela-Botanica 2000-2004
33
*@copyright     Tela-Botanica 2000-2004
34
*@version       $Revision: 1.2 $
34
*@version       $Revision: 1.2 $
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
36
*/
36
*/
37
 
37
 
38
 
38
 
39
// +------------------------------------------------------------------------------------------------------+
39
// +------------------------------------------------------------------------------------------------------+
40
// |                                            ENTETE du PROGRAMME                                       |
40
// |                                            ENTETE du PROGRAMME                                       |
41
// +------------------------------------------------------------------------------------------------------+
41
// +------------------------------------------------------------------------------------------------------+
42
 
42
 
43
 
43
 
44
/**
44
/**
45
 * class commande_serveur
45
 * class commande_serveur
46
 * Cette classe permet d'accéder au fichier ezmlm.sh afin de lui ajouter des
46
 * Cette classe permet d'accéder au fichier ezmlm.sh afin de lui ajouter des
47
 * commandes qui seront effectués périodiquement par le serveur.
47
 * commandes qui seront effectués périodiquement par le serveur.
48
 */
48
 */
49
class commande_serveur
49
class commande_serveur
50
{
50
{
51
 
51
 
52
     /*** Attributes: ***/
52
     /*** Attributes: ***/
53
 
53
 
54
    /**
54
    /**
55
     * Pointeur vers le fichier des commandes
55
     * Pointeur vers le fichier des commandes
56
     * @access private
56
     * @access private
57
     */
57
     */
58
    var $_fichier;
58
    var $_fichier;
59
 
59
 
60
    /**
60
    /**
61
     * 
61
     * 
62
     *
62
     *
63
     * @return void
63
     * @return void
64
     * @access public
64
     * @access public
65
     */
65
     */
66
    function commande_serveur($fichier)
66
    function commande_serveur($fichier)
67
    {
67
    {
68
        $this->_fichier = fopen ($fichier,'a+') ;
68
        $this->_fichier = fopen ($fichier,'a+') ;
69
        if (!$this->_fichier) {
69
        if (!$this->_fichier) {
70
            return 'Impossible d\'ouvrir le fichier de commande' ;
70
            return 'Impossible d\'ouvrir le fichier de commande' ;
71
        }
71
        }
72
    } // end of member function commande_serveur
72
    } // end of member function commande_serveur
73
 
73
 
74
    /**
74
    /**
75
     * 
75
     * 
76
     *
76
     *
77
     * @param string commande La commande, une chaine à ajouter à la fin du fichier ezmlm.sh
77
     * @param string commande La commande, une chaine à ajouter à la fin du fichier ezmlm.sh
78
     * @return bool
78
     * @return bool
79
     * @access public
79
     * @access public
80
     */
80
     */
81
    function ajouterCommande( $commande )
81
    function ajouterCommande( $commande )
82
    {
82
    {
83
        fwrite ($this->_fichier, "\n".$commande) ;
83
        fwrite ($this->_fichier, "\n".$commande) ;
84
    } // end of member function ajouterCommande
84
    } // end of member function ajouterCommande
85
    
85
    
86
    /**
86
    /**
87
     *  Destructeur
87
     *  Destructeur
88
     *
88
     *
89
     * @return void
89
     * @return void
90
     * @access public
90
     * @access public
91
     */
91
     */
92
    function _commande_serveur($fichier)
92
    function _commande_serveur($fichier)
93
    {
93
    {
94
        fclose ($this->_fichier) ;
94
        fclose ($this->_fichier) ;
95
    } // end of member function commande_serveur
95
    } // end of member function commande_serveur
96
 
96
 
97
    /**
97
    /**
98
     *
98
     *
99
     *
99
     *
100
     * @return
100
     * @return
101
     */
101
     */
102
    
102
    
103
    function enleverToutesCommandes () {
103
    function enleverToutesCommandes () {
104
        ftruncate ($this->_fichier, 12) ;
104
        ftruncate ($this->_fichier, 12) ;
105
    }
105
    }
106
} // end of commande_serveur
106
} // end of commande_serveur
107
?>
107
?>