Version 4.2.0

This commit is contained in:
Neo committed 2025-12-19 05:44:59 -08:00
1 parent 0dc2aee5ed
commit 96997ddd8e
2074 files changed
+125454 -55780

No files matched your search

@@ -1,13 +1,12 @@
<?php
/**
* @brief Categories Model
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Content
* @since 8 April 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\cms;
@@ -248,27 +247,24 @@ class _Categories extends \IPS\Node\Model implements \IPS\Node\Permissions
return in_array( $id, static::$containerIds );
}
/**
* @brief Cache of categories we've fetched
*/
protected static $cache = array();
/**
* Fetch All Root Nodes
*
* @param string|NULL $permissionCheck The permission key to check for or NULl to not check permissions
* @param \IPS\Member|NULL $member The member to check permissions for or NULL for the currently logged in member
* @param mixed $where Additional WHERE clause
* @param mixed $databaseId Grab categories from a specific database
* @return array
*/
public static function roots( $permissionCheck='view', $member=NULL, $where=array(), $databaseId=null )
public static function roots( $permissionCheck='view', $member=NULL, $where=array() )
{
$permissionCheck = ( \IPS\Dispatcher::hasInstance() AND \IPS\Dispatcher::i()->controllerLocation === 'admin' ) ? NULL : $permissionCheck;
if ( $databaseId === NULL and static::$customDatabaseId !== NULL )
if ( static::$customDatabaseId !== NULL )
{
$databaseId = static::$customDatabaseId;
}
if ( $databaseId !== NULL )
{
$where[] = array('category_database_id=?', $databaseId );
$where[] = array('category_database_id=?', static::$customDatabaseId );
}
return parent::roots( $permissionCheck, $member, $where );
@@ -886,7 +882,14 @@ class _Categories extends \IPS\Node\Model implements \IPS\Node\Permissions
}
}
}
$guestGroup = \IPS\Member\Group::load( \IPS\Settings::i()->guest_group );
if( !$this->can_view_others )
{
$disabled[ $guestGroup->g_id ] = array( 'view', 2, 3, 4, 5, 6, 7 );
}
return $disabled;
}
@@ -1768,7 +1771,7 @@ class _Categories extends \IPS\Node\Model implements \IPS\Node\Permissions
*/
public function metaDescription()
{
return $this->meta_description ?: parent::metaDescription();
return $this->meta_description ?: static::database()->metaDescription();
}
/**
@@ -1778,6 +1781,26 @@ class _Categories extends \IPS\Node\Model implements \IPS\Node\Permissions
*/
public function metaTitle()
{
return $this->page_title ?: parent::metaTitle();
return $this->page_title ?: static::database()->metaTitle();
}
/**
* Check permissions
*
* @param mixed $permission A key which has a value in static::$permissionMap['view'] matching a column ID in core_permission_index
* @param \IPS\Member|\IPS\Member\Group|NULL $member The member or group to check (NULL for currently logged in member)
* @return bool
* @throws \OutOfBoundsException If $permission does not exist in static::$permissionMap
*/
public function can( $permission, $member=NULL )
{
$_member = $member ?: \IPS\Member::loggedIn();
if ( !$_member->member_id and !$this->can_view_others )
{
return FALSE;
}
return parent::can( $permission, $member );
}
}