예제 #1
0
파일: prime.php 프로젝트: ctubio/ckpool
function process($p, $user, $menu)
{
    $info = homeInfo($user);
    if (is_array($info) && isset($info['u_multiaddr'])) {
        if (isset($menu['Account'])) {
            $menu['Account']['Addresses'] = 'addrmgt';
        }
        if (isset($menu['Workers'])) {
            $menu['Workers']['Percents'] = 'percent';
        }
    }
    if ($user == 'Kano' || $user == 'ckolivas') {
        $menu['Admin']['ckp'] = 'ckp';
        $menu['Admin']['PPLNS2'] = 'pplns2';
        $menu['Admin']['PPLNS'] = 'pplns';
        $menu['Admin']['AllWork'] = 'allwork';
        $menu['Admin']['IPS'] = 'ips';
        $menu['Admin']['Events'] = 'events';
    }
    bp:
    $page = '';
    $n = '';
    foreach ($menu as $item => $options) {
        if ($options !== NULL) {
            foreach ($options as $name => $pagename) {
                if ($pagename === $p) {
                    $page = $p;
                    $n = " - {$name}";
                }
            }
        }
    }
    if ($page === '' and $p == 'blocks') {
        $p = 'pblocks';
        goto bp;
    }
    if ($page === '') {
        showPage($info, 'index', $menu, '', $user);
    } else {
        showPage($info, $page, $menu, $n, $user);
    }
}
예제 #2
0
function show_api($info, $page, $menu, $name, $user)
{
    global $fld_sep;
    $u = getparam('username', true);
    if (nutem($u)) {
        no_api();
    }
    $api = getparam('api', true);
    if (nutem($api)) {
        no_api();
    }
    $jfu = getparam('json', true);
    $work = getparam('work', true);
    $ans = getAtts($u, 'KAPIKey.str');
    if ($ans['STATUS'] != 'ok') {
        no_api($jfu);
    }
    if (!isset($ans['KAPIKey.str'])) {
        no_api($jfu);
    }
    if ($ans['KAPIKey.str'] != $api) {
        no_api($jfu);
    }
    if (nuem($work)) {
        $info = homeInfo($u);
        if ($info === false) {
            no_api($jfu);
        }
        $rep = fldEncode($info, 'STAMP', true);
        $rep .= fldEncode($info, 'lastbc', false);
        $rep .= fldEncode($info, 'lastheight', false);
        $rep .= fldEncode($info, 'currndiff', false);
        $rep .= fldEncode($info, 'lastblock', false);
        $rep .= fldEncode($info, 'lastblockheight', false);
        $rep .= fldEncode($info, 'blockacc', false);
        $rep .= fldEncode($info, 'blockerr', false);
        $rep .= fldEncode($info, 'p_hashrate5m', false);
        $rep .= fldEncode($info, 'p_hashrate1hr', false);
        $rep .= fldEncode($info, 'u_hashrate5m', false);
        $rep .= fldEncode($info, 'u_hashrate1hr', false);
    } else {
        $info = homeInfo($u);
        if ($info === false) {
            no_api($jfu);
        }
        $per = false;
        if (is_array($info) && isset($info['u_multiaddr'])) {
            $percent = getparam('percent', true);
            if (!nuem($percent)) {
                $per = true;
            }
        }
        if ($per === true) {
            $ans = getPercents($u);
        } else {
            $ans = getWorkers($u);
        }
        if ($ans === false) {
            no_api($jfu);
        }
        $rep = fldEncode($ans, 'STAMP', true);
        $rep .= fldEncode($ans, 'rows', false);
        $rows = $ans['rows'];
        $flds = explode(',', $ans['flds']);
        $zeflds = '';
        for ($i = 0; $i < $rows; $i++) {
            foreach ($flds as $fld) {
                if (substr($fld, 0, 7) != 'idlenot') {
                    $rep .= fldEncode($ans, $fld . ':' . $i, false);
                    if ($i == 0) {
                        $zeflds .= "{$fld},";
                    }
                }
            }
        }
        $rep .= fldEncode($ans, 'arn', false);
        $rep .= fldEncode($ans, 'arp', false);
        $rep .= fldEncode(array(), 'flds', false);
        $rep .= substr($zeflds, 0, -1);
    }
    if (nuem($jfu)) {
        echo $rep;
    } else {
        $j = preg_replace("/([^=]+)=([^{$fld_sep}]*){$fld_sep}/", '"$1":"$2",', $rep . $fld_sep);
        echo '{' . substr($j, 0, -1) . '}';
    }
    exit(0);
}
예제 #3
0
파일: page.php 프로젝트: theuni/ckpool
function gopage($info, $data, $pagefun, $page, $menu, $name, $user, $ispage = true, $dotop = true, $douser = true)
{
    global $dbg, $stt;
    global $page_css, $page_scripts;
    $dbg_marker = '[@dbg@]';
    $css_marker = '[@css@]';
    $script_marker = '[@scripts@]';
    if ($dbg === true) {
        $pg = $dbg_marker . '<br>';
    } else {
        $pg = '';
    }
    if ($info === NULL) {
        $info = homeInfo($user);
    }
    if ($ispage == true) {
        $both = array('info' => $info, 'data' => $data);
        $pg .= $pagefun($both, $user);
    } else {
        $pg .= $pagefun;
    }
    // if (isset($_SESSION['logkey']))
    //	unset($_SESSION['logkey']);
    $head = pghead($css_marker, $script_marker, $name);
    $body = pgbody($info, $page, $menu, $dotop, $user, $douser);
    $foot = pgfoot($info);
    if ($dbg === true) {
        $pg = str_replace($dbg_marker, cvtdbg(), $pg);
    }
    $head = str_replace($css_marker, $page_css, $head);
    if ($page_scripts != '') {
        $page_scripts .= "</script>";
    }
    $head = str_replace($script_marker, $page_scripts, $head);
    $all = $head;
    $all .= trm_force($body);
    $all .= trm($pg);
    if (isset($_SERVER["REQUEST_TIME_FLOAT"])) {
        $elapsed = microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"];
    } else {
        $elapsed = microtime(true) - $stt;
    }
    $foot = trm_force(str_replace('Z/', number_format($elapsed, 4), $foot));
    usleep(100000);
    echo $all . $foot;
    exit(0);
}
예제 #4
0
파일: function.php 프로젝트: mul14/FiyoCMS
function checkHomePage()
{
    $link = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    //check curent paging
    $a = strpos($_SERVER['REQUEST_URI'], "?page=");
    if ($a !== 0) {
        $page = substr($_SERVER['REQUEST_URI'], $a + 6);
    }
    $link = @str_replace("?page={$page}", "", $link);
    $link = str_replace("index.php", "", $link);
    if (FUrl('auto') == $link or empty($link)) {
        return true;
    } else {
        if (isset($_REQUEST['link'])) {
            $c = check_permalink('permalink', @$_REQUEST['link'], 'link');
            $b = homeInfo('link');
            if ($c == $b) {
                return true;
            }
        } else {
            return false;
        }
    }
}
예제 #5
0
파일: site.php 프로젝트: mul14/FiyoCMS
    $flocal = str_replace("http://localhost/", "", FUrl);
    define("FLocal", $flocal);
} else {
    define("FLocal", "/");
}
/********************************************/
/*  	  Define Page_ID, PageTitle	  		*/
/********************************************/
if (_FINDEX_ != 'BACK') {
    $pid = menuInfo('id', getLink());
    if (checkHomePage()) {
        define('Page_ID', homeInfo('id'));
        if (homeInfo('title')) {
            define('PageTitle', homeInfo('title'));
        } else {
            define('PageTitle', homeInfo('name'));
        }
    } else {
        if (!SEF_URL) {
            $link = str_replace("&page=" . _Page, "", getLink());
            if ($pid == menuInfo('id')) {
                define('Page_ID', $pid);
            } else {
                if ($pid = check_permalink('link', $link, 'pid')) {
                    define('Page_ID', $pid);
                } else {
                    if (isset($_GET['pid']) and is_numeric($_GET['pid'])) {
                        define('Page_ID', pageInfo($_GET['pid'], 'id'));
                    } else {
                        define('Page_ID', oneQuery('menu', 'global', 1, 'id'));
                    }