unset($fields); unset($values); // add permission/weight relationships $fields = array('permission_id', 'weight_id'); foreach ($weight_id as $w) { $values[] = array($name, $w); } fbilling_add('permission_weights', $fields, $values); redirect_standard('cat'); } if ($action == 'conf_edit') { $insert_ok = fbilling_check_if_exists($cat, 'name', $name); // get number of permissions with same name if ($insert_ok > 0) { // if there is permission with requested name check whether it's not permission we are editing $permission_data = fbilling_get_data_by_id($cat, $id); if ($permission_data['name'] == $name) { $insert_ok = 0; } else { $insert_ok = 1; } } if ($insert_ok > 0) { echo _("Permission with specified name already exists in database, please provide different name, and try again"); echo "<a href='javascript:history.go(-1)''> Go Back</a>"; return true; } else { $fields = "name = '{$name}', is_active = {$is_active}"; fbilling_edit($cat, $fields, $id); // update permission details fbilling_del('permission_weights', 'permission_id', $id);
recordings.php - Reponsible for managing recordings associated with each hangup cause */ include "shared.php"; // get list of recordings and draw rnav // of course we could name this files cause.php, and whole section whould be cause management, which would be, em, not pretty // anyways above can be done bit later $cause_list = fbilling_get_list('causes'); echo "<div class='rnav'><ul>"; foreach ($cause_list as $cause) { echo "<li class='current'><a href=/admin/config.php?display={$display}&cat={$cat}&action=edit&id={$cause['id']}>{$cause['name']}</a></li>"; } echo "</ul></div>"; $recording_list = recordings_list(); if ($action == 'edit') { // start edit cause $cause_data = fbilling_get_data_by_id('causes', $id); ?> <form name='cause' method='GET'> <table> <tr> <td> <a href='#' class='info'><?php echo _("Cause Name"); ?> <span><?php echo _("Selected recording will be played whenever extension will hit that cause"); ?> </span></a></td> </td> <td>
<a href=/admin/config.php?display=fbilling_admin&cat=tariffs&action=import><?php echo _("Import Tariffs"); ?> </a> <?php if ($_REQUEST['export'] == 'Export') { // use hit export button show csv download link echo "<a href=/fbilling_data/{$csv_file_url}>Download CSV file</a>"; } } elseif ($action == 'add' or $action == 'edit') { // startif (action add/edit) if ($action == 'edit') { $tariff_data = fbilling_get_data_by_id($cat, $id); } ?> <form name='tariff_form' method='GET' onsubmit='return check_tariff_form();'> <table> <tr> <td> <a href='#' class='info'><?php echo _("Cost"); ?> <span><?php echo _("Per minute cost for this prefix"); ?> </span></a></td> </td> <td>
// if there is weight with requested name. exit echo _("Weight with specified name already exists in database, please provide different name, and try again"); echo "<a href='javascript:history.go(-1)''> Go Back</a>"; return true; } $fields = array('name'); $values = array($name); fbilling_add($cat, $fields, $values); redirect_standard('cat'); } if ($action == 'conf_edit') { $insert_ok = fbilling_check_if_exists($cat, 'name', $name); // get number of weights with same name if ($insert_ok > 0) { // if there is weight with requested name check whether it's not weight we are editing $weight_data = fbilling_get_data_by_id($cat, $id); if ($weight_data['name'] == $name) { $insert_ok = 0; } else { $insert_ok = 1; } } if ($insert_ok > 0) { echo _("Weight with specified name already exists in database, please provide different name, and try again"); echo "<a href='javascript:history.go(-1)''>Go Back</a>"; return true; } else { $fields = "name = '{$name}'"; fbilling_edit($cat, $fields, $id); redirect_standard('cat'); }
if ($insert_ok > 0) { // if there is prefix with requested name. exit echo "Prefix with specified pattern already exists in database, please use different pattern, or edit existing one.<br />"; echo "<a href='javascript:history.go(-1)''>Go Back</a>"; return true; } $fields = array('pref', 'is_active', 'weight_id', 'country', 'description'); $values = array($prefix, $prefix_is_active, $prefix_weight_id, $country, $prefix_description); fbilling_add($cat, $fields, $values); redirect_standard('cat'); } elseif ($action == 'conf_edit') { $insert_ok = fbilling_check_if_exists($cat, 'pref', $prefix); // get number of tenants with same name if ($insert_ok > 0) { // if there is prefix with requested name check whether it's not prefix we are editing $prefix_data = fbilling_get_data_by_id($cat, $id); if ($prefix_data['pref'] == $prefix) { $insert_ok = 0; } else { $insert_ok = 1; } } if ($insert_ok > 0) { echo _("Prefix with specified pattern already exists in database, please use different pattern, or edit existing one."); echo "<br /><a href='javascript:history.go(-1)''>Go Back</a>"; return true; } else { $fields = "pref = '{$prefix}', is_active = {$prefix_is_active}, weight_id = '{$prefix_weight_id}', country = '{$country}', description = '{$prefix_description}'"; fbilling_edit($cat, $fields, $id); redirect_standard('cat'); }
// if yes, exit echo _("Trunk with specified name already exists in database, please provide different name, and try again."); echo "<a href='javascript:history.go(-1)''> Go Back</a>"; return true; } $fields = array('name', 'proto', 'dial', 'add_prefix', 'remove_prefix'); $values = array($name, $protocol, $dial, $add_prefix, $remove_prefix); fbilling_add($cat, $fields, $values); redirect_standard('cat'); } if ($action == 'conf_edit') { $insert_ok = fbilling_check_if_exists($cat, 'name', $name); // get number of trunks with same name if ($insert_ok > 0) { // if there is trunk with requested name check whether it's not trunk we are editing $trunk_data = fbilling_get_data_by_id($cat, $id); if ($trunk_data['name'] == $name) { $insert_ok = 0; } else { $insert_ok = 1; } } if ($insert_ok > 0) { echo _("Trunk with specified name already exists in database, please provide different name, and try again."); echo "<a href='javascript:history.go(-1)''> Go Back</a>"; return true; } else { $fields = "name = '{$name}', proto = '{$protocol}', dial = '{$dial}', add_prefix = '{$add_prefix}', remove_prefix = '{$remove_prefix}'"; $values = array($name, $protocol, $dial, $add_prefix, $remove_prefix); fbilling_edit($cat, $fields, $id); redirect_standard('cat');
// if there is tenant with requested name. exit echo _("Tenant with specified name already exists in database, provide different name, and try again."); echo "<a href='javascript:history.go(-1)''> Go Back</a>"; return true; } $fields = array('name', 'is_active', 'credit'); $values = array($name, $is_active, $credit); fbilling_add($cat, $fields, $values); redirect_standard('cat'); } if ($action == 'conf_edit') { $insert_ok = fbilling_check_if_exists($cat, 'name', $name); // get number of tenants with same name if ($insert_ok > 0) { // if there is tenant with requested name check whether it's not tenant we are editing $tenant_data = fbilling_get_data_by_id($cat, $id); if ($tenant_data['name'] == $name) { $insert_ok = 0; } else { $insert_ok = 1; } } if ($insert_ok > 0) { echo _("Tenant with specified name already exists in database, provide different name, and try again."); echo "<a href='javascript:history.go(-1)''> Go Back</a>"; return true; } else { $fields = "name = '{$name}', is_active = {$is_active}, credit = '{$credit}'"; fbilling_edit($cat, $fields, $id); redirect_standard('cat'); }