Commit ade92c92 authored by Romain Loth's avatar Romain Loth

tidy up php scripts: 10 are used via include (=> moved to lib dir) while 5 are...

tidy up php scripts: 10 are used via include (=> moved to lib dir) while 5 are used for front end (search_* and print_*) => stay
parent 0d5232c7
......@@ -2,12 +2,9 @@
/* liste de parametres */
$dbname='community.db';
$min_num_friends=0;// nombre minimal de voisin que doit avoir un scholar pour être affiché
// $compress='No';
/* parametres externes: nom de l'hôte SQL*/
$params = parse_ini_file("parametres_comex.ini");
......
<?php
include ("comex_library.php");
include ("parametres.php");
include ("normalize.php");
include ("php_library/comex_library.php");
include ("php_library/parametres.php");
include ("php_library/normalize.php");
//include("../common/library/fonctions_php.php");
......@@ -324,12 +324,12 @@ foreach ($base->query($sql) as $row) {
$scholars[$row['doors_uid']] = $info;
}
/// stats
include ('stat-prep_from_array.php');///
include ("php_library/stat-prep_from_array.php");
// debug
// $content .= var_dump($scholars) ;
include ("directory_content.php");
include ("php_library/directory_content.php");
// liste des chercheurs
......
<?php
// affiche la liste de jobs correspondant à une requête
include ("parametres.php");
include ("normalize.php");
include ("comex_library.php");
//include("../common/library/fonctions_php.php");
include ("php_library/parametres.php");
include ("php_library/normalize.php");
include ("php_library/comex_library.php");
$meta = '<!DOCTYPE html>
<html lang="en">
......@@ -237,11 +236,11 @@ foreach ($base->query($sql) as $row) {
/// stats
//$base = new PDO('sqlite:' . $dbname);
include ('jobs_stat-prep_from_array.php');///
include ('php_library/jobs_stat-prep_from_array.php');///
include ("jobs_content.php");
include ("php_library/jobs_content.php");
// liste des chercheurs
......
<?php
include ("comex_library.php");
include ("parametres.php");
include ("normalize.php");
//include("../common/library/fonctions_php.php");
include ("php_library/comex_library.php");
include ("php_library/parametres.php");
include ("php_library/normalize.php");
$meta = '<!DOCTYPE html>
<html lang="en">
......@@ -188,9 +187,9 @@ foreach ($base->query($sql) as $row) {
}
}
include ('stat-prep_from_array.php');///
include ('php_library/stat-prep_from_array.php');
include ("directory_content.php");
include ('php_library/directory_content.php');
......
......@@ -3,9 +3,8 @@
/*
* Génère le gexf des scholars à partir de la base mysql
*/
include("parametres.php");
//include("../common/library/fonctions_php.php");
include("normalize.php");
include("php_library/parametres.php");
include("php_library/normalize.php");
$base = new PDO($dsn, $user, $pass, $opt);
......
......@@ -3,10 +3,8 @@
/*
* Génère le gexf des scholars à partir de la base sqlite
*/
include("parametres.php");
//include("../common/library/fonctions_php.php");
include("normalize.php");
include("php_library/parametres.php");
include("php_library/normalize.php");
// ===================== SQL connect =====================
......@@ -42,80 +40,6 @@ foreach($res as $row) {
}
// ==================== /new retrieval =====================
// $base = new PDO("sqlite:" . $dbname);
//
// $category = trim(strtolower($_GET['category']));
// $login = trim(strtolower($_GET['login']));
// $q = "%".sanitize_input($login)."%";
//
// //echo "category: ".$category.";";
// //echo "login: ".$login.";";
// //echo "q: ".$q.";";
//
// $cat = '';
// $query = '';
// if ($category == 'login') {
// $cat = "unique_id";
// $query = 'unique_id LIKE upper(\''.strtoupper($q).'\')';
// } elseif ($category == 'firstname') {
// $cat = "firstname";
// $query = 'first_name LIKE upper(\''.strtoupper($q).'\')';
// } elseif ($category == 'lastname') {
// $cat = "lastname";
// $query = 'last_name LIKE upper(\''.strtoupper($q).'\')';
// } else {
// echo ("ERROR");
// exit();
// }
//
// $filtered = array (
// "yes", "1", "0", "nvgfpmeilym", "no", "mr", "ms", "", " ", " "
// );
// function filter_word($value) {
// if ($value == null) return true;
// return ! in_array(strtolower($value),$filtered);
// }
//
// $req = "SELECT unique_id, first_name, last_name,nb_keywords FROM scholars WHERE ".$query." GROUP BY unique_id";
// #echo "req: ".$req.";";
// $results = array();
// $i = 0;
// $res = $base->query($req);
//
// foreach ($res as $row) {
// if ($row["nb_keywords"]==0){
// $row["nb_keywords"]=' (no keyword to map)';
// } else {
// $row["nb_keywords"]='';
// }
// array_push($results,$row);
// }
//
// $nbresults = sizeof($results);
// $results = array_slice($results,0,20);
// $nbresults2 = sizeof($results);
// $completion = array(
// "results" => array()
// );
//
//
// foreach($results as $row) {
// array_push($completion["results"], array(
// 'id' => $row["unique_id"],
// 'term' => $login,
// 'firstname' => $row["first_name"],
// 'lastname' => $row["last_name"].$row["nb_keywords"],
// 'score' => 1,
//
// // TODO change: general metadata is uselessly copied x nbresults
// // F*** it, I'll put the meta data here...
// 'category' => $cat,
// "size" => $nbresults2,
// "total" => $nbresults,
// "remaining" => ($nbresults - $nbresults2)
// ));
// }
// $i = 0;
echo json_encode($completion);
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment