本文整理汇总了PHP中EasySCP_TemplateEngine::assign方法的典型用法代码示例。如果您正苦于以下问题:PHP EasySCP_TemplateEngine::assign方法的具体用法?PHP EasySCP_TemplateEngine::assign怎么用?PHP EasySCP_TemplateEngine::assign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EasySCP_TemplateEngine
的用法示例。
在下文中一共展示了EasySCP_TemplateEngine::assign方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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', '');
}
示例2: 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);
}
}
}
示例3: 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' => ''));
}
示例4: 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);
}
示例5: 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();
}
}
}
示例6: generate_page
/**
* @param EasySCP_TemplateEngine $tpl
* @param int $reseller_id
* @param string $reseller_name
*/
function generate_page($tpl, $reseller_id, $reseller_name)
{
global $rid;
$cfg = EasySCP_Registry::get('Config');
$sql = EasySCP_Registry::get('Db');
$start_index = 0;
$rows_per_page = $cfg->DOMAIN_ROWS_PER_PAGE;
if (isset($_GET['psi'])) {
$start_index = $_GET['psi'];
} else {
if (isset($_POST['psi'])) {
$start_index = $_POST['psi'];
}
}
$tpl->assign(array('POST_PREV_PSI' => $start_index));
// count query
$count_query = "\n\t\tSELECT\n\t\t\tCOUNT(`admin_id`) AS cnt\n\t\tFROM\n\t\t\t`admin`\n\t\tWHERE\n\t\t\t`admin_type` = 'user'\n\t\tAND\n\t\t\t`created_by` = ?\n\t";
$query = <<<SQL_QUERY
\t\tSELECT
\t\t\t`admin_id`
\t\tFROM
\t\t\t`admin`
\t\tWHERE
\t\t\t`admin_type` = 'user'
\t\tAND
\t\t\t`created_by` = ?
\t\tORDER BY
\t\t\t`admin_name` DESC
\t\tLIMIT
\t\t\t{$start_index}, {$rows_per_page}
SQL_QUERY;
$rs = exec_query($sql, $count_query, $reseller_id);
$records_count = $rs->fields['cnt'];
$rs = exec_query($sql, $query, $reseller_id);
$tpl->assign(array('RESELLER_NAME' => tohtml($reseller_name), 'RESELLER_ID' => $reseller_id));
if ($rs->rowCount() == 0) {
$tpl->assign(array('DOMAIN_LIST' => '', 'SCROLL_PREV' => '', 'SCROLL_NEXT' => ''));
} else {
$prev_si = $start_index - $rows_per_page;
if ($start_index == 0) {
$tpl->assign('SCROLL_PREV', '');
} else {
$tpl->assign(array('SCROLL_PREV_GRAY' => '', 'PREV_PSI' => $prev_si, 'RID' => $rid));
}
$next_si = $start_index + $rows_per_page;
if ($next_si + 1 > $records_count) {
$tpl->assign('SCROLL_NEXT', '');
} else {
$tpl->assign(array('SCROLL_NEXT_GRAY' => '', 'NEXT_PSI' => $next_si, 'RID' => $rid));
}
$row = 1;
while (!$rs->EOF) {
$admin_id = $rs->fields['admin_id'];
$query = "\n\t\t\t\tSELECT\n\t\t\t\t\t`domain_id`\n\t\t\t\tFROM\n\t\t\t\t\t`domain`\n\t\t\t\tWHERE\n\t\t\t\t\t`domain_admin_id` = ?\n\t\t\t;";
$dres = exec_query($sql, $query, $admin_id);
generate_domain_entry($tpl, $dres->fields['domain_id'], $row++);
$rs->moveNext();
}
}
}
示例7: 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 : ''));
}
示例8: 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
}
示例9: generate_page
/**
* @param EasySCP_TemplateEngine $tpl
*/
function generate_page($tpl)
{
global $month, $year;
$cfg = EasySCP_Registry::get('Config');
$sql = EasySCP_Registry::get('Db');
$start_index = 0;
$rows_per_page = $cfg->DOMAIN_ROWS_PER_PAGE;
if (isset($_GET['psi']) && is_numeric($_GET['psi'])) {
$start_index = $_GET['psi'];
} else {
if (isset($_POST['psi']) && is_numeric($_GET['psi'])) {
$start_index = $_POST['psi'];
}
}
$tpl->assign(array('POST_PREV_PSI' => $start_index));
// count query
$count_query = "\n\t\tSELECT\n\t\t\tCOUNT(`admin_id`) AS cnt\n\t\tFROM\n\t\t\t`admin`\n\t\tWHERE\n\t\t\t`admin_type` = 'reseller'\n\t";
$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` DESC\n\t\tLIMIT\n\t\t\t{$start_index}, {$rows_per_page};\n\t";
$rs = exec_query($sql, $count_query);
$records_count = $rs->fields['cnt'];
$rs = exec_query($sql, $query);
if ($rs->rowCount() == 0) {
set_page_message(tr('There are no resellers in your system!'), 'info');
return;
} else {
$prev_si = $start_index - $rows_per_page;
if ($start_index == 0) {
$tpl->assign('SCROLL_PREV', '');
} else {
$tpl->assign(array('SCROLL_PREV_GRAY' => '', 'PREV_PSI' => $prev_si));
}
$next_si = $start_index + $rows_per_page;
if ($next_si + 1 > $records_count) {
$tpl->assign('SCROLL_NEXT', '');
} else {
$tpl->assign(array('SCROLL_NEXT_GRAY' => '', 'NEXT_PSI' => $next_si));
}
gen_select_lists($tpl, @$month, @$year);
$row = 1;
while (!$rs->EOF) {
generate_reseller_entry($tpl, $rs->fields['admin_id'], $rs->fields['admin_name'], $row++);
$rs->moveNext();
}
}
}
示例10: prepareTemplate
/**
* Prepares the template
*
* @return void
*/
protected static function prepareTemplate()
{
self::$EasySCP_TemplateEngine = EasySCP_TemplateEngine::getInstance();
// check if i18n support is available
if (function_exists('tr')) {
self::$EasySCP_TemplateEngine->assign(array('TR_PAGE_TITLE' => tr('EasySCP Error'), 'THEME_CHARSET' => tr('encoding'), 'MSG_TYPE' => 'error', 'MESSAGE' => self::$exceptionMessage));
} else {
self::$EasySCP_TemplateEngine->assign(array('TR_PAGE_TITLE' => 'EasySCP Error', 'THEME_CHARSET' => 'UTF-8', 'MSG_TYPE' => 'error', 'MESSAGE' => self::$exceptionMessage));
}
}
示例11: gen_page_ftp_list
/**
* @param EasySCP_TemplateEngine $tpl
* @param EasySCP_Database $sql
* @param int $dmn_id
* @param string $dmn_name
*/
function gen_page_ftp_list($tpl, $sql, $dmn_id, $dmn_name)
{
$query = "\n\t\tSELECT\n\t\t\t`gid`,\n\t\t\t`members`\n\t\tFROM\n\t\t\t`ftp_group`\n\t\tWHERE\n\t\t\t`groupname` = ?\n\t;";
$rs = exec_query($sql, $query, $dmn_name);
if ($rs->recordCount() == 0) {
$tpl->assign(array('FTP_MSG' => tr('FTP list is empty!'), 'FTP_MSG_TYPE' => 'info', 'FTP_ITEM' => '', 'FTPS_TOTAL' => '', 'TABLE_LIST' => ''));
} else {
$ftp_accs = explode(',', $rs->fields['members']);
sort($ftp_accs);
reset($ftp_accs);
for ($i = 0, $cnt_ftp_accs = count($ftp_accs); $i < $cnt_ftp_accs; $i++) {
$tpl->assign('ITEM_CLASS', $i % 2 == 0 ? 'content' : 'content2');
$ftp_accs_encode[$i] = decode_idna($ftp_accs[$i]);
$query = "\n\t\t\t\tSELECT\n\t\t\t\t\t`net2ftppasswd`\n\t\t\t\tFROM\n\t\t\t\t\t`ftp_users`\n\t\t\t\tWHERE\n\t\t\t\t\t`userid` = ?\n\t\t\t;";
$rs = exec_query($sql, $query, $ftp_accs[$i]);
$tpl->append(array('FTP_ACCOUNT' => tohtml($ftp_accs_encode[$i]), 'UID' => urlencode($ftp_accs[$i]), 'FTP_LOGIN_AVAILABLE' => !is_null($rs->fields['net2ftppasswd'])));
}
$tpl->assign('TOTAL_FTP_ACCOUNTS', count($ftp_accs));
}
}
示例12: gen_page_data
/**
* @param EasySCP_TemplateEngine $tpl
* @param EasySCP_Database $sql
*/
function gen_page_data($tpl, $sql)
{
if (isset($_POST['uaction']) && $_POST['uaction'] === 'send_circular') {
$tpl->assign(array('MESSAGE_SUBJECT' => clean_input($_POST['msg_subject'], true), 'MESSAGE_TEXT' => clean_input($_POST['msg_text'], true), 'SENDER_EMAIL' => clean_input($_POST['sender_email'], true), 'SENDER_NAME' => clean_input($_POST['sender_name'], true)));
} else {
$user_id = $_SESSION['user_id'];
$query = "\n\t\t\tSELECT\n\t\t\t\t`fname`, `lname`, `email`\n\t\t\tFROM\n\t\t\t\t`admin`\n\t\t\tWHERE\n\t\t\t\t`admin_id` = ?\n\t\t\tGROUP BY\n\t\t\t\t`email`\n\t\t";
$rs = exec_query($sql, $query, $user_id);
if (isset($rs->fields['fname']) && isset($rs->fields['lname'])) {
$sender_name = $rs->fields['fname'] . ' ' . $rs->fields['lname'];
} elseif (isset($rs->fields['fname']) && !isset($rs->fields['lname'])) {
$sender_name = $rs->fields['fname'];
} elseif (!isset($rs->fields['fname']) && isset($rs->fields['lname'])) {
$sender_name = $rs->fields['lname'];
} else {
$sender_name = '';
}
$tpl->assign(array('MESSAGE_SUBJECT' => '', 'MESSAGE_TEXT' => '', 'SENDER_EMAIL' => tohtml($rs->fields['email']), 'SENDER_NAME' => tohtml($sender_name)));
}
}
示例13: 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));
}
示例14: gen_db_list
/**
* @param EasySCP_TemplateEngine $tpl
* @param EasySCP_Database $sql
* @param int $user_id
*/
function gen_db_list($tpl, $sql, $user_id)
{
$dmn_id = get_user_domain_id($user_id);
$query = "\n\t\tSELECT\n\t\t\t`sqld_id`, `sqld_name`\n\t\tFROM\n\t\t\t`sql_database`\n\t\tWHERE\n\t\t\t`domain_id` = ?\n\t\tORDER BY\n\t\t\t`sqld_name`\n\t";
$rs = exec_query($sql, $query, $dmn_id);
if ($rs->recordCount() == 0) {
set_page_message(tr('Database list is empty!'), 'info');
$tpl->assign('DB_LIST', '');
} else {
while (!$rs->EOF) {
$db_id = $rs->fields['sqld_id'];
$db_name = $rs->fields['sqld_name'];
$num = gen_db_user_list($tpl, $sql, $db_id);
$tpl->append(array('DB_ID' => $db_id, 'DB_NAME' => tohtml($db_name), 'DB_NAME_JS' => tojs($db_name), 'DB_MSG' => $num ? '' : tr('Database user list is empty!')));
$rs->moveNext();
}
}
}
示例15: gen_page_post_data
/**
* @param EasySCP_TemplateEngine $tpl
*/
function gen_page_post_data($tpl)
{
$cfg = EasySCP_Registry::get('Config');
if ($cfg->MYSQL_PREFIX === 'yes') {
$tpl->assign('MYSQL_PREFIX_NO', true);
if ($cfg->MYSQL_PREFIX_TYPE === 'behind') {
$tpl->assign('MYSQL_PREFIX_BEHIND', true);
} else {
$tpl->assign('MYSQL_PREFIX_INFRONT', true);
}
} else {
$tpl->assign('MYSQL_PREFIX_YES', true);
$tpl->assign('MYSQL_PREFIX_ALL', true);
}
if (isset($_POST['uaction']) && $_POST['uaction'] === 'add_db') {
$tpl->assign(array('DB_NAME' => clean_input($_POST['db_name'], true), 'USE_DMN_ID' => isset($_POST['use_dmn_id']) && $_POST['use_dmn_id'] === 'on' ? $cfg->HTML_CHECKED : '', 'START_ID_POS_CHECKED' => isset($_POST['id_pos']) && $_POST['id_pos'] !== 'end' ? $cfg->HTML_CHECKED : '', 'END_ID_POS_CHECKED' => isset($_POST['id_pos']) && $_POST['id_pos'] === 'end' ? $cfg->HTML_CHECKED : ''));
} else {
$tpl->assign(array('DB_NAME' => '', 'USE_DMN_ID' => '', 'START_ID_POS_CHECKED' => $cfg->HTML_CHECKED, 'END_ID_POS_CHECKED' => ''));
}
}