<?php
/*****************************************************************/
// function plugin_shell_variables - required function
/*****************************************************************/

function plugin_shell_variables($args){
    /* Specification
          itemkey     - used to identify variable in your other functions
          type        - text,textarea,yesno,password
          description - description of the variable, displayed in ClientExec
    */


    $variables = array (
               "Name" => array (
                                    "type"=>"hidden",
                                    "description"=>"Used By CE to show plugin - must match how you call the action function names",
                                    "value"=>"Shell"
                                   ),
               "Description" => array (
                                    "type"=>"hidden",
                                    "description"=>"Description visable by admin in server settings",

                                    "value"=>"Manages *nix shell users based on username"
                                   ),
               "Username" => array (
                                    "type"=>"text",
                                    "description"=>"Username used to connect to server",
                                    "value"=>""
                                   ),
               "Password" => array (
                                    "type"=>"password",
                                    "description"=>"Password used to connect to server",
                                    "value"=>""
                                   ),
               "Actions" => array (
                                    "type"=>"hidden",
                                    "description"=>"current actions that are active for this plugin_per server",
                                    "value"=>"Create,Update,Delete,Suspend,UnSuspend"
                                   )
    );
    return $variables;


}


//TODO: need to define a way to get package attributes

//plugin function called after new account is activated ( approved )
function Plugin_Shell_Create($args){

}

function Plugin_Shell_CreateUsername($args){
        //function used to determine how you want CE to create usernames on this server
        //if it does not matter on this server you can return $args['DomainUsername']
        $pos = strpos($args['DomainName'],".");
        if ($pos === false) {
            //username is not a domain so we just pass the 
            //user picked domain
            $username = $args['DomainUsername'];
        }else{
            $username = substr($args['DomainName'],0,strpos($args['DomainName'],".")); // remove the extension of the domain
        }
        return $username;
}

function Plugin_Shell_Update($args){
    
}

function Plugin_Shell_Delete($args){

}

function Plugin_Shell_Suspend($args){

}

function Plugin_Shell_UnSuspend($args){

}
?>
