Skip to content
Browse files

[ci skip] DocBlocks for Upload and Xmlrpc libraries

Partially fixes issue #1295
  • Loading branch information...
1 parent 0fa95bd commit f5ccd12b395a6d01c8ba1890f3639b753a345379 @narfbg narfbg committed Nov 2, 2012
Showing with 532 additions and 71 deletions.
  1. +203 −31 system/libraries/Upload.php
  2. +329 −40 system/libraries/Xmlrpc.php
View
234 system/libraries/Upload.php
@@ -37,40 +37,210 @@
*/
class CI_Upload {
+ /**
+ * Maximum file size
+ *
+ * @var int
+ */
public $max_size = 0;
+
+ /**
+ * Maximum image width
+ *
+ * @var int
+ */
public $max_width = 0;
+
+ /**
+ * Maximum image height
+ *
+ * @var int
+ */
public $max_height = 0;
+
+ /**
+ * Maximum filename length
+ *
+ * @var int
+ */
public $max_filename = 0;
+
+ /**
+ * Maximum duplicate filename increment ID
+ *
+ * @var int
+ */
public $max_filename_increment = 100;
+
+ /**
+ * Allowed file types
+ *
+ * @var string
+ */
public $allowed_types = '';
+
+ /**
+ * Temporary filename
+ *
+ * @var string
+ */
public $file_temp = '';
+
+ /**
+ * Filename
+ *
+ * @var string
+ */
public $file_name = '';
+
+ /**
+ * Original filename
+ *
+ * @var string
+ */
public $orig_name = '';
+
+ /**
+ * File type
+ *
+ * @var string
+ */
public $file_type = '';
- public $file_size = '';
+
+ /**
+ * File size
+ *
+ * @var int
+ */
+ public $file_size = NULL;
+
+ /**
+ * Filename extension
+ *
+ * @var string
+ */
public $file_ext = '';
+
+ /**
+ * Upload path
+ *
+ * @var string
+ */
public $upload_path = '';
+
+ /**
+ * Overwrite flag
+ *
+ * @var bool
+ */
public $overwrite = FALSE;
+
+ /**
+ * Obfuscate filename flag
+ *
+ * @var bool
+ */
public $encrypt_name = FALSE;
+
+ /**
+ * Is image flag
+ *
+ * @var bool
+ */
public $is_image = FALSE;
- public $image_width = '';
- public $image_height = '';
+
+ /**
+ * Image width
+ *
+ * @var int
+ */
+ public $image_width = NULL;
+
+ /**
+ * Image height
+ *
+ * @var int
+ */
+ public $image_height = NULL;
+
+ /**
+ * Image type
+ *
+ * @var string
+ */
public $image_type = '';
+
+ /**
+ * Image size string
+ *
+ * @var string
+ */
public $image_size_str = '';
+
+ /**
+ * Error messages list
+ *
+ * @var array
+ */
public $error_msg = array();
+
+ /**
+ * MIME types list
+ *
+ * @var array
+ */
public $mimes = array();
+
+ /**
+ * Remove spaces flag
+ *
+ * @var bool
+ */
public $remove_spaces = TRUE;
+
+ /**
+ * MIME detection flag
+ *
+ * @var bool
+ */
public $detect_mime = TRUE;
+
+ /**
+ * XSS filter flag
+ *
+ * @var bool
+ */
public $xss_clean = FALSE;
+
+ /**
+ * Temporary filename prefix
+ *
+ * @var string
+ */
public $temp_prefix = 'temp_file_';
+
+ /**
+ * Filename sent by the client
+ *
+ * @var bool
+ */
public $client_name = '';
+ // --------------------------------------------------------------------
+
+ /**
+ * Filename override
+ *
+ * @var string
+ */
protected $_file_name_override = '';
+ // --------------------------------------------------------------------
+
/**
* Constructor
*
- * @param array
+ * @param array $props
* @return void
*/
public function __construct($props = array())
@@ -90,7 +260,7 @@ public function __construct($props = array())
/**
* Initialize preferences
*
- * @param array
+ * @param array $config
* @return void
*/
public function initialize($config = array())
@@ -106,14 +276,14 @@ public function initialize($config = array())
'file_name' => '',
'orig_name' => '',
'file_type' => '',
- 'file_size' => '',
+ 'file_size' => NULL,
'file_ext' => '',
'upload_path' => '',
'overwrite' => FALSE,
'encrypt_name' => FALSE,
'is_image' => FALSE,
- 'image_width' => '',
- 'image_height' => '',
+ 'image_width' => NULL,
+ 'image_height' => NULL,
'image_type' => '',
'image_size_str' => '',
'error_msg' => array(),
@@ -155,7 +325,7 @@ public function initialize($config = array())
/**
* Perform the file upload
*
- * @param string $field = 'userfile'
+ * @param string $field
* @return bool
*/
public function do_upload($field = 'userfile')
@@ -357,7 +527,7 @@ public function do_upload($field = 'userfile')
* Returns an associative array containing all of the information
* related to the upload, allowing the developer easy access in one array.
*
- * @param string
+ * @param string $index
* @return mixed
*/
public function data($index = NULL)
@@ -392,7 +562,7 @@ public function data($index = NULL)
/**
* Set Upload Path
*
- * @param string
+ * @param string $path
* @return void
*/
public function set_upload_path($path)
@@ -410,8 +580,8 @@ public function set_upload_path($path)
* existence of a file with the same name. If found, it will append a
* number to the end of the filename to avoid overwriting a pre-existing file.
*
- * @param string
- * @param string
+ * @param string $path
+ * @param string $filename
* @return string
*/
public function set_filename($path, $filename)
@@ -455,7 +625,7 @@ public function set_filename($path, $filename)
/**
* Set Maximum File Size
*
- * @param int
+ * @param int $n
* @return void
*/
public function set_max_filesize($n)
@@ -468,7 +638,7 @@ public function set_max_filesize($n)
/**
* Set Maximum File Name Length
*
- * @param int
+ * @param int $n
* @return void
*/
public function set_max_filename($n)
@@ -481,7 +651,7 @@ public function set_max_filename($n)
/**
* Set Maximum Image Width
*
- * @param int
+ * @param int $n
* @return void
*/
public function set_max_width($n)
@@ -494,7 +664,7 @@ public function set_max_width($n)
/**
* Set Maximum Image Height
*
- * @param int
+ * @param int $n
* @return void
*/
public function set_max_height($n)
@@ -507,7 +677,7 @@ public function set_max_height($n)
/**
* Set Allowed File Types
*
- * @param string
+ * @param string $types
* @return void
*/
public function set_allowed_types($types)
@@ -527,7 +697,7 @@ public function set_allowed_types($types)
*
* Uses GD to determine the width/height/type of image
*
- * @param string
+ * @param string $path
* @return void
*/
public function set_image_properties($path = '')
@@ -559,7 +729,7 @@ public function set_image_properties($path = '')
* Enables the XSS flag so that the file that was uploaded
* will be run through the XSS filter.
*
- * @param bool
+ * @param bool $flag
* @return void
*/
public function set_xss_clean($flag = FALSE)
@@ -601,7 +771,7 @@ public function is_image()
/**
* Verify that the filetype is allowed
*
- * @param bool
+ * @param bool $ignore_mime
* @return bool
*/
public function is_allowed_filetype($ignore_mime = FALSE)
@@ -738,7 +908,7 @@ public function validate_upload_path()
/**
* Extract the file extension
*
- * @param string
+ * @param string $filename
* @return string
*/
public function get_extension($filename)
@@ -752,7 +922,7 @@ public function get_extension($filename)
/**
* Clean the file name for security
*
- * @param string
+ * @param string $filename
* @return string
*/
public function clean_file_name($filename)
@@ -886,7 +1056,7 @@ public function do_xss_clean()
/**
* Set an error message
*
- * @param string
+ * @param string $msg
* @return void
*/
public function set_error($msg)
@@ -916,8 +1086,8 @@ public function set_error($msg)
/**
* Display the error message
*
- * @param string
- * @param string
+ * @param string $open
+ * @param string $close
* @return string
*/
public function display_errors($open = '<p>', $close = '</p>')
@@ -933,7 +1103,7 @@ public function display_errors($open = '<p>', $close = '</p>')
* This is a list of mime types. We use it to validate
* the "allowed types" set by the developer
*
- * @param string
+ * @param string $mime
* @return string
*/
public function mimes_types($mime)
@@ -946,10 +1116,12 @@ public function mimes_types($mime)
/**
* Prep Filename
*
- * Prevents possible script execution from Apache's handling of files multiple extensions
- * http://httpd.apache.org/docs/1.3/mod/mod_mime.html#multipleext
+ * Prevents possible script execution from Apache's handling
+ * of files' multiple extensions.
+ *
+ * @link http://httpd.apache.org/docs/1.3/mod/mod_mime.html#multipleext
*
- * @param string
+ * @param string $filename
* @return string
*/
protected function _prep_filename($filename)
@@ -986,7 +1158,7 @@ protected function _prep_filename($filename)
* Detects the (actual) MIME type of the uploaded file, if possible.
* The input array is expected to be $_FILES[$field]
*
- * @param array
+ * @param array $file
* @return void
*/
protected function _file_mime_type($file)
View
369 system/libraries/Xmlrpc.php
@@ -26,6 +26,13 @@
*/
defined('BASEPATH') OR exit('No direct script access allowed');
+if ( ! function_exists('xml_parser_create'))
+{
+ show_error('Your PHP installation does not support XML');
+}
+
+// ------------------------------------------------------------------------
+
/**
* XML-RPC request handler class
*
@@ -35,56 +42,212 @@
* @author EllisLab Dev Team
* @link http://codeigniter.com/user_guide/libraries/xmlrpc.html
*/
-
-if ( ! function_exists('xml_parser_create'))
-{
- show_error('Your PHP installation does not support XML');
-}
-
-// ------------------------------------------------------------------------
-
class CI_Xmlrpc {
- public $debug = FALSE; // Debugging on or off
+ /**
+ * Debug flag
+ *
+ * @var bool
+ */
+ public $debug = FALSE;
+
+ /**
+ * I4 data type
+ *
+ * @var string
+ */
public $xmlrpcI4 = 'i4';
+
+ /**
+ * Integer data type
+ *
+ * @var string
+ */
public $xmlrpcInt = 'int';
+
+ /**
+ * Boolean data type
+ *
+ * @var string
+ */
public $xmlrpcBoolean = 'boolean';
+
+ /**
+ * Double data type
+ *
+ * @var string
+ */
public $xmlrpcDouble = 'double';
+
+ /**
+ * String data type
+ *
+ * @var string
+ */
public $xmlrpcString = 'string';
+
+ /**
+ * DateTime format
+ *
+ * @var string
+ */
public $xmlrpcDateTime = 'dateTime.iso8601';
+
+ /**
+ * Base64 data type
+ *
+ * @var string
+ */
public $xmlrpcBase64 = 'base64';
+
+ /**
+ * Array data type
+ *
+ * @var string
+ */
public $xmlrpcArray = 'array';
+
+ /**
+ * Struct data type
+ *
+ * @var string
+ */
public $xmlrpcStruct = 'struct';
+ /**
+ * Data types list
+ *
+ * @var array
+ */
public $xmlrpcTypes = array();
+
+ /**
+ * Valid parents list
+ *
+ * @var array
+ */
public $valid_parents = array();
- public $xmlrpcerr = array(); // Response numbers
- public $xmlrpcstr = array(); // Response strings
+ /**
+ * Response error numbers list
+ *
+ * @var array
+ */
+ public $xmlrpcerr = array();
+
+ /**
+ * Response error messages list
+ *
+ * @var string[]
+ */
+ public $xmlrpcstr = array();
+
+ /**
+ * Encoding charset
+ *
+ * @var string
+ */
public $xmlrpc_defencoding = 'UTF-8';
+
+ /**
+ * XML-RPC client name
+ *
+ * @var string
+ */
public $xmlrpcName = 'XML-RPC for CodeIgniter';
+
+ /**
+ * XML-RPC version
+ *
+ * @var string
+ */
public $xmlrpcVersion = '1.1';
- public $xmlrpcerruser = 800; // Start of user errors
- public $xmlrpcerrxml = 100; // Start of XML Parse errors
- public $xmlrpc_backslash = ''; // formulate backslashes for escaping regexp
+ /**
+ * Start of user errors
+ *
+ * @var int
+ */
+ public $xmlrpcerruser = 800;
+
+ /**
+ * Start of XML parse errors
+ *
+ * @var int
+ */
+ public $xmlrpcerrxml = 100;
+
+ /**
+ * Backslash replacement value
+ *
+ * @var string
+ */
+ public $xmlrpc_backslash = '';
+
+ /**
+ * XML-RPC Client object
+ *
+ * @var object
+ */
public $client;
+
+ /**
+ * XML-RPC Method name
+ *
+ * @var string
+ */
public $method;
+
+ /**
+ * XML-RPC Data
+ *
+ * @var array
+ */
public $data;
+
+ /**
+ * XML-RPC Message
+ *
+ * @var string
+ */
public $message = '';
- public $error = ''; // Error string for request
+
+ /**
+ * Request error message
+ *
+ * @var string
+ */
+ public $error = '';
+
+ /**
+ * XML-RPC result object
+ *
+ * @var object
+ */
public $result;
+
+ /**
+ * XML-RPC Reponse
+ *
+ * @var array
+ */
public $response = array(); // Response from remote server
+ /**
+ * XSS Filter flag
+ *
+ * @var bool
+ */
public $xss_clean = TRUE;
+ // --------------------------------------------------------------------
/**
* Constructor
*
* Initializes property default values
*
- * @param array
+ * @param array $config
* @return void
*/
public function __construct($config = array())
@@ -149,7 +312,7 @@ public function __construct($config = array())
/**
* Initialize
*
- * @param array
+ * @param array $config
* @return void
*/
public function initialize($config = array())
@@ -172,9 +335,9 @@ public function initialize($config = array())
* Parse server URL
*
* @param string $url
- * @param int $port = 80
- * @param string $proxy = FALSE
- * @param int $proxy_port = 8080
+ * @param int $port
+ * @param string $proxy
+ * @param int $proxy_port
* @return void
*/
public function server($url, $port = 80, $proxy = FALSE, $proxy_port = 8080)
@@ -201,7 +364,7 @@ public function server($url, $port = 80, $proxy = FALSE, $proxy_port = 8080)
/**
* Set Timeout
*
- * @param int seconds
+ * @param int $seconds
* @return void
*/
public function timeout($seconds = 5)
@@ -217,7 +380,7 @@ public function timeout($seconds = 5)
/**
* Set Methods
*
- * @param string method name
+ * @param string $function Method name
* @return void
*/
public function method($function)
@@ -230,7 +393,7 @@ public function method($function)
/**
* Take Array of Data and Create Objects
*
- * @param array
+ * @param array $incoming
* @return void
*/
public function request($incoming)
@@ -254,7 +417,7 @@ public function request($incoming)
/**
* Set Debug
*
- * @param bool
+ * @param bool $flag
* @return void
*/
public function set_debug($flag = TRUE)
@@ -267,7 +430,7 @@ public function set_debug($flag = TRUE)
/**
* Values Parsing
*
- * @param mixed
+ * @param mixed $value
* @return object
*/
public function values_parsing($value)
@@ -350,8 +513,8 @@ public function display_response()
/**
* Sends an Error Message for Server Request
*
- * @param int
- * @param string
+ * @param int $number
+ * @param string $message
* @return object
*/
public function send_error_message($number, $message)
@@ -364,7 +527,7 @@ public function send_error_message($number, $message)
/**
* Send Response for Server Request
*
- * @param array
+ * @param array $response
* @return object
*/
public function send_response($response)
@@ -385,24 +548,79 @@ public function send_response($response)
*/
class XML_RPC_Client extends CI_Xmlrpc
{
+ /**
+ * Path
+ *
+ * @var string
+ */
public $path = '';
+
+ /**
+ * Server hostname
+ *
+ * @var string
+ */
public $server = '';
+
+ /**
+ * Server port
+ *
+ * @var int
+ */
public $port = 80;
+
+ /**
+ * Proxy hostname
+ *
+ * @var string
+ */
public $proxy = FALSE;
+
+ /**
+ * Proxy port
+ *
+ * @var int
+ */
public $proxy_port = 8080;
+
+ /**
+ * Error number
+ *
+ * @var string
+ */
public $errno = '';
+
+ /**
+ * Error message
+ *
+ * @var string
+ */
public $errstring = '';
+
+ /**
+ * Timeout in seconds
+ *
+ * @var int
+ */
public $timeout = 5;
+
+ /**
+ * No Multicall flag
+ *
+ * @var bool
+ */
public $no_multicall = FALSE;
+ // --------------------------------------------------------------------
+
/**
* Constructor
*
* @param string $path
* @param object $server
- * @param int $port = 80
- * @param string $proxy = FALSE
- * @param int $proxy_port = 8080
+ * @param int $port
+ * @param string $proxy
+ * @param int $proxy_port
* @return void
*/
public function __construct($path, $server, $port = 80, $proxy = FALSE, $proxy_port = 8080)
@@ -421,7 +639,7 @@ public function __construct($path, $server, $port = 80, $proxy = FALSE, $proxy_p
/**
* Send message
*
- * @param mixed
+ * @param mixed $msg
* @return object
*/
public function send($msg)
@@ -440,7 +658,7 @@ public function send($msg)
/**
* Send payload
*
- * @param object
+ * @param object $msg
* @return object
*/
public function sendPayload($msg)
@@ -500,18 +718,50 @@ public function sendPayload($msg)
*/
class XML_RPC_Response
{
+
+ /**
+ * Value
+ *
+ * @var mixed
+ */
public $val = 0;
+
+ /**
+ * Error number
+ *
+ * @var int
+ */
public $errno = 0;
+
+ /**
+ * Error message
+ *
+ * @var string
+ */
public $errstr = '';
+
+ /**
+ * Headers list
+ *
+ * @var array
+ */
public $headers = array();
+
+ /**
+ * XSS Filter flag
+ *
+ * @var bool
+ */
public $xss_clean = TRUE;
+ // --------------------------------------------------------------------
+
/**
* Constructor
*
- * @param mixed
- * @param int
- * @param string
+ * @param mixed $val
+ * @param int $code
+ * @param string $fstr
* @return void
*/
public function __construct($val, $code = 0, $fstr = '')
@@ -717,16 +967,42 @@ public function iso8601_decode($time, $utc = FALSE)
*/
class XML_RPC_Message extends CI_Xmlrpc
{
+
+ /**
+ * Payload
+ *
+ * @var string
+ */
public $payload;
+
+ /**
+ * Method name
+ *
+ * @var string
+ */
public $method_name;
+
+ /**
+ * Parameter list
+ *
+ * @var array
+ */
public $params = array();
+
+ /**
+ * XH?
+ *
+ * @var array
+ */
public $xh = array();
+ // --------------------------------------------------------------------
+
/**
* Constructor
*
- * @param string method name
- * @param array
+ * @param string $method
+ * @param array $pars
* @return void
*/
public function __construct($method, $pars = FALSE)
@@ -1304,14 +1580,27 @@ public function decode_message($param)
*/
class XML_RPC_Values extends CI_Xmlrpc
{
+ /**
+ * Value data
+ *
+ * @var array
+ */
public $me = array();
+
+ /**
+ * Value type
+ *
+ * @var int
+ */
public $mytype = 0;
+ // --------------------------------------------------------------------
+
/**
* Constructor
*
- * @param mixed
- * @param string
+ * @param mixed $val
+ * @param string $type
* @return void
*/
public function __construct($val = -1, $type = '')

0 comments on commit f5ccd12

Please sign in to comment.
Something went wrong with that request. Please try again.