Esempio n. 1
0
         }
         //store in array
         $folders_array[$fold] = array('folder' => $fold, 'nlevel' => $folder_level, 'id' => $id);
         $_SESSION['nb_folders']++;
         $i++;
     }
 }
 //Close file & delete it
 fclose($cacheFileF);
 unlink($cacheFile_name_folder);
 //if no new folders them inform
 if ($nb_folders_imported == 0) {
     $text .= $txt['none'] . '<br />';
 } else {
     //Refresh the rights of actual user
     IdentifyUserRights(implode(';', $_SESSION['groupes_visibles']) . ';' . $new_id, $_SESSION['groupes_interdits'], $_SESSION['is_admin'], $_SESSION['fonction_id'], true);
     //rebuild full tree
     $tree = new NestedTree($pre . 'nested_tree', 'id', 'parent_id', 'title');
     $tree->rebuild();
 }
 //show
 $text .= '<br /><b>' . $txt['importing_items'] . ':</b><br />';
 // Now import ITEMS
 $nb_items_imported = 0;
 //prepare file to be read
 fclose($cacheFile);
 $cacheFile = fopen($cacheFile_name, "r");
 while (!feof($cacheFile)) {
     //prepare an array with item to import
     $item = fgets($cacheFile, 4096);
     $item = explode($items_separator, str_replace(array("\r\n", "\n", "\r"), '', $item));
Esempio n. 2
0
         $res_roles = $db->query_first("SELECT title FROM " . $pre . "roles_title WHERE id = " . $role);
         $_SESSION['arr_roles'][$role] = array('id' => $role, 'title' => $res_roles['title']);
     }
     //build complete array of roles
     $_SESSION['arr_roles_full'] = array();
     $rows = $db->fetch_all_array("\r\n\t\t\t\t\t\t\t\tSELECT id, title\r\n\t\t\t\t\t\t\t\tFROM " . $pre . "roles_title A\r\n\t\t\t\t\t\t\t\tORDER BY title ASC");
     foreach ($rows as $reccord) {
         $_SESSION['arr_roles_full'][$reccord['id']] = array('id' => $reccord['id'], 'title' => $reccord['title']);
     }
     //Set some settings
     $_SESSION['user']['find_cookie'] = false;
     $_SESSION['settings']['update_needed'] = "";
     // Update table
     $db->query_update("users", array('key_tempo' => $_SESSION['key'], 'last_connexion' => mktime(date("h"), date("i"), date("s"), date("m"), date("d"), date("Y")), 'timestamp' => mktime(date("h"), date("i"), date("s"), date("m"), date("d"), date("Y")), 'disabled' => 0, 'no_bad_attempts' => 0), "id=" . $data['id']);
     //Get user's rights
     IdentifyUserRights($data['groupes_visibles'], $_SESSION['groupes_interdits'], $data['admin'], $data['fonction_id'], false);
     //Get some more elements
     $_SESSION['hauteur_ecran'] = $data_received['hauteur_ecran'];
     //Get last seen items
     $_SESSION['latest_items_tab'][] = "";
     foreach ($_SESSION['latest_items'] as $item) {
         if (!empty($item)) {
             $data = $db->query_first("SELECT label,id_tree FROM " . $pre . "items WHERE id = " . $item);
             $_SESSION['latest_items_tab'][$item] = array('label' => $data['label'], 'url' => 'index.php?page=items&amp;group=' . $data['id_tree'] . '&amp;id=' . $item);
         }
     }
     //send back the random key
     $return = $data_received['randomstring'];
 } else {
     if ($data['disabled'] == 1) {
         //User and password is okay but account is locked
Esempio n. 3
0
     $title = htmlspecialchars_decode($data_received['title']);
     $complexity = htmlspecialchars_decode($data_received['complexity']);
     $parent_id = htmlspecialchars_decode($data_received['parent_id']);
     $renewal_period = htmlspecialchars_decode($data_received['renewal_period']);
     //Check if title doesn't contains html codes
     if (preg_match_all("|<[^>]+>(.*)</[^>]+>|U", $title, $out)) {
         $error = 'error_html_codes';
     }
     $db->query_update("nested_tree", array('parent_id' => $parent_id, 'title' => $title, 'personal_folder' => 0, 'renewal_period' => $renewal_period, 'bloquer_creation' => '0', 'bloquer_modification' => '0'), "id='" . $data_received['id'] . "'");
     //Add complexity
     $db->query_update("misc", array('valeur' => $complexity), array('intitule' => $data_received['id'], 'type' => 'complex'));
     require_once 'NestedTree.class.php';
     $tree = new NestedTree($pre . 'nested_tree', 'id', 'parent_id', 'title');
     $tree->rebuild();
     //Get user's rights
     IdentifyUserRights($_SESSION['groupes_visibles'] . ';' . $data_received['id'], $_SESSION['groupes_interdits'], $_SESSION['is_admin'], $_SESSION['fonction_id'], true);
     echo '[ { "error" : "' . $error . '" } ]';
     break;
     //CASE where to update the associated Function
 //CASE where to update the associated Function
 case "fonction":
     $val = explode(';', $_POST['valeur']);
     $valeur = $_POST['valeur'];
     //Check if ID already exists
     $data = $db->fetch_row("SELECT authorized FROM " . $pre . "rights WHERE tree_id = '" . $val[0] . "' AND fonction_id= '" . $val[1] . "'");
     if (empty($data[0])) {
         //Insert into DB
         $db->query_insert('rights', array('tree_id' => $val[0], 'fonction_id' => $val[1], 'authorized' => 1));
     } else {
         //Update DB
         if ($data[0] == 1) {