<div id="fav_courses"><p>Favourite courses:</p> <?php $favs = array_filter(User::GetAttribs(User::GetAuthenticatedID()), function ($attr) { return $attr[0] == 'COURSEFAV'; }); foreach ($favs as $fav) { $id = $fav[1]; $subj = ucfirst(Comment::GetSubject($fav[1])); echo "<p><a href=\"/search?id={$id}\">{$subj}</a></p>"; } ?> </div> <br> <div id="fav_topics"><p>Favourite topics:<br> <?php $favs = array_filter(User::GetAttribs(User::GetAuthenticatedID()), function ($attr) { return $attr[0] == 'TOPICFAV'; }); foreach ($favs as $fav) { $id = $fav[1]; $subj = ucfirst(Comment::GetSubject($fav[1])); echo "<p>{$subj}</p>"; } ?> </div> <br>
// id, code, title, descr, university $arr[] = array($elem['id'], $elem['title'], $elem['code']); } $lst = CourseDefn::ListAllStartingWithCode($val); foreach ($lst as $elem) { // id, code, title, descr, university $arr[] = array($elem['id'], $elem['code'], $elem['title']); } break; // TODO: decide if it's okay to do this, especially without auth // TODO: decide if it's okay to do this, especially without auth case 'users': $lst = User::ListAllStartingWithName($val); $arr = array(); foreach ($lst as $k => $v) { $usr = User::GetAttribs($v['id']); foreach ($usr as $l => $w) { $usr[$w[0]] = $w[1]; } $arr[] = array($v['id'], $usr['NAME'], "{$usr['UNIVERSITY']}, {$usr['GRADYEAR']}"); } $invert_validation = true; break; default: die(''); } header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); header("Content-Type: application/json");
include "{$ROOT}/user/views/create.view.php"; } } else { if ($action == 'show' || ($status_called = $action == 'status')) { User::enterStatusMode(); $id = $status_called ? User::GetAuthenticatedID() : $params['id']; if (!$id) { Error::generate('notice', 'Must be logged in.'); User::leaveStatusMode(); if (isset($_SESSION) && $_SESSION['last_rendered_page']) { redirect_raw($_SESSION['last_rendered_page']); } else { redirect(); } } else { if (!($args['userinfo'] = User::GetAttribs($id))) { Error::generate('notice', 'Invalid user ID.'); User::leaveStatusMode(); if (isset($_SESSION) && $_SESSION['last_rendered_page']) { redirect_raw($_SESSION['last_rendered_page']); } else { redirect(); } } else { foreach ($args['userinfo'] as $key => $param) { switch (strtolower($param[0])) { case 'file': $id = $param[1]; $fname = File::GetAttrib($id, 'name'); $frole = File::GetAttrib($id, 'roles'); $fowner = File::GetAttrib($id, 'owner');