コード例 #1
0
ファイル: album.php プロジェクト: martinlindhe/core_dev
 case 'show':
     // shows an user album
     // child = user id
     // child2 = album id
     if (!$this->child || !$this->child2) {
         die('XXX wrong album params');
     }
     $user = User::get($this->child);
     if (!$user) {
         die('XXX NO SUCH USER');
     }
     $album = PhotoAlbum::get($this->child2);
     if ($album->owner != 0 && $album->owner != $this->child) {
         throw new \Exception('epic HACK attempt');
     }
     echo '<h1>Photo album ' . $album->name . ' by ' . UserLink::render($this->child) . '</h1>';
     echo 'Created ' . ago($album->time_created) . '<br/>';
     // shows album content
     $images = File::getByCategory(USER, $this->child2, $this->child);
     if (!$images && $album->owner) {
         echo '&raquo; ' . ahref('u/album/delete/' . $this->child2, 'Delete empty album') . '<br/>';
     }
     if ($session->id == $this->child) {
         echo '&raquo; ' . ahref('u/album/upload/' . $this->child2, 'Add photos') . '<br/>';
     }
     foreach ($images as $im) {
         $a = new XhtmlComponentA();
         $a->href = getThumbUrl($im->id, 0, 0);
         $a->rel = 'lightbox[album]';
         $a->content = showThumb($im->id, $im->name, 150, 150);
         echo $a->render();
コード例 #2
0
ファイル: chatroom.php プロジェクト: martinlindhe/core_dev
        $m->microtime = microtime(true);
        $m->store();
        $page->setMimeType('text/plain');
        echo 'OK';
        break;
    case 'show':
        // child = room id
        $cr = ChatRoom::get($this->child);
        echo '<h2>Chat in ' . $cr->name . '</h2>';
        if ($cr->locked_by) {
            echo 'The chatroom is locked!';
            return;
        }
        $div_name = 'chatroom_txt';
        $form_id = 'chatfrm';
        ChatRoomUpdater::init($this->child, $div_name, $form_id);
        $css = 'width:500px;' . 'height:300px;' . 'background-color:#eee;' . 'overflow:auto;';
        echo '<div id="' . $div_name . '" style="' . $css . '"></div>';
        $form = new XhtmlForm();
        $form->setId($form_id);
        $form->addInput('msg', $session->username . ':', '', 445);
        $form->setFocus('msg');
        $form->disableAutocomplete();
        echo $form->render();
        YuiTooltip::init();
        echo UserLink::render(27, "martin") . ' ';
        echo UserLink::render(32, "kotte");
        break;
    default:
        echo 'No handler for view ' . $this->owner;
}
コード例 #3
0
ファイル: blogs.php プロジェクト: martinlindhe/core_dev
<?php

namespace cd;

switch ($this->owner) {
    case 'recent':
        $list = BlogEntry::getRecent(10);
        foreach ($list as $b) {
            echo '<h1>' . $b->subject . '</h1>';
            echo '<i>Written ' . ago($b->time_created) . ' by ' . UserLink::render($b->owner) . '</i><br/>';
            echo nl2br($b->body);
        }
        break;
    default:
        echo 'No handler for view ' . $this->owner;
}
コード例 #4
0
ファイル: messages.php プロジェクト: martinlindhe/core_dev
             default:
                 throw new \Exception('eh');
         }
         echo ahref('videomsg/send/' . $msg->from, 'Reply with video') . '<br/>';
         echo ahref('u/messages/send/' . $msg->from, 'Reply with text') . '<br/>';
         echo '<hr/>';
     }
     break;
 case 'outbox':
     echo '<h1>Message outbox</h1>';
     $list = Message::getOutbox($session->id);
     //d($list);
     echo ahref('u/messages/inbox', 'Show inbox') . '<br/>';
     echo '<br/>';
     foreach ($list as $msg) {
         echo 'To ' . UserLink::render($msg->to) . ', ' . ago($msg->time_sent) . '<br/>';
         switch ($msg->type) {
             case PRIV_MSG:
                 echo nl2br($msg->body) . '<br/>';
                 break;
             case RECORDING_MSG:
                 echo 'VIDEO MSG!!!<br/>';
                 echo embed_flv($msg->body) . '<br/>';
                 break;
             default:
                 throw new \Exception('eh');
         }
         echo '<hr/>';
     }
     break;
 case 'send':
コード例 #5
0
ファイル: poke.php プロジェクト: martinlindhe/core_dev
<?php

namespace cd;

$session->requireLoggedIn();
switch ($this->owner) {
    case 'send':
        // child = user to poke
        if (Bookmark::exists(BOOKMARK_USERBLOCK, $session->id, $this->child)) {
            echo 'User has blocked you from access';
            return;
        }
        echo 'A poke was sent to the user.<br/><br/>';
        Poke::send($this->child);
        echo ahref('u/profile/' . $this->child, 'Continue');
        break;
    case 'show':
        // shows my recieved pokes
        echo '<h1>My recieved pokes</h1>';
        $list = Poke::getPokes($session->id);
        foreach ($list as $poke) {
            echo 'Poke from ' . UserLink::render($poke->from) . ' sent at ' . $poke->time . '<br/>';
        }
        break;
    default:
        echo 'no such view: ' . $this->owner;
}
コード例 #6
0
ファイル: ipcheck.php プロジェクト: martinlindhe/core_dev
 case 'ip':
     // query ip info
     $ip = '';
     if (!empty($_GET['ip'])) {
         $ip = $_GET['ip'];
     }
     if (!$ip) {
         die('meh');
     }
     $geoip = IPv4_to_GeoIP($ip);
     echo '<h1>' . $ip . ' (' . gethostbyaddr($ip) . ')</h1>';
     echo '<br/><br/>';
     $list = LoginEntry::getUsersByIP($ip);
     echo 'This IP is associated with ' . count($list) . ' registered users:<br/>';
     foreach ($list as $user_ip) {
         echo UserLink::render($user_ip) . '<br/>';
     }
     echo '<hr/>';
     echo '<a href="http://www.dnsstuff.com/tools/whois.ch?ip=' . $ip . '" target="_blank">Perform whois lookup</a><br/>';
     echo '<a href="http://www.dnsstuff.com/tools/tracert.ch?ip=' . $ip . '" target="_blank">Perform traceroute</a><br/>';
     echo '<a href="http://www.dnsstuff.com/tools/ping.ch?ip=' . $ip . '" target="_blank">Ping IP</a><br/>';
     echo '<a href="http://www.dnsstuff.com/tools/city.ch?ip=' . $ip . '" target="_blank">Lookup city from IP</a><br/>';
     echo '<hr/>';
     //Admin notes
     echo CommentViewer::render(IP, $geoip);
     break;
 case 'user':
     // query user name
     $user_name = 0;
     if (!empty($_GET['user'])) {
         $user_name = $_GET['user'];