if ($_REQUEST['pop_type'] == "alt_cfg_edit") { $value = isset($_POST['value']) ? $_POST['value'] : $_REQUEST['value']; $res = explode("_", $value, 2); if ($_REQUEST['custom'] == 0) { if ($res[0] != 0) { //SQL Config Files if (isset($_REQUEST['button_save'])) { $sql = "UPDATE endpointman_custom_configs SET data = '" . addslashes($_REQUEST['config_text']) . "' WHERE id = " . $res[0]; $endpoint->db->query($sql); $message = "Saved to Database!"; } $sql = 'SELECT * FROM endpointman_custom_configs WHERE id =' . $res[0]; $row =& $endpoint->db->getRow($sql, array(), DB_FETCHMODE_ASSOC); $endpoint->tpl->assign("save_as_name_value", $row['name']); $endpoint->tpl->assign("filename", $row['original_name']); $row['data'] = $endpoint->display_htmlspecialchars($row['data']); $endpoint->tpl->assign("config_data", $row['data']); $endpoint->tpl->assign("allow_hdfiles", $endpoint->global_cfg['allow_hdfiles']); $endpoint->tpl->assign("value", $value); } else { //HD Config Files $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'] . ")"; $row =& $endpoint->db->getRow($sql, array(), DB_FETCHMODE_ASSOC); $file = PHONE_MODULES_PATH . 'endpoint/' . $row['directory'] . "/" . $row['cfg_dir'] . "/" . $res[1]; if (isset($_REQUEST['button_save']) && $endpoint->global_cfg['allow_hdfiles']) { $wfh = fopen($file, 'w'); fwrite($wfh, $_REQUEST['config_text']); fclose($wfh); $message = "Saved to Hard Drive!"; $handle = fopen($file, "rb"); $contents = fread($handle, filesize($file));