示例#1
0
 public static function runlog($message, $level, $repeatcheck = false)
 {
     $request = \yk::app()->getDispatcher()->getRequest();
     $env = array('clientip' => g('_clientip'), 'uid' => g('uid'), 'siteurl' => APP_NAME . '/' . $request->getModuleName() . '/' . $request->getControllerName() . '/' . $request->getActionName());
     $log = $env['clientip'] . "\t{$env['uid']}\t{$env['siteurl']}\t" . "\n" . $message;
     self::write($log, $level, $repeatcheck);
 }
示例#2
0
class P
{
    public static function Main()
    {
        if ($x) {
            function g()
            {
                echo "g1\n";
            }
            class T
            {
                function f()
                {
                    echo "T1::f\n";
                }
            }
        } else {
            function g()
            {
                echo "g2\n";
            }
            class T
            {
                function f()
                {
                    echo "T2::f\n";
                }
            }
        }
        $t = new T();
        $t->f();
        g();
    }
}
示例#3
0
function render($data = NULL, $layout = NULL, $sharp = 'default', $pathinfo = false)
{
    if ($layout == null) {
        if (is_ajax_request()) {
            $layout = 'ajax';
        } elseif (is_mobile_request()) {
            $layout = 'mobile';
        } else {
            $layout = 'web';
        }
    }
    $GLOBALS['layout'] = $layout;
    $GLOBALS['sharp'] = $sharp;
    $layout_file = AROOT . 'view/layout/' . $layout . '/' . $sharp . '.tpl.html';
    $data = apply_filter('CTRL_' . g('c') . '_' . g('a') . '_RENDER_FILTER', $data);
    $GLOBALS['LP_RENDER_DATA'] = $data;
    if (file_exists($layout_file)) {
        @extract($data);
        require $layout_file;
    } else {
        $layout_file = CROOT . 'view/layout/' . $layout . '/' . $sharp . '.tpl.html';
        if (file_exists($layout_file)) {
            @extract($data);
            require $layout_file;
        }
    }
}
示例#4
0
 public static function decode($str, $key = null)
 {
     if ($key == null) {
         $key = g('_config/security/authkey');
     }
     return self::rc4($str, self::$_decode, $key);
 }
示例#5
0
 function __construct()
 {
     parent::__construct();
     if (strtolower(g('a')) != 'api') {
         session_start();
     }
 }
示例#6
0
 public function test_g()
 {
     unset($GLOBALS['test']);
     $this->assertFalse(g('test'));
     $GLOBALS['test'] = 'im';
     $this->assertEqual(g('test'), 'im');
 }
function f(&$p)
{
    echo '$p ' . (isset($p) ? "is set\n" : "is not set\n");
    g($p);
    echo '$p ' . (isset($p) ? "is set\n" : "is not set\n");
    var_dump($p);
}
示例#8
0
文件: goal.php 项目: noscripter/goal
function g($a = null, $s = 'g')
{
    $s .= $a ?: 'o';
    return $a ? $s : function ($a = null) use($s) {
        return g($a, $s);
    };
}
示例#9
0
function ajax_render($dat, $tpl = '', $dir = false, $ret = false)
{
    if ($ret) {
        return array($dat, $tpl);
    }
    if (is_array($dat)) {
        extract($dat);
    } else {
        $content = $dat;
        $title = '系统消息';
    }
    header("Content-Type:text/html; charset=utf-8");
    header("Expires: Thu, 01 Jan 1970 00:00:01 GMT");
    header("Cache-Control: no-cache, must-revalidate");
    header("Pragma: no-cache");
    if (!$dir) {
        $dir = t(g('m'));
    }
    if ($tpl == 'info') {
        $tpl = $tpl = AROOT . 'view/layout/ajax/info.tpl.html';
    } elseif ($tpl) {
        $tpl = AROOT . 'view/layout/ajax/' . $dir . '/' . $tpl . '.tpl.html';
    } else {
        $tpl = AROOT . 'view/layout/ajax/' . $dir . '/' . t(g('a')) . '.tpl.html';
    }
    require_once $tpl;
}
示例#10
0
文件: modlocal.php 项目: klich3/gPOS
function ListarLocales()
{
    global $action;
    $res = Seleccion("Local", "", "IdLocal ASC", "");
    if (!$res) {
        echo gas("aviso", "No hay locales disponibles");
    } else {
        //echo gas("titulo",_("Lista de locales"));
        echo "<center>";
        echo "<table border=0 class=forma>";
        echo "<tr><td class='lh'>Local</td><td class='lh'></td><td class='lh'></td></tr>";
        while ($oLocal = LocalFactory($res)) {
            $id = $oLocal->getId();
            //error("Info: id es '$id'");
            $nombre = $oLocal->getNombre();
            $linkEdicion = gAccion("editar", _("Modificar"), $id);
            $linkborrado = gAccionConfirmada("borrar", _("Eliminar"), $id, _("¿Seguro que quiere borrar?"));
            echo "<tr class='f'><td class=nombre>{$nombre}</td><td>{$linkEdicion}</td><td>{$linkborrado}</td></tr>";
        }
        echo "<tr class='f'><td></td><td></td><td></td></tr>";
        echo "<tr class='f'><td></td><td>" . g('center', gAccion('alta', _('Nuevo local'))) . "</td><td></td></tr>";
        echo "</table>";
        //TODO: debe ser relativo a un parametro: permitealtalocales
        //echo g("center",gAccion("alta",_("Nuevo local")));
    }
    userOperacionesConLocales();
    echo "</center>";
}
示例#11
0
 function f()
 {
     function g()
     {
         echo __CLASS__;
     }
     g();
 }
示例#12
0
function gt($param)
{
    $val = g($param);
    if ($val === false) {
        return false;
    }
    return trim($val);
}
示例#13
0
 function __construct()
 {
     // load datafunction
     $data_function_file = AROOT . 'function/' . g('m') . '.function.php';
     if (file_exists($data_function_file)) {
         require_once $data_function_file;
     }
 }
示例#14
0
function storyInfo()
{
    $uri = g('uri');
    $userId = g('userId');
    st_db_object()->rawQuery("CALL MOVESTORIESFORWARD()");
    $db_data = st_db_object()->rawQuery("\n                            SELECT \n                                (SELECT COUNT(*) FROM `story_user` WHERE `story_user`.`FK_story_id` = `story`.`id`) AS num_players,\n                                `story`.`time_limit` AS time_limit,\n                                (CASE\n                                    WHEN `story`.`current_turn` > 0 THEN\n                                        (SELECT MAX(`turn`.`timestamp`) FROM `turn` WHERE `turn`.`FK_story_id` = `story`.`id`)\n                                    ELSE\n                                        `story`.`started_at`\n                                END) AS turn_start,\n                                NOW() AS now_time,\n                                `story`.`current_turn` AS current_turn,\n                                (SELECT `story_user`.`turn_order` FROM `story_user` WHERE `story_user`.`FK_user_id` = ? AND `story_user`.`FK_story_id` = `story`.`id` LIMIT 1) AS turn_order\n                            FROM \n                                `story`  \n                            WHERE \n                                `story`.`uri` = ?\n                                ", array($userId, $uri));
    echo json_encode($db_data[0]);
}
function f($arg1, $arg2, $arg3)
{
    function g($arg4)
    {
        var_dump(xdebug_get_function_stack());
    }
    g($arg1 - 2);
}
示例#16
0
 public function indexAction()
 {
     if (g('uid') < 1) {
         $this->redirect('/login');
     } else {
         $this->redirect('/center');
     }
 }
示例#17
0
 function __construct()
 {
     // 载入默认的
     parent::__construct();
     if (g('a') != 'get_token' && g('a') != 'register') {
         $this->check_token();
     }
 }
示例#18
0
 public static function get()
 {
     $uid = g('uid');
     $str1 = pack('VVV', $uid, date('w'), date('d'));
     $request = \yk::app()->getDispatcher()->getRequest();
     $str2 = $request->getModuleName();
     $str3 = $request->getControllerName();
     return substr(md5($str1 . $str2 . $str3), 0, -8);
 }
示例#19
0
function l($lookup, $default = "")
{
    $locals = g("locals", array());
    if (isset($locals[$lookup])) {
        return $locals[$lookup];
    } else {
        return $default;
    }
}
示例#20
0
function test()
{
    f();
    g(1);
    h();
    f(1, 2, 3, 4);
    g(1, 2, 3, 4);
    h(1, 2, 3, 4);
}
示例#21
0
 public function testG()
 {
     $GLOBALS['__testarray'] = array('easy', 'hard');
     $array = g('__testarray');
     $this->assertEquals('easy', $array[0]);
     $this->assertEquals('hard', $array[1]);
     $GLOBALS['__testvalue'] = 'config_test';
     $this->assertEquals('config_test', g('__testvalue'));
 }
示例#22
0
文件: 1917.php 项目: badlamer/hhvm
function f($x)
{
    if ($x == 1) {
        goto mylabel1;
    } else {
        if ($x == 2) {
            goto mylabel2;
        } else {
            if ($x == 3) {
                goto mylabel3;
            } else {
                if ($x == 4) {
                    goto mylabel4;
                }
            }
        }
    }
    try {
        g($x);
        echo "Should not get here\n";
        try {
            try {
                mylabel1:
                g($x);
            } catch (exception $e) {
                echo "1a\n";
            }
            try {
                mylabel2:
                g($x);
            } catch (exception $e) {
                echo "1b\n";
            }
        } catch (exception $e) {
            echo "1\n";
        }
        try {
            try {
                mylabel3:
                g($x);
            } catch (exception $e) {
                echo "2a\n";
            }
            try {
                mylabel4:
                g($x);
            } catch (exception $e) {
                echo "2b\n";
            }
        } catch (exception $e) {
            echo "2\n";
        }
    } catch (Exception $e) {
        echo "0\n";
    }
}
示例#23
0
 function __construct()
 {
     // 载入默认的
     parent::__construct();
     if (g('a') != 'login' && g('a') != 'login_check' && g('a') != 'install') {
         if (!is_login()) {
             return info_page('<a href="?a=login">请先登入</a>');
         }
     }
 }
示例#24
0
function gp($key = '', $def = null)
{
    $v = g($key);
    if (is_null($v)) {
        $v = p($key);
    }
    if (is_null($v)) {
        $v = $def;
    }
    return $v;
}
示例#25
0
function pa_handler()
{
    $PA = new Paliweb();
    $uri = $_SERVER['REQUEST_URI'];
    $uri = substr($uri, 1);
    //$parsed = parse_url($uri);
    //$uri_path = $parsed['path'];
    $uri_segment = explode('/', $uri);
    $class = 'Main';
    $method = 'index';
    $arguments = array();
    //$index = 0;
    $controller_dir = PA_CONTROLLER_DIR;
    while (isset($uri_segment[0]) && $uri_segment[0] && is_dir($controller_dir . $uri_segment[0])) {
        $controller_dir .= $uri_segment[0] . '/';
        array_shift($uri_segment);
        //$index ++;
    }
    if (isset($uri_segment[0]) && $uri_segment[0]) {
        $class = $uri_segment[0];
    }
    if (isset($uri_segment[1]) && $uri_segment[1]) {
        $method = $uri_segment[1];
    }
    if (isset($uri_segment[2]) && $uri_segment[2]) {
        $arguments = array_slice($uri_segment, 2);
    }
    //print_r($uri_segment); exit;
    //echo $class . $method; exit;
    if (file_exists($controller_dir . $class . '.php')) {
        //echo 'hi'; return;
        require_once $controller_dir . $class . '.php';
        $controller = new $class();
        if (method_exists($controller, $method)) {
            call_user_func_array(array($controller, $method), $arguments);
        } else {
            $PA->http->notFound();
        }
        /*      page_protect();
                load_template('header', ['title' => 'hi']);
                load_view('');
                load_template('footer');*/
    } elseif (g('rt') == 'ajax' && file_exists(PA_AJAX_DIR . $uri_segment[0])) {
        require_once PA_AJAX_DIR . $uri_segment[0] . '.php';
        if (function_exists($uri_segment[1])) {
            call_user_func($uri_segment[1]);
        } else {
            $PA->http->notFound();
        }
    } else {
        $PA->http->notFound();
    }
}
示例#26
0
 function __construct()
 {
     // 载入默认的
     parent::__construct();
     $a = g('a');
     $c = g('c');
     session_start();
     if (!ss('uid') && $c != 'login') {
         header('Location: /?c=login');
         exit;
     }
 }
示例#27
0
 function __construct()
 {
     parent::__construct();
     if (g('c') !== 'get_token') {
         $permit = $this->check_admin_permit();
         if (!permit) {
             $data['code'] = 101;
             $data['message'] = 'not permit';
             render($data, 'rest');
         }
     }
 }
示例#28
0
function c($str)
{
    $ret = "";
    for ($i = 0; $i < strlen($str); $i++) {
        $p = ord(substr($str, $i, 1));
        if ($p > 160) {
            $q = ord(substr($str, ++$i, 1));
            $p = $p * 256 + $q - 65536;
        }
        $ret .= substr(g($p), 0, 1);
    }
    return $ret;
}
示例#29
0
文件: 1853.php 项目: lsqtongxin/hhvm
function f($x)
{
    if (is_array($x)) {
        var_dump($x);
        var_dump($x[0]);
        var_dump($x[0][1]);
    }
    if (is_array($x) && $x) {
        g($x);
        g($x[0]);
        g($x[0][1]);
    }
}
示例#30
0
 function check_login()
 {
     $not_check = array();
     $not_check = apply_filter('CTRL_PLUGIN_LOGIN_FILTER', $not_check);
     if (strtolower(g('c')) == 'plugin' && in_array(g('a'), $not_check)) {
         // for some plugin no need to login
         // not check
     } else {
         if (!is_login()) {
             return info_page(__('NEED_LOGIN'));
         }
     }
 }