File: fichierConf.class.php

package info (click to toggle)
ocsinventory-server 2.5%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 7,088 kB
  • sloc: php: 27,462; perl: 8,241; sh: 1,680; sql: 1,355; xml: 1,041; makefile: 34
file content (93 lines) | stat: -rwxr-xr-x 3,632 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
/*
 * Copyright 2005-2016 OCSInventory-NG/OCSInventory-ocsreports contributors.
 * See the Contributors file for more details about them.
 *
 * This file is part of OCSInventory-NG/OCSInventory-ocsreports.
 *
 * OCSInventory-NG/OCSInventory-ocsreports is free software: you can redistribute
 * it and/or modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, either version 2 of the License,
 * or (at your option) any later version.
 *
 * OCSInventory-NG/OCSInventory-ocsreports is distributed in the hope that it
 * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with OCSInventory-NG/OCSInventory-ocsreports. if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 */
$tab_dont_see = array(527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545);

class language {
    protected $tableauMots;    // tableau contenant tous les mots du fichier
    protected $plug_language;

    function __construct($language, $plugin = '') { // constructeur
        if ($plugin != '') {
            require_once('require/function_files.php');
            $rep_list = scanDirectory(MAIN_SECTIONS_DIR);
            foreach ($rep_list as $key) {
                if (file_exists(MAIN_SECTIONS_DIR . $key . '/language/' . $language . ".txt")) {
                    $file = fopen(MAIN_SECTIONS_DIR . $key . '/language/' . $language . ".txt", "r");
                    while (!feof($file)) {
                        $val = fgets($file, 1024);
                        $tok1 = rtrim(strtok($val, " "));
                        $tok2 = rtrim(strtok(""));
                        $this->plug_language[$tok1] = $tok2;
                    }
                    fclose($file);
                    echo MAIN_SECTIONS_DIR . $key . '/language/' . $language . ".txt<br>";
                }
            }
        }

        $language_file = PLUGINS_DIR . "language/" . $language . "/" . $language . ".txt";
        if (file_exists($language_file)) {
            $file = fopen($language_file, "r");
            if ($file) {
                while (!feof($file)) {
                    $val = fgets($file, 1024);
                    $tok1 = rtrim(strtok($val, " "));
                    $tok2 = rtrim(strtok(""));
                    $this->tableauMots[$tok1] = $tok2;
                }
                fclose($file);
            }
        }
    }

    function g($i) {
        global $tab_dont_see;
        //If word doesn't exist for language, return default english word
        if ($this->tableauMots[$i] == null) {
            $defword = new language('en_GB');
            $word = $defword->tableauMots[$i];
        } else {
            $word = $this->tableauMots[$i];
        }
        //language mode
        if ($_SESSION['OCS']['MODE_LANGUAGE'] == "ON") {
            if (!in_array($i, $tab_dont_see)) {
                $_SESSION['OCS']['EDIT_LANGUAGE'][$i] = $word;
            }
            $word .= "{" . $i . "}";
        }
        return stripslashes($word);
    }

    function g_plug($i) {
        if ($this->plug_language[$i] == null) {
            $defword = new language('en_GB', 'plugin');
            $word = $defword->plug_language[$i];
        } else {
            $word = $this->plug_language[$i];
        }
        return stripslashes($word);
    }

}
?>