Version 3.3.4

This commit is contained in:
Neo committed 2025-12-19 00:35:52 -08:00
1 parent 78706903a2
commit fb6b5baabc
2206 files changed
+409828 -382984

No files matched your search

+299 -150
View File
@@ -2,21 +2,21 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.2.3
* IP.Board v3.3.4
* Static Classes for IP.Board 3
*
* These classes are not required as objects. We have grouped
* together several singletons to prevent multiple file loads
* Last Updated: $Date: 2011-10-06 23:44:10 -0400 (Thu, 06 Oct 2011) $
* Last Updated: $Date: 2012-07-04 13:32:40 -0400 (Wed, 04 Jul 2012) $
* </pre>
*
* @author $Author: bfarber $
* @author $Author: AndyMillne $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license This is NULLED!
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @link http://hatynka.in
* @link http://www.invisionpower.com
* @since 12th March 2002
* @version $Revision: 9587 $
* @version $Revision: 11032 $
*
* @author Matt
*/
@@ -28,7 +28,6 @@ $_ipsPowerSettings = array( 'status_sidebar_show_x' => 5,
'ipb_disable_group_psformat' => 0,
'tags_max_truncated_len' => 35,
'max_bbcodes_per_post' => 500,
'topic_marking_keep_days' => 31,
'postpage_contents' => '5,10,15,20,25,30,35,40',
'topicpage_contents' => '5,10,15,20,25,30,35,40',
'member_photo_crop' => 100,
@@ -36,6 +35,8 @@ $_ipsPowerSettings = array( 'status_sidebar_show_x' => 5,
'like_notifications_limit' => 1000,
'actidx_override' => 0,
'signature_line_length' => 200,
'show_x_page_link' => 2,
'post_order_column' => 'pid', // Other valid values: 'post_date'
);
class IPSAdCodeDefault
@@ -566,7 +567,6 @@ class IPSBWOptions
$array[ $key ] = 1;
}
else
{
$array[ $key ] = 0;
}
@@ -629,10 +629,10 @@ class IPSBWOptions
{
/* INIT */
$int = 0;
/* Generate bitwise array */
$bitArray = self::_getBitWiseArray( $type, $app );
if ( ! $bitArray OR ! count( $bitArray ) )
{
return 0;
@@ -662,7 +662,7 @@ class IPSBWOptions
{
$bitArray = array();
$allOptions = ipsRegistry::fetchBitWiseOptions( $app );
if ( is_array( $allOptions ) )
{
if ( isset( $allOptions[ $type ] ) AND is_array( $allOptions[ $type ] ) )
@@ -1309,18 +1309,7 @@ class IPSLib
return false;
}
/**
* Quickly determines if we've got VK enabled and set up
*
* @access public
* @return boolean
*/
static public function vkontakte_enabled()
{
return ( ipsRegistry::$settings['vk_enabled'] AND ipsRegistry::$settings['vk_api_id'] AND ipsRegistry::$settings['vk_secret'] ) ? TRUE : FALSE;
}
/**
* Central setlocale method so we can adjust as needed
*
@@ -1392,9 +1381,6 @@ class IPSLib
switch( $method )
{
case 'vkontakte':
return self::vkontakte_enabled();
break;
case 'facebook':
return self::fbc_enabled();
break;
@@ -1513,32 +1499,118 @@ class IPSLib
*
* @param array array('conf_key' => 'new value')
* @return true/false
* @author MarkWade
*/
static public function updateSettings($update=array())
{
$fields = array_keys($update);
static public function updateSettings( $update=array(), $parseEditorValues=FALSE )
{
//-----------------------------------------
// Load the settings we need to update
//-----------------------------------------
$fields = array_keys( $update );
ipsRegistry::DB()->build( array( 'select' => '*', 'from' => 'core_sys_conf_settings', 'where' => "conf_key IN ('" . implode( "','", $fields ) . "')" ) );
ipsRegistry::DB()->execute();
$db_fields = array();
while ( $r = ipsRegistry::DB()->fetch() )
{
$db_fields[ $r['conf_key'] ] = $r;
}
if (empty($db_fields))
if ( empty( $db_fields ) )
{
return false;
}
/* We have to examine $_POST as the custom PHP for some settings
still sets that rather than $value */
$oldPostData = $_POST;
//-----------------------------------------
// Update values
//-----------------------------------------
foreach( $db_fields as $key => $data )
{
$value = str_replace( "&#39;", "'", IPSText::safeslashes($update[ $key ]) );
$value = $value == '' ? "{blank}" : $value;
$value = null;
/* Init */
if ( !is_array( $update[ $key ] ) )
{
if ( $update[ $key ] != $data['conf_default'] )
{
$value = str_replace( "&#39;", "'", IPSText::stripslashes( $update[ $key ] ) );
$value = $value == '' ? "{blank}" : $value;
}
else
{
$value = $data['conf_default'];
}
}
/* Evaluate PHP */
if ( $data['conf_evalphp'] )
{
$data['conf_evalphp'] = str_replace( '&#092;', '\\', $data['conf_evalphp'] );
$save = 1;
ipsRegistry::DB()->update( 'core_sys_conf_settings', array( 'conf_value' => $value ), 'conf_id=' . $data['conf_id'] );
$data['conf_evalphp'] = str_replace( '$this->registry', 'ipsRegistry::instance()', $data['conf_evalphp'] );
$data['conf_evalphp'] = str_replace( '$this->cache', 'ipsRegistry::cache()', $data['conf_evalphp'] );
$data['conf_evalphp'] = str_replace( '$this->DB', 'ipsRegistry::DB()', $data['conf_evalphp'] );
$data['conf_evalphp'] = str_replace( '$this->settings', 'ipsRegistry::$settings', $data['conf_evalphp'] );
$data['conf_evalphp'] = str_replace( '$this->lang', 'ipsRegistry::getClass(\'class_localization\')', $data['conf_evalphp'] );
eval( $data['conf_evalphp'] );
if ( $_POST[ $key ] !== $oldPostData[ $key ] )
{
$value = $_POST[ $key ];
}
/* Was value set? */
if ( $value === null )
{
$value = str_replace( "&#39;", "'", IPSText::stripslashes( $update[ $key ] ) );
$value = $value == '' ? "{blank}" : $value;
}
}
/* Parse */
if ( $parseEditorValues and $data['conf_type'] == 'editor' )
{
IPSText::getTextClass('bbcode')->bypass_badwords = 1;
IPSText::getTextClass('bbcode')->parse_smilies = 1;
IPSText::getTextClass('bbcode')->parse_html = 1;
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
IPSText::getTextClass('bbcode')->parse_nl2br = 1;
if( trim($value) == '<br>' OR trim($value) == '<br />' )
{
$value = '';
}
else
{
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/editor/composite.php', 'classes_editor_composite' );
$editor = new $classToLoad();
$value = $editor->process( $value );
}
}
/* Strip new lines */
$value = str_replace( "\r", "", $value );
/* Save */
if ( $value != $data['conf_default'] )
{
ipsRegistry::DB()->update( 'core_sys_conf_settings', array( 'conf_value' => $value ), 'conf_id=' . $data['conf_id'] );
}
else if( ( isset( $update[ $key ] ) && $update[ $key ] == '' ) || ( $update[ $key ] == $data['conf_default'] ) || $data['conf_value'] != '' )
{
ipsRegistry::DB()->update( 'core_sys_conf_settings', array( 'conf_value' => '' ), 'conf_id=' . $data['conf_id'] );
}
}
//-----------------------------------------
// Recache
//-----------------------------------------
ipsRegistry::DB()->build( array( 'select' => '*', 'from' => 'core_sys_conf_settings', 'where' => 'conf_add_cache=1' ) );
$info = ipsRegistry::DB()->execute();
@@ -1557,6 +1629,10 @@ class IPSLib
ipsRegistry::cache()->setCache( 'settings', $settings, array( 'array' => 1 ) );
//-----------------------------------------
// Return
//-----------------------------------------
return true;
}
@@ -1769,22 +1845,14 @@ EOF;
}
}
// FURL Pack select
$furl_templates_filename = 'furlTemplates.php';
if ( IPB_USE_ONLY_ID_FURL )
{
$furl_templates_filename = 'furlIdTemplates.php';
}
/* Loop over the applications and build */
foreach( $apps as $path => $app_dir )
{
if ( is_file( IPS_ROOT_PATH . $path . '/extensions/' . $furl_templates_filename ) )
if ( is_file( IPS_ROOT_PATH . $path . '/extensions/furlTemplates.php' ) )
{
$_SEOTEMPLATES = array();
require( IPS_ROOT_PATH . $path . '/extensions/' . $furl_templates_filename );/*noLibHook*/
require( IPS_ROOT_PATH . $path . '/extensions/furlTemplates.php' );/*noLibHook*/
if ( is_array( $_SEOTEMPLATES ) && count( $_SEOTEMPLATES ) )
{
@@ -2031,7 +2099,7 @@ EOF;
$bbcodes = array();
$currentBbcodes = ipsRegistry::cache()->getCache('bbcode');
$protectedBbcodes = array('right', 'left', 'center', 'b', 'i', 'u', 'url', 'img', 'quote', 'indent', 'snapback',
'list', 'strike', 'sub', 'sup', 'email', 'background', 'color', 'size', 'font'
'list', 'strike', 'sub', 'sup', 'email', 'color', 'size', 'font'
);
/* Remove protected bbcodes */
@@ -2359,9 +2427,10 @@ EOF;
* Get the application title. Uses lang file keys if present.
*
* @param string application
* @param bool Force public title
* @return string Text to show for application title
*/
static public function getAppTitle( $app )
static public function getAppTitle( $app, $forcePublic=false )
{
if ( ! $app )
{
@@ -2370,7 +2439,7 @@ EOF;
return isset( ipsRegistry::getClass('class_localization')->words[ $app . '_display_title' ] ) ?
ipsRegistry::getClass('class_localization')->words[ $app . '_display_title' ] :
( IN_ACP ? ipsRegistry::$applications[ $app ]['app_title'] : ipsRegistry::$applications[ $app ]['app_public_title'] );
( ( IN_ACP AND !$forcePublic ) ? ipsRegistry::$applications[ $app ]['app_title'] : ipsRegistry::$applications[ $app ]['app_public_title'] );
}
/**
@@ -2524,6 +2593,9 @@ EOF;
case 'vncwithunreadcontent':
$_ck = 'can_vnc_unread_content';
break;
case 'tags':
$_ck = 'can_searchTags';
break;
}
/* got anything? */
@@ -2652,7 +2724,7 @@ EOF;
* @param array Array of extensions an application must have to be returned
* @return Array
*/
static public function getEnabledApplications( $extensions=array() )
static public function getEnabledApplications( $extensions=array(), $forceNotFromCache=FALSE )
{
$apps = array();
$extensions = is_string( $extensions ) ? array( $extensions ) : ( is_array( $extensions ) ? $extensions : array() );
@@ -2660,7 +2732,7 @@ EOF;
static $cache = array();
$_key = md5( implode( ',', $extensions ) );
if( $cache[ $_key ] )
if( $cache[ $_key ] and !$forceNotFromCache )
{
return $cache[ $_key ];
}
@@ -3153,11 +3225,12 @@ EOF;
*/
static public function shareLinks( $title='', $params=array() )
{
$url = ( isset( $params['url'] ) ) ? $params['url'] : '';
$cssClass = ( isset( $params['cssClass'] ) ) ? $params['cssClass'] : 'topic_share left';
$group = ( isset( $params['group'] ) ) ? $params['group'] : 'global';
$bit = ( isset( $params['bit'] ) ) ? $params['bit'] : 'shareLinks';
$skip = ( isset( $params['skip'] ) ) ? $params['skip'] : array();
$url = isset( $params['url'] ) ? $params['url'] : '';
$cssClass = isset( $params['cssClass'] ) ? $params['cssClass'] : 'topic_share left';
$group = isset( $params['group'] ) ? $params['group'] : 'global';
$bit = isset( $params['bit'] ) ? $params['bit'] : 'shareLinks';
$skip = isset( $params['skip'] ) ? $params['skip'] : array();
$override = isset( $params['overrideApp'] ) ? $params['overrideApp'] : '';
/* Disabled? */
if ( ! ipsRegistry::$settings['sl_enable'] )
@@ -3173,6 +3246,7 @@ EOF;
$canon = ipsRegistry::getClass('output')->fetchRootDocUrl();
$url = ( $url ) ? $url : ipsRegistry::$settings['this_url'];
$raw = $url;
$canon = IPSText::base64_encode_urlSafe( ( $canon ) ? $canon : $url );
$title = IPSText::base64_encode_urlSafe( $title );
$url = IPSText::base64_encode_urlSafe( $url );
@@ -3194,7 +3268,9 @@ EOF;
}
else
{
$cache[ $key ]['_url'] = ( $data['share_canonical'] ) ? $canon : $url;
$cache[ $key ]['_rawUrl'] = $raw;
$cache[ $key ]['overrideApp'] = $override;
$cache[ $key ]['_url'] = $data['share_canonical'] ? $canon : $url;
}
}
@@ -3286,28 +3362,21 @@ EOF;
/**
* Has an active license or not
* @param boolean Allow perpetual license to count.
* @return boolean
* @return true
*/
static public function hasActiveLicense( $allowPerpetual=true )
{
//return true;
$licenseData = ipsRegistry::cache()->getCache( 'licenseData' );
if ( ( ! $licenseData OR ! $licenseData['key']['_expires'] OR $licenseData['key']['_expires'] < IPS_UNIX_TIME_NOW OR $licenseData['key']['_expires'] == 9999999999 ) )
{
return false;
}
if ( $allowPerpetual !== true )
{
if ( stristr( $licenseData['name'], 'perpetual' ) )
{
return false;
}
}
return true;
}
/**
* Is the archive DB on another server?
* @return boolean
*/
static public function isUsingRemoteArchiveDB()
{
return ( ipsRegistry::$settings['archive_remote_sql_database'] && ipsRegistry::$settings['archive_remote_sql_user'] ) ? true : false;
}
}
/**
@@ -3479,19 +3548,19 @@ class IPSDebug
$errfile = str_replace( @getcwd(), "", $errfile );
$log = false;
$message = "> [$errno] $errstr\n> > Строка: $errline\n> > Файл: $errfile";
$message = "> [$errno] $errstr\n> > Line: $errline\n> > File: $errfile";
/* What do we have? */
switch ($errno)
{
case E_ERROR:
$log = true;
echo "<b>Ошибка</b> [$errno] $errstr (Строка: $errline в $errfile)<br />\n";
echo "<b>IPB ERROR</b> [$errno] $errstr (Line: $errline of $errfile)<br />\n";
exit(1);
break;
case E_WARNING:
$log = true;
echo "<b>Предупреждение</b> [$errno] $errstr (Строка: $errline в $errfile)<br />\n";
echo "<b>IPB WARNING</b> [$errno] $errstr (Line: $errline of $errfile)<br />\n";
break;
case E_NOTICE:
$log = true;
@@ -3615,7 +3684,7 @@ class IPSDebug
{
if ( $lineNumber )
{
print "<h4>Ошибка в шаблоне: <a href='#line{$lineNumber}'>" . $lineNumber . "</a></h4>";
print "<h4>Parse Error on line: <a href='#line{$lineNumber}'>" . $lineNumber . "</a></h4>";
}
else
{
@@ -3791,7 +3860,7 @@ class IPSDebug
| Can also be obtained from COM, but it's extremely slow...
---------------------------------------------------------------*/
$serverstats = @shell_exec('typeperf \"Processor(_Total)\% Processor Time\" -sc 1');
$serverstats = @shell_exec('typeperf "Processor(_Total)\% Processor Time" -sc 1');
if( $serverstats )
{
@@ -4100,6 +4169,21 @@ class IPSText
}
}
static public function jsonEncodeForTemplate( $data )
{
/* Using UTF-8 - it's an easy thing */
if ( IPS_DOC_CHAR_SET == 'UTF-8' )
{
return json_encode( $data );
}
/* convert */
array_walk_recursive( $data, array( 'IPSText', 'arrayWalkCallbackConvert' ) );
$jsonEncoded = json_encode( $data );
return IPSText::convertCharsets( $jsonEncoded, "UTF-8", IPS_DOC_CHAR_SET );
}
/**
* Get helper classes
* Used here to allow classes to be loaded and used as-and-when they're needed
@@ -4150,55 +4234,27 @@ class IPSText
*
* Mostly used to ensure that data designed for UTF-8 XML files is actually stored as UTF-8 from
* 'flat' files that may not be saved as UTF-8.
* Most likely this will have to be expanded to support different char sets eventually.
*
* @param string Data in
* @return string Data out
*/
static public function encodeForXml( $string )
{
if ( strtolower( IPS_DOC_CHAR_SET ) != 'utf-8' )
if ( function_exists( 'mb_detect_encoding' ) )
{
$encoding = mb_detect_encoding( $string );
if ( $encoding != 'UTF-8' )
{
$string = IPSText::convertCharsets( $string, $encoding );
}
}
elseif ( strtolower( IPS_DOC_CHAR_SET ) == 'utf-8' )
{
$string = utf8_encode( $string );
}
return $string;
}
/**
* Convert russian mounth names to english
*
* @access public
* @param string Date
* @return string Converted date
*/
static public function monthNameRu2En( $text )
{
return str_replace( array('Январь','Февраль','Март','Апрель','Май','Июнь,','Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'), array('January','February','March','April','May','June','July','August','September','October','November','December'), $text );
}
static public function transliterate( $text )
{
return str_replace( array('а','б','в','г','д','е','ё','ж','з','и','й','к','л','м','н','о','п','р','с','т','у','ф','х','ц','ч','ш','щ','э','ю','я','ы','ь','ъ'), array('a','b','v','g','d','e','e','zh','z','i','i','k','l','m','n','o','p','r','s','t','u','f','h','c','ch','sh','sh','a','ju','ja','i','',''), $text);
}
static public function makeSeoTransliterate( $text )
{
if ( IPB_USE_SEO_TRANSLIT )
{
$text = urldecode($text);
$text = self::transliterate( $text );
$text = preg_replace('#[^a-z0-9-]#', '', $text);
$text = urlencode($text);
}
return $text;
}
/**
* Make an SEO title for use in the URL
@@ -4237,7 +4293,7 @@ class IPSText
}
/* Finish off */
$text = mb_strtolower($text);
$text = strtolower($text);
if ( strtolower( IPS_DOC_CHAR_SET ) == 'utf-8' )
{
@@ -4256,8 +4312,6 @@ class IPSText
$text = preg_replace( "#-{2,}#", '-', $text );
$text = trim($text, '-');
$text = self::makeSeoTransliterate( $text );
IPSDebug::addMessage( "<span style='color:red'>makeSeoTitle ($text) called</span>" );
return ( $text ) ? $text : '-';
@@ -4320,7 +4374,7 @@ class IPSText
{
$_chr = array(
/* Latin-1 Supplement */
chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
chr(195).chr(128) => 'Ae', chr(195).chr(129) => 'A',
chr(195).chr(130) => 'A', chr(195).chr(131) => 'A',
chr(195).chr(132) => 'A', chr(195).chr(133) => 'A',
chr(195).chr(135) => 'C', chr(195).chr(136) => 'E',
@@ -4330,12 +4384,12 @@ class IPSText
chr(195).chr(143) => 'I', chr(195).chr(145) => 'N',
chr(195).chr(146) => 'O', chr(195).chr(147) => 'O',
chr(195).chr(148) => 'O', chr(195).chr(149) => 'O',
chr(195).chr(150) => 'O', chr(195).chr(153) => 'U',
chr(195).chr(150) => 'Oe', chr(195).chr(153) => 'U',
chr(195).chr(154) => 'U', chr(195).chr(155) => 'U',
chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y',
chr(195).chr(159) => 's', chr(195).chr(160) => 'a',
chr(195).chr(156) => 'Ue', chr(195).chr(157) => 'Y',
chr(195).chr(159) => 'ss', chr(195).chr(160) => 'a',
chr(195).chr(161) => 'a', chr(195).chr(162) => 'a',
chr(195).chr(163) => 'a', chr(195).chr(164) => 'a',
chr(195).chr(163) => 'a', chr(195).chr(164) => 'ae',
chr(195).chr(165) => 'a', chr(195).chr(167) => 'c',
chr(195).chr(168) => 'e', chr(195).chr(169) => 'e',
chr(195).chr(170) => 'e', chr(195).chr(171) => 'e',
@@ -4343,11 +4397,10 @@ class IPSText
chr(195).chr(174) => 'i', chr(195).chr(175) => 'i',
chr(195).chr(177) => 'n', chr(195).chr(178) => 'o',
chr(195).chr(179) => 'o', chr(195).chr(180) => 'o',
chr(195).chr(181) => 'o', chr(195).chr(182) => 'o',
chr(195).chr(182) => 'o', chr(195).chr(185) => 'u',
chr(195).chr(186) => 'u', chr(195).chr(187) => 'u',
chr(195).chr(188) => 'u', chr(195).chr(189) => 'y',
chr(195).chr(191) => 'y',
chr(195).chr(181) => 'o', chr(195).chr(182) => 'oe',
chr(195).chr(185) => 'u', chr(195).chr(186) => 'u',
chr(195).chr(187) => 'u', chr(195).chr(188) => 'ue',
chr(195).chr(189) => 'y', chr(195).chr(191) => 'y',
/* Latin Extended-A */
chr(196).chr(128) => 'A', chr(196).chr(129) => 'a',
chr(196).chr(130) => 'A', chr(196).chr(131) => 'a',
@@ -4390,13 +4443,13 @@ class IPSText
chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
chr(197).chr(146) => 'OE', chr(197).chr(147) => 'oe',
chr(197).chr(148) => 'R', chr(197).chr(149) => 'r',
chr(197).chr(150) => 'R', chr(197).chr(151) => 'r',
chr(197).chr(152) => 'R', chr(197).chr(153) => 'r',
chr(197).chr(154) => 'S', chr(197).chr(155) => 's',
chr(197).chr(156) => 'S', chr(197).chr(157) => 's',
chr(197).chr(158) => 'S', chr(197).chr(159) => 's',
chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
@@ -4540,6 +4593,23 @@ class IPSText
return $string;
}
/**
* Strips out all non UTF-8 characters from a string
* This is best used when you have already converted / got UTF-8 data
* @param string In
* @return string Cleaned
*/
public static function stripNonUtf8( $string )
{
$string = preg_replace('/[\x00-\x08\x10\x0B\x0C\x0E-\x19\x7F]|(?<=^|[\x00-\x7F])[\x80-\xBF]+|([\xC0\xC1]|[\xF0-\xFF])[\x80-\xBF]*'.
'|[\xC2-\xDF]((?![\x80-\xBF])|[\x80-\xBF]{2,})|[\xE0-\xEF](([\x80-\xBF](?![\x80-\xBF]))|(?![\x80-\xBF]{2})|[\x80-\xBF]{3,})/', '?', $string );
$string = preg_replace('/\xE0[\x80-\x9F][\x80-\xBF]|\xED[\xA0-\xBF][\x80-\xBF]/S','?', $string );
return $string;
}
/**
* Decodes long named HTML entities in a string &eacute; without affecting other HTML entities (&lt; etc) etc
* @param string Raw string
@@ -4547,13 +4617,21 @@ class IPSText
*/
public static function decodeNamedHtmlEntities( $string )
{
/* Some manual conversions */
$manual = array( 'Alpha' => 'A', 'Beta' => 'B', 'alpha' => 'a', 'beta' => 'b' );
foreach( $manual as $o => $r )
{
$string = str_replace( '&' . $o . ';', $r, $string );
}
preg_match_all( '#&([^;\s]+?);#', $string, $matches );
$entities = array();
$notList = array( 'amp' );
$notList = array( 'amp', 'para', 'middot', 'gt', 'lt' );
foreach( $matches[0] as $word )
{
if ( preg_match( '#^&([a-zA-Z]{3,8});$#', $word, $match ) )
if ( preg_match( '#^&([a-zA-Z]{2,8});$#', $word, $match ) )
{
if ( ! in_array( $match[1], $notList ) )
{
@@ -4561,12 +4639,14 @@ class IPSText
}
}
}
$translated = @explode( ' ', @html_entity_decode( @implode( ' ', $entities ), ENT_NOQUOTES, IPS_DOC_CHAR_SET ) );
/* -15 is the same as -1 but with Euro plus French and Finnish */
$charSet = ( IPS_DOC_CHAR_SET == 'ISO-8859-1' ) ? 'ISO-8859-15' : IPS_DOC_CHAR_SET;
$translated = @explode( ' ', @html_entity_decode( @implode( ' ', $entities ), ENT_NOQUOTES, $charSet ) );
if ( is_array( $translated ) AND count( $translated ) AND count( $translated ) == count( $entities ) )
{
return str_ireplace( $entities, $translated, $string );
return str_replace( $entities, $translated, $string );
}
return $string;
@@ -4863,7 +4943,7 @@ class IPSText
return FALSE;
}
if ( preg_match( '#[\;\#\n\r\*\'\"<>&\%\!\(\)\{\}\[\]\?\\/\s]#', $email ) )
if ( preg_match( '#[\;\#\n\r\*\'\"<>&\%\!\(\)\{\}\[\]\?\\/\s\,]#', $email ) )
{
return FALSE;
}
@@ -4937,12 +5017,23 @@ class IPSText
*/
static public function searchHighlight( $text, $highlight )
{
//-----------------------------------------
// INIT
//-----------------------------------------
/* No highlight to do (1)? No point in wasting time then.. */
if ( $highlight == '' )
{
return $text;
}
$highlight = self::parseCleanValue( urldecode( $highlight ) );
/* No highlight to do (2)? No point in wasting time then.. */
if ( $highlight == '' )
{
return $text;
}
/* Init some more vars */
$loosematch = 1;//strstr( $highlight, '*' ) ? 1 : 0;
$isPhrase = preg_match( '#("|&(amp;)?quot;)#', $highlight );
$keywords = str_replace( '*', '', str_replace( "+", " ", str_replace( "++", "+", str_replace( '-', '', trim($highlight) ) ) ) );
$keywords = str_replace( '&quot;', '', str_replace( '\\', '&#092;', str_replace( '&amp;quot;', '', $keywords ) ) );
$word_array = array();
@@ -4980,7 +5071,7 @@ class IPSText
$keywords = str_replace( $match[0], '', $keywords );
}
}
else if ( strstr( $keywords, ' ' ) )
else if ( ! $isPhrase && strstr( $keywords, ' ' ) )
{
$word_array = explode( ' ', str_replace( ' ', ' ', $keywords ) );
}
@@ -5293,7 +5384,7 @@ class IPSText
self::$classConvertCharset->method = 'internal';
}
}
$text = self::$classConvertCharset->convertEncoding( $text, $original_cset, $destination_cset );
/* Experimental - convert \u#### to html entity */
@@ -5606,6 +5697,11 @@ class IPSText
*/
static public function stripslashes($t)
{
if( is_array($t) )
{
return $t;
}
if ( IPS_MAGIC_QUOTES )
{
$t = stripslashes($t);
@@ -5683,6 +5779,7 @@ class IPSText
static public function UNhtmlspecialchars($t="")
{
$t = str_replace( "&amp;" , "&", $t );
$t = str_replace( "&#38;" , "&", $t );
$t = str_replace( "&lt;" , "<", $t );
$t = str_replace( "&gt;" , ">", $t );
$t = str_replace( "&quot;", '"', $t );
@@ -5782,13 +5879,12 @@ class IPSText
* @see http://en.wikipedia.org/wiki/Space_(punctuation)
* @see http://www.ascii.cl/htmlcodes.htm
*/
//$t = str_replace( chr(160), ' ', $t );
$t = str_replace( chr(160), ' ', $t );
$t = str_replace( chr(173), ' ', $t );
//$t = str_replace( chr(240), ' ', $t ); -> latin small letter eth
//$t = str_replace( chr(0xA0), "", $t ); //Remove sneaky spaces Same as chr 160
//$t = str_replace( chr(0x11f9), "", $t); //Remove sneaky spaces
//$t = str_replace( chr(0x2004), "", $t ); //Remove sneaky spaces
//$t = str_replace( chr(0x2005), "", $t ); //Remove sneaky spaces
//$t = str_replace( chr(0x2006), "", $t ); //Remove sneaky spaces
@@ -5799,12 +5895,37 @@ class IPSText
//$t = str_replace( chr(0x200D), " ", $t ); //Remove sneaky spaces
//$t = str_replace( chr(0x202F), " ", $t ); //Remove sneaky spaces
//$t = str_replace( chr(0x205F), " ", $t ); //Remove sneaky spaces
//$t = str_replace( chr(0x2060), "", $t ); //Remove sneaky spaces
//$t = str_replace( chr(0xFEFF), "", $t ); //Remove sneaky spaces
}
return $t;
}
/**
* URL encode safe with IPB FURLS
* @param string $data
* @return string Data
*/
static public function urlencode_furlSafe( $data )
{
$data = str_replace( '/', '%2F', $data );
return urlencode( $data );
}
/**
* URL encode safe with IPB FURLS
* @param string $data
* @return string Data
*/
static public function urldecode_furlSafe( $data )
{
$data = str_replace( '%25', '%', $data );
return urldecode( $data );
}
/**
* Base64 encode for URLs
*
@@ -5813,7 +5934,7 @@ class IPSText
*/
static public function base64_encode_urlSafe( $data )
{
return strtr( base64_encode( $data ), '+/=', '-_,' );;
return strtr( base64_encode( $data ), '+/=', '-_,' );
}
/**
@@ -5826,4 +5947,32 @@ class IPSText
{
return base64_decode( strtr( $data, '-_,', '+/=' ) );
}
/**
* Wrapper for PHPs strip_tags. Makes < and > not part of tags safe
* Based on @link http://www.php.net/manual/en/function.strip-tags.php#89309
* @param string $text
* @param string $allowed
*/
static public function stripTags( $text, $allowed='' )
{
$strs = explode( '<', $text );
$res = $strs[0];
for( $i=1 ; $i < count( $strs ) ; $i++ )
{
if ( ! strpos( $strs[$i], '>' ) )
{
$res = $res . '&#0000001;' . $strs[$i];
}
else
{
$res = $res . '<' . $strs[$i];
}
}
$text = strip_tags( $res, $allowed );
return str_replace( '&#0000001;', '<', $text );
}
}
+9 -9
View File
@@ -1,10 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
+478 -475
View File
@@ -1,476 +1,479 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.2.3
* Primary controller
* Last Updated: $LastChangedDate: 2011-09-16 07:16:26 -0400 (Fri, 16 Sep 2011) $
* </pre>
*
* @author $Author: mmecham $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license This is NULLED!
* @package IP.Board
* @link http://hatynka.in
* @since 14th May 2003
* @version $Rev: 9496 $
*/
/**
* Class "Controller"
* A very simple public facing interface to resolve incoming data into
* a command class
*
* @author Matt Mecham
* @since Wednesday 14th May 2008
* @package IP.Board
*/
class ipsController
{
/**
* Registry reference
*
* @access protected
* @var object
*/
protected $registry;
/**
* Command
*
* @access public
* @var string
*/
static public $cmd;
/**
* Constructor
*
* @access private
* @return @e void
*/
private function __construct() { }
/**
* Public facing function to run the controller
*
* @access public
* @return @e void
*/
static public function run()
{
$instance = new ipsController();
$instance->init();
$instance->handleRequest();
}
/**
* Initialize ipsRegistry and this class
*
* @access protected
* @return @e void
*/
protected function init()
{
$this->registry = ipsRegistry::instance();
$this->registry->init();
}
/**
* Handle the incoming request using the command resolver
*
* @access protected
* @return @e void
*/
protected function handleRequest()
{
$cmd_r = new ipsController_CommandResolver();
try
{
self::$cmd = $cmd_r->getCommand( $this->registry );
}
catch( Exception $e )
{
$msg = $e->getMessage();
/* An error occured, so throw a 404 */
try
{
/* The following patch prevents links such as /admin/index.php?adsess=123&app=anyrandomnamehere&module=login&do=login-complete from loading
an ACP error screen complete with wrapper, which may expose the applications that are installed to an end user.
This issue was reported by Christopher Truncer via the IPS ticket system. */
if( IN_ACP AND !$this->registry->member()->getProperty('member_id') )
{
$this->registry->getClass('output')->silentRedirect( ipsRegistry::$settings['base_url'] );
}
$this->registry->getClass('output')->showError( 'incorrect_furl', 404, null, null, 404 );
}
catch( Exception $e )
{
print $msg;
exit();
}
}
IPSDebug::setMemoryDebugFlag( "Everything up until execute call", 0 );
self::$cmd->execute( $this->registry );
}
}
/**
* Class "Command Resolver"
* Resolves the incoming data
*
* @author Matt Mecham
* @since Wednesday 14th May 2008
* @package IP.Board
*/
class ipsController_CommandResolver
{
/**#@+
* Internal strings to remember
*
* @access protected
* @var string
*/
protected static $base_cmd;
protected static $default_cmd;
protected static $modules_dir = 'modules_public';
protected static $class_dir = 'public';
/**#@-*/
/**
* Constructor
*
* @access public
* @return @e void
*/
public function __construct()
{
if ( ! self::$base_cmd )
{
self::$base_cmd = ipsRegistry::$current_module == 'ajax' ? new ReflectionClass( 'ipsAjaxCommand' ) : new ReflectionClass( 'ipsCommand' );
self::$default_cmd = new ipsCommand_default();
self::$modules_dir = ( IPS_AREA != 'admin' ) ? 'modules_public' : 'modules_admin';
self::$class_dir = ( IPS_AREA != 'admin' ) ? 'public' : 'admin';
}
}
/**
* Retreive the command
*
* @access public
* @param object ipsRegistry reference
* @return object
*/
public function getCommand( ipsRegistry $registry )
{
$_NOW = IPSDebug::getMemoryDebugFlag();
$module = ipsRegistry::$current_module;
$section = ipsRegistry::$current_section;
$filepath = IPSLib::getAppDir( IPS_APP_COMPONENT ) . '/' . self::$modules_dir . '/' . $module . '/';
/* Bug Fix #21009 */
if ( ! ipsRegistry::$applications[ IPS_APP_COMPONENT ]['app_enabled'] )
{
throw new Exception( "The specified application has been disabled" );
}
if ( !IN_ACP and !IPSLib::moduleIsEnabled( $module, IPS_APP_COMPONENT ) and $module != 'ajax' )
{
throw new Exception( "The specified module has been disabled" );
}
/* Got a section? */
if ( ! $section )
{
if ( is_file( $filepath . 'defaultSection.php' ) )
{
$DEFAULT_SECTION = '';
include( $filepath . 'defaultSection.php' );/*noLibHook*/
if ( $DEFAULT_SECTION )
{
$section = $DEFAULT_SECTION;
ipsRegistry::$current_section = $section;
}
}
}
$_classname = self::$class_dir . '_' . IPS_APP_COMPONENT . '_' . $module . '_';
/* Rarely used, let's leave file_exists which is faster for non-existent files */
if ( file_exists( $filepath . 'manualResolver.php' ) )
{
$classname = IPSLib::loadActionOverloader( $filepath . 'manualResolver.php' , $_classname . 'manualResolver' );
}
else if ( is_file( $filepath . $section . '.php' ) )
{
$classname = IPSLib::loadActionOverloader( $filepath . $section . '.php' , $_classname . $section );
}
IPSDebug::setMemoryDebugFlag( "Controller getCommand executed" );
if ( class_exists( $classname ) )
{
$cmd_class = new ReflectionClass( $classname );
if ( $cmd_class->isSubClassOf( self::$base_cmd ) )
{
return $cmd_class->newInstance();
}
else
{
throw new Exception( "$section в $module не существует!" );
}
}
# Fudge it to return just the default object
return clone self::$default_cmd;
}
}
abstract class ipsCommand
{
/**#@+
* Registry Object Shortcuts
*
* @access protected
* @var object
*/
protected $registry;
protected $DB;
protected $settings;
protected $request;
protected $lang;
protected $member;
protected $memberData;
protected $cache;
protected $caches;
/**#@-*/
/**
* Constructor
*
* @access public
* @return @e void
*/
final public function __construct()
{
}
/**
* Make the registry shortcuts
*
* @access public
* @param object ipsRegistry reference
* @return @e void
*/
public function makeRegistryShortcuts( ipsRegistry $registry )
{
/* Make registry objects */
$this->registry = $registry;
$this->DB = $this->registry->DB();
$this->settings =& $this->registry->fetchSettings();
$this->request =& $this->registry->fetchRequest();
$this->lang = $this->registry->getClass('class_localization');
$this->member = $this->registry->member();
$this->memberData =& $this->registry->member()->fetchMemberData();
$this->cache = $this->registry->cache();
$this->caches =& $this->registry->cache()->fetchCaches();
$this->memberData = IPSMember::setUpModerator( $this->memberData );
}
/**
* Execute the command (call doExecute)
*
* @access public
* @param object ipsRegistry reference
* @return @e void
*/
public function execute( ipsRegistry $registry )
{
//$registry->getClass('class_permissions')
$this->makeRegistryShortcuts( $registry );
$this->doExecute( $registry );
}
/**
* Do execute method (must be overriden)
*
* @access protected
* @param object ipsRegistry reference
* @return @e void
*/
protected abstract function doExecute( ipsRegistry $registry );
}
/**
* Abstract class for handling ajax requests
*/
abstract class ipsAjaxCommand
{
/**#@+
* Registry Object Shortcuts
*
* @access protected
* @var object
*/
protected $registry;
protected $DB;
protected $settings;
protected $request;
protected $lang;
protected $member;
protected $memberData;
protected $cache;
protected $caches;
protected $ajax;
/**#@-*/
/**
* Constructor
*
* @access public
* @return @e void
*/
final public function __construct()
{
}
/**
* Magic function to catch all the ajax methods
*
* @access public
* @param string $func Function name being called
* @param array $arguments Array of parameters
* @return mixed
*/
public function __call( $func, $arguments )
{
if( method_exists( $this->ajax, $func ) )
{
return call_user_func_array( array( $this->ajax, $func ), $arguments );
}
}
/**
* Creates all the registry shorctus
*
* @access public
* @param object ipsRegistry reference
* @return @e void
*/
public function makeRegistryShortcuts( ipsRegistry $registry )
{
/* Make registry objects */
$this->registry = $registry;
$this->DB = $this->registry->DB();
$this->settings =& $this->registry->fetchSettings();
$this->request =& $this->registry->fetchRequest();
$this->lang = $this->registry->getClass('class_localization');
$this->member = $this->registry->member();
$this->memberData =& $this->registry->member()->fetchMemberData();
$this->cache = $this->registry->cache();
$this->caches =& $this->registry->cache()->fetchCaches();
$this->memberData = IPSMember::setUpModerator( $this->memberData );
$classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classAjax.php', 'classAjax' );
$this->ajax = new $classToLoad();
IPSDebug::fireBug( 'registerExceptionHandler' );
IPSDebug::fireBug( 'registerErrorHandler' );
}
/**
* Executes the ajax request, checks secure key
*
* @access public
* @param object ipsRegistry reference
* @return @e void
*/
public function execute( ipsRegistry $registry )
{
/* Setup Shortcuts First */
$this->makeRegistryShortcuts( $registry );
/* Check the secure key */
$this->request['secure_key'] = $this->request['secure_key'] ? $this->request['secure_key'] : $this->request['md5check'];
//if( $this->request['secure_key'] && $this->request['secure_key'] != $this->member->form_hash )
if( $this->request['secure_key'] != $this->member->form_hash )
{
IPSDebug::fireBug( 'error', array( "The security key did not match the member's form hash" ) );
$this->returnString( 'nopermission' );
}
$this->doExecute( $registry );
}
/**
* Do execute method (must be overriden)
*
* @access protected
* @param object ipsRegistry reference
* @return @e void
*/
protected abstract function doExecute( ipsRegistry $registry );
}
class ipsCommand_default extends ipsCommand
{
/**
* Do execute method
*
* @access protected
* @param object ipsRegistry reference
* @return @e void
*/
protected function doExecute( ipsRegistry $registry )
{
$modules_dir = ( IPS_AREA != 'admin' ) ? 'modules_public' : 'modules_admin';
$filepath = IPSLib::getAppDir( IPS_APP_COMPONENT ) . '/' . $modules_dir . '/' . ipsRegistry::$current_module . '/' . ipsRegistry::$current_section . '.php';
$filepath = str_replace( DOC_IPS_ROOT_PATH, '', $filepath );
//-----------------------------------------
// Redirect to board index
//-----------------------------------------
if ( ! (IPS_APP_COMPONENT == 'forums' AND ipsRegistry::$current_module == 'forums' AND ipsRegistry::$current_section == 'boards') )
{
if( IPB_THIS_SCRIPT == 'admin' )
{
$registry->output->silentRedirect( ipsRegistry::$settings['_base_url'] );
}
else
{
$registry->output->silentRedirect( ipsRegistry::$settings['_original_base_url'] );
}
}
//-----------------------------------------
// Uh oh, this is a big one.. (no forums app)
//-----------------------------------------
if ( ! is_file( $filepath ) )
{
$this->registry->getClass('output')->showError( array( 'command_file_missing', $filepath ), 401100, null, null, 404 );
}
else
{
$this->registry->getClass('output')->showError( array( 'command_class_incorrect', $filepath ), 401200, null, null, 404 );
}
}
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* Primary controller
* 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 $
*/
/**
* Class "Controller"
* A very simple public facing interface to resolve incoming data into
* a command class
*
* @author Matt Mecham
* @since Wednesday 14th May 2008
* @package IP.Board
*/
class ipsController
{
/**
* Registry reference
*
* @access protected
* @var object
*/
protected $registry;
/**
* Command
*
* @access public
* @var string
*/
static public $cmd;
/**
* Constructor
*
* @access private
* @return @e void
*/
private function __construct() { }
/**
* Public facing function to run the controller
*
* @access public
* @return @e void
*/
static public function run()
{
$instance = new ipsController();
$instance->init();
$instance->handleRequest();
}
/**
* Initialize ipsRegistry and this class
*
* @access protected
* @return @e void
*/
protected function init()
{
$this->registry = ipsRegistry::instance();
$this->registry->init();
}
/**
* Handle the incoming request using the command resolver
*
* @access protected
* @return @e void
*/
protected function handleRequest()
{
$cmd_r = new ipsController_CommandResolver();
try
{
self::$cmd = $cmd_r->getCommand( $this->registry );
}
catch( Exception $e )
{
$msg = $e->getMessage();
/* An error occured, so throw a 404 */
try
{
/* The following patch prevents links such as /admin/index.php?adsess=123&app=anyrandomnamehere&module=login&do=login-complete from loading
an ACP error screen complete with wrapper, which may expose the applications that are installed to an end user.
This issue was reported by Christopher Truncer via the IPS ticket system. */
if( IN_ACP AND !$this->registry->member()->getProperty('member_id') )
{
$this->registry->getClass('output')->silentRedirect( ipsRegistry::$settings['base_url'] );
}
$this->registry->getClass('output')->showError( 'incorrect_furl', 404, null, null, 404 );
}
catch( Exception $e )
{
print $msg;
exit();
}
}
IPSDebug::setMemoryDebugFlag( "Everything up until execute call", 0 );
self::$cmd->execute( $this->registry );
}
}
/**
* Class "Command Resolver"
* Resolves the incoming data
*
* @author Matt Mecham
* @since Wednesday 14th May 2008
* @package IP.Board
*/
class ipsController_CommandResolver
{
/**#@+
* Internal strings to remember
*
* @access protected
* @var string
*/
protected static $base_cmd;
protected static $default_cmd;
protected static $modules_dir = 'modules_public';
protected static $class_dir = 'public';
/**#@-*/
/**
* Constructor
*
* @access public
* @return @e void
*/
public function __construct()
{
if ( ! self::$base_cmd )
{
self::$base_cmd = ipsRegistry::$current_module == 'ajax' ? new ReflectionClass( 'ipsAjaxCommand' ) : new ReflectionClass( 'ipsCommand' );
self::$default_cmd = new ipsCommand_default();
self::$modules_dir = ( IPS_AREA != 'admin' ) ? 'modules_public' : 'modules_admin';
self::$class_dir = ( IPS_AREA != 'admin' ) ? 'public' : 'admin';
}
}
/**
* Retreive the command
*
* @access public
* @param object ipsRegistry reference
* @return object
*/
public function getCommand( ipsRegistry $registry )
{
$_NOW = IPSDebug::getMemoryDebugFlag();
$module = ipsRegistry::$current_module;
$section = ipsRegistry::$current_section;
$filepath = IPSLib::getAppDir( IPS_APP_COMPONENT ) . '/' . self::$modules_dir . '/' . $module . '/';
/* Bug Fix #21009 */
if ( ! ipsRegistry::$applications[ IPS_APP_COMPONENT ]['app_enabled'] )
{
throw new Exception( "The specified application has been disabled" );
}
if ( !IN_ACP and !IPSLib::moduleIsEnabled( $module, IPS_APP_COMPONENT ) and $module != 'ajax' )
{
throw new Exception( "The specified module has been disabled" );
}
/* Got a section? */
if ( ! $section )
{
if ( is_file( $filepath . 'defaultSection.php' ) )
{
$DEFAULT_SECTION = '';
include( $filepath . 'defaultSection.php' );/*noLibHook*/
if ( $DEFAULT_SECTION )
{
$section = $DEFAULT_SECTION;
ipsRegistry::$current_section = $section;
}
}
}
$_classname = self::$class_dir . '_' . IPS_APP_COMPONENT . '_' . $module . '_';
/* Rarely used, let's leave file_exists which is faster for non-existent files */
if ( file_exists( $filepath . 'manualResolver.php' ) )
{
$classname = IPSLib::loadActionOverloader( $filepath . 'manualResolver.php' , $_classname . 'manualResolver' );
}
else if ( is_file( $filepath . $section . '.php' ) )
{
$classname = IPSLib::loadActionOverloader( $filepath . $section . '.php' , $_classname . $section );
}
IPSDebug::setMemoryDebugFlag( "Controller getCommand executed" );
if ( class_exists( $classname ) )
{
$cmd_class = new ReflectionClass( $classname );
if ( $cmd_class->isSubClassOf( self::$base_cmd ) )
{
return $cmd_class->newInstance();
}
else
{
throw new Exception( "$section in $module does not exist!" );
}
}
else
{
throw new Exception( "$classname does not exist!" );
}
# Fudge it to return just the default object
return clone self::$default_cmd;
}
}
abstract class ipsCommand
{
/**#@+
* Registry Object Shortcuts
*
* @access protected
* @var object
*/
protected $registry;
protected $DB;
protected $settings;
protected $request;
protected $lang;
protected $member;
protected $memberData;
protected $cache;
protected $caches;
/**#@-*/
/**
* Constructor
*
* @access public
* @return @e void
*/
final public function __construct()
{
}
/**
* Make the registry shortcuts
*
* @access public
* @param object ipsRegistry reference
* @return @e void
*/
public function makeRegistryShortcuts( ipsRegistry $registry )
{
/* Make registry objects */
$this->registry = $registry;
$this->DB = $this->registry->DB();
$this->settings =& $this->registry->fetchSettings();
$this->request =& $this->registry->fetchRequest();
$this->lang = $this->registry->getClass('class_localization');
$this->member = $this->registry->member();
$this->memberData =& $this->registry->member()->fetchMemberData();
$this->cache = $this->registry->cache();
$this->caches =& $this->registry->cache()->fetchCaches();
$this->memberData = IPSMember::setUpModerator( $this->memberData );
}
/**
* Execute the command (call doExecute)
*
* @access public
* @param object ipsRegistry reference
* @return @e void
*/
public function execute( ipsRegistry $registry )
{
//$registry->getClass('class_permissions')
$this->makeRegistryShortcuts( $registry );
$this->doExecute( $registry );
}
/**
* Do execute method (must be overriden)
*
* @access protected
* @param object ipsRegistry reference
* @return @e void
*/
protected abstract function doExecute( ipsRegistry $registry );
}
/**
* Abstract class for handling ajax requests
*/
abstract class ipsAjaxCommand
{
/**#@+
* Registry Object Shortcuts
*
* @access protected
* @var object
*/
protected $registry;
protected $DB;
protected $settings;
protected $request;
protected $lang;
protected $member;
protected $memberData;
protected $cache;
protected $caches;
protected $ajax;
/**#@-*/
/**
* Constructor
*
* @access public
* @return @e void
*/
final public function __construct()
{
}
/**
* Magic function to catch all the ajax methods
*
* @access public
* @param string $func Function name being called
* @param array $arguments Array of parameters
* @return mixed
*/
public function __call( $func, $arguments )
{
if( method_exists( $this->ajax, $func ) )
{
return call_user_func_array( array( $this->ajax, $func ), $arguments );
}
}
/**
* Creates all the registry shorctus
*
* @access public
* @param object ipsRegistry reference
* @return @e void
*/
public function makeRegistryShortcuts( ipsRegistry $registry )
{
/* Make registry objects */
$this->registry = $registry;
$this->DB = $this->registry->DB();
$this->settings =& $this->registry->fetchSettings();
$this->request =& $this->registry->fetchRequest();
$this->lang = $this->registry->getClass('class_localization');
$this->member = $this->registry->member();
$this->memberData =& $this->registry->member()->fetchMemberData();
$this->cache = $this->registry->cache();
$this->caches =& $this->registry->cache()->fetchCaches();
$this->memberData = IPSMember::setUpModerator( $this->memberData );
$classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classAjax.php', 'classAjax' );
$this->ajax = new $classToLoad();
IPSDebug::fireBug( 'registerExceptionHandler' );
IPSDebug::fireBug( 'registerErrorHandler' );
}
/**
* Executes the ajax request, checks secure key
*
* @access public
* @param object ipsRegistry reference
* @return @e void
*/
public function execute( ipsRegistry $registry )
{
/* Setup Shortcuts First */
$this->makeRegistryShortcuts( $registry );
/* Check the secure key */
$this->request['secure_key'] = $this->request['secure_key'] ? $this->request['secure_key'] : $this->request['md5check'];
if( $this->request['secure_key'] != $this->member->form_hash )
{
IPSDebug::fireBug( 'error', array( "The security key did not match the member's form hash" ) );
$this->returnString( 'nopermission' );
}
$this->doExecute( $registry );
}
/**
* Do execute method (must be overriden)
*
* @access protected
* @param object ipsRegistry reference
* @return @e void
*/
protected abstract function doExecute( ipsRegistry $registry );
}
class ipsCommand_default extends ipsCommand
{
/**
* Do execute method
*
* @access protected
* @param object ipsRegistry reference
* @return @e void
*/
protected function doExecute( ipsRegistry $registry )
{
$modules_dir = ( IPS_AREA != 'admin' ) ? 'modules_public' : 'modules_admin';
$filepath = IPSLib::getAppDir( IPS_APP_COMPONENT ) . '/' . $modules_dir . '/' . ipsRegistry::$current_module . '/' . ipsRegistry::$current_section . '.php';
$filepath = str_replace( DOC_IPS_ROOT_PATH, '', $filepath );
//-----------------------------------------
// Redirect to board index
//-----------------------------------------
if ( ! (IPS_APP_COMPONENT == 'forums' AND ipsRegistry::$current_module == 'forums' AND ipsRegistry::$current_section == 'boards') )
{
if( IPB_THIS_SCRIPT == 'admin' )
{
$registry->output->silentRedirect( ipsRegistry::$settings['_base_url'] );
}
else
{
$registry->output->silentRedirect( ipsRegistry::$settings['_original_base_url'] );
}
}
//-----------------------------------------
// Uh oh, this is a big one.. (no forums app)
//-----------------------------------------
if ( ! is_file( $filepath ) )
{
$this->registry->getClass('output')->showError( array( 'command_file_missing', $filepath ), 401100, null, null, 404 );
}
else
{
$this->registry->getClass('output')->showError( array( 'command_class_incorrect', $filepath ), 401200, null, null, 404 );
}
}
}
File diff suppressed because it is too large. Load diff
@@ -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;
}
}
File diff suppressed because it is too large. Load diff