PageRenderTime 23ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/www/usage.php

https://github.com/mtwstudios/comtor
PHP | 52 lines | 30 code | 13 blank | 9 comment | 7 complexity | 2dd15e73c20d1ad0652e5f3ae1965392 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1
  1. <?php
  2. require_once("loginCheck.php");
  3. require_once("smarty/Smarty.class.php");
  4. $tpl = new Smarty();
  5. require_once("header1.php");
  6. // Connect to database
  7. require_once("connect.php");
  8. // Check for admin permissions, else use current user id
  9. if ((isset($_GET['userId'])) && is_numeric($_GET['userId']) && ($_SESSION['acctType'] == "admin"))
  10. $userId = $_GET['userId'];
  11. else
  12. $userId = $_SESSION['userId'];
  13. /* Display current user information */
  14. if (($userInfo = getUserInfoById($userId)) !== false)
  15. $tpl->assign($userInfo);
  16. else
  17. {
  18. // Redirect with error message
  19. $_SESSION['msg']['error'] = "Specified user does not exist!";
  20. require_once("redirect.php");
  21. }
  22. // Assign date format to template
  23. $dateFormat = "l F j, Y g:i:s A";
  24. $tpl->assign('dateFormat', $dateFormat);
  25. require_once("generalFunctions.php");
  26. // Display use of each doclet
  27. if (getUserAcctType($userId) == "student")
  28. $tpl->assign('doclets', getDocletUsage($userId));
  29. // Assign breadcrumbs
  30. $breadcrumbs = array();
  31. $breadcrumbs[] = array('text' => 'COMTOR', 'href' => 'index.php');
  32. $breadcrumbs[] = array('text' => 'System Usage', 'href' => 'usage.php');
  33. $tpl->assign('breadcrumbs', $breadcrumbs);
  34. // Fetch template
  35. $tpldata = $tpl->fetch("usage.tpl");
  36. $tpl->assign('tpldata', $tpldata);
  37. // Display template
  38. $tpl->display("htmlmain.tpl");
  39. ?>