Beispiel #1
0
    return true;
}
/***********************************************************************************************************************
 * Main
 */
// Include core library
require 'imscp-lib.php';
iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onAdminScriptStart);
// Check for login
check_login('admin');
// Adds a service port or updates one or more services ports
if (isset($_POST['uaction']) && $_POST['uaction'] != 'reset') {
    admin_addUpdateServices(clean_input($_POST['uaction']));
    // Deletes a service port
} elseif (isset($_GET['delete'])) {
    deleteService(clean_input($_GET['delete']));
}
/** @var $cfg iMSCP_Config_Handler_File */
$cfg = iMSCP_Registry::get('config');
$tpl = new iMSCP_pTemplate();
$tpl->define_dynamic(array('layout' => 'shared/layouts/ui.tpl', 'page' => 'admin/settings_ports.tpl', 'page_message' => 'layout', 'service_ports' => 'page', 'port_delete_link' => 'service_ports'));
$tpl->assign(array('TR_PAGE_TITLE' => tr('Admin / Settings / Service Ports'), 'TR_ACTION' => tr('Action'), 'TR_UDP' => tr('udp'), 'TR_TCP' => tr('tcp'), 'TR_ENABLED' => tr('Yes'), 'TR_DISABLED' => tr('No'), 'TR_SERVERPORTS' => tr('Server ports'), 'TR_SERVICE' => tr('Service Name'), 'TR_IP' => tr('IP address'), 'TR_PORT' => tr('Port'), 'TR_PROTOCOL' => tr('Protocol'), 'TR_SHOW' => tr('Show'), 'TR_DELETE' => tr('Delete'), 'TR_MESSAGE_DELETE' => tr('Are you sure you want to delete %s service port ?', '%s'), 'TR_ADD_NEW_SERVICE_PORT' => tr('Add new service port'), 'VAL_FOR_SUBMIT_ON_UPDATE' => tr('Update'), 'VAL_FOR_SUBMIT_ON_ADD' => tr('Add'), 'VAL_FOR_SUBMIT_ON_RESET' => tr('Reset')));
iMSCP_Events_Aggregator::getInstance()->registerListener('onGetJsTranslations', function ($e) {
    /** @var $e \iMSCP_Events_Event */
    $e->getParam('translations')->core['dataTable'] = getDataTablesPluginTranslations(false);
});
generateNavigation($tpl);
admin_showServices($tpl);
generatePageMessage($tpl);
$tpl->parse('LAYOUT_CONTENT', 'page');
iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onAdminScriptEnd, array('templateEngine' => $tpl));
} elseif (isset($_POST['addNewFeature'])) {
    $desc = $_POST['addNewFeature'];
    addFeature($desc);
    $id = getFeatureID($desc);
    echo $id;
} elseif (isset($_POST['featureID'])) {
    $id = $_POST['featureID'];
    deleteFeature($id);
} elseif (isset($_POST['addNewAdvantage'])) {
    $advantage = $_POST['addNewAdvantage'];
    addAdvantages($advantage);
    $resp['advKey'] = getAdvantageID($advantage);
    echo json_encode($resp);
} elseif (isset($_POST['advID'])) {
    $Aid = $_POST['advID'];
    deleteAdvantage($Aid);
} elseif (isset($_POST['updService'])) {
    $service = $_POST['updService'];
    $price = $_POST['updPrice'];
    $id = $_POST['serviceID'];
    updateServices($service, $price, $id);
} elseif (isset($_POST['addNewService'])) {
    $service = $_POST['addNewService'];
    $price = $_POST['addNewPrice'];
    addCharges($service, $price);
    $id = getServiceID($service, $price);
    echo $id;
} elseif (isset($_POST['ServId'])) {
    $id = $_POST['ServId'];
    deleteService($id);
}