} 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(); echo ahref('u/photo/show/' . $im->id, 'Details'); echo '<br/><br/>'; } $lb = new YuiLightbox(); echo $lb->render(); break; case 'delete': $session->requireLoggedIn(); if ($this->child && confirmed('Are you sure you want to delete this photo album?')) { // verify that the owner of the album is current session id $album = PhotoAlbum::get($this->child); if (!$album->owner || $album->owner != $session->id) { dp('HACK: tried to delete photo album ' . $this->child . ' which is not owned by user ' . $session->id); return; } PhotoAlbum::delete($this->child); js_redirect('u/album/overview'); } break; case 'upload': // child = album id $session->requireLoggedIn(); function handleUpload($p) {
<?php require_once 'config.php'; $session->requireAdmin(); if (empty($_GET['id']) || !is_numeric($_GET['id'])) { die; } //invalid request $itemId = $_GET['id']; require 'design_head.php'; echo xhtmlMenu($forum_menu, 'blog_menu'); echo getForumDepthHTML(FORUM_FOLDER, $itemId); $item = getForumItem($itemId); if ($item) { echo showForumPost($item, '', false); } if (confirmed('Are you sure you want to delete this forum post?', 'id', $itemId)) { deleteForumItemRecursive($itemId); echo 'The forum and all subforums has been deleted'; } require 'design_foot.php';
function install_core() { global $agave; if (!confirmed()) { confirm('Install Core'); } //install all core tables first by calling just _info_install hooks foreach ($agave->setting('installed_modules') as $module) { include_once $agave->modulePath($module) . $module . ".info"; } foreach ($agave->setting('installed_modules') as $module) { $func = $module . "_info_install"; if (function_exists($func)) { call_user_func($func); } } //now call all the other stuff to populate the core tables $admin = $agave->load('admin'); foreach ($agave->setting('installed_modules') as $module) { if (function_exists($module . "_info_cron")) { $admin->installCron(call_user_func($module . "_info_cron"), $module); } if (function_exists($module . "_info_menu")) { $admin->installMenu(call_user_func($module . "_info_menu"), $module); } if (function_exists($module . "_info_menu_items")) { $admin->installMenuItems(call_user_func($module . "_info_menu_items"), $module); } if (function_exists($module . "_info_panels")) { $admin->installPanels(call_user_func($module . "_info_panels"), $module); } if (function_exists($module . "_info_system_uri")) { $admin->installSystemUri(call_user_func($module . "_info_system_uri"), $module); } if (function_exists($module . "_info_system_variables")) { $admin->installSystemVariables(call_user_func($module . "_info_system_variables")); } if (function_exists($module . "_info_user_access")) { $admin->installUserAccess(call_user_func($module . "_info_user_access"), $module); } $meta = call_user_func($module . "_info_meta"); //set versions for core modules $versions[$module] = $meta['version']; } $_SESSION['installing_agave'] = TRUE; install_phase('user'); }
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; }
$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) { $o = new ChatRoom(); $o->name = trim($p['name']); $o->id = $o->store(); js_redirect('a/chatroom/list'); } echo '<h2>Create new chatroom</h2>'; $x = new XhtmlForm(); $x->addInput('name', 'Name');
$pct = 0; if ($tot_votes) { $pct = $cnt / $tot_votes * 100; } echo ' • ' . $title . ' got ' . $cnt . ' votes (' . $pct . '%)<br/>'; $list[] = array('name' => $title, 'value' => $cnt); } $pie = new Yui3PieChart(); $pie->setWidth(100); $pie->setHeight(100); $pie->setCategoryKey('name'); $pie->setDataSource($list); echo $pie->render(); break; case 'remove': if (confirmed('Are you sure you want to remove this site poll?')) { PollItem::removePoll($this->child); js_redirect('a/polls/list'); } break; case 'add': function addPoll($p) { if (empty($p['poll_q'])) { return; } if (!empty($p['poll_start_man'])) { $pollId = PollItem::addPollExactPeriod(SITE, 0, $p['poll_q'], $p['poll_start_man'], $p['poll_end_man']); } else { $pollId = PollItem::add(SITE, 0, $p['poll_q'], $p['poll_dur'], $p['poll_start']); }
* @description com wNewsletter. */ defined('_JEXEC') or die('Restricted access'); require_once JApplicationHelper::getPath('admin_html'); require_once JPATH_COMPONENT . DS . 'admin.wnewsletter.class.php'; require_once JPATH_COMPONENT . DS . 'controller.php'; JTable::addIncludePath(JPATH_COMPONENT . DS . 'tables'); $id = JRequest::getVar('id', '', 'get', 'int', 0); $cid = JRequest::getVar('cid', '', 'post', 'array', array(0)); switch ($task) { //save status and ordering case "confirmed": confirmed($cid, 1, $option); break; case "unconfirmed": confirmed($cid, 0, $option); break; case 'send': SendMail::send(); break; // process product by controller // process product by controller default: $controller = new wNewsLetterController(array('default_task' => 'showNewsLetter')); $controller->execute(JRequest::getVar('task')); $controller->redirect(); } function confirmed($cid, $confirmed, $option) { global $mainframe; $database =& JFactory::getDBO();
$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; }
<?php 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;
echo '<h2>No such user exists</h2>'; return; } echo '<h1>User admin for ' . $user->name . '</h1>'; echo '» ' . ahref('u/profile/' . $user->id, 'Show profile') . '<br/>'; if ($user->type == SESSION_FACEBOOK) { echo '<h2>Facebook account</h2>'; echo 'Fb username: '******'fb_name') . '<br/>'; echo 'Fb picture: <img src="' . UserSetting::get($user->id, 'fb_picture') . '"/><br/>'; $fburl = 'http://www.facebook.com/profile.php?id=' . $user->name; echo 'Fb profile: <a href="' . $fburl . '" target="_blank">' . $fburl . '</a><br/>'; } echo 'Last IP: ' . $user->last_ip . '<br/>'; echo '<br/>'; if ($session->id != $this->owner && isset($_GET['remove'])) { if (confirmed('Are you sure you want to remove this user?')) { $user->remove(); echo '<div class="item">User removed</div>'; } return; } if (!empty($_POST['change_pwd'])) { if (Password::isForbidden($_POST['change_pwd'])) { echo '<div class="item">Weak password was chosen, password has not been changed!</div>'; return; } UserHandler::setPassword($user->id, $_POST['change_pwd']); echo '<div class="item">Password changed!</div>'; return; } if (!empty($_POST['setting_name']) && isset($_POST['setting_val'])) {