mirror of
https://github.com/Floriansylvain/projet_programmation_web.git
synced 2026-08-19 11:43:16 +02:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="PublishConfigData" serverName="Sapinet" remoteFilesAllowedToDisappearOnAutoupload="false">
|
||||
<component name="PublishConfigData" serverName="Sapinet" exclude=".svn;.cvs;.idea;.DS_Store;.git;.hg;*.hprof;*.pyc;.env" remoteFilesAllowedToDisappearOnAutoupload="false">
|
||||
<serverData>
|
||||
<paths name="Sapinet">
|
||||
<serverdata>
|
||||
|
||||
@@ -26,7 +26,7 @@ let resultsCount = document.querySelector('#results-count')
|
||||
let filters = document.querySelectorAll('.filters p')
|
||||
|
||||
function sanitize(chain) {
|
||||
return chain.replace(/[^a-zA-Z0-9\- ]/g,'')
|
||||
return chain.replace(/[^a-zA-Z0-9\- ]/g, '')
|
||||
}
|
||||
|
||||
function showSuggestions() {
|
||||
@@ -72,7 +72,7 @@ function apiRequestThese(search, offset) {
|
||||
.then(data => {
|
||||
fetch(`api.php?q=count&search=${searchString}&option=${queryOption}&offset=0`)
|
||||
.then(response => response.json())
|
||||
.then(aCount => displayResults(data, aCount.data[0]))
|
||||
.then(aCount => displayResults(data, aCount.data ? aCount.data[0] : 0))
|
||||
})
|
||||
} else {
|
||||
alert('Veuillez attendre une seconde entre chaque recherche.')
|
||||
@@ -95,7 +95,7 @@ window.addEventListener('scroll', fadeIn);
|
||||
|
||||
function updatePageNumber(number) {
|
||||
pagesNumbers.childNodes.forEach(elem => {
|
||||
if (elem.innerHTML == number) {
|
||||
if (parseInt(elem.innerHTML) === number) {
|
||||
elem.style.fontWeight = "bold"
|
||||
elem.style.textDecoration = "underline"
|
||||
pagesNumbers.scrollLeft += elem.getBoundingClientRect().left -
|
||||
@@ -133,7 +133,6 @@ function displayResults(results, aCount) {
|
||||
error.classList.add("fade-in");
|
||||
errorMessage.innerHTML = results.message
|
||||
pagesNumbersContainer.style.display = 'none'
|
||||
return;
|
||||
} else if (results.status === 200) {
|
||||
count = aCount
|
||||
resultsArray = []
|
||||
@@ -163,7 +162,7 @@ function displayResults(results, aCount) {
|
||||
if (elem[14] === 'no') {
|
||||
onlineButton.disabled = true
|
||||
} else {
|
||||
onlineButton.onclick = function() {
|
||||
onlineButton.onclick = function () {
|
||||
window.open('https://www.theses.fr/' + elem[13] + '/document', ',_blank')
|
||||
}
|
||||
}
|
||||
@@ -180,7 +179,8 @@ function displayResults(results, aCount) {
|
||||
let pre_replacement = new RegExp(searchString, 'gi').exec(e)
|
||||
child.innerHTML = e.replace(pre_replacement, `<mark>${pre_replacement}</mark>`)
|
||||
content.appendChild(child)
|
||||
} i += 1
|
||||
}
|
||||
i += 1
|
||||
})
|
||||
|
||||
header.addEventListener('click', () => {
|
||||
@@ -194,14 +194,14 @@ function displayResults(results, aCount) {
|
||||
|
||||
let nb = document.createElement("p")
|
||||
nb.innerHTML = `Nombre de résultats en ${queryOption} pour "${searchString}":
|
||||
${new Intl.NumberFormat('fr-FR', { maximumSignificantDigits: 3 }).format(count)}.`
|
||||
${new Intl.NumberFormat('fr-FR', {maximumSignificantDigits: 3}).format(count)}.`
|
||||
resultsCount.appendChild(nb)
|
||||
|
||||
loader.style.display = "none"
|
||||
|
||||
nbPages = Math.ceil(count / RESULTS_NUMBER)
|
||||
|
||||
for (let i = 0 ; i < nbPages ; i++) {
|
||||
for (let i = 0; i < nbPages; i++) {
|
||||
let number = document.createElement('p')
|
||||
number.innerHTML = i + 1
|
||||
if (i === 0)
|
||||
|
||||
@@ -9,25 +9,29 @@ require_once('../class/dotEnv.php');
|
||||
|
||||
if (($handle = fopen(getenv('FILE'), "r")) !== FALSE) {
|
||||
|
||||
$dbname = getenv('DBNAME');
|
||||
|
||||
$pdo_obj = new conf();
|
||||
$pdo = $pdo_obj->getPDO();
|
||||
$stmt = $pdo->query("TRUNCATE `" . getenv('DBNAME') ."`.`theses`");
|
||||
$stmt = $pdo->prepare("TRUNCATE `:dbname`.`theses`");
|
||||
$stmt->bindParam(':dbname', $dbname);
|
||||
|
||||
$row = 1;
|
||||
while (($data = fgetcsv($handle, 10000, ";")) !== FALSE) {
|
||||
$new_these = these::emptyThese();
|
||||
$num = count($data);
|
||||
if ($row > 1) {
|
||||
for ($c = 0 ; $c < $num ; $c++) {
|
||||
for ($c = 0; $c < $num; $c++) {
|
||||
$new_these->insertField($data[$c], $c);
|
||||
}
|
||||
$dump = new dump($new_these);
|
||||
try {
|
||||
$dump->sendThese($pdo);
|
||||
} catch (Exception $e) {
|
||||
echo "<br><br>Failed on " . $row ." ( " . $e->getMessage() . " ) :<br>";
|
||||
echo "<br><br>Failed on " . $row . " ( " . $e->getMessage() . " ) :<br>";
|
||||
}
|
||||
} $row++;
|
||||
}
|
||||
$row++;
|
||||
}
|
||||
fclose($handle);
|
||||
echo "<br><br>CSV file imported into DB. (" . $row . " results)";
|
||||
|
||||
Reference in New Issue
Block a user