Version 3.4.6
This commit is contained in:
1 parent
e4478369d8
commit
b45ea0dffb
1568 files changed
+155104
-161665
No files matched your search
@@ -2,21 +2,21 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.4.5
|
||||
* IP.Board v3.4.6
|
||||
* 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: 2013-05-21 20:51:17 -0400 (Tue, 21 May 2013) $
|
||||
* Last Updated: $Date: 2013-09-26 22:37:28 -0400 (Thu, 26 Sep 2013) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @author $Author: rashbrook $
|
||||
* @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 12th March 2002
|
||||
* @version $Revision: 12263 $
|
||||
* @version $Revision: 12370 $
|
||||
*
|
||||
* @author Matt
|
||||
*/
|
||||
@@ -1330,17 +1330,6 @@ 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
|
||||
*
|
||||
@@ -1417,9 +1406,6 @@ class IPSLib
|
||||
|
||||
switch( $method )
|
||||
{
|
||||
case 'vkontakte':
|
||||
return self::vkontakte_enabled();
|
||||
break;
|
||||
case 'facebook':
|
||||
return self::fbc_enabled();
|
||||
break;
|
||||
@@ -1887,20 +1873,11 @@ EOF;
|
||||
/* Loop over the applications and build */
|
||||
foreach( $apps as $path => $app_dir )
|
||||
{
|
||||
$furltemplatesfile = IPS_ROOT_PATH . $path;
|
||||
if(IPB_USE_ONLY_ID_FURL && is_file( $furltemplatesfile.'/extensions/furlTemplatesID.php'))
|
||||
{
|
||||
$furltemplatesfile.='/extensions/furlTemplatesID.php';
|
||||
}
|
||||
else
|
||||
{
|
||||
$furltemplatesfile.='/extensions/furlTemplates.php';
|
||||
}
|
||||
if ( is_file( $furltemplatesfile ) )
|
||||
if ( is_file( IPS_ROOT_PATH . $path . '/extensions/furlTemplates.php' ) )
|
||||
{
|
||||
$_SEOTEMPLATES = array();
|
||||
|
||||
require( $furltemplatesfile );/*noLibHook*/
|
||||
require( IPS_ROOT_PATH . $path . '/extensions/furlTemplates.php' );/*noLibHook*/
|
||||
|
||||
if ( is_array( $_SEOTEMPLATES ) && count( $_SEOTEMPLATES ) )
|
||||
{
|
||||
@@ -3483,22 +3460,6 @@ EOF;
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -4270,19 +4231,21 @@ class IPSCookie
|
||||
* Abstract layer allows us to do some checking, etc
|
||||
*
|
||||
* @param string Cookie name
|
||||
* @param boolean Use prefix?
|
||||
* @return mixed
|
||||
* @since 2.0
|
||||
*/
|
||||
static public function get($name)
|
||||
static public function get( $name, $usePrefix = true )
|
||||
{
|
||||
$_name = ( $usePrefix ? ipsRegistry::$settings['cookie_id'].$name : $name );
|
||||
/* Check internal data first */
|
||||
if ( isset( self::$_cookiesSet[ $name ] ) )
|
||||
{
|
||||
return self::$_cookiesSet[ $name ];
|
||||
}
|
||||
else if ( isset( $_COOKIE[ipsRegistry::$settings['cookie_id'].$name] ) )
|
||||
else if ( isset( $_COOKIE[ $_name ] ) )
|
||||
{
|
||||
$_value = $_COOKIE[ ipsRegistry::$settings['cookie_id'].$name ];
|
||||
$_value = $_COOKIE[ $_name ];
|
||||
|
||||
$_couldBeJson = stripslashes( urldecode( $_value ) );
|
||||
$_test = json_decode( $_couldBeJson, true );
|
||||
@@ -4523,61 +4486,6 @@ class IPSText
|
||||
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','yo','zh','z','i','i','k','l','m','n','o','p','r','s','t','u','f','kh','tc','ch','sh','sch','e','iu','ia','y','',''), $text);
|
||||
|
||||
}
|
||||
|
||||
static public function makeSeoTransliterate( $text )
|
||||
{
|
||||
if (!IPB_USE_SEO_TRANSLIT )
|
||||
{
|
||||
return $text;
|
||||
}
|
||||
/*if ( IPB_USE_ONLY_ID_FURL )
|
||||
{
|
||||
return '-';
|
||||
}*/
|
||||
if ((is_array($text)) && (count($text)))
|
||||
{
|
||||
foreach( $text as $k => $v)
|
||||
{
|
||||
$text[$k] = self::makeSeoTransliterate( $v );
|
||||
}
|
||||
return $text;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$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
|
||||
* We parse them even if friendly urls are off so that the data is there when you do switch it on
|
||||
@@ -4628,7 +4536,7 @@ class IPSText
|
||||
}
|
||||
|
||||
/* Finish off */
|
||||
$text = mb_strtolower($text);
|
||||
$text = strtolower($text);
|
||||
|
||||
if ( strtolower( IPS_DOC_CHAR_SET ) == 'utf-8' )
|
||||
{
|
||||
@@ -4646,8 +4554,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 : '-';
|
||||
@@ -5278,11 +5184,19 @@ class IPSText
|
||||
//$email = trim($email);
|
||||
|
||||
//$email = str_replace( " ", "", $email );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check we're not passing an array
|
||||
// (path disclosure prevention)
|
||||
//-----------------------------------------
|
||||
if ( is_array( $email ) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Check for more than 1 @ symbol
|
||||
//-----------------------------------------
|
||||
|
||||
if ( substr_count( $email, '@' ) > 1 )
|
||||
{
|
||||
return FALSE;
|
||||
@@ -6237,15 +6151,8 @@ class IPSText
|
||||
* @see http://en.wikipedia.org/wiki/Space_(punctuation)
|
||||
* @see http://www.ascii.cl/htmlcodes.htm
|
||||
*/
|
||||
if ( strtolower(IPS_DOC_CHAR_SET) == 'utf-8' )
|
||||
{
|
||||
$t = str_replace(chr(194).chr(160), chr(32), $t );
|
||||
return $t;
|
||||
}
|
||||
else
|
||||
{
|
||||
$t = str_replace(chr(160), chr(32), $t );
|
||||
$t = str_replace( chr(173), chr(32), $t );
|
||||
$t = str_replace( chr(160), ' ', $t );
|
||||
$t = str_replace( chr(173), ' ', $t );
|
||||
|
||||
//$t = str_replace( chr(240), ' ', $t ); -> latin small letter eth
|
||||
|
||||
@@ -6263,7 +6170,6 @@ class IPSText
|
||||
//$t = str_replace( chr(0x2060), "", $t ); //Remove sneaky spaces
|
||||
//$t = str_replace( chr(0xFEFF), "", $t ); //Remove sneaky spaces
|
||||
}
|
||||
}
|
||||
|
||||
return $t;
|
||||
}
|
||||
|
||||
@@ -1,172 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services / IPBmafia.Ru
|
||||
* IP.Board v3.4.2 / darkLicenseActivationEmulator 1.1
|
||||
* License emulator
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: _Dark_ $
|
||||
* @copyright (c) 2012 IPBmafia.Ru
|
||||
* @package IP.Board
|
||||
* @link http://www.ipbmafia.ru
|
||||
* @version 1.1
|
||||
*
|
||||
*/
|
||||
class darkLAE {
|
||||
|
||||
public static $settings = array(
|
||||
/*
|
||||
* if TRUE IP.Board copyright will be displayed in page footer
|
||||
* if FALSE IP.Board copyright will be hidden
|
||||
* если TRUE копирайт IP.Board будет отображен в футере страницы
|
||||
* если FALSE копирайт IP.Board будет скрыт
|
||||
*/
|
||||
'ipboard_copyright_showing' => TRUE,
|
||||
);
|
||||
|
||||
private static $licenseKey = 'darkLAE 1.1 (_Dark_, IPBmafia.Ru)';
|
||||
|
||||
public static function activateLicense() {
|
||||
$response = array(
|
||||
'result' => 'ok'
|
||||
);
|
||||
return json_encode($response);
|
||||
}
|
||||
|
||||
public static function getLicenseKey() {
|
||||
return self::$licenseKey;
|
||||
}
|
||||
|
||||
public static function getLicenseData() {
|
||||
return array(
|
||||
'key' => array(
|
||||
'_expires' => '9999999998',
|
||||
'status_icon' => 'medal.png',
|
||||
'status' => 'Ok',
|
||||
'name' => 'Master License Key',
|
||||
'msg' => 'Activated by darkLAE',
|
||||
'expires' => '9999999999'
|
||||
),
|
||||
'addons' => array(
|
||||
array(
|
||||
'expires' => '',
|
||||
'_expires' => 0,
|
||||
'status_icon' => 'accept.png',
|
||||
'status' => 'Ok',
|
||||
'name' => 'IP.Board',
|
||||
'msg' => ''
|
||||
),
|
||||
array(
|
||||
'expires' => '',
|
||||
'_expires' => 0,
|
||||
'status_icon' => 'accept.png',
|
||||
'status' => 'Ok',
|
||||
'name' => 'IP.Nexus',
|
||||
'msg' => ''
|
||||
),
|
||||
array(
|
||||
'expires' => '',
|
||||
'_expires' => 0,
|
||||
'status_icon' => 'accept.png',
|
||||
'status' => 'Ok',
|
||||
'name' => 'IP.Content',
|
||||
'msg' => ''
|
||||
),
|
||||
array(
|
||||
'expires' => '',
|
||||
'_expires' => 0,
|
||||
'status_icon' => 'accept.png',
|
||||
'status' => 'Ok',
|
||||
'name' => 'IP.Gallery',
|
||||
'msg' => ''
|
||||
),
|
||||
array(
|
||||
'expires' => '',
|
||||
'_expires' => 0,
|
||||
'status_icon' => 'accept.png',
|
||||
'status' => 'Ok',
|
||||
'name' => 'IP.Blog',
|
||||
'msg' => ''
|
||||
),
|
||||
array(
|
||||
'expires' => '',
|
||||
'_expires' => 0,
|
||||
'status_icon' => 'accept.png',
|
||||
'status' => 'Ok',
|
||||
'name' => 'IP.Downloads',
|
||||
'msg' => ''
|
||||
),
|
||||
array(
|
||||
'expires' => '',
|
||||
'_expires' => 0,
|
||||
'status_icon' => 'cross.png',
|
||||
'status' => 'Inactive',
|
||||
'name' => 'IP.Chat',
|
||||
'msg' => "Unfortunately, you can't use IP.Chat with nulled version."
|
||||
),
|
||||
array(
|
||||
'expires' => '',
|
||||
'_expires' => 0,
|
||||
'status_icon' => 'accept.png',
|
||||
'status' => 'Ok',
|
||||
'name' => 'Copyright Removal',
|
||||
'msg' => 'If you want disable copyright edit file /admin/sources/base/darkLAE.php at line 20.'
|
||||
)
|
||||
),
|
||||
'ipbMain' => array(
|
||||
array(
|
||||
'expires' => '',
|
||||
'_expires' => 0,
|
||||
'status_icon' => 'information.png',
|
||||
'status' => 'Inactive',
|
||||
'name' => 'Standard Support',
|
||||
'msg' => "You can't get support from the IPS Client Area, but you can ask for help at <a href='http://www.ipbmafia.ru' target='_blank'>IPBmafia.Ru</a>"
|
||||
),
|
||||
array(
|
||||
'expires' => '',
|
||||
'_expires' => 0,
|
||||
'status_icon' => 'information.png',
|
||||
'status' => 'Inactive',
|
||||
'name' => 'Download Access',
|
||||
'msg' => "You can't download new versions from the IPS Client Area, but you can download nulled versions at <a href='http://www.ipbmafia.ru' target='_blank'>IPBmafia.Ru</a>"
|
||||
),
|
||||
array(
|
||||
'expires' => '',
|
||||
'_expires' => 0,
|
||||
'status_icon' => 'cross.png',
|
||||
'status' => 'Inactive',
|
||||
'name' => 'Spam Monitoring Service',
|
||||
'msg' => "Unfortunately, you can't use Spam Monitoring Service with nulled version."
|
||||
),
|
||||
array(
|
||||
'expires' => '',
|
||||
'_expires' => 0,
|
||||
'status_icon' => 'cross.png',
|
||||
'status' => 'Inactive',
|
||||
'name' => 'Mobile Push Notifications',
|
||||
'msg' => "Unfortunately, you can't use Mobile Push Notifications with nulled version."
|
||||
),
|
||||
array(
|
||||
'expires' => '',
|
||||
'_expires' => 0,
|
||||
'status_icon' => 'accept.png',
|
||||
'status' => 'Ok',
|
||||
'name' => 'Visual Skin Editor',
|
||||
'msg' => ''
|
||||
)
|
||||
),
|
||||
'skinGen' => 1,
|
||||
'iphoneNotifications' => 0,
|
||||
'cr' => (int) !self::$settings['ipboard_copyright_showing']
|
||||
);
|
||||
}
|
||||
|
||||
public static function getVisualSkinEditorJsonData() {
|
||||
$json = <<<_Dark_
|
||||
var IPS_SKIN_GEN_DATA = {"skinGroups":{"app_calendar":["App: Calendar",["app_calendar_td_selected","app_calendar_td_hover","app_calendar_td_blank","app_calendar_td_today"]],"app_gallery":["App: Gallery",["albumDetailTable_td"]],"global":["Global Styles",["body","a","content","desc","desclighter"]],"tables":["Table Content",["row1","row2","unread","unreadalt","tableheader","tableheader_a","ipb_table"]],"other":["Other Styles",["ipsbox","Bar Header","postblock","NoMessages","fieldsetSubmit","general_box","general_box_h3","ipsboxcontainer","maintitle","sideMenuActive","ipsVerticalTabbed_tabs_li","ipsVerticalTabbed_tabs_li_a","ipsVerticalTabbed_tabs_li_a_hover","ipsVerticalTabbed_tabs_li_active","ipsfilterbar_item","ipsfilterbar_active"]],"buttons":["Button Styles",["but_submit","but_submit_alt","but_topic","but_secondary"]],"header":["Header Elements",["registerLink","header","primarynav","primarynav_inactive","primarynav_active","searchbutton"]],"pagination":["Pagination",["paginationBackForward","paginationBackForwardHover","paginationBackActive"]],"sidebar":["Sidebar",["ipsSideBlock","ipsSideBlock_h3"]],"profiles":["Profile Page",["statusupdate"]],"app_blog":["App: Blog",["entry_header"]]},"colorizeGroups":{"base":["app_calendar_td_selected","app_calendar_td_hover","app_calendar_td_blank","app_calendar_td_today","albumDetailTable_td","body","content","row1","row2","unread","unreadalt","ipsbox","Bar Header","tableheader","tableheader_a","postblock","NoMessages","but_submit_alt","fieldsetSubmit","registerLink","header","primarynav","primarynav_inactive","primarynav_active","general_box","general_box_h3","ipsboxcontainer","maintitle","desc","desclighter","ipb_table","ipsVerticalTabbed_tabs_li","ipsVerticalTabbed_tabs_li_a","ipsVerticalTabbed_tabs_li_a_hover","ipsVerticalTabbed_tabs_li_active","ipsfilterbar_item","ipsfilterbar_active","but_secondary","paginationBackForward","ipsSideBlock","ipsSideBlock_h3","statusupdate","entry_header"],"text":["a"],"secondary":["but_submit","searchbutton","but_topic"],"tertiary":["sideMenuActive","paginationBackForwardHover","paginationBackActive"]},"classes":{"app_calendar_td_selected":["#calendar_table td.selected","Calendar Selected Cell","Used for selected cells in the monthly calendar",{"background":["#E2E9F0",""],"shadow":["#E2E9F0",""]}],"app_calendar_td_hover":["#calendar_table td.normal:hover","Calendar Cell Hover","Used for hovering over cells in the monthly calendar",{"background":["#EDF1F5",""]}],"app_calendar_td_blank":["#calendar_table td.blank","Calendar Blank Cell","Used for blank cells in the monthly calendar",{"background":["#dbe2e8",""],"border":["#dbe2e8",""]}],"app_calendar_td_today":["#calendar_table td.today","Calendar Today Cell","Used for todays cell in the monthly calendar",{"background":["#f1f6ec",""],"border":["#6f8f52",""],"color":["#6f8f52",""]}],"albumDetailTable_td":["#albumDetailTable td","Album Detail Table","Thick border for detail table",{"border":["#ebf0f3",""]}],"body":["html, body","Body","The page background",{"background":["#d8dde8",""],"color":["#5a5a5a",""]}],"a":["a","Links","Basic links",{"color":["#225985",""]}],"content":["#content","Main Content Area","The area that contains all page content",{"background":["#fff",""]}],"row1":[".row1, .post_block.row1","Table Row 1","Generic table row color 1",{"background":["#fff",""]}],"row2":[".row2, .post_block.row2","Table Row 2","Generic table row color 2",{"background":["#f1f6f9",""]}],"unread":[".unread","Unread Row","Unread row colour",{"background":["#f7fbfc",""]}],"unreadalt":[".unread .altrow, .unread.altrow","Unread Row (Alt)","Darker version of unread row, used to highlight certain table columns",{"background":["#E2E9F0",""]}],"ipsbox":[".ipsBox","Content Box","Used to wrap most content sections",{"background":["#ebf0f3",""]}],"Bar Header":[".bar","Bar Header","Used in post forms, etc",{"background":["#eff4f7",""]}],"tableheader":[".header","Table Header","Used for table headings",{"background":["#b6c7db",""],"color":["#1d3652",""]}],"tableheader_a":["body .ipb_table .header a,\tbody .topic_options a","Table Header Link","Used for links in table headings",{"color":["#1d3652",""]}],"postblock":[".post_block","Post Block","An individual post wrapper",{"background":["#fff",""],"border":["#D6E2EB",""]}],"NoMessages":[".no_messages","No Messages Box","Box for 'no data' type messages",{"background":["#f6f8fa",""],"border":false}],"but_submit":[".input_submit","Submit Button","The primary button that submits forms",{"background":["#212121",""],"border":["#5c5c5c",""],"color":["#fff",""],"boxshadow":["#5c5c5c"," inset 0 1px 0 0 "]}],"but_submit_alt":[".input_submit.alt","Alternate Submit Button","Secondary buttons for forms",{"background":["#e2e9f0",""],"border":["#dae2ea",""],"color":["#464646",""],"boxshadow":["#eff3f8"," inset 0 1px 0 0 "]}],"fieldsetSubmit":["body#ipboard_body fieldset.submit,body#ipboard_body p.submit","Submit\/Button Strip","Used in forms where the submit buttons
Line truncated
|
||||
_Dark_;
|
||||
return $json;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -5,6 +5,6 @@
|
||||
<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>
|
||||
IP.Board
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,479 +1,479 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.4.5
|
||||
* Primary controller
|
||||
* Last Updated: $LastChangedDate: 2012-05-10 16:10:13 -0400 (Thu, 10 May 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: 10721 $
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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 не существует!" );
|
||||
}
|
||||
}
|
||||
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 );
|
||||
}
|
||||
}
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.4.6
|
||||
* Primary controller
|
||||
* Last Updated: $LastChangedDate: 2012-05-10 16:10:13 -0400 (Thu, 10 May 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: 10721 $
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
+4396
-4478
File diff suppressed because it is too large.
Load diff
@@ -3,7 +3,7 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.4.5
|
||||
* IP.Board v3.4.6
|
||||
* Mobile app methods
|
||||
* Last Updated: $LastChangedDate: 2012-05-21 07:52:30 -0400 (Mon, 21 May 2012) $
|
||||
* </pre>
|
||||
|
||||
+4762
-4819
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user