"Fossies" - the Fresh Open Source Software Archive

Member "OCSNG_UNIX_SERVER_2.6/ocsreports/backend/identity/methode/local.php" (17 Apr 2019, 3477 Bytes) of package /linux/privat/OCSNG_UNIX_SERVER_2.6.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "local.php" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 2.3.1_vs_2.4.

    1 <?php
    2 /*
    3  * Copyright 2005-2016 OCSInventory-NG/OCSInventory-ocsreports contributors.
    4  * See the Contributors file for more details about them.
    5  *
    6  * This file is part of OCSInventory-NG/OCSInventory-ocsreports.
    7  *
    8  * OCSInventory-NG/OCSInventory-ocsreports is free software: you can redistribute
    9  * it and/or modify it under the terms of the GNU General Public License as
   10  * published by the Free Software Foundation, either version 2 of the License,
   11  * or (at your option) any later version.
   12  *
   13  * OCSInventory-NG/OCSInventory-ocsreports is distributed in the hope that it
   14  * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
   15  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   16  * GNU General Public License for more details.
   17  *
   18  * You should have received a copy of the GNU General Public License
   19  * along with OCSInventory-NG/OCSInventory-ocsreports. if not, write to the
   20  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
   21  * MA 02110-1301, USA.
   22  */
   23 /* page de récupération en local des droits
   24  * et des tags sur lesquels l'utilisateur
   25  * a des droits
   26  *
   27  * on doit renvoyer un tableau array('accesslvl'=>%%,'tag_show'=>array(%,%,%,%,%...))
   28  * si une erreur est rencontrée, on retourne un code erreur
   29  *
   30  */
   31 
   32 require_once ('require/function_files.php');
   33 //nom de la page
   34 $name = "local.php";
   35 connexion_local_read();
   36 mysqli_select_db($link_ocs, $db_ocs);
   37 
   38 //recherche du niveau de droit de l'utilisateur
   39 $reqOp = "SELECT new_accesslvl as accesslvl FROM operators WHERE id='%s'";
   40 $argOp = array($_SESSION['OCS']["loggeduser"]);
   41 $resOp = mysql2_query_secure($reqOp, $link_ocs, $argOp);
   42 $rowOp = mysqli_fetch_object($resOp);
   43 
   44 if (isset($rowOp->accesslvl)) {
   45     $lvluser = $rowOp->accesslvl;
   46 
   47     $profile_config = PROFILES_DIR . $lvluser . '.xml';
   48 
   49     if (!file_exists($profile_config)) {
   50         migrate_config_2_2();
   51     }
   52 
   53     $profile_serializer = new XMLProfileSerializer();
   54     $profile = $profile_serializer->unserialize($lvluser, file_get_contents($profile_config));
   55 
   56     $restriction = $profile->getRestriction('GUI');
   57 
   58     //Si l'utilisateur a des droits limités
   59     //on va rechercher les tags sur lesquels il a des droits
   60     if ($restriction == 'YES') {
   61         $sql = "select tag from tags where login='%s'";
   62         $arg = array($_SESSION['OCS']["loggeduser"]);
   63         $res = mysql2_query_secure($sql, $link_ocs, $arg);
   64         while ($row = mysqli_fetch_object($res)) {
   65             // Check for wildcard
   66             if (strpos($row->tag, '*') !== false || strpos($row->tag,'?') !== false) {
   67                 $wildcard = true;
   68                 $row->tag = str_replace("*", "%", $row->tag);
   69                 $row->tag = str_replace("?", "_", $row->tag);
   70                 if($wildcard === true){
   71                     $sql_wildcard = "SELECT TAG FROM `accountinfo` WHERE TAG LIKE '$row->tag' GROUP BY TAG";
   72                     $res_wildcard = mysql2_query_secure($sql_wildcard, $link_ocs);
   73                     while ($row_wildcard = mysqli_fetch_object($res_wildcard)) {
   74                         $list_tag[$row_wildcard->TAG] = $row_wildcard->TAG;
   75                     }
   76                     
   77                 }      
   78             }else{
   79                 $list_tag[$row->tag] = $row->tag;
   80             }
   81         }
   82         if (!isset($list_tag)) {
   83             $ERROR = $l->g(893);
   84         }
   85     } elseif ($restriction != 'NO') {
   86         $ERROR = $restriction;
   87     }
   88 } else {
   89     $ERROR = $l->g(894);
   90 }
   91 ?>