예제 #1
0
파일: test.php 프로젝트: quen/hawthorn
<?php 
require_once 'hawthorn.php';
if (array_key_exists('user', $_GET)) {
    // In a real system you would fill the values in here from:
    // 1) Magic number from your system's configuration, which would be set to
    //    match the Hawthorn server's magic number. (Do not use this example
    //    magic number on any live system!)
    // 2) User and display name from your system's user database, based on
    //    the current authenticated user.
    // 3) Permissions from your system's user database, based on permission
    //    information your system stores ("rw" for normal users).
    // 4) Hawthorn server URL(s) from your system's configuration.
    $hawthorn = new hawthorn('23d70acbe28943b3548e500e297afb16', array('http://192.168.0.100:13370/'), $_GET['user'], $_GET['displayname'], $_GET['extra'], $_GET['permissions'], 'hawthorn.js', 'popup.html', 'reacquire.php');
    // This test uses a load test channel in case you want to watch a load test.
    // To show it working, just get the auth key and display it.
    $hawthorn->getAuthKey('loadtestchan3', $hawthornKey, $hawthornKeyTime);
    ?>
<p>Ok, got past init again. Key is <?php 
    print $hawthornKey;
    ?>
, time
<?php 
    print $hawthornKeyTime;
    ?>
.</p>
<?php 
    // Print JS code that causes recent messages to be displayed.
    print $hawthorn->recent('loadtestchan3');
    // Print link to chat in channel.
    print $hawthorn->linkToChat('loadtestchan3', 'Load test channel 3', 'Chat now!');
    // For admins only, print server statistics link