Version 3.4.5

This commit is contained in:
Neo committed 2025-12-19 00:38:12 -08:00
1 parent fb6b5baabc
commit e4478369d8
1360 files changed
+228921 -179445

No files matched your search

@@ -3,17 +3,17 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Admin Output Library
* Last Updated: $LastChangedDate: 2012-07-03 10:29:35 -0400 (Tue, 03 Jul 2012) $
* Last Updated: $LastChangedDate: 2013-05-20 16:38:23 -0400 (Mon, 20 May 2013) $
* </pre>
*
* @author $Author: ips_terabyte $
* @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
* @version $Rev: 11026 $
* @version $Rev: 12261 $
*
*/
@@ -31,8 +31,8 @@ class adminOutput extends output
*
* @var object
*/
public $global_template = '';
public $global_template = '';
/**#@+
* HTML variables
*
@@ -90,7 +90,15 @@ class adminOutput extends output
*
* @var array
*/
protected $tabKeys = array( 'core', 'forums', 'members', 'lookfeel', 'support', 'reports', 'other' );
private $tabKeys = array();
private $otherTabKeys = array();
private $tabPrefs = array();
/**
* Is bookmarkable
* @var boolean
*/
protected $_canBookmark = true;
/**
* Constructor
@@ -108,6 +116,10 @@ class adminOutput extends output
$this->settings['base_url'] = $this->settings['_original_base_url'];
$this->settings['public_url'] = $this->settings['_original_base_url'] . '/index.php?';
$this->settings['public_dir'] = $this->settings['_original_base_url'] . '/' . PUBLIC_DIRECTORY . '/';
$this->settings['public_cdn_url'] = rtrim( $this->settings['ipb_img_url'] ? $this->settings['ipb_img_url'] : $this->settings['_original_base_url'], '/' ) . '/' . PUBLIC_DIRECTORY . '/';
$this->settings['css_base_url'] = rtrim( $this->settings['ipb_css_url'] ? $this->settings['ipb_css_url'] : $this->settings['_original_base_url'], '/' ) . '/' . PUBLIC_DIRECTORY . '/';
$this->settings['js_base_url'] = rtrim( $this->settings['ipb_js_url'] ? $this->settings['ipb_js_url'] : $this->settings['_original_base_url'], '/' ) . '/' . PUBLIC_DIRECTORY . '/';
$this->settings['base_acp_url'] = $this->settings['base_url'] . '/' . CP_DIRECTORY;
$this->settings['skin_acp_url'] = $this->settings['base_url'] . '/' . CP_DIRECTORY . "/skin_cp";
@@ -139,6 +151,234 @@ class adminOutput extends output
$this->settings['extraJsModules'] = '';
}
/**
* Called in admin function constructor to prevent output init clashes
*/
public function initTabKeys()
{
/* Get tab prefs first */
$this->tabPrefs = $this->registry->adminFunctions->staffGetCookie( 'tabPrefs' );
/* Set up default tab keys */
$this->getMainTabKeys();
}
/**
* Returns keys for use in the main tab bar
* @return array:
*/
public function getMainTabKeys()
{
if ( ! count( $this->tabKeys ) )
{
if ( isset( $this->tabPrefs['tabBar'] ) && is_array( $this->tabPrefs['tabBar'] ) && count( $this->tabPrefs['tabBar'] ) )
{
$this->tabKeys = array_values( $this->tabPrefs['tabBar'] );
}
else
{
$this->tabKeys = array( 'core', 'forums', 'members', 'lookfeel', 'support', 'reports', 'other' );
}
}
return $this->tabKeys;
}
/**
* Returns keys for use in the other apps menu
* @return array:
*/
public function getOtherTabKeys()
{
$tmp = $this->registry->getClass('class_permissions')->return;
$this->registry->getClass('class_permissions')->return = TRUE; // We have to do this to stop the checkForAppAccess call below to end up sending a showError screen
$mainTabKeys = $this->getMainTabKeys();
if ( ! count( $this->otherTabKeys ) )
{
if ( isset( $this->tabPrefs['otherMenu'] ) && is_array( $this->tabPrefs['otherMenu'] ) && count( $this->tabPrefs['otherMenu'] ) )
{
$this->otherTabKeys = array_values( $this->tabPrefs['otherMenu'] );
/* Got all apps? Some could have been added after we last re-arranged tabs */
foreach( ipsRegistry::$applications as $app_dir => $app_data )
{
if ( $this->registry->getClass('class_permissions')->checkForAppAccess( $app_data['app_directory'] ) !== TRUE || ! $app_data['app_enabled'] )
{
continue;
}
if ( ! in_array( $app_dir, $mainTabKeys ) && ! in_array( $app_dir, $this->otherTabKeys ) )
{
$this->otherTabKeys[] = $app_data['app_directory'];
}
}
}
else
{
foreach( ipsRegistry::$applications as $app_dir => $app_data )
{
if ( in_array( $app_data['app_directory'], array( 'core', 'forums', 'members' ) ) || in_array( $app_data['app_directory'], $mainTabKeys ) || $this->registry->getClass('class_permissions')->checkForAppAccess( $app_data['app_directory'] ) !== TRUE || ! $app_data['app_enabled'] )
{
continue;
}
$this->otherTabKeys[] = $app_data['app_directory'];
}
}
}
$this->registry->getClass('class_permissions')->return = $tmp;
return $this->otherTabKeys;
}
/**
* Get tab data from keys
* @param array Array of keys to fetch data from
*/
public function getTabDataFromKeys( $keys )
{
$tmp = $this->registry->getClass('class_permissions')->return;
$this->registry->getClass('class_permissions')->return = TRUE; // We have to do this to stop the checkForAppAccess call below to end up sending a showError screen
$fakeApps = $this->fetchFakeApps();
$applications = ipsRegistry::$applications;
$defaultFakeApp = array();
$tabs = array();
$fakeActive = false;
/* Set up fake apps stuff */
foreach( $fakeApps as $fa => $data )
{
$_active = false;
$fakeAppAccess[ $fa ] = false;
$fakeAppActive[ $fa ] = false;
foreach( $data as $appData )
{
if ( ! $defaultFakeApp[ $fa ] )
{
$defaultFakeApp[ $fa ] = $appData['app'];
$defaultFakeModule[ $fa ] = $appData['module'];
}
if ( ! $fakeAppAccess[ $fa ] and ipsRegistry::getClass('class_permissions')->checkForModuleAccess( $appData['app'], $appData['module'] ) )
{
$fakeAppAccess[ $fa ] = true;
}
if ( $appData['app'] == ipsRegistry::$current_application && $appData['module'] == ipsRegistry::$current_module )
{
$fakeAppActive[ $fa ] = true;
$fakeActive = true;
}
}
}
foreach( $keys as $tabkey )
{
$gotIt = false;
/* Try 'other' first */
if ( $tabkey == 'other' )
{
$gotIt = true;
$tabs[ $tabkey ] = array( 'title' => $this->lang->words['other_applications'],
'active' => false,
'appDir' => false,
'isEnabled' => true,
'permCheck' => true,
'url' => "{$this->settings['_base_url']}app=core&amp;module=applications&amp;section=applications&amp;do=applications_overview" );
}
/* Try fake apps first */
foreach( $fakeApps as $fa => $data )
{
if ( $fa == $tabkey )
{
$gotIt = true;
switch( $fa )
{
case 'lookfeel':
$title = $this->lang->words['gl_lookandfeel'];
$link = "{$this->settings['_base_url']}app={$defaultFakeApp['lookfeel']}&amp;module={$defaultFakeModule['lookfeel']}";
break;
case 'support':
$title = $this->lang->words['gl_support'];
$link = "{$this->settings['_base_url']}app=core&amp;module=diagnostics";
break;
case 'reports':
$title = $this->lang->words['gl_reportsmenu'];
$link = "{$this->settings['_base_url']}app={$defaultFakeApp['reports']}&amp;module={$defaultFakeModule['reports']}";
break;
}
$tabs[ $tabkey ] = array( 'title' => $title,
'permCheck' => $fakeAppAccess[ $fa ],
'active' => $fakeAppActive[ $fa ],
'appDir' => $defaultFakeApp[ $fa ],
'isEnabled' => true,
'url' => $link );
}
}
/* Try normal apps next */
if ( $gotIt === false )
{
/* Loop */
foreach( $applications as $app_dir => $app_data )
{
switch( $app_data['app_directory'] )
{
case 'core':
$app_data['app_title'] = $this->lang->words['gl_system'];
break;
case 'forums':
$app_data['app_title'] = $this->lang->words['gl_forums'];
break;
case 'members':
$app_data['app_title'] = $this->lang->words['gl_members'];
break;
}
if ( $tabkey == $app_data['app_directory'] )
{
$tabs[ $tabkey ] = array( 'title' => $app_data['app_title'],
'active' => ( $fakeActive === false && ipsRegistry::$current_application == $app_data['app_directory'] ) ? true : false,
'permCheck' => ipsRegistry::getClass('class_permissions')->checkForAppAccess( $app_data['app_directory'] ),
'isEnabled' => (boolean) $app_data['app_enabled'],
'appDir' => $app_data['app_directory'],
'url' => "{$this->settings['_base_url']}app={$app_data['app_directory']}" );
}
}
}
}
$this->registry->getClass('class_permissions')->return = $tmp;
return $tabs;
}
/**
* Can bookmark this page
* @param boolean
*/
public function canBookmark( $bool )
{
$this->_canBookmark = (boolean) $bool;
}
/**
* Set a global message to be used
*
@@ -184,13 +424,42 @@ class adminOutput extends output
IPSDebug::setMemoryDebugFlag( "CORE: Template Loaded ({$classToLoad})", $_pre_load );
return new $classToLoad( $this->registry );
$class = new $classToLoad( $this->registry );
$this->compiled_templates[ $app . '.' . $template ] = $class;
return $class;
}
else
{
$this->showError( sprintf( $this->lang->words['notemplatefiletoload'], $template ), 4100, true );
}
}
/**
* Returns a template class; loading if required
*
* @access public
* @param string template name
* @param boolean [Test only, TRUE for yes, FALSE for no]
* @return mixed Object, or null
*/
public function getXTemplate( $groupName )
{
if ( ! isset( $this->compiled_templates[ $groupName ] ) || ! is_object( $this->compiled_templates[ $groupName ] ) )
{
//-----------------------------------------
// Using self:: so that we can load public
// skins inside ACP when necessary
//-----------------------------------------
list( $app, $template ) = explode( '.', $groupName );
self::loadTemplate( $template, $app );
}
return isset( $this->compiled_templates[ $groupName ] ) ? $this->compiled_templates[ $groupName ] : NULL;
}
/**
* Show a download dialog box
@@ -387,7 +656,7 @@ class adminOutput extends output
* @param string Text to display
* @return @e void
*/
public function multipleRedirectFinish($text='Completed!')
public function multipleRedirectFinish($text='Завершено!')
{
print $this->global_template->global_redirect_done( $text );
exit();
@@ -403,7 +672,7 @@ class adminOutput extends output
* @param integer Header code to send (ignored for ACP)
* @return @e void
*/
public function showError( $message, $code=0, $logError=FALSE, $logExtra='', $header=500 )
public function showError( $message, $code=0, $logError=FALSE, $logExtra='', $header=401 )
{
$this->_sendOutputSetUp( 'error' );
@@ -433,7 +702,7 @@ class adminOutput extends output
}
}
}
//-----------------------------------------
// Log the error, if needed
//-----------------------------------------
@@ -449,13 +718,13 @@ class adminOutput extends output
$this->logErrorMessage( $_logMessage, $code );
}
//-----------------------------------------
// Send notification if needed
//-----------------------------------------
$this->sendErrorNotification( $message, $code );
//-----------------------------------------
// Finally, output
//-----------------------------------------
@@ -474,6 +743,15 @@ class adminOutput extends output
public function sendOutput( $return=false )
{
$this->_sendOutputSetUp( 'normal' );
//-----------------------------------------
// Hang on, is IP.SEO still installed?
//-----------------------------------------
if ( IPSLib::appIsInstalled('ipseo') and !in_array( ipsRegistry::$request['section'], array( 'upgrade', 'applications' ) ) )
{
$this->silentRedirect( $this->settings['_base_url'] . 'app=core&amp;module=seo&amp;section=upgrade' );
}
//---------------------------------------
// INIT
@@ -494,7 +772,7 @@ class adminOutput extends output
$this->printPopupWindow();
exit();
}
//-----------------------------------------
// Debug?
//-----------------------------------------
@@ -541,19 +819,31 @@ class adminOutput extends output
}
}
/**
* Add in bookmarkables
*/
require_once( IPS_ROOT_PATH . 'sources/classes/admin/bookmarks.php' );
$bookmarks = new classes_admin_bookmarks();
$_bookmarkData = array( 'url' => $bookmarks->cleanUrl( $this->settings['query_string_safe'] ),
'can' => ( $this->_canBookmark ? 'true' : 'false' ),
'has' => ( $bookmarks->hasBookmarked( $this->settings['query_string_safe'] ) ? 'true' : 'false' ),
'jsn' => $bookmarks->asJson() );
//-----------------------------------------
// Get tab order
//-----------------------------------------
$applications = ipsRegistry::$applications;
$mainTabs = $this->registry->output->getMainTabKeys();
$otherTabs = $this->registry->output->getOtherTabKeys();
$mainTabData = $this->registry->output->getTabDataFromKeys( $mainTabs );
$otherTabData = $this->registry->output->getTabDataFromKeys( $otherTabs );
$_tabOrder = ipsRegistry::getClass('adminFunctions')->staffGetCookie( 'tabOrder' );
if( !count($_tabOrder) OR !is_array($_tabOrder) )
{
$_tabOrder = $this->tabKeys;
}
$gbl_sub_menu = $this->_buildGlobalSubMenu();
$html = str_replace( '<%CONTENT%>', $this->html_main, $this->global_template->global_main_wrapper( IPS_DOC_CHAR_SET, $this->_css, $gbl_sub_menu, $_tabOrder ) );
$html = str_replace( '<%CONTENT%>', $this->html_main, $this->global_template->global_main_wrapper( IPS_DOC_CHAR_SET, $this->_css, $gbl_sub_menu, $mainTabData, $otherTabData, $_bookmarkData ) );
//------------------------------------------------
// Message in a bottle?
@@ -700,9 +990,12 @@ class adminOutput extends output
//-----------------------------------------
// Last thing, the nav element...
//-----------------------------------------
$html = str_replace( "<%PAGE_NAV%>", $_last_nav['title'], $html );
if ( isset( $_last_nav['title'] ) )
{
$html = str_replace( "<%PAGE_NAV%>", $_last_nav['title'], $html );
}
$query_html = "";
//-----------------------------------------
@@ -775,7 +1068,7 @@ class adminOutput extends output
}
$html = str_replace( "<%QUERIES%>" , $query_html , $html );
//-----------------------------------------
// Got BODY EXTRA?
//-----------------------------------------
@@ -791,6 +1084,9 @@ class adminOutput extends output
$html = str_replace( "<#EMO_DIR#>" , 'default' , $html );
/* Remove any public side hooks */
$html = preg_replace( '#<!--hook\.([^\>]+?)-->#', '', $html );
//-----------------------------------------
// Gzip?
//-----------------------------------------
@@ -1111,7 +1407,7 @@ class adminOutput extends output
if ( IN_DEV )
{
ipsRegistry::cache()->updateCacheWithoutSaving( 'app_menu_cache', array() );
//ipsRegistry::cache()->updateCacheWithoutSaving( 'app_menu_cache', array() );
}
if ( ! is_array( ipsRegistry::cache()->getCache('app_menu_cache') ) OR ! count( ipsRegistry::cache()->getCache('app_menu_cache') ) )
@@ -1236,7 +1532,7 @@ class adminOutput extends output
{
if( !$this->ignoreCoreNav )
{
$this->core_nav[] = array( $this->settings['base_url'] . 'module=' . $_current_module . '&amp;section=' . $item['section'], $module_data['title'] );
$this->core_nav[] = array( $this->settings['base_url'] . 'module=' . $_current_module . '&amp;section=' . $item['section'], $item['title'] );
}
$_nav_main_done = 1;
@@ -1260,11 +1556,11 @@ class adminOutput extends output
}
}
/* Reset */
$_ok = 0;
if ( $item['url'] )
{
/* Reset */
$_ok = 0;
/* Trying something a little different with the nav */
$_url = explode( '=', $item['url'] );
@@ -1338,7 +1634,7 @@ class adminOutput extends output
if ( IN_DEV )
{
ipsRegistry::cache()->updateCacheWithoutSaving( 'app_menu_cache', array() );
//ipsRegistry::cache()->updateCacheWithoutSaving( 'app_menu_cache', array() );
}
if ( ! is_array( ipsRegistry::cache()->getCache('app_menu_cache') ) OR ! count( ipsRegistry::cache()->getCache('app_menu_cache') ) )
@@ -1980,7 +2276,7 @@ class adminOutput extends output
$yes = "<span class='yesno_yes {$css}'><input type='radio' name='{$name}' value='1' {$y_js}{$id_yes} /><label for='{$id}_yes'>{$this->lang->words['yesno_yes']}</label></span>";
$no = "<span class='yesno_no {$css}'><input type='radio' name='{$name}' value='0' {$n_js}{$id_no} /><label for='{$id}_no'>{$this->lang->words['yesno_no']}</label></span>";
if ( $default_val == 1 )
if ( $default_val == "1" )
{
$yes = "<span class='yesno_yes {$css}'><input type='radio'{$id_yes} name='{$name}' value='1' {$y_js} checked='checked' /><label for='{$id}_yes'>{$this->lang->words['yesno_yes']}</label></span>";
}