diff --git a/cake/libs/controller/components/request_handler.php b/cake/libs/controller/components/request_handler.php index 3adc663c1..2f18ff3e7 100644 --- a/cake/libs/controller/components/request_handler.php +++ b/cake/libs/controller/components/request_handler.php @@ -39,7 +39,6 @@ if (!defined('REQUEST_MOBILE_UA')) { * */ class RequestHandlerComponent extends Object { - /** * The layout that will be switched to for Ajax requests * @@ -129,10 +128,8 @@ class RequestHandlerComponent extends Object { */ var $ext = null; /** - * Constructor. Parses the accepted content types accepted by the client using - * HTTP_ACCEPT + * Constructor. Parses the accepted content types accepted by the client using HTTP_ACCEPT * - * @access public */ function __construct() { $this->__acceptTypes = explode(',', env('HTTP_ACCEPT')); @@ -152,8 +149,9 @@ class RequestHandlerComponent extends Object { * corresponding content-type is pushed onto the list of accepted content-types * as the first item. * - * @param object A reference to the controller + * @param object $controller A reference to the controller * @see Router::parseExtensions() + * @access public */ function initialize(&$controller) { if (isset($controller->params['url']['ext'])) { @@ -181,10 +179,10 @@ class RequestHandlerComponent extends Object { * - If the XML data is POSTed, the data is parsed into an XML object, which is assigned * to the $data property of the controller, which can then be saved to a model object. * - * @param object A reference to the controller + * @param object $controller A reference to the controller + * @access public */ function startup(&$controller) { - if (!$this->enabled) { return; } @@ -211,19 +209,20 @@ class RequestHandlerComponent extends Object { /** * Handles (fakes) redirects for Ajax requests using requestAction() * - * @param object A reference to the controller - * @param mixed A string or array containing the redirect location + * @param object $controller A reference to the controller + * @param mixed $url A string or array containing the redirect location + * @access public */ function beforeRedirect(&$controller, $url) { if (!$this->isAjax()) { return; } - } /** * Returns true if the current HTTP request is Ajax, false otherwise * * @return boolean True if call is Ajax + * @access public */ function isAjax() { return env('HTTP_X_REQUESTED_WITH') === "XMLHttpRequest"; @@ -231,7 +230,8 @@ class RequestHandlerComponent extends Object { /** * Returns true if the current request is over HTTPS, false otherwise. * - * @return bool + * @return bool True if call is over HTTPS + * @access public */ function isSSL() { return env('HTTPS'); @@ -240,6 +240,7 @@ class RequestHandlerComponent extends Object { * Returns true if the current call accepts an XML response, false otherwise * * @return boolean True if client accepts an XML response + * @access public */ function isXml() { return $this->prefers('xml'); @@ -248,6 +249,7 @@ class RequestHandlerComponent extends Object { * Returns true if the current call accepts an RSS response, false otherwise * * @return boolean True if client accepts an RSS response + * @access public */ function isRss() { return $this->prefers('rss'); @@ -256,6 +258,7 @@ class RequestHandlerComponent extends Object { * Returns true if the current call accepts an Atom response, false otherwise * * @return boolean True if client accepts an RSS response + * @access public */ function isAtom() { return $this->prefers('atom'); @@ -265,6 +268,7 @@ class RequestHandlerComponent extends Object { * client accepts WAP content. * * @return boolean True if user agent is a mobile web browser + * @access public */ function isMobile() { preg_match('/' . REQUEST_MOBILE_UA . '/i', env('HTTP_USER_AGENT'), $match); @@ -277,6 +281,7 @@ class RequestHandlerComponent extends Object { * Returns true if the client accepts WAP content * * @return bool + * @access public */ function isWap() { return $this->prefers('wap'); @@ -285,39 +290,44 @@ class RequestHandlerComponent extends Object { * Returns true if the current call a POST request * * @return boolean True if call is a POST + * @access public */ function isPost() { - return (strtolower(env('REQUEST_METHOD')) == 'post'); + return (low(env('REQUEST_METHOD')) == 'post'); } /** * Returns true if the current call a PUT request * * @return boolean True if call is a PUT + * @access public */ function isPut() { - return (strtolower(env('REQUEST_METHOD')) == 'put'); + return (low(env('REQUEST_METHOD')) == 'put'); } /** * Returns true if the current call a GET request * * @return boolean True if call is a GET + * @access public */ function isGet() { - return (strtolower(env('REQUEST_METHOD')) == 'get'); + return (low(env('REQUEST_METHOD')) == 'get'); } /** * Returns true if the current call a DELETE request * * @return boolean True if call is a DELETE + * @access public */ function isDelete() { - return (strtolower(env('REQUEST_METHOD')) == 'delete'); + return (low(env('REQUEST_METHOD')) == 'delete'); } /** * Gets Prototype version if call is Ajax, otherwise empty string. * The Prototype library sets a special "Prototype version" HTTP header. * * @return string Prototype version of component making Ajax call + * @access public */ function getAjaxVersion() { if (env('HTTP_X_PROTOTYPE_VERSION') != null) { @@ -392,7 +402,7 @@ class RequestHandlerComponent extends Object { * * @param mixed $type Can be null (or no parameter), a string type name, or an * array of types - * @returns mixed If null or no parameter is passed, returns an array of content + * @return mixed If null or no parameter is passed, returns an array of content * types the client accepts. If a string is passed, returns true * if the client accepts it. If an array is passed, returns true * if the client accepts one or more elements in the array. @@ -434,19 +444,16 @@ class RequestHandlerComponent extends Object { /** * Determines the content type of the data the client has sent (i.e. in a POST request) * - * @param mixed $type Can be null (or no parameter), a string type name, or an - * array of types + * @param mixed $type Can be null (or no parameter), a string type name, or an array of types * @access public */ function requestedWith($type = null) { - if (!$this->isPost() && !$this->isPut()) { return null; } if ($type == null) { return $this->mapType(env('CONTENT_TYPE')); - } elseif (is_array($type)) { foreach ($type as $t) { if ($this->requestedWith($t)) { @@ -455,7 +462,6 @@ class RequestHandlerComponent extends Object { } return false; } elseif (is_string($type)) { - return ($type == $this->mapType(env('CONTENT_TYPE'))); } } @@ -469,7 +475,7 @@ class RequestHandlerComponent extends Object { * * @param mixed $type An optional array of 'friendly' content-type names, i.e. * 'html', 'xml', 'js', etc. - * @returns mixed If $type is null or not provided, the first content-type in the + * @return mixed If $type is null or not provided, the first content-type in the * list, based on preference, is returned. * @access public * @see RequestHandlerComponent::setContent() @@ -508,7 +514,7 @@ class RequestHandlerComponent extends Object { * Sets the layout and template paths for the content type defined by $type. * * @param object $controller A reference to a controller object - * @param string $type + * @param string $type Type of response to send (e.g: 'ajax') * @access public * @see RequestHandlerComponent::setContent() * @see RequestHandlerComponent::respondAs() @@ -622,12 +628,11 @@ class RequestHandlerComponent extends Object { /** * Maps a content-type back to an alias * - * @param mixed $type - * @return mixed + * @param mixed $type Content type + * @return mixed Alias * @access public */ function mapType($ctype) { - if (is_array($ctype)) { $out = array(); foreach ($ctype as $t) { diff --git a/cake/libs/controller/components/security.php b/cake/libs/controller/components/security.php index 105da7b2e..e24e977f9 100644 --- a/cake/libs/controller/components/security.php +++ b/cake/libs/controller/components/security.php @@ -96,6 +96,7 @@ class SecurityComponent extends Object { * requests. * * @var array + * @access public * @see SecurityComponent::requireAuth() */ var $allowedControllers = array(); @@ -104,6 +105,7 @@ class SecurityComponent extends Object { * requests. * * @var array + * @access public * @see SecurityComponent::requireAuth() */ var $allowedActions = array(); @@ -111,6 +113,7 @@ class SecurityComponent extends Object { * Form fields to disable * * @var array + * @access public */ var $disabledFields = array(); /** @@ -123,8 +126,7 @@ class SecurityComponent extends Object { /** * Component startup. All security checking happens here. * - * @param object $controller - * @return unknown + * @param object $controller Instantiating controller * @access public */ function startup(&$controller) { @@ -239,8 +241,8 @@ class SecurityComponent extends Object { /** * Generates the text of an HTTP-authentication request header from an array of options.. * - * @param array $options - * @return unknown + * @param array $options Set of options for header + * @return string HTTP-authentication request header * @access public */ function loginRequest($options = array()) { @@ -260,7 +262,7 @@ class SecurityComponent extends Object { /** * Parses an HTTP digest authentication response, and returns an array of the data, or null on failure. * - * @param string $digest + * @param string $digest Digest authentication response * @return array Digest authentication parameters * @access public */ @@ -300,12 +302,14 @@ class SecurityComponent extends Object { ); } /** - * Black-hole an invalid request with a 404 error or custom callback + * Black-hole an invalid request with a 404 error or custom callback. If SecurityComponent::$blackHoleCallback + * is speicifed, it will use this callback by executing the method indicated in $error * - * @param object $controller - * @param string $error - * @return Controller blackHoleCallback + * @param object $controller Instantiating controller + * @param string $error Error method + * @return mixed If specified, controller blackHoleCallback's response, or no return otherwise * @access public + * @see SecurityComponent::$blackHoleCallback */ function blackHole(&$controller, $error = '') { if ($this->blackHoleCallback == null) { @@ -321,8 +325,8 @@ class SecurityComponent extends Object { /** * Check if post is required * - * @param object $controller - * @return bool + * @param object $controller Instantiating controller + * @return bool true if post is requred * @access private */ function __postRequired(&$controller) { @@ -340,8 +344,8 @@ class SecurityComponent extends Object { /** * Check if access requires secure connection * - * @param object $controller - * @return bool + * @param object $controller Instantiating controller + * @return bool true if secure connection required * @access private */ function __secureRequired(&$controller) { @@ -359,8 +363,8 @@ class SecurityComponent extends Object { /** * Check if authentication is required * - * @param object $controller - * @return bool + * @param object $controller Instantiating controller + * @return bool true if authentication required * @access private */ function __authRequired(&$controller) { @@ -393,8 +397,8 @@ class SecurityComponent extends Object { /** * Check if login is required * - * @param object $controller - * @return bool + * @param object $controller Instantiating controller + * @return bool true if login is required * @access private */ function __loginRequired(&$controller) { @@ -435,10 +439,10 @@ class SecurityComponent extends Object { return true; } /** - * Validate submited form + * Validate submitted form * - * @param object $controller - * @return bool + * @param object $controller Instantiating controller + * @return bool true if submitted form is valid * @access private */ function __validatePost(&$controller) { @@ -567,8 +571,8 @@ class SecurityComponent extends Object { /** * Add authentication key for new form posts * - * @param object $controller - * @return bool + * @param object $controller Instantiating controller + * @return bool Success * @access private */ function __generateToken(&$controller) { @@ -592,7 +596,7 @@ class SecurityComponent extends Object { /** * Sets the default login options for an HTTP-authenticated request * - * @param unknown_type $options + * @param array $options Default login options * @access private */ function __setLoginDefaults(&$options) { @@ -607,10 +611,10 @@ class SecurityComponent extends Object { /** * Calls a controller callback method * - * @param object $controller - * @param string $method - * @param array $params - * @return Contrtoller callback method + * @param object $controller Controller to run callback on + * @param string $method Method to execute + * @param array $params Parameters to send to method + * @return mixed Controller callback method's response * @access private */ function __callback(&$controller, $method, $params = array()) { diff --git a/cake/libs/controller/components/session.php b/cake/libs/controller/components/session.php index 67a1f6ba2..8324a377c 100644 --- a/cake/libs/controller/components/session.php +++ b/cake/libs/controller/components/session.php @@ -48,7 +48,7 @@ class SessionComponent extends CakeSession { /** * Class constructor * - * @param string $base + * @param string $base The base path for the Session */ function __construct($base = null) { if (Configure::read('Session.start') === true) { @@ -60,7 +60,8 @@ class SessionComponent extends CakeSession { /** * Turn sessions on if 'Session.start' is set to false in core.php * - * @param string $base + * @param string $base The base path for the Session + * @access public */ function activate($base = null) { if ($this->__active === true) { @@ -70,9 +71,9 @@ class SessionComponent extends CakeSession { $this->__active = true; } /** - * Startup method. Copies controller data locally for rendering flash messages. + * Startup method. Copies controller data locally for rendering flash messages. * - * @param object $controller + * @param object $controller Instantiating controller * @access public */ function startup(&$controller) { @@ -118,8 +119,7 @@ class SessionComponent extends CakeSession { * Calling the method without a param will return all session vars * * @param string $name the name of the session key you want to read - * - * @return values from the session vars + * @return mixed value from the session vars * @access public */ function read($name = null) { @@ -133,8 +133,9 @@ class SessionComponent extends CakeSession { * * In your controller: $this->Session->del('Controller.sessKey'); * - * @param string $name + * @param string $name the name of the session key you want to delete * @return boolean true is session variable is set and can be deleted, false is variable was not set. + * @access public */ function del($name) { if ($this->__active === true) { @@ -147,7 +148,7 @@ class SessionComponent extends CakeSession { * * In your controller: $this->Session->delete('Controller.sessKey'); * - * @param string $name + * @param string $name the name of the session key you want to delete * @return bool, true is session variable is set and can be deleted, false is variable was not set. * @access public */ @@ -162,7 +163,7 @@ class SessionComponent extends CakeSession { * * In your controller: $this->Session->check('Controller.sessKey'); * - * @param string $name + * @param string $name the name of the session key you want to check * @return boolean true is session variable is set, false if not * @access public */ @@ -208,6 +209,7 @@ class SessionComponent extends CakeSession { * Used to renew a session id * * In your controller: $this->Session->renew(); + * * @access public */ function renew() { @@ -232,7 +234,8 @@ class SessionComponent extends CakeSession { /** * Used to destroy sessions * - * In your controller:. $this->Session->destroy(); + * In your controller: $this->Session->destroy(); + * * @access public */ function destroy() {