PageRenderTime 38ms CodeModel.GetById 7ms RepoModel.GetById 0ms app.codeStats 0ms

/classes/core/Request.inc.php

https://github.com/lib-uoguelph-ca/ocs
PHP | 154 lines | 65 code | 20 blank | 69 comment | 4 complexity | d239a79992b6175c01ff16222207a749 MD5 | raw file
Possible License(s): GPL-2.0
  1. <?php
  2. /**
  3. * @file Request.inc.php
  4. *
  5. * Copyright (c) 2000-2012 John Willinsky
  6. * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
  7. *
  8. * @class Request
  9. * @ingroup core
  10. *
  11. * @brief Class providing operations associated with HTTP requests.
  12. * Requests are assumed to be in the format:
  13. * http://host.tld/index.php
  14. * /<conference_id>
  15. * /<sched_conf_id>
  16. * /<page_name>
  17. * /<operation_name>
  18. * /<arguments...>
  19. * <conference_id> is assumed to be "index" for top-level site requests.
  20. * ditto for <sched_conf_id>
  21. */
  22. //$Id$
  23. import('core.PKPRequest');
  24. class Request extends PKPRequest {
  25. /**
  26. * Redirect to the specified page within OCS. Shorthand for a common call to Request::redirect(Request::url(...)).
  27. * @param $conferencePath string The path of the conference to redirect to.
  28. * @param $schedConfPath string The path of the conference to redirect to.
  29. * @param $page string The name of the op to redirect to.
  30. * @param $op string optional The name of the op to redirect to.
  31. * @param $path mixed string or array containing path info for redirect.
  32. * @param $params array Map of name => value pairs for additional parameters
  33. * @param $anchor string Name of desired anchor on the target page
  34. */
  35. function redirect($conferencePath = null, $schedConfPath = null, $page = null, $op = null, $path = null, $params = null, $anchor = null) {
  36. $_this =& PKPRequest::_checkThis();
  37. $_this->redirectUrl($_this->url($conferencePath, $schedConfPath, $page, $op, $path, $params, $anchor));
  38. }
  39. /**
  40. * Deprecated
  41. * @see PKPPageRouter::getRequestedContextPath()
  42. */
  43. function getRequestedConferencePath() {
  44. static $conference;
  45. $_this =& PKPRequest::_checkThis();
  46. if (!isset($conference)) {
  47. $conference = $_this->_delegateToRouter('getRequestedContextPath', 1);
  48. HookRegistry::call('Request::getRequestedConferencePath', array(&$conference));
  49. }
  50. return $conference;
  51. }
  52. /**
  53. * Deprecated
  54. * @see PKPPageRouter::getRequestedContextPath()
  55. */
  56. function getRequestedSchedConfPath() {
  57. static $schedConf;
  58. $_this =& PKPRequest::_checkThis();
  59. if (!isset($schedConf)) {
  60. $schedConf = $_this->_delegateToRouter('getRequestedContextPath', 2);
  61. HookRegistry::call('Request::getRequestedSchedConfPath', array(&$schedConf));
  62. }
  63. return $schedConf;
  64. }
  65. /**
  66. * Deprecated
  67. * @see PKPPageRouter::getContext()
  68. */
  69. function &getConference() {
  70. $_this =& PKPRequest::_checkThis();
  71. $returner = $_this->_delegateToRouter('getContext', 1);
  72. return $returner;
  73. }
  74. /**
  75. * Deprecated
  76. * @see PKPPageRouter::getContext()
  77. */
  78. function &getSchedConf() {
  79. $_this =& PKPRequest::_checkThis();
  80. $returner = $_this->_delegateToRouter('getContext', 2);
  81. return $returner;
  82. }
  83. /**
  84. * Deprecated
  85. * @see PKPPageRouter::getRequestedContextPath()
  86. */
  87. function getRequestedContextPath($contextLevel = null) {
  88. $_this =& PKPRequest::_checkThis();
  89. // Emulate the old behavior of getRequestedContextPath for
  90. // backwards compatibility.
  91. if (is_null($contextLevel)) {
  92. return $_this->_delegateToRouter('getRequestedContextPaths');
  93. } else {
  94. return array($_this->_delegateToRouter('getRequestedContextPath', $contextLevel));
  95. }
  96. }
  97. /**
  98. * Deprecated
  99. * @see PKPPageRouter::getContext()
  100. */
  101. function &getContext($level = 1) {
  102. $_this =& PKPRequest::_checkThis();
  103. $returner = $_this->_delegateToRouter('getContext', $level);
  104. return $returner;
  105. }
  106. /**
  107. * Deprecated
  108. * @see PKPPageRouter::getContextByName()
  109. */
  110. function &getContextByName($contextName) {
  111. $_this =& PKPRequest::_checkThis();
  112. $returner = $_this->_delegateToRouter('getContextByName', $contextName);
  113. return $returner;
  114. }
  115. /**
  116. * Deprecated
  117. * @see PKPPageRouter::url()
  118. */
  119. function url($conferencePath = null, $schedConfPath = null, $page = null,
  120. $op = null, $path = null, $params = null, $anchor = null, $escape = false) {
  121. $_this =& PKPRequest::_checkThis();
  122. return $_this->_delegateToRouter('url', array($conferencePath, $schedConfPath), $page, $op, $path,
  123. $params, $anchor, $escape);
  124. }
  125. /**
  126. * Deprecated
  127. * @see PageRouter::redirectHome()
  128. */
  129. function redirectHome() {
  130. $_this =& PKPRequest::_checkThis();
  131. return $_this->_delegateToRouter('redirectHome');
  132. }
  133. }
  134. ?>