当前位置: 首页>>代码示例>>PHP>>正文


PHP EasySCP_TemplateEngine::append方法代码示例

本文整理汇总了PHP中EasySCP_TemplateEngine::append方法的典型用法代码示例。如果您正苦于以下问题:PHP EasySCP_TemplateEngine::append方法的具体用法?PHP EasySCP_TemplateEngine::append怎么用?PHP EasySCP_TemplateEngine::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EasySCP_TemplateEngine的用法示例。


在下文中一共展示了EasySCP_TemplateEngine::append方法的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', '');
}
开发者ID:gOOvER,项目名称:EasySCP,代码行数:36,代码来源:manage_reseller_owners.php

示例2: 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++;
        }
    }
}
开发者ID:gOOvER,项目名称:EasySCP,代码行数:62,代码来源:manage_reseller_users.php

示例3: 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));
    }
}
开发者ID:gOOvER,项目名称:EasySCP,代码行数:53,代码来源:ftp_choose_dir.php

示例4: 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();
        }
    }
}
开发者ID:gOOvER,项目名称:EasySCP,代码行数:36,代码来源:protected_user_manage.php

示例5: get_server_ip

/**
 * Get Server IPs
 * @param EasySCP_TemplateEngine $tpl
 */
function get_server_ip($tpl)
{
    $cfg = EasySCP_Registry::get('Config');
    $sql = EasySCP_Registry::get('Db');
    $query = "\n\t\tSELECT\n\t\t\t`ip_id`, `ip_number`, `ip_domain`\n\t\tFROM\n\t\t\t`server_ips`\n\t\tORDER BY\n\t\t\t`ip_number`\n\t";
    $rs = exec_query($sql, $query);
    $i = 0;
    $reseller_ips = '';
    if ($rs->recordCount() == 0) {
        $tpl->assign(array('RSL_IP_MESSAGE' => tr('Reseller IP list is empty!'), 'RSL_IP_MESSAGE_TYPE' => 'info'));
    } else {
        $tpl->assign(array('TR_RSL_IP_NUMBER' => tr('No.'), 'TR_RSL_IP_ASSIGN' => tr('Assign'), 'TR_RSL_IP_LABEL' => tr('Label'), 'TR_RSL_IP_IP' => tr('Number')));
        while (!$rs->EOF) {
            $ip_id = $rs->fields['ip_id'];
            $ip_var_name = "ip_{$ip_id}";
            if (isset($_POST[$ip_var_name]) && $_POST[$ip_var_name] == 'asgned') {
                $ip_item_assigned = $cfg->HTML_CHECKED;
                $reseller_ips .= "{$ip_id};";
            } else {
                $ip_item_assigned = '';
            }
            $tpl->append(array('RSL_IP_NUMBER' => $i + 1, 'RSL_IP_LABEL' => $rs->fields['ip_domain'], 'RSL_IP_IP' => $rs->fields['ip_number'], 'RSL_IP_CKB_NAME' => $ip_var_name, 'RSL_IP_CKB_VALUE' => 'asgned', 'RSL_IP_ITEM_ASSIGNED' => $ip_item_assigned));
            $rs->moveNext();
            $i++;
        }
    }
    return $reseller_ips;
}
开发者ID:gOOvER,项目名称:EasySCP,代码行数:32,代码来源:reseller_add.php

示例6: listIPDomains

/**
 * Generate List of Domains assigned to IPs
 *
 * @param EasySCP_TemplateEngine $tpl
 */
function listIPDomains($tpl)
{
    $sql = EasySCP_Registry::get('Db');
    $query = "\n\t\tSELECT\n\t\t\tip_id, ip_number, ip_number_v6\n\t\tFROM\n\t\t\tserver_ips;\n\t";
    $rs = exec_query($sql, $query);
    while (!$rs->EOF) {
        $no_domains = false;
        $no_alias_domains = false;
        $domains = array();
        $reseller = array();
        $query = "\n\t\t\tSELECT\n\t\t\t\t`d`.`domain_name`, `a`.`admin_name`\n\t\t\tFROM\n\t\t\t\t`domain` d\n\t\t\tINNER JOIN\n\t\t\t\t`admin` a\n\t\t\tON\n\t\t\t\t(`a`.`admin_id` = `d`.`domain_created_id`)\n\t\t\tWHERE\n\t\t\t\t`d`.`domain_ip_id` = ?\n\t\t\tORDER BY\n\t\t\t\t`d`.`domain_name`;\n\t\t";
        $rs2 = exec_query($sql, $query, $rs->fields['ip_id']);
        $domain_count = $rs2->recordCount();
        if ($rs2->recordCount() == 0) {
            $no_domains = true;
        }
        while (!$rs2->EOF) {
            $domains[] = $rs2->fields['domain_name'];
            $reseller[] = $rs2->fields['admin_name'];
            $rs2->moveNext();
        }
        $query = "\n\t\t\tSELECT\n\t\t\t\t`da`.`alias_name`, `a`.`admin_name`\n\t\t\tFROM\n\t\t\t\t`domain_aliasses` da\n\t\t\tINNER JOIN\n\t\t\t\t`domain` d\n\t\t\tON\n\t\t\t\t(`d`.`domain_id` = `da`.`domain_id`)\n\t\t\tINNER JOIN\n\t\t\t\t`admin` a\n\t\t\tON\n\t\t\t\t(`a`.`admin_id` = `d`.`domain_created_id`)\n\t\t\tWHERE\n\t\t\t\t`da`.`alias_ip_id` = ?\n\t\t\tORDER BY\n\t\t\t\t`da`.`alias_name`;\n\t\t";
        $rs3 = exec_query($sql, $query, $rs->fields['ip_id']);
        $alias_count = $rs3->recordCount();
        if ($rs3->recordCount() == 0) {
            $no_alias_domains = true;
        }
        while (!$rs3->EOF) {
            $domains[] = $rs3->fields['alias_name'];
            $reseller[] = $rs3->fields['admin_name'];
            $rs3->moveNext();
        }
        if ($no_domains && $no_alias_domains) {
            $tpl->append(array('DOMAIN_NAME' => array(tr("No records found")), 'RESELLER_NAME' => array('')));
        } else {
            $tpl->append(array('DOMAIN_NAME' => $domains, 'RESELLER_NAME' => $reseller));
        }
        $tpl->append(array('IP' => $rs->fields['ip_number_v6'] != '' ? $rs->fields['ip_number'] . ' / ' . $rs->fields['ip_number_v6'] : $rs->fields['ip_number'], 'RECORD_COUNT' => tr('Total Domains') . " : " . ($domain_count + $alias_count)));
        $rs->moveNext();
    }
    // end while
}
开发者ID:gOOvER,项目名称:EasySCP,代码行数:47,代码来源:ip_usage.php

示例7: gen_user_sessions

/**
 * @param EasySCP_TemplateEngine $tpl
 */
function gen_user_sessions($tpl)
{
    $sql = EasySCP_Registry::get('Db');
    $query = "\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\t`login`\n\t";
    $rs = exec_query($sql, $query);
    while (!$rs->EOF) {
        if ($rs->fields['user_name'] === NULL) {
            $tpl->append(array('ADMIN_USERNAME' => tr('Unknown'), 'LOGIN_TIME' => date("G:i:s", $rs->fields['lastaccess'])));
        } else {
            $tpl->append(array('ADMIN_USERNAME' => $rs->fields['user_name'], 'LOGIN_TIME' => date("G:i:s", $rs->fields['lastaccess'])));
        }
        $sess_id = session_id();
        if ($sess_id === $rs->fields['session_id']) {
            $tpl->append('KILL_LINK', 'sessions_manage.php');
        } else {
            $tpl->append('KILL_LINK', 'sessions_manage.php?kill=' . $rs->fields['session_id']);
        }
        $rs->moveNext();
    }
}
开发者ID:gOOvER,项目名称:EasySCP,代码行数:23,代码来源:sessions_manage.php

示例8: 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();
        }
    }
}
开发者ID:gOOvER,项目名称:EasySCP,代码行数:19,代码来源:protected_areas.php

示例9: generate_page

/**
 * @param EasySCP_TemplateEngine $tpl
 */
function generate_page($tpl)
{
    $sql = EasySCP_Registry::get('Db');
    global $month, $year, $day;
    $all[0] = 0;
    $all[1] = 0;
    $all[2] = 0;
    $all[3] = 0;
    $all[4] = 0;
    $all[5] = 0;
    $all[6] = 0;
    $all[7] = 0;
    $all_other_in = 0;
    $all_other_out = 0;
    $ftm = mktime(0, 0, 0, $month, $day, $year);
    $ltm = mktime(0, 0, 0, $month, $day + 1, $year);
    $query = "\n\t\tSELECT\n\t\t\tCOUNT(`bytes_in`) AS cnt\n\t\tFROM\n\t\t\t`server_traffic`\n\t\tWHERE\n\t\t\t`traff_time` > ? AND `traff_time` <= ?\n\t";
    $rs = exec_query($sql, $query, array($ftm, $ltm));
    $dnum = $rs->fields['cnt'];
    $query = "\n\t\tSELECT\n\t\t\t`traff_time` AS ttime,\n\t\t\t`bytes_in` AS sbin,\n\t\t\t`bytes_out` AS sbout,\n\t\t\t`bytes_mail_in` AS smbin,\n\t\t\t`bytes_mail_out` AS smbout,\n\t\t\t`bytes_pop_in` AS spbin,\n\t\t\t`bytes_pop_out` AS spbout,\n\t\t\t`bytes_web_in` AS swbin,\n\t\t\t`bytes_web_out` AS swbout\n\t\tFROM\n\t\t\t`server_traffic`\n\t\tWHERE\n\t\t\t`traff_time` > ? AND `traff_time` <= ?\n\t";
    $rs1 = exec_query($sql, $query, array($ftm, $ltm));
    if ($dnum != 0) {
        for ($i = 0; $i < $dnum; $i++) {
            // make it in kb mb or bytes :)
            $ttime = date('H:i', $rs1->fields['ttime']);
            // make other traffic
            $other_in = $rs1->fields['sbin'] - ($rs1->fields['swbin'] + $rs1->fields['smbin'] + $rs1->fields['spbin']);
            $other_out = $rs1->fields['sbout'] - ($rs1->fields['swbout'] + $rs1->fields['smbout'] + $rs1->fields['spbout']);
            $tpl->append(array('HOUR' => $ttime, 'WEB_IN' => sizeit($rs1->fields['swbin']), 'WEB_OUT' => sizeit($rs1->fields['swbout']), 'SMTP_IN' => sizeit($rs1->fields['smbin']), 'SMTP_OUT' => sizeit($rs1->fields['smbout']), 'POP_IN' => sizeit($rs1->fields['spbin']), 'POP_OUT' => sizeit($rs1->fields['spbout']), 'OTHER_IN' => sizeit($other_in), 'OTHER_OUT' => sizeit($other_out), 'ALL_IN' => sizeit($rs1->fields['sbin']), 'ALL_OUT' => sizeit($rs1->fields['sbout']), 'ALL' => sizeit($rs1->fields['sbin'] + $rs1->fields['sbout'])));
            $all[0] = $all[0] + $rs1->fields['swbin'];
            $all[1] = $all[1] + $rs1->fields['swbout'];
            $all[2] = $all[2] + $rs1->fields['smbin'];
            $all[3] = $all[3] + $rs1->fields['smbout'];
            $all[4] = $all[4] + $rs1->fields['spbin'];
            $all[5] = $all[5] + $rs1->fields['spbout'];
            $all[6] = $all[6] + $rs1->fields['sbin'];
            $all[7] = $all[7] + $rs1->fields['sbout'];
            $rs1->moveNext();
        }
        // end for
        $all_other_in = $all[6] - ($all[0] + $all[2] + $all[4]);
        $all_other_out = $all[7] - ($all[1] + $all[3] + $all[5]);
    }
    $tpl->assign(array('WEB_IN_ALL' => sizeit($all[0]), 'WEB_OUT_ALL' => sizeit($all[1]), 'SMTP_IN_ALL' => sizeit($all[2]), 'SMTP_OUT_ALL' => sizeit($all[3]), 'POP_IN_ALL' => sizeit($all[4]), 'POP_OUT_ALL' => sizeit($all[5]), 'OTHER_IN_ALL' => sizeit($all_other_in), 'OTHER_OUT_ALL' => sizeit($all_other_out), 'ALL_IN_ALL' => sizeit($all[6]), 'ALL_OUT_ALL' => sizeit($all[7]), 'ALL_ALL' => sizeit($all[6] + $all[7])));
}
开发者ID:gOOvER,项目名称:EasySCP,代码行数:48,代码来源:server_statistic_day.php

示例10: gen_db_user_list

/**
 * @param EasySCP_TemplateEngine $tpl
 * @param EasySCP_Database $sql
 * @param int $db_id
 */
function gen_db_user_list($tpl, $sql, $db_id)
{
    global $count;
    $query = "\n\t\tSELECT\n\t\t\t`sqlu_id`, `sqlu_name`\n\t\tFROM\n\t\t\t`sql_user`\n\t\tWHERE\n\t\t\t`sqld_id` = ?\n\t\tORDER BY\n\t\t\t`sqlu_name`\n\t";
    $rs = exec_query($sql, $query, $db_id);
    $users = array();
    if ($rs->recordCount() > 0) {
        while (!$rs->EOF) {
            $count++;
            $user_id = $rs->fields['sqlu_id'];
            $user_mysql = $rs->fields['sqlu_name'];
            $users[] = array('DB_USER' => tohtml($user_mysql), 'DB_USER_JS' => tojs($user_mysql), 'USER_ID' => $user_id);
            $rs->moveNext();
        }
    }
    $tpl->append('DB_USERLIST', $users);
    return count($users);
}
开发者ID:gOOvER,项目名称:EasySCP,代码行数:23,代码来源:sql_manage.php

示例11: generate_page

/**
 * @param EasySCP_TemplateEngine $tpl
 */
function generate_page($tpl)
{
    $cfg = EasySCP_Registry::get('Config');
    $sql = EasySCP_Registry::get('Db');
    $start_index = 0;
    $rows_per_page = 12;
    if (isset($_GET['psi']) && is_numeric($_GET['psi'])) {
        $start_index = intval($_GET['psi']);
    }
    $count_query = "\n\t\tSELECT\n\t\t\tCOUNT(`log_id`) AS cnt\n\t\tFROM\n\t\t\t`log`;\n\t";
    $query = "\n\t\tSELECT\n\t\t\tDATE_FORMAT(`log_time`, '%Y-%m-%d %H:%i') AS dat, `log_message`\n\t\tFROM\n\t\t\t`log`\n\t\tORDER BY\n\t\t\t`log_time` 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('Log is empty!'), 'info');
        $tpl->assign(array('PAG_MESSAGE' => tr('Log is empty!')));
    } 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));
        }
        $tpl->assign(array('PAGE_MESSAGE' => ''));
        while (!$rs->EOF) {
            $log_message = $rs->fields['log_message'];
            $replaces = array('/[^a-zA-Z](delete[sd]?)[^a-zA-Z]/i' => ' <strong style="color:#f00">\\1</strong> ', '/[^a-zA-Z](remove[sd]?)[^a-zA-Z]/i' => ' <strong style="color:#f00">\\1</strong> ', '/[^a-zA-Z](add(s|ed)?)[^a-zA-Z]/i' => ' <strong style="color:#3c6">\\1</strong> ', '/[^a-zA-Z](change[sd]?)[^a-zA-Z]/i' => ' <strong style="color:#30f">\\1</strong> ', '/[^a-zA-Z](update[sd]?)[^a-zA-Z]/i' => ' <strong style="color:#30f">\\1</strong> ', '/[^a-zA-Z](edit(s|ed)?)[^a-zA-Z]/i' => ' <strong style="color:#3c6">\\1</strong> ', '/[^a-zA-Z](unknown)[^a-zA-Z]/i' => ' <strong style="color:#c0f">\\1</strong> ', '/[^a-zA-Z](logged)[^a-zA-Z]/i' => ' <strong style="color:#360">\\1</strong> ', '/[^a-zA-Z]((session )?manipulation)[^a-zA-Z]/i' => ' <strong style="color:#f00">\\1</strong> ', '/[^a-zA-Z]*(Warning[\\!]?)[^a-zA-Z]/i' => ' <strong style="color:#f00">\\1</strong> ', '/(bad password login data)/i' => ' <strong style="color:#f00">\\1</strong> ');
            foreach ($replaces as $pattern => $replacement) {
                $log_message = preg_replace($pattern, $replacement, $log_message);
            }
            $date_formt = $cfg->DATE_FORMAT . ' H:i';
            $tpl->append(array('ADM_MESSAGE' => $log_message, 'DATE' => date($date_formt, strtotime($rs->fields['dat']))));
            $rs->moveNext();
        }
        // end while
    }
}
开发者ID:gOOvER,项目名称:EasySCP,代码行数:47,代码来源:admin_log.php

示例12: 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));
    }
}
开发者ID:gOOvER,项目名称:EasySCP,代码行数:26,代码来源:ftp_accounts.php

示例13: gen_dmn_als_list

/**
 * @param EasySCP_TemplateEngine $tpl
 * @param EasySCP_Database $sql
 * @param int $dmn_id
 * @param string $post_check
 */
function gen_dmn_als_list($tpl, $sql, $dmn_id, $post_check)
{
    $cfg = EasySCP_Registry::get('Config');
    $ok_status = $cfg->ITEM_OK_STATUS;
    $query = "\n\t\tSELECT\n\t\t\t`alias_id`, `alias_name`\n\t\tFROM\n\t\t\t`domain_aliasses`\n\t\tWHERE\n\t\t\t`domain_id` = ?\n\t\tAND\n\t\t\t`status` = ?\n\t\tORDER BY\n\t\t\t`alias_name`\n\t";
    $rs = exec_query($sql, $query, array($dmn_id, $ok_status));
    if ($rs->recordCount() != 0) {
        $first_passed = false;
        while (!$rs->EOF) {
            if ($post_check === 'yes') {
                $als_id = !isset($_POST['als_id']) ? '' : $_POST['als_id'];
                $als_selected = $als_id == $rs->fields['alias_name'] ? $cfg->HTML_SELECTED : '';
            } else {
                $als_selected = !$first_passed ? $cfg->HTML_SELECTED : '';
            }
            $als_menu_name = decode_idna($rs->fields['alias_name']);
            $tpl->append(array('ALS_ID' => tohtml($rs->fields['alias_name']), 'ALS_SELECTED' => $als_selected, 'ALS_NAME' => tohtml($als_menu_name)));
            $rs->moveNext();
            if (!$first_passed) {
                $first_passed = true;
            }
        }
    }
}
开发者ID:gOOvER,项目名称:EasySCP,代码行数:30,代码来源:ftp_add.php

示例14: get_hp_data_list

/**
 * Get list with hosting plan for selection
 * @param EasySCP_TemplateEngine $tpl
 * @param int $reseller_id
 */
function get_hp_data_list($tpl, $reseller_id)
{
    global $dmn_chp;
    $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`,\n\t\t\t\tt1.`reseller_id`,\n\t\t\t\tt1.`name`,\n\t\t\t\tt1.`props`,\n\t\t\t\tt1.`status`,\n\t\t\t\tt2.`admin_id`,\n\t\t\t\tt2.`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');
        $tpl->assign('PERSONALIZE', '');
        if ($rs->recordCount() == 0) {
            set_page_message(tr('You have no hosting plans. Please contact your system administrator.'), 'info');
            $tpl->assign('ADD_USER', '');
            $tpl->assign('ADD_FORM', '');
        }
    } else {
        $query = "\n\t\t\tSELECT\n\t\t\t\t`id`,\n\t\t\t\t`name`,\n\t\t\t\t`props`,\n\t\t\t\t`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 (0 !== $rs->rowCount()) {
        // There are data
        while ($data = $rs->fetchRow()) {
            $dmn_chp = isset($dmn_chp) ? $dmn_chp : $data['id'];
            $tpl->append(array('HP_NAME' => tohtml($data['name']), 'CHN' => $data['id'], 'CH_SEL' => $data['id'] == $dmn_chp ? $cfg->HTML_SELECTED : ''));
        }
    } else {
        $tpl->assign('ADD_USER', '');
    }
}
开发者ID:gOOvER,项目名称:EasySCP,代码行数:33,代码来源:user_add1.php

示例15: get_error_htaccess

/**
 * Get get_error_htaccess errors generated by a daemon request
 *
 * @param EasySCP_TemplateEngine $tpl EasySCP_TemplateEngine instance
 * @return int number of errors
 */
function get_error_htaccess($tpl)
{
    $cfg = EasySCP_Registry::get('Config');
    $sql_query = "\n\t\tSELECT\n\t\t\t`id`, `dmn_id`, h.`status`, 'htaccess' as `type`, `domain_name`\n\t\tFROM\n\t\t\t`htaccess` h\n\t\tLEFT JOIN\n\t\t\t`domain`\n\t\tON\n\t\t\t`dmn_id` = `domain_id`\n\t\tWHERE\n\t\t\th.`status` <> '{$cfg->ITEM_OK_STATUS}'\n\t\tUNION\n\t\tSELECT\n\t\t\t`id`, `dmn_id`, hg.`status`, 'htaccess_groups' as `type`, `domain_name`\n\t\tFROM\n\t\t\t`htaccess_groups` hg\n\t\tLEFT JOIN\n\t\t\t`domain`\n\t\tON\n\t\t\t`dmn_id` = `domain_id`\n\t\tWHERE\n\t\t\thg.`status` <> '{$cfg->ITEM_OK_STATUS}'\n\t\tUNION\n\t\tSELECT\n\t\t\t`id`, `dmn_id`, hu.`status`, 'htaccess_users' as `type`, `domain_name`\n\t\tFROM\n\t\t\t`htaccess_users` hu\n\t\tLEFT JOIN\n\t\t\t`domain`\n\t\tON\n\t\t\t`dmn_id` = `domain_id`\n\t\tWHERE\n\t\t\thu.`status` <> '{$cfg->ITEM_OK_STATUS}'\n\t";
    $rs = DB::query($sql_query);
    $errors = 0;
    if ($rs->rowCount() == 0) {
        $tpl->assign(array('TR_HTACCESS_MESSAGE' => tr('No htaccess related system errors')));
    } else {
        while ($row = $rs->fetch()) {
            $tpl->append(array('TR_HTACCESS_TYPE' => $row['type'], 'TR_HTACCESS_NAME' => $row['domain_name'] == null ? tr('missing domain') : tohtml($row['domain_name']), 'TR_HTACCESS_ERROR' => tohtml($row['status'])));
        }
    }
    return $errors;
}
开发者ID:gOOvER,项目名称:EasySCP,代码行数:21,代码来源:easyscp_debugger.php


注:本文中的EasySCP_TemplateEngine::append方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。