Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -11,7 +11,7 @@
|
||||
namespace IPS\core;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -56,11 +56,68 @@ class _Application extends \IPS\Application
|
||||
$this->clubs = \IPS\Db::i()->select( 'COUNT(*)', 'core_clubs', array( 'approved=0' ) )->first();
|
||||
}
|
||||
return $this->clubs;
|
||||
|
||||
case 'themes':
|
||||
case 'applications':
|
||||
case 'plugins':
|
||||
case 'languages':
|
||||
return $this->_getUpdateCount( $queryString['controller'] );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ACP Menu JSON for this application.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function acpMenu()
|
||||
{
|
||||
$menu = parent::acpMenu();
|
||||
|
||||
if ( \IPS\DEMO_MODE )
|
||||
{
|
||||
unset( $menu['support'] );
|
||||
}
|
||||
|
||||
$categories = ( new \IPS\core\modules\admin\marketplace\marketplace )->hierarchicalCategoryTree();
|
||||
|
||||
foreach( $categories as $c )
|
||||
{
|
||||
$menu[ 'mp_' . $c['id'] ][ 'all' ] = array(
|
||||
'tab' => 'marketplace',
|
||||
'module_url' => 'marketplace',
|
||||
'controller' => 'marketplace',
|
||||
'do' => 'viewCategory&id=' . $c['id'],
|
||||
'restriction' => 'marketplace_manage',
|
||||
'restriction_module' => 'marketplace',
|
||||
'menu_checks' => array( 'do' => 'viewCategory', 'id' => $c['id'] ),
|
||||
'menu_controller' => 'all'
|
||||
);
|
||||
|
||||
foreach( $c['children'] as $ch )
|
||||
{
|
||||
$menu[ 'mp_' . $c['id'] ][ $ch['id'] ] = array(
|
||||
'tab' => 'marketplace',
|
||||
'module_url' => 'marketplace',
|
||||
'controller' => 'marketplace',
|
||||
'do' => 'viewCategory&id=' . $ch['id'],
|
||||
'restriction' => 'marketplace_manage',
|
||||
'restriction_module' => 'marketplace',
|
||||
'menu_checks' => array( 'do' => 'viewCategory', 'id' => $ch['id'] ),
|
||||
'menu_controller' => $ch['id']
|
||||
);
|
||||
|
||||
\IPS\Member::loggedIn()->language()->words[ 'menu__core_mp_' . $c['id'] . '_' . $ch['id'] ] = $ch['name'];
|
||||
}
|
||||
\IPS\Member::loggedIn()->language()->words[ 'menu__core_mp_' . $c['id'] ] = $c['name'];
|
||||
\IPS\Member::loggedIn()->language()->words[ 'menu__core_mp_' . $c['id'] . '_all' ] = 'All ' . $c['name'];
|
||||
}
|
||||
|
||||
return $menu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the custom badge for each row
|
||||
*
|
||||
@@ -73,7 +130,7 @@ class _Application extends \IPS\Application
|
||||
if ( $return )
|
||||
{
|
||||
$availableUpgrade = $this->availableUpgrade( TRUE, FALSE );
|
||||
$return[2] = \IPS\Theme::i()->getTemplate( 'global', 'core' )->updatebadge( $availableUpgrade['version'], \IPS\Http\Url::internal( 'app=core&module=system&controller=upgrade', 'admin' ), $availableUpgrade['released'], FALSE );
|
||||
$return[2] = \IPS\Theme::i()->getTemplate( 'global', 'core' )->updatebadge( $availableUpgrade['version'], \IPS\Http\Url::internal( 'app=core&module=system&controller=upgrade', 'admin' ), (string) \IPS\DateTime::ts( $availableUpgrade['released'] )->localeDate(), FALSE );
|
||||
}
|
||||
|
||||
return $return;
|
||||
@@ -100,6 +157,11 @@ class _Application extends \IPS\Application
|
||||
/* Save installed domain to spam defense whitelist */
|
||||
$domain = rtrim( str_replace( 'www.', '', parse_url( \IPS\Settings::i()->base_url, PHP_URL_HOST ) ), '/' );
|
||||
\IPS\Db::i()->insert( 'core_spam_whitelist', array( 'whitelist_type' => 'domain', 'whitelist_content' => $domain, 'whitelist_date' => time(), 'whitelist_reason' => 'Invision Community Domain' ) );
|
||||
|
||||
if ( \IPS\CIC2 )
|
||||
{
|
||||
\IPS\Cicloud\postInstall();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,7 +177,7 @@ class _Application extends \IPS\Application
|
||||
return (
|
||||
$module->key == 'system'
|
||||
and
|
||||
in_array( $controller, array( 'login', 'register', 'lostpass', 'terms', 'ajax', 'privacy', 'editor', 'language', 'theme', 'redirect', 'guidelines', 'announcement' ) )
|
||||
\in_array( $controller, array( 'login', 'register', 'lostpass', 'terms', 'ajax', 'privacy', 'editor', 'language', 'theme', 'redirect', 'guidelines', 'announcement', 'metatags', 'marketplace' ) )
|
||||
)
|
||||
or
|
||||
(
|
||||
@@ -137,12 +199,14 @@ class _Application extends \IPS\Application
|
||||
$module->key == 'system'
|
||||
and
|
||||
(
|
||||
in_array( $controller, array(
|
||||
\in_array( $controller, array(
|
||||
'login', // Because you can login when offline
|
||||
'embed', // Because the offline message can contain embedded media
|
||||
'lostpass',
|
||||
'register',
|
||||
'announcement' // Announcements can be useful when the site is offline
|
||||
'announcement', // Announcements can be useful when the site is offline
|
||||
'redirect', // When email tracking is enabled we pass through here
|
||||
'marketplace', // Remote services needs to send data back
|
||||
) )
|
||||
or
|
||||
(
|
||||
@@ -229,13 +293,13 @@ class _Application extends \IPS\Application
|
||||
}
|
||||
|
||||
/* Convert &showuser= */
|
||||
if ( isset( \IPS\Request::i()->showuser ) and is_numeric( \IPS\Request::i()->showuser ) )
|
||||
if ( isset( \IPS\Request::i()->showuser ) and \is_numeric( \IPS\Request::i()->showuser ) )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=members&controller=profile&id=' . \IPS\Request::i()->showuser ) );
|
||||
}
|
||||
|
||||
/* Redirect ?app=core&module=attach§ion=attach&attach_rel_module=post&attach_id= */
|
||||
if ( isset( \IPS\Request::i()->app ) AND \IPS\Request::i()->app == 'core' AND isset( \IPS\Request::i()->controller ) AND \IPS\Request::i()->controller == 'attach' AND isset( \IPS\Request::i()->attach_id ) AND is_numeric( \IPS\Request::i()->attach_id ) )
|
||||
if ( isset( \IPS\Request::i()->app ) AND \IPS\Request::i()->app == 'core' AND isset( \IPS\Request::i()->controller ) AND \IPS\Request::i()->controller == 'attach' AND isset( \IPS\Request::i()->attach_id ) AND \is_numeric( \IPS\Request::i()->attach_id ) )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "applications/core/interface/file/attachment.php?id=" . \IPS\Request::i()->attach_id, 'none' ) );
|
||||
}
|
||||
@@ -252,8 +316,14 @@ class _Application extends \IPS\Application
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=discover&controller=streams' ) );
|
||||
}
|
||||
|
||||
/* redirect old message link */
|
||||
if( isset( \IPS\Request::i()->app ) AND \IPS\Request::i()->app == 'members' AND isset( \IPS\Request::i()->module ) AND ( \IPS\Request::i()->module == 'messaging' ) AND \IPS\Request::i()->controller == 'view' AND isset( \IPS\Request::i()->topicID ) )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=messaging&controller=messenger&id=' . \IPS\Request::i()->topicID, 'front', 'messenger_convo' ) );
|
||||
}
|
||||
|
||||
/* redirect old messenger link */
|
||||
if( isset( \IPS\Request::i()->app ) AND \IPS\Request::i()->app == 'members' AND isset( \IPS\Request::i()->module ) AND (\IPS\Request::i()->module == 'messaging' ) )
|
||||
if( isset( \IPS\Request::i()->app ) AND \IPS\Request::i()->app == 'members' AND isset( \IPS\Request::i()->module ) AND ( \IPS\Request::i()->module == 'messaging' ) )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=messaging&controller=messenger', 'front', 'messaging' ) );
|
||||
}
|
||||
@@ -397,4 +467,118 @@ class _Application extends \IPS\Application
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an array of specific links to add to the sitemap
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function sitemapLinks()
|
||||
{
|
||||
$return = array(
|
||||
\IPS\Http\Url::internal( 'app=core&module=system&controller=cookies', 'front', 'cookies' ),
|
||||
\IPS\Http\Url::internal( 'app=core&module=system&controller=terms', 'front', 'terms' ),
|
||||
);
|
||||
|
||||
if( \IPS\Settings::i()->gl_type != 'none' )
|
||||
{
|
||||
$return[] = \IPS\Http\Url::internal( 'app=core&module=system&controller=guidelines', 'front', 'guidelines' );
|
||||
}
|
||||
|
||||
if( \IPS\Settings::i()->privacy_type != 'none' )
|
||||
{
|
||||
$return[] = \IPS\Http\Url::internal( 'app=core&module=system&controller=privacy', 'front', 'privacy' );
|
||||
}
|
||||
|
||||
$guest = new \IPS\Member;
|
||||
if( $guest->canAccessModule( \IPS\Application\Module::get( 'core', 'staffdirectory', 'front' ) ) )
|
||||
{
|
||||
$return[] = \IPS\Http\Url::internal( 'app=core&module=staffdirectory&controller=directory', 'front', 'staffdirectory' );
|
||||
}
|
||||
|
||||
if ( \IPS\Settings::i()->reputation_enabled and \IPS\Settings::i()->reputation_leaderboard_on )
|
||||
{
|
||||
$return[] = \IPS\Http\Url::internal( 'app=core&module=discover&controller=popular&tab=leaderboard', 'front', 'leaderboard_leaderboard' );
|
||||
$return[] = \IPS\Http\Url::internal( 'app=core&module=discover&controller=popular&tab=history', 'front', 'leaderboard_history' );
|
||||
$return[] = \IPS\Http\Url::internal( 'app=core&module=discover&controller=popular&tab=members', 'front', 'leaderboard_members' );
|
||||
}
|
||||
|
||||
if ( \IPS\Settings::i()->clubs )
|
||||
{
|
||||
$return[] = \IPS\Http\Url::internal( 'app=core&module=clubs&controller=directory', 'front', 'clubs_list' );
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get AdminCP Menu Count for resource updates
|
||||
*
|
||||
* @param string $type resource type (applications/plugins/languages/themes)
|
||||
* @return int
|
||||
*/
|
||||
protected function _getUpdateCount( string $type ): int
|
||||
{
|
||||
$key = "updatecount_{$type}";
|
||||
if( isset( \IPS\Data\Store::i()->$key ) )
|
||||
{
|
||||
return \IPS\Data\Store::i()->$key;
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
switch( $type )
|
||||
{
|
||||
case 'applications':
|
||||
foreach( \IPS\Application::applications() as $app )
|
||||
{
|
||||
if( \count( $app->availableUpgrade( TRUE ) ) )
|
||||
{
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'plugins':
|
||||
foreach( \IPS\Plugin::plugins() as $plugin )
|
||||
{
|
||||
if( $plugin->update_check_data )
|
||||
{
|
||||
$data = json_decode( $plugin->update_check_data, TRUE );
|
||||
if( !empty( $data['longversion'] ) AND $data['longversion'] > $plugin->version_long )
|
||||
{
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'languages':
|
||||
foreach( \IPS\Lang::languages() as $language )
|
||||
{
|
||||
if( $language->update_data )
|
||||
{
|
||||
$data = json_decode( $language->update_data, TRUE );
|
||||
if( !empty( $data['longversion'] ) AND $data['longversion'] > $language->version_long )
|
||||
{
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'themes':
|
||||
foreach( \IPS\Theme::themes() as $theme )
|
||||
{
|
||||
if( $theme->update_data )
|
||||
{
|
||||
$data = json_decode( $theme->update_data, TRUE );
|
||||
if( !empty( $data['longversion'] ) AND $data['longversion'] > $theme->long_version )
|
||||
{
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
\IPS\Data\Store::i()->$key = $count;
|
||||
return (int) \IPS\Data\Store::i()->$key;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user