Esempio n. 1
0
 * Main
 */
iMSCP_Events_Manager::getInstance()->dispatch(iMSCP_Events::onClientScriptStart);
/** @var $cfg iMSCP_Config_Handler_File */
$cfg = iMSCP_Registry::get('config');
check_login('user');
if (iMSCP_Plugin_OwnDDNS::customerHasOwnDDNS($_SESSION['user_id'])) {
    if (iMSCP_Registry::isRegistered('pluginManager')) {
        /** @var iMSCP_Plugin_Manager $pluginManager */
        $pluginManager = iMSCP_Registry::get('pluginManager');
    } else {
        throw new iMSCP_Plugin_Exception('An unexpected error occured');
    }
    $tpl = new iMSCP_pTemplate();
    $tpl->define_dynamic(array('layout' => 'shared/layouts/ui.tpl', 'page' => '../../plugins/OwnDDNS/frontend/client/ownddns.tpl', 'page_message' => 'layout', 'ownddns_select_item' => 'page', 'ownddns_account_list' => 'page', 'ownddns_account_item' => 'page', 'ownddns_no_account_item' => 'page', 'ownddns_edit_login' => 'page', 'ownddns_add_dialog' => 'page', 'ownddns_add_button' => 'page', 'scroll_prev_gray' => 'ownddns_account_list', 'scroll_prev' => 'ownddns_account_list', 'scroll_next_gray', 'ownddns_account_list', 'scroll_next' => 'ownddns_account_list'));
    $tpl->assign(array('TR_PAGE_TITLE' => tr('Domains / OwnDDNS'), 'TR_PAGE_TITLE_OWNDDNS_ADD' => tr('OwnDDNS - Account'), 'THEME_CHARSET' => tr('encoding'), 'ISP_LOGO' => layout_getUserLogo(), 'OWNDDNS_NO_ACCOUNT' => tr('No account for OwnDDNS activated'), 'TR_OWNDDNS_ACCOUNT_NAME' => tr('OwnDDNS account name'), 'TR_OWNDDNS_ACCOUNT_FQDN' => tr('OwnDDNS FQDN'), 'TR_POPUP_OWNDDNS_ACCOUNT_NAME' => tr('OwnDDNS account name:'), 'TR_POPUP_OWNDDNS_KEY' => tr('OwnDDNS access key:'), 'TR_OWNDDNS_ACCOUNT_STATUS' => tr('Status'), 'TR_OWNDDNS_ACCOUNT_ACTIONS' => tr('Actions'), 'TR_ADD_OWNDDNS_ACCOUNT' => tr('Add new OwnDDNS account'), 'DELETE_ACCOUNT_ALERT' => tr('Are you sure, You want to delete this OwnDDNS account?'), 'TR_EDIT_ACCOUNT' => tr('Edit account'), 'TR_DELETE_ACCOUNT' => tr('Delete account'), 'TR_PREVIOUS' => tr('Previous'), 'TR_NEXT' => tr('Next'), 'TR_ADD' => tr('Add'), 'TR_CANCEL' => tr('Cancel'), 'OWNDDNS_DIALOG_OPEN' => 0, 'OWNDDNS_ACCOUNT_NAME' => '', 'OWNDDNS_ACCOUNT_FQDN' => '', 'OWNDDNS_PASSWORD' => '', 'TR_UPDATE' => tr('Update'), 'TR_CANCEL' => tr('Cancel'), 'OWNDDNS_KEY_READONLY' => $cfg->HTML_READONLY, 'OWNDDNS_KEY_ADD' => '', 'OWNDDNS_KEY_EDIT' => '', 'OWNDDNS_ACCOUNT_NAME_ADD' => '', 'OWNDDNS_ACCOUNT_NAME_EDIT' => '', 'OWNDDNS_ACCOUNT_FQDN_EDIT' => '', 'TR_GENERATE_OWNDDNSKEY' => tr('Generate account key'), 'TR_OWNDDNS_SELECT_NAME_NONE' => tr('Select a domain'), 'TR_OWNDDNS_LAST_IP' => tr('Last ipaddress'), 'TR_OWNDDNS_LAST_UPDATE' => tr('Last update'), 'ACCOUNT_NAME_SELECTED' => ''));
    if (isset($_REQUEST['action'])) {
        $action = clean_input($_REQUEST['action']);
        if ($action === 'add') {
            if (ownddns_AddAccount($tpl, $pluginManager, $_SESSION['user_id'])) {
                set_page_message(tr('New OwnDDNS account successfully scheduled for addition'), 'success');
                redirectTo('ownddns.php');
            }
        } elseif ($action === 'edit') {
            $accountID = isset($_GET['ownddns_account_id']) ? clean_input($_GET['ownddns_account_id']) : '';
            if ($accountID != '') {
                if (ownddns_EditAccount($tpl, $_SESSION['user_id'], $accountID)) {
                    set_page_message(tr('OwnDDNS account successfully scheduled for update'), 'success');
                    redirectTo('ownddns.php');
                }
            }
Esempio n. 2
0
$tpl = new iMSCP_pTemplate();
$tpl->define_dynamic(array('layout' => 'shared/layouts/ui.tpl', 'page' => '../../plugins/OwnDDNS/frontend/reseller/ownddns.tpl', 'page_message' => 'layout', 'ownddns_list' => 'page', 'ownddns_edit' => 'page', 'ownddns_select_item' => 'page', 'ownddns_customer_list' => 'page', 'ownddns_customer_item' => 'page', 'ownddns_no_customer_item' => 'page', 'scroll_prev_gray' => 'ownddns_customer_list', 'scroll_prev' => 'ownddns_customer_list', 'scroll_next_gray', 'ownddns_customer_list', 'scroll_next' => 'ownddns_customer_list'));
if (isset($_REQUEST['action'])) {
    $action = clean_input($_REQUEST['action']);
    if ($action === 'activate') {
        $customerAdminId = isset($_POST['admin_id']) && $_POST['admin_id'] !== '-1' ? clean_input($_POST['admin_id']) : '';
        if ($customerAdminId != '') {
            ownddns_activateCustomer($tpl, $pluginManager, $customerAdminId, $_SESSION['user_id']);
        }
    } elseif ($action === 'edit') {
        $customerAdminId = $_GET['admin_id'] !== '' ? (int) clean_input($_GET['admin_id']) : '';
        if ($customerAdminId != '') {
            ownddns_changeCustomerOwnDDNS($tpl, $customerAdminId, $_SESSION['user_id']);
        }
    } elseif ($action === 'delete') {
        $customerAdminId = isset($_GET['admin_id']) ? clean_input($_GET['admin_id']) : '';
        if ($customerAdminId != '') {
            ownddns_deactivateCustomer($tpl, $customerAdminId, $_SESSION['user_id']);
        }
    }
}
$tpl->assign(array('TR_PAGE_TITLE' => tr('Customers / OwnDDNS'), 'THEME_CHARSET' => tr('encoding'), 'ISP_LOGO' => layout_getUserLogo(), 'CUSTOMER_NOT_SELECTED' => tr("No customer selected."), 'TR_OWNDDNS_SELECT_NAME_NONE' => tr('Select a customer'), 'TR_SHOW' => tr('Activate OwnDDNS for this customer'), 'TR_UPDATE' => tr('Update'), 'TR_CANCEL' => tr('Cancel'), 'TR_OWNDDNS_CUSTOMER_NAME' => tr('Customer'), 'TR_OWNDDNS_NO_CUSTOMER' => tr('OwnDDNS customer entries'), 'OWNDDNS_NO_CUSTOMER' => tr('No customer for OwnDDNS support activated'), 'TR_OWNDDNS_STATUS' => tr('Status'), 'TR_OWNDDNS_ACCOUNT_LIMIT' => tr('Account limit'), 'DEACTIVATE_CUSTOMER_ALERT' => tr('Are you sure, You want to deactivate OwnDDNS for this customer?'), 'TR_PREVIOUS' => tr('Previous'), 'TR_OWNDDNS_ACTIONS' => tr('Actions'), 'TR_EDIT_OWNDDNS_ACCOUNT' => tr('Edit customer OwnDDNS'), 'TR_DELETE_OWNDDNS_ACCOUNT' => tr('Delete customer OwnDDNS'), 'TR_LIMIT_VALUE' => tr('Limit value'), 'TR_MAX_ACCOUNT_LIMIT' => tr('Max creating accounts') . '<br /><i>(0 ' . tr('unlimited') . ')</i>', 'TR_NEXT' => tr('Next')));
generateNavigation($tpl);
if (!isset($_GET['action'])) {
    ownddns_generateSelect($tpl, $_SESSION['user_id']);
    ownddns_generateActivatedCustomers($tpl, $_SESSION['user_id']);
}
generatePageMessage($tpl);
$tpl->parse('LAYOUT_CONTENT', 'page');
iMSCP_Events_Manager::getInstance()->dispatch(iMSCP_Events::onResellerScriptEnd, array('templateEngine' => $tpl));
$tpl->prnt();
Esempio n. 3
0
            if ($data['alias_id'] == '0') {
                exec_query('UPDATE `domain` SET `domain_status` = ? WHERE `domain_id` = ?', array($cfg->ITEM_TOCHANGE_STATUS, $data['domain_id']));
            } else {
                exec_query('UPDATE `domain_aliasses` SET `alias_status` = ? WHERE `alias_id` = ?', array($cfg->ITEM_TOCHANGE_STATUS, $data['alias_id']));
            }
        }
        send_request();
    }
}
/***********************************************************************************************************************
 * Main
 */
iMSCP_Events_Manager::getInstance()->dispatch(iMSCP_Events::onAdminScriptStart);
check_login('admin');
if (iMSCP_Registry::isRegistered('pluginManager')) {
    /** @var iMSCP_Plugin_Manager $pluginManager */
    $pluginManager = iMSCP_Registry::get('pluginManager');
} else {
    throw new iMSCP_Plugin_Exception('An unexpected error occured');
}
/** @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' => '../../plugins/OwnDDNS/frontend/admin/ownddns.tpl', 'page_message' => 'layout'));
$tpl->assign(array('TR_PAGE_TITLE' => tr('General / OwnDDNS'), 'THEME_CHARSET' => tr('encoding'), 'ISP_LOGO' => layout_getUserLogo(), 'TR_CANCEL' => tr('Cancel'), 'TR_UPDATE' => tr('Update'), 'TR_YES' => tr('Yes'), 'TR_NO' => tr('No'), 'TR_OWNDDNS_SETTINGS' => tr('OwnDDNS - Settings'), 'TR_OWNDDNS_DEBUG' => tr('OwnDDNS - Debug'), 'TR_OWNDDNS_BASE64' => tr('Base64 encoding'), 'TR_MAX_ALLOWED_ACCOUNTS' => tr('Max. account for customer (0 = unlimted)'), 'TR_MAX_ACCOUNTS_LENGHT' => tr('Max. lenght for subdomain name'), 'TR_UPDATE_REPEAT_TIME' => tr('Update repeat time (in minutes)'), 'TR_UPDATE_TTL_TIME' => tr('Update TTL time (in seconds - min. 60)'), 'TR_ACCOUNT_NAME_BLACKLIST' => tr('Account name blacklist (semikolon separated)'), 'TR_UPDATE_TTL_TIME_TOOLTIP' => json_encode(tr('Set the time for the dns ttl update time. Minimum 60 seconds.')), 'TR_ACCOUNT_NAME_BLACKLIST_TOOLTIP' => json_encode(tr('Create a semikolon separated list which account names are not allowed to use.'))));
ownddnsSettings($tpl, $pluginManager);
generateNavigation($tpl);
generatePageMessage($tpl);
$tpl->parse('LAYOUT_CONTENT', 'page');
iMSCP_Events_Manager::getInstance()->dispatch(iMSCP_Events::onAdminScriptEnd, array('templateEngine' => $tpl));
$tpl->prnt();
Esempio n. 4
0
/**
 * Deletes user logo
 *
 * @author Laurent Declercq <*****@*****.**>
 * @param string $logoFilePath OPTIONAL Logo file path
 * @param bool $onlyFile OPTIONAL Tell whether or not only logo file must be deleted
 * @return bool TRUE on success, FALSE otherwise
 */
function layout_deleteUserLogo($logoFilePath = null, $onlyFile = false)
{
    /** @var $cfg iMSCP_Config_Handler_File */
    $cfg = iMSCP_Registry::get('config');
    if (null === $logoFilePath) {
        if ($_SESSION['user_type'] == 'admin') {
            $logoFilePath = layout_getUserLogo(true);
        } else {
            $logoFilePath = layout_getUserLogo(false);
        }
    }
    if ($_SESSION['user_type'] == 'admin') {
        $userId = 1;
    } else {
        $userId = $_SESSION['user_id'];
    }
    if (!$onlyFile) {
        exec_query('UPDATE `user_gui_props` SET `logo` = ? WHERE `user_id` = ?', array(null, $userId));
    }
    if (strpos($logoFilePath, $cfg->ISP_LOGO_PATH) !== false) {
        $logoFilePath = $cfg->GUI_ROOT_DIR . '/data/persistent/ispLogos/' . basename($logoFilePath);
        if (file_exists($logoFilePath) && @unlink($logoFilePath)) {
            return true;
        } else {
            write_log(tr("System is unable to remove '%s' user logo.", $logoFilePath), E_USER_WARNING);
            return false;
        }
    }
    return true;
}
Esempio n. 5
0
        } else {
            set_page_message(tr('Unknown layout color.'), 'error');
        }
    } elseif ($_POST['uaction'] == 'changeShowLabels') {
        layout_setMainMenuLabelsVisibility($_SESSION['user_id'], clean_input($_POST['mainMenuShowLabels']));
        set_page_message(tr('Main menu labels visibility successfully updated.'), 'success');
    } else {
        set_page_message(tr('Unknown action: %s', tohtml($_POST['uaction'])), 'error');
    }
}
$html_selected = $cfg->HTML_SELECTED;
$userId = $_SESSION['user_id'];
if (layout_isMainMenuLabelsVisible($userId)) {
    $tpl->assign(array('MAIN_MENU_SHOW_LABELS_ON' => $html_selected, 'MAIN_MENU_SHOW_LABELS_OFF' => ''));
} else {
    $tpl->assign(array('MAIN_MENU_SHOW_LABELS_ON' => '', 'MAIN_MENU_SHOW_LABELS_OFF' => $html_selected));
}
$ispLogo = layout_getUserLogo(false);
if (layout_isUserLogo($ispLogo)) {
    $tpl->parse('LOGO_REMOVE_BUTTON', '.logo_remove_button');
} else {
    $tpl->assign('LOGO_REMOVE_BUTTON', '');
}
$tpl->assign(array('TR_PAGE_TITLE' => tr('Reseller / Profile / Layout'), 'OWN_LOGO' => $ispLogo, 'TR_LAYOUT_SETTINGS' => tr('Layout'), 'TR_UPLOAD_LOGO' => tr('Upload logo'), 'TR_LOGO_FILE' => tr('Logo file'), 'TR_ENABLED' => tr('Enabled'), 'TR_DISABLED' => tr('Disabled'), 'TR_UPLOAD' => tr('Upload'), 'TR_REMOVE' => tr('Remove'), 'TR_LAYOUT_COLOR' => tr('Layout color'), 'TR_CHOOSE_LAYOUT_COLOR' => tr('Choose layout color'), 'TR_CHANGE' => tr('Change'), 'TR_OTHER_SETTINGS' => tr('Other settings'), 'TR_MAIN_MENU_SHOW_LABELS' => tr('Show labels for main menu links')));
generateNavigation($tpl);
generatePageMessage($tpl);
reseller_generateLayoutColorForm($tpl);
$tpl->parse('LAYOUT_CONTENT', 'page');
iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onResellerScriptEnd, array('templateEngine' => $tpl));
$tpl->prnt();
unsetMessages();
Esempio n. 6
0
        if (layout_setUserLayoutColor($userId, $_POST['layoutColor'])) {
            $_SESSION['user_theme_color'] = $_POST['layoutColor'];
            set_page_message(tr('Layout color successfully updated.'), 'success');
        } else {
            set_page_message(tr('Unknown layout color.'), 'error');
        }
    } else {
        set_page_message(tr('Unknown action: %s', tohtml($_POST['uaction'])), 'error');
    }
}
$html_selected = $cfg->HTML_SELECTED;
$userId = $_SESSION['user_id'];
if ($_SESSION['show_main_menu_labels']) {
    $tpl->assign(array('MAIN_MENU_SHOW_LABELS_ON' => $html_selected, 'MAIN_MENU_SHOW_LABELS_OFF' => ''));
} else {
    $tpl->assign(array('MAIN_MENU_SHOW_LABELS_ON' => '', 'MAIN_MENU_SHOW_LABELS_OFF' => $html_selected));
}
$ispLogo = layout_getUserLogo();
if (layout_isUserLogo($ispLogo)) {
    $tpl->parse('LOGO_REMOVE_BUTTON', '.logo_remove_button');
} else {
    $tpl->assign('LOGO_REMOVE_BUTTON', '');
}
$tpl->assign(array('TR_PAGE_TITLE' => tr('Admin / Profile / Layout'), 'ISP_LOGO' => $ispLogo, 'OWN_LOGO' => $ispLogo, 'TR_UPLOAD_LOGO' => tr('Upload logo'), 'TR_LOGO_FILE' => tr('Logo file'), 'TR_ENABLED' => tr('Enabled'), 'TR_DISABLED' => tr('Disabled'), 'TR_UPLOAD' => tr('Upload'), 'TR_REMOVE' => tr('Remove'), 'TR_LAYOUT_COLOR' => tr('Layout color'), 'TR_CHOOSE_LAYOUT_COLOR' => tr('Choose layout color'), 'TR_CHANGE' => tr('Change'), 'TR_OTHER_SETTINGS' => tr('Other settings'), 'TR_MAIN_MENU_SHOW_LABELS' => tr('Show labels for main menu links')));
generateNavigation($tpl);
admin_generateLayoutColorForm($tpl);
generatePageMessage($tpl);
$tpl->parse('LAYOUT_CONTENT', 'page');
iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onAdminScriptEnd, array('templateEngine' => $tpl));
$tpl->prnt();
unsetMessages();
Esempio n. 7
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();