Changeset 10315

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

Several changes to Endpoint Manager for version 2.2.9

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • contributed_modules/modules/endpointman/Install/phonesettings.module

    r10052 r10315  
    1 <?php 
     1<?PHP 
     2 
     3/** 
     4 * Endpoint Manager ARI File 
     5 * 
     6 * @author Andrew Nagy 
     7 * @license MPL / GPLv2 / LGPL 
     8 * @package Endpoint Manager 
     9 */ 
    210 
    311 
     
    2735  function init() { 
    2836  } 
    29   
     37 
    3038  /* 
    3139   * Adds menu item to nav menu 
     
    5866   *   action 
    5967   */ 
    60   function action($args) {   
     68  function action($args) { 
     69  error_reporting(E_ALL); 
     70  ini_set('display_errors', 1); 
    6171  global $endpoint, $global_cfg; 
    6272 
    6373  $doc_root = $_SERVER["DOCUMENT_ROOT"] ."/admin/modules/endpointman/"; 
    6474  require($doc_root . "includes/functions.inc"); 
    65    
     75 
    6676  $endpoint = new endpointmanager(); 
    67    
    68   $sql = "SELECT id FROM endpointman_mac_list WHERE ext = '".$_SESSION['ari_user']['extension']."' "; 
    69   $results = mysql_query($sql); 
    70   $row = mysql_fetch_assoc($results); 
    71    
    7277 
    73   $id = $row['id']; 
     78  $sql = "SELECT mac_id, line FROM endpointman_line_list WHERE ext = '".$_SESSION['ari_user']['extension']."' "; 
     79    $mac_row =& $endpoint->db->getRow($sql, array(), DB_FETCHMODE_ASSOC); 
    7480 
    75   $row = $endpoint->get_phone_info($id); 
    76    
    77   $cfg_data = unserialize($row['cfg_data']); 
    78    
    79    
    80   if($row['custom_cfg_template'] > 0) { 
    81     $row['custom_cfg_data'] = $row['template_data']['custom_cfg_data']; 
    82   } 
    83   $custom_cfg_data2 = unserialize($row['custom_cfg_data']); 
    84    
     81  $mac_id = $mac_row['mac_id']; 
     82  $line = $mac_row['line']; 
     83 
     84  $row = $endpoint->get_phone_info($mac_id); 
     85 
     86  $cfg_data = unserialize($row['template_data']); 
     87 
     88  $custom_cfg_data2 = unserialize($row['global_custom_cfg_data']); 
     89 
    8590  $count = count($cfg_data); 
    8691  for($i=0;$i<=$count;$i++) { 
     
    9095    } 
    9196  } 
    92      
     97 
    9398  $custom_cfg_data = serialize($custom_cfg_data); 
    94    
    95   $sql = "UPDATE endpointman_mac_list SET user_cfg_data = '".$custom_cfg_data."' WHERE id = ". $id; 
    96   mysql_query($sql); 
    97    
    98   require(PHONE_MODULES_PATH.$row['directory'].'/'.$row['cfg_dir'].'/functions.inc'); 
    9999 
    100   $phone_config = new $row['cfg_dir'](); 
    101   $phone_config->generate_config($id); 
    102    
     100  $sql = "UPDATE endpointman_mac_list SET global_user_cfg_data = '".$custom_cfg_data."' WHERE id = ". $mac_id; 
     101  $endpoint->db->query($sql); 
     102 
     103  //refresh the data before we prepare so we get acurate data 
     104  $row['global_user_cfg_data'] = $custom_cfg_data; 
     105  $endpoint->prepare_configs($row); 
     106 
    103107  $m = "phonesettings"; 
    104    
     108 
    105109  $ret .= " 
    106110      <head> 
     
    111115        </script> 
    112116    </head>"; 
    113    
     117 
    114118    return $ret; 
    115119  } 
     
    129133    die('No Database?'); 
    130134    } 
    131    
     135 
    132136  $doc_root = $_SERVER["DOCUMENT_ROOT"] ."/admin/modules/endpointman/"; 
    133137  require($doc_root . "includes/functions.inc"); 
    134    
     138 
    135139  $endpoint = new endpointmanager(); 
    136    
    137   $sql = "SELECT id FROM endpointman_mac_list WHERE ext = '".$_SESSION['ari_user']['extension']."' "; 
    138   $results = mysql_query($sql); 
    139   $row = mysql_fetch_assoc($results); 
    140    
    141   global $global_cfg; 
    142140 
    143   $row = $endpoint->get_phone_info($row['id'])
    144    
     141  $sql = "SELECT mac_id, line FROM endpointman_line_list WHERE ext = '".$_SESSION['ari_user']['extension']."' "
     142    $mac_row =& $endpoint->db->getRow($sql, array(), DB_FETCHMODE_ASSOC); 
    145143 
    146    
     144  $mac_id = $mac_row['mac_id']; 
     145  $line = $mac_row['line']; 
    147146 
    148   if(!$endpoint->sync_product($row['product_id'])) { 
    149     die("unable to sync local template files". $custom); 
     147  $row = $endpoint->get_phone_info($mac_id); 
     148 
     149  if(!$endpoint->sync_model($row['model_id'])) { 
     150    die("unable to sync local template files"); 
    150151  } 
    151    
    152   //Get default template config data from the database for this product 
    153   $sql = "SELECT cfg_data FROM endpointman_product_list WHERE id=". $row['product_id']; 
    154   $result=mysql_query($sql); 
    155   $product_row=mysql_fetch_array($result);     
    156    
    157   //inset it into our usable row 
    158   $row['cfg_data'] = $product_row['cfg_data']; 
    159152 
    160153  $brand_name = $row['directory']; 
    161154  $model_name = $row['cfg_dir']; 
    162155 
    163      
     156 
    164157  //Start the display of the html file in the product folder 
    165    
    166   $template .=  '<h3>Hello '. $row['description'] . ', You are currently editing phone settings for extension '.$row['ext'].'</h3><br />'; 
    167    
    168   if($row['custom_cfg_template'] > 0) { 
    169     $row['custom_cfg_data'] = $row['template_data']['custom_cfg_data']; 
    170   }  
    171158 
    172   $out = $endpoint->generate_gui_html($row['cfg_data'],$row['custom_cfg_data'],FALSE,$row['user_cfg_data']); 
    173    
    174   $out[0]['data'] = array_values($out[0]['data']); 
    175    
    176   $out[0]['title'] = "Your Phone Settings"; 
    177    
     159  $template =  '<h3>Hello '. $row['line'][$line]['description'] . ', You are currently editing phone settings for extension '.$row['line'][$line]['ext'].'</h3><br />'; 
     160 
     161  $out = $endpoint->generate_gui_html($row['template_data'],$row['global_custom_cfg_data'],FALSE,$row['global_user_cfg_data']); 
     162 
     163  if(!empty($out)) { 
     164    $out[0]['data'] = array_values($out[0]['data']); 
     165    $out[0]['title'] = "Your Phone Settings"; 
     166    $button = "<input name='submit' type='submit' value='Save & Reboot'>"; 
     167 
     168  } else { 
     169    $out[0]['title'] = "Your Phone Settings have not been enabled. Please talk to your administrator."; 
     170    $out[0]['data'] = NULL; 
     171    $button = ""; 
     172  } 
     173 
    178174  $tpl = new RainTPL( LOCAL_PATH.'templates' ); 
    179    
     175 
    180176  $tpl->assign("in_ari", 1); 
    181177  $tpl->assign("template_editor", $out); 
    182   $tpl->assign("hidden_id", $row['id']); 
    183   $tpl->assign("hidden_custom", $custom); 
     178  $tpl->assign("hidden_id", $row['line'][$line]['luid']); 
    184179  $template .= $tpl->draw( 'template_editor', TRUE ); 
    185    
     180 
    186181 
    187182  $m = "phonesettings"; 
    188   $ret .= "<form class='phonesettings' name='ari_settings' action='' method='GET'> 
     183  $ret = "<form class='phonesettings' name='ari_settings' action='' method='GET'> 
    189184  <input type=hidden name=m value=" . $m . "> 
    190185  <input type=hidden name=f value='action'> 
     
    192187  <br> 
    193188  " . $template . " 
    194   <br> 
    195   <input name='submit' type='submit' value='Save & Reboot'> 
    196   </form>"; 
     189  <br>". $button ."</form>"; 
    197190  return($ret); 
    198191  } 
    199192} // class 
    200  
    201 ?> 
  • contributed_modules/modules/endpointman/ajax_select.html.php

    r10218 r10315  
    11<?PHP 
     2/** 
     3 * Endpoint Manager FreePBX AJAX Select File 
     4 * 
     5 * @author Andrew Nagy 
     6 * @license MPL / GPLv2 / LGPL 
     7 * @package Endpoint Manager 
     8 */ 
    29include('includes/ajax_select.php'); 
  • contributed_modules/modules/endpointman/export.html.php

    r10220 r10315  
    11<?php 
    2 /*  
    3  * To change this template, choose Tools | Templates 
    4  * and open the template in the editor. 
     2/** 
     3 * Endpoint Manager FreePBX CSV Export 
     4 * 
     5 * @author Andrew Nagy 
     6 * @license MPL / GPLv2 / LGPL 
     7 * @package Endpoint Manager 
    58 */ 
    69include('includes/export.php'); 
  • contributed_modules/modules/endpointman/functions.inc.php

    r10229 r10315  
    11<?PHP 
     2/** 
     3 * Endpoint Manager FreePBX Hooks File 
     4 * 
     5 * @author Andrew Nagy 
     6 * @license MPL / GPLv2 / LGPL 
     7 * @package Endpoint Manager 
     8 */ 
    29 
    310function endpointman_get_config($engine) { 
  • contributed_modules/modules/endpointman/includes/advanced.inc

    r10240 r10315  
    1515 
    1616echo $tpl->draw( 'global_header' ); 
    17 echo $tpl->draw( 'advanced_subheader' ); 
    18  
    1917if(!isset($_REQUEST['subpage'])) { 
    2018    $_REQUEST['subpage'] = ""; 
     19        $tpl->assign("subhead_area", 'settings'); 
     20} else { 
     21    $tpl->assign("subhead_area", $_REQUEST['subpage']); 
    2122} 
     23echo $tpl->draw( 'advanced_subheader' ); 
     24 
     25 
    2226 
    2327switch($_REQUEST['subpage']) { 
     
    4347                                        $sql = "SELECT id FROM endpointman_brand_list WHERE name LIKE '%".$device[1]."%' LIMIT 1"; 
    4448                                        $res =& $db->query($sql); 
    45                                         if($res->numRows()) { 
     49                                        if($res->numRows() > 0) { 
    4650                                            $brand_id = $endpoint->db->getOne($sql); 
    4751                                            $brand_id = $brand_id[0]; 
     52 
     53                                            $sql_model = "SELECT id FROM endpointman_model_list WHERE brand = ".$brand_id." AND model LIKE '%".$device[2]."%' LIMIT 1"; 
     54                                            $sql_ext = "SELECT extension, name FROM users WHERE extension LIKE '%".$device[3]."%' LIMIT 1"; 
     55 
     56                                            $res_model =& $db->query($sql_model); 
     57                                            if($res_model->numRows()) { 
     58                                                $model_id =& $db->getRow($sql_model,array(), DB_FETCHMODE_ASSOC); 
     59                                                $model_id = $model_id['id']; 
     60 
     61                                                $res_ext =& $db->query($sql_ext); 
     62                                                if($res_ext->numRows()) { 
     63                                                    $ext =& $db->getRow($sql_ext,array(), DB_FETCHMODE_ASSOC); 
     64                                                    $description = $ext['name']; 
     65                                                    $ext = $ext['extension']; 
     66 
     67                                                    $sql = "INSERT INTO  endpointman_mac_list (mac, model) VALUES ('".$mac."','".$model_id."')"; 
     68                                                    $endpoint->db->query($sql); 
     69 
     70                                                    $sql = 'SELECT last_insert_id()'; 
     71                                                    $ext_id =& $endpoint->db->getOne($sql); 
     72 
     73                                                    $sql = "INSERT INTO `endpointman_line_list` (`mac_id`, `ext`, `line`, `description`) VALUES ('".$ext_id."', '".$ext."', '1','".$description."')"; 
     74                                                    $endpoint->db->query($sql); 
     75 
     76                                                    $message .= "Inserted Mac Address ".$mac."<br/>"; 
     77                                                } else { 
     78                                                    $endpoint->error['csv_upload'] = 'Invalid Extension Specified'; 
     79                                                } 
     80                                            } else { 
     81                                                $endpoint->error['csv_upload'] = 'Invalid Model Specified'; 
     82                                            } 
    4883                                        } else { 
    49                                             $brand_id = 0
     84                                            $endpoint->error['csv_upload'] = 'Invalid Brand Specified'
    5085                                        } 
    51                                         $sql_model = "SELECT id FROM endpointman_model_list WHERE brand = ".$brand_id." AND model LIKE '%".$device[2]."%' LIMIT 1"; 
    52                                         $sql_ext = "SELECT extension, name FROM users WHERE extension LIKE '%".$device[3]."%' LIMIT 1"; 
    53  
    54                                         $res_model =& $db->query($sql_model); 
    55                                         if($res_model->numRows()) { 
    56                                             $model_id =& $db->getRow($sql_model,array(), DB_FETCHMODE_ASSOC); 
    57                                             $model_id = $model_id['id']; 
    58                                         } else { 
    59                                             $model_id = 0; 
    60                                         } 
    61                                         $res_ext =& $db->query($sql_ext); 
    62                                         if($res_ext->numRows()) { 
    63                                             $ext =& $db->getRow($sql_ext,array(), DB_FETCHMODE_ASSOC); 
    64                                             $description = $ext['name']; 
    65                                             $ext = $ext['extension']; 
    66                                         } else { 
    67                                             $ext = ''; 
    68                                             $description = ''; 
    69                                         } 
    70                                         $sql = "INSERT INTO  endpointman_mac_list (mac, model) VALUES ('".$mac."','".$model_id."')"; 
    71                                         $endpoint->db->query($sql); 
    72  
    73                                         $sql = 'SELECT last_insert_id()'; 
    74                                         $ext_id =& $endpoint->db->getOne($sql); 
    75  
    76                                         $sql = "INSERT INTO `endpointman_line_list` (`mac_id`, `ext`, `line`, `description`) VALUES ('".$ext_id."', '".$ext."', '1','".$description."')"; 
    77                                         $endpoint->db->query($sql); 
    78                                          
    79                                         $message .= "Inserted Mac Address ".$mac."<br/>"; 
    8086                                    } else { 
    81                                         $message .= "Invalid Mac on line ". $i. "<br />"; 
     87                                        $endpoint->error['csv_upload'] = "Invalid Mac on line ". $i. "<br />"; 
    8288                                    } 
    8389                                } 
     
    8793                            unlink(LOCAL_PATH.$_FILES['import_csv']['name']); 
    8894                            $message .= "Please reboot & rebuild all imported phones<br />"; 
    89                             $tpl->assign("message", $message); 
    9095                        } else { 
    91                             $tpl->assign("message", "Possible file upload attack!")
     96                            $this->error['file_upload'] = "Possible file upload attack!"
    9297 
    9398                        } 
     
    95100                } 
    96101            } 
     102        } 
     103        $error_message = NULL; 
     104        foreach($endpoint->error as $key => $error) { 
     105            $error_message .= $error; 
     106            if($endpoint->global_cfg['debug']) { 
     107                $error_message .= " Function: [".$key."]"; 
     108            } 
     109            $error_message .= "<br />"; 
     110        } 
     111        if(isset($message)) { 
     112            $endpoint->display_message_box($message,$tpl,0); 
     113        } 
     114        if(isset($error_message)) { 
     115            $endpoint->display_message_box($error_message,$tpl,1); 
    97116        } 
    98117        echo $tpl->draw( 'advanced_settings_iedl' ); 
     
    272291        $tpl->assign("oui_list_custom", $row_out_custom); 
    273292        $tpl->assign("brand_ava", $endpoint->brandAvailable()); 
     293 
     294        $error_message = NULL; 
     295        foreach($endpoint->error as $key => $error) { 
     296            $error_message .= $error; 
     297            if($endpoint->global_cfg['debug']) { 
     298                $error_message .= " Function: [".$key."]"; 
     299            } 
     300            $error_message .= "<br />"; 
     301        } 
     302        if(isset($message)) { 
     303            $endpoint->display_message_box($message,$tpl,0); 
     304        } 
     305        if(isset($error_message)) { 
     306            $endpoint->display_message_box($error_message,$tpl,1); 
     307        } 
     308 
    274309        echo $tpl->draw( 'advanced_settings_oui' ); 
    275310        break; 
     
    289324            $sql = "DELETE FROM endpointman_custom_configs WHERE id =". $_REQUEST['sql']; 
    290325            $endpoint->db->query($sql); 
     326            $message = "Deleted!"; 
    291327        } 
    292328        if(1 == 0) { 
     
    327363            $contents = fread($handle, filesize($file)); 
    328364            fclose($handle); 
     365            $tpl->assign("location", $file); 
    329366            $tpl->assign("config_data", $contents); 
    330367        } 
     
    340377                    fwrite($wfh,$_REQUEST['config_text']); 
    341378                    fclose($wfh); 
     379                    $message = "Saved to Hard Drive!"; 
    342380                }elseif(isset($_REQUEST['button_save_as'])) { 
    343381                    $sql = 'INSERT INTO endpointman_custom_configs (name, original_name, product_id, data) VALUES ("'.addslashes($_REQUEST['save_as_name']).'","'.addslashes($config_files[$_REQUEST['file']]).'","'.$_REQUEST['product_select'].'","'.addslashes($_REQUEST['config_text']).'")'; 
    344382                    $endpoint->db->query($sql); 
    345                 } 
    346             } 
     383                    $message = "Saved to Database!"; 
     384                } 
     385            } 
     386 
    347387            $handle = fopen($file, "rb"); 
    348388            $contents = fread($handle, filesize($file)); 
    349389            fclose($handle); 
     390 
     391            if(isset($_REQUEST['sendid'])) { 
     392                $endpoint->submit_config($row['directory'],$row['cfg_dir'],$config_files[$_REQUEST['file']],$contents); 
     393                $message = 'Sent! Thanks :-)'; 
     394            } 
     395 
    350396            $tpl->assign("save_as_name_value", $config_files[$_REQUEST['file']]); 
    351397            $tpl->assign("config_data", $contents); 
     398            $tpl->assign("filename", $config_files[$_REQUEST['file']]); 
     399            $tpl->assign('sendid', $_REQUEST['file']); 
     400            $tpl->assign("type", 'file'); 
     401            $tpl->assign("location", $file); 
     402             
    352403        } elseif(isset($_REQUEST['sql'])) { 
    353404            if(isset($_REQUEST['config_text'])) { 
     
    355406                    $sql = "UPDATE endpointman_custom_configs SET data = '".addslashes($_REQUEST['config_text'])."' WHERE id = ".$_REQUEST['sql']; 
    356407                    $endpoint->db->query($sql); 
     408                    $message = "Saved to Database!"; 
    357409                }elseif(isset($_REQUEST['button_save_as'])) { 
    358410                    $sql = 'SELECT original_name FROM endpointman_custom_configs WHERE id = '.$_REQUEST['sql']; 
     
    361413                    $sql = "INSERT INTO endpointman_custom_configs (name, original_name, product_id, data) VALUES ('".addslashes($_REQUEST['save_as_name'])."','".addslashes($file_name)."','".$_REQUEST['product_select']."','".addslashes($_REQUEST['config_text'])."')"; 
    362414                    $endpoint->db->query($sql); 
    363                 } 
     415                    $message = "Saved to Database!"; 
     416                } 
     417            } 
     418            if(isset($_REQUEST['sendid'])) { 
     419                $sql = "SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id = '". $_REQUEST['product_select'] ."'"; 
     420                $row22 =& $endpoint->db->getRow($sql, array(), DB_FETCHMODE_ASSOC); 
     421                $endpoint->submit_config($row22['directory'],$row22['cfg_dir'],$config_files[$_REQUEST['file']],$contents); 
     422                $message = 'Sent! Thanks! :-)'; 
    364423            } 
    365424            $sql = 'SELECT * FROM endpointman_custom_configs WHERE id =' . $_REQUEST['sql']; 
    366425            $row =& $endpoint->db->getRow($sql, array(), DB_FETCHMODE_ASSOC); 
    367426            $tpl->assign("save_as_name_value", $row['name']); 
     427            $tpl->assign("filename", $row['original_name']); 
     428            $tpl->assign('sendid', $_REQUEST['sql']); 
     429            $tpl->assign("type", 'sql'); 
    368430            $tpl->assign("config_data", $row['data']); 
    369431        } 
     
    433495        } 
    434496        $tpl->assign("product_list", $product_list); 
     497 
     498        $error_message = NULL; 
     499        foreach($endpoint->error as $key => $error) { 
     500            $error_message .= $error; 
     501            if($endpoint->global_cfg['debug']) { 
     502                $error_message .= " Function: [".$key."]"; 
     503            } 
     504            $error_message .= "<br />"; 
     505        } 
     506        if(isset($message)) { 
     507            $endpoint->display_message_box($message,$tpl,0); 
     508        } 
     509        if(isset($error_message)) { 
     510            $endpoint->display_message_box($error_message,$tpl,1); 
     511        } 
     512 
    435513        echo $tpl->draw( 'advanced_settings_poce' ); 
    436514        break; 
     
    549627        $tpl->assign("debug_selected", $debug_selected); 
    550628 
     629        $tpl->assign("ip", $_SERVER["SERVER_ADDR"]); 
     630        $tpl->assign("srvip", $endpoint->global_cfg['srvip']); 
     631        $tpl->assign("arp_location", $endpoint->global_cfg['arp_location']); 
     632        $tpl->assign("nmap_location", $endpoint->global_cfg['nmap_location']); 
     633        $tpl->assign("asterisk_location", $endpoint->global_cfg['asterisk_location']); 
     634 
     635        $tpl->assign("config_location", $endpoint->global_cfg['config_location']); 
     636        $tpl->assign("list_tz", $endpoint->listTZ($endpoint->global_cfg['tz'])); 
     637        $tpl->assign("brand_list", $endpoint->brandAvailable()); 
     638 
    551639        $error_message = NULL; 
    552640        foreach($endpoint->error as $key => $error) { 
     
    564652        } 
    565653 
    566         $tpl->assign("ip", $_SERVER["SERVER_ADDR"]); 
    567         $tpl->assign("srvip", $endpoint->global_cfg['srvip']); 
    568         $tpl->assign("arp_location", $endpoint->global_cfg['arp_location']); 
    569         $tpl->assign("nmap_location", $endpoint->global_cfg['nmap_location']); 
    570         $tpl->assign("asterisk_location", $endpoint->global_cfg['asterisk_location']); 
    571  
    572         $tpl->assign("config_location", $endpoint->global_cfg['config_location']); 
    573         $tpl->assign("list_tz", $endpoint->listTZ($endpoint->global_cfg['tz'])); 
    574         $tpl->assign("brand_list", $endpoint->brandAvailable()); 
    575654        echo $tpl->draw( 'advanced_settings_settings' ); 
    576655        break; 
  • contributed_modules/modules/endpointman/includes/brand_model_manager.inc

    r10233 r10315  
    1818    $installer = array("type" => 'brand', "id" => $_REQUEST['brand']);     
    1919  } 
    20 } elseif((isset($_REQUEST['button_install_firmware'])) OR (isset($_REQUEST['button_update_firmware'])) AND (isset($_REQUEST['product']))) { 
     20} elseif(isset($_REQUEST['product'])) { 
     21    if(isset($_REQUEST['button_install_firmware'])) { 
     22        $installer = array("type" => 'firmware', "id" => $_REQUEST['product']); 
     23    } elseif(isset($_REQUEST['button_update_firmware'])) { 
     24        $endpoint->remove_firmware($_REQUEST['product']); 
    2125  $installer = array("type" => 'firmware', "id" => $_REQUEST['product']); 
     26    } 
    2227} elseif((isset($_REQUEST['button_remove_firmware'])) AND (isset($_REQUEST['product']))) { 
    2328  $endpoint->remove_firmware($_REQUEST['product']); 
     
    8287      $row_out[$i]['products'][$j] = $row2; 
    8388      if($check_for_updates) { 
    84         if(($temp = $endpoint->firmware_update_check($row2['id'])) AND (array_key_exists('firmware_vers', $row)) AND ($row['firmware_vers'] > 0)) { 
     89        if(($temp = $endpoint->firmware_update_check($row2['id'])) AND (array_key_exists('firmware_vers', $row2)) AND ($row2['firmware_vers'] > 0)) { 
    8590          $row_out[$i]['products'][$j]['update_fw'] = 1; 
    8691          $row_out[$i]['products'][$j]['update_vers_fw'] = $temp['data']['version']; 
  • contributed_modules/modules/endpointman/includes/devices_manager.inc

    r10259 r10315  
    129129    $sql = "DELETE FROM endpointman_line_list WHERE mac_id=".$_REQUEST['id']; 
    130130    $endpoint->db->query($sql); 
     131    $message = _("Deleted")."!"; 
    131132} elseif((isset($_REQUEST['button_add_selected_phones'])) AND (isset($_REQUEST['add']))) { 
    132133    $list_num = count($_REQUEST['add']); 
     
    233234        $phone_info = $endpoint->get_phone_info($data['id']); 
    234235        $endpoint->prepare_configs($phone_info); 
     236        foreach($phone_info['line'] as $line) { 
     237            $sql = "UPDATE endpointman_line_list SET description = '".$line['description']."' WHERE luid = ".$line['luid']; 
     238            $endpoint->db->query($sql); 
     239        } 
    235240    } 
    236241} elseif(isset($_REQUEST['button_rebuild_reboot'])) { 
     
    247252            $phone_info = $endpoint->get_phone_info($row['id']); 
    248253            $endpoint->prepare_configs($phone_info); 
     254            foreach($phone_info['line'] as $line) { 
     255                $sql = "UPDATE endpointman_line_list SET description = '".$line['description']."' WHERE luid = ".$line['luid']; 
     256                $endpoint->db->query($sql); 
     257            } 
    249258        } 
    250259    } 
     
    404413            $tpl->assign("brand_id", $edit_row['brand_id']); 
    405414            $tpl->assign("models_ava", $ma); 
    406             $tpl->assign("display_ext", $endpoint->displayExtension($edit_row['ext'])); 
     415            $tpl->assign("display_ext", $endpoint->displayExtension($edit_row['line'][1]['luid'])); 
    407416            $tpl->assign("display_templates", $endpoint->display_templates($edit_row['product_id'],$edit_row['template_id'])); 
    408417            $tpl->assign("edit_id", $edit_row['id']); 
     
    420429        $error_message .= "<br />"; 
    421430    } 
     431 
     432    if(isset($message)) { 
     433        $endpoint->display_message_box($message,$tpl,0); 
     434    } 
     435 
    422436    if(isset($error_message)) { 
    423437        $endpoint->display_message_box($error_message,$tpl,1); 
    424438    } 
    425     if(isset($message)) { 
    426         $endpoint->display_message_box($message,$tpl,0); 
    427     } 
    428439 
    429440    //draw the template 
  • contributed_modules/modules/endpointman/includes/functions.inc

    r10261 r10315  
    2525        date_default_timezone_set('America/Los_Angeles'); 
    2626 
    27         $this->db = $db; 
     27        if(isset($_SESSION['dbh_asterisk'])) { 
     28            $this->db = $_SESSION['dbh_asterisk']; 
     29            $_SERVER["SCRIPT_FILENAME"] = str_replace("recordings/", "admin/", $_SERVER["SCRIPT_FILENAME"]); 
     30        } else { 
     31            $this->db = $db; 
     32        } 
    2833        $this->amp_conf = $amp_conf; 
    2934        $this->error = array(); 
    3035 
    31  
     36        $this->global_cfg =& $this->db->getAssoc("SELECT var_name, value FROM endpointman_global_vars"); 
     37 
     38        define("UPDATE_PATH", $this->global_cfg['update_server']); 
     39        define("VER", $this->global_cfg['version']); 
    3240        //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 
    3341        define("PHONE_MODULES_PATH", dirname($_SERVER["SCRIPT_FILENAME"])."/modules/_ep_phone_modules/"); 
     
    3644        define("WEB_PATH", dirname($_SERVER['SCRIPT_NAME'])."/modules/endpointman/"); 
    3745        define("LOCAL_PATH", dirname($_SERVER["SCRIPT_FILENAME"])."/modules/endpointman/"); 
    38  
    39  
    40         $this->global_cfg =& $this->db->getAssoc("SELECT var_name, value FROM endpointman_global_vars"); 
    41  
    42         define("UPDATE_PATH", $this->global_cfg['update_server']); 
    43         define("VER", $this->global_cfg['version']); 
    4446        
    4547        //Define error reporting 
     
    4951        } else { 
    5052            ini_set('display_errors', 0); 
    51         }      
     53        } 
     54 
     55        //Check writable 
     56        if(isset($this->global_cfg['config_location'])) { 
     57            if(is_dir($this->global_cfg['config_location'])) { 
     58                if(!is_writeable($this->global_cfg['config_location'])) { 
     59                    $user = exec('whoami'); 
     60                    $this->error['config_location'] = "Configuration Directory is not writable!". 
     61                        "<br />Please change the location: <a href='config.php?type=tool&display=epm_advanced'>Here</a>". 
     62                        "<br />Or run this command on SSH: 'chown -R ".$user.":".$user." ".$this->global_cfg['config_location']."' then 'chmod -R 777 ".$this->global_cfg['config_location']."'"; 
     63                } 
     64            } else { 
     65                $this->error['config_location'] = "Configuration Directory is not a directory or does not exist! Please change the location here: <a href='config.php?type=tool&display=epm_advanced'>Here</a>"; 
     66            } 
     67        } 
    5268 
    5369        //include the local template class 
    5470        include LOCAL_PATH."includes/rain.tpl.class.php"; 
     71    } 
     72 
     73    function submit_config($brand,$product,$orig_name,$data) { 
     74        $posturl = 'http://www.provisioner.net/submit_config.php'; 
     75        $postvars = 'brand=&product=&origname='.htmlentities(addslashes($orig_name)).'&config_data='.base64_encode($data); 
     76 
     77        $ch = curl_init($posturl); 
     78        curl_setopt($ch, CURLOPT_POST, 1); 
     79        curl_setopt($ch, CURLOPT_POSTFIELDS, $postvars); 
     80        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 
     81        curl_setopt($ch, CURLOPT_HEADER, 0);  // DO NOT RETURN HTTP HEADERS 
     82        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);  // RETURN THE CONTENTS OF THE CALL 
     83        $Rec_Data = curl_exec($ch); 
     84 
     85        ob_start(); 
     86        header("Content-Type: text/html"); 
     87        $Final_Out=ob_get_clean(); 
     88        curl_close($ch); 
     89 
    5590    } 
    5691 
     
    193228            return(FALSE); 
    194229        } 
    195         $sql = "SELECT id,mac,model FROM endpointman_mac_list WHERE model > 0 AND id =".$mac_id; 
     230        $sql = "SELECT id FROM endpointman_mac_list WHERE model > 0 AND id =".$mac_id; 
    196231 
    197232        $res =& $this->db->query($sql); 
    198233        if($res->numRows()) { 
    199234            //Returns Brand Name, Brand Directory, Model Name, Mac Address, Extension (FreePBX), Custom Configuration Template, Custom Configuration Data, Product Name, Product ID, Product Configuration Directory, Product Configuration Version, Product XML name, 
    200             $sql = "SELECT endpointman_mac_list.config_files_override, endpointman_mac_list.global_user_cfg_data, endpointman_model_list.id as model_id, endpointman_brand_list.id as brand_id, endpointman_brand_list.name, endpointman_brand_list.directory, endpointman_model_list.model, endpointman_mac_list.mac, endpointman_line_list.ext, endpointman_mac_list.template_id, endpointman_mac_list.global_custom_cfg_data, endpointman_product_list.long_name, endpointman_product_list.id as product_id, endpointman_product_list.cfg_dir, endpointman_product_list.cfg_ver, endpointman_model_list.template_data, endpointman_model_list.enabled, devices.description, sip.data as secret FROM endpointman_line_list, endpointman_mac_list, endpointman_model_list, endpointman_brand_list, endpointman_product_list, sip, devices WHERE endpointman_mac_list.model = endpointman_model_list.id AND endpointman_brand_list.id = endpointman_model_list.brand AND endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_line_list.ext = sip.id AND sip.keyword = 'secret' AND endpointman_line_list.ext = devices.id AND endpointman_mac_list.id = endpointman_line_list.mac_id AND endpointman_mac_list.id = ". $mac_id; 
     235            $sql = "SELECT endpointman_mac_list.config_files_override, endpointman_mac_list.global_user_cfg_data, endpointman_model_list.id as model_id, endpointman_brand_list.id as brand_id, endpointman_brand_list.name, endpointman_brand_list.directory, endpointman_model_list.model, endpointman_mac_list.mac, endpointman_mac_list.template_id, endpointman_mac_list.global_custom_cfg_data, endpointman_product_list.long_name, endpointman_product_list.id as product_id, endpointman_product_list.cfg_dir, endpointman_product_list.cfg_ver, endpointman_model_list.template_data, endpointman_model_list.enabled FROM endpointman_line_list, endpointman_mac_list, endpointman_model_list, endpointman_brand_list, endpointman_product_list WHERE endpointman_mac_list.model = endpointman_model_list.id AND endpointman_brand_list.id = endpointman_model_list.brand AND endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_mac_list.id = endpointman_line_list.mac_id AND endpointman_mac_list.id = ". $mac_id; 
    201236 
    202237            $phone_info =& $this->db->getRow($sql, array(), DB_FETCHMODE_ASSOC); 
     
    213248 
    214249            } 
     250 
     251            $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; 
     252            $lines_info =& $this->db->getAll($sql, array(), DB_FETCHMODE_ASSOC); 
     253            foreach($lines_info as $line) { 
     254                $phone_info['line'][$line['line']] = $line; 
     255            } 
     256 
     257 
    215258        } else { 
    216259            $sql = "SELECT id, mac, ext FROM endpointman_mac_list WHERE id =".$mac_id; 
     
    439482                            } 
    440483                            $items[$i] = $items; 
    441                             $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($i,$items,$key,$custom_cfg_data); 
     484                            $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($i,$items,$key,$custom_cfg_data,$admin,$user_cfg_data); 
    442485                            $template_variables_array[$group_count]['data'][$variables_count]['looping'] = TRUE; 
    443486                            $variables_count++; 
     
    445488                    } 
    446489                } else { 
    447                     $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($i,$cfg_data,$key,$custom_cfg_data); 
     490                    if(!isset($variables_count)) { 
     491                        $variables_count = 0; 
     492                    } 
     493                    $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($i,$cfg_data,$key,$custom_cfg_data,$admin,$user_cfg_data); 
    448494                    $variables_count++; 
    449495                } 
     
    461507     * @return array 
    462508     */ 
    463     function generate_form_data ($i,$cfg_data,$key,$custom_cfg_data) { 
    464         $admin = TRUE; 
     509    function generate_form_data ($i,$cfg_data,$key,$custom_cfg_data,$admin=FALSE,$user_cfg_data) { 
    465510        if ($cfg_data[$i]['type'] == "input") { 
    466511            if((!$admin) && (isset($user_cfg_data[$key]['value']))) { 
     
    510555        } 
    511556        if(($this->global_cfg['enable_ari']) AND ($admin) AND ($cfg_data[$i]['type'] != "break") AND ($cfg_data[$i]['type'] != "group")) { 
     557            
    512558            $template_variables_array['aried'] = 1; 
    513559            $template_variables_array['ari']['key'] = $key; 
     
    673719        } 
    674720 
    675         //Pretend we have three lines, we could just have one line or 20...whatever the phone supports 
    676         $provisioner_lib->lines[1] = array('ext' => $phone_info['ext'], 'secret' => $phone_info['secret'], 'displayname' => $phone_info['description']); 
     721        //Loop through Lines! 
     722        foreach($phone_info['line'] as $line) { 
     723            $provisioner_lib->lines[$line['line']] = array('ext' => $line['ext'], 'secret' => $line['secret'], 'displayname' => $line['description']); 
     724        } 
     725 
     726        $global_user_cfg_data = unserialize($phone_info['global_user_cfg_data']); 
    677727 
    678728        if(is_array($phone_info['template_data'])) { 
     
    681731            $template_data = unserialize($phone_info['global_custom_cfg_data']); 
    682732        } 
     733 
    683734        $new_template_data = array(); 
    684735        if(is_array($template_data)) { 
    685736            foreach($template_data as $key => $data) { 
    686737                if(array_key_exists('value', $data)) { 
    687                     $new_template_data[$key] = $data['value']; 
     738                    if((isset($template_data[$key]['ari'])) && (isset($global_user_cfg_data[$key]['value']))) { 
     739                       $new_template_data[$key] = $global_user_cfg_data[$key]['value']; 
     740                    } else { 
     741                       $new_template_data[$key] = $data['value']; 
     742                    } 
    688743                } else { 
    689744                    $key = explode('_',$key); 
     
    697752        //line 'global' will set variables that aren't line dependant 
    698753        $provisioner_lib->options = $new_template_data; 
     754 
    699755        //Setting a line variable here...these aren't defined in the template_data.xml file yet. however they will still be parsed 
    700756        //and if they have defaults assigned in a future template_data.xml or in the config file using pipes (|) those will be used, pipes take precedence 
     757        $provisioner_lib->processor_info = "EndPoint Manager Version ".$this->global_cfg['version']; 
    701758 
    702759        // Because every brand is an extension (eventually) of endpoint, you know this function will exist regardless of who it is 
     760        //Start timer 
     761        $time_start = microtime(true); 
    703762        $returned_data = $provisioner_lib->generate_config(); 
    704  
     763        //End timer 
     764        $time_end = microtime(true); 
     765        $time = $time_end - $time_start; 
     766        if($time > 360) { 
     767            $this->error['generate_time'] = "It's taking a awfully long time to generate configs...(".round($time,2)." seconds)"; 
     768        } 
    705769        //Create Directory Structure (If needed) 
    706770        if(isset($provisioner_lib->directory_structure)) { 
     
    744808        } 
    745809 
    746         $provisioner_lib->processor_info = "EndPoint Manager Version ".$this->global_cfg['version']; 
    747  
    748810        //Generate Files 
    749811        foreach($returned_data as $key => $data) { 
     
    828890    /** 
    829891     * Remove firmware from the Hard Drive 
    830      * @param int $id Procut ID 
     892     * @param int $id Product ID 
    831893     */ 
    832894    function remove_firmware($id=NULL) { 
     
    836898        $file_list = explode(",",$files); 
    837899        $i = 0; 
    838         while($i < count($file_list)) { 
    839             unlink($this->global_cfg['config_location'].$file_list[$i]); 
    840             $i++; 
     900        foreach($file_list as $file) { 
     901            if(file_exists($this->global_cfg['config_location'].$file)) { 
     902                unlink($this->global_cfg['config_location'].$file); 
     903            } 
    841904        } 
    842905        $sql = 'UPDATE endpointman_product_list SET firmware_files = "", firmware_vers = "" WHERE id = '.$id; 
     
    846909    /** 
    847910     * Install Firmware for the specified Product Line 
    848      * @param <type> $product_id 
     911     * @param <type> $product_id Product ID 
    849912     */ 
    850913    function install_firmware($product_id) { 
     
    10231086                    } 
    10241087                } else { 
    1025                     $this->error['brand_update_check_local_file'] = "<br/>Error: No Local File for ".$data['name']."!"; 
     1088                    $this->error['brand_update_check_local_file'] = "<br/>Error: No Local File for ".$data['name']."!<br /><br />Learn how to manually upload packages here (it's easy!): <a href='http://projects.colsolgrp.net/documents/28' target='_blank'>Click Here!</a>"; 
    10261089                } 
    10271090            } 
     
    10451108            } 
    10461109        } else { 
    1047             $this->error['brand_update_check_master_file'] = "<br/>Aborting Brand Downloads. Can't Get Master File, Assuming Timeout Issues!"; 
     1110            $this->error['brand_update_check_master_file'] = "<br/>Aborting Brand Downloads. Can't Get Master File, Assuming Timeout Issues!<br /><br />Learn how to manually upload packages here (it's easy!): <a href='http://projects.colsolgrp.net/documents/28' target='_blank'>Click Here!</a>"; 
    10481111        } 
    10491112 
     
    18421905    } 
    18431906 
    1844     function displayExtension($ext = NULL) { 
    1845         if(!isset($ext)) { 
     1907    function displayExtension($line_id = NULL) { 
     1908        if(!isset($line_id)) { 
     1909            $ext = NULL; 
    18461910            $not_added="SELECT devices.id, devices.description FROM devices WHERE tech='sip' AND devices.id not in (SELECT devices.id FROM devices, endpointman_line_list WHERE tech='sip' AND devices.id = endpointman_line_list.ext ) ORDER BY devices.id"; 
    18471911        } else { 
     1912            $sql = 'SELECT ext FROM endpointman_line_list WHERE luid = '.$line_id; 
     1913            $ext = $this->db->getOne($sql); 
    18481914            $not_added="SELECT devices.id, devices.description FROM devices WHERE tech='sip' AND devices.id not in (SELECT devices.id FROM devices, endpointman_line_list WHERE tech='sip' AND devices.id = endpointman_line_list.ext AND endpointman_line_list.ext !=".$ext." ) ORDER BY devices.id"; 
    18491915        } 
  • contributed_modules/modules/endpointman/index.php

    r9907 r10315  
    11<?PHP 
    2 /* 
    3 Endpoint Manager V2 
    4 Copyright (C) 2009-2010  Ed Macri, John Mullinix and Andrew Nagy  
    5  
    6 This program is free software; you can redistribute it and/or 
    7 modify it under the terms of the GNU General Public License 
    8 as published by the Free Software Foundation; either version 2 
    9 of the License, or (at your option) any later version. 
    10  
    11 This program is distributed in the hope that it will be useful, 
    12 but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    14 GNU General Public License for more details. 
    15  
    16 You should have received a copy of the GNU General Public License 
    17 along with this program; if not, write to the Free Software 
    18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. 
    19  
    20 http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 
    21 */ 
     2/** 
     3 * Endpoint Manager Index File 
     4 * 
     5 * @author Andrew Nagy 
     6 * @license MPL / GPLv2 / LGPL 
     7 * @package Endpoint Manager 
     8 */ 
    229include('page.endpointman.php'); 
    23 ?> 
  • contributed_modules/modules/endpointman/install.php

    r10259 r10315  
    11<?PHP 
    2 //ini_set('display_errors', 1); 
    3 //error_reporting(E_ALL); 
    4 /* 
    5 Endpoint Manager V2 
    6 Copyright (C) 2009-2010  Ed Macri, John Mullinix and Andrew Nagy 
    7  
    8 This program is free software; you can redistribute it and/or 
    9 modify it under the terms of the GNU General Public License 
    10 as published by the Free Software Foundation; either version 2 
    11 of the License, or (at your option) any later version. 
    12  
    13 This program is distributed in the hope that it will be useful, 
    14 but WITHOUT ANY WARRANTY; without even the implied warranty of 
    15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    16 GNU General Public License for more details. 
    17  
    18 You should have received a copy of the GNU General Public License 
    19 along with this program; if not, write to the Free Software 
    20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. 
    21  
    22 http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 
    23 */ 
    24  
     2/** 
     3 * Endpoint Manager Installer 
     4 * 
     5 * @author Andrew Nagy 
     6 * @license MPL / GPLv2 / LGPL 
     7 * @package Endpoint Manager 
     8 */ 
    259if (! function_exists("out")) { 
    2610    function out($text) { 
     
    7054 
    7155if(!file_exists(PHONE_MODULES_PATH."setup.php")) { 
    72   copy(LOCAL_PATH."Install/setup.php",PHONE_MODULES_PATH."setup.php"); 
     56  copy(LOCAL_PATH."install/setup.php",PHONE_MODULES_PATH."setup.php"); 
    7357        out("Moving Auto Provisioner Class"); 
    7458} 
     
    9377} 
    9478 
    95 $version = "2.2.8"; 
     79$version = "2.2.9"; 
    9680 
    9781if(ep_table_exists("endpointman_global_vars")) { 
     
    142126    $ver = "2.2.7"; 
    143127} elseif($global_cfg['version'] == '2.2.8') { 
    144   $ver = "2.2.8"; 
     128    $ver = "2.2.8"; 
     129} elseif($global_cfg['version'] == '2.2.9') { 
     130    $ver = "2.2.9"; 
     131} elseif($global_cfg['version'] == '2.3.0') { 
     132    $ver = "2.3.0"; 
     133} elseif($global_cfg['version'] == '2.3.1') { 
     134    $ver = "2.3.1"; 
    145135} else { 
    146136    $ver = "1000"; 
     
    153143    out('Version Identified as '. $ver); 
    154144} 
    155  
    156 if(($ver < "1.9.0") AND ($ver > 0)) { 
     145if(!$new_install) { 
     146 
     147    if(($ver < "1.9.0") AND ($ver > 0)) { 
    157148        out("Please Wait While we upgrade your old setup"); 
    158149        //Expand the value option 
     
    326317 
    327318        out("DONE! You can now use endpoint manager!"); 
    328 
    329  
    330 if ($ver <= "1.9.0") { 
     319   
     320 
     321    if ($ver <= "1.9.0") { 
    331322        out("Locating NMAP + ARP + ASTERISK Executables"); 
    332323 
     
    397388        $sql = "ALTER TABLE endpointman_mac_list CHANGE custom_cfg_data custom_cfg_data TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL"; 
    398389        $db->query($sql); 
    399 
    400 if ($ver <= "1.9.1") { 
     390   
     391    if ($ver <= "1.9.1") { 
    401392        out("Create Custom Configs Table"); 
    402393        $sql = "CREATE TABLE IF NOT EXISTS `endpointman_custom_configs` ( 
     
    452443        $sql = "ALTER TABLE endpointman_mac_list CHANGE custom_cfg_data custom_cfg_data TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL"; 
    453444        $db->query($sql); 
    454 
    455  if ($ver <= "1.9.2") { 
     445   
     446    if ($ver <= "1.9.2") { 
    456447        out('Updating Global Variables'); 
    457  
    458  
    459 if ($ver <= "1.9.9") { 
     448    
     449 
     450    if ($ver <= "1.9.9") { 
    460451        out("Adding Custom Field to OUI List"); 
    461452        $sql = 'ALTER TABLE `endpointman_oui_list` ADD `custom` INT(1) NOT NULL DEFAULT \'0\''; 
     
    500491        $sql = "INSERT INTO cronmanager (module, id, time, freq, lasttime, command) VALUES ('endpointman', 'UPDATES', '23', '24', '0', 'php ".LOCAL_PATH. "includes/update_check.php')"; 
    501492        $db->query($sql); 
    502 
    503 if($ver <= "2.0.0") { 
    504         if(file_exists($amp_conf['AMPWEBROOT']."/recordings")) { 
    505             out("Installing ARI Module"); 
    506             copy(LOCAL_PATH. "Install/phonesettings.module", $amp_conf['AMPWEBROOT']."/recordings/modules/phonesettings.module"); 
    507  
    508             copy(LOCAL_PATH. "templates/javascript/jquery.coda-slider-2.0.js", $amp_conf['AMPWEBROOT']."/recordings/theme/js/jquery.coda-slider-2.0.js"); 
    509  
    510             copy(LOCAL_PATH. "templates/javascript/jquery.easing.1.3.js", $amp_conf['AMPWEBROOT']."/recordings/theme/js/jquery.easing.1.3.js"); 
    511  
    512             copy(LOCAL_PATH. "templates/stylesheets/coda-slider-2.0a.css", $amp_conf['AMPWEBROOT']."/recordings/theme/coda-slider-2.0a.css"); 
    513  
    514  
    515             out("Fixing permissions on ARI module"); 
    516             chmod($amp_conf['AMPWEBROOT']."/recordings/modules/phonesettings.module", 0664); 
    517         } 
    518  
     493    } 
     494    if($ver <= "2.0.0") { 
    519495        out("Locating NMAP + ARP + ASTERISK Executables"); 
    520496        $nmap = find_exec("nmap"); 
     
    586562 
    587563        $new_model_list = array( 
    588             "2" => "1-2-11", 
    589             "3" => "1-2-10", 
    590             "4" => "1-2-9", 
    591             "6" => "4-2-3", 
    592             "7" => "4-3-7", 
    593             "8" => "6-1-1", 
    594             "9" => "6-1-2", 
    595             "10" => "6-1-3", 
    596             "11" => "6-1-4", 
    597             "12"  => "6-1-5", 
    598             "13"  => "6-1-6", 
    599             "15" => "2-1-3", 
    600             "22"  => "4-2-4", 
    601             "23" => "2-1-2", 
    602             "24" => "2-1-1", 
    603             "25" => "2-1-4", 
    604             "26" => "2-1-5", 
    605             "27" => "2-2-1", 
    606             "28" => "2-2-2", 
    607             "29" => "4-2-1", 
    608             "30" => "4-2-5", 
    609             "31" => "4-2-6", 
    610             "32" => "4-2-7", 
    611             "33" => "4-2-2", 
    612             "34" => "4-3-1", 
    613             "35" => "4-3-2", 
    614             "36" => "4-3-3", 
    615             "37" => "4-3-4", 
    616             "38" => "4-3-5", 
    617             "39" => "4-3-6", 
    618             "40" => "4-3-8", 
    619             "41" => "4-3-9", 
    620             "42" => "4-3-10", 
    621             "43" => "4-3-11", 
    622             "44" => "4-3-12", 
    623             "45" => "4-1-1", 
    624             "46" => "4-1-2", 
    625             "47" => "1-2-1", 
    626             "48" => "1-2-2", 
    627             "49" => "1-1-1", 
    628             "50" => "1-1-2", 
    629             "51" => "1-2-3", 
    630             "52" => "1-2-4", 
    631             "53" => "1-2-5", 
    632             "54" => "1-2-6", 
    633             "55" => "1-2-7", 
    634             "56" => "1-2-8", 
    635             "57" => "", 
    636             "58" => "", 
    637             "59" => "", 
    638             "60" => "7-1-1", 
    639             "61" => "7-1-2", 
    640             "62" => "8-1-1", 
    641             "63" => "8-1-2", 
    642             "64" => "8-1-3", 
    643             "65" => "8-1-4", 
    644             "67" => "7-2-1", 
    645             "68" => "7-2-2", 
    646             "69" => "7-2-3", 
    647             "70" => "7-2-4", 
    648             "71" => "7-2-5", 
    649             "72" => "7-2-6" 
     564                "2" => "1-2-11", 
     565                "3" => "1-2-10", 
     566                "4" => "1-2-9", 
     567                "6" => "4-2-3", 
     568                "7" => "4-3-7", 
     569                "8" => "6-1-1", 
     570                "9" => "6-1-2", 
     571                "10" => "6-1-3", 
     572                "11" => "6-1-4", 
     573                "12"  => "6-1-5", 
     574                "13"  => "6-1-6", 
     575                "15" => "2-1-3", 
     576                "22"  => "4-2-4", 
     577                "23" => "2-1-2", 
     578                "24" => "2-1-1", 
     579                "25" => "2-1-4", 
     580                "26" => "2-1-5", 
     581                "27" => "2-2-1", 
     582                "28" => "2-2-2", 
     583                "29" => "4-2-1", 
     584                "30" => "4-2-5", 
     585                "31" => "4-2-6", 
     586                "32" => "4-2-7", 
     587                "33" => "4-2-2", 
     588                "34" => "4-3-1", 
     589                "35" => "4-3-2", 
     590                "36" => "4-3-3", 
     591                "37" => "4-3-4", 
     592                "38" => "4-3-5", 
     593                "39" => "4-3-6", 
     594                "40" => "4-3-8", 
     595                "41" => "4-3-9", 
     596                "42" => "4-3-10", 
     597                "43" => "4-3-11", 
     598                "44" => "4-3-12", 
     599                "45" => "4-1-1", 
     600                "46" => "4-1-2", 
     601                "47" => "1-2-1", 
     602                "48" => "1-2-2", 
     603                "49" => "1-1-1", 
     604                "50" => "1-1-2", 
     605                "51" => "1-2-3", 
     606                "52" => "1-2-4", 
     607                "53" => "1-2-5", 
     608                "54" => "1-2-6", 
     609                "55" => "1-2-7", 
     610                "56" => "1-2-8", 
     611                "57" => "", 
     612                "58" => "", 
     613                "59" => "", 
     614                "60" => "7-1-1", 
     615                "61" => "7-1-2", 
     616                "62" => "8-1-1", 
     617                "63" => "8-1-2", 
     618                "64" => "8-1-3", 
     619                "65" => "8-1-4", 
     620                "67" => "7-2-1", 
     621                "68" => "7-2-2", 
     622                "69" => "7-2-3", 
     623                "70" => "7-2-4", 
     624                "71" => "7-2-5", 
     625                "72" => "7-2-6" 
    650626        ); 
    651627 
     
    658634 
    659635        $new_product_list = array( 
    660             "6" => array("product_id" => "1-1", "model_id" => "1-1-1"), 
    661             "7" => array("product_id" => "1-2", "model_id" => "1-2-1"), 
    662             "1" => array("product_id" => "2-1", "model_id" => "2-1-1"), 
    663             "2" => array("product_id" => "2-2", "model_id" => "2-2-1"), 
    664             "3" => array("product_id" => "4-2", "model_id" => "4-2-1"), 
    665             "5" => array("product_id" => "4-1", "model_id" => "4-1-1"), 
    666             "4" => array("product_id" => "4-3", "model_id" => "4-3-1"), 
    667             "8" => array("product_id" => "6-1", "model_id" => "6-1-1"), 
    668             "9" => array("product_id" => "7-1", "model_id" => "7-1-1"), 
    669             "11" => array("product_id" => "7-2", "model_id" => "7-2-1"), 
    670             "10" => array("product_id" => "8-1", "model_id" => "8-1-1") 
     636                "6" => array("product_id" => "1-1", "model_id" => "1-1-1"), 
     637                "7" => array("product_id" => "1-2", "model_id" => "1-2-1"), 
     638                "1" => array("product_id" => "2-1", "model_id" => "2-1-1"), 
     639                "2" => array("product_id" => "2-2", "model_id" => "2-2-1"), 
     640                "3" => array("product_id" => "4-2", "model_id" => "4-2-1"), 
     641                "5" => array("product_id" => "4-1", "model_id" => "4-1-1"), 
     642                "4" => array("product_id" => "4-3", "model_id" => "4-3-1"), 
     643                "8" => array("product_id" => "6-1", "model_id" => "6-1-1"), 
     644                "9" => array("product_id" => "7-1", "model_id" => "7-1-1"), 
     645                "11" => array("product_id" => "7-2", "model_id" => "7-2-1"), 
     646                "10" => array("product_id" => "8-1", "model_id" => "8-1-1") 
    671647        ); 
    672648 
     
    685661        } 
    686662 
     663        out('WARNING: Config Files have changed MUCH. We have to remove all of your old custom config files. Sorry :-('); 
     664        $db->query('TRUNCATE TABLE `endpointman_custom_configs`'); 
     665 
     666 
     667        exec("rm -Rf ".PHONE_MODULES_PATH); 
     668 
     669        if(!file_exists(PHONE_MODULES_PATH)) { 
     670            mkdir(PHONE_MODULES_PATH, 0764); 
     671            out("Creating Phone Modules Directory"); 
     672        } 
     673 
     674        if(!file_exists(PHONE_MODULES_PATH."setup.php")) { 
     675            copy(LOCAL_PATH."install/setup.php",PHONE_MODULES_PATH."setup.php"); 
     676            out("Moving Auto Provisioner Class"); 
     677        } 
     678 
     679        if(!file_exists(PHONE_MODULES_PATH."temp/")) { 
     680            mkdir(PHONE_MODULES_PATH."temp/", 0764); 
     681            out("Creating temp folder"); 
     682        } 
     683    } 
     684    if ($ver <= "2.2.1") { 
     685    } 
     686 
     687    if ($ver <= "2.2.2") { 
     688 
     689        out("Remove all Dashes in IDs"); 
    687690        $data = array(); 
    688         $data =& $db->getAll("SELECT * FROM  endpointman_custom_configs",array(), DB_FETCHMODE_ASSOC); 
    689         $variable_change = array( 
    690           "{\$srvip}" => "{\$server.ip.1}", 
    691           "{\$ext}" => "{\$ext.line.1}", 
    692           "{\$pass}" => "{\$pass.line.1}", 
    693           "{\$secret}" => "{\$pass.line.1}", 
    694           "{\$displayname}" => "{\$displayname.line.1}" 
    695         ); 
    696  
     691        $data =& $db->getAll("SELECT * FROM `endpointman_model_list",array(), DB_FETCHMODE_ASSOC); 
    697692        foreach($data as $list) { 
    698             foreach($variable_change as $key => $value) { 
    699                 $list['data'] = str_replace($key, $value, $list['data']); 
    700             } 
    701             $sql = "UPDATE endpointman_custom_configs SET data = '".addslashes($list['data'])."' WHERE id = ". $list['id']; 
     693            $new_model_id = str_replace("-", "", $list['id']); 
     694            $sql = "UPDATE endpointman_model_list SET id = '".$new_model_id."' WHERE id = ". $list['id']; 
    702695            $db->query($sql); 
    703696        } 
    704697 
    705         exec("rm -Rf ".PHONE_MODULES_PATH); 
    706  
    707         if(!file_exists(PHONE_MODULES_PATH)) { 
    708                 mkdir(PHONE_MODULES_PATH, 0764); 
    709                 out("Creating Phone Modules Directory"); 
    710         } 
    711  
    712         if(!file_exists(PHONE_MODULES_PATH."setup.php")) { 
    713                 copy(LOCAL_PATH."Install/setup.php",PHONE_MODULES_PATH."setup.php"); 
    714                 out("Moving Auto Provisioner Class"); 
    715         } 
    716  
    717         if(!file_exists(PHONE_MODULES_PATH."temp/")) { 
    718                 mkdir(PHONE_MODULES_PATH."temp/", 0764); 
    719                 out("Creating temp folder"); 
    720         } 
    721 
    722 if ($ver <= "2.2.1") { 
    723 
    724  
    725 if ($ver <= "2.2.2") { 
    726  
    727     out("Remove all Dashes in IDs"); 
    728     $data = array(); 
    729     $data =& $db->getAll("SELECT * FROM `endpointman_model_list",array(), DB_FETCHMODE_ASSOC); 
    730     foreach($data as $list) { 
    731         $new_model_id = str_replace("-", "", $list['id']); 
    732         $sql = "UPDATE endpointman_model_list SET id = '".$new_model_id."' WHERE id = ". $list['id']; 
    733         $db->query($sql); 
    734     } 
    735  
    736     $data = array(); 
    737     $data =& $db->getAll("SELECT * FROM `endpointman_product_list",array(), DB_FETCHMODE_ASSOC); 
    738     foreach($data as $list) { 
    739         $new_product_id = str_replace("-", "", $list['id']); 
    740         $sql = "UPDATE endpointman_product_list SET id = '".$new_product_id."' WHERE id = ". $list['id']; 
    741         $db->query($sql); 
    742     } 
    743  
    744     $data = array(); 
    745     $data =& $db->getAll("SELECT * FROM `endpointman_mac_list",array(), DB_FETCHMODE_ASSOC); 
    746     foreach($data as $list) { 
    747         $new_model_id = str_replace("-", "", $list['model']); 
    748         $sql = "UPDATE endpointman_mac_list SET model = '".$new_model_id."' WHERE id = ". $list['id']; 
    749     $db->query($sql); 
    750     } 
    751  
    752     $data = array(); 
    753     $data =& $db->getAll("SELECT * FROM endpointman_template_list",array(), DB_FETCHMODE_ASSOC); 
    754     foreach($data as $list) { 
    755         $new_model_id = str_replace("-", "", $list['model_id']); 
    756         $new_product_id = str_replace("-", "", $list['product_id']); 
    757         $sql = "UPDATE endpointman_template_list SET model_id = '".$new_model_id."', product_id = '".$new_product_id."' WHERE id = ". $list['id']; 
    758         $db->query($sql); 
    759     } 
    760  
    761     $data = array(); 
    762     $data =& $db->getAll("SELECT * FROM endpointman_custom_configs",array(), DB_FETCHMODE_ASSOC); 
    763     foreach($data as $list) { 
    764         $new_product_id = str_replace("-", "", $list['product_id']); 
    765         $sql = "UPDATE endpointman_custom_configs SET product_id = '".$new_product_id."' WHERE id = ". $list['id']; 
    766         $db->query($sql); 
    767     } 
    768 } if ($ver <= "2.2.3") { 
    769   $sql = 'UPDATE `asterisk`.`endpointman_global_vars` SET `value` = \'http://www.provisioner.net/release/\' WHERE `endpointman_global_vars`.`idnum` = 6 LIMIT 1;'; 
    770   $db->query($sql); 
    771 
    772  
    773 if ($ver <= "2.2.4") { 
    774     out("Fix Debug Left on Error, this turns off debug."); 
    775     $sql = 'UPDATE `asterisk`.`endpointman_global_vars` SET `value` = \'1\' WHERE `endpointman_global_vars`.`idnum` = 9 LIMIT 1;'; 
    776     $db->query($sql); 
    777 
    778  
    779 if ($ver <= "2.2.5") {   
    780     out("Fixing Permissions of Phone Modules Directory"); 
    781     $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(PHONE_MODULES_PATH), RecursiveIteratorIterator::SELF_FIRST); 
    782     foreach($iterator as $item) { 
    783         chmod($item, 0764); 
    784     } 
    785  
    786     out("Creating Endpoint Version Row"); 
    787     $sql = 'INSERT INTO `asterisk`.`endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (NULL, \'endpoint_vers\', \'\');'; 
    788     $db->query($sql); 
    789 
    790  
    791 if ($ver <= "2.2.6") { 
    792     $sql = "CREATE TABLE IF NOT EXISTS `endpointman_line_list` ( 
     698        $data = array(); 
     699        $data =& $db->getAll("SELECT * FROM `endpointman_product_list",array(), DB_FETCHMODE_ASSOC); 
     700        foreach($data as $list) { 
     701            $new_product_id = str_replace("-", "", $list['id']); 
     702            $sql = "UPDATE endpointman_product_list SET id = '".$new_product_id."' WHERE id = ". $list['id']; 
     703            $db->query($sql); 
     704        } 
     705 
     706        $data = array(); 
     707        $data =& $db->getAll("SELECT * FROM `endpointman_mac_list",array(), DB_FETCHMODE_ASSOC); 
     708        foreach($data as $list) { 
     709            $new_model_id = str_replace("-", "", $list['model']); 
     710            $sql = "UPDATE endpointman_mac_list SET model = '".$new_model_id."' WHERE id = ". $list['id']; 
     711            $db->query($sql); 
     712        } 
     713 
     714        $data = array(); 
     715        $data =& $db->getAll("SELECT * FROM endpointman_template_list",array(), DB_FETCHMODE_ASSOC); 
     716        foreach($data as $list) { 
     717            $new_model_id = str_replace("-", "", $list['model_id']); 
     718            $new_product_id = str_replace("-", "", $list['product_id']); 
     719            $sql = "UPDATE endpointman_template_list SET model_id = '".$new_model_id."', product_id = '".$new_product_id."' WHERE id = ". $list['id']; 
     720            $db->query($sql); 
     721        } 
     722 
     723        $data = array(); 
     724        $data =& $db->getAll("SELECT * FROM endpointman_custom_configs",array(), DB_FETCHMODE_ASSOC); 
     725        foreach($data as $list) { 
     726            $new_product_id = str_replace("-", "", $list['product_id']); 
     727            $sql = "UPDATE endpointman_custom_configs SET product_id = '".$new_product_id."' WHERE id = ". $list['id']; 
     728            $db->query($sql); 
     729        } 
     730    } if 
     731    ($ver <= "2.2.3") { 
     732        $sql = "UPDATE endpointman_global_vars SET value = 'http://www.provisioner.net/release/' WHERE var_name = 'update_server'"; 
     733        $db->query($sql); 
     734    } 
     735 
     736    if ($ver <= "2.2.4") { 
     737 
     738    } 
     739 
     740    if ($ver <= "2.2.5") { 
     741        out("Fixing Permissions of Phone Modules Directory"); 
     742        $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(PHONE_MODULES_PATH), RecursiveIteratorIterator::SELF_FIRST); 
     743        foreach($iterator as $item) { 
     744            chmod($item, 0764); 
     745        } 
     746 
     747        out("Creating Endpoint Version Row"); 
     748        $sql = 'INSERT INTO `asterisk`.`endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (NULL, \'endpoint_vers\', \'\');'; 
     749        $db->query($sql); 
     750    } 
     751 
     752    if ($ver <= "2.2.6") { 
     753        $sql = "CREATE TABLE IF NOT EXISTS `endpointman_line_list` ( 
    793754  `luid` int(11) NOT NULL AUTO_INCREMENT, 
    794755  `mac_id` int(11) NOT NULL, 
     
    800761  PRIMARY KEY (`luid`) 
    801762) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;"; 
    802     $db->query($sql); 
    803  
    804     $data = array(); 
    805     $data =& $db->getAll("SELECT * FROM endpointman_mac_list",array(), DB_FETCHMODE_ASSOC); 
    806     foreach($data as $list) { 
    807         $sql = "INSERT INTO endpointman_line_list (mac_id, line, ext, description) VALUES ('".$list['id']."', '1', '".$list['ext']."', '".$list['description']."')"; 
    808         $db->query($sql); 
    809     } 
    810  
    811     $sql = 'ALTER TABLE `endpointman_custom_configs` CHANGE `data` `data` LONGBLOB NOT NULL'; 
    812     $db->query($sql); 
    813  
    814     $sql = 'ALTER TABLE `endpointman_mac_list` DROP `description`'; 
    815     $db->query($sql); 
    816  
    817     $sql = 'ALTER TABLE `endpointman_mac_list` DROP `ext`'; 
    818     $db->query($sql); 
    819  
    820     $sql = 'ALTER TABLE `endpointman_mac_list` CHANGE `custom_cfg_template` `template_id` INT(11) NOT NULL'; 
    821     $db->query($sql); 
    822  
    823     $sql = 'ALTER TABLE `endpointman_mac_list` CHANGE `cfg_template_data` `global_template_id` LONGBLOB NOT NULL'; 
    824     $db->query($sql); 
    825  
    826     $sql = 'ALTER TABLE `endpointman_mac_list` CHANGE `user_cfg_data` `global_user_cfg_data` LONGBLOB NOT NULL'; 
    827     $db->query($sql); 
    828  
    829     $sql = 'ALTER TABLE `endpointman_model_list` ADD `max_lines` SMALLINT(2) NOT NULL AFTER `model`;'; 
    830     $db->query($sql); 
    831  
    832     $sql = 'ALTER TABLE `endpointman_model_list` CHANGE `template_data` `template_data` LONGBLOB NOT NULL'; 
    833     $db->query($sql); 
    834  
    835     $sql = 'ALTER TABLE `endpointman_template_list` CHANGE `custom_cfg_data` `global_custom_cfg_data` LONGBLOB NULL DEFAULT NULL'; 
    836     $db->query($sql); 
    837  
    838     $sql = 'ALTER TABLE `endpointman_mac_list` CHANGE `custom_cfg_data` `global_custom_cfg_data` LONGBLOB NOT NULL'; 
    839     $db->query($sql); 
    840  
     763        $db->query($sql); 
     764 
     765        $data = array(); 
     766        $data =& $db->getAll("SELECT * FROM endpointman_mac_list",array(), DB_FETCHMODE_ASSOC); 
     767        foreach($data as $list) { 
     768            $sql = "INSERT INTO endpointman_line_list (mac_id, line, ext, description) VALUES ('".$list['id']."', '1', '".$list['ext']."', '".$list['description']."')"; 
     769            $db->query($sql); 
     770        } 
     771 
     772        $sql = 'ALTER TABLE `endpointman_custom_configs` CHANGE `data` `data` LONGBLOB NOT NULL'; 
     773        $db->query($sql); 
     774 
     775        $sql = 'ALTER TABLE `endpointman_mac_list` DROP `description`'; 
     776        $db->query($sql); 
     777 
     778        $sql = 'ALTER TABLE `endpointman_mac_list` DROP `ext`'; 
     779        $db->query($sql); 
     780 
     781        $sql = 'ALTER TABLE `endpointman_mac_list` CHANGE `custom_cfg_template` `template_id` INT(11) NOT NULL'; 
     782        $db->query($sql); 
     783 
     784        $sql = 'ALTER TABLE `endpointman_mac_list` CHANGE `cfg_template_data` `global_template_id` LONGBLOB NOT NULL'; 
     785        $db->query($sql); 
     786 
     787        $sql = 'ALTER TABLE `endpointman_mac_list` CHANGE `user_cfg_data` `global_user_cfg_data` LONGBLOB NOT NULL'; 
     788        $db->query($sql); 
     789 
     790        $sql = 'ALTER TABLE `endpointman_model_list` ADD `max_lines` SMALLINT(2) NOT NULL AFTER `model`;'; 
     791        $db->query($sql); 
     792 
     793        $sql = 'ALTER TABLE `endpointman_model_list` CHANGE `template_data` `template_data` LONGBLOB NOT NULL'; 
     794        $db->query($sql); 
     795 
     796        $sql = 'ALTER TABLE `endpointman_template_list` CHANGE `custom_cfg_data` `global_custom_cfg_data` LONGBLOB NULL DEFAULT NULL'; 
     797        $db->query($sql); 
     798 
     799        $sql = 'ALTER TABLE `endpointman_mac_list` CHANGE `custom_cfg_data` `global_custom_cfg_data` LONGBLOB NOT NULL'; 
     800        $db->query($sql); 
     801 
     802    } 
     803 
     804    if ($ver <= "2.2.7") { 
     805 
     806    } 
     807 
     808    if ($ver <= "2.2.8") { 
     809        out("Fix Debug Left on Error, this turns off debug."); 
     810        $sql = "UPDATE endpointman_global_vars SET value = '0' WHERE var_name = 'debug'"; 
     811        $db->query($sql); 
     812 
     813        $sql = 'ALTER TABLE  endpointman_mac_list CHANGE global_user_cfg_data  global_user_cfg_data LONGBLOB NOT NULL'; 
     814        $db->query($sql); 
     815    } 
     816 
     817    if ($ver <= '2.2.9') { 
     818         
     819    } 
    841820} 
    842  
    843 if ($ver <= "2.2.7") { 
    844  
    845 } 
    846  
    847 if ($ver <= "2.2.8") { 
    848  
    849 } 
    850  
    851821 
    852822 
     
    920890  `template_id` int(11) NOT NULL, 
    921891  `global_custom_cfg_data` longblob NOT NULL, 
    922   `global_user_cfg_data` blob NOT NULL, 
     892  `global_user_cfg_data` longblob NOT NULL, 
    923893  `config_files_override` text NOT NULL, 
    924894  PRIMARY KEY (`id`), 
     
    11221092        $db->query($sql); 
    11231093 
    1124         if(file_exists($amp_conf['AMPWEBROOT']."/recordings")) { 
    1125             out("Installing ARI Module"); 
    1126             copy(LOCAL_PATH. "Install/phonesettings.module", $amp_conf['AMPWEBROOT']."/recordings/modules/phonesettings.module"); 
    1127  
    1128             copy(LOCAL_PATH. "templates/javascript/jquery.coda-slider-2.0.js", $amp_conf['AMPWEBROOT']."/recordings/theme/js/jquery.coda-slider-2.0.js"); 
    1129  
    1130             copy(LOCAL_PATH. "templates/javascript/jquery.easing.1.3.js", $amp_conf['AMPWEBROOT']."/recordings/theme/js/jquery.easing.1.3.js"); 
    1131  
    1132             copy(LOCAL_PATH. "templates/stylesheets/coda-slider-2.0a.css", $amp_conf['AMPWEBROOT']."/recordings/theme/coda-slider-2.0a.css"); 
    1133  
    1134  
    1135             out("Fixing permissions on ARI module"); 
    1136             chmod($amp_conf['AMPWEBROOT']."/recordings/modules/phonesettings.module", 0664); 
    1137         } 
     1094    if(file_exists($amp_conf['AMPWEBROOT']."/recordings")) { 
     1095        out("Installing ARI Module"); 
     1096        copy(LOCAL_PATH. "install/phonesettings.module", $amp_conf['AMPWEBROOT']."/recordings/modules/phonesettings.module"); 
     1097 
     1098        mkdir($amp_conf['AMPWEBROOT']."/recordings/theme/js/"); 
     1099 
     1100        copy(LOCAL_PATH. "templates/javascript/jquery.coda-slider-2.0.js", $amp_conf['AMPWEBROOT']."/recordings/theme/js/jquery.coda-slider-2.0.js"); 
     1101 
     1102        copy(LOCAL_PATH. "templates/javascript/jquery.easing.1.3.js", $amp_conf['AMPWEBROOT']."/recordings/theme/js/jquery.easing.1.3.js"); 
     1103 
     1104        copy(LOCAL_PATH. "templates/stylesheets/coda-slider-2.0a.css", $amp_conf['AMPWEBROOT']."/recordings/theme/coda-slider-2.0a.css"); 
     1105 
     1106 
     1107        out("Fixing permissions on ARI module"); 
     1108        chmod($amp_conf['AMPWEBROOT']."/recordings/modules/phonesettings.module", 0664); 
     1109    } 
     1110 
    11381111} else { 
    11391112    out("Update Version Number"); 
    11401113    $sql = "UPDATE endpointman_global_vars SET value = '".$version."' WHERE var_name = 'version'"; 
    11411114    $db->query($sql); 
     1115 
     1116    if(file_exists($amp_conf['AMPWEBROOT']."/recordings")) { 
     1117        out("Installing ARI Module"); 
     1118        copy(LOCAL_PATH. "install/phonesettings.module", $amp_conf['AMPWEBROOT']."/recordings/modules/phonesettings.module"); 
     1119 
     1120        mkdir($amp_conf['AMPWEBROOT']."/recordings/theme/js/"); 
     1121 
     1122        copy(LOCAL_PATH. "templates/javascript/jquery.coda-slider-2.0.js", $amp_conf['AMPWEBROOT']."/recordings/theme/js/jquery.coda-slider-2.0.js"); 
     1123 
     1124        copy(LOCAL_PATH. "templates/javascript/jquery.easing.1.3.js", $amp_conf['AMPWEBROOT']."/recordings/theme/js/jquery.easing.1.3.js"); 
     1125         
     1126        copy(LOCAL_PATH. "templates/stylesheets/coda-slider-2.0a.css", $amp_conf['AMPWEBROOT']."/recordings/theme/coda-slider-2.0a.css"); 
     1127 
     1128 
     1129        out("Fixing permissions on ARI module"); 
     1130        chmod($amp_conf['AMPWEBROOT']."/recordings/modules/phonesettings.module", 0664); 
     1131    } 
    11421132} 
  • contributed_modules/modules/endpointman/installer.html.php

    r10219 r10315  
    11<?PHP 
     2/** 
     3 * Endpoint Manager FreePBX Sub-Module Installer 
     4 * 
     5 * @author Andrew Nagy 
     6 * @license MPL / GPLv2 / LGPL 
     7 * @package Endpoint Manager 
     8 */ 
    29include('includes/installer.php'); 
  • contributed_modules/modules/endpointman/module.xml

    r10262 r10315  
    22  <rawname>endpointman</rawname> 
    33  <name>PBX End Point Manager</name> 
    4   <version>2.2.8</version> 
     4  <version>2.2.9</version> 
    55  <type>tool</type> 
    66  <category>End Point Manager</category> 
     
    2222  <location>contributed_modules/release/endpointman-2.2.8.tgz</location> 
    2323 
    24 <md5sum>8427f7636c2982fad2e5bb52f7c88289</md5sum> 
     24<md5sum>b1341a35ef60d0fad17348803a0a7833</md5sum> 
    2525</module> 
  • contributed_modules/modules/endpointman/page.endpointman.php

    r10218 r10315  
    1 <?php  
     1<?PHP 
     2/** 
     3 * Endpoint Manager Master Page File 
     4 * 
     5 * @author Andrew Nagy 
     6 * @license MPL / GPLv2 / LGPL 
     7 * @package Endpoint Manager 
     8 */ 
    29require_once $amp_conf['AMPWEBROOT'].'/admin/modules/endpointman/config.php'; 
    310 
  • contributed_modules/modules/endpointman/page.epm_advanced.php

    r10218 r10315  
    1 <?php  
     1<?PHP 
     2/** 
     3 * Endpoint Manager FreePBX File 
     4 * 
     5 * @author Andrew Nagy 
     6 * @license MPL / GPLv2 / LGPL 
     7 * @package Endpoint Manager 
     8 */ 
    29require_once $amp_conf['AMPWEBROOT'].'/admin/modules/endpointman/config.php'; 
    310 
  • contributed_modules/modules/endpointman/page.epm_config.php

    r10218 r10315  
    1 <?php  
     1<?PHP 
     2/** 
     3 * Endpoint Manager FreePBX File 
     4 * 
     5 * @author Andrew Nagy 
     6 * @license MPL / GPLv2 / LGPL 
     7 * @package Endpoint Manager 
     8 */ 
    29require_once $amp_conf['AMPWEBROOT'].'/admin/modules/endpointman/config.php'; 
    310 
  • contributed_modules/modules/endpointman/page.epm_devices.php

    r10218 r10315  
    1 <?php 
     1<?PHP 
     2/** 
     3 * Endpoint Manager FreePBX File 
     4 * 
     5 * @author Andrew Nagy 
     6 * @license MPL / GPLv2 / LGPL 
     7 * @package Endpoint Manager 
     8 */ 
    29 
    310require_once $amp_conf['AMPWEBROOT'].'/admin/modules/endpointman/config.php'; 
  • contributed_modules/modules/endpointman/page.epm_templates.php

    r10218 r10315  
    1 <?php  
     1<?PHP 
     2/** 
     3 * Endpoint Manager FreePBX File 
     4 * 
     5 * @author Andrew Nagy 
     6 * @license MPL / GPLv2 / LGPL 
     7 * @package Endpoint Manager 
     8 */ 
    29 
    310require_once $amp_conf['AMPWEBROOT'].'/admin/modules/endpointman/config.php'; 
  • contributed_modules/modules/endpointman/templates/advanced_settings_iedl.html

    r10219 r10315  
    1 <center><h3>{$message}</h3></center> 
     1{if condition="isset($show_error_box)"} 
     2    {include="message_box"} 
     3{/if} 
    24<p><?=_('Export CSV file of devices')?>: 
    35  <br> 
  • contributed_modules/modules/endpointman/templates/advanced_settings_poce.html

    r10227 r10315  
     1{if condition="isset($show_error_box)"} 
     2    {include="message_box"} 
     3{/if} 
    14<center><form method="post" action="config.php{$web_vars}&display=epm_advanced&subpage=poce"> 
    25  <?=_("Select Product")?> 
     
    2023<center><h4><?=_("File Configuration Editor")?></h4> 
    2124<table width="70%" border="0" cellspacing="4" cellpadding="4"> 
     25    <tr><td></td><td><div style="font-size: 14px" align="left">{if condition="isset($location)"}File Location: <i>{$location}</i>{/if}</div></td></tr> 
    2226  <tr> 
    2327    <td valign="top"> 
     
    4650        <textarea name="config_text" id="textarea" cols="100" rows="30" wrap="off">{if condition="isset($config_data)"}{$config_data}{/if}</textarea> 
    4751      </label> 
    48       <br> 
     52      <br><div style="font-size: 15px"> 
    4953      <label> 
    5054        <input type="submit" name="button_save" value="<?=_('Save')?>"> 
     
    5559  <label> 
    5660    <input type="text" name="save_as_name" id="save_as_name" value="{if condition="isset($save_as_name_value)"}{$save_as_name_value}{/if}"> 
    57   </label>{/if} 
    58     </form></td> 
     61  </label>{/if}{if condition="isset($type)"}|| <a href="config.php{$web_vars}&display=epm_advanced&subpage=poce&sendid={$sendid}&filename={$filename}&product_select={$product_selected}&{if condition="$type == 'sql'"}sql={$sendid}{else}file={$sendid}{/if}">Click here to send this configuration file to the Provisioner.net Team</a>{/if}</div> 
     62        </form><div style="font-size: 13px">(Note: 'Save' Saves to the local hard drive, if the phone module is ever updated this file will be over-written, 'Save As' Saves to the database and is not over-written on updates)</div></td> 
     63     
    5964  </tr> 
    6065</table> 
  • contributed_modules/modules/endpointman/templates/advanced_settings_settings.html

    r10233 r10315  
    5353</tr> 
    5454<tr> 
    55   <td align='right'><?=_("Enable FreePBX ARI Module")?></td> 
     55  <td align='right'><?=_("Enable FreePBX ARI Module")?> (<a href="http://projects.colsolgrp.net/documents/29" target="_blank">What?</a>)</td> 
    5656  <td align='left'><label> 
    5757    <input type=checkbox name="enable_ari" {$ari_selected}> 
     
    6464  </label></td> 
    6565</tr> 
     66<!-- 
    6667<tr> 
    6768  <td align='right'><?=_("Enable Nightly Phone Module Updates Check")?></td> 
     
    7071  </label></td> 
    7172</tr> 
     73--> 
    7274<tr> 
    7375<td colspan='2' align='center'><input type='Submit' name='button_update_globals' value='<?=_('Update Globals')?>'></td> 
  • contributed_modules/modules/endpointman/templates/advanced_settings_sh_manager.html

    r10052 r10315  
    1818--> 
    1919</style> 
    20 <?=_('Note: This will show or hide Brands/Products/Models on the Brand Configurations/Setup page ONLY!')?> 
    21 <br /> 
    22 <br /> 
    2320{loop name="brand2_list"} 
    2421<table width="100%" class="brand" border="0" cellspacing="0" cellpadding="0"> 
    2522  <tr> 
    26     <td colspan="2">{$value.name} (<?=_('Version')?> [{$value.cfg_ver}]) <form action='config.php{$web_vars}&display=epm_advanced&subpage=sh_manager' method='POST'><input type="hidden" name="brand" value="{$value.id}"><input type="submit" name="button_{if condition="$value.hidden == '1'"}show{else}hide{/if}" class="button_{if condition="$value.hidden == '1'"}show{else}hide{/if}" value="{if condition="$value.hidden == '1'"}<?=_('Show')?>{else}<?=_('Hide')?>{/if}"></form></td> 
     23    <td colspan="2">{$value.name}<form action='config.php{$web_vars}&display=epm_advanced&subpage=sh_manager' method='POST'><input type="hidden" name="brand" value="{$value.id}"><input type="submit" name="button_{if condition="$value.hidden == '1'"}show{else}hide{/if}" class="button_{if condition="$value.hidden == '1'"}show{else}hide{/if}" value="{if condition="$value.hidden == '1'"}<?=_('Show')?>{else}<?=_('Hide')?>{/if}"></form></td> 
    2724  </tr> 
    2825  <tr> 
     
    3128  <table width="100%" class="product" border="0" cellspacing="0" cellpadding="0"> 
    3229      <tr> 
    33         <td colspan="2">{$value.long_name} {if condition="$value.cfg_ver != ''"}(<?=_('Version')?> [{$value.cfg_ver}]){/if} <form action='config.php{$web_vars}&display=epm_advanced&subpage=sh_manager' method='POST'><input type="hidden" name="product" value="{$value.id}"><input type="submit" name="button_{if condition="$value.hidden == '1'"}show{else}hide{/if}" class="button_{if condition="$value.hidden == '1'"}show{else}hide{/if}" value="{if condition="$value.hidden == '1'"}<?=_('Show')?>{else}<?=_('Hide')?>{/if}"></form></td> 
     30        <td colspan="2">{$value.long_name}<form action='config.php{$web_vars}&display=epm_advanced&subpage=sh_manager' method='POST'><input type="hidden" name="product" value="{$value.id}"><input type="submit" name="button_{if condition="$value.hidden == '1'"}show{else}hide{/if}" class="button_{if condition="$value.hidden == '1'"}show{else}hide{/if}" value="{if condition="$value.hidden == '1'"}<?=_('Show')?>{else}<?=_('Hide')?>{/if}"></form></td> 
    3431      </tr> 
    3532      <tr> 
  • contributed_modules/modules/endpointman/templates/advanced_subheader.html

    r10218 r10315  
    11<table align='center' width='90%'> 
    22<tr> 
    3 <td align='center'><h4><a href='{$web_vars}&display=epm_advanced&subpage=settings'><?=_('Settings')?></a></h4></td> 
    4 <td align='center'><h4><a href='{$web_vars}&display=epm_advanced&subpage=oui_manager'><?=_('OUI Manager')?></a></h4></td> 
    5 <td align='center'><h4><a href='{$web_vars}&display=epm_advanced&subpage=poce'><?=_('Product Options/Configuration Editor')?></a></h4></td> 
     3    <td align='center'>{if condition="$subhead_area == 'settings'"}<h4 style="color:#ff9933;"><?=_('Settings')?></h4>{else}<h4><a href='{$web_vars}&display=epm_advanced&subpage=settings'><?=_('Settings')?></a></h4>{/if}</td> 
     4    <td align='center'>{if condition="$subhead_area == 'oui_manager'"}<h4 style="color:#ff9933;"><?=_('OUI Manager')?></h4>{else}<h4><a href='{$web_vars}&display=epm_advanced&subpage=oui_manager'><?=_('OUI Manager')?></a></h4>{/if}</td> 
     5    <td align='center'>{if condition="$subhead_area == 'poce'"}<h4 style="color:#ff9933;"><?=_('Product Options/Configuration Editor')?></h4>{else}<h4><a href='{$web_vars}&display=epm_advanced&subpage=poce'><?=_('Product Options/Configuration Editor')?></a></h4>{/if}</td> 
    66</tr> 
    77<tr> 
    8     <td align='center'><h4><a href='{$web_vars}&display=epm_advanced&subpage=iedl'><?=_('Import/Export Devices My Devices List')?></a></h4></td> 
    9 <td align='center'><h4><a href='{$web_vars}&display=epm_advanced&subpage=manual_upload'><?=_('Manual Endpoint Modules Upload')?></a></h4></td> 
    10 <td align='center'><h4><a href='{$web_vars}&display=epm_advanced&subpage=sh_manager'><?=_('Show/Hide Brands/Models')?></a></h4></td> 
     8    <td align='center'>{if condition="$subhead_area == 'iedl'"}<h4 style="color:#ff9933;"><?=_('Import/Export Devices My Devices List')?></h4>{else}<h4><a href='{$web_vars}&display=epm_advanced&subpage=iedl'><?=_('Import/Export Devices My Devices List')?></a></h4>{/if}</td> 
     9<td align='center'>{if condition="$subhead_area == 'manual_upload'"}<h4 style="color:#ff9933;"><?=_('Manual Endpoint Modules Upload')?></h4>{else}<h4><a href='{$web_vars}&display=epm_advanced&subpage=manual_upload'><?=_('Manual Endpoint Modules Upload')?></a></h4>{/if}</td> 
     10<td align='center'>{if condition="$subhead_area == 'sh_manager'"}<h4 style="color:#ff9933;"><?=_('Show/Hide Brands/Models')?></h4>{else}<h4><a href='{$web_vars}&display=epm_advanced&subpage=sh_manager'><?=_('Show/Hide Brands/Models')?></a></h4>{/if}</td> 
    1111</tr> 
    1212</table> 
  • contributed_modules/modules/endpointman/templates/template_editor.html

    r10240 r10315  
    9191                                    </td><td width="90%"> 
    9292            {if condition="isset($value.aried)"} 
    93                                         <label><input type='checkbox' name='ari_{$value.ari.key}' {if condition="isset($value.ari.checked)"}{$value.ari.checked}{/if}><?=_('End User Editable (Through ARI Module)')?></label> 
     93                                        <label><input type='checkbox' name='ari_{$value.ari.key}' {if condition="isset($value.ari.checked)"}{$value.ari.checked}{/if}>End User Editable (<a href="http://projects.colsolgrp.net/documents/29" target="_blank">Through ARI Module</a>)</label> 
    9494            {/if} 
    9595                                    </td> 
     
    113113            <input type="submit" name="button_save_template" value="<?=_('Save Template');?>"> 
    114114        </form> 
     115        {include="global_footer"} 
    115116        {/if} 
    116 {include="global_footer"} 
  • contributed_modules/modules/endpointman/uninstall.php

    r10240 r10315  
    11<?PHP 
    2 /* 
    3 Endpoint Manager V2 
    4 Copyright (C) 2009-2010  Ed Macri, John Mullinix and Andrew Nagy  
    5  
    6 This program is free software; you can redistribute it and/or 
    7 modify it under the terms of the GNU General Public License 
    8 as published by the Free Software Foundation; either version 2 
    9 of the License, or (at your option) any later version. 
    10  
    11 This program is distributed in the hope that it will be useful, 
    12 but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    14 GNU General Public License for more details. 
    15  
    16 You should have received a copy of the GNU General Public License 
    17 along with this program; if not, write to the Free Software 
    18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. 
    19  
    20 http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 
    21 */ 
     2/** 
     3 * Endpoint Manager Uninstaller 
     4 * 
     5 * @author Andrew Nagy 
     6 * @license MPL / GPLv2 / LGPL 
     7 * @package Endpoint Manager 
     8 */ 
    229require dirname($_SERVER["SCRIPT_FILENAME"]). "/modules/endpointman/includes/functions.inc"; 
    2310 
     
    7865unlink($amp_conf['AMPWEBROOT']."/recordings/modules/phonesettings.module"); 
    7966 
    80 ?> 
     67unlink($amp_conf['AMPWEBROOT']."/recordings/theme/js/jquery.coda-slider-2.0.js"); 
     68 
     69unlink($amp_conf['AMPWEBROOT']."/recordings/theme/js/jquery.easing.1.3.js"); 
     70 
     71unlink($amp_conf['AMPWEBROOT']."/recordings/theme/coda-slider-2.0a.css");