Example #1
0
/**
 * Generates IP list form
 *
 * @param iMSCP_pTemplate $tpl Template engine instance
 * @param array &$data Reseller data
 * @return void
 */
function _admin_generateIpListForm($tpl, &$data)
{
    $tpl->assign(array('TR_IP_ADDRESS' => tr('IP address'), 'TR_IP_LABEL' => tr('Label'), 'TR_ASSIGN' => tr('Assign')));
    iMSCP_Events_Aggregator::getInstance()->registerListener('onGetJsTranslations', function ($e) {
        /** @var $e \iMSCP_Events_Event */
        $e->getParam('translations')->core['dataTable'] = getDataTablesPluginTranslations(false);
    });
    foreach ($data['server_ips'] as $ipData) {
        $tpl->assign(array('IP_ID' => tohtml($ipData['ip_id']), 'IP_NUMBER' => tohtml($ipData['ip_number']), 'IP_ASSIGNED' => in_array($ipData['ip_id'], $data['reseller_ips']) ? ' checked' : ''));
        $tpl->parse('IP_BLOCK', '.ip_block');
    }
}
Example #2
0
}
/***********************************************************************************************************************
 * Main
 */
// Include core library
require 'imscp-lib.php';
iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onAdminScriptStart);
check_login('admin');
// Register iMSCP_NetworkCard instance in registry for shared access
iMSCP_Registry::set('networkCardObject', new iMSCP_NetworkCard());
if (!empty($_POST)) {
    $ipNumber = isset($_POST['ip_number']) ? trim($_POST['ip_number']) : '';
    $netCard = isset($_POST['ip_card']) ? clean_input($_POST['ip_card']) : '';
    if (client_checkIpData($ipNumber, $netCard)) {
        client_registerIp($ipNumber, $netCard);
    }
}
$tpl = new iMSCP_pTemplate();
$tpl->define_dynamic(array('layout' => 'shared/layouts/ui.tpl', 'page' => 'admin/ip_manage.tpl', 'page_message' => 'layout', 'ip_addresses_block' => 'page', 'ip_address_block' => 'ip_addresses_block', 'ip_address_form_block' => 'page', 'network_card_block' => 'ip_address_form_block'));
$tpl->assign(array('TR_PAGE_TITLE' => tr('Admin / Settings / IP Addresses Management'), 'TR_IP' => tr('IP Address'), 'TR_ACTION' => tr('Action'), 'TR_NETWORK_CARD' => tr('Network interface'), 'TR_ADD' => tr('Add'), 'TR_CANCEL' => tr('Cancel'), 'TR_CONFIGURED_IPS' => tr('IP addresses under control of i-MSCP'), 'TR_ADD_NEW_IP' => tr('Add new IP address'), 'TR_IP_DATA' => tr('IP address data'), 'TR_MESSAGE_DELETE' => json_encode(tr('Are you sure you want to delete this IP: %s?', '%s')), 'TR_MESSAGE_DENY_DELETE' => json_encode(tr('You cannot remove the %s IP address.', '%s')), 'ERR_FIELDS_STACK' => iMSCP_Registry::isRegistered('errFieldsStack') ? json_encode(iMSCP_Registry::get('errFieldsStack')) : '[]', 'TR_TIP' => tr('This interface allow to add or remove IP addresses. IP addresses listed below are already under the control of i-MSCP. IP addresses which are added through this interface will be automatically added into the i-MSCP database, and will be available for assignment to one or many of your resellers. If an IP address is not already configured on the system, it will be attached to the selected network interface.')));
iMSCP_Events_Aggregator::getInstance()->registerListener('onGetJsTranslations', function ($e) {
    /** @var $e \iMSCP_Events_Event */
    $e->getParam('translations')->core['dataTable'] = getDataTablesPluginTranslations(false);
});
generateNavigation($tpl);
client_generatePage($tpl);
generatePageMessage($tpl);
$tpl->parse('LAYOUT_CONTENT', 'page');
iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onAdminScriptEnd, array('templateEngine' => $tpl));
$tpl->prnt();
unsetMessages();
Example #3
0
                    $pluginManager->pluginSetStatus($pluginName, 'todisable');
                    $action = 'disable';
            }
            doAction($pluginManager, $pluginName, $action);
        } else {
            showBadRequestErrorPage();
        }
    } elseif (isset($_POST['bulk_actions'])) {
        doBulkAction($pluginManager);
    } elseif (!empty($_FILES) && uploadPlugin($pluginManager)) {
        OpcodeCacheUtils::clearAllActive();
        // Force newest files to be loaded on next run
        set_page_message(tr('Plugin has been successfully uploaded.'), 'success');
        redirectTo('settings_plugins.php?update_plugin_list');
    }
    redirectTo('settings_plugins.php');
}
$tpl = new TemplateEngine();
$tpl->define_dynamic(array('layout' => 'shared/layouts/ui.tpl', 'page' => 'admin/settings_plugins.tpl', 'page_message' => 'layout', 'plugins_block' => 'page', 'plugin_block' => 'plugins_block', 'plugin_status_details_block' => 'plugin_block', 'plugin_activate_link' => 'plugin_block', 'plugin_deactivate_link' => 'plugin_block', 'plugin_protected_link' => 'plugin_block'));
EventManager::getInstance()->registerListener(Events::onGetJsTranslations, function ($event) {
    /** @var $event \iMSCP_Events_Event $translations */
    $event->getParam('translations')->core = array_merge($event->getParam('translations')->core, array('dataTable' => getDataTablesPluginTranslations(false), 'force_retry' => tr('Force retry'), 'close' => tr('Close'), 'error_details' => tr('Error details')));
});
$tpl->assign(array('TR_PAGE_TITLE' => tr('Admin / Settings / Plugin Management'), 'TR_BULK_ACTIONS' => tr('Bulk Actions'), 'TR_PLUGIN' => tr('Plugin'), 'TR_DESCRIPTION' => tr('Description'), 'TR_STATUS' => tr('Status'), 'TR_ACTIONS' => tr('Actions'), 'TR_INSTALL' => tr('Install'), 'TR_ACTIVATE' => tr('Activate'), 'TR_DEACTIVATE_TOOLTIP' => tr('Deactivate this plugin'), 'TR_DEACTIVATE' => tr('Deactivate'), 'TR_UNINSTALL' => tr('Uninstall'), 'TR_PROTECT' => tr('Protect'), 'TR_DELETE' => tr('Delete'), 'TR_PROTECT_TOOLTIP' => tr('Protect this plugin'), 'TR_VERSION' => tr('Version'), 'TR_BY' => tr('By'), 'TR_VISIT_PLUGIN_SITE' => tr('Visit plugin site'), 'TR_UPDATE_PLUGIN_LIST' => tr('Update Plugins'), 'TR_APPLY' => tr('Apply'), 'TR_PLUGIN_UPLOAD' => tr('Plugins Upload'), 'TR_UPLOAD' => tr('Upload'), 'TR_PLUGIN_ARCHIVE' => tr('Plugin archive'), 'TR_PLUGIN_ARCHIVE_TOOLTIP' => tr('Only tar.gz, tar.bz2 and zip archives are accepted.'), 'TR_PLUGIN_HINT' => tr('Plugins hook into i-MSCP to extend its functionality with custom features. Plugins are developed independently from the core i-MSCP application by thousands of developers all over the world. You can find new plugins to install by browsing the %s.', '<a style="text-decoration: underline" href="http://i-mscp.net/filebase/index.php/Filebase/" target="_blank">' . tr('i-MSCP plugin store') . '</a></u>'), 'TR_CLICK_FOR_MORE_DETAILS' => tr('Click here for more details')));
generateNavigation($tpl);
generatePage($tpl, $pluginManager);
generatePageMessage($tpl);
$tpl->parse('LAYOUT_CONTENT', 'page');
EventManager::getInstance()->dispatch(Events::onAdminScriptEnd, array('templateEngine' => $tpl));
$tpl->prnt();
unsetMessages();
Example #4
0
/**
 * Generates IP list form
 *
 * @param iMSCP_pTemplate $tpl Template engine instance
 * @param array &$data Reseller data
 * @return void
 */
function _admin_generateIpListForm($tpl, &$data)
{
    $assignedTranslation = tr('Already in use');
    $unusedTranslation = tr('Not used');
    $tpl->assign(array('TR_IP_ADDRESS' => tr('IP address'), 'TR_IP_LABEL' => tr('Label'), 'TR_ASSIGN' => tr('Assign'), 'TR_STATUS' => tr('Usage status')));
    iMSCP_Events_Aggregator::getInstance()->registerListener('onGetJsTranslations', function ($e) {
        /** @var $e \iMSCP_Events_Event */
        $e->getParam('translations')->core['dataTable'] = getDataTablesPluginTranslations(false);
    });
    foreach ($data['server_ips'] as $ipData) {
        $resellerHasIp = in_array($ipData['ip_id'], $data['reseller_ips']);
        $isUsedIp = in_array($ipData['ip_id'], $data['used_ips']);
        $tpl->assign(array('IP_ID' => tohtml($ipData['ip_id']), 'IP_NUMBER' => tohtml($ipData['ip_number']), 'IP_ASSIGNED' => $resellerHasIp ? ' checked' : '', 'IP_STATUS' => $isUsedIp ? $assignedTranslation : $unusedTranslation, 'IP_READONLY' => $isUsedIp ? ' title="' . tohtml(tr('You cannot unassign an IP address already in use.'), 'htmlAttr') . '" readonly' : ''));
        $tpl->parse('IP_BLOCK', '.ip_block');
    }
}
Example #5
0
/**
 * Generates view
 *
 * @param iMSCP_ptemplate $tpl
 * @return void
 */
function client_generateView($tpl)
{
    iMSCP_Events_Aggregator::getInstance()->registerListener(iMSCP_Events::onGetJsTranslations, function ($e) {
        /** @var iMSCP_Events_Description $e */
        $translations = $e->getParam('translations');
        $translations['core']['datatable'] = getDataTablesPluginTranslations(false);
        $translations['core']['deactivate_message'] = tr("Are you sure you want to deactivate the external mail server(s) for the '%s' domain?", true, '%s');
    });
    $tpl->assign(array('TR_PAGE_TITLE' => tr('Client / Email / External Mail Server'), 'TR_DOMAIN' => tr('Domain'), 'TR_STATUS' => tr('Status'), 'TR_ACTION' => tr('Action'), 'TR_DEACTIVATE_SELECTED_ITEMS' => tr('Deactivate selected items'), 'TR_CANCEL' => tr('Cancel')));
    $domainProps = get_domain_default_props($_SESSION['user_id']);
    $domainId = $domainProps['domain_id'];
    $domainName = $domainProps['domain_name'];
    _client_generateItemList($tpl, $domainId, $domainName);
}
Example #6
0
EventManager::getInstance()->dispatch(Events::onClientScriptStart);
check_login('user');
if (isset($_REQUEST['action'])) {
    $action = clean_input($_REQUEST['action']);
    if ($action === 'add') {
        if (addList()) {
            set_page_message(tr('Mailing list successfully scheduled for creation.'), 'success');
            redirectTo('mailman.php');
        }
    } elseif ($action === 'edit') {
        if (!empty($_POST) && addList()) {
            set_page_message(tr('Mailing list successfully scheduled for update'), 'success');
            redirectTo('mailman.php');
        }
    } elseif ($action === 'delete' && isset($_REQUEST['list_id'])) {
        deleteList(clean_input($_REQUEST['list_id']));
        set_page_message(tr('Mailing list successfully scheduled for deletion.'), 'success');
        redirectTo('mailman.php');
    } else {
        showBadRequestErrorPage();
    }
}
$tpl = new TemplateEngine();
$tpl->define_dynamic(array('layout' => 'shared/layouts/ui.tpl', 'page' => '../../plugins/Mailman/themes/default/view/client/mailman.tpl', 'page_message' => 'layout', 'email_lists' => 'page', 'email_list' => 'email_lists'));
$tpl->assign(array('TR_PAGE_TITLE' => tr('Client / Email / Mailman'), 'ISP_LOGO' => layout_getUserLogo(), 'DATATABLE_TRANSLATIONS' => getDataTablesPluginTranslations(), 'TR_MAIL_LISTS' => tojs(tr('Mailing List', false)), 'TR_EDIT' => tr('Edit'), 'TR_DELETE' => tr('Delete'), 'TR_ADD_LIST' => tr('Add mailing list'), 'TR_MAIL_LIST' => tr('Mailing List'), 'TR_LIST_NAME' => tr('List name'), 'TR_LIST_URL' => tr('List URL'), 'TR_STATUS' => tr('Status'), 'TR_ACTIONS' => tr('Actions'), 'TR_ADMIN_EMAIL' => tr('Admin email'), 'TR_ADMIN_PASSWORD' => tr('Password'), 'TR_ADMIN_PASSWORD_CONFIRM' => tr('Password confirmation'), 'TR_URL' => tr('Url'), 'TR_CONFIRM_DELETION' => tr('Please, confirm the deletion of the %s mailing list.', false, '%s'), 'TR_SAVE' => tojs(tr('Save', false)), 'TR_CANCEL' => tojs(tr('Cancel', false))));
generateNavigation($tpl);
generatePage($tpl);
$tpl->parse('LAYOUT_CONTENT', 'page');
EventManager::getInstance()->dispatch(Events::onClientScriptEnd, array('templateEngine' => $tpl));
$tpl->prnt();
unsetMessages();