Esempio n. 1
0
 public function seachgame()
 {
     $name = I("keyword");
     $offset = I("offset");
     $count = I("count");
     $game1 = array('id' => "1", 'name' => "Dota 2", 'nameZh' => "Dota 2", 'details' => "Dota 2", 'type' => 1, 'image' => get_public() . "Game/Dota 2-272x380.jpg", 'imageHD' => "");
     $game2 = array('id' => "2", 'name' => "League of Legends", 'nameZh' => "英雄联盟", 'details' => "英雄联盟", 'type' => 1, 'image' => get_public() . "Game/League of Legends-272x380.jpg", 'imageHD' => "");
     $this->ajaxReturn(array($game1, $game2));
 }
Esempio n. 2
0
    header('Content-Type: text/javascript');
    get_public();
});
route('/fotns/*', function () {
    header('Content-Type: */*');
    get_public();
});
route('/images/*', function () {
    if (fnmatch(route(), '/images/*.jpg')) {
        header('Content-Type: image/jpeg');
    } elseif (fnmatch(route(), '/images/*.png')) {
        header('Content-Type: image/png');
    } else {
        header('Content-Type: image/*');
    }
    get_public();
});
/* Site routes */
route('/', function () {
    controller('main.php', 'Main');
});
route('/about', function () {
    controller('main.php', 'About');
});
route('/404', function () {
    controller('main.php', 'NotFound');
});
/* Ajax routes */
route('/ajax/posts', function () {
    $start = isset($_POST['start']) ? $_POST['start'] : NULL;
    $count = isset($_POST['count']) ? $_POST['count'] : NULL;
Esempio n. 3
0
/**
 * Return property or method with public access modifier
 * @param string $key
 * @param mixed $value Value of property (NULL by default). If typeof callback, then defines as method
 * @param boolean $is_static Is class element static?
 * @return array
 */
function _public($key, $value = null, $is_static = false)
{
    // Set values
    $result = array('name' => trim((string) $key), 'value' => $value, 'access' => get_public(), 'method' => false, 'static' => (bool) $is_static);
    // Name isn't valid
    if (empty($result['name'])) {
        trigger_error("Property and method name cannot be empty", E_USER_ERROR);
    } elseif (is_callable($value)) {
        // Is method
        $result['method'] = true;
    }
    return $result;
}
Esempio n. 4
0
                }
                break;
        }
        $last_id = read_file(C_PATH . '/last_' . $type . '_id.txt');
        if ($mtArr[0][0] == $last_id) {
            echo '还没有发现新内容 ' . date('Y-m-d H:i:s', time());
            exit;
        }
        write_file(C_PATH . '/last_' . $type . '_id.txt', $mtArr[0][0], 'w');
        $i = 0;
        $count = count($mtArr);
        $mtArr = array_reverse($mtArr);
        while ($i < $count) {
            $anss = post_answer($type, $mtArr[$i][0], $mtArr[$i][1], $mtArr[$i][2]);
            echo $i . ' ' . $mtArr[$i][1] . ':' . $anss . "<br>";
            $i++;
        }
    }
}
// 干!
switch (get('do')) {
    case 'comment':
        get_public('comment');
        break;
    case 'question':
        get_public('question');
        break;
    default:
        echo '<a href="?do=question">回复前两页新问题</a> <a href="?do=comment">回复前两页新通知</a>';
        break;
}