public static function render($type, $owner)
 {
     $view = new ViewModel('views/user/comments.php');
     $view->registerVar('type', $type);
     $view->registerVar('owner', $owner);
     return $view->render();
 }
Exemple #2
0
switch ($this->owner) {
    case 'list':
        echo '<h1>All uploaded files</h1>';
        $list = File::getList();
        $dt = new YuiDatatable();
        $dt->addColumn('id', '#', 'link', 'a/files/details/', 'name');
        $dt->addColumn('time_uploaded', 'Uploaded');
        $dt->addColumn('uploader', 'Uploader', 'link', 'u/profile/');
        $dt->addColumn('type', 'Type');
        $dt->addColumn('size', 'Size');
        $dt->addColumn('mimetype', 'Mime');
        $dt->setDataSource($list);
        echo $dt->render();
        break;
    case 'delete':
        if (confirmed('Are you sure you want to permanently delete this file?')) {
            File::unlink($this->child);
            js_redirect('a/files/list');
        }
        break;
    case 'details':
        // child = file id
        $view = new ViewModel('views/user/file_details.php');
        $view->registerVar('owner', $this->child);
        echo $view->render();
        echo '<br/>';
        echo '&raquo; ' . ahref('a/files/delete/' . $this->child, 'Permanently delete file') . '<br/>';
        break;
    default:
        echo 'No handler for view ' . $this->owner;
}
Exemple #3
0
     $a->content = showThumb($f->id, $f->name, 150, 150);
     echo $a->render();
     $lb = new YuiLightbox();
     echo $lb->render() . '<br/>';
     if ($session->id && $session->id != $f->uploader) {
         echo '&raquo; ' . ahref('u/report/photo/' . $f->id, 'Report photo') . '<br/>';
     }
     if ($session->id && $session->id == $f->uploader) {
         echo '&raquo; ' . ahref('u/photo/rotate/' . $f->id . '/90', 'Rotate left') . '<br/>';
         echo '&raquo; ' . ahref('u/photo/rotate/' . $f->id . '/270', 'Rotate right') . '<br/>';
         echo '<br/>';
         echo '&raquo; ' . ahref('u/photo/delete/' . $f->id, 'Delete photo') . '<br/>';
     }
     echo '<br/>';
     $view = new ViewModel('views/user/rate.php');
     $view->registerVar('view', 'handle');
     $view->registerVar('owner', FILE);
     $view->registerVar('child', $f->id);
     echo 'Rate photo:<br/>';
     echo $view->render();
     break;
 case 'rotate':
     // child = file id
     // child2 = rotate %
     $allowed = array(90, 270);
     if (!in_array($this->child2, $allowed)) {
         dp('HACK: odd rotate %: ' . $this->child2);
         return;
     }
     $session->requireLoggedIn();
     $f = File::get($this->child);
Exemple #4
0
     if (UserFinder::byUsername($o->data)) {
         echo 'Username is taken!<br/>';
     } else {
         echo '&raquo; ' . ahref('?approve', 'Approve') . '<br/>';
     }
     echo '<br/>';
     echo '&raquo; ' . ahref('?deny', 'Deny') . '<br/>';
     break;
 case MODERATE_UPLOAD:
     echo '<h2>Moderate file with reference ' . $o->reference . '</h2>';
     if ($o->owner) {
         $u = User::get($o->owner);
         echo 'Uploaded by ' . $u->name;
     }
     $view = new ViewModel('views/user/file_details.php');
     $view->registerVar('owner', $o->data);
     echo $view->render();
     echo '<br/>';
     echo '&raquo; ' . ahref('?approve', 'Approve') . '<br/>';
     echo '<br/>';
     echo '&raquo; ' . ahref('?deny', 'Deny') . '<br/>';
     break;
 case MODERATE_USER:
     //XXXX: combine all current (in moderation queue) & past (moderated) "user reports" here as quick overview
     $reporter = User::get($o->owner);
     $u = User::get($o->reference);
     echo '<h2>Reported user: '******'</h2>';
     echo 'Reported by ' . $reporter->name . '<br/>';
     echo 'Reason: ' . $o->data . '<br/>';
     echo '<br/>';
     echo '&raquo; ' . ahref('?approve', 'Discard') . '<br/>';