first commit
Signed-off-by: Daniel Tartavel <contact@librepc.com>
This commit is contained in:
parent
cf413dc0af
commit
6c8c96934c
40
config.inc.php
Executable file
40
config.inc.php
Executable file
@ -0,0 +1,40 @@
|
||||
|
||||
<?php
|
||||
|
||||
date_default_timezone_set("Europe/Paris");
|
||||
|
||||
define( 'EOL', "\n");
|
||||
define( 'TAB', "\t");
|
||||
|
||||
//constantes des niveaux de log
|
||||
define( "INFO", 1);
|
||||
define( "ALERT", 2);
|
||||
define( "ERROR", 3);
|
||||
|
||||
// initialise le user si accès authentifié
|
||||
/*if ( isset( $_SERVER['PHP_AUTH_USER']) )
|
||||
{
|
||||
$user = $_SERVER['PHP_AUTH_USER'];
|
||||
}*/
|
||||
// création de l'objet base de donnée, mais pas ouverture de la base
|
||||
|
||||
//variables diverses
|
||||
//$admin = "Daniel";
|
||||
//$site = "Espace Tuina";
|
||||
//$dossier = "/espacetuina";
|
||||
//$basedir = dirname( $_SERVER['DOCUMENT_ROOT'] ) . $dossier;
|
||||
//$lang_basedir = $basedir . "/languages/";
|
||||
//$base_url = "https://librepc.homelinux.org" . $dossier;
|
||||
//$url_gestion = $base_url . "/gestion";
|
||||
//$url_admin = $base_url . "/outils";
|
||||
//$alias = "et";
|
||||
//$table_prefix = ""; //$alias . "_";
|
||||
//$lang_list[] = array();
|
||||
//$lang_dir = '';
|
||||
|
||||
//$_SESSION['basedir'] = $basedir;
|
||||
//$_SESSION['base_url'] = $base_url;
|
||||
|
||||
//set_include_path("./");
|
||||
|
||||
?>
|
54
db.class.php
Normal file
54
db.class.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
class db
|
||||
{
|
||||
private $server = "localhost";
|
||||
private $port = 3306;
|
||||
private $user = "root";
|
||||
private $passwd = "DT_dedibox";
|
||||
public $dadabase;
|
||||
public $connect;
|
||||
public $result;
|
||||
|
||||
/*function __construct()
|
||||
{
|
||||
}
|
||||
*/
|
||||
|
||||
function open()
|
||||
{
|
||||
if ( ! $this->connect )
|
||||
{
|
||||
$this->connect = new mysqli( $this->server, $this->user, $this->passwd, $this->database );
|
||||
if ( $this->connect->connect_errno )
|
||||
{
|
||||
log_error( "Échec de la connexion : " . " => " . $this->connect->connect_error . "<br />" . __file__ . esp( 'ligne' ) . __line__);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function close()
|
||||
{
|
||||
$this->connect->close();
|
||||
$this->connect = 0;
|
||||
}
|
||||
|
||||
function query( $string )
|
||||
{
|
||||
if ( empty( $this->connect ) ) $this->open();
|
||||
|
||||
$this->result = $this->connect->query( $string ) ;
|
||||
if ( $this->connect->error ) log_error( "Échec de la commande query" . " => ". $this->connect->error . "<br />" . __file__ . esp( 'ligne' ) . __line__ . "\n" . $string);
|
||||
}
|
||||
|
||||
function error()
|
||||
{
|
||||
print_r( $this );
|
||||
$this->error = $this->error;
|
||||
return $this->error;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
7
entete_mail.php
Normal file
7
entete_mail.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
$webmaster= "contact@lalis.fr";
|
||||
$headers = "From: contact@lalis.fr\n";
|
||||
$headers .= "MIME-Version: 1.0\n";
|
||||
$headers .= "Content-type: text/plain; charset=UTF-8\n";
|
||||
$headers .= "DATE: " . date( 'r' ) . "\n";
|
||||
?>
|
31
log.php
Normal file
31
log.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
require_once( "entete_mail.php" );
|
||||
|
||||
// $level => INFO, ALERT, ERROR
|
||||
function log_write($log, $level=INFO)
|
||||
{
|
||||
global $webmaster, $headers;
|
||||
if ( $level == ALERT )
|
||||
{
|
||||
mail( $webmaster, "Connecteur nextcloud pour dolibarr: Alerte", $log_mail, $headers );
|
||||
}elseif ( $level == ERROR )
|
||||
{
|
||||
mail( $webmaster, "Connecteur nextcloud pour dolibarr: Erreur", $log_mail, $headers );
|
||||
}
|
||||
}
|
||||
|
||||
// $die = true -> execute die()
|
||||
function log_error($log, $die=true)
|
||||
{
|
||||
global $webmaster, $headers;
|
||||
echo "$log<br />" . EOL;
|
||||
log_write($log);
|
||||
$log_err = 'erreur dans la requête' . "<br/>" . "un rapport détaillé a été envoyé au webmaster";
|
||||
if ( $die )
|
||||
{
|
||||
echo "\n";
|
||||
die( $log_err );
|
||||
}
|
||||
}
|
||||
?>
|
23
nconnector.php
Executable file
23
nconnector.php
Executable file
@ -0,0 +1,23 @@
|
||||
#!/usr/bin/php
|
||||
|
||||
<?php
|
||||
|
||||
require("session_init.php");
|
||||
require("config.inc.php");
|
||||
require("log.php");
|
||||
require("db.class.php");
|
||||
|
||||
$doldb = new db();
|
||||
$doldb->database = "dolibarr";
|
||||
$ncdb = new db();
|
||||
$ncdb->database = "nextcloud";
|
||||
$doldb->query("SELECT login FROM llx_adherents");
|
||||
|
||||
function esp( $s )
|
||||
{
|
||||
$s = " $s ";
|
||||
return $s;
|
||||
}
|
||||
|
||||
var_print($doldb);
|
||||
?>
|
5
session_init.php
Normal file
5
session_init.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
?>
|
59
synchro dolibarr nextcloud.txt
Normal file
59
synchro dolibarr nextcloud.txt
Normal file
@ -0,0 +1,59 @@
|
||||
synchro dolibarr nextcloud
|
||||
Table oc_accounts
|
||||
uid
|
||||
data
|
||||
|
||||
{
|
||||
"displayname":
|
||||
{
|
||||
"value":"[uid]",
|
||||
"scope":"contacts",
|
||||
"verified":"0"
|
||||
},
|
||||
"address":
|
||||
{
|
||||
"value":"[adresse]",
|
||||
"scope":"private",
|
||||
"verified":"0"
|
||||
},
|
||||
"website":
|
||||
{
|
||||
"value":"[website]",
|
||||
"scope":"private",
|
||||
"verified":"0"
|
||||
},
|
||||
"email":
|
||||
{
|
||||
"value":"[email]",
|
||||
"scope":"contacts","verified":"1"
|
||||
},
|
||||
"avatar":
|
||||
{
|
||||
"scope":"contacts",
|
||||
"verified":"0"
|
||||
},
|
||||
"phone":
|
||||
{
|
||||
"value":"[telephone]",
|
||||
"scope":"private",
|
||||
"verified":"0"
|
||||
},
|
||||
"twitter":
|
||||
{
|
||||
"value":"",
|
||||
"scope":"private",
|
||||
"verified":"0"
|
||||
}
|
||||
}
|
||||
|
||||
Table oc_users
|
||||
uid => llx_adherents.login
|
||||
displayname => llx_adherents.firstname llx_adherents.lastname
|
||||
password => "1|".llx_adherents.pass_crypted
|
||||
uid_lower => llx_adherents.login en minuscule
|
||||
|
||||
|
||||
|
||||
table oc_group_user
|
||||
uid (table oc_users) => llx_adherents.login
|
||||
gid (membres, contributeur) =>llx_adherents.fk_adherent_type 2 => membres 3 =>contributeurs
|
Reference in New Issue
Block a user