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 @@ ...@@ -2,12 +2,9 @@
/* liste de parametres */ /* liste de parametres */
$dbname='community.db';
$min_num_friends=0;// nombre minimal de voisin que doit avoir un scholar pour être affiché $min_num_friends=0;// nombre minimal de voisin que doit avoir un scholar pour être affiché
// $compress='No'; // $compress='No';
/* parametres externes: nom de l'hôte SQL*/ /* parametres externes: nom de l'hôte SQL*/
$params = parse_ini_file("parametres_comex.ini"); $params = parse_ini_file("parametres_comex.ini");
......
<?php <?php
include ("comex_library.php"); include ("php_library/comex_library.php");
include ("parametres.php"); include ("php_library/parametres.php");
include ("normalize.php"); include ("php_library/normalize.php");
//include("../common/library/fonctions_php.php"); //include("../common/library/fonctions_php.php");
...@@ -324,12 +324,12 @@ foreach ($base->query($sql) as $row) { ...@@ -324,12 +324,12 @@ foreach ($base->query($sql) as $row) {
$scholars[$row['doors_uid']] = $info; $scholars[$row['doors_uid']] = $info;
} }
/// stats /// stats
include ('stat-prep_from_array.php');/// include ("php_library/stat-prep_from_array.php");
// debug // debug
// $content .= var_dump($scholars) ; // $content .= var_dump($scholars) ;
include ("directory_content.php"); include ("php_library/directory_content.php");
// liste des chercheurs // liste des chercheurs
......
<?php <?php
// affiche la liste de jobs correspondant à une requête // affiche la liste de jobs correspondant à une requête
include ("parametres.php"); include ("php_library/parametres.php");
include ("normalize.php"); include ("php_library/normalize.php");
include ("comex_library.php"); include ("php_library/comex_library.php");
//include("../common/library/fonctions_php.php");
$meta = '<!DOCTYPE html> $meta = '<!DOCTYPE html>
<html lang="en"> <html lang="en">
...@@ -237,11 +236,11 @@ foreach ($base->query($sql) as $row) { ...@@ -237,11 +236,11 @@ foreach ($base->query($sql) as $row) {
/// stats /// stats
//$base = new PDO('sqlite:' . $dbname); //$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 // liste des chercheurs
......
<?php <?php
include ("comex_library.php"); include ("php_library/comex_library.php");
include ("parametres.php"); include ("php_library/parametres.php");
include ("normalize.php"); include ("php_library/normalize.php");
//include("../common/library/fonctions_php.php");
$meta = '<!DOCTYPE html> $meta = '<!DOCTYPE html>
<html lang="en"> <html lang="en">
...@@ -188,9 +187,9 @@ foreach ($base->query($sql) as $row) { ...@@ -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 @@ ...@@ -3,9 +3,8 @@
/* /*
* Génère le gexf des scholars à partir de la base mysql * Génère le gexf des scholars à partir de la base mysql
*/ */
include("parametres.php"); include("php_library/parametres.php");
//include("../common/library/fonctions_php.php"); include("php_library/normalize.php");
include("normalize.php");
$base = new PDO($dsn, $user, $pass, $opt); $base = new PDO($dsn, $user, $pass, $opt);
......
...@@ -3,10 +3,8 @@ ...@@ -3,10 +3,8 @@
/* /*
* Génère le gexf des scholars à partir de la base sqlite * Génère le gexf des scholars à partir de la base sqlite
*/ */
include("parametres.php"); include("php_library/parametres.php");
//include("../common/library/fonctions_php.php"); include("php_library/normalize.php");
include("normalize.php");
// ===================== SQL connect ===================== // ===================== SQL connect =====================
...@@ -42,80 +40,6 @@ foreach($res as $row) { ...@@ -42,80 +40,6 @@ foreach($res as $row) {
} }
// ==================== /new retrieval ===================== // ==================== /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); 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