Version 3.3.4
This commit is contained in:
1 parent
78706903a2
commit
fb6b5baabc
2206 files changed
+409828
-382984
No files matched your search
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.3.4
|
||||
* Mobile app methods
|
||||
* Last Updated: $LastChangedDate: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/company/standards.php#license
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 14th May 2003
|
||||
* @version $Rev: 10914 $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author Matt Mecham
|
||||
* @since Wednesday 9th May 2012
|
||||
* @package IP.Board
|
||||
*/
|
||||
class ipsMobileApp
|
||||
{
|
||||
/* Never convert these fields */
|
||||
static public $noConvertFields = array( 'ips_username', 'ips_password' );
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @access private
|
||||
* @return @e void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->convertIncoming();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize ipsRegistry and this class
|
||||
*
|
||||
* @access protected
|
||||
* @return @e void
|
||||
*/
|
||||
protected function convertIncoming()
|
||||
{
|
||||
# GET first
|
||||
$input = $this->_recurse( $_GET, array() );
|
||||
|
||||
# Then overwrite with POST
|
||||
ipsRegistry::$request = $this->_recurse( $_POST, $input );
|
||||
|
||||
/* Reset $_GET and $_POST */
|
||||
array_walk_recursive( $_POST, create_function( '&$value, $key', '$value = ipsMobileApp::convert($key, $value);' ) );
|
||||
array_walk_recursive( $_GET , create_function( '&$value, $key', '$value = ipsMobileApp::convert($key, $value);' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively parse stuff
|
||||
*/
|
||||
private function _recurse( &$data, $input=array(), $iteration=0 )
|
||||
{
|
||||
if ( $iteration >= 20 )
|
||||
{
|
||||
return $input;
|
||||
}
|
||||
|
||||
if ( is_array( $data ) )
|
||||
{
|
||||
foreach( $data as $k => $v )
|
||||
{
|
||||
if ( is_array( $v ) )
|
||||
{
|
||||
$input[ $k ] = $this->_recurse( $data[ $k ], array(), $iteration + 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
$v = self::convert( $k, $v );
|
||||
|
||||
$input[ $k ] = IPSText::parseCleanValue( $v, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $input;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the content
|
||||
*/
|
||||
public static function convert( $k, $v )
|
||||
{
|
||||
return ( is_string( $v ) && ( ! in_array( $k, self::$noConvertFields ) ) ) ? IPSText::convertCharsets( $v, 'UTF-8', IPS_DOC_CHAR_SET ) : $v;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user