File: ms_logs.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,352 bytes parent folder | download | duplicates (2)
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.
 */
if (AJAX) {
    parse_str($protectedPost['ocs']['0'], $params);
    $protectedPost += $params;

    ob_start();
}

require_once('require/function_table_html.php');
require_once('require/function_files.php');
// @TODO : buggy code
$protectedPost['onglet'] == "";
$tab_options = $protectedPost;

$Directory = $_SESSION['OCS']['LOG_DIR'] . "/";
$data = scanDirectory($Directory, "csv");

if (is_array($data)) {
    $form_name = "logs";
    echo open_form($form_name);
    $sql = "";
    $arg = array();
    foreach ($data['name'] as $id => $value) {
        if ($id == 0) {
            $name = 'as name';
            $date_create = 'as date_create';
            $date_modif = 'as date_modif';
            $size = 'as size';
        } else {
            $name = '';
            $date_create = '';
            $date_modif = '';
            $size = '';
        }
        $sql .= "select '%s' " . $name . ",'%s' " . $date_create . ",'%s' " . $date_modif . ",'%s' " . $size . " union ";
        array_push($arg, $value);
        array_push($arg, rtrim($data['date_create'][$id], "."));
        array_push($arg, rtrim($data['date_modif'][$id], "."));
        array_push($arg, round($data['size'][$id] / 1024, 3) . " " . $l->g(516));
    }
    $sql = substr($sql, 0, -6);

    $list_fields = array('name' => 'name',
        $l->g(951) => 'date_create',
        $l->g(952) => 'date_modif',
        $l->g(953) => 'size'
    );
    $list_col_cant_del = $list_fields;
    $default_fields = $list_fields;

    //	$sql= "select '%s' as function,%s from deploy";
    $tab_options['ARG_SQL'] = $arg;
    $tab_options['LBL']['name'] = $l->g(950);
    $tab_options['LIEN_LBL']['name'] = 'index.php?' . PAG_INDEX . '=' . $pages_refs['ms_csv'] . '&no_header=1&log=';
    $tab_options['LIEN_CHAMP']['name'] = 'name';
    $tab_options['LIEN_TYPE']['name'] = 'POPUP';
    $tab_options['POPUP_SIZE']['name'] = "width=900,height=600";
    printEntete($l->g(928));
    $table_name = $form_name;
    $tab_options['form_name'] = $form_name;
    $tab_options['table_name'] = $table_name;
    ajaxtab_entete_fixe($list_fields, $default_fields, $tab_options, $list_col_cant_del);
    echo close_form();
} else {
    msg_warning($l->g(766));
}

if (AJAX) {
    ob_end_clean();
    tab_req($list_fields, $default_fields, $list_col_cant_del, $sql, $tab_options);
}
?>