Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

FOP2 Community Forum

D

dsisevran

@dsisevran
Unfollow Follow
About
Posts
7
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Using FOP2 Phonebook with LDAP server
    D dsisevran
    Support

    Yes! Thanks for pointing my fault. As I'm not using this query in a function, I forgot changing return $results; to echo $results;
    I firstly trying to add this code inside the original in a function with no luck. Then I have blank vphonebook.php and fill it with this code only but still not working. Finally Nicolas help me to fix the problem.


  • Using FOP2 Phonebook with LDAP server
    D dsisevran
    Support

    Thank Nicolas for your help.
    Finally as I only use ldap for my search my vphonebook.php look like

    <?php
    
    $texto     = $_REQUEST['term'];
    
    // ---------------------------- VARIABLES ----------------------------
    $ldapURL = 'LDAP_URL';
    $ldapPort = 389; // Port par defaut = 389
    $ldapVersionProtocole = 3; // Version par defaut = 2
    $ldapIdentifiant = 'cn=ADMIN,dc=DOMAIN,dc=COM';
    $ldapMotDePasse = 'PASSWD';
    
    // ---------------------------- CONNEXION ----------------------------
    $ldap = ldap_connect($ldapURL, $ldapPort);
    if (false === $ldap) die('Echec de la connexion');
    ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, $ldapVersionProtocole);
    $retour = ldap_bind($ldap, $ldapIdentifiant, $ldapMotDePasse);
    if (false === $retour) die('Echec de l\'authentification (ou de la connexion)');
    
    // ---------------------------- RECHERCHE ----------------------------
    $dn = "OU=PERSON,DC=DOMAIN,DC=COM";
    $recherche = "UID=*$texto*";
    $requete = ldap_search($ldap, $dn, $recherche);
    if (false === $requete) die('La recherche a echoue');
    
    // ---------------------------- RESULTAT ----------------------------
    $resultats = ldap_get_entries($ldap, $requete);
    $myArray = array();
    for ($i=0; $i<$resultats["count"]; $i++) {
        $myArray[] = "{\"name\":\"\",\"value\":\"" . $resultats[$i]["cn"][0] . " <" . $resultats[$i]["telephonenumber"][0] . ">\"}";
    }
    
    // ---------------------------- FORMATAGE ----------------------------
    //print_r($myArray);
    $results = json_encode($myArray,JSON_UNESCAPED_UNICODE);
    $results = str_replace('\"', '"', $results);
    $results = str_replace('"{', '{', $results);
    $results = str_replace('}"', '}', $results);
    
    // ---------------------------- FERMETURE ----------------------------
    ldap_close($ldap);
    
    echo $results;
    
    ?>
    

  • Using FOP2 Phonebook with LDAP server
    D dsisevran
    Support

    I have wrote a little script to query on LDAP and formating the result in a json array but not working when adding it in vphonebook.php

    <?php
    
    // ---------------------------- VARIABLES ----------------------------
    $ldapURL = 'LDAP_URL';
    $ldapPort = 389; // Port par defaut = 389
    $ldapVersionProtocole = 3; // Version par defaut = 2
    $ldapIdentifiant = 'cn=ADMIN,dc=DOMAIN,dc=COM';
    $ldapMotDePasse = 'PASSWD';
    
    // ---------------------------- CONNEXION ----------------------------
    $ldap = ldap_connect($ldapURL, $ldapPort);
    if (false === $ldap) die('Echec de la connexion');
    ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, $ldapVersionProtocole);
    $retour = ldap_bind($ldap, $ldapIdentifiant, $ldapMotDePasse);
    if (false === $retour) die('Echec de l\'authentification (ou de la connexion)');
    
    // ---------------------------- RECHERCHE ----------------------------
    $dn = "OU=PERSON,DC=DOMAIN,DC=COM";
    $recherche = "UID=*$texto*";
    $requete = ldap_search($ldap, $dn, $recherche);
    if (false === $requete) die('La recherche a echoue');
    
    // ---------------------------- RESULTAT ----------------------------
    $resultats = ldap_get_entries($ldap, $requete);
    $myArray = array();
    for ($i=0; $i<$resultats["count"]; $i++) {
        $myArray[] = "{\"name\":\"\",\"value\":\"" . $resultats[$i]["cn"][0] . " <" . $resultats[$i]["telephonenumber"][0] . ">\"}";
    }
    
    // ---------------------------- FORMATAGE ----------------------------
    //print_r($myArray);
    $results = json_encode($myArray,JSON_UNESCAPED_UNICODE);
    $results = str_replace('\"', '"', $results);
    $results = str_replace('"{', '{', $results);
    $results = str_replace('}"', '}', $results);
    
    // ---------------------------- FERMETURE ----------------------------
    ldap_close($ldap);
    
    return $results;
    
    ?>
    

  • Using FOP2 Phonebook with LDAP server
    D dsisevran
    Support

    Thanks 😉
    Yes I am working on a separate php file for testing only and then I will modify vphonebook.php.


  • Using FOP2 Phonebook with LDAP server
    D dsisevran
    Support

    Whitch syntax does the result have to be return for matching contact form query?


  • Using FOP2 Phonebook with LDAP server
    D dsisevran
    Support

    Thanks for the answer. Will try to do something before paid for a full licence. I have also see VOP which could do the trick. Will give a try.
    Regards.


  • Using FOP2 Phonebook with LDAP server
    D dsisevran
    Support

    Dear,
    Is there any update concering this request?
    Regards.

  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups