<?php
require_once 'modules/admin/models/ServerPlugin.php';
/**
* @package Plugins
*/
class PluginSkeleton extends ServerPlugin
{
    
    /*****************************************************************/
    // function getVariables - required function
    /*****************************************************************/
    
    function getVariables(){
        /* Specification
              itemkey     - used to identify variable in your other functions
              type        - text,textarea,yesno,password
              description - description of the variable, displayed in ClientExec
              encryptable - used to indicate the variable's value must be encrypted in the database
        */
    
    
        $variables = array (
                   /*T*/"Name"/*/T*/ => array (
                                        "type"=>"hidden",
                                        "description"=>"Used By CE to show plugin",
                                        "value"=>"Skeleton Plugin"
                                       ),
                   /*T*/"Description"/*/T*/ => array (
                                        "type"=>"hidden",
                                        "description"=>/*T*/"Description viewable by admin in server settings"/*/T*/,
                                        "value"=>/*T*/"Skeleton Plugin, to be used as a base for your custom server plugins."/*/T*/
                                       ),
                   /*T*/"Username"/*/T*/ => array (
                                        "type"=>"text",
                                        "description"=>/*T*/"Username used to connect to server"/*/T*/,
                                        "value"=>""
                                       ),
                   /*T*/"Password"/*/T*/ => array (
                                        "type"=>"password",
                                        "description"=>/*T*/"Password used to connect to server"/*/T*/,
                                        "value"=>"",
                                        "encryptable"=>true
                                       ),
                   /*T*/"Actions"/*/T*/ => array (
                                        "type"=>"hidden",
                                        "description"=>/*T*/"Current actions that are active for this plugin per server"/*/T*/,
                                        "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 create($args){
    
    }
    
    function 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 = mb_substr($args['DomainName'],0,strpos($args['DomainName'],".")); // remove the extension of the domain
            }
            return $username;
    }
    
    function update($args){
    }
    
    function delete($args){
    }
    
    function suspend($args){
    }
    
    function unsuspend($args){
    }
}
?>
