Ganteng Doang Upload Shell Gak Bisa


Linux server.jmdstrack.com 3.10.0-1160.119.1.el7.tuxcare.els10.x86_64 #1 SMP Fri Oct 11 21:40:41 UTC 2024 x86_64
/ home/ jmdstrac/ public_html/ devices/ src/

/home/jmdstrac/public_html/devices/src/RuleDictionnaryPrinterCollection.php

<?php

/**
 * ---------------------------------------------------------------------
 *
 * GLPI - Gestionnaire Libre de Parc Informatique
 *
 * http://glpi-project.org
 *
 * @copyright 2015-2023 Teclib' and contributors.
 * @copyright 2003-2014 by the INDEPNET Development Team.
 * @licence   https://www.gnu.org/licenses/gpl-3.0.html
 *
 * ---------------------------------------------------------------------
 *
 * LICENSE
 *
 * This file is part of GLPI.
 *
 * This program 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 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 this program.  If not, see <https://www.gnu.org/licenses/>.
 *
 * ---------------------------------------------------------------------
 */

class RuleDictionnaryPrinterCollection extends RuleCollection
{
   // From RuleCollection

    public $stop_on_first_match = true;
    public $can_replay_rules    = true;
    public $menu_type           = 'dictionnary';
    public $menu_option         = 'printer';

    public static $rightname           = 'rule_dictionnary_printer';

    /**
     * @see RuleCollection::getTitle()
     **/
    public function getTitle()
    {
        return __('Dictionnary of printers');
    }


    /**
     * @see RuleCollection::cleanTestOutputCriterias()
     **/
    public function cleanTestOutputCriterias(array $output)
    {

       //If output array contains keys begining with _ : drop it
        foreach ($output as $criteria => $value) {
            if (($criteria[0] == '_') && ($criteria != '_ignore_import')) {
                unset($output[$criteria]);
            }
        }
        return $output;
    }


    public function replayRulesOnExistingDB($offset = 0, $maxtime = 0, $items = [], $params = [])
    {
        global $DB;

        if (isCommandLine()) {
            printf(__('Replay rules on existing database started on %s') . "\n", date("r"));
        }
        $nb = 0;
        $i  = $offset;

       //Select all the differents software
        $criteria = [
            'SELECT' => [
                'glpi_printers.name',
                'glpi_manufacturers.name AS manufacturer',
                'glpi_printers.manufacturers_id AS manufacturers_id',
                'glpi_printers.comment AS comment'
            ],
            'DISTINCT'  => true,
            'FROM'      => 'glpi_printers',
            'LEFT JOIN' => [
                'glpi_manufacturers' => [
                    'ON'  => [
                        'glpi_manufacturers' => 'id',
                        'glpi_printers'      => 'manufacturers_id'
                    ]
                ]
            ],
            'WHERE'     => [
            // Do not replay on trashbin and templates
                'glpi_printers.is_deleted'    => 0,
                'glpi_printers.is_template'   => 0
            ]
        ];

        if ($offset) {
            $criteria['START'] = (int)$offset;
            $criteria['LIMIT'] = 999999999;
        }

        $iterator = $DB->request($criteria);
        $nb   = count($iterator) + $offset;
        $step = (($nb > 1000) ? 50 : (($nb > 20) ? floor(count($iterator) / 20) : 1));

        foreach ($iterator as $input) {
            if (!($i % $step)) {
                if (isCommandLine()) {
                    //TRANS: %1$s is a date, %2$s is a row, %3$s is total row, %4$s is memory
                    printf(
                        __('%1$s - replay rules on existing database: %2$s/%3$s (%4$s Mio)') . "\n",
                        date("H:i:s"),
                        $i,
                        $nb,
                        round(memory_get_usage() / (1024 * 1024), 2)
                    );
                } else {
                    Html::changeProgressBarPosition($i, $nb, "$i / $nb");
                }
            }

           //Replay printer dictionnary rules
            $res_rule = $this->processAllRules($input, [], []);

            foreach (['manufacturer', 'is_global', 'name'] as $attr) {
                if (isset($res_rule[$attr]) && ($res_rule[$attr] == '')) {
                    unset($res_rule[$attr]);
                }
            }

           //If the software's name or version has changed
            if (self::somethingHasChanged($res_rule, $input)) {
                $IDs = [];
               //Find all the printers in the database with the same name and manufacturer
                $print_iterator = $DB->request([
                    'SELECT' => 'id',
                    'FROM'   => 'glpi_printers',
                    'WHERE'  => [
                        'name'               => $input['name'],
                        'manufacturers_id'   => $input['manufacturers_id']
                    ]
                ]);

                if (count($print_iterator)) {
                     //Store all the printer's IDs in an array
                    foreach ($print_iterator as $result) {
                        $IDs[] = $result["id"];
                    }
                     //Replay dictionnary on all the printers
                     $this->replayDictionnaryOnPrintersByID($IDs, $res_rule);
                }
            }
            $i++;

            if ($maxtime) {
                $crt = explode(" ", microtime());
                if ($crt[0] + $crt[1] > $maxtime) {
                    break;
                }
            }
        }

        if (isCommandLine()) {
            printf(__('Replay rules on existing database: %1$s/%2$s') . "\n", $i, $nb);
        } else {
            Html::changeProgressBarPosition($i, $nb, "$i / $nb");
        }

        if (isCommandLine()) {
            printf(__('Replay rules on existing database ended on %s') . "\n", date("r"));
        }

        return (($i == $nb) ? -1 : $i);
    }


    /**
     * @param $res_rule  array
     * @param $input     array
     **/
    public static function somethingHasChanged(array $res_rule, array $input)
    {

        if (
            (isset($res_rule["name"]) && ($res_rule["name"] != $input["name"]))
            || (isset($res_rule["manufacturer"]) && ($res_rule["manufacturer"] != ''))
            || (isset($res_rule['is_global']) && ($res_rule['is_global'] != ''))
        ) {
            return true;
        }
        return false;
    }


    /**
     * Replay dictionnary on several printers
     *
     * @param $IDs       array of printers IDs to replay
     * @param $res_rule  array of rule results
     *
     * @return void
     **/
    public function replayDictionnaryOnPrintersByID(array $IDs, $res_rule = [])
    {
        global $DB;

        $new_printers  = [];
        $delete_ids    = [];

        $iterator = $DB->request([
            'SELECT'    => [
                'glpi_printers.id',
                'glpi_printers.name',
                'glpi_printers.entities_id AS entities_id',
                'glpi_printers.is_global AS is_global',
                'glpi_manufacturers.name AS manufacturer'
            ],
            'FROM'      => 'glpi_printers',
            'LEFT JOIN' => [
                'glpi_manufacturers'  => [
                    'FKEY'   => [
                        'glpi_printers'      => 'manufacturers_id',
                        'glpi_manufacturers' => 'id'
                    ]
                ]
            ],
            'WHERE'     => [
                'glpi_printers.is_template'   => 0,
                'glpi_printers.id'            => $IDs
            ]
        ]);

        foreach ($iterator as $printer) {
            //For each printer
            $this->replayDictionnaryOnOnePrinter($new_printers, $res_rule, $printer, $delete_ids);
        }

       //Delete printer if needed
        $this->putOldPrintersInTrash($delete_ids);
    }


    /**
     * @param $IDS array
     */
    public function putOldPrintersInTrash($IDS = [])
    {

        $printer = new Printer();
        foreach ($IDS as $id) {
            $printer->delete(['id' => $id]);
        }
    }


    /**
     * Replay dictionnary on one printer
     *
     * @param &$new_printers   array containing new printers already computed
     * @param $res_rule        array of rule results
     * @param $params          array
     * @param &$printers_ids   array containing replay printer need to be put in trashbin
     **/
    public function replayDictionnaryOnOnePrinter(
        array &$new_printers,
        array $res_rule,
        array $params,
        array &$printers_ids
    ) {
        $p['id']           = 0;
        $p['name']         = '';
        $p['manufacturer'] = '';
        $p['is_global']    = '';
        $p['entity']       = 0;
        foreach ($params as $key => $value) {
            $p[$key] = $value;
        }

        $input["name"]         = $p['name'];
        $input["manufacturer"] = $p['manufacturer'];

        if (empty($res_rule)) {
            $res_rule = $this->processAllRules($input, [], []);
        }

        $printer = new Printer();

       //Printer's name has changed
        if (
            isset($res_rule["name"])
            && ($res_rule["name"] != $p['name'])
        ) {
            $manufacturer = "";

            if (isset($res_rule["manufacturer"])) {
                $manufacturer = addslashes(Dropdown::getDropdownName(
                    "glpi_manufacturers",
                    $res_rule["manufacturer"]
                ));
            } else {
                $manufacturer = addslashes($p['manufacturer']);
            }

           //New printer not already present in this entity
            if (!isset($new_printers[$p['entity']][$res_rule["name"]])) {
               // create new printer or restore it from trashbin
                $new_printer_id = $printer->addOrRestoreFromTrash(
                    $res_rule["name"],
                    $manufacturer,
                    $p['entity']
                );
                $new_printers[$p['entity']][$res_rule["name"]] = $new_printer_id;
            } else {
                $new_printer_id = $new_printers[$p['entity']][$res_rule["name"]];
            }

           // Move direct connections
            $this->moveDirectConnections($p['id'], $new_printer_id);
        } else {
            $new_printer_id  = $p['id'];
            $res_rule["id"]  = $p['id'];

            if (isset($res_rule["manufacturer"])) {
                if ($res_rule["manufacturer"] != '') {
                    $res_rule["manufacturers_id"] = $res_rule["manufacturer"];
                }
                unset($res_rule["manufacturer"]);
            }
            $printer->update($res_rule);
        }

       // Add to printer to deleted list
        if ($new_printer_id != $p['id']) {
            $printers_ids[] = $p['id'];
        }
    }


    /**
     * Move direct connections from old printer to the new one
     *
     * @param $ID                 the old printer's id
     * @param $new_printers_id    the new printer's id
     *
     * @return void
     **/
    public function moveDirectConnections($ID, $new_printers_id)
    {
        $computeritem = new Computer_Item();
       //For each direct connection of this printer
        $connections = getAllDataFromTable(
            'glpi_computers_items',
            [
                'itemtype'  => 'Printer',
                'items_id'  => $ID
            ]
        );
        foreach ($connections as $connection) {
            //Direct connection exists in the target printer ?
            if (
                !countElementsInTable(
                    "glpi_computers_items",
                    ['itemtype'     => 'Printer',
                        'items_id'     => $new_printers_id,
                        'computers_id' => $connection["computers_id"]
                    ]
                )
            ) {
               //Direct connection doesn't exists in the target printer : move it
                $computeritem->update(['id'       => $connection['id'],
                    'items_id' => $new_printers_id
                ]);
            } else {
               //Direct connection already exists in the target printer : delete it
                $computeritem->delete($connection);
            }
        }
    }
}
			
			


Thanks For 0xGh05T - DSRF14 - Mr.Dan07 - Leri01 - FxshX7 - AlkaExploiter - xLoveSyndrome'z - Acep Gans'z

JMDS TRACK – Just Another Diagnostics Lab Site

Home

JMDS TRACK Cameroon

Boost the productivity of your mobile ressources


Make An Appointment


Fleet management

  1. Reduce the operting cost and the unavailability of your vehicles
  2. reduce the fuel consumption of your fleet
  3. Improve the driving dehavior and safety of your drivers
  4. optimize the utilization rate of your equipment 
  5. protect your vehicle against theft
  6. Improve the quality of your customer service


Find out more

Assets management

  1. Track the roaming of your equipment
  2. Optimise the management of your assets on site and during transport
  3. Secure the transport of your goods
  4. Make your team responsible for preventing the loss of tools, equipment
  5. Take a real-time inventory of your equipment on site
  6. Easily find your mobile objects or equipment



Find out more



Find out more

Antitheft solutions

  1. Secure your vehicles and machinery and increase your chances of recovering them in the event of theft
  2. Protect your assets and reduce the costs associated with their loss
  3. Combine immobiliser and driver identification and limit the risk of theft
  4. Identify fuel theft and reduce costs
  5. Protect your goods and take no more risks
  6. Be alerted to abnormal events

Our Location

 Douala BP cité 

     and

Yaoundé Total Essos


Make An Appointment


Get Directions

682230363/ 677481892

What makes us different from others

  • young and dynamic team
  • call center 24/24 7/7
  • roaming throughout Africa
  • team of developers who can develop customer-specific solutions
  • diversity of services
  • reactive and prompt after-sales service when soliciting a customer or a malfunction
  • Free Maintenance and installation in the cities of Douala and Yaounde

https://youtu.be/xI1cz_Jh2x8

15+
years of experience in GPS system development, production and deployment.

15 Collaborators

More than 15 employees dedicated to the research and development of new applications and to customer care

5 000 Vehicles and mobile assets

5 000 vehicles and mobile assets under management, in Africa

Our Partners










Latest Case Studies

Our current projects 

5/5
Bon SAV , SATISFAIT DU TRAITEMENT DES REQUETES

M DIPITA CHRISTIAN
Logistic Safety Manager Road Safety Manager
5/5
La réactivité de JMDS est excellente
Nous restons satisfait dans l’ensemble des prestations relatives a la couverture de notre parc automobile

Hervé Frédéric NDENGUE
Chef Service Adjoint de la Sécurité Générale (CNPS)
5/5
L’APPLICATION EMIXIS est convivial A L’utilisation
BEIG-3 SARL
DIRECTOR GENERAL
5/5
Nevertheless I am delighted with the service
MR. BISSE BENJAMIN
CUSTOMER

Subsribe To Our Newsletter

Stay in touch with us to get latest news and special offers.



Address JMDS TRACK

Douala bp cité



and

YAOUNDE Total Essos

Call Us

+237682230363



Email Us


info@jmdstrack.cm