$iFilteredTotal = DB::count(); /* * Output */ $sOutput = '{'; $sOutput .= '"sEcho": ' . intval($_GET['sEcho']) . ', '; $sOutput .= '"iTotalRecords": ' . $iTotal . ', '; $sOutput .= '"iTotalDisplayRecords": ' . $iTotal . ', '; $sOutput .= '"aaData": [ '; foreach ($rows as $record) { $get_item_in_list = true; $sOutput_item = "["; //col1 $sOutput_item .= '"' . date($_SESSION['settings']['date_format'] . " " . $_SESSION['settings']['time_format'], $record['date']) . '", '; //col3 $sOutput_item .= '"' . stripslashes("<b>" . handleBackslash($record['label']) . "</b> <span style='font-size:10px;font-style:italic;'><i class='fa fa-folder-o'></i> " . $record['folder'] . "</span>") . '", '; //col2 $sOutput_item .= '"' . htmlspecialchars(stripslashes($record['login']), ENT_QUOTES) . '", '; //col4 $sOutput_item .= '"' . htmlspecialchars(stripslashes($LANG[$record['action']]), ENT_QUOTES) . '", '; //col5 if ($record['perso'] == 1) { $sOutput_item .= '"' . htmlspecialchars(stripslashes($LANG['yes']), ENT_QUOTES) . '"'; } else { $sOutput_item .= '"' . htmlspecialchars(stripslashes($LANG['no']), ENT_QUOTES) . '"'; } //Finish the line $sOutput_item .= '], '; if ($get_item_in_list == true) { $sOutput .= $sOutput_item; }
} } } else { $perso = '<i class="fa fa-tag mi-green"></i> '; $action = 'AfficherDetailsItem(\'' . $record['id'] . '\',\'0\',\'' . $expired_item . '\', \'' . $restrictedTo . '\',\'\',\'\', \'\', \'' . $record['id_tree'] . '\')'; $action_dbl = 'AfficherDetailsItem(\'' . $record['id'] . '\',\'0\',\'' . $expired_item . '\', \'' . $restrictedTo . '\', \'\', true, \'\', \'' . $record['id_tree'] . '\')'; $displayItem = 1; // reinit in case of not personal group if ($init_personal_folder == false) { $findPfGroup = ""; $init_personal_folder = true; } } // prepare new line $sOutput .= '<li ondblclick="' . $action_dbl . '" class="item" id="' . $record['id'] . '" style="margin-left:-30px;"><a id="fileclass' . $record['id'] . '" class="file_search" onclick="' . $action . ' "><i class="fa fa-key mi-yellow"></i> ' . mb_substr(stripslashes(handleBackslash($record['label'])), 0, 65); if (!empty($record['description']) && isset($_SESSION['settings']['show_description']) && $_SESSION['settings']['show_description'] == 1) { $tempo = explode("<br />", $record['description']); if (count($tempo) == 1) { $sOutput .= ' <font size="2px">[' . strip_tags(stripslashes(mb_substr(cleanString($record['description']), 0, 30))) . ']</font>'; } else { $sOutput .= ' <font size="2px">[' . strip_tags(stripslashes(mb_substr(cleanString($tempo[0]), 0, 30))) . ']</font>'; } } // set folder $sOutput .= ' <span style="font-size:11px;font-style:italic;"><i class="fa fa-folder-o"></i> ' . strip_tags(stripslashes(mb_substr(cleanString($record['folder']), 0, 65))) . '</span>'; $sOutput .= '<span style="float:right;margin:2px 10px 0px 0px;">'; // Prepare make Favorite small icon $sOutput .= ' <span id="quick_icon_fav_' . $record['id'] . '" title="Manage Favorite" class="cursor tip">'; if (in_array($record['id'], $_SESSION['favourites'])) { $sOutput .= '<i class="fa fa-star mi-yellow fa-lg" onclick="ActionOnQuickIcon(' . $record['id'] . ',0)" class="tip"></i> ';
$return .= '<li onclick="displayItemNumber(' . $record['id'] . ', ' . $record['id_tree'] . ')"><i class="fa fa-hand-o-right"></i> ' . $record['label'] . '</li>'; $x++; array_push($arrTmp, $record['id']); if ($x >= 10) { break; } } } } // get wainting suggestions $nb_suggestions_waiting = 0; if (isset($_SESSION['settings']['enable_suggestion']) && $_SESSION['settings']['enable_suggestion'] == 1 && ($_SESSION['user_admin'] == 1 || $_SESSION['user_manager'] == 1)) { $rows = DB::query("SELECT * FROM " . prefix_table("suggestion")); $nb_suggestions_waiting = DB::count(); } echo json_encode(array("error" => "", "existing_suggestions" => $nb_suggestions_waiting, "text" => handleBackslash($return)), JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP); break; /** * Generates a KEY with CRYPT */ /** * Generates a KEY with CRYPT */ case "generate_new_key": // load passwordLib library $pwdlib = new SplClassLoader('PasswordLib', '../includes/libraries'); $pwdlib->register(); $pwdlib = new PasswordLib\PasswordLib(); // generate key $key = $pwdlib->getRandomToken($_POST['size']); echo '[{"key" : "' . $key . '"}]';
} else { $reason[1] = cryption($reason[1], $_SESSION['my_sk'], $record['raison_iv'], "decrypt"); } $reason[1] = @$reason[1]['string']; // if not UTF8 then cleanup and inform that something is wrong with encrytion/decryption if (!isUTF8($reason[1]) || is_array($reason[1])) { $reason[1] = ""; } } // imported via API if ($record['login'] == "") { $record['login'] = $LANG['imported_via_api']; } if (!empty($reason[1]) || $record['action'] == "at_copy" || $record['action'] == "at_creation" || $record['action'] == "at_manual" || $record['action'] == "at_modification" || $record['action'] == "at_delete" || $record['action'] == "at_restored") { $avatar = isset($record['avatar_thumb']) && !empty($record['avatar_thumb']) ? $_SESSION['settings']['cpassman_url'] . '/includes/avatars/' . $record['avatar_thumb'] : $_SESSION['settings']['cpassman_url'] . '/includes/images/photo.jpg'; $history .= '<tr style="">' . '<td rowspan="2" style="width:40px;"><img src="' . $avatar . '" style="border-radius:20px; height:35px;"></td>' . '<td colspan="2" style="font-size:11px;"><i>' . $LANG['by'] . ' ' . $record['login'] . ' ' . $LANG['at'] . ' ' . date($_SESSION['settings']['date_format'] . ' ' . $_SESSION['settings']['time_format'], $record['date']) . '</i></td></tr>' . '<tr style="border-bottom:3px solid #C9C9C9;"><td style="width:100px;"><b>' . $LANG[$record['action']] . '</b></td>' . '<td style="">' . (!empty($record['raison']) ? count($reason) > 1 ? $LANG[trim($reason[0])] . ' : ' . handleBackslash($reason[1]) : ($record['action'] == "at_manual" ? $reason[0] : $LANG[trim($reason[0])]) : '') . '</td>' . '</tr>' . '<tr></tr>'; } } $history .= "</table>"; $data = array('error' => "", 'new_html' => $history); // send data echo prepareExchangedData($data, "encode"); break; } } // Build the QUERY in case of GET if (isset($_GET['type'])) { switch ($_GET['type']) { /* * CASE * Autocomplet for TAGS