Changeset 12899
- Timestamp:
- 10/31/11 19:21:05 (2 years ago)
- Files:
-
- modules/branches/2.10/endpointman/config.php (modified) (1 diff)
- modules/branches/2.10/endpointman/includes/abstraction/freepbx.inc (modified) (11 diffs)
- modules/branches/2.10/endpointman/includes/advanced.inc (modified) (20 diffs)
- modules/branches/2.10/endpointman/includes/ajax_post.php (added)
- modules/branches/2.10/endpointman/includes/ajax_select.php (modified) (4 diffs)
- modules/branches/2.10/endpointman/includes/brand_model_manager.inc (modified) (5 diffs)
- modules/branches/2.10/endpointman/includes/databases/freepbxv2.inc (deleted)
- modules/branches/2.10/endpointman/includes/databases/mysql.inc (deleted)
- modules/branches/2.10/endpointman/includes/default.inc (deleted)
- modules/branches/2.10/endpointman/includes/devices_manager.inc (modified) (15 diffs)
- modules/branches/2.10/endpointman/includes/export.php (modified) (1 diff)
- modules/branches/2.10/endpointman/includes/functions.inc (modified) (79 diffs)
- modules/branches/2.10/endpointman/includes/installer.php (modified) (2 diffs)
- modules/branches/2.10/endpointman/includes/oui_list.inc (deleted)
- modules/branches/2.10/endpointman/includes/popup.php (modified) (21 diffs)
- modules/branches/2.10/endpointman/includes/rain.error.php (modified) (1 diff)
- modules/branches/2.10/endpointman/includes/template_manager.inc (modified) (3 diffs)
- modules/branches/2.10/endpointman/includes/update_check.php (deleted)
- modules/branches/2.10/endpointman/module.xml (modified) (2 diffs)
- modules/branches/2.10/endpointman/templates/freepbx29 (added)
- modules/branches/2.10/endpointman/templates/freepbx29/advanced_settings_iedl.html (added)
- modules/branches/2.10/endpointman/templates/freepbx29/advanced_settings_manual_upload.html (added)
- modules/branches/2.10/endpointman/templates/freepbx29/advanced_settings_oui.html (added)
- modules/branches/2.10/endpointman/templates/freepbx29/advanced_settings_poce.html (added)
- modules/branches/2.10/endpointman/templates/freepbx29/advanced_settings_settings.html (added)
- modules/branches/2.10/endpointman/templates/freepbx29/advanced_settings_settings_pop.html (added)
- modules/branches/2.10/endpointman/templates/freepbx29/advanced_settings_sh_manager.html (added)
- modules/branches/2.10/endpointman/templates/freepbx29/advanced_subheader.html (added)
- modules/branches/2.10/endpointman/templates/freepbx29/alt_config_popup.html (added)
- modules/branches/2.10/endpointman/templates/freepbx29/brand_model_manager.html (added)
- modules/branches/2.10/endpointman/templates/freepbx29/compiled (added)
- modules/branches/2.10/endpointman/templates/freepbx29/compiled/advanced_settings_settings_1319361402.php (added)
- modules/branches/2.10/endpointman/templates/freepbx29/compiled/advanced_subheader_1319361402.php (added)
- modules/branches/2.10/endpointman/templates/freepbx29/compiled/brand_model_manager_1319583629.php (added)
- modules/branches/2.10/endpointman/templates/freepbx29/compiled/devices_manager_1319361402.php (added)
- modules/branches/2.10/endpointman/templates/freepbx29/compiled/global_footer_1319361402.php (added)
- modules/branches/2.10/endpointman/templates/freepbx29/compiled/global_header_1319583629.php (added)
- modules/branches/2.10/endpointman/templates/freepbx29/compiled/message_box_1319361402.php (added)
- modules/branches/2.10/endpointman/templates/freepbx29/compiled/template_manager_1318982713.php (added)
- modules/branches/2.10/endpointman/templates/freepbx29/credits.html (moved) (moved from modules/branches/2.10/endpointman/includes/databases/freepbxv3.inc)
- modules/branches/2.10/endpointman/templates/freepbx29/devices_manager.html (added)
- modules/branches/2.10/endpointman/templates/freepbx29/global_footer.html (added)
- modules/branches/2.10/endpointman/templates/freepbx29/global_header.html (added)
- modules/branches/2.10/endpointman/templates/freepbx29/global_links.html (added)
- modules/branches/2.10/endpointman/templates/freepbx29/message_box.html (added)
- modules/branches/2.10/endpointman/templates/freepbx29/specifics_pop.html (added)
- modules/branches/2.10/endpointman/templates/freepbx29/template_editor.html (added)
- modules/branches/2.10/endpointman/templates/freepbx29/template_manager.html (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/branches/2.10/endpointman/config.php
r12708 r12899 32 32 33 33 if(!is_writeable(LOCAL_PATH)) { 34 chmod(LOCAL_PATH, 0764); 34 if(!chmod(LOCAL_PATH, 0764)) { 35 die('My own path is not writable ('.LOCAL_PATH.')'); 36 } 35 37 } 36 38 modules/branches/2.10/endpointman/includes/abstraction/freepbx.inc
r11804 r12899 25 25 } 26 26 27 function sql($sql, $type="query", $fetchmode=null) { 28 global $db; 29 $results = $db->$type($sql, $fetchmode); 30 if (DB::IsError($results)) { 31 $this->sql_error($results); 32 } 33 return $results; 34 } 35 36 function sql_error($results) { 37 echo "<pre>"; 38 var_dump(debug_backtrace()); 39 die($results->getDebugInfo() . "SQL - <br /> $sql"); 40 } 41 27 42 function get_stored_globals() { 28 43 //Get all global variables 29 $temp =& $this->db->getAssoc("SELECT var_name, value FROM endpointman_global_vars"); 44 $temp =& $this->sql("SELECT var_name, value FROM endpointman_global_vars",'getAssoc'); 45 $this->global_cfg = $temp; 30 46 return($temp); 31 47 } 32 48 33 49 function all_products() { 34 $temp =& $this-> db->getAll("SELECT * FROM endpointman_product_list WHERE id > 0",array(),DB_FETCHMODE_ASSOC);50 $temp =& $this->sql("SELECT * FROM endpointman_product_list WHERE id > 0",'getAll',DB_FETCHMODE_ASSOC); 35 51 return($temp); 36 52 } … … 38 54 function all_devices() { 39 55 $sql = 'SELECT endpointman_mac_list.id , endpointman_mac_list.mac , endpointman_model_list.model, endpointman_model_list.enabled , endpointman_brand_list.name, endpointman_mac_list.global_custom_cfg_data, endpointman_mac_list.template_id FROM endpointman_mac_list , endpointman_model_list , endpointman_brand_list WHERE ( endpointman_model_list.id = endpointman_mac_list.model ) AND ( endpointman_model_list.brand = endpointman_brand_list.id )'; 40 $temp =& $this-> db->getAll($sql,array(),DB_FETCHMODE_ASSOC);56 $temp =& $this->sql($sql,'getAll',DB_FETCHMODE_ASSOC); 41 57 return($temp); 42 58 } … … 72 88 function all_models() { 73 89 $sql="SELECT endpointman_model_list.* FROM endpointman_model_list, endpointman_product_list WHERE endpointman_model_list.product_id = endpointman_product_list.id AND endpointman_model_list.enabled = 1 AND endpointman_product_list.hidden = 0"; 74 $result1 =& $this-> db->getAll($sql, array(),DB_FETCHMODE_ASSOC);90 $result1 =& $this->sql($sql, 'getAll',DB_FETCHMODE_ASSOC); 75 91 return($result1); 76 92 } … … 92 108 function all_active_brands() { 93 109 $sql="SELECT DISTINCT endpointman_brand_list.name, endpointman_brand_list.id FROM endpointman_brand_list,endpointman_model_list WHERE endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.enabled = 1 AND endpointman_model_list.hidden = 0 AND endpointman_brand_list.installed = 1 AND endpointman_brand_list.hidden = 0"; 94 $data =& $this-> db->getAll($sql,array(), DB_FETCHMODE_ASSOC);110 $data =& $this->sql($sql,'getAll', DB_FETCHMODE_ASSOC); 95 111 return($data); 96 112 } … … 98 114 function all_models_by_product($product_id) { 99 115 $sql="SELECT * FROM endpointman_model_list WHERE product_id = ".$product_id; 100 $result1 =& $this-> db->getAll($sql, array(),DB_FETCHMODE_ASSOC);116 $result1 =& $this->sql($sql, 'getAll',DB_FETCHMODE_ASSOC); 101 117 return($result1); 102 118 } … … 104 120 function all_models_by_brand($brand_id) { 105 121 $sql="SELECT endpointman_model_list.* FROM endpointman_model_list, endpointman_product_list WHERE endpointman_model_list.product_id = endpointman_product_list.id AND endpointman_model_list.enabled = 1 AND endpointman_product_list.hidden = 0 AND endpointman_model_list.brand = " . $brand_id; 106 $result1 =& $this-> db->getAll($sql, array(),DB_FETCHMODE_ASSOC);122 $result1 =& $this->sql($sql, 'getAll',DB_FETCHMODE_ASSOC); 107 123 return($result1); 108 124 } … … 110 126 function all_unknown_devices() { 111 127 $sql = 'SELECT * FROM endpointman_mac_list WHERE model = 0'; 112 $unknown_list =& $this-> db->getAll($sql,array(),DB_FETCHMODE_ASSOC);128 $unknown_list =& $this->sql($sql,'getAll',DB_FETCHMODE_ASSOC); 113 129 return($unknown_list); 114 130 } … … 120 136 $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"; 121 137 } 122 $result =& $this-> db->getAll($not_added,array(), DB_FETCHMODE_ASSOC);138 $result =& $this->sql($not_added,'getAll', DB_FETCHMODE_ASSOC); 123 139 return($result); 124 140 } … … 126 142 function all_used_registrations() { 127 143 $not_added="SELECT devices.id, devices.description FROM devices WHERE tech='sip' AND devices.id in (SELECT devices.id FROM devices, endpointman_line_list WHERE tech='sip' AND devices.id = endpointman_line_list.ext ) ORDER BY devices.id"; 128 $result =& $this-> db->getAll($not_added,array(), DB_FETCHMODE_ASSOC);144 $result =& $this->sql($not_added,'getAll', DB_FETCHMODE_ASSOC); 129 145 return($result); 130 146 } … … 132 148 function get_lines_from_device($device_id) { 133 149 $sql = 'SELECT * FROM endpointman_line_list WHERE mac_id = '.$device_id. ' ORDER BY endpointman_line_list.line ASC'; 134 $line_list =& $this-> db->getAll($sql,array(),DB_FETCHMODE_ASSOC);150 $line_list =& $this->sql($sql,'getAll',DB_FETCHMODE_ASSOC); 135 151 return($line_list); 136 152 } … … 138 154 function get_line_information($line_id) { 139 155 $sql = 'SELECT * FROM endpointman_line_list WHERE luid = '.$line_id; 140 $line_list =& $this-> db->getRow($sql,array(),DB_FETCHMODE_ASSOC);156 $line_list =& $this->sql($sql,'getRow',DB_FETCHMODE_ASSOC); 141 157 return($line_list); 142 158 } modules/branches/2.10/endpointman/includes/advanced.inc
r12768 r12899 39 39 if($mac = $endpoint->mac_check_clean($device[0])) { 40 40 $sql = "SELECT id FROM endpointman_brand_list WHERE name LIKE '%".$device[1]."%' LIMIT 1"; 41 $res = & $db->query($sql);41 $res = $endpoint->eda->sql($sql); 42 42 if($res->numRows() > 0) { 43 $brand_id = $endpoint-> db->getOne($sql);43 $brand_id = $endpoint->eda->sql($sql, 'getOne'); 44 44 $brand_id = $brand_id[0]; 45 45 … … 53 53 } 54 54 55 $res_model =& $endpoint-> db->query($sql_model);55 $res_model =& $endpoint->eda->sql($sql_model); 56 56 if($res_model->numRows()) { 57 $model_id =& $endpoint-> db->getRow($sql_model,array(), DB_FETCHMODE_ASSOC);57 $model_id =& $endpoint->eda->sql($sql_model,'getRow', DB_FETCHMODE_ASSOC); 58 58 $model_id = $model_id['id']; 59 59 60 $res_ext =& $endpoint-> db->query($sql_ext);60 $res_ext =& $endpoint->eda->sql($sql_ext); 61 61 if($res_ext->numRows()) { 62 $ext =& $endpoint-> db->getRow($sql_ext,array(), DB_FETCHMODE_ASSOC);62 $ext =& $endpoint->eda->sql($sql_ext,'getRow', DB_FETCHMODE_ASSOC); 63 63 $description = $ext['name']; 64 64 $ext = $ext['extension']; … … 98 98 case "manual_upload": 99 99 $sql = "SELECT value FROM endpointman_global_vars WHERE var_name LIKE 'endpoint_vers'"; 100 $provisioner_ver = $endpoint-> db->getOne($sql);100 $provisioner_ver = $endpoint->eda->sql($sql,'getOne'); 101 101 $provisioner_ver = date("n-j-y",$provisioner_ver) . " at " . date("g:ia",$provisioner_ver); 102 102 $endpoint->tpl->assign("provisioner_ver", $provisioner_ver); … … 172 172 $sql = "UPDATE endpointman_product_list SET hidden = 1 WHERE id = '".$_REQUEST['product']."'"; 173 173 } 174 $endpoint-> db->query($sql);174 $endpoint->eda->sql($sql); 175 175 }elseif(isset($_REQUEST['button_show'])) { 176 176 if(isset($_REQUEST['model'])) { … … 181 181 $sql = "UPDATE endpointman_product_list SET hidden = 0 WHERE id = '".$_REQUEST['product']."'"; 182 182 } 183 $endpoint-> db->query($sql);183 $endpoint->eda->sql($sql); 184 184 } 185 185 $sql="SELECT * from endpointman_brand_list WHERE id > 0 ORDER BY id ASC "; 186 $result =& $endpoint-> db->getAll($sql, array(), DB_FETCHMODE_ASSOC);186 $result =& $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); 187 187 $i = 0; 188 188 foreach($result as $row) { … … 192 192 $j = 0; 193 193 $sql = 'SELECT * FROM endpointman_product_list WHERE brand = '.$row['id'].' ORDER BY long_name ASC'; 194 $result2 =& $endpoint-> db->getAll($sql, array(), DB_FETCHMODE_ASSOC);194 $result2 =& $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); 195 195 $xml_data = ""; 196 196 foreach($result2 as $row2) { 197 197 $row_out[$i]['products'][$j] = $row2; 198 198 $sql = 'SELECT * FROM endpointman_model_list WHERE product_id = '.$row2['id']; 199 $result3 =& $endpoint-> db->getAll($sql, array(), DB_FETCHMODE_ASSOC);199 $result3 =& $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); 200 200 $k = 0; 201 201 foreach($result3 as $row3) { … … 215 215 if((isset($_REQUEST['oui_sub'])) AND ($_REQUEST['rb_brand'] > 0) AND ($_REQUEST['oui'] != "")) { 216 216 $sql = "INSERT INTO endpointman_oui_list (oui, brand, custom) VALUES ('".$_REQUEST['oui']."', '".$_REQUEST['rb_brand']."', '1')"; 217 $endpoint-> db->query($sql);217 $endpoint->eda->sql($sql); 218 218 $endpoint->message['oui_manager'] = "Added!"; 219 219 } elseif(isset($_REQUEST['oui_sub'])) { … … 222 222 if((isset($_REQUEST['delete'])) AND ($_REQUEST['id'] > 0)) { 223 223 $sql = "DELETE FROM endpointman_oui_list WHERE id = ". $_REQUEST['id']; 224 $endpoint-> db->query($sql);224 $endpoint->eda->sql($sql); 225 225 $endpoint->message['oui_manager'] = "Deleted!"; 226 226 } 227 227 $sql = 'SELECT endpointman_oui_list.id, endpointman_oui_list.oui , endpointman_brand_list.name FROM endpointman_oui_list , endpointman_brand_list WHERE endpointman_oui_list.brand = endpointman_brand_list.id AND endpointman_oui_list.custom = 0'; 228 $data =& $endpoint-> db->getAll($sql, array(), DB_FETCHMODE_ASSOC);228 $data =& $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); 229 229 $i = 0; 230 230 $row_out = array(); … … 235 235 $endpoint->tpl->assign("oui_list", $row_out); 236 236 $sql = 'SELECT endpointman_oui_list.id, endpointman_oui_list.oui , endpointman_brand_list.name FROM endpointman_oui_list , endpointman_brand_list WHERE endpointman_oui_list.brand = endpointman_brand_list.id AND endpointman_oui_list.custom = 1'; 237 $data = & $endpoint->db->getAll($sql, array(), DB_FETCHMODE_ASSOC);237 $data = $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); 238 238 $i = 0; 239 239 $row_out_custom = array(); … … 249 249 case "poce": 250 250 $sql = 'SELECT * FROM `endpointman_product_list` WHERE `hidden` = 0 AND `id` > 0'; 251 $data =& $endpoint-> db->getAll($sql, array(), DB_FETCHMODE_ASSOC);251 $data =& $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); 252 252 $i = 0; 253 253 foreach($data as $row) { … … 261 261 if(isset($_REQUEST['delete'])) { 262 262 $sql = "DELETE FROM endpointman_custom_configs WHERE id =". $_REQUEST['sql']; 263 $endpoint-> db->query($sql);263 $endpoint->eda->sql($sql); 264 264 $endpoint->message['poce'] = "Deleted!"; 265 265 } 266 266 if(isset($_REQUEST['file'])) { 267 267 $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'] ."'"; 268 $row = & $endpoint->db->getRow($sql, array(), DB_FETCHMODE_ASSOC);268 $row = $endpoint->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); 269 269 270 270 $config_files = explode(",",$row['config_files']); … … 278 278 }elseif(isset($_REQUEST['button_save_as'])) { 279 279 $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']).'")'; 280 $endpoint-> db->query($sql);280 $endpoint->eda->sql($sql); 281 281 $endpoint->message['poce'] = "Saved to Database!"; 282 282 } … … 306 306 if(isset($_REQUEST['button_save'])) { 307 307 $sql = "UPDATE endpointman_custom_configs SET data = '".addslashes($_REQUEST['config_text'])."' WHERE id = ".$_REQUEST['sql']; 308 $endpoint-> db->query($sql);308 $endpoint->eda->sql($sql); 309 309 $endpoint->message['poce'] = "Saved to Database!"; 310 310 }elseif(isset($_REQUEST['button_save_as'])) { 311 311 $sql = 'SELECT original_name FROM endpointman_custom_configs WHERE id = '.$_REQUEST['sql']; 312 $file_name = $endpoint-> db->getOne($sql);312 $file_name = $endpoint->eda->sql($sql,'getOne'); 313 313 314 314 $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'])."')"; 315 $endpoint-> db->query($sql);315 $endpoint->eda->sql($sql); 316 316 $endpoint->message['poce'] = "Saved to Database!"; 317 317 } 318 318 } 319 319 $sql = 'SELECT * FROM endpointman_custom_configs WHERE id =' . $_REQUEST['sql']; 320 $row =& $endpoint-> db->getRow($sql, array(), DB_FETCHMODE_ASSOC);320 $row =& $endpoint->eda->sql($sql, 'getrow', DB_FETCHMODE_ASSOC); 321 321 322 322 if(isset($_REQUEST['sendid'])) { 323 323 $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'] ."'"; 324 $row22 =& $endpoint-> db->getRow($sql, array(), DB_FETCHMODE_ASSOC);324 $row22 =& $endpoint->eda->sql($sql, 'getrow', DB_FETCHMODE_ASSOC); 325 325 $endpoint->submit_config($row22['directory'],$row22['cfg_dir'],$row['original_name'],$row['data']); 326 326 $endpoint->message['poce'] = 'Sent! Thanks! :-)'; … … 338 338 $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'] . "'"; 339 339 340 $row =& $endpoint-> db->getRow($sql, array(), DB_FETCHMODE_ASSOC);340 $row =& $endpoint->eda->sql($sql, 'getrow', DB_FETCHMODE_ASSOC); 341 341 $config_files = explode(",",$row['config_files']); 342 342 $i = 0; … … 347 347 } 348 348 $sql = "SELECT * FROM endpointman_custom_configs WHERE product_id = '". $_REQUEST['product_select'] . "'"; 349 $res =& $endpoint-> db->query($sql);349 $res =& $endpoint->eda->sql($sql); 350 350 $i = 0; 351 351 if($res->numRows()) { 352 $data =& $endpoint-> db->getAll($sql, array(), DB_FETCHMODE_ASSOC);352 $data =& $endpoint->eda->sql($sql, 'getall', DB_FETCHMODE_ASSOC); 353 353 foreach($data as $row2) { 354 354 $sql_file_list[$i]['value'] = $row2['id']; … … 396 396 397 397 $sql = 'SELECT model FROM `endpointman_model_list` WHERE `product_id` LIKE CONVERT(_utf8 \'1-2\' USING latin1) COLLATE latin1_swedish_ci AND `enabled` = 1 AND `hidden` = 0'; 398 $data =& $endpoint-> db->getAll($sql, array(), DB_FETCHMODE_ASSOC);398 $data =& $endpoint->eda->sql($sql, 'getall', DB_FETCHMODE_ASSOC); 399 399 $i = 1; 400 400 foreach($data as $list) { … … 426 426 427 427 $sql="UPDATE endpointman_global_vars SET value='" . $_POST['srvip'] . "' WHERE var_name='srvip'"; 428 $endpoint-> db->query($sql);428 $endpoint->eda->sql($sql); 429 429 $sql="UPDATE endpointman_global_vars SET value='" . $_POST['tz'] . "' WHERE var_name='tz'"; 430 $endpoint-> db->query($sql);430 $endpoint->eda->sql($sql); 431 431 432 432 $sql="UPDATE endpointman_global_vars SET value='" . $_POST['cfg_type'] . "' WHERE var_name='server_type'"; 433 $endpoint-> db->query($sql);433 $endpoint->eda->sql($sql); 434 434 435 435 //No trailing slash. Help the user out and add one :-) … … 442 442 if(is_writable($_POST['config_loc'])) { 443 443 $sql="UPDATE endpointman_global_vars SET value='" . $_POST['config_loc'] . "' WHERE var_name='config_location'"; 444 $endpoint-> db->query($sql);444 $endpoint->eda->sql($sql); 445 445 } else { 446 446 $endpoint->error['config_dir'] = "Directory Not Writable!"; … … 480 480 481 481 $sql="UPDATE endpointman_global_vars SET value='" . $_POST['package_server'] . "' WHERE var_name='update_server'"; 482 $endpoint-> db->query($sql);482 $endpoint->eda->sql($sql); 483 483 484 484 $sql="UPDATE endpointman_global_vars SET value='" . $_POST['allow_hdfiles'] . "' WHERE var_name='allow_hdfiles'"; 485 $endpoint-> db->query($sql);485 $endpoint->eda->sql($sql); 486 486 487 487 $sql="UPDATE endpointman_global_vars SET value='" . $_POST['allow_dupext'] . "' WHERE var_name='show_all_registrations'"; 488 $endpoint-> db->query($sql);488 $endpoint->eda->sql($sql); 489 489 490 490 $sql="UPDATE endpointman_global_vars SET value='" . $_POST['enable_ari'] . "' WHERE var_name='enable_ari'"; 491 $endpoint-> db->query($sql);491 $endpoint->eda->sql($sql); 492 492 493 493 $sql="UPDATE endpointman_global_vars SET value='" . $_POST['enable_debug'] . "' WHERE var_name='debug'"; 494 $endpoint-> db->query($sql);494 $endpoint->eda->sql($sql); 495 495 496 496 $sql="UPDATE endpointman_global_vars SET value='" . $_POST['enable_debug'] . "' WHERE var_name='debug'"; 497 $endpoint-> db->query($sql);497 $endpoint->eda->sql($sql); 498 498 499 499 $sql="UPDATE endpointman_global_vars SET value='" . $_POST['ntp_server'] . "' WHERE var_name='ntp'"; 500 $endpoint-> db->query($sql);500 $endpoint->eda->sql($sql); 501 501 502 502 $sql="UPDATE endpointman_global_vars SET value='" . $_POST['nmap_loc'] . "' WHERE var_name='nmap_location'"; 503 $endpoint-> db->query($sql);503 $endpoint->eda->sql($sql); 504 504 505 505 $sql="UPDATE endpointman_global_vars SET value='" . $_POST['arp_loc'] . "' WHERE var_name='arp_location'"; 506 $endpoint-> db->query($sql);506 $endpoint->eda->sql($sql); 507 507 508 508 $sql="UPDATE endpointman_global_vars SET value='" . $_POST['disable_help'] . "' WHERE var_name='disable_help'"; 509 $endpoint-> db->query($sql);509 $endpoint->eda->sql($sql); 510 510 511 511 if($_POST['cfg_type'] == 'http') { … … 516 516 } 517 517 //Because we are working with global variables we probably updated them, so lets refresh those variables 518 $endpoint->global_cfg = & $db->getAssoc("SELECT var_name, value FROM endpointman_global_vars");518 $endpoint->global_cfg = $endpoint->eda->sql("SELECT var_name, value FROM endpointman_global_vars",'getAssoc'); 519 519 520 520 if($endpoint->global_cfg['server_type'] == 'http') { modules/branches/2.10/endpointman/includes/ajax_select.php
r10797 r12899 12 12 13 13 include 'jsonwrapper.php'; 14 14 15 function in_array_recursive($needle, $haystack) { 15 16 16 $it = new RecursiveIteratorIterator(new RecursiveArrayIterator($haystack)); 17 18 17 foreach($it AS $element) { 19 18 if($element == $needle) { … … 44 43 } elseif(isset($_REQUEST['mac'])) { 45 44 $sql = "SELECT id FROM endpointman_mac_list WHERE mac = '".$endpoint->mac_check_clean($_REQUEST['mac'])."'"; 46 $macid = $endpoint-> db->getOne($sql);45 $macid = $endpoint->eda->sql($sql,'getOne'); 47 46 if($macid) { 48 47 $_REQUEST['mac'] = $macid; … … 70 69 71 70 if(($_REQUEST['atype'] == "lines") && (!isset($_REQUEST['mac'])) && (!isset($_REQUEST['macid']))) { 72 $count = $endpoint-> db->getOne($sql);71 $count = $endpoint->eda->sql($sql,'getOne'); 73 72 for($z=0;$z<$count;$z++) { 74 73 $result[$z]['id'] = $z + 1; … … 80 79 $result = $endpoint->linesAvailable(NULL,$_REQUEST['mac']); 81 80 } else { 82 $result = $endpoint-> db->getAll($sql,array(), DB_FETCHMODE_ASSOC);81 $result = $endpoint->eda->sql($sql,'getAll', DB_FETCHMODE_ASSOC); 83 82 } 84 83 modules/branches/2.10/endpointman/includes/brand_model_manager.inc
r12767 r12899 30 30 $sql = "UPDATE endpointman_brand_list SET enabled = 0 WHERE id = '".$_REQUEST['model']."'"; 31 31 } 32 $endpoint-> db->query($sql);32 $endpoint->eda->sql($sql); 33 33 } elseif(isset($_REQUEST['button_enable'])) { 34 34 if(isset($_REQUEST['model'])) { … … 37 37 $sql = "UPDATE endpointman_brand_list SET enabled = 1 WHERE id = '".$_REQUEST['model']."'"; 38 38 } 39 $endpoint-> db->query($sql);39 $endpoint->eda->sql($sql); 40 40 } elseif(isset($_REQUEST['button_uninstall'])) { 41 41 if(isset($_REQUEST['brand'])) { … … 53 53 54 54 $sql="SELECT * from endpointman_brand_list WHERE id > 0 AND hidden = 0 ORDER BY id ASC "; 55 $brand_list =& $endpoint-> db->getAll($sql,array(),DB_FETCHMODE_ASSOC);55 $brand_list =& $endpoint->eda->sql($sql,'getAll',DB_FETCHMODE_ASSOC); 56 56 $i = 0; 57 57 $note = ""; … … 81 81 $j = 0; 82 82 $sql = 'SELECT * FROM endpointman_product_list WHERE hidden = 0 AND brand = '.$row['id'].' ORDER BY long_name ASC'; 83 $product_list =& $endpoint-> db->getAll($sql,array(),DB_FETCHMODE_ASSOC);83 $product_list =& $endpoint->eda->sql($sql,'getAll',DB_FETCHMODE_ASSOC); 84 84 foreach($product_list as $row2) { 85 85 $row_out[$i]['products'][$j] = $row2; … … 99 99 if(1 == 1) { 100 100 $sql = "SELECT * FROM endpointman_model_list WHERE hidden = 0 AND product_id = '".$row2['id']."'"; 101 $model_list =& $endpoint-> db->getAll($sql,array(),DB_FETCHMODE_ASSOC);101 $model_list =& $endpoint->eda->sql($sql,'getAll',DB_FETCHMODE_ASSOC); 102 102 $k = 0; 103 103 foreach($model_list as $row3) { modules/branches/2.10/endpointman/includes/devices_manager.inc
r12896 r12899 22 22 $mode = NULL; 23 23 24 $family_list =& $endpoint->e ndpoint_data->all_products();25 $full_device_list =& $endpoint->e ndpoint_data->all_devices();24 $family_list =& $endpoint->eda->all_products(); 25 $full_device_list =& $endpoint->eda->all_devices(); 26 26 $ava_exts = $endpoint->display_registration_list(); 27 27 … … 63 63 $template_editor = TRUE; 64 64 $sql = "UPDATE endpointman_mac_list SET model = '".$_REQUEST['model_list']."' WHERE id =".$_REQUEST['edit_id']; 65 $endpoint-> db->query($sql);65 $endpoint->eda->sql($sql); 66 66 if ($_REQUEST['template_list'] == 0) { 67 67 $endpoint->edit_template_display($_REQUEST['edit_id'],1); … … 75 75 $sql = 'SELECT * FROM endpointman_line_list WHERE mac_id = '. $_REQUEST['edit_id']; 76 76 77 $lines_list = $endpoint-> db->getAll($sql,array(),DB_FETCHMODE_ASSOC);77 $lines_list = $endpoint->eda->sql($sql,'getAll',DB_FETCHMODE_ASSOC); 78 78 79 79 foreach($lines_list as $row) { 80 80 $sql = "SELECT description FROM devices WHERE id = ".$_REQUEST['ext_list_'.$row['luid']]; 81 $name = $endpoint-> db->getOne($sql);81 $name = $endpoint->eda->sql($sql,'getOne'); 82 82 83 83 $sql = "UPDATE endpointman_line_list SET line = '".$_REQUEST['line_list_'.$row['luid']]."', ext = '".$_REQUEST['ext_list_'.$row['luid']]."', description = '".$name."' WHERE luid = ". $row['luid']; 84 $endpoint-> db->query($sql);84 $endpoint->eda->sql($sql); 85 85 } 86 86 87 87 $sql = "UPDATE endpointman_mac_list SET template_id = '".$_REQUEST['template_list']."', model = '".$_REQUEST['model_list']."' WHERE id = ". $_REQUEST['edit_id']; 88 $endpoint-> db->query($sql);88 $endpoint->eda->sql($sql); 89 89 90 90 … … 96 96 case "delete": 97 97 $sql = 'SELECT mac_id FROM endpointman_line_list WHERE luid = '.$_REQUEST['edit_id'] ; 98 $mac_id = $endpoint-> db->getOne($sql,array(),DB_FETCHMODE_ASSOC);98 $mac_id = $endpoint->eda->sql($sql,'getOne',DB_FETCHMODE_ASSOC); 99 99 $row = $endpoint->get_phone_info($mac_id); 100 100 … … 120 120 $template_editor = TRUE; 121 121 $sql = "UPDATE endpointman_mac_list SET model = '".$_REQUEST['model_list']."' WHERE id =".$_REQUEST['edit_id']; 122 $endpoint-> db->query($sql);122 $endpoint->eda->sql($sql); 123 123 if ($_REQUEST['template_list'] == 0) { 124 124 $endpoint->edit_template_display($_REQUEST['edit_id'],1); … … 162 162 case "rebuild_configs_for_all_phones" : 163 163 $sql = "SELECT endpointman_mac_list.id FROM endpointman_mac_list, endpointman_brand_list, endpointman_product_list, endpointman_model_list WHERE endpointman_brand_list.id = endpointman_product_list.brand AND endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_mac_list.model = endpointman_model_list.id ORDER BY endpointman_product_list.cfg_dir ASC"; 164 $mac_list =& $endpoint-> db->getAll($sql,array(),DB_FETCHMODE_ASSOC);164 $mac_list =& $endpoint->eda->sql($sql,'getAll',DB_FETCHMODE_ASSOC); 165 165 foreach($mac_list as $data) { 166 166 $phone_info = $endpoint->get_phone_info($data['id']); 167 167 foreach($phone_info['line'] as $line) { 168 168 $sql = "UPDATE endpointman_line_list SET description = '".$line['description']."' WHERE luid = ".$line['luid']; 169 $endpoint-> db->query($sql);169 $endpoint->eda->sql($sql); 170 170 } 171 171 if(isset($_REQUEST['reboot'])) { … … 182 182 if($_REQUEST['rb_brand'] != "") { 183 183 $sql = 'SELECT endpointman_mac_list.id FROM endpointman_mac_list , endpointman_model_list , endpointman_brand_list , endpointman_product_list WHERE endpointman_brand_list.id = endpointman_model_list.brand AND endpointman_model_list.id = endpointman_mac_list.model AND endpointman_model_list.product_id = endpointman_product_list.id AND endpointman_brand_list.id = '.$_REQUEST['rb_brand'].' ORDER BY endpointman_product_list.cfg_dir ASC'; 184 $data =& $endpoint-> db->getAll($sql,array(),DB_FETCHMODE_ASSOC);184 $data =& $endpoint->eda->sql($sql,'getAll',DB_FETCHMODE_ASSOC); 185 185 if(!empty($data)) { 186 186 foreach($data as $row) { … … 242 242 $final[$key]['id'] = $key; 243 243 $sqln = "SELECT * FROM endpointman_model_list WHERE enabled = 1 AND brand =".$data['brand_id']; 244 $model_list =& $endpoint-> db->getAll($sqln,array(),DB_FETCHMODE_ASSOC);244 $model_list =& $endpoint->eda->sql($sqln,'getAll',DB_FETCHMODE_ASSOC); 245 245 $j = 0; 246 246 foreach($model_list as $row) { … … 277 277 foreach($_REQUEST['selected'] as $key => $data) { 278 278 $sql = "UPDATE endpointman_mac_list SET global_custom_cfg_data = '', template_id = 0, global_user_cfg_data = '', config_files_override = '', model = '".$_REQUEST['model_list_selected']."' WHERE id = ". $_REQUEST['selected'][$key]; 279 $endpoint-> db->query($sql);279 $endpoint->eda->sql($sql); 280 280 281 281 $phone_info = $endpoint->get_phone_info($_REQUEST['selected'][$key]); … … 304 304 } else { 305 305 $sql = "SELECT endpointman_mac_list.id FROM endpointman_mac_list, endpointman_brand_list, endpointman_product_list, endpointman_model_list WHERE endpointman_brand_list.id = endpointman_product_list.brand AND endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_mac_list.model = endpointman_model_list.id AND endpointman_product_list.id = '".$_REQUEST['product_select']."'"; 306 $data =& $endpoint-> db->getAll($sql,array(),DB_FETCHMODE_ASSOC);306 $data =& $endpoint->eda->sql($sql,'getAll',DB_FETCHMODE_ASSOC); 307 307 foreach($data as $row) { 308 308 $sql = "UPDATE endpointman_mac_list SET template_id = '".$_REQUEST['template_selector']."' WHERE id = ". $row['id']; 309 $endpoint-> db->query($sql);309 $endpoint->eda->sql($sql); 310 310 $phone_info = $endpoint->get_phone_info($row['id']); 311 311 if(isset($_REQUEST['reboot'])) { … … 318 318 foreach($phone_info['line'] as $line) { 319 319 $sql = "UPDATE endpointman_line_list SET description = '".$line['description']."' WHERE luid = ".$line['luid']; 320 $endpoint-> db->query($sql);320 $endpoint->eda->sql($sql); 321 321 } 322 322 } … … 327 327 328 328 //Refresh the list after processing 329 $devices_list =& $endpoint->e ndpoint_data->all_devices();;329 $devices_list =& $endpoint->eda->all_devices();; 330 330 331 331 $i = 0; … … 338 338 foreach($device_statuses as $key => $data) { 339 339 preg_match('/(\d*)\/[\d]*/i', $data, $extout); 340 if(preg_match('/OK \(.*\)/i', $data)) { 341 $devices_status[$extout[1]] = TRUE; 342 } else { 343 $devices_status[$extout[1]] = FALSE; 340 preg_match('/\b(?:\d{1,3}\.){3}\d{1,3}\b/i', $data, $ipaddress); 341 if(!empty($extout[1])) { 342 if(preg_match('/OK \(.*\)/i', $data)) { 343 $devices_status[$extout[1]]['status'] = TRUE; 344 $devices_status[$extout[1]]['ip'] = $ipaddress[0]; 345 } else { 346 $devices_status[$extout[1]]['status'] = FALSE; 347 } 344 348 } 345 349 } 346 350 347 351 foreach($devices_list as $devices_row) { 348 $line_list =& $endpoint->e ndpoint_data->get_lines_from_device($devices_row['id']);352 $line_list =& $endpoint->eda->get_lines_from_device($devices_row['id']); 349 353 $list[$i] = $devices_row; 350 354 $z = 0; … … 355 359 } else { 356 360 $sql = "SELECT name FROM endpointman_template_list WHERE id =".$devices_row['template_id']; 357 $template_name =& $endpoint-> db->getOne($sql);361 $template_name =& $endpoint->eda->sql($sql,'getOne'); 358 362 $list[$i]['template_name'] = $template_name; 359 363 } … … 372 376 $ext = $list[$i]['line'][0]['ext']; 373 377 374 $list[$i]['status']['status'] = $devices_status[$ext];375 $list[$i]['status']['ip'] = ($ip_info[0] != "(null)") ? $ip_info[0] : '';376 $list[$i]['status']['port'] = ($ip_info[0] != "(null)") ? $ip_info[1] :'';378 $list[$i]['status']['status'] = isset($devices_status[$ext]['status']) ?$devices_status[$ext]['status'] : FALSE; 379 $list[$i]['status']['ip'] = isset($devices_status[$ext]['ip']) ? $devices_status[$ext]['ip'] : FALSE; 380 $list[$i]['status']['port'] = ''; 377 381 $i++; 378 382 } 379 383 380 $unknown_list =& $endpoint->e ndpoint_data->all_unknown_devices();384 $unknown_list =& $endpoint->eda->all_unknown_devices(); 381 385 382 386 foreach($unknown_list as $row) { #Displays unknown phones in the database with edit and delete buttons modules/branches/2.10/endpointman/includes/export.php
r10792 r12899 20 20 $sql = 'SELECT endpointman_mac_list.mac, endpointman_brand_list.name, endpointman_model_list.model, endpointman_line_list.ext,endpointman_line_list.line FROM endpointman_mac_list, endpointman_model_list, endpointman_brand_list, endpointman_line_list WHERE endpointman_line_list.mac_id = endpointman_mac_list.id AND endpointman_model_list.id = endpointman_mac_list.model AND endpointman_model_list.brand = endpointman_brand_list.id'; 21 21 22 $result = $endpoint-> db->getAll($sql,array(),DB_FETCHMODE_ASSOC);22 $result = $endpoint->eda->sql($sql,'getAll',DB_FETCHMODE_ASSOC); 23 23 24 24 foreach($result as $row) { modules/branches/2.10/endpointman/includes/functions.inc
r12829 r12899 15 15 public $error; //error construct 16 16 public $message; //message construct 17 public $e ndpoint_data; //??17 public $eda; //endpoint data abstraction layer 18 18 public $tpl; //Template System Object (RAIN TPL) 19 19 … … 26 26 global $amp_conf; 27 27 require('abstraction/freepbx.inc'); 28 $this->endpoint_data = new epm_data_abstraction(); 29 30 $this->global_cfg = $this->endpoint_data->get_stored_globals(); 31 32 $this->endpoint_data->global_cfg = $this->global_cfg; 28 $this->eda = new epm_data_abstraction(); 29 30 $this->global_cfg = $this->eda->get_stored_globals(); 33 31 34 32 $this->global_cfg['disable_epm'] = FALSE; 35 33 36 $this->db = $this->endpoint_data->db;37 38 //TODO: Need to have this change when the user changes timezones, for now we keep it set to my timezone39 date_default_timezone_set( 'America/Los_Angeles');34 //$this->db = $this->eda->db; 35 36 $this->global_cfg['tz'] = !empty($this->global_cfg['tz']) ? $this->global_cfg['tz'] : 'America/Los_Angeles'; 37 date_default_timezone_set($this->global_cfg['tz']); 40 38 41 39 //Generate empty array … … 117 115 } 118 116 } 119 120 121 $this->tpl = new RainTPL( LOCAL_PATH.'templates/freepbx', LOCAL_PATH.'templates/freepbx/compiled', '/admin/modules/endpointman/templates/images' ); 117 118 $sql = 'SELECT value FROM `admin` WHERE `variable` LIKE CONVERT(_utf8 \'version\' USING latin1) COLLATE latin1_swedish_ci'; 119 120 preg_match('/^(\d*)\.(\d*)/', $this->eda->sql($sql, 'getone'), $versions); 121 122 $this->global_cfg['amp_ver']['major'] = $versions[1]; 123 $this->global_cfg['amp_ver']['minor'] = $versions[2]; 124 125 $suffix = $this->global_cfg['amp_ver']['minor'] < '10' ? '29' : ''; 126 $this->tpl = new RainTPL( LOCAL_PATH.'templates/freepbx'.$suffix, LOCAL_PATH.'templates/freepbx/compiled', '/admin/modules/endpointman/templates/images' ); 122 127 123 128 … … 126 131 } 127 132 128 $sql = 'SELECT value FROM `admin` WHERE `variable` LIKE CONVERT(_utf8 \'version\' USING latin1) COLLATE latin1_swedish_ci'; 129 $this->global_cfg['amp_ver'] = (int)substr(preg_replace('/[^0-9]*/i', '', $this->db->getOne($sql)),0,3); 130 $this->tpl->assign("amp_ver", $this->global_cfg['amp_ver']); 133 134 $this->tpl->assign("amp_ver", $this->global_cfg['amp_ver']['minor']); 131 135 132 136 } … … 258 262 //Find the matching brand model to the oui 259 263 $oui_sql = "SELECT endpointman_brand_list.name, endpointman_brand_list.id FROM endpointman_oui_list, endpointman_brand_list WHERE oui LIKE '%". $oui ."%' AND endpointman_brand_list.id = endpointman_oui_list.brand AND endpointman_brand_list.installed = 1 LIMIT 1"; 260 $brand = $this-> db->getRow($oui_sql, array(), DB_FETCHMODE_ASSOC);261 262 $res = $this-> db->query($oui_sql);264 $brand = $this->eda->sql($oui_sql, 'getRow', DB_FETCHMODE_ASSOC); 265 266 $res = $this->eda->sql($oui_sql); 263 267 $brand_count = $res->numRows(); 264 268 … … 288 292 if($this->sync_model($model)) { 289 293 $sql = "SELECT id,template_id FROM endpointman_mac_list WHERE mac = '".$mac."'"; 290 $dup = $this-> db->getRow($sql,array(),DB_FETCHMODE_ASSOC);294 $dup = $this->eda->sql($sql,'getRow',DB_FETCHMODE_ASSOC); 291 295 292 296 if($dup) { … … 296 300 297 301 $sql = "UPDATE endpointman_mac_list SET model = ".$model.", template_id = ".$template." WHERE id = ".$dup['id']; 298 $this-> db->query($sql);302 $this->eda->sql($sql); 299 303 $return = $this->add_line($dup['id'], $line, $ext); 300 304 if($return) { … … 309 313 310 314 $sql = "SELECT mac_id FROM endpointman_line_list WHERE ext = ".$ext; 311 $used = $this-> db->getOne($sql);315 $used = $this->eda->sql($sql,'getOne'); 312 316 313 317 if(($used) AND (!$this->global_cfg['show_all_registrations'])) { … … 318 322 if(!isset($displayname)) { 319 323 $sql = 'SELECT description FROM devices WHERE id = '.$ext; 320 $name =& $this-> db->getOne($sql);324 $name =& $this->eda->sql($sql,'getOne'); 321 325 } else { 322 326 $name = $displayname; … … 325 329 $sql = 'SELECT endpointman_product_list. * , endpointman_model_list.template_data, endpointman_brand_list.directory FROM endpointman_model_list, endpointman_brand_list, endpointman_product_list WHERE endpointman_model_list.id = \''.$model.'\' AND endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.product_id = endpointman_product_list.id'; 326 330 327 $row =& $this-> db->getRow($sql,array(),DB_FETCHMODE_ASSOC);331 $row =& $this->eda->sql($sql,'getRow',DB_FETCHMODE_ASSOC); 328 332 329 333 $sql = "INSERT INTO `endpointman_mac_list` (`mac`, `model`, `template_id`) VALUES ('".$mac."', '".$model."', '".$template."')"; 330 $this-> db->query($sql);334 $this->eda->sql($sql); 331 335 332 336 $sql = 'SELECT last_insert_id()'; 333 $ext_id =& $this-> db->getOne($sql);337 $ext_id =& $this->eda->sql($sql,'getOne'); 334 338 335 339 if(empty($line)) { … … 338 342 339 343 $sql = "INSERT INTO `endpointman_line_list` (`mac_id`, `ext`, `line`, `description`) VALUES ('".$ext_id."', '".$ext."', '".$line."', '".addslashes($name)."')"; 340 $this-> db->query($sql);344 $this->eda->sql($sql); 341 345 342 346 $this->message['add_device'] = "Added ".$name." to line ".$line; … … 357 361 if((!isset($line)) AND (!isset($ext))) { 358 362 if($this->linesAvailable(NULL,$mac_id)) { 359 if($this->e ndpoint_data->all_unused_registrations()) {363 if($this->eda->all_unused_registrations()) { 360 364 $sql = 'SELECT * FROM endpointman_line_list WHERE mac_id = '. $mac_id; 361 $lines_list = $this-> db->getAll($sql,array(),DB_FETCHMODE_ASSOC);365 $lines_list = $this->eda->sql($sql,'getAll',DB_FETCHMODE_ASSOC); 362 366 363 367 foreach($lines_list as $row) { 364 368 $sql = "SELECT description FROM devices WHERE id = ".$ext; 365 $name=$this-> db->getOne($sql);369 $name=$this->eda->sql($sql,'getOne'); 366 370 367 371 $sql = "UPDATE endpointman_line_list SET line = '".$line."', ext = ".$ext.", description = '".addslashes($name)."' WHERE luid = ". $row['luid']; 368 $this-> db->query($sql);372 $this->eda->sql($sql); 369 373 } 370 374 … … 373 377 374 378 $sql = "SELECT description FROM devices WHERE id = ".$reg[0]['value']; 375 $name = $this-> db->getOne($sql);379 $name = $this->eda->sql($sql,'getOne'); 376 380 377 381 $sql = "INSERT INTO `endpointman_line_list` (`mac_id`, `ext`, `line`, `description`) VALUES ('".$mac_id."', '".$reg[0]['value']."', '".$lines[0]['value']."', '".addslashes($name)."')"; 378 $this-> db->query($sql);382 $this->eda->sql($sql); 379 383 380 384 $this->message['add_line'] = "Added '<i>".$name."</i>' to line '<i>".$lines[0]['value']."</i>' on device '<i>".$reg[0]['value']."</i>' <br/> Configuration Files will not be Generated until you click Save!"; … … 390 394 } elseif((!isset($line)) AND (isset($ext))) { 391 395 if($this->linesAvailable(NULL,$mac_id)) { 392 if($this->e ndpoint_data->all_unused_registrations()) {396 if($this->eda->all_unused_registrations()) { 393 397 $lines = array_values($this->linesAvailable(NULL,$mac_id)); 394 398 395 399 $sql = "INSERT INTO `endpointman_line_list` (`mac_id`, `ext`, `line`, `description`) VALUES ('".$mac_id."', '".$ext."', '".$lines[0]['value']."', '".addslashes($displayname)."')"; 396 $this-> db->query($sql);400 $this->eda->sql($sql); 397 401 398 402 $this->message['add_line'] = "Added '<i>".$name."</i>' to line '<i>".$lines[0]['value']."</i>' on device '<i>".$reg[0]['value']."</i>' <br/> Configuration Files will not be Generated until you click Save!"; … … 408 412 } elseif((isset($line)) AND (isset($ext))) { 409 413 $sql = "SELECT luid FROM endpointman_line_list WHERE line = '".$line."' AND mac_id = ".$mac_id; 410 $luid = $this-> db->getOne($sql);414 $luid = $this->eda->sql($sql,'getOne'); 411 415 if($luid) { 412 416 $this->error['add_line'] = "This line has already been assigned!"; … … 415 419 if(!isset($displayname)) { 416 420 $sql = 'SELECT description FROM devices WHERE id = '.$ext; 417 $name =& $this-> db->getOne($sql);421 $name =& $this->eda->sql($sql,'getOne'); 418 422 } else { 419 423 $name = $displayname; … … 421 425 422 426 $sql = "INSERT INTO `endpointman_line_list` (`mac_id`, `ext`, `line`, `description`) VALUES ('".$mac_id."', '".$ext."', '".$line."', '".addslashes($name)."')"; 423 $this-> db->query($sql);427 $this->eda->sql($sql); 424 428 $this->message['add_line'] .= "Added ".$name." to line ".$line . "<br/>"; 425 429 return($mac_id); … … 431 435 function update_device($macid,$model,$template,$luid=NULL,$name=NULL,$line=NULL,$update_lines=TRUE) { 432 436 $sql = "UPDATE endpointman_mac_list SET model = ".$model.", template_id = ".$temp." WHERE id = ".$macid; 433 $this-> db->query($sql);437 $this->eda->sql($sql); 434 438 435 439 if($update_lines) { … … 447 451 if(isset($luid)) { 448 452 $sql = "SELECT * FROM endpointman_line_list WHERE luid = ".$luid; 449 $row = $this-> db->getRow($sql, array(), DB_FETCHMODE_ASSOC);453 $row = $this->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); 450 454 451 455 if(!isset($name)) { 452 456 $sql = "SELECT description FROM devices WHERE id = ".$row['ext']; 453 $name=$this-> db->getOne($sql);457 $name=$this->eda->sql($sql,'getOne'); 454 458 } 455 459 … … 458 462 } 459 463 $sql = "UPDATE endpointman_line_list SET line = '".$line."', ext = '".$row['ext']."', description = '".$name."' WHERE luid = ". $row['luid']; 460 $this-> db->query($sql);464 $this->eda->sql($sql); 461 465 return(TRUE); 462 466 } else { 463 467 $sql = "SELECT * FROM endpointman_line_list WHERE mac_id = ".$macid; 464 $lines_info = $this-> db->getAll($sql, array(), DB_FETCHMODE_ASSOC);468 $lines_info = $this->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); 465 469 foreach($lines_info as $row) { 466 470 $sql = "SELECT description FROM devices WHERE id = ".$row['ext']; 467 $name=$this-> db->getOne($sql);471 $name=$this->eda->sql($sql,'getOne'); 468 472 469 473 $sql = "UPDATE endpointman_line_list SET line = '".$row['line']."', ext = '".$row['ext']."', description = '".$name."' WHERE luid = ". $row['luid']; 470 $this-> db->query($sql);474 $this->eda->sql($sql); 471 475 } 472 476 return(TRUE); … … 481 485 function delete_line($lineid,$allow_device_remove=FALSE) { 482 486 $sql = 'SELECT mac_id FROM endpointman_line_list WHERE luid = '.$lineid ; 483 $mac_id = $this-> db->getOne($sql,array(),DB_FETCHMODE_ASSOC);487 $mac_id = $this->eda->sql($sql,'getOne',DB_FETCHMODE_ASSOC); 484 488 $row = $this->get_phone_info($mac_id); 485 489 486 490 $sql = 'SELECT COUNT(*) FROM endpointman_line_list WHERE mac_id = '.$mac_id; 487 $num_lines = $this-> db->getOne($sql,array(),DB_FETCHMODE_ASSOC);491 $num_lines = $this->eda->sql($sql,'getOne',DB_FETCHMODE_ASSOC); 488 492 if($num_lines > 1) { 489 493 $sql = "DELETE FROM endpointman_line_list WHERE luid=".$lineid; 490 $this-> db->query($sql);494 $this->eda->sql($sql); 491 495 $this->message['delete_line'] = "Deleted!"; 492 496 return(TRUE); … … 494 498 if($allow_device_remove) { 495 499 $sql = "DELETE FROM endpointman_line_list WHERE luid=".$lineid; 496 $this-> db->query($sql);500 $this->eda->sql($sql); 497 501 498 502 $sql = "DELETE FROM endpointman_mac_list WHERE id=". $mac_id; 499 $this-> db->query($sql);503 $this->eda->sql($sql); 500 504 $this->message['delete_line'] = "Deleted!"; 501 505 return(TRUE); … … 509 513 function delete_device($mac_id) { 510 514 $sql = "DELETE FROM endpointman_mac_list WHERE id=".$mac_id; 511 $this-> db->query($sql);515 $this->eda->sql($sql); 512 516 513 517 $sql = "DELETE FROM endpointman_line_list WHERE mac_id=".$mac_id; 514 $this-> db->query($sql);518 $this->eda->sql($sql); 515 519 $this->message['delete_device'] = "Deleted!"; 516 520 return(TRUE); … … 578 582 $sql = "SELECT id FROM endpointman_mac_list WHERE model > 0 AND id =".$mac_id; 579 583 580 $res = $this-> db->query($sql);584 $res = $this->eda->sql($sql); 581 585 if($res->numRows()) { 582 586 //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, 583 587 $sql = "SELECT endpointman_mac_list.specific_settings, 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, endpointman_mac_list.global_settings_override 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; 584 588 585 $phone_info = $this-> db->getRow($sql, array(), DB_FETCHMODE_ASSOC);589 $phone_info = $this->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); 586 590 587 591 if(!$phone_info) { … … 593 597 $sql = "SELECT name, global_custom_cfg_data, config_files_override, global_settings_override FROM endpointman_template_list WHERE id = ".$phone_info['template_id']; 594 598 595 $phone_info['template_data_info'] = $this-> db->getRow($sql, array(), DB_FETCHMODE_ASSOC);599 $phone_info['template_data_info'] = $this->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); 596 600 597 601 } 598 602 599 603 $sql = "SELECT endpointman_line_list.*, sip.data as secret, devices.*, endpointman_line_list.description AS epm_description 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." ORDER BY endpointman_line_list.line ASC"; 600 $lines_info = $this-> db->getAll($sql, array(), DB_FETCHMODE_ASSOC);604 $lines_info = $this->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); 601 605 foreach($lines_info as $line) { 602 606 $phone_info['line'][$line['line']] = $line; … … 608 612 $sql = "SELECT id, mac, ext FROM endpointman_mac_list WHERE id =".$mac_id; 609 613 //Phone is unknown, we need to display this to the end user so that they can make corrections 610 $row = $this-> db->getRow($sql, array(), DB_FETCHMODE_ASSOC);614 $row = $this->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); 611 615 612 616 $brand = $this->get_brand_from_mac($row['mac']); … … 625 629 $phone_info['mac'] = $row['mac']; 626 630 $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; 627 $lines_info = $this-> db->getAll($sql, array(), DB_FETCHMODE_ASSOC);631 $lines_info = $this->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); 628 632 foreach($lines_info as $line) { 629 633 $phone_info['line'][$line['line']] = $line; … … 651 655 } 652 656 653 $model_id = $this-> db->getOne($sql);657 $model_id = $this->eda->sql($sql,'getOne'); 654 658 655 659 //Make sure the model data from the local confg files are stored in the database and vice-versa. Serious errors will occur if the database is not in sync with the local file … … 666 670 } 667 671 668 $row = $this-> db->getRow($sql, array(), DB_FETCHMODE_ASSOC);672 $row = $this->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); 669 673 670 674 $this->tpl->assign("template_editor_display", 1); … … 706 710 foreach($config_files_list as $files) { 707 711 $sql = "SELECT * FROM endpointman_custom_configs WHERE product_id = '".$row['product_id']."' AND original_name = '".$files."'"; 708 $alt_configs_list_count = $this-> db->query($sql);712 $alt_configs_list_count = $this->eda->sql($sql); 709 713 if($alt_configs_list_count->numRows() > 0) { 710 $alt_configs_list = $this-> db->getAll($sql, array(), DB_FETCHMODE_ASSOC);714 $alt_configs_list = $this->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); 711 715 $alt_configs[$i]['name'] = $files; 712 716 $files = str_replace(".","_",$files); … … 864 868 //$a is the line number 865 869 $sql = "SELECT line FROM endpointman_line_list WHERE ext = ".$ext; 866 $a = $this-> db->getOne($sql);870 $a = $this->eda->sql($sql,'getOne'); 867 871 $template_variables_array[$group_count]['title'] = "Line Options for Line ".$a; 868 872 foreach($config_options['data']['item'] as $items) { … … 1105 1109 1106 1110 //Load template data 1107 $row = $this-> db->getRow($sql, array(), DB_FETCHMODE_ASSOC);1111 $row = $this->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); 1108 1112 1109 1113 $cfg_data = unserialize($row['template_data']); … … 1207 1211 } 1208 1212 1209 $this-> db->query($sql);1213 $this->eda->sql($sql); 1210 1214 1211 1215 $phone_info = array(); … … 1220 1224 } else { 1221 1225 $sql = 'SELECT id FROM endpointman_mac_list WHERE template_id = '.$id; 1222 $phones = $this-> db->getAll($sql, array(), DB_FETCHMODE_ASSOC);1226 $phones = $this->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); 1223 1227 foreach($phones as $data) { 1224 1228 $phone_info = $this->get_phone_info($data['id']); … … 1334 1338 foreach($temp as $list) { 1335 1339 $sql = "SELECT original_name,data FROM endpointman_custom_configs WHERE id = ".$list; 1336 $res = $this-> db->query($sql);1340 $res = $this->eda->sql($sql); 1337 1341 if($res->numRows()) { 1338 $data = $this-> db->getRow($sql, array(),DB_FETCHMODE_ASSOC);1342 $data = $this->eda->sql($sql, 'getRow',DB_FETCHMODE_ASSOC); 1339 1343 $provisioner_lib->config_files_override[$data['original_name']] = $data['data']; 1340 1344 } … … 1348 1352 foreach($temp as $list) { 1349 1353 $sql = "SELECT original_name,data FROM endpointman_custom_configs WHERE id = ".$list; 1350 $res = $this-> db->query($sql);1354 $res = $this->eda->sql($sql); 1351 1355 if($res->numRows()) { 1352 $data = $this-> db->getRow($sql, array(),DB_FETCHMODE_ASSOC);1356 $data = $this->eda->sql($sql, 'getRow',DB_FETCHMODE_ASSOC); 1353 1357 $provisioner_lib->config_files_override[$data['original_name']] = $data['data']; 1354 1358 } … … 1533 1537 function firmware_update_check($id=NULL) { 1534 1538 $sql = "SELECT * FROM endpointman_product_list WHERE id ='". $id."'"; 1535 $row = $this-> db->getRow($sql,array(),DB_FETCHMODE_ASSOC);1539 $row = $this->eda->sql($sql,'getRow',DB_FETCHMODE_ASSOC); 1536 1540 1537 1541 $sql = "SELECT directory FROM endpointman_brand_list WHERE id =". $row['brand']; 1538 $brand_directory = $this-> db->getOne($sql);1542 $brand_directory = $this->eda->sql($sql,'getOne'); 1539 1543 1540 1544 //config drive unknown! … … 1563 1567 function firmware_local_check($id=NULL) { 1564 1568 $sql = "SELECT * FROM endpointman_product_list WHERE hidden = 0 AND id ='". $id ."'"; 1565 $res = $this-> db->query($sql);1569 $res = $this->eda->sql($sql); 1566 1570 1567 1571 if($res->numRows()) { 1568 $row = $this-> db->getRow($sql,array(),DB_FETCHMODE_ASSOC);1572 $row = $this->eda->sql($sql,'getRow',DB_FETCHMODE_ASSOC); 1569 1573 1570 1574 $sql = "SELECT directory FROM endpointman_brand_list WHERE hidden = 0 AND id =". $row['brand']; 1571 $brand_directory = $this-> db->getOne($sql);1575 $brand_directory = $this->eda->sql($sql,'getOne'); 1572 1576 1573 1577 //config drive unknown! … … 1598 1602 function remove_firmware($id) { 1599 1603 $sql = "SELECT firmware_files FROM endpointman_product_list WHERE id =". $id; 1600 $files = $this-> db->getOne($sql);1604 $files = $this->eda->sql($sql,'getOne'); 1601 1605 1602 1606 $file_list = explode(",",$files); … … 1608 1612 } 1609 1613 $sql = 'UPDATE endpointman_product_list SET firmware_files = "", firmware_vers = "" WHERE id = '.$id; 1610 $this-> db->query($sql);1614 $this->eda->sql($sql); 1611 1615 } 1612 1616 … … 1617 1621 function install_firmware($product_id) { 1618 1622 $sql = 'SELECT endpointman_product_list.*, endpointman_brand_list.directory FROM endpointman_product_list, endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id = '.$product_id; 1619 $row = $this-> db->getRow($sql, array(), DB_FETCHMODE_ASSOC);1623 $row = $this->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); 1620 1624 $temp = $this->xml2array(PHONE_MODULES_PATH."endpoint/".$row['directory']."/".$row['cfg_dir']."/family_data.xml"); 1621 1625 if($temp['data']['firmware_ver'] > $row['firmware_vers']) { … … 1649 1653 $list = implode(",", $list); 1650 1654 $sql = "UPDATE endpointman_product_list SET firmware_vers = '".$temp['data']['firmware_ver']."', firmware_files = '".$list."' WHERE id = ". $row['id']; 1651 $this-> db->query($sql);1655 $this->eda->sql($sql); 1652 1656 if(isset($copy_error)) { 1653 1657 echo "<BR />Copy Error Detected! Aborting Install!"; … … 1745 1749 1746 1750 $sql = "SELECT value FROM endpointman_global_vars WHERE var_name LIKE 'endpoint_vers'"; 1747 $data = $this-> db->getOne($sql);1751 $data = $this->eda->sql($sql,'getOne'); 1748 1752 1749 1753 $contents = file_get_contents(UPDATE_PATH."/update_status"); … … 1765 1769 1766 1770 $sql = "UPDATE endpointman_global_vars SET value = '".$endpoint_last_mod."' WHERE var_name = 'endpoint_vers'"; 1767 $this-> db->query($sql);1771 $this->eda->sql($sql); 1768 1772 } 1769 1773 } … … 1774 1778 //Assume that if we can't connect and find the master.xml file then why should we try to find every other file. 1775 1779 if($master_result) { 1776 $row = $this-> db->getAll('SELECT * FROM endpointman_brand_list WHERE id > 0', array(), DB_FETCHMODE_ASSOC);1780 $row = $this->eda->sql('SELECT * FROM endpointman_brand_list WHERE id > 0', 'getAll', DB_FETCHMODE_ASSOC); 1777 1781 1778 1782 foreach($out as $data) { 1779 1783 1780 $local = $this-> db->getOne("SELECT local FROM endpointman_brand_list WHERE directory = '".$data['directory']."'");1784 $local = $this->eda->sql("SELECT local FROM endpointman_brand_list WHERE directory = '".$data['directory']."'",'getOne'); 1781 1785 1782 1786 if(!$local) { … … 1795 1799 1796 1800 foreach($temp['oui_list']['oui'] as $oui) { 1797 $sql = " INSERTINTO endpointman_oui_list (`oui`, `brand`, `custom`) VALUES ('".$oui."', '".$temp['brand_id']."', '0')";1798 $this-> db->query($sql);1801 $sql = "REPLACE INTO endpointman_oui_list (`oui`, `brand`, `custom`) VALUES ('".$oui."', '".$temp['brand_id']."', '0')"; 1802 $this->eda->sql($sql); 1799 1803 1800 1804 } … … 1817 1821 //insert row 1818 1822 $sql = "INSERT INTO endpointman_brand_list (id, name, directory, cfg_ver) VALUES ('".$temp['brand_id']."', '".$temp['name']."', '".$temp['directory']."', '".$version[$brand_name]."')"; 1819 $this-> db->query($sql);1823 $this->eda->sql($sql); 1820 1824 } else { 1821 1825 //in database already! … … 1858 1862 */ 1859 1863 function download_brand($id) { 1860 $row = $this-> db->getAll('SELECT * FROM endpointman_brand_list WHERE id ='.$id, array(), DB_FETCHMODE_ASSOC);1864 $row = $this->eda->sql('SELECT * FROM endpointman_brand_list WHERE id ='.$id, 'getAll', DB_FETCHMODE_ASSOC); 1861 1865 echo "Downloading Brand XML....."; 1862 1866 $result = $this->download_xml(UPDATE_PATH .$row[0]['directory']. "/".$row[0]['directory'].".xml","endpoint/".$row[0]['directory']); … … 1952 1956 $brand_version = max($last_mod, $brand_last_mod); 1953 1957 1954 $b_data = $this-> db->getOne("SELECT id FROM endpointman_brand_list WHERE id='".$brand_id."'", array(), DB_FETCHMODE_ASSOC);1958 $b_data = $this->eda->sql("SELECT id FROM endpointman_brand_list WHERE id = '".$brand_id."'", 'getOne'); 1955 1959 if($b_data) { 1956 1960 echo "Updating data.........."; 1957 1961 $sql = "UPDATE endpointman_brand_list SET local = '".$local."', name = '".$brand_name."', cfg_ver = '".$brand_version."', installed = 1, hidden = 0 WHERE id = ".$brand_id; 1958 $this-> db->query($sql);1962 $this->eda->sql($sql); 1959 1963 } else { 1960 1964 $sql = "INSERT INTO endpointman_brand_list (id, name, directory, cfg_ver, local, installed) VALUES ('".$brand_id."', '".$brand_name."', '".$directory."', '".$brand_version."', '1', '1')"; 1961 $this-> db->query($sql);1965 $this->eda->sql($sql); 1962 1966 } 1963 1967 … … 1971 1975 1972 1976 $family_line_xml = $this->xml2array(PHONE_MODULES_PATH.'/endpoint/'.$directory.'/'.$family_list['directory'].'/family_data.xml'); 1973 1977 1974 1978 $require_firmware = NULL; 1975 1979 if((key_exists('require_firmware', $family_line_xml['data'])) && ($remote) && ($family_line_xml['data']['require_firmware'] == "TRUE")) { … … 1978 1982 } 1979 1983 1980 $data = $this-> db->getOne("SELECT id FROM endpointman_product_list WHERE id='".$brand_id.$family_line_xml['data']['id']."'", array(), DB_FETCHMODE_ASSOC);1984 $data = $this->eda->sql("SELECT id FROM endpointman_product_list WHERE id='".$brand_id.$family_line_xml['data']['id']."'", 'getOne'); 1981 1985 $short_name = preg_replace("/\[(.*?)\]/si", "", $family_line_xml['data']['name']); 1982 1986 if($data) { … … 1986 1990 } 1987 1991 1988 $this-> db->query($sql);1992 $this->eda->sql($sql); 1989 1993 $family_line_xml['data']['model_list'] = $this->fix_single_array_keys($family_line_xml['data']['model_list']); 1990 1994 echo "--Updating Model Lines................<br/>"; … … 1999 2003 $sql = 'SELECT id, global_custom_cfg_data, global_user_cfg_data FROM endpointman_mac_list WHERE model = '.$model_final_id; 2000 2004 $old_data = NULL; 2001 $old_data = $this-> db->getAll($sql, array(), DB_FETCHMODE_ASSOC);2005 $old_data = $this->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); 2002 2006 foreach($old_data as $data) { 2003 2007 $global_custom_cfg_data = unserialize($data['global_custom_cfg_data']); … … 2022 2026 $final_data = serialize($final_data); 2023 2027 $sql = "UPDATE endpointman_mac_list SET global_custom_cfg_data = '".$final_data."' WHERE id =".$data['id']; 2024 $this-> db->query($sql);2028 $this->eda->sql($sql); 2025 2029 echo "Done!<br/>"; 2026 2030 } … … 2058 2062 $final_data = serialize($new_data); 2059 2063 $sql = "UPDATE endpointman_mac_list SET global_user_cfg_data = '".$final_data."' WHERE id =".$data['id']; 2060 $this-> db->query($sql);2064 $this->eda->sql($sql); 2061 2065 echo "Done!<br/>"; 2062 2066 } … … 2064 2068 $old_data = NULL; 2065 2069 $sql = 'SELECT id, global_custom_cfg_data FROM endpointman_template_list WHERE model_id = '.$model_final_id; 2066 $old_data = $this-> db->getAll($sql, array(), DB_FETCHMODE_ASSOC);2070 $old_data = $this->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); 2067 2071 foreach($old_data as $data) { 2068 2072 $global_custom_cfg_data = unserialize($data['global_custom_cfg_data']); … … 2092 2096 } 2093 2097 2094 $m_data = $this-> db->getOne("SELECT id FROM endpointman_model_list WHERE id='".$brand_id.$family_line_xml['data']['id'].$model_list['id']."'", array(), DB_FETCHMODE_ASSOC);2098 $m_data = $this->eda->sql("SELECT id FROM endpointman_model_list WHERE id='".$brand_id.$family_line_xml['data']['id'].$model_list['id']."'", 'getone'); 2095 2099 if($m_data) { 2096 2100 $sql = "UPDATE endpointman_model_list SET max_lines = '".$model_list['lines']."', model = '".$model_list['model']."', template_list = '".$template_list."' WHERE id = '".$brand_id.$family_line_xml['data']['id'].$model_list['id']."'"; … … 2098 2102 $sql = "INSERT INTO endpointman_model_list (`id`, `brand`, `model`, `max_lines`, `product_id`, `template_list`, `enabled`, `hidden`) VALUES ('".$brand_id.$family_line_xml['data']['id'].$model_list['id']."', '".$brand_id."', '".$model_list['model']."', '".$model_list['lines']."', '".$brand_id.$family_line_xml['data']['id']."', '".$template_list."', '0', '0')"; 2099 2103 } 2100 $this->db->query($sql); 2101 2104 $this->eda->sql($sql); 2105 2106 2102 2107 if(!$this->sync_model($brand_id.$family_line_xml['data']['id'].$model_list['id'])) { 2103 2108 echo "System Error in Sync Model Function, Load Failure!<br />"; … … 2108 2113 2109 2114 foreach($temp['data']['brands']['oui_list']['oui'] as $oui) { 2110 $sql = " INSERTINTO endpointman_oui_list (`oui`, `brand`, `custom`) VALUES ('".$oui."', '".$brand_id."', '0')";2111 $this-> db->query($sql);2115 $sql = "REPLACE INTO endpointman_oui_list (`oui`, `brand`, `custom`) VALUES ('".$oui."', '".$brand_id."', '0')"; 2116 $this->eda->sql($sql); 2112 2117 } 2113 2118 … … 2133 2138 function remove_brand($id=NULL,$remove_configs=FALSE) { 2134 2139 $sql = 'SELECT id, firmware_vers FROM endpointman_product_list WHERE brand = '.$id; 2135 $products = $this-> db->getAll($sql, array(), DB_FETCHMODE_ASSOC);2140 $products = $this->eda->sql($sql, 'getall', DB_FETCHMODE_ASSOC); 2136 2141 foreach($products as $data) { 2137 2142 if($data['firmware_vers'] != "") { … … 2140 2145 } 2141 2146 2142 $brand_dir = $this-> db->getOne("SELECT directory FROM endpointman_brand_list WHERE id=".$id);2147 $brand_dir = $this->eda->sql("SELECT directory FROM endpointman_brand_list WHERE id=".$id,'getone'); 2143 2148 $this->rmrf(PHONE_MODULES_PATH."endpoint/".$brand_dir); 2144 2149 2145 2150 $sql = "DELETE FROM endpointman_model_list WHERE brand = '". $id."'"; 2146 $this-> db->query($sql);2151 $this->eda->sql($sql); 2147 2152 2148 2153 $sql = "DELETE FROM endpointman_product_list WHERE brand = '". $id . "'"; 2149 $this-> db->query($sql);2154 $this->eda->sql($sql); 2150 2155 2151 2156 $sql = "DELETE FROM endpointman_oui_list WHERE brand = '". $id . "'"; 2152 $this-> db->query($sql);2157 $this->eda->sql($sql); 2153 2158 2154 2159 $this->rmrf(PHONE_MODULES_PATH .$brand_dir); 2155 2160 $sql = "DELETE FROM endpointman_brand_list WHERE id = ". $id; 2156 2161 2157 $this-> db->query($sql);2162 $this->eda->sql($sql); 2158 2163 } 2159 2164 … … 2164 2169 */ 2165 2170 function sync_model($model) { 2166 if ((!empty($model)) OR ($model > 0)) {2167 $sql = "SELECT * FROM endpointman_model_list WHERE id='" .$model."'";2168 2169 $model_row = $this-> db->getRow($sql, array(),DB_FETCHMODE_ASSOC);2170 2171 $sql = "SELECT * FROM endpointman_product_list WHERE id='" .$model_row['product_id']."'";2172 2173 $product_row = $this-> db->getRow($sql, array(),DB_FETCHMODE_ASSOC);2174 2175 $sql = "SELECT * FROM endpointman_brand_list WHERE id=" .$model_row['brand'];2176 2177 $brand_row = $this-> db->getRow($sql, array(),DB_FETCHMODE_ASSOC);2178 2179 if(!file_exists(PHONE_MODULES_PATH.'/endpoint/'.$brand_row['directory'])) {2180 $this->error['sync_model'] = "Brand Directory '".$brand_row['directory']."' Doesn't Exist! (".PHONE_MODULES_PATH.'/endpoint/'.$brand_row['directory'].")";2171 if ((!empty($model)) OR ($model > 0)) { 2172 $sql = "SELECT * FROM endpointman_model_list WHERE id='" . $model . "'"; 2173 2174 $model_row = $this->eda->sql($sql, 'getrow', DB_FETCHMODE_ASSOC); 2175 2176 $sql = "SELECT * FROM endpointman_product_list WHERE id='" . $model_row['product_id'] . "'"; 2177 2178 $product_row = $this->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); 2179 2180 $sql = "SELECT * FROM endpointman_brand_list WHERE id=" . $model_row['brand']; 2181 2182 $brand_row = $this->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); 2183 2184 if (!file_exists(PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'])) { 2185 $this->error['sync_model'] = "Brand Directory '" . $brand_row['directory'] . "' Doesn't Exist! (" . PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . ")"; 2181 2186 return(FALSE); 2182 }2183 2184 if(!file_exists(PHONE_MODULES_PATH.'/endpoint/'.$brand_row['directory'].'/'.$product_row['cfg_dir'])) {2185 $this->error['sync_model'] = "Product Directory '".$product_row['cfg_dir']."' Doesn't Exist! (".PHONE_MODULES_PATH.'/endpoint/'.$brand_row['directory'].'/'.$product_row['cfg_dir'].")";2187 } 2188 2189 if (!file_exists(PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir'])) { 2190 $this->error['sync_model'] = "Product Directory '" . $product_row['cfg_dir'] . "' Doesn't Exist! (" . PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir'] . ")"; 2186 2191 return(FALSE); 2187 }2188 2189 if(!file_exists(PHONE_MODULES_PATH.'/endpoint/'.$brand_row['directory'].'/'.$product_row['cfg_dir'].'/family_data.xml')) {2190 $this->error['sync_model'] = "File 'family_data.xml Doesn't exist in directory: ".PHONE_MODULES_PATH.'/endpoint/'.$brand_row['directory'].'/'.$product_row['cfg_dir'];2192 } 2193 2194 if (!file_exists(PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir'] . '/family_data.xml')) { 2195 $this->error['sync_model'] = "File 'family_data.xml Doesn't exist in directory: " . PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir']; 2191 2196 return(FALSE); 2192 }2193 2194 $family_line_xml = $this->xml2array(PHONE_MODULES_PATH .'/endpoint/'.$brand_row['directory'].'/'.$product_row['cfg_dir'].'/family_data.xml');2195 2196 if ($product_row['cfg_ver'] <= $family_line_xml['data']['version']) {2197 if (array_key_exists('template_data', $family_line_xml['data']['model_list'])) {2197 } 2198 2199 $family_line_xml = $this->xml2array(PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir'] . '/family_data.xml'); 2200 2201 if ($product_row['cfg_ver'] <= $family_line_xml['data']['version']) { 2202 if (array_key_exists('template_data', $family_line_xml['data']['model_list'])) { 2198 2203 if (is_array($family_line_xml['data']['model_list']['template_data']['files'])) { 2199 2204 $template_list = implode(",", $family_line_xml['data']['model_list']['template_data']['files']); … … 2206 2211 } else { 2207 2212 $key = $this->arraysearchrecursive($model_row['model'], $family_line_xml['data']['model_list'], 'model'); 2208 if ($key === FALSE) {2213 if ($key === FALSE) { 2209 2214 $this->error['sync_model'] = "Can't locate model in family XML file"; 2210 2215 return(FALSE); 2211 2216 } else { 2212 if (is_array($family_line_xml['data']['model_list'][$key[0]]['template_data']['files'])) {2213 $template_list = implode(",", $family_line_xml['data']['model_list'][$key[0]]['template_data']['files']);2217 if (is_array($family_line_xml['data']['model_list'][$key[0]]['template_data']['files'])) { 2218 $template_list = implode(",", $family_line_xml['data']['model_list'][$key[0]]['template_data']['files']); 2214 2219 $template_list_array = $family_line_xml['data']['model_list'][$key[0]]['template_data']['files']; 2215 2220 } else { … … 2221 2226 } 2222 2227 2223 $sql = "UPDATE endpointman_model_list SET max_lines = '" .$maxlines."', template_list = '".$template_list."' WHERE id = '".$model."'";2224 $this-> db->query($sql);2228 $sql = "UPDATE endpointman_model_list SET max_lines = '" . $maxlines . "', template_list = '" . $template_list . "' WHERE id = '" . $model . "'"; 2229 $this->eda->sql($sql); 2225 2230 2226 2231 $version = $family_line_xml['data']['version']; … … 2229 2234 $configuration_files = $family_line_xml['data']['configuration_files']; 2230 2235 2231 $sql = "UPDATE endpointman_product_list SET long_name = '" .$template_list."', short_name = '".$short_name."' , cfg_ver = '".$version."', WHERE id = '".$product_row['id']."'";2232 $this-> db->query($sql);2236 $sql = "UPDATE endpointman_product_list SET long_name = '" . $long_name . "', short_name = '" . $short_name . "' , cfg_ver = '" . $version . "' WHERE id = '" . $product_row['id'] . "'"; 2237 $this->eda->sql($sql); 2233 2238 2234 2239 $template_data_array = array(); 2235 foreach ($template_list_array as $data) {2236 if (file_exists(PHONE_MODULES_PATH.'/endpoint/'.$brand_row['directory'].'/'.$product_row['cfg_dir'].'/'.$data)) {2237 $template_data_xml = $this->xml2array(PHONE_MODULES_PATH .'/endpoint/'.$brand_row['directory'].'/'.$product_row['cfg_dir'].'/'.$data);2240 foreach ($template_list_array as $data) { 2241 if (file_exists(PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir'] . '/' . $data)) { 2242 $template_data_xml = $this->xml2array(PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir'] . '/' . $data); 2238 2243 $template_data_xml = $this->fix_single_array_keys($template_data_xml['template_data']); 2239 2244 $template_data_array = array_merge($template_data_array, $template_data_xml); … … 2241 2246 } 2242 2247 2243 if (file_exists(PHONE_MODULES_PATH .'/endpoint/'.$brand_row['directory'].'/'.$product_row['cfg_dir'].'/template_data_custom.xml')) {2244 $template_data_multi = $this->xml2array(PHONE_MODULES_PATH .'/endpoint/'.$brand_row['directory'].'/'.$product_row['cfg_dir'].'/template_data_custom.xml');2245 if ($template_data_multi) {2248 if (file_exists(PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir'] . '/template_data_custom.xml')) { 2249 $template_data_multi = $this->xml2array(PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir'] . '/template_data_custom.xml'); 2250 if ($template_data_multi) { 2246 2251 $template_data_multi = $this->fix_single_array_keys($template_data_multi['template_data']['item']); 2247 2252 $template_data_array = array_merge($template_data_array, $template_data_multi); … … 2249 2254 } 2250 2255 2251 if (file_exists(PHONE_MODULES_PATH .'/endpoint/'.$brand_row['directory'].'/'.$product_row['cfg_dir'].'/template_data_' . $model_row['model'] . '_custom.xml')) {2256 if (file_exists(PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir'] . '/template_data_' . $model_row['model'] . '_custom.xml')) { 2252 2257 $template_data_multi = $this->xml2array(self::$modules_path . $this->brand_name . "/" . $this->family_line . "/template_data_" . $this->model . "_custom.xml"); 2253 if ($template_data_multi) {2258 if ($template_data_multi) { 2254 2259 $template_data_multi = $this->fix_single_array_keys($template_data_multi['template_data']['item']); 2255 2260 $template_data_array = array_merge($template_data_array, $template_data_multi); … … 2257 2262 } 2258 2263 2259 if (empty($template_data_array)) {2264 if (empty($template_data_array)) { 2260 2265 $this->error['sync_model'] = "No Template Data Found"; 2261 2266 return(FALSE); 2262 2267 } 2263 2268 2264 $sql = "UPDATE endpointman_model_list SET template_data = '" .serialize($template_data_array)."' WHERE id = '".$model."'";2265 $this-> db->query($sql);2269 $sql = "UPDATE endpointman_model_list SET template_data = '" . serialize($template_data_array) . "' WHERE id = '" . $model . "'"; 2270 $this->eda->sql($sql); 2266 2271 } 2267 2272 … … 2420 2425 global $amp_conf; 2421 2426 $sql = "SHOW TABLES FROM ".$amp_conf['AMPDBNAME']; 2422 $result = $this-> db->getAll($sql);2427 $result = $this->eda->sql($sql,'getAll'); 2423 2428 2424 2429 foreach($result as $row) { … … 2672 2677 $oui_sql = "SELECT endpointman_brand_list.name, endpointman_brand_list.id FROM endpointman_oui_list, endpointman_brand_list WHERE oui LIKE '%". $oui ."%' AND endpointman_brand_list.id = endpointman_oui_list.brand AND endpointman_brand_list.installed = 1 LIMIT 1"; 2673 2678 2674 $brand = $this-> db->getRow($oui_sql, array(), DB_FETCHMODE_ASSOC);2679 $brand = $this->eda->sql($oui_sql, 'getRow', DB_FETCHMODE_ASSOC); 2675 2680 2676 $res = $this-> db->query($oui_sql);2681 $res = $this->eda->sql($oui_sql); 2677 2682 $brand_count = $res->numRows(); 2678 2683 … … 2685 2690 //Find out if endpoint has already been configured for this mac address 2686 2691 $epm_sql = "SELECT * FROM endpointman_mac_list WHERE mac LIKE '%". $mac_strip ."%'"; 2687 $epm_row = $this-> db->getRow($epm_sql, array(), DB_FETCHMODE_ASSOC);2688 2689 $res = $this-> db->query($epm_sql);2692 $epm_row = $this->eda->sql($epm_sql, 'getRow', DB_FETCHMODE_ASSOC); 2693 2694 $res = $this->eda->sql($epm_sql); 2690 2695 $epm_count = $res->numRows(); 2691 2696 … … 2713 2718 function areaAvailable($model,$area=NULL) { 2714 2719 $sql = "SELECT max_lines FROM endpointman_model_list WHERE id = '". $model."'"; 2715 $count = $this-> db->getOne($sql);2720 $count = $this->eda->sql($sql,'getOne'); 2716 2721 2717 2722 for($z=0;$z<$count;$z++) { … … 2747 2752 2748 2753 if ((!isset($oui)) && (!isset($brand)) && (!isset($model))) { 2749 $result1 = $this->e ndpoint_data->all_models();2754 $result1 = $this->eda->all_models(); 2750 2755 }elseif((isset($brand)) && ($brand !=0)) { 2751 $result1 = $this->e ndpoint_data->all_models_by_brand($brand);2756 $result1 = $this->eda->all_models_by_brand($brand); 2752 2757 }elseif((isset($product)) && ($product !=0)) { 2753 $result1 = $this->e ndpoint_data->all_models_by_product($product);2754 } else { 2755 $result1 = $this->e ndpoint_data->all_models();2758 $result1 = $this->eda->all_models_by_product($product); 2759 } else { 2760 $result1 = $this->eda->all_models(); 2756 2761 } 2757 2762 … … 2797 2802 2798 2803 $sql_l = "SELECT line, mac_id FROM `endpointman_line_list` WHERE luid = ".$lineid; 2799 $line = $this-> db->getRow($sql_l, array(), DB_FETCHMODE_ASSOC);2804 $line = $this->eda->sql($sql_l, 'getRow', DB_FETCHMODE_ASSOC); 2800 2805 2801 2806 $sql_lu = "SELECT line FROM endpointman_line_list WHERE mac_id = ".$line['mac_id']; … … 2807 2812 } 2808 2813 2809 $max_lines = $this-> db->getOne($sql);2810 $lines_used = $this-> db->getAll($sql_lu);2814 $max_lines = $this->eda->sql($sql,'getOne'); 2815 $lines_used = $this->eda->sql($sql_lu,'getAll'); 2811 2816 2812 2817 for($i = 1; $i <= $max_lines; $i++) { … … 2836 2841 2837 2842 if(isset($line_id)) { 2838 $result = $this->e ndpoint_data->all_unused_registrations();2839 $line_data = $this->e ndpoint_data->get_line_information($line_id);2840 } else { 2841 $result = $this->e ndpoint_data->all_unused_registrations();2843 $result = $this->eda->all_unused_registrations(); 2844 $line_data = $this->eda->get_line_information($line_id); 2845 } else { 2846 $result = $this->eda->all_unused_registrations(); 2842 2847 $line_data = NULL; 2843 2848 } … … 2866 2871 */ 2867 2872 function brands_available ($selected = NULL,$show_blank=TRUE) { 2868 $data = $this->e ndpoint_data->all_active_brands();2873 $data = $this->eda->all_active_brands(); 2869 2874 if($show_blank) { 2870 2875 $temp[0]['value'] = ""; … … 2891 2896 $sql="SELECT id FROM endpointman_product_list WHERE endpointman_product_list.id ='".$product_id."'"; 2892 2897 2893 $id = $this-> db->getOne($sql);2898 $id = $this->eda->sql($sql,'getOne'); 2894 2899 2895 2900 $sql="SELECT * FROM endpointman_template_list WHERE product_id = '".$id."'"; 2896 2901 2897 $data = $this-> db->getAll($sql,array(), DB_FETCHMODE_ASSOC);2902 $data = $this->eda->sql($sql,'getAll', DB_FETCHMODE_ASSOC); 2898 2903 foreach($data as $row) { 2899 2904 $temp[$i]['value'] = $row['id']; … … 2915 2920 } 2916 2921 2917 function listTZ($selected) { 2918 /** 2919 $sql="SELECT tz FROM endpointman_time_zones"; 2920 $data = $this->db->getAll($sql,array(), DB_FETCHMODE_ASSOC); 2921 * 2922 * 2923 */ 2924 2922 function listTZ($selected) { 2925 2923 require('timezone.php'); 2926 2924 $data = DateTimeZone::listIdentifiers(); modules/branches/2.10/endpointman/includes/installer.php
r12052 r12899 35 35 case "export_brand": 36 36 $sql = 'SELECT `name`, `directory` FROM `endpointman_brand_list` WHERE `id` = '.$_REQUEST['package'].''; 37 $row = $endpoint-> db->getRow($sql, array(), DB_FETCHMODE_ASSOC);37 $row = $endpoint->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); 38 38 echo "Exporting ". $row['name']."<br/>"; 39 39 if(!file_exists(PHONE_MODULES_PATH."/temp/export/")) { … … 78 78 echo "Updating Last Modified <br />"; 79 79 $sql = "UPDATE endpointman_global_vars SET value = '".$endpoint_last_mod."' WHERE var_name = 'endpoint_vers'"; 80 $endpoint-> db->query($sql);80 $endpoint->eda->sql($sql); 81 81 } 82 82 break; modules/branches/2.10/endpointman/includes/popup.php
r12430 r12899 17 17 } 18 18 $sql = "UPDATE endpointman_mac_list SET specific_settings = '".serialize($final)."' WHERE id =". $_REQUEST['edit_id']; 19 $endpoint-> db->query($sql);19 $endpoint->eda->sql($sql); 20 20 } 21 21 … … 48 48 $template_editor = TRUE; 49 49 $sql = "UPDATE endpointman_mac_list SET model = '".$_REQUEST['model_list']."' WHERE id =".$_REQUEST['edit_id']; 50 $endpoint-> db->query($sql);50 $endpoint->eda->sql($sql); 51 51 $endpoint->tpl->assign("silent_mode", 1); 52 52 … … 95 95 //This is a group template 96 96 $sql = "UPDATE endpointman_template_list SET global_settings_override = '".addslashes($settings_ser)."' WHERE id = ".$_REQUEST['tid']; 97 $endpoint-> db->query($sql);97 $endpoint->eda->sql($sql); 98 98 } else { 99 99 //This is an individual template 100 100 $sql = "UPDATE endpointman_mac_list SET global_settings_override = '".addslashes($settings_ser)."' WHERE id = ".$_REQUEST['tid']; 101 $endpoint-> db->query($sql);101 $endpoint->eda->sql($sql); 102 102 } 103 103 … … 108 108 //This is a group template 109 109 $sql = "UPDATE endpointman_template_list SET global_settings_override = NULL WHERE id = ".$_REQUEST['tid']; 110 $endpoint-> db->query($sql);110 $endpoint->eda->sql($sql); 111 111 } else { 112 112 //This is an individual template 113 113 $sql = "UPDATE endpointman_mac_list SET global_settings_override = NULL WHERE id = ".$_REQUEST['tid']; 114 $endpoint-> db->query($sql);114 $endpoint->eda->sql($sql); 115 115 } 116 116 $endpoint->message['advanced_settings'] = "Globals Reset to Default!"; … … 119 119 //This is a group template 120 120 $sql = 'SELECT global_settings_override FROM endpointman_template_list WHERE id = '.$_REQUEST['tid']; 121 $settings = $endpoint-> db->getOne($sql);121 $settings = $endpoint->eda->sql($sql,'getOne'); 122 122 } else { 123 123 //This is an individual template 124 124 $sql = 'SELECT global_settings_override FROM endpointman_mac_list WHERE id = '.$_REQUEST['tid']; 125 $settings = $endpoint-> db->getOne($sql);125 $settings = $endpoint->eda->sql($sql,'getOne'); 126 126 } 127 127 if(isset($settings)) { … … 135 135 } 136 136 //Because we are working with global variables we probably updated them, so lets refresh those variables 137 $endpoint->global_cfg =& $endpoint-> db->getAssoc("SELECT var_name, value FROM endpointman_global_vars");137 $endpoint->global_cfg =& $endpoint->eda->sql("SELECT var_name, value FROM endpointman_global_vars",'getAssoc'); 138 138 139 139 $endpoint->tpl->assign("ip", $_SERVER["SERVER_ADDR"]); … … 158 158 if(isset($_REQUEST['button_save'])) { 159 159 $sql = "UPDATE endpointman_custom_configs SET data = '".addslashes($_REQUEST['config_text'])."' WHERE id = ".$res[0]; 160 $endpoint-> db->query($sql);160 $endpoint->eda->sql($sql); 161 161 $message = "Saved to Database!"; 162 162 } 163 163 $sql = 'SELECT * FROM endpointman_custom_configs WHERE id =' . $res[0]; 164 $row =& $endpoint-> db->getRow($sql, array(), DB_FETCHMODE_ASSOC);164 $row =& $endpoint->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); 165 165 $endpoint->tpl->assign("save_as_name_value", $row['name']); 166 166 $endpoint->tpl->assign("filename", $row['original_name']); … … 173 173 //HD Config Files 174 174 $sql = "SELECT endpointman_brand_list.directory, endpointman_product_list.cfg_dir FROM endpointman_brand_list, endpointman_product_list WHERE endpointman_brand_list.id = endpointman_product_list.brand AND endpointman_product_list.id = (SELECT product_id FROM endpointman_template_list WHERE id = ".$_REQUEST['tid'].")"; 175 $row =& $endpoint-> db->getRow($sql, array(), DB_FETCHMODE_ASSOC);175 $row =& $endpoint->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); 176 176 $file=PHONE_MODULES_PATH.'endpoint/'.$row['directory']."/".$row['cfg_dir']."/".$res[1]; 177 177 … … 187 187 $time = time(); 188 188 $sql = 'SELECT endpointman_template_list.name, endpointman_template_list.config_files_override, endpointman_template_list.product_id FROM endpointman_template_list WHERE endpointman_template_list.id = '.$_REQUEST['tid']; 189 $row = $endpoint-> db->getRow($sql, array(), DB_FETCHMODE_ASSOC);189 $row = $endpoint->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); 190 190 $config_fs = unserialize($row['config_files_override']); 191 191 192 192 $sql = 'INSERT INTO endpointman_custom_configs (name, original_name, product_id, data) VALUES ("'.$row['name'].'_'.$time.'","'.addslashes($res[1]).'","'.$row['product_id'].'","'.addslashes($_REQUEST['config_text']).'")'; 193 $endpoint-> db->query($sql);194 $message = "Saved to Database!"; 195 $new_id =& $endpoint-> db->getOne('SELECT last_insert_id()');193 $endpoint->eda->sql($sql); 194 $message = "Saved to Database!"; 195 $new_id =& $endpoint->eda->sql('SELECT last_insert_id()','getOne'); 196 196 $sql = 'SELECT * FROM endpointman_custom_configs WHERE id =' . $new_id; 197 $row =& $endpoint-> db->getRow($sql, array(), DB_FETCHMODE_ASSOC);197 $row =& $endpoint->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); 198 198 199 199 $contents = $row['data']; … … 210 210 $config_files = serialize($config_fs); 211 211 $sql = "UPDATE endpointman_template_list SET config_files_override = '".$config_files."' WHERE id = ".$_REQUEST['tid']; 212 $endpoint-> db->query($sql);212 $endpoint->eda->sql($sql); 213 213 } else { 214 214 $handle = fopen($file, "rb"); … … 229 229 if(isset($_REQUEST['button_save'])) { 230 230 $sql = "UPDATE endpointman_custom_configs SET data = '".addslashes($_REQUEST['config_text'])."' WHERE id = ".$res[0]; 231 $endpoint-> db->query($sql);231 $endpoint->eda->sql($sql); 232 232 $message = "Saved to Database!"; 233 233 } 234 234 $sql = 'SELECT * FROM endpointman_custom_configs WHERE id =' . $res[0]; 235 $row =& $endpoint-> db->getRow($sql, array(), DB_FETCHMODE_ASSOC);235 $row =& $endpoint->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); 236 236 $file = "SQL/".$row['original_name']; 237 237 $endpoint->tpl->assign("file", basename($file)); … … 244 244 } else { 245 245 $sql = "SELECT endpointman_brand_list.directory, endpointman_product_list.cfg_dir FROM endpointman_brand_list, endpointman_product_list WHERE endpointman_brand_list.id = endpointman_product_list.brand AND endpointman_product_list.id = (SELECT endpointman_model_list.product_id FROM endpointman_model_list, endpointman_mac_list WHERE endpointman_mac_list.model = endpointman_model_list.id AND endpointman_mac_list.id = ".$_REQUEST['tid'].")"; 246 $row =& $endpoint->db->getRow($sql, array(), DB_FETCHMODE_ASSOC); 247 //$res[1] = escapeshellcmd($res[1]); 246 $row =& $endpoint->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); 248 247 $file=PHONE_MODULES_PATH.'endpoint/'.$row['directory']."/".$row['cfg_dir']."/".$res[1]; 249 248 … … 259 258 $time = time(); 260 259 $sql = 'SELECT endpointman_mac_list.mac, endpointman_mac_list.config_files_override, endpointman_model_list.product_id FROM endpointman_mac_list, endpointman_model_list WHERE endpointman_mac_list.model = endpointman_model_list.id AND endpointman_mac_list.id = '.$_REQUEST['tid']; 261 $row = $endpoint-> db->getRow($sql, array(), DB_FETCHMODE_ASSOC);260 $row = $endpoint->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); 262 261 $config_fs = unserialize($row['config_files_override']); 263 262 264 263 $sql = 'INSERT INTO endpointman_custom_configs (name, original_name, product_id, data) VALUES ("'.$row['mac'].'_'.$time.'","'.addslashes($res[1]).'","'.$row['product_id'].'","'.addslashes($_REQUEST['config_text']).'")'; 265 $endpoint-> db->query($sql);266 $message = "Saved to Database!"; 267 $new_id =& $endpoint-> db->getOne('SELECT last_insert_id()');264 $endpoint->eda->sql($sql); 265 $message = "Saved to Database!"; 266 $new_id =& $endpoint->eda->sql('SELECT last_insert_id()'); 268 267 $sql = 'SELECT * FROM endpointman_custom_configs WHERE id =' . $new_id; 269 $row =& $endpoint-> db->getRow($sql, array(), DB_FETCHMODE_ASSOC);268 $row =& $endpoint->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); 270 269 271 270 $contents = $row['data']; … … 282 281 $config_files = serialize($config_fs); 283 282 $sql = "UPDATE endpointman_mac_list SET config_files_override = '".$config_files."' WHERE id = ".$_REQUEST['tid']; 284 $endpoint-> db->query($sql);283 $endpoint->eda->sql($sql); 285 284 } else { 286 285 $handle = fopen($file, "rb"); … … 302 301 if(isset($_REQUEST['cfg_file'])) { 303 302 $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'] ."'"; 304 $row =& $endpoint-> db->getRow($sql, array(), DB_FETCHMODE_ASSOC);303 $row =& $endpoint->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); 305 304 306 305 $config_files = explode(",",$row['config_files']); … … 314 313 }elseif(isset($_REQUEST['button_save_as'])) { 315 314 $sql = 'INSERT INTO endpointman_custom_configs (name, original_name, product_id, data) VALUES ("'.addslashes($_REQUEST['save_as_name']).'","'.addslashes($config_files[$_REQUEST['cfg_file']]).'","'.$_REQUEST['product_select'].'","'.addslashes($_REQUEST['config_text']).'")'; 316 $endpoint-> db->query($sql);315 $endpoint->eda->sql($sql); 317 316 $message = "Saved to Database!"; 318 317 } … … 339 338 if(isset($_REQUEST['button_save'])) { 340 339 $sql = "UPDATE endpointman_custom_configs SET data = '".addslashes($_REQUEST['config_text'])."' WHERE id = ".$_REQUEST['sql']; 341 $endpoint-> db->query($sql);340 $endpoint->eda->sql($sql); 342 341 $message = "Saved to Database!"; 343 342 }elseif(isset($_REQUEST['button_save_as'])) { 344 343 $sql = 'SELECT original_name FROM endpointman_custom_configs WHERE id = '.$_REQUEST['sql']; 345 $file_name = $endpoint-> db->getOne($sql);344 $file_name = $endpoint->eda->sql($sql,'getOne'); 346 345 347 346 $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'])."')"; 348 $endpoint-> db->query($sql);347 $endpoint->eda->sql($sql); 349 348 $message = "Saved to Database!"; 350 349 } … … 352 351 if(isset($_REQUEST['sendid'])) { 353 352 $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'] ."'"; 354 $row22 =& $endpoint-> db->getRow($sql, array(), DB_FETCHMODE_ASSOC);353 $row22 =& $endpoint->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); 355 354 $endpoint->submit_config($row22['directory'],$row22['cfg_dir'],$config_files[$_REQUEST['cfg_file']],$contents); 356 355 $message = 'Sent! Thanks! :-)'; 357 356 } 358 357 $sql = 'SELECT * FROM endpointman_custom_configs WHERE id =' . $_REQUEST['sql']; 359 $row =& $endpoint-> db->getRow($sql, array(), DB_FETCHMODE_ASSOC);358 $row =& $endpoint->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); 360 359 $endpoint->tpl->assign("save_as_name_value", $row['name']); 361 360 $endpoint->tpl->assign("filename", $row['original_name']); … … 367 366 $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'] . "'"; 368 367 369 $row =& $endpoint-> db->getRow($sql, array(), DB_FETCHMODE_ASSOC);368 $row =& $endpoint->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); 370 369 $config_files = explode(",",$row['config_files']); 371 370 $i = 0; … … 376 375 } 377 376 $sql = "SELECT * FROM endpointman_custom_configs WHERE product_id = '". $_REQUEST['product_select'] . "'"; 378 $res =& $endpoint-> db->query($sql);377 $res =& $endpoint->eda->sql($sql); 379 378 $i = 0; 380 379 if($res->numRows()) { 381 $data =& $endpoint-> db->getAll($sql, array(), DB_FETCHMODE_ASSOC);380 $data =& $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); 382 381 foreach($data as $row2) { 383 382 $sql_file_list[$i]['value'] = $row2['id']; … … 410 409 411 410 $sql = 'SELECT model FROM `endpointman_model_list` WHERE `product_id` LIKE CONVERT(_utf8 \'1-2\' USING latin1) COLLATE latin1_swedish_ci AND `enabled` = 1 AND `hidden` = 0'; 412 $data =& $endpoint-> db->getAll($sql, array(), DB_FETCHMODE_ASSOC);411 $data =& $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); 413 412 $i = 1; 414 413 foreach($data as $list) { modules/branches/2.10/endpointman/includes/rain.error.php
r11804 r12899 105 105 set_error_handler( "myErrorHandler" ); 106 106 107 108 109 ?>modules/branches/2.10/endpointman/includes/template_manager.inc
r11816 r12899 11 11 12 12 $product_list = "SELECT * FROM endpointman_product_list WHERE id > 0"; 13 $product_list =& $ db->getAll($product_list,array(), DB_FETCHMODE_ASSOC);13 $product_list =& $endpoint->eda->sql($product_list,'getAll', DB_FETCHMODE_ASSOC); 14 14 15 15 $mac_list = "SELECT * FROM endpointman_mac_list"; 16 $mac_list =& $ db->getAll($mac_list, array(), DB_FETCHMODE_ASSOC);16 $mac_list =& $endpoint->eda->sql($mac_list, 'getAll', DB_FETCHMODE_ASSOC); 17 17 18 18 if((!$product_list) && (!$mac_list)) { … … 32 32 } else { 33 33 $sql = "INSERT INTO endpointman_template_list (product_id, name, model_id) VALUES ('".$_REQUEST['model_class']."','".$_REQUEST['template_name']."','".$_REQUEST['model_clone']."')"; 34 $endpoint-> db->query($sql);34 $endpoint->eda->sql($sql); 35 35 $sql = "SELECT id FROM endpointman_template_list WHERE product_id = '".$_REQUEST['model_class']."' AND name = '".$_REQUEST['template_name']."'"; 36 $id = $endpoint-> db->getOne($sql);36 $id = $endpoint->eda->sql($sql,'getOne'); 37 37 $endpoint->edit_template_display($id,0); 38 38 } 39 39 } elseif(isset($_REQUEST['delete_template'])) { 40 40 $sql = "DELETE FROM endpointman_template_list WHERE id = ". $_REQUEST['id']; 41 $endpoint-> db->query($sql);41 $endpoint->eda->sql($sql); 42 42 $sql = "UPDATE endpointman_mac_list SET custom_cfg_template = 0 WHERE custom_cfg_template = ".$_REQUEST['id']; 43 $endpoint-> db->query($sql);43 $endpoint->eda->sql($sql); 44 44 $default_display = TRUE; 45 45 $endpoint->message['general'] = _('Deleted'); … … 56 56 if($default_display) { 57 57 $sql = 'SELECT endpointman_template_list.*, endpointman_product_list.short_name as model_class, endpointman_model_list.model as model_clone, endpointman_model_list.enabled FROM endpointman_template_list, endpointman_model_list, endpointman_product_list WHERE endpointman_model_list.hidden = 0 AND endpointman_template_list.model_id = endpointman_model_list.id AND endpointman_template_list.product_id = endpointman_product_list.id'; 58 $template_list =& $ db->getAll($sql, array(), DB_FETCHMODE_ASSOC);58 $template_list =& $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); 59 59 $i = 0; 60 60 $row_out = array(); modules/branches/2.10/endpointman/module.xml
r12896 r12899 3 3 <repo>standard</repo> 4 4 <name>PBX End Point Manager</name> 5 <version>2.10.0. 4</version>5 <version>2.10.0.5</version> 6 6 <type>setup</type> 7 7 <category>Connectivity</category> … … 16 16 <description>PBX End Point Manager supports automated deployment of multiple manufacturers IP telephones.</description> 17 17 <changelog> 18 *2.10.0.2* Bump for 2.10 19 *2.9.2.2* Added status lights 20 *2.9.2.0* Fixes #5282, #5264, #4895, #5155, #4971, #5282, #5233 21 *2.9.1.3* Remove Firmware upon uninstall of Endpoint Manager, Force Firmware install for certain phones (#5155), Better Timezone Support (#4895) 22 *2.9.1.2* Added ability to export phone modules. 23 *2.9.1.0* Fixed various issues 24 *2.9.0.9* #4950 25 *2.9.0.8* Fixed #5068, Took off RC status. Fixed Version Numbering. 26 *2.9.0.3RC9* Fixed #4878, #4956, #4946, #4950 27 *2.9.0.3RC6* Fixed Device + User Mode (http://www.freepbx.org/forum/freepbx/users/device-user-mode), #4792 28 *2.9.0.0* bumped for 2.9, removed errors in module.xml causing erors for online xml parsing 18 https://github.com/tm1000/freepbx-endpointmanager/commits/master 29 19 </changelog> 30 <info>http ://www.provisioner.net</info>20 <info>https://github.com/tm1000/freepbx-endpointmanager</info> 31 21 <location>2.10/endpointman-2.10.0.3.tgz</location> 32 22 <depends> 33 <version>2. 10alpha1</version>23 <version>2.7</version> 34 24 </depends> 35 25 <requirements>
