示例#1
0
文件: Engine.php 项目: nsdown/ffs
<?php

if (RUN) {
    if (VERSION('c', 120226)) {
        //http://u.fps88.com/?/so/str&page=page&type=type
        $val = explode('&page', VAL);
        $str = urldecode($val[0]);
        if (empty($_GET['page'])) {
            $page = "1";
        } else {
            $page = $_GET['page'];
        }
        if (empty($_GET['type'])) {
            $type = "";
        } else {
            $type = $_GET['type'];
        }
        if ($str == '') {
            ERROR('⊙﹏⊙', '傻孩子,你啥都不输入叫我搜索什么?');
        }
        if (empty($page) || $page <= 0) {
            $page = 1;
        }
        /*载入搜索配置*/
        include_once MOP . 'config.php';
        /*先检索数据*/
        $resb = FILE_SEARCH('name', $str, $type);
        $resb = STR_ARRSORT($resb, 'down');
        /*分页并返回数据*/
        $resc = count($resb);
        if (SO_MAX != '0') {
示例#2
0
文件: Engine.php 项目: nsdown/ffs
<?php

/*使用RUN全局安全常量来确保*/
if (RUN) {
    if (VERSION('c', 111022)) {
        /*此处开始为引擎代码*/
        include_once 'app/index/config.php';
        if (VAL == 'index') {
            $mods = array_reverse(glob(ROT . 'app/*/ico.html'));
            $FFS['mod_ico'] = '';
            foreach ($mods as $mod) {
                $FFS['mod_ico'] = $FFS['mod_ico'] . file_get_contents($mod);
            }
            /*建立要插入的模板*/
            $str1 = '<div class="hotAndNew round_box"><dl class="hotfile"><dt><a href="' . URL . '?/index/hot">热门下载</a></dt>{hot:link}</dl><dl class="newfile"><dt><a href="' . URL . '?/index/new">最近分享</a></dt>{new:link}</dl></div>';
            $data = @file_get_contents(MOP . 'update.vds');
            if ($data == false) {
                $hot = '暂无数据';
                $new = '暂无数据';
            } else {
                $data = unserialize($data);
                /*开始读取热门下载*/
                $hot = '';
                $name = '';
                foreach ($data['hot'] as $hotw) {
                    $name = $hotw['name'];
                    $hot = $hot . '<dd><a href="' . URL . '?/file/view-' . $hotw['id'] . '.html" title="' . $name . '.' . $hotw['type'] . '">' . $name . '</a><span>' . $hotw['down'] . '次</span></dd>';
                }
                /*开始读取最近上传*/
                $new = '';
                foreach ($data['new'] as $neww) {
示例#3
0
文件: Engine.php 项目: nsdown/ffs
<?php

header('Content-Type:text/html;charset=utf-8');
if (RUN && ADMIN) {
    if (VERSION('c', 110924)) {
        if (ACT == 'index') {
            /*读取配置,文件数量*/
            $files = FILE_READDB();
            /*创建页面数组*/
            $FFS['html']['path'] = ROT . 'glob/admin/system.html';
            $FFS['html']['tag']['{info:files}'] = '这里显示接入的页面内容';
            $FFS['html']['tag']['{html:title}'] = SITE_NAM;
            $FFS['html']['tag']['{html:keywords}'] = SITE_KEY;
            $FFS['html']['tag']['{html:des}'] = SITE_DES;
            $FFS['html']['tag']['{html:icp}'] = SITE_ICP;
            $FFS['html']['tag']['{html:qq}'] = SITE_QQ;
            $FFS['html']['tag']['{html:email}'] = SITE_EMAIL;
            $FFS['html']['tag']['{html:tel}'] = SITE_TEL;
            $FFS['html']['tag']['{html:tongji}'] = stripslashes(SITE_TONGJI);
            $FFS['html']['tag']['{site:upload_max_filesize}'] = ini_get('upload_max_filesize');
            $FFS['html']['tag']['{site:memory_limit}'] = ini_get('memory_limit');
            $FFS['html']['tag']['{site:post_max_size}'] = ini_get('post_max_size');
            $FFS['html']['tag']['{site:max_input_time}'] = ini_get('max_input_time');
            $FFS['html']['tag']['{site:VER1}'] = VER1;
            $FFS['html']['tag']['{site:VER2}'] = VER2;
            $FFS['html']['tag']['{site:disk}'] = STR_FILESIZE(disk_free_space(ROT));
            $FFS['html']['tag']['{site:files}'] = $files['count'];
            $FFS['html']['tag']['{site:save}'] = SAVE_DIR;
            $FFS['html']['tag']['{site:DEBUG}'] = DEBUG;
            $FFS['html']['tag']['{site:TASK_RUNTIME}'] = TASK_RUNTIME;
            $FFS['html']['tag']['{site:FONTFILE}'] = FONTFILE;
示例#4
0
function start($aspid = false)
{
    $unix = new unix();
    $sock = new sockets();
    $Masterbin = $unix->find_program("rdpproxy");
    if (!is_file($Masterbin)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, rdpproxy not installed\n";
        }
        return;
    }
    if (!$aspid) {
        $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
        $pid = $unix->get_pid_from_file($pidfile);
        if ($unix->process_exists($pid, basename(__FILE__))) {
            $time = $unix->PROCCESS_TIME_MIN($pid);
            if ($GLOBALS["OUTPUT"]) {
                echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Already Artica task running PID {$pid} since {$time}mn\n";
            }
            return;
        }
        @file_put_contents($pidfile, getmypid());
    }
    $pid = PID_NUM();
    if ($unix->process_exists($pid)) {
        $timepid = $unix->PROCCESS_TIME_MIN($pid);
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Service already started {$pid} since {$timepid}Mn...\n";
        }
        return;
    }
    $EnableRDPProxy = $sock->GET_INFO("EnableRDPProxy");
    if (!is_numeric($EnableRDPProxy)) {
        $EnableRDPProxy = 0;
    }
    if ($EnableRDPProxy == 0) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service disabled (see EnableRDPProxy)\n";
        }
        return;
    }
    $nohup = $unix->find_program("nohup");
    $kill = $unix->find_program("kill");
    $RDPProxyPort = $sock->GET_INFO("RDPProxyPort");
    if (!is_numeric($RDPProxyPort)) {
        $RDPProxyPort = 3389;
    }
    $PIDS = $unix->PIDOF_BY_PORT($RDPProxyPort);
    if (count($PIDS) == 0) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} 0 PID listens {$RDPProxyPort}...\n";
        }
    }
    if (count($PIDS) > 0) {
        while (list($pid, $b) = each($PIDS)) {
            if ($unix->process_exists($pid)) {
                $cmdline = @file_get_contents("/proc/{$pid}/cmdline");
                if ($GLOBALS["OUTPUT"]) {
                    echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} killing PID {$pid} that listens {$RDPProxyPort} TCP port\n";
                }
                if ($GLOBALS["OUTPUT"]) {
                    echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Process: `{$cmdline}`\n";
                }
                unix_system_kill_force($pid);
            }
        }
    }
    @mkdir('/etc/rdpproxy/cert/rdp', 0755, true);
    @mkdir("/var/rdpproxy/recorded", 0755, true);
    @mkdir("/var/run/redemption", 0755, true);
    @mkdir("/tmp/rdpproxy", 0755, true);
    @mkdir("/home/rdpproxy/recorded", 0755, true);
    foreach (glob("/usr/share/artica-postfix/img/rdpproxy/*") as $filename) {
        if ($GLOBALS["VERBOSE"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} \"" . basename($filename) . "\"\n";
        }
        @copy($filename, "/usr/local/share/rdpproxy/" . basename($filename));
    }
    if (is_file("/var/run/redemption/rdpproxy.pid")) {
        @unlink("/var/run/redemption/rdpproxy.pid");
    }
    $VERSION = VERSION();
    $cmd = "{$nohup} {$Masterbin} >/dev/null 2>&1 &";
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service v.{$VERSION}\n";
    }
    shell_exec($cmd);
    for ($i = 1; $i < 5; $i++) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} waiting {$i}/5\n";
        }
        sleep(1);
        $pid = PID_NUM();
        if ($unix->process_exists($pid)) {
            break;
        }
    }
    $pid = PID_NUM();
    if ($unix->process_exists($pid)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Success PID {$pid}\n";
        }
        if (!is_file("/var/run/redemption/rdpproxy.pid")) {
            @file_put_contents("/var/run/redemption/rdpproxy.pid", $pid);
        }
        AUTHHOOK_START(true);
    } else {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Failed\n";
        }
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} {$cmd}\n";
        }
    }
}