本文整理汇总了PHP中EasySCP_TemplateEngine类的典型用法代码示例。如果您正苦于以下问题:PHP EasySCP_TemplateEngine类的具体用法?PHP EasySCP_TemplateEngine怎么用?PHP EasySCP_TemplateEngine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EasySCP_TemplateEngine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gen_pgroups
/**
* @param EasySCP_TemplateEngine $tpl
* @param EasySCP_Database $sql
* @param int $dmn_id
*/
function gen_pgroups($tpl, $sql, &$dmn_id)
{
$cfg = EasySCP_Registry::get('Config');
$query = "\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\t`htaccess_groups`\n\t\tWHERE\n\t\t\t`dmn_id` = ?\n\t\tORDER BY\n\t\t\t`dmn_id` DESC\n\t";
$rs = exec_query($sql, $query, $dmn_id);
if ($rs->recordCount() == 0) {
$tpl->assign('GROUP_MESSAGE', tr('You have no groups!'));
} else {
while (!$rs->EOF) {
$tpl->append(array('GNAME' => tohtml($rs->fields['ugroup']), 'GSTATUS' => translate_dmn_status($rs->fields['status']), 'GROUP_ID' => $rs->fields['id'], 'GROUP_DELETE' => tr('Delete'), 'GROUP_DELETE_SCRIPT' => $rs->fields['status'] === $cfg->ITEM_OK_STATUS && $rs->fields['ugroup'] != $cfg->AWSTATS_GROUP_AUTH ? "action_delete('protected_group_delete.php?gname=" . $rs->fields['id'] . "', '" . $rs->fields['ugroup'] . "')" : tr('N/A')));
if ($rs->fields['members'] != '') {
$group_members = '';
$members = explode(',', $rs->fields['members']);
$cnt_members = count($members);
for ($i = 0; $i < $cnt_members; $i++) {
$query = "\n\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\t`uname`\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t`htaccess_users`\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t`id` = ?\n\t\t\t\t\t";
$rs_members = exec_query($sql, $query, $members[$i]);
if ($cnt_members == 1 || $cnt_members == $i + 1) {
$group_members .= tohtml($rs_members->fields['uname']);
} else {
$group_members .= tohtml($rs_members->fields['uname']) . ', ';
}
}
$tpl->append('MEMBER', $group_members);
} else {
$tpl->append('MEMBER', '');
}
$rs->moveNext();
}
}
}
示例2: dump_gui_debug
/**
* @param EasySCP_TemplateEngine $tpl
*/
function dump_gui_debug($tpl)
{
$gui_debug_data = '<div id="dump_gui_debug">';
$gui_debug_data .= '<span style="color:#00f;text-decoration:underline;">Content of <strong>$_SESSION</strong>:<br /></span>';
$gui_debug_data .= '<pre>';
$gui_debug_data .= htmlentities(print_r($_SESSION, true));
$gui_debug_data .= '</pre>';
$gui_debug_data .= '<span style="color:#00f;text-decoration:underline;">Content of <strong>$_POST</strong>:<br /></span>';
$gui_debug_data .= '<pre>';
$gui_debug_data .= htmlentities(print_r($_POST, true));
$gui_debug_data .= '</pre>';
$gui_debug_data .= '<span style="color:#00f;text-decoration:underline;">Content of <strong>$_GET</strong>:<br /></span>';
$gui_debug_data .= '<pre>';
$gui_debug_data .= htmlentities(print_r($_GET, true));
$gui_debug_data .= '</pre>';
$gui_debug_data .= '<span style="color:#00f;text-decoration:underline;">Content of <strong>$_COOKIE</strong>:<br /></span>';
$gui_debug_data .= '<pre>';
$gui_debug_data .= htmlentities(print_r($_COOKIE, true));
$gui_debug_data .= '</pre>';
$gui_debug_data .= '<span style="color:#00f;text-decoration:underline;">Content of <strong>$_FILES</strong>:<br /></span>';
$gui_debug_data .= '<pre>';
$gui_debug_data .= htmlentities(print_r($_FILES, true));
$gui_debug_data .= '</pre>';
/* Activate debug code if needed
$gui_debug_data .= '<span style="color:#00f;text-decoration:underline;">Content of <strong>$_SERVER</strong>:<br /></span>';
$gui_debug_data .= '<pre>';
$gui_debug_data .= htmlentities(print_r($_SERVER, true));
$gui_debug_data .= '</pre>';
*/
$gui_debug_data .= '</div>';
$tpl->assign('GUI_DEBUG', $gui_debug_data);
}
示例3: gen_reseller_table
/**
* @todo check if it's useful to have the table admin two times in the same query
* @param EasySCP_TemplateEngine $tpl
*/
function gen_reseller_table($tpl)
{
$cfg = EasySCP_Registry::get('Config');
$sql = EasySCP_Registry::get('Db');
$query = "\n\t\tSELECT\n\t\t\tt1.`admin_id`, t1.`admin_name`, t2.`admin_name` AS created_by\n\t\tFROM\n\t\t\t`admin` AS t1,\n\t\t\t`admin` AS t2\n\t\tWHERE\n\t\t\tt1.`admin_type` = 'reseller'\n\t\tAND\n\t\t\tt1.`created_by` = t2.`admin_id`\n\t\tORDER BY\n\t\t\t`created_by`,\n\t\t\t`admin_id`\n\t";
$rs = exec_query($sql, $query);
$i = 0;
if ($rs->recordCount() == 0) {
set_page_message(tr('Reseller list is empty!'), 'info');
} else {
while (!$rs->EOF) {
$admin_id = $rs->fields['admin_id'];
$admin_id_var_name = "admin_id_" . $admin_id;
$tpl->append(array('NUMBER' => $i + 1, 'RESELLER_NAME' => tohtml($rs->fields['admin_name']), 'OWNER' => tohtml($rs->fields['created_by']), 'CKB_NAME' => $admin_id_var_name));
$rs->moveNext();
$i++;
}
$tpl->assign('PAGE_MESSAGE', '');
}
$query = "\n\t\tSELECT\n\t\t\t`admin_id`, `admin_name`\n\t\tFROM\n\t\t\t`admin`\n\t\tWHERE\n\t\t\t`admin_type` = 'admin'\n\t\tORDER BY\n\t\t\t`admin_name`\n\t";
$rs = exec_query($sql, $query);
while (!$rs->EOF) {
if (isset($_POST['uaction']) && $_POST['uaction'] === 'reseller_owner' && (isset($_POST['dest_admin']) && $_POST['dest_admin'] == $rs->fields['admin_id'])) {
$selected = $cfg->HTML_SELECTED;
} else {
$selected = '';
}
$tpl->append(array('OPTION' => tohtml($rs->fields['admin_name']), 'VALUE' => $rs->fields['admin_id'], 'SELECTED' => $selected));
$rs->moveNext();
}
$tpl->assign('PAGE_MESSAGE', '');
}
示例4: gen_user_table
/**
* @param EasySCP_TemplateEngine $tpl
*/
function gen_user_table($tpl)
{
$cfg = EasySCP_Registry::get('Config');
$sql = EasySCP_Registry::get('Db');
$query = "\n\t\tSELECT\n\t\t\t`admin_id`, `admin_name`\n\t\tFROM\n\t\t\t`admin`\n\t\tWHERE\n\t\t\t`admin_type` = 'reseller'\n\t\tORDER BY\n\t\t\t`admin_name`\n\t";
$rs = exec_query($sql, $query);
if ($rs->recordCount() == 0) {
set_page_message(tr('Reseller or user list is empty!'), 'info');
user_goto('manage_users.php');
}
$reseller_id = $rs->fields['admin_id'];
$all_resellers = array();
while (!$rs->EOF) {
if (isset($_POST['uaction']) && $_POST['uaction'] === 'change_src' && (isset($_POST['src_reseller']) && $_POST['src_reseller'] == $rs->fields['admin_id'])) {
$selected = $cfg->HTML_SELECTED;
$reseller_id = $_POST['src_reseller'];
} else {
if (isset($_POST['uaction']) && $_POST['uaction'] === 'move_user' && (isset($_POST['dst_reseller']) && $_POST['dst_reseller'] == $rs->fields['admin_id'])) {
$selected = $cfg->HTML_SELECTED;
$reseller_id = $_POST['dst_reseller'];
} else {
$selected = '';
}
}
$all_resellers[] = $rs->fields['admin_id'];
$tpl->append(array('SRC_RSL_OPTION' => tohtml($rs->fields['admin_name']), 'SRC_RSL_VALUE' => $rs->fields['admin_id'], 'SRC_RSL_SELECTED' => $selected));
$tpl->append(array('DST_RSL_OPTION' => tohtml($rs->fields['admin_name']), 'DST_RSL_VALUE' => $rs->fields['admin_id'], 'DST_RSL_SELECTED' => ''));
$rs->moveNext();
}
if (isset($_POST['src_reseller']) && $_POST['src_reseller'] == 0) {
$selected = $cfg->HTML_SELECTED;
$reseller_id = 0;
} else {
$selected = '';
}
$tpl->append(array('SRC_RSL_OPTION' => tr("N/A"), 'SRC_RSL_VALUE' => 0, 'SRC_RSL_SELECTED' => $selected));
if ($reseller_id === 0) {
$query = "\n\t\t\tSELECT\n\t\t\t\t`admin_id`, `admin_name`\n\t\t\tFROM\n\t\t\t\t`admin`\n\t\t\tWHERE\n\t\t\t\t`admin_type` = 'user'\n\t\t\tAND\n\t\t\t\t`created_by` NOT IN (?)\n\t\t\tORDER BY\n\t\t\t\t`admin_name`\n\t\t";
$not_in = implode(',', $all_resellers);
$rs = exec_query($sql, $query, $not_in);
} else {
$query = "\n\t\t\tSELECT\n\t\t\t\t`admin_id`, `admin_name`\n\t\t\tFROM\n\t\t\t\t`admin`\n\t\t\tWHERE\n\t\t\t\t`admin_type` = 'user'\n\t\t\tAND\n\t\t\t\t`created_by` = ?\n\t\t\tORDER BY\n\t\t\t\t`admin_name`\n\t\t";
$rs = exec_query($sql, $query, $reseller_id);
}
if ($rs->recordCount() == 0) {
set_page_message(tr('User list is empty!'), 'info');
$tpl->assign('RESELLER_LIST', '');
} else {
$i = 0;
while (!$rs->EOF) {
$admin_id = $rs->fields['admin_id'];
$admin_id_var_name = 'admin_id_' . $admin_id;
$show_admin_name = decode_idna($rs->fields['admin_name']);
$tpl->append(array('NUMBER' => $i + 1, 'USER_NAME' => tohtml($show_admin_name), 'CKB_NAME' => $admin_id_var_name));
$rs->moveNext();
$i++;
}
}
}
示例5: gen_admin_personal_data
/**
* @param EasySCP_TemplateEngine $tpl
* @param int $user_id
*/
function gen_admin_personal_data($tpl, $user_id)
{
$cfg = EasySCP_Registry::get('Config');
$sql = EasySCP_Registry::get('Db');
$query = "\n\t\tSELECT\n\t\t\t`fname`,\n\t\t\t`lname`,\n\t\t\t`gender`,\n\t\t\t`firm`,\n\t\t\t`zip`,\n\t\t\t`city`,\n\t\t\t`state`,\n\t\t\t`country`,\n\t\t\t`street1`,\n\t\t\t`street2`,\n\t\t\t`email`,\n\t\t\t`phone`,\n\t\t\t`fax`\n\t\tFROM\n\t\t\t`admin`\n\t\tWHERE\n\t\t\t`admin_id` = ?\n\t";
$rs = exec_query($sql, $query, $user_id);
$tpl->assign(array('FIRST_NAME' => empty($rs->fields['fname']) ? '' : tohtml($rs->fields['fname']), 'LAST_NAME' => empty($rs->fields['lname']) ? '' : tohtml($rs->fields['lname']), 'FIRM' => empty($rs->fields['firm']) ? '' : tohtml($rs->fields['firm']), 'ZIP' => empty($rs->fields['zip']) ? '' : tohtml($rs->fields['zip']), 'CITY' => empty($rs->fields['city']) ? '' : tohtml($rs->fields['city']), 'STATE' => empty($rs->fields['state']) ? '' : tohtml($rs->fields['state']), 'COUNTRY' => empty($rs->fields['country']) ? '' : tohtml($rs->fields['country']), 'STREET_1' => empty($rs->fields['street1']) ? '' : tohtml($rs->fields['street1']), 'STREET_2' => empty($rs->fields['street2']) ? '' : tohtml($rs->fields['street2']), 'EMAIL' => empty($rs->fields['email']) ? '' : tohtml($rs->fields['email']), 'PHONE' => empty($rs->fields['phone']) ? '' : tohtml($rs->fields['phone']), 'FAX' => empty($rs->fields['fax']) ? '' : tohtml($rs->fields['fax']), 'VL_MALE' => $rs->fields['gender'] == 'M' ? $cfg->HTML_SELECTED : '', 'VL_FEMALE' => $rs->fields['gender'] == 'F' ? $cfg->HTML_SELECTED : '', 'VL_UNKNOWN' => $rs->fields['gender'] == 'U' || empty($rs->fields['gender']) ? $cfg->HTML_SELECTED : ''));
}
示例6: gen_user_assign
/**
* @param EasySCP_TemplateEngine $tpl
* @param EasySCP_Database $sql
* @param int $dmn_id
*/
function gen_user_assign($tpl, $sql, &$dmn_id)
{
if (isset($_GET['uname']) && $_GET['uname'] !== '' && is_numeric($_GET['uname'])) {
$uuser_id = $_GET['uname'];
$tpl->assign('UNAME', tohtml(get_htuser_name($sql, $uuser_id, $dmn_id)));
$tpl->assign('UID', $uuser_id);
} else {
if (isset($_POST['nadmin_name']) && !empty($_POST['nadmin_name']) && is_numeric($_POST['nadmin_name'])) {
$uuser_id = $_POST['nadmin_name'];
$tpl->assign('UNAME', tohtml(get_htuser_name($sql, $uuser_id, $dmn_id)));
$tpl->assign('UID', $uuser_id);
} else {
user_goto('protected_user_manage.php');
}
}
// get groups
$query = "\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\t`htaccess_groups`\n\t\tWHERE\n\t\t\t`dmn_id` = ?\n\t";
$rs = exec_query($sql, $query, $dmn_id);
if ($rs->recordCount() == 0) {
set_page_message(tr('You have no groups!'), 'info');
user_goto('protected_user_manage.php');
} else {
$added_in = 0;
$not_added_in = 0;
while (!$rs->EOF) {
$group_id = $rs->fields['id'];
$group_name = $rs->fields['ugroup'];
$members = $rs->fields['members'];
$members = explode(",", $members);
$grp_in = 0;
// let's generete all groups wher the user is assigned
for ($i = 0, $cnt_members = count($members); $i < $cnt_members; $i++) {
if ($uuser_id == $members[$i]) {
$tpl->append(array('GRP_IN' => tohtml($group_name), 'GRP_IN_ID' => $group_id));
$grp_in = $group_id;
$added_in++;
}
}
if ($grp_in !== $group_id) {
$tpl->append(array('GRP_NAME' => tohtml($group_name), 'GRP_ID' => $group_id));
$not_added_in++;
}
$rs->moveNext();
}
// generate add/remove buttons
if ($added_in != 0) {
$tpl->assign('IN_GROUP', true);
}
if ($not_added_in != 0) {
$tpl->assign('NOT_IN_GROUP', true);
}
}
}
示例7: gen_htaccess_entries
/**
* @param EasySCP_TemplateEngine $tpl
* @param EasySCP_Database $sql
* @param int $dmn_id
*/
function gen_htaccess_entries($tpl, $sql, &$dmn_id)
{
$query = "\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\t`htaccess`\n\t\tWHERE\n\t\t\t`dmn_id` = ?\n\t";
$rs = exec_query($sql, $query, $dmn_id);
if ($rs->recordCount() == 0) {
set_page_message(tr('You do not have protected areas'), 'info');
} else {
while (!$rs->EOF) {
$auth_name = $rs->fields['auth_name'];
$tpl->append(array('AREA_NAME' => tohtml($auth_name), 'JS_AREA_NAME' => addslashes($auth_name), 'AREA_PATH' => tohtml($rs->fields['path']), 'PID' => $rs->fields['id'], 'STATUS' => translate_dmn_status($rs->fields['status'])));
$rs->moveNext();
}
}
}
示例8: gen_directories
/**
* @param EasySCP_TemplateEngine $tpl
*/
function gen_directories($tpl)
{
$sql = EasySCP_Registry::get('Db');
// Initialize variables
$path = isset($_GET['cur_dir']) ? $_GET['cur_dir'] : '';
$domain = $_SESSION['user_logged'];
// Create the virtual file system and open it so it can be used
$vfs = new EasySCP_VirtualFileSystem($domain, $sql);
// Get the directory listing
$list = $vfs->ls($path);
if (!$list) {
set_page_message(tr('Cannot open directory!<br />Please contact your administrator!'), 'error');
return;
}
// Show parent directory link
$parent = explode(DIRECTORY_SEPARATOR, $path);
array_pop($parent);
$parent = implode(DIRECTORY_SEPARATOR, $parent);
$tpl->append(array('ACTION' => '', 'ACTION_LINK' => 'no', 'ICON' => "parent", 'DIR_NAME' => tr('Parent Directory'), 'CHOOSE_IT' => '', 'LINK' => 'ftp_choose_dir.php?cur_dir=' . $parent));
// Show directories only
foreach ($list as $entry) {
// Skip non-directory entries
if ($entry['type'] != EasySCP_VirtualFileSystem::VFS_TYPE_DIR) {
continue;
}
// Skip '.' and '..'
if ($entry['file'] == '.' || $entry['file'] == '..') {
continue;
}
// Check for .htaccess existence to display another icon
$dr = $path . '/' . $entry['file'];
$tfile = $dr . '/.htaccess';
if ($vfs->exists($tfile)) {
$image = "locked";
} else {
$image = "folder";
}
// Check if folder does not contain a folder that can not be protected
// @todo: valid directories (e.g. /htdocs/disabled/) are excluded (false positive)
$forbiddenDirnames = '/backups|disabled|errors|logs|phptmp/i';
$forbidden = preg_match($forbiddenDirnames, $entry['file']);
if ($forbidden === 1) {
$tpl->append('ACTION_LINK', 'no');
} else {
$tpl->append('ACTION_LINK', 'yes');
}
// Create the directory link
$tpl->append(array('PROTECT_IT' => "protected_areas_add.php?file=" . $dr, 'ICON' => $image, 'DIR_NAME' => tohtml($entry['file']), 'CHOOSE_IT' => $dr, 'LINK' => "ftp_choose_dir.php?cur_dir=" . $dr));
}
}
示例9: gen_error_page_data
/**
* @param EasySCP_TemplateEngine $tpl
* @param EasySCP_Database $sql
* @param int $user_id
* @param string $eid
*/
function gen_error_page_data($tpl, $sql, $eid)
{
$domain = $_SESSION['user_logged'];
// Check if we already have an error page
$vfs = new EasySCP_VirtualFileSystem($domain, $sql);
$error = $vfs->get('/errors/' . $eid . '.html');
if (false !== $error) {
// We already have an error page, return it
$tpl->assign(array('ERROR' => tohtml($error)));
return;
}
// No error page
$tpl->assign(array('ERROR' => ''));
}
示例10: gen_hp_table
/**
* Extract and show data for hosting plans
* @param EasySCP_TemplateEngine $tpl
* @param int $reseller_id
*/
function gen_hp_table($tpl, $reseller_id)
{
global $external_event;
$sql = EasySCP_Registry::get('Db');
$cfg = EasySCP_Registry::get('Config');
if (isset($cfg->HOSTING_PLANS_LEVEL) && $cfg->HOSTING_PLANS_LEVEL === 'admin') {
$query = "\n\t\t\tSELECT\n\t\t\t\tt1.`id`, t1.`reseller_id`, t1.`name`, t1.`props`, t1.`status`,\n\t\t\t\tt2.`admin_id`, t2.`admin_type`\n\t\t\tFROM\n\t\t\t\t`hosting_plans` AS t1,\n\t\t\t\t`admin` AS t2\n\t\t\tWHERE\n\t\t\t\tt2.`admin_type` = ?\n\t\t\tAND\n\t\t\t\tt1.`reseller_id` = t2.`admin_id`\n\t\t\tAND\n\t\t\t\tt1.`status` = 1\n\t\t\tORDER BY\n\t\t\t\tt1.`name`\n\t\t";
$rs = exec_query($sql, $query, 'admin');
$tr_edit = tr('View details');
$tpl->assign('HP_MENU_ADD', '');
} else {
$query = "\n\t\t\tSELECT\n\t\t\t\t`id`, `name`, `props`, `status`\n\t\t\tFROM\n\t\t\t\t`hosting_plans`\n\t\t\tWHERE\n\t\t\t\t`reseller_id` = ?\n\t\t\tORDER BY\n\t\t\t\t`name`\n\t\t";
$rs = exec_query($sql, $query, $reseller_id);
}
if ($rs->rowCount() == 0) {
set_page_message(tr('Hosting plans not found!'), 'info');
$tpl->assign('HP_TABLE', '');
} else {
// There is data for hosting plans :-)
if ($external_event == '_off_') {
$tpl->assign('HP_MESSAGE', '');
}
$tpl->assign(array('TR_HOSTING_PLANS' => tr('Hosting plans'), 'TR_NOM' => tr('No.'), 'TR_EDIT' => tr('Edit'), 'TR_DELETE' => tr('Delete'), 'PLAN_SHOW' => tr('Show hosting plan'), 'TR_PLAN_NAME' => tr('Name'), 'TR_ACTION' => tr('Actions')));
$coid = isset($cfg->CUSTOM_ORDERPANEL_ID) ? $cfg->CUSTOM_ORDERPANEL_ID : '';
$i = 1;
while ($data = $rs->fetchRow()) {
$status = $data['status'] ? tr('Enabled') : tr('Disabled');
$tpl->append(array('PLAN_NOM' => $i++, 'PLAN_NAME' => tohtml($data['name']), 'PLAN_NAME2' => addslashes(clean_html($data['name'])), 'PURCHASING' => $status, 'CUSTOM_ORDERPANEL_ID' => $coid, 'HP_ID' => $data['id'], 'RESELLER_ID' => $_SESSION['user_id']));
}
}
}
示例11: getInstance
/**
* Get an EasySCP_TemplateEngine instance
*
* Returns an {@link EasySCP_TemplateEngine} instance, only creating it if it
* doesn't already exist.
*
* @return EasySCP_TemplateEngine An EasySCP_TemplateEngine instance
*/
public static function getInstance()
{
if (is_null(self::$_instance)) {
self::$_instance = new self();
}
return self::$_instance;
}
示例12: system_message
/**
* Generates a page message if something terribly goes wrong.
*
* @todo possible session injection, check $_SESSION['user_theme'] for valid
* value
*
* @param String $msg Message Content
* @param String $type Message Type (notice, warning, error, success)
* @param string $backButtonDestination Destiation where to go on back link
* click
*/
function system_message($msg, $type = 'error', $backButtonDestination = '')
{
$cfg = EasySCP_Registry::get('Config');
$theme_color = isset($_SESSION['user_theme']) ? $_SESSION['user_theme'] : $cfg->USER_INITIAL_THEME;
if (empty($backButtonDestination)) {
$backButtonDestination = "javascript:history.go(-1)";
}
$tpl = EasySCP_TemplateEngine::getInstance();
// If we are on the login page, path will be like this
$template = 'system-message.tpl';
if (!is_file($tpl->get_template_dir() . '/' . $template)) {
// But if we're inside the panel it will be like this
$template = '../system-message.tpl';
}
if (!is_file($tpl->get_template_dir() . '/' . $template)) {
// And if we don't find the template, we'll just displaying error
// message
throw new EasySCP_Exception($msg);
}
// Small workaround to be able to use the system_message() function during
// EasySCP initialization process without i18n support
if (function_exists('tr')) {
$tpl->assign(array('TR_PAGE_TITLE' => tr('EasySCP Error'), 'TR_BACK' => tr('Back'), 'TR_ERROR_MESSAGE' => tr('Error Message'), 'MESSAGE' => $msg, 'MSG_TYPE' => $type, 'BACKBUTTONDESTINATION' => $backButtonDestination, 'TR_LOGIN' => tr('Login'), 'TR_USERNAME' => tr('Username'), 'TR_PASSWORD' => tr('Password'), 'TR_LOSTPW' => tr('Lost password'), 'TR_WEBMAIL_SSL_LINK' => 'webmail', 'TR_FTP_SSL_LINK' => 'ftp', 'TR_PMA_SSL_LINK' => 'pma'));
} else {
$tpl->assign(array('TR_PAGE_TITLE' => 'EasySCP Error', 'TR_BACK' => 'Back', 'TR_ERROR_MESSAGE' => 'Error Message', 'MESSAGE' => $msg, 'MSG_TYPE' => $type, 'BACKBUTTONDESTINATION' => $backButtonDestination, 'TR_LOGIN' => 'Login', 'TR_USERNAME' => 'Username', 'TR_PASSWORD' => 'Password', 'TR_LOSTPW' => 'Lost password', 'TR_WEBMAIL_SSL_LINK' => 'webmail', 'TR_FTP_SSL_LINK' => 'ftp', 'TR_PMA_SSL_LINK' => 'pma'));
}
$tpl->display($template);
exit;
}
示例13: add_reseller
/**
* @param EasySCP_TemplateEngine $tpl
*/
function add_reseller($tpl)
{
global $reseller_ips;
$cfg = EasySCP_Registry::get('Config');
$sql = EasySCP_Registry::get('Db');
if (isset($_POST['uaction']) && $_POST['uaction'] === 'add_reseller') {
if (check_user_data()) {
$upass = crypt_user_pass($_POST['pass']);
$user_id = $_SESSION['user_id'];
$username = clean_input($_POST['username']);
$fname = clean_input($_POST['fname']);
$lname = clean_input($_POST['lname']);
$gender = clean_input($_POST['gender']);
$firm = clean_input($_POST['firm']);
$zip = clean_input($_POST['zip']);
$city = clean_input($_POST['city']);
$state = clean_input($_POST['state']);
$country = clean_input($_POST['country']);
$email = clean_input($_POST['email']);
$phone = clean_input($_POST['phone']);
$fax = clean_input($_POST['fax']);
$street1 = clean_input($_POST['street1']);
$street2 = clean_input($_POST['street2']);
$query = "\n\t\t\t\tINSERT INTO `admin` (\n\t\t\t\t\t`admin_name`,\n\t\t\t\t\t`admin_pass`,\n\t\t\t\t\t`admin_type`,\n\t\t\t\t\t`domain_created`,\n\t\t\t\t\t`created_by`,\n\t\t\t\t\t`fname`,\n\t\t\t\t\t`lname`,\n\t\t\t\t\t`firm`,\n\t\t\t\t\t`zip`,\n\t\t\t\t\t`city`,\n\t\t\t\t\t`state`,\n\t\t\t\t\t`country`,\n\t\t\t\t\t`email`,\n\t\t\t\t\t`phone`,\n\t\t\t\t\t`fax`,\n\t\t\t\t\t`street1`,\n\t\t\t\t\t`street2`,\n\t\t\t\t\t`gender`\n\t\t\t\t) VALUES (\n\t\t\t\t\t?,\n\t\t\t\t\t?,\n\t\t\t\t\t'reseller',\n\t\t\t\t\tunix_timestamp(),\n\t\t\t\t\t?,\n\t\t\t\t\t?,\n\t\t\t\t\t?,\n\t\t\t\t\t?,\n\t\t\t\t\t?,\n\t\t\t\t\t?,\n\t\t\t\t\t?,\n\t\t\t\t\t?,\n\t\t\t\t\t?,\n\t\t\t\t\t?,\n\t\t\t\t\t?,\n\t\t\t\t\t?,\n\t\t\t\t\t?,\n\t\t\t\t\t?\n\t\t\t\t)\n\t\t\t";
exec_query($sql, $query, array($username, $upass, $user_id, $fname, $lname, $firm, $zip, $city, $state, $country, $email, $phone, $fax, $street1, $street2, $gender));
$new_admin_id = $sql->insertId();
$user_logged = $_SESSION['user_logged'];
write_log("{$user_logged}: add reseller: {$username}");
// $user_def_lang = $cfg->USER_INITIAL_LANG;
$user_def_lang = '';
// $user_theme_color = $cfg->USER_INITIAL_THEME;
$user_theme_color = '';
$query = "\n\t\t\t\tINSERT INTO `user_gui_props`\n\t\t\t\t\t(\n\t\t\t\t\t`user_id`,\n\t\t\t\t\t`lang`,\n\t\t\t\t\t`layout`\n\t\t\t\t\t)\n\t\t\t\tVALUES\n\t\t\t\t\t(?, ?, ?)\n\t\t\t";
exec_query($sql, $query, array($new_admin_id, $user_def_lang, $user_theme_color));
/*
* 'reseller_props' table entry;
*/
$nreseller_max_domain_cnt = clean_input($_POST['nreseller_max_domain_cnt']);
$nreseller_max_subdomain_cnt = clean_input($_POST['nreseller_max_subdomain_cnt']);
$nreseller_max_alias_cnt = clean_input($_POST['nreseller_max_alias_cnt']);
$nreseller_max_mail_cnt = clean_input($_POST['nreseller_max_mail_cnt']);
$nreseller_max_ftp_cnt = clean_input($_POST['nreseller_max_ftp_cnt']);
$nreseller_max_sql_db_cnt = clean_input($_POST['nreseller_max_sql_db_cnt']);
$nreseller_max_sql_user_cnt = clean_input($_POST['nreseller_max_sql_user_cnt']);
$nreseller_max_traffic = clean_input($_POST['nreseller_max_traffic']);
$nreseller_max_disk = clean_input($_POST['nreseller_max_disk']);
$customer_id = clean_input($_POST['customer_id']);
$support_system = clean_input($_POST['support_system']);
$query = "\n\t\t\t\tINSERT INTO `reseller_props` (\n\t\t\t\t\t`reseller_id`, `reseller_ips`,\n\t\t\t\t\t`max_dmn_cnt`, `current_dmn_cnt`,\n\t\t\t\t\t`max_sub_cnt`, `current_sub_cnt`,\n\t\t\t\t\t`max_als_cnt`, `current_als_cnt`,\n\t\t\t\t\t`max_mail_cnt`, `current_mail_cnt`,\n\t\t\t\t\t`max_ftp_cnt`, `current_ftp_cnt`,\n\t\t\t\t\t`max_sql_db_cnt`, `current_sql_db_cnt`,\n\t\t\t\t\t`max_sql_user_cnt`, `current_sql_user_cnt`,\n\t\t\t\t\t`max_traff_amnt`, `current_traff_amnt`,\n\t\t\t\t\t`max_disk_amnt`, `current_disk_amnt`,\n\t\t\t\t\t`support_system`, `customer_id`\n\t\t\t\t) VALUES (\n\t\t\t\t\t?, ?,\n\t\t\t\t\t?, '0',\n\t\t\t\t\t?, '0',\n\t\t\t\t\t?, '0',\n\t\t\t\t\t?, '0',\n\t\t\t\t\t?, '0',\n\t\t\t\t\t?, '0',\n\t\t\t\t\t?, '0',\n\t\t\t\t\t?, '0',\n\t\t\t\t\t?, '0',\n\t\t\t\t\t?, ?\n\t\t\t\t)\n\t\t\t\t";
exec_query($sql, $query, array($new_admin_id, $reseller_ips, $nreseller_max_domain_cnt, $nreseller_max_subdomain_cnt, $nreseller_max_alias_cnt, $nreseller_max_mail_cnt, $nreseller_max_ftp_cnt, $nreseller_max_sql_db_cnt, $nreseller_max_sql_user_cnt, $nreseller_max_traffic, $nreseller_max_disk, $support_system, $customer_id));
send_add_user_auto_msg($user_id, clean_input($_POST['username']), $_POST['pass'], clean_input($_POST['email']), clean_input($_POST['fname']), clean_input($_POST['lname']), tr('Reseller'), $gender);
$_SESSION['reseller_added'] = 1;
user_goto('manage_users.php');
} else {
$tpl->assign(array('EMAIL' => clean_input($_POST['email'], true), 'USERNAME' => clean_input($_POST['username'], true), 'FIRST_NAME' => clean_input($_POST['fname'], true), 'CUSTOMER_ID' => clean_input($_POST['customer_id'], true), 'LAST_NAME' => clean_input($_POST['lname'], true), 'FIRM' => clean_input($_POST['firm'], true), 'ZIP' => clean_input($_POST['zip'], true), 'CITY' => clean_input($_POST['city'], true), 'STATE' => clean_input($_POST['state'], true), 'COUNTRY' => clean_input($_POST['country'], true), 'STREET_1' => clean_input($_POST['street1'], true), 'STREET_2' => clean_input($_POST['street2'], true), 'PHONE' => clean_input($_POST['phone'], true), 'FAX' => clean_input($_POST['fax'], true), 'VL_MALE' => $_POST['gender'] == 'M' ? $cfg->HTML_SELECTED : '', 'VL_FEMALE' => $_POST['gender'] == 'F' ? $cfg->HTML_SELECTED : '', 'VL_UNKNOWN' => $_POST['gender'] == 'U' || empty($_POST['gender']) ? $cfg->HTML_SELECTED : '', 'MAX_DOMAIN_COUNT' => clean_input($_POST['nreseller_max_domain_cnt'], true), 'MAX_SUBDOMAIN_COUNT' => clean_input($_POST['nreseller_max_subdomain_cnt'], true), 'MAX_ALIASES_COUNT' => clean_input($_POST['nreseller_max_alias_cnt'], true), 'MAX_MAIL_USERS_COUNT' => clean_input($_POST['nreseller_max_mail_cnt'], true), 'MAX_FTP_USERS_COUNT' => clean_input($_POST['nreseller_max_ftp_cnt'], true), 'MAX_SQLDB_COUNT' => clean_input($_POST['nreseller_max_sql_db_cnt'], true), 'MAX_SQL_USERS_COUNT' => clean_input($_POST['nreseller_max_sql_user_cnt'], true), 'MAX_TRAFFIC_AMOUNT' => clean_input($_POST['nreseller_max_traffic'], true), 'MAX_DISK_AMOUNT' => clean_input($_POST['nreseller_max_disk'], true), 'SUPPORT_SYSTEM_YES' => $_POST['support_system'] == 'yes' ? $cfg->HTML_SELECTED : '', 'SUPPORT_SYSTEM_NO' => $_POST['support_system'] == 'no' ? $cfg->HTML_SELECTED : '', 'SUPPORT_SYSTEM' => clean_input($_POST['support_system'], true)));
}
} else {
$tpl->assign(array('EMAIL' => '', 'USERNAME' => '', 'FIRST_NAME' => '', 'CUSTOMER_ID' => '', 'LAST_NAME' => '', 'FIRM' => '', 'ZIP' => '', 'CITY' => '', 'STATE' => '', 'COUNTRY' => '', 'STREET_1' => '', 'STREET_2' => '', 'PHONE' => '', 'FAX' => '', 'VL_MALE' => '', 'VL_FEMALE' => '', 'VL_UNKNOWN' => $cfg->HTML_SELECTED, 'MAX_DOMAIN_COUNT' => '', 'MAX_SUBDOMAIN_COUNT' => '', 'MAX_ALIASES_COUNT' => '', 'MAX_MAIL_USERS_COUNT' => '', 'MAX_FTP_USERS_COUNT' => '', 'MAX_SQLDB_COUNT' => '', 'MAX_SQL_USERS_COUNT' => '', 'MAX_TRAFFIC_AMOUNT' => '', 'MAX_DISK_AMOUNT' => '', 'SUPPORT_SYSTEM_YES' => $cfg->HTML_SELECTED, 'SUPPORT_SYSTEM_NO' => ''));
}
}
示例14: add_user
/**
* @param EasySCP_TemplateEngine $tpl
*/
function add_user($tpl)
{
$cfg = EasySCP_Registry::get('Config');
$sql = EasySCP_Registry::get('Db');
if (isset($_POST['uaction']) && $_POST['uaction'] === 'add_user') {
if (check_user_data()) {
$upass = crypt_user_pass($_POST['pass']);
$user_id = $_SESSION['user_id'];
$username = clean_input($_POST['username']);
$fname = clean_input($_POST['fname']);
$lname = clean_input($_POST['lname']);
$gender = clean_input($_POST['gender']);
$firm = clean_input($_POST['firm']);
$zip = clean_input($_POST['zip']);
$city = clean_input($_POST['city']);
$state = clean_input($_POST['state']);
$country = clean_input($_POST['country']);
$email = clean_input($_POST['email']);
$phone = clean_input($_POST['phone']);
$fax = clean_input($_POST['fax']);
$street1 = clean_input($_POST['street1']);
$street2 = clean_input($_POST['street2']);
if (get_gender_by_code($gender, true) === null) {
$gender = '';
}
$query = "\n\t\t\t\tINSERT INTO `admin`\n\t\t\t\t\t(\n\t\t\t\t\t\t`admin_name`,\n\t\t\t\t\t\t`admin_pass`,\n\t\t\t\t\t\t`admin_type`,\n\t\t\t\t\t\t`domain_created`,\n\t\t\t\t\t\t`created_by`,\n\t\t\t\t\t\t`fname`,\n\t\t\t\t\t\t`lname`,\n\t\t\t\t\t\t`firm`,\n\t\t\t\t\t\t`zip`,\n\t\t\t\t\t\t`city`,\n\t\t\t\t\t\t`state`,\n\t\t\t\t\t\t`country`,\n\t\t\t\t\t\t`email`,\n\t\t\t\t\t\t`phone`,\n\t\t\t\t\t\t`fax`,\n\t\t\t\t\t\t`street1`,\n\t\t\t\t\t\t`street2`,\n\t\t\t\t\t\t`gender`\n\t\t\t\t\t) VALUES (\n\t\t\t\t\t\t?,\n\t\t\t\t\t\t?,\n\t\t\t\t\t\t'admin',\n\t\t\t\t\t\tunix_timestamp(),\n\t\t\t\t\t\t?,\n\t\t\t\t\t\t?,\n\t\t\t\t\t\t?,\n\t\t\t\t\t\t?,\n\t\t\t\t\t\t?,\n\t\t\t\t\t\t?,\n\t\t\t\t\t\t?,\n\t\t\t\t\t\t?,\n\t\t\t\t\t\t?,\n\t\t\t\t\t\t?,\n\t\t\t\t\t\t?,\n\t\t\t\t\t\t?,\n\t\t\t\t\t\t?,\n\t\t\t\t\t\t?\n\t\t\t\t\t)\n\t\t\t";
exec_query($sql, $query, array($username, $upass, $user_id, $fname, $lname, $firm, $zip, $city, $state, $country, $email, $phone, $fax, $street1, $street2, $gender));
$new_admin_id = $sql->insertId();
$user_logged = $_SESSION['user_logged'];
write_log("{$user_logged}: add admin: {$username}");
$user_def_lang = $_SESSION['user_def_lang'];
$user_theme_color = $_SESSION['user_theme'];
$query = "\n\t\t\t\tINSERT INTO `user_gui_props` (\n\t\t\t\t\t`user_id`,\n\t\t\t\t\t`lang`,\n\t\t\t\t\t`layout`\n\t\t\t\t) VALUES (?,?,?)\n\t\t\t";
exec_query($sql, $query, array($new_admin_id, $user_def_lang, $user_theme_color));
send_add_user_auto_msg($user_id, clean_input($_POST['username']), clean_input($_POST['pass']), clean_input($_POST['email']), clean_input($_POST['fname']), clean_input($_POST['lname']), tr('Administrator'), $gender);
$_SESSION['user_added'] = 1;
user_goto('manage_users.php');
} else {
// check user data
$tpl->assign(array('EMAIL' => clean_input($_POST['email'], true), 'USERNAME' => clean_input($_POST['username'], true), 'FIRST_NAME' => clean_input($_POST['fname'], true), 'LAST_NAME' => clean_input($_POST['lname'], true), 'FIRM' => clean_input($_POST['firm'], true), 'ZIP' => clean_input($_POST['zip'], true), 'CITY' => clean_input($_POST['city'], true), 'STATE' => clean_input($_POST['state'], true), 'COUNTRY' => clean_input($_POST['country'], true), 'STREET_1' => clean_input($_POST['street1'], true), 'STREET_2' => clean_input($_POST['street2'], true), 'PHONE' => clean_input($_POST['phone'], true), 'FAX' => clean_input($_POST['fax'], true), 'VL_MALE' => $_POST['gender'] == 'M' ? $cfg->HTML_SELECTED : '', 'VL_FEMALE' => $_POST['gender'] == 'F' ? $cfg->HTML_SELECTED : '', 'VL_UNKNOWN' => $_POST['gender'] == 'U' || empty($_POST['gender']) ? $cfg->HTML_SELECTED : ''));
}
} else {
$tpl->assign(array('EMAIL' => '', 'USERNAME' => '', 'FIRST_NAME' => '', 'LAST_NAME' => '', 'FIRM' => '', 'ZIP' => '', 'CITY' => '', 'STATE' => '', 'COUNTRY' => '', 'STREET_1' => '', 'STREET_2' => '', 'PHONE' => '', 'FAX' => '', 'VL_MALE' => '', 'VL_FEMALE' => '', 'VL_UNKNOWN' => $cfg->HTML_SELECTED));
}
// end else
}
示例15: gen_page_dynamic_data
/**
* @param EasySCP_TemplateEngine $tpl
* @param EasySCP_Database $sql
* @param string $ftp_acc
*/
function gen_page_dynamic_data($tpl, $sql, $ftp_acc)
{
$cfg = EasySCP_Registry::get('Config');
$query = "\n\t\tSELECT\n\t\t\t`homedir`\n\t\tFROM\n\t\t\t`ftp_users`\n\t\tWHERE\n\t\t\t`userid` = ?\n\t";
$rs = exec_query($sql, $query, $ftp_acc);
$homedir = $rs->fields['homedir'];
$domain_ftp = $_SESSION['user_logged'];
$nftp_dir = $cfg->FTP_HOMEDIR . "/" . $domain_ftp;
if ($nftp_dir == $homedir) {
$odir = '';
$oins = '';
} else {
$odir = $cfg->HTML_CHECKED;
$oins = substr($homedir, strlen($nftp_dir));
}
$tpl->assign(array('FTP_ACCOUNT' => $ftp_acc, 'ID' => $ftp_acc, 'USE_OTHER_DIR_CHECKED' => $odir, 'OTHER_DIR' => $oins));
}