Menu

setting the default variables

Help
kpable
2007-07-01
2013-05-20
  • kpable

    kpable - 2007-07-01

    Hi there,

    Just installed the upgrade to 2.1 from 1.4 - nice! Thank you!
    The recursive groups is brilliant for me (although it does end up with a lot of duplicated groups listed in the array which I'll have to take care of).

    Quick questions:
       "// You can set your default variables here, or when you invoke the class"
    I'm sure it's something simple, but how do you set them when you invoke the class? Ideally I'd like to be able to do upgrades by dropping the new class in where the old one sits, and handle all the variables in my own scripts so nothing else has to be modified.

    Also, in the example:
       $ldap=new adLDAP($options);
    I can find any reference to the options in the class, documentation or faq. Can I see some examples?

    Thanks again!
    Sean.

     
    • kpable

      kpable - 2007-07-02

      Ah, found it. Live and learn :)

          function adLDAP($options=array()){
              //you can specifically overide any of the default configuration options setup above
              if (count($options)>0){
                  if (array_key_exists("account_suffix",$options)){ $this->_account_suffix=$options["account_suffix"]; }
                  if (array_key_exists("base_dn",$options)){ $this->_base_dn=$options["base_dn"]; }
                  if (array_key_exists("domain_controllers",$options)){ $this->_domain_controllers=$options["domain_controllers"]; }
                  if (array_key_exists("ad_username",$options)){ $this->_ad_username=$options["ad_username"]; }
                  if (array_key_exists("ad_password",$options)){ $this->_ad_password=$options["ad_password"]; }
                  if (array_key_exists("real_primarygroup",$options)){ $this->_real_primarygroup=$options["real_primarygroup"]; }
                  if (array_key_exists("use_ssl",$options)){ $this->_use_ssl=$options["use_ssl"]; }
                  if (array_key_exists("recursive_groups",$options)){ $this->_recursive_groups=$options["recursive_groups"]; }
              }

       

Log in to post a comment.