Changeset 10320

Show
Ignore:
Timestamp:
09/27/10 04:34:12 (3 years ago)
Author:
tm1000
Message:

Simple fixes for EPM 2.3.0

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • contributed_modules/modules/endpointman/includes/functions.inc

    r10315 r10320  
    2323        global $amp_conf, $db, $global_cfg; 
    2424 
     25        //TODO: Need to have this change when the user changes timezones, for now we keep it set to my timezone 
    2526        date_default_timezone_set('America/Los_Angeles'); 
    2627 
     28        //The only time dbh_asterisk is set is when we are inside the ARI Recording interface 
    2729        if(isset($_SESSION['dbh_asterisk'])) { 
    2830            $this->db = $_SESSION['dbh_asterisk']; 
     31            //We don't want to reference the recordings directory when in the recording interface. 
    2932            $_SERVER["SCRIPT_FILENAME"] = str_replace("recordings/", "admin/", $_SERVER["SCRIPT_FILENAME"]); 
    3033        } else { 
    3134            $this->db = $db; 
    3235        } 
     36 
     37        //Move all information from the global $amp_conf into our public space. This will help prevent security concerns 
    3338        $this->amp_conf = $amp_conf; 
     39 
     40        //Generate empty array 
    3441        $this->error = array(); 
    3542 
     43        //Get all global variables 
    3644        $this->global_cfg =& $this->db->getAssoc("SELECT var_name, value FROM endpointman_global_vars"); 
    3745 
     46        //TODO: Possibly remove these as I don't believe anything uses them anymore 
    3847        define("UPDATE_PATH", $this->global_cfg['update_server']); 
    3948        define("VER", $this->global_cfg['version']); 
     49        //end possible removal 
     50 
    4051        //Define the location of phone modules, keeping it outside of the module directory so that when the user updates endpointmanager they don't lose all of their phones 
    4152        define("PHONE_MODULES_PATH", dirname($_SERVER["SCRIPT_FILENAME"])."/modules/_ep_phone_modules/"); 
     
    5364        } 
    5465 
    55         //Check writable 
     66        //Check if config location is writable and/or exists! 
    5667        if(isset($this->global_cfg['config_location'])) { 
    5768            if(is_dir($this->global_cfg['config_location'])) { 
     
    7182    } 
    7283 
     84    /** 
     85     * Used to send sample configurations to provisioner.net 
     86     * NOTE: The user has to explicitly click a link that states they are sending the configuration to the project 
     87     * We don't take configs on our own accord!! 
     88     * @param <type> $brand Brand Directory 
     89     * @param <type> $product Product Directory 
     90     * @param <type> $orig_name The file's original name we are sending 
     91     * @param <type> $data The config file's data 
     92     */ 
    7393    function submit_config($brand,$product,$orig_name,$data) { 
    7494        $posturl = 'http://www.provisioner.net/submit_config.php'; 
    75         $postvars = 'brand=&product=&origname='.htmlentities(addslashes($orig_name)).'&config_data='.base64_encode($data); 
     95        $postvars = 'brand='.$brand.'&product='.$product.'&origname='.htmlentities(addslashes($orig_name)).'&config_data='.base64_encode($data); 
    7696 
    7797        $ch = curl_init($posturl); 
     
    80100        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 
    81101        curl_setopt($ch, CURLOPT_HEADER, 0);  // DO NOT RETURN HTTP HEADERS 
    82         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);  // RETURN THE CONTENTS OF THE CALL 
     102        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);  // RETURN THE CONTENTS OF THE CALL, probably not needed 
    83103        $Rec_Data = curl_exec($ch); 
    84104 
     
    144164 
    145165    /** 
    146      * Get the brand from any mac sent 
     166     * Get the brand from any mac sent to this function 
    147167     * @param string $mac 
    148168     * @return array 
     
    274294            $phone_info['product_id'] = 0; 
    275295            $phone_info['custom_cfg_template'] = 0; 
    276             $phone_info['ext'] = $row['ext']; 
    277296            $phone_info['mac'] = $row['mac']; 
    278         } 
    279  
    280         //Final Output needs to look like this: 
    281         //$this['mac_id'] 
    282         //$this['model_id'] 
    283         //$this['brand_id'] 
    284         //$this['template_id'] 
    285         //$this['product_id'] 
    286         //$this['mac'] 
    287         //$this['cfg_dir'] 
    288         //$this['cfg_ver'] 
    289         //$this['model_name'] 
    290         //$this['brand_name'] 
    291         //$this['long_name'] 
    292         //$this['config_files_override'] 
    293         //$this['global_custom_cfg_data'] 
    294         //$this['global_user_cfg_data'] 
    295         //$this['template_data'] 
    296         //$this['enabled'] 
    297         //$this['line'][1]['ext'] 
    298         //$this['line'][1]['description'] 
    299         //$this['line'][1]['secret'] 
    300         //$this['line'][1]['custom_cfg_data'] 
    301         //$this['line'][1]['user_cfg_data'] 
    302         // 
     297            $sql = "SELECT endpointman_line_list.*, sip.data as secret, devices.* FROM endpointman_line_list, sip, devices WHERE endpointman_line_list.ext = devices.id AND endpointman_line_list.ext = sip.id AND sip.keyword = 'secret' AND mac_id = ".$mac_id; 
     298            $lines_info =& $this->db->getAll($sql, array(), DB_FETCHMODE_ASSOC); 
     299            foreach($lines_info as $line) { 
     300                $phone_info['line'][$line['line']] = $line; 
     301            } 
     302        } 
     303 
     304        //Final Output will look something similar to this 
     305        /**Array 
     306            ( 
     307                [config_files_override] => 
     308                [global_user_cfg_data] => N; 
     309                [model_id] => 213 
     310                [brand_id] => 2 
     311                [name] => Grandstream 
     312                [directory] => grandstream 
     313                [model] => GXP2000 
     314                [mac] => 000B820D0050 
     315                [template_id] => 0 
     316                [global_custom_cfg_data] => Serialized Data (Changed Template Values) 
     317                [long_name] => GXP Enterprise IP series [280,1200,2000,2010,2020] 
     318                [product_id] => 21 
     319                [cfg_dir] => gxp 
     320                [cfg_ver] => 1.5 
     321                [template_data] => Serialized Data (The default Template Values) 
     322                [enabled] => 1 
     323                [line] => Array 
     324                    ( 
     325                        [1] => Array 
     326                            ( 
     327                                [luid] => 2 
     328                                [mac_id] => 2 
     329                                [line] => 1 
     330                                [ext] => 1000 
     331                                [description] => Description 
     332                                [custom_cfg_data] => 
     333                                [user_cfg_data] => 
     334                                [secret] => secret 
     335                                [id] => 1000 
     336                                [tech] => sip 
     337                                [dial] => SIP/1000 
     338                                [devicetype] => fixed 
     339                                [user] => 1000 
     340                                [emergency_cid] => 
     341                            ) 
     342 
     343                    ) 
     344 
     345            ) 
     346        */ 
     347 
     348        echo "<pre>"; 
     349        print_r($phone_info); 
    303350        return $phone_info; 
    304351    } 
     
    671718    /** 
    672719     * Prepare and then send the data that Provisioner expects, then take what provisioner gives us and do what it says 
    673      * @param array $phone_info 
     720     * @param array $phone_info Everything from get_phone_info 
    674721     */ 
    675722    function prepare_configs($phone_info) { 
  • contributed_modules/modules/endpointman/module.xml

    r10319 r10320  
    2222        </changelog> 
    2323  <info>http://projects.colsolgrp.net/projects/show/endpointman</info> 
    24   <location>contributed_modules/release/endpointman-2.3.0.tgz</location> 
     24  <location>contributed_modules/release/endpointman-2.2.9.tgz</location> 
    2525 
    26 <md5sum>7adabdcde60d5f27a3dcae7c660e7526</md5sum> 
     26<md5sum>c9dd08b16ad7e9eb41164ab3a8e0123f</md5sum> 
    2727</module>