function uploadSubmit($p) { if (!is_url($p['url'])) { $error = ErrorHandler::getInstance(); $error->add('Not an url'); return false; } $eventId = TaskQueue::addTask(TASK_FETCH, $p['url']); echo '<div class="okay">URL to process has been enqueued.</div><br/>'; echo ahref('queue/show/' . $eventId, 'Click here') . ' to perform further actions on this file.'; }
function uploadSubmit($p) { // XhtmlForm:s upload handler har redan processat filen här $eventId = TaskQueue::addTask(TASK_UPLOAD, $p['f1']); if (!$eventId) { echo 'file upload handling failed'; return false; } echo '<div class="okay">Your file has been uploaded successfully!</div><br/>'; echo ahref('queue/show/' . $eventId, 'Click here') . ' to perform further actions on this file.'; return true; }
public static function render($name) { $wiki = self::getByName($name); $session = SessionHandler::getInstance(); if (empty($wiki->text)) { $res = t('The wiki') . ' "' . $name . '" ' . t('does not yet exist') . '!<br/>'; if ($session->isWebmaster) { $res .= ahref('u/wiki/edit/' . $name, 'Create') . '<br/>'; } return $res; } return self::renderText($wiki->text); }
public static function render($id) { $u = User::get($id); if (!$u) { return 'no such user'; } $res = ''; switch ($u->type) { case SESSION_REGULAR: //$res .= '(reg)'; break; case SESSION_FACEBOOK: // '<fb:name uid="'.$u->name.'" useyou="false"></fb:name>'; //$pic = UserSetting::get($u->id, 'fb_picture'); $name = UserSetting::get($u->id, 'fb_name'); $res .= $name . ' (facebook)'; break; default: throw new \Exception('hm'); } // $res .= '<span class="yui3-hastooltip" id="tt_usr_'.$u->id.'">'.$u->name.'</span>'; $res .= ahref('u/profile/' . $u->id, $u->name); return $res; }
<?php namespace cd; $session->requireSuperAdmin(); switch ($this->owner) { case 'overview': echo '<h1>Blogs overview</h1>'; echo '» ' . ahref('a/blogs/new', 'Write a new blog post'); break; case 'new': function createHandler($p) { $session = SessionHandler::getInstance(); $o = new BlogEntry(); $o->owner = $session->id; $o->subject = trim($p['subject']); $o->body = trim($p['body']); $o->time_created = sql_datetime(time()); $o->time_published = sql_datetime(time()); $o->id = $o->store(); js_redirect('a/blogs/overview'); } echo '<h1>Write a new blog</h1>'; $x = new XhtmlForm(); $x->addInput('subject', 'Subject'); $x->addRichedit('body', 'Body'); $x->addSubmit('Create'); $x->setHandler('createHandler'); echo $x->render(); break;
$form->addFile($f->name, $f->label); break; case UserDataField::CHECKBOX: $form->addCheckbox($f->name, $f->label, UserSetting::get($session->id, $f->name)); break; default: $form->addInput($f->name, $f->label, UserSetting::get($session->id, $f->name)); } } $form->addSubmit('Save'); $form->setHandler('handleEdit'); echo $form->render(); echo '<br/><br/>'; echo '» ' . ahref('u/edit/username', 'Change username') . '<br/>'; echo '» ' . ahref('u/edit/password', 'Change password') . '<br/>'; echo '» ' . ahref('u/block/manage', 'Manage blocked users') . '<br/>'; break; case 'username': function handleEditUsername($p) { $p['new_user'] = trim($p['new_user']); $error = ErrorHandler::getInstance(); $session = SessionHandler::getInstance(); // dont put empty names or current username on request queue if (!$p['new_user'] || $p['new_user'] == $session->username) { $error->add('Useless request'); return false; } if (User::getByName($p['new_user'])) { $error->add('Username taken'); return false;
// shows the photo $a = new XhtmlComponentA(); $a->href = getThumbUrl($f->id, 0, 0); $a->rel = 'lightbox'; $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 '» ' . ahref('u/report/photo/' . $f->id, 'Report photo') . '<br/>'; } if ($session->id && $session->id == $f->uploader) { echo '» ' . ahref('u/photo/rotate/' . $f->id . '/90', 'Rotate left') . '<br/>'; echo '» ' . ahref('u/photo/rotate/' . $f->id . '/270', 'Rotate right') . '<br/>'; echo '<br/>'; echo '» ' . 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);
ahref('m3.config.setLocalSettings'); ahref('m3.config.getPhpIniSettings'); ahref('m3.inventory.ping'); ahref('m3.inventory.getApis'); ahref('m3.inventory.getApi'); ahref('m3.inventory.getApplications'); ahref('m3.inventory.getApplication'); ahref('m3.inventory.getNetworks'); ahref('m3.inventory.getNetwork'); ahref('m3.inventory.getTags'); ahref('m3.inventory.getTag'); ahref('m3.inventory.getVersionInfo'); ahref('m3.metrics.getApiDurations'); ahref('m3.metrics.purgeApiDurations'); ahref('m3.operation.evaluatePhpCode'); ahref('m3.operation.getFileContent'); echo <<<EOF <tr><th>Enter API To Test</th></tr> <tr><td> <form action="api_test.php" method="GET"> <input type="hidden" name='s' value="{$GLOBALS['m3SecretKey']}"> Method: <input type="text" size="30" name="userApi" value="{$userApi}"><br/> Params: <input type="text" size="30" name="userParams" value="{$userParams}"> <input type="submit" value="Invoke"><br/> </form> </td></tr> EOF; echo '</table>'; if (isset($results)) { echo "<hr/><h1>RESULTS DUMP</h1>\n"; echo "<pre>\n";
<?php /** * For normal users usage of chatrooms */ namespace cd; $session->requireLoggedIn(); switch ($this->owner) { case 'list': echo '<h2>Select chatroom</h2>'; $list = ChatRoom::getList(); foreach ($list as $cr) { echo ahref('u/chatroom/show/' . $cr->id, $cr->name) . '<br/>'; } break; case 'update': // JSON - returns messages in chatroom (since ts) // child = room id $page->setMimeType('text/plain'); if (!$this->child || !is_numeric($this->child)) { die('hey'); } $ts = 0; if (isset($_GET['ts']) && is_numeric($_GET['ts'])) { $ts = $_GET['ts']; $max_age = parse_duration('7d'); // empty json string on old queries if ($ts < microtime(true) - $max_age) { echo '[]'; return;
echo ' (' . count($list) . ' hits)</h2>'; $dt = new YuiDatatable(); $dt->addColumn('id', 'Username', 'link', 'a/user/', 'name'); $dt->addColumn('email', 'E-mail'); $dt->addColumn('time_last_active', 'Last active'); $dt->addColumn('last_ip', 'Last IP'); $dt->addColumn('time_created', 'Created'); $dt->addColumn('is_online', 'Online?'); $dt->addColumn('type', 'Type', 'array', getSessionTypes()); // $dt->addColumn('userlevel', 'User level', 'array', getUserLevels() ); /* //XXX row coloring not fully working in YuiDatatable $header->embedCss( '.yui-skin-sam .yui-dt tr.green_mark,'. '.yui-skin-sam .yui-dt tr.green_mark td.yui-dt-asc,'. '.yui-skin-sam .yui-dt tr.green_mark td.yui-dt-desc,'. '.yui-skin-sam .yui-dt tr.green_mark td.yui-dt-asc,'. '.yui-skin-sam .yui-dt tr.green_mark td.yui-dt-desc {'. 'background-color: #3a3;'. 'color: #fff;'. '}'); $dt->colorRow('is_online', '!=', false, 'green_mark'); */ // $dt->setSortOrder('time_last_active', 'desc'); $dt->setDataSource($list); //$dt->setRowsPerPage(10); echo $dt->render(); echo '<br/>'; if ($session->isSuperAdmin) { echo '» ' . ahref('a/create_user/', 'Create new user'); }
<?php namespace cd; $header->setTitle(t('Error message')); echo $error->render(true); echo ahref('u/login', 'Log in') . '<br/>'; echo ahref('./', 'Go to start page') . '<br/>';
<?php //TODO later: allow anonymous polls? then allow 1 vote from each IP namespace cd; switch ($this->owner) { case 'active': echo '<h1>Active polls</h1>'; $list = PollItem::getActivePolls(SITE); // d($list); foreach ($list as $p) { echo ahref('u/polls/show/' . $p->id, $p->text) . '<br/>'; } break; case 'vote': // child = vote id // child2 = option id if (!$session->id || !is_numeric($this->child) || !is_numeric($this->child2)) { throw new \Exception('XXX'); } Rating::addVote(POLL, $this->child, $this->child2); $page->disableDesign(); echo '1'; break; case 'show': //child = poll id if (!$this->child) { throw new \Exception('no id set'); } $poll = PollItem::get($this->child); if (!$poll) {
{ $grp = new UserGroup(); $grp->setName($p['name']); $grp->setInfo($p['info']); $grp->setLevel($p['level']); $grp->save(); redir('a/usergroups'); } $header->setTitle('Admin: Manage user groups'); echo '<h1>Manage user groups</h1>'; echo '<h2>Add new group</h2>'; $form = new XhtmlForm('adm_usergroup'); $form->addInput('name', 'Group name'); $form->addTextarea('info', 'Info'); $form->addDropdown('level', 'Level', getUserLevels()); $form->addSubmit('Add'); $form->setHandler('addUserGroupSubmit'); echo $form->render(); echo '<br/>'; echo '<h2>Existing groups</h2>'; echo '<table>'; echo '<tr><th>Name</th><th>Level</th><th>Info</th><th>Created</th></tr>'; foreach (UserGroup::getAll() as $grp) { echo '<tr>'; echo '<td>' . ahref('a/usergroup/' . $grp->getId(), $grp->getName()) . '</td>'; echo '<td>' . $grp->getLevelDesc() . '</td>'; echo '<td>' . $grp->getInfo() . '</td>'; echo '<td>' . sql_datetime($grp->getTimeCreated()) . '</td>'; echo '</tr>'; } echo '</table>';
$session = SessionHandler::getInstance(); $o = FaqItem::get($p['id']); $o->question = $p['q']; $o->answer = $p['a']; $o->creator = $session->id; $o->time_created = sql_datetime(time()); $o->store(); js_redirect('a/faq'); } echo '<h2>Edit FAQ</h2>'; $faq = FaqItem::get($this->child); $x = new XhtmlForm(); $x->addHidden('id', $this->child); $x->addInput('q', 'Question', $faq->question); $x->addTextarea('a', 'Answer', $faq->answer); $x->addSubmit('Save'); $x->setHandler(__NAMESPACE__ . '\\editHandler'); echo $x->render(); echo '<br/>'; echo '» ' . ahref('a/faq/delete/' . $this->child, 'Delete FAQ entry'); break; case 'delete': // child = tblFAQ.id if (confirmed('Are you sure you want to delete this FAQ entry?')) { FaqItem::remove($this->child); js_redirect('a/faq'); } break; default: echo 'No handler for view ' . $this->owner; }
case RECORDING_MSG: echo embed_flv($msg->body) . '<br/>'; break; 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/>';
echo $view->render(); echo '<br/>'; echo '» ' . ahref('?approve', 'Approve') . '<br/>'; echo '<br/>'; echo '» ' . 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 '» ' . ahref('?approve', 'Discard') . '<br/>'; break; case MODERATE_PHOTO: $reporter = User::get($o->owner); echo '<h2>Reported photo: ' . $o->reference . '</h2>'; echo 'Reported by ' . $reporter->name . '<br/>'; echo 'Reason: ' . $o->data . '<br/>'; echo '<br/>'; echo '» ' . ahref('?approve', 'Discard') . '<br/>'; break; default: throw new \Exception('Unhandled ModerationObject type ' . $o->type); } break; default: echo 'No handler for view ' . $this->owner; }
<?php namespace cd; $session->requireLoggedIn(); switch ($this->owner) { case 'adduser': // child = user id Bookmark::create(BOOKMARK_FAVORITEUSER, $this->child); js_redirect('u/bookmark/listusers'); break; case 'removeuser': // child = user id Bookmark::remove(BOOKMARK_FAVORITEUSER, $this->child); js_redirect('u/bookmark/listusers'); break; case 'listusers': echo '<h1>Favorite users</h1>'; $bookmarks = Bookmark::getList(BOOKMARK_FAVORITEUSER, $session->id); foreach ($bookmarks as $bm) { $u = User::get($bm->value); echo ahref('u/profile/' . $u->id, $u->name); echo ' '; echo ahref('u/bookmark/removeuser/' . $u->id, 'Remove'); echo '<br/>'; } break; default: echo 'No handler for view ' . $this->owner; }
function ahref_js($text, $js, $class = '') { return ahref('#', $text, '', $js, $class); }
function etable($datos, $tablea = [], $tha = [], $tra = [], $tda = []) { global $d, $t, $columnas, $pki, $qs; $res = "\n" . t("tr", tarray("th", $columnas, $tha), $tra); // aqui acumulamos el resultado parcial - los headings + rows // intentamos hacer una fila de edit controls $edits = ""; foreach ($columnas as $i) { $edits .= "\n" . td(input(["name" => $i]), $tda); } $res .= tr($edits . td(submit("Insertar") . hidden("d", $d) . hidden("t", $t) . hidden("c", "i"), $tda), $tra); // primero hacemos tr() y td() que ya se repite mucho t("tr", ...) ... ya están $i = 0; foreach ($datos[1] as $arr) { // PC::db($arr, "arr"); // cojemos el valor del PK para esta fila $pkv = $arr[$pki]; // añadimos los botones // $arr[] = submit("Actualizar", $pkv) . submit("Borrar", $pkv); // pues no van a ser botones que no hacen lo que necesito, probamos con vinculos $arr[] = ahref("{$qs}&c=a&id={$pkv}", "Actualizar") . " " . ahref("{$qs}&c=b&id={$pkv}", "Borrar"); $res .= "\n" . tr(etarray("td", $arr, $tda), $tra); // podria hacer que etarray coja este "td" .. como nombre de función pero bueno // PC::db($arr, "arrb"); $i++; // el index de la fila } return t("table", $res, $tablea); }
} if ($fb->type == USER) { $from = User::get($fb->from); echo '<h2>User feedback from ' . $fb->name . '</h2>'; } echo 'Subject: ' . $fb->subject . '<br/>'; if ($fb->body) { echo 'Message: ' . nl2br($fb->body); } echo '<br/>'; if ($fb->type == USER) { $msg = "In response to your feedback:\n\n" . $fb->body; $frm = new XhtmlForm(); $frm->addHidden('owner', $this->child); $frm->addHidden('to', $fb->from); $frm->addTextarea('msg', 'Reply', $msg); $frm->addSubmit('Send'); $frm->setHandler('fbHandle'); echo $frm->render(); } echo '<br/>'; echo ahref('a/feedback/markhandled/' . $this->child, 'Mark as handled'); break; case 'markhandled': // child = tblFeedback.id Feedback::markHandled($this->child); js_redirect('a/feedback/default'); break; default: echo 'No handler for view ' . $this->owner; }
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 '» ' . ahref('a/files/delete/' . $this->child, 'Permanently delete file') . '<br/>'; break; default: echo 'No handler for view ' . $this->owner; }
namespace cd; $session->requireLoggedIn(); switch ($this->owner) { case 'user': // child = user id if (!$this->child || $this->child == $session->id) { die('meh'); } if (confirmed('You sure you want to block this user from contacting you?')) { Bookmark::create(BOOKMARK_USERBLOCK, $this->child); js_redirect('u/profile/' . $this->child); } break; case 'remove': // child = user id Bookmark::remove(BOOKMARK_USERBLOCK, $this->child); js_redirect('u/block/manage'); break; case 'manage': echo '<h1>Manage your blocked users</h1>'; $list = Bookmark::getList(BOOKMARK_USERBLOCK, $session->id); foreach ($list as $o) { echo ahref('u/profile/' . $o->value, User::get($o->value)->name) . ' '; echo ahref('u/block/remove/' . $o->value, 'Remove block') . '<br/>'; } break; default: echo 'no such view: ' . $this->owner; }
js_redirect('a/chatroom/list'); } $o = ChatRoom::get($this->child); echo '<h2>Edit chatroom ' . $o->name . '</h2>'; $x = new XhtmlForm(); $x->addHidden('roomid', $o->id); //XXX haxx $x->addInput('name', 'Name', $o->name, 200); $x->addCheckbox('locked', 'Lock chatroom (read only)', $o->locked_by ? 1 : 0); $x->addSubmit('Save'); $x->setHandler('editHandler'); echo $x->render(); echo '<br/>'; echo '» ' . ahref('a/chatroom/empty/' . $this->child, 'Empty chatroom of messages') . '<br/>'; echo '<br/>'; echo '» ' . ahref('a/chatroom/remove/' . $this->child, 'Remove chatroom') . '<br/>'; break; case 'remove': if (confirmed('Are you sure you want to remove this chatroom?')) { ChatRoom::remove($this->child); js_redirect('a/chatroom/list'); } break; case 'empty': if (confirmed('Are you sure you want to remove all messages from this chatroom?')) { ChatMessage::deleteByRoom($this->child); js_redirect('a/chatroom/list'); } break; case 'new': function createHandler($p)
$a->content = showThumb($avatar_id, 'Avatar', 150, 150); echo $a->render(); $lb = new YuiLightbox(); echo $lb->render() . '<br/>'; } } echo '<br/>'; if ($session->id && $user_id != $session->id) { echo '» ' . ahref('u/messages/send/' . $user_id, 'Send message') . '<br/>'; echo '» ' . ahref('u/poke/send/' . $user_id, 'Poke user') . '<br/>'; //XXX: FIXME move to rr-project view echo '» ' . ahref('videomsg/send/' . $user_id, 'Send video message') . '<br/>'; if (Bookmark::exists(BOOKMARK_FAVORITEUSER, $user_id, $session->id)) { echo '» ' . ahref('u/bookmark/removeuser/' . $user_id, 'Remove favorite') . '<br/>'; } else { echo '» ' . ahref('u/bookmark/adduser/' . $user_id, 'Add favorite') . '<br/>'; } echo '<br/>'; if (Bookmark::exists(BOOKMARK_USERBLOCK, $user_id, $session->id)) { echo '<b>THIS USER IS BLOCKED FROM CONTACTING YOU</b><br/>'; } else { echo '» ' . ahref('u/block/user/' . $user_id, 'Block user') . '<br/>'; } echo '» ' . ahref('u/report/user/' . $user_id, 'Report user') . '<br/>'; } echo '» ' . ahref('u/guestbook/' . $user_id, 'Guestbook') . '<br/>'; echo '» ' . ahref('u/album/overview/' . $user_id, 'Photos') . '<br/>'; echo '<br/>'; if ($session->id && $user_id == $session->id) { echo '» ' . ahref('u/edit', 'Edit profile') . '<br/>'; }
<?php namespace cd; switch ($this->owner) { case 'user': function handleSearch($p) { $list = UserList::getUsers($p['q']); echo '<h2>Showing users matching <u>' . $p['q'] . '</u>'; echo ' (' . count($list) . ' hits)</h2>'; $dt = new YuiDatatable(); $dt->addColumn('id', 'Username', 'link', 'u/profile/', 'name'); $dt->addColumn('time_last_active', 'Last active'); $dt->setDataSource($list); echo $dt->render(); } $form = new XhtmlForm(); $form->addInput('q', 'Username search'); $form->setFocus('q'); $form->addSubmit('Search'); $form->setHandler('handleSearch'); echo $form->render(); echo '<br/>'; echo '» ' . ahref('u/users/online', 'Show users online') . '<br/>'; echo '» ' . ahref('u/users/newest', 'Show new members') . '<br/>'; break; default: throw new \Exception('no such view: ' . $this->owner); }
<?php namespace cd; $session->requireSuperAdmin(); echo '<h1>core_dev admin</h1>'; echo ahref('a/moderation', 'Moderation queue') . '<br/>'; echo ahref('a/feedback', 'Feedback (' . Feedback::getUnansweredCount() . ')') . '<br/>'; echo ahref('a/blogs/overview', 'Blogs') . '<br/>'; echo '<br/>'; echo ahref('a/users', 'Users') . '<br/>'; echo ahref('a/usergroups', 'User groups') . '<br/>'; echo ahref('a/files/list', 'Files') . '<br/>'; echo ahref('a/polls', 'Polls') . '<br/>'; echo ahref('a/chatroom/list', 'Chatrooms') . '<br/>'; echo ahref('a/userdata/list', 'Userdata types') . '<br/>'; echo ahref('a/reserved_words', 'Reserved words') . '<br/>'; echo ahref('a/faq', 'FAQ') . '<br/>'; echo '<br/>'; echo ahref('a/phpinfo', 'phpinfo()') . '<br/>'; echo ahref('a/compatiblity', 'Compatibility check') . '<br/>'; echo ahref('t/timezones', 'Time zones') . '<br/>'; echo ahref('t/currency', 'Currencies') . '<br/>'; echo '<br/>'; echo ahref('a/mysql_config', 'MySQL information') . '<br/>'; echo ahref('a/geoip/version', 'GeoIP information') . '<br/>'; echo ahref('a/hashes', 'Available hash functions') . '<br/>'; echo '<br/>';
//TODO: abiltiy to mark a userdata field as required at registration (such as email) namespace cd; $session->requireSuperAdmin(); switch ($this->owner) { case 'list': echo '<h1>Existing userdata fields</h1>'; $list = UserDataField::getAll(); $dt = new YuiDatatable(); $dt->addColumn('id', 'Name', 'link', 'a/userdata/edit/', 'name'); $dt->addColumn('label', 'Label'); $dt->addColumn('type', 'Type', 'array', UserDataField::getTypes()); $dt->setDataSource($list); echo $dt->render(); echo '<br/>'; echo '» ' . ahref('a/userdata/new', 'Create new field'); break; case 'new': function newSubmit($p) { $f = new UserDataField(); $f->name = $p['name']; $f->type = $p['type']; $f->label = $p['label']; $f->id = $f->store(); if ($f->type == UserDataField::RADIO) { js_redirect('a/userdata/edit/' . $f->id); } else { js_redirect('a/userdata/list'); } }
} if ($poll) { $cats = new CategoryList(POLL); $cats->setOwner($this->child); foreach ($cats->getItems() as $i => $opt) { $frm->addInput('poll_a' . $i, 'Answer ' . ($i + 1), $opt->title); } $frm->addInput('poll_new_a', 'New answer'); } $frm->addSubmit('Save'); $frm->setHandler('editPoll'); echo $frm->render(); echo '<br/>'; echo ahref('a/polls/stats/' . $this->child, 'Poll stats') . '<br/>'; echo '<br/>'; echo ahref('a/polls/remove/' . $this->child, 'Remove poll') . '<br/>'; break; case 'stats': echo '<h1>Poll stats</h1>'; $votes = Rating::getStats(POLL, $this->child); $tot_votes = 0; foreach ($votes as $cnt) { $tot_votes += $cnt; } $list = array(); foreach ($votes as $title => $cnt) { $pct = 0; if ($tot_votes) { $pct = $cnt / $tot_votes * 100; } echo ' • ' . $title . ' got ' . $cnt . ' votes (' . $pct . '%)<br/>';
$form->addSubmit('Save'); $form->setHandler('handleUpload'); echo $form->render(); // only enable Html5Uploader for supported browsers $b = HttpUserAgent::getBrowser(); if ($b->name == 'Firefox' || $b->name == 'Chrome') { echo '<h1>' . ahref('u/album/uploadmulti/' . $this->child, $b->name . ' detected, try the new drag & drop multi image uploader') . '</h1>'; } break; case 'uploadmulti': if (!$this->child) { die('nonow2'); } echo '<h2>Multi image uploader</h2>'; echo Html5Uploader::albumUploader($this->child); echo ahref('u/album/show/' . $session->id . '/' . $this->child, 'Return to album'); break; case 'new': $session->requireLoggedIn(); // create new photo album echo '<h1>Create a new photo album</h1>'; function handleNew($p) { $session = SessionHandler::getInstance(); $o = new PhotoAlbum(); $o->owner = $session->id; $o->name = $p['name']; $o->time_created = sql_datetime(time()); if ($session->isSuperAdmin && $p['system']) { $o->owner = 0; }
<html> <head> <title>Home</title> <meta charset="UTF-8"> <link rel="stylesheet" href="CSS/mainStyle.css"> <script src="JS/mainScript.js"></script> <?php require "Classes/mysqlConnection.php"; require "Classes/quickElements.php"; ?> </head> <body> <?php //check if the user is logged, if not, show the login option session_start(); if (isset($_SESSION["name"])) { echo "Welcome " . $_SESSION["name"] . ", you have the options<br>"; ahref("Itens", "Item/item.php"); ahref("Characters", "Characters/characters.php"); echo "<a class='greenLink' href='#' onclick='javascript:window.open(\"D20/d20.htm\", \"D20\", \"width=310, height=300, menubar=0, status=0, titlebar=0, \");'>Open D20</a><br>"; ahref("Logout", "Accounts/logout.php"); } else { echo "Welcome, stranger<br>Please, login first to use our services<br>"; ahref("Login", "Accounts/login.phtml"); } ?> </body> </html>