DT
This commit is contained in:
parent
39c249772a
commit
05fef2df62
@ -13,7 +13,21 @@ function esp( $s )
|
|||||||
return $s;
|
return $s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function concat ($a, $b)
|
||||||
|
{
|
||||||
|
if ( !empty($a) && !empty(b) )
|
||||||
|
{
|
||||||
|
$r = $a . " " . $b;
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
$r = $a . $b;
|
||||||
|
}
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
|
||||||
$flag = 0;
|
$flag = 0;
|
||||||
|
$data = array("displayname"=>array("value"=>"","scope"=>"contacts","verified"=>"0"),"address"=>array("value"=>"[adresse]","scope"=>"private","verified"=>"0"),"website"=>array("value"=>"[website]","scope"=>"private","verified"=>"0"),"email"=>array("value"=>"","scope"=>"contacts","verified"=>"1"),"avatar"=>array("scope"=>"contacts","verified"=>"0"),"phone"=>array("value"=>"","scope"=>"private","verified"=>"0"),"twitter"=>array("value"=>"","scope"=>"private","verified"=>"0"));
|
||||||
|
|
||||||
$doldb = new db("dolibarr");
|
$doldb = new db("dolibarr");
|
||||||
$ncdb = new db("nextcloud");
|
$ncdb = new db("nextcloud");
|
||||||
$doldb->query("SELECT login, firstname, lastname, pass_crypted, fk_adherent_type, address, email, phone_perso, phone_mobile, zip, town FROM llx_adherent");
|
$doldb->query("SELECT login, firstname, lastname, pass_crypted, fk_adherent_type, address, email, phone_perso, phone_mobile, zip, town FROM llx_adherent");
|
||||||
@ -32,16 +46,19 @@ while ($user = $doldb->result->fetch_assoc())
|
|||||||
//echo $user["login"] . " n'existe pas";
|
//echo $user["login"] . " n'existe pas";
|
||||||
if ( empty($user["phone_mobile"]) )
|
if ( empty($user["phone_mobile"]) )
|
||||||
{
|
{
|
||||||
$phone = $user["phone_perso"];
|
$data["phone"]["value"] = $user["phone_perso"];
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
$phone = $user["phone_mobile"];
|
$data["phone"]["value"] = $user["phone_mobile"];
|
||||||
}
|
}
|
||||||
$user["firstname"] = "";
|
|
||||||
$name = json_encode((!empty($user["firstname"])?$user["firstname"]:"") . (!empty($user["lastname"])?" " . $user["lastname"]:""));
|
|
||||||
echo "=$name=";
|
|
||||||
|
|
||||||
$account_data = '{"displayname":{"value":' . $name . ',"scope":"contacts","verified":"0"},"address":{"value":' . json_encode($user['address'] . " " . $user['zip'] . " " . $user['town']) . ',"scope":"private","verified":"0"},"website":{"value":"","scope":"private","verified":"0"},"email":{"value":"' . $user["email"] . '","scope":"contacts","verified":"1"},"avatar":{"scope":"contacts","verified":"0"},"phone":{"value":"' . $phone . '","scope":"private","verified":"0"},"twitter":{"value":"","scope":"private","verified":"0"}}';
|
$data["displayname"]["value"] = concat ($user["firstname", $user["lastname"]);
|
||||||
|
$address = concat($user['address'], $user["zip"]);
|
||||||
|
$data["address"]["value"] = concat ($address, $user["town"]);
|
||||||
|
$data["email"]["value"] = $user["email"];
|
||||||
|
$account_data = json_encode($data);
|
||||||
|
|
||||||
|
//$account_data = '{"displayname":{"value":' . $name . ',"scope":"contacts","verified":"0"},"address":{"value":' . json_encode($user['address'] . " " . $user['zip'] . " " . $user['town']) . ',"scope":"private","verified":"0"},"website":{"value":"","scope":"private","verified":"0"},"email":{"value":"' . $user["email"] . '","scope":"contacts","verified":"1"},"avatar":{"scope":"contacts","verified":"0"},"phone":{"value":"' . $phone . '","scope":"private","verified":"0"},"twitter":{"value":"","scope":"private","verified":"0"}}';
|
||||||
$oc_account_query = "INSERT INTO oc_accounts (uid, data) VALUES ('" . $user["login"] . "','" . $account_data ."')";
|
$oc_account_query = "INSERT INTO oc_accounts (uid, data) VALUES ('" . $user["login"] . "','" . $account_data ."')";
|
||||||
$oc_users_query = "INSERT INTO oc_users (uid, displayname, password, uid_lower) VALUES ('" . $user["login"] . "','" . $user["firstname"] . ' ' . $user["lastname"] . "','1|" . $user["pass_crypted"] . "','" . strtolower($user["login"]) . "')";
|
$oc_users_query = "INSERT INTO oc_users (uid, displayname, password, uid_lower) VALUES ('" . $user["login"] . "','" . $user["firstname"] . ' ' . $user["lastname"] . "','1|" . $user["pass_crypted"] . "','" . strtolower($user["login"]) . "')";
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user