Version 4.1.2
This commit is contained in:
1 parent
3ba79295ee
commit
28bd025b35
1131 files changed
+63658
-20579
No files matched your search
@@ -53,15 +53,14 @@ class _Table extends \IPS\Helpers\Table\Db
|
||||
|
||||
if( is_subclass_of( $className, 'IPS\Content\Item' ) )
|
||||
{
|
||||
$this->rowsTemplate = $className::contentTableTemplate();
|
||||
$this->rowsTemplate = $className::manageFollowRows();
|
||||
$containerClass = $className::$containerNodeClass;
|
||||
$this->group = 'follow_id';
|
||||
|
||||
$this->joins = array(
|
||||
array( 'from' => 'core_permission_index', 'where' => array( "core_permission_index.app=? AND core_permission_index.perm_type=?", $containerClass::$permApp, $containerClass::$permType ) ),
|
||||
$this->joins = array(
|
||||
array( 'from' => $className::$databaseTable, 'where' => array( $className::$databaseTable . '.' . $className::$databasePrefix . $className::$databaseColumnId . '=core_follow.follow_rel_id AND core_follow.follow_app=?', $currentType[0] ) )
|
||||
);
|
||||
|
||||
|
||||
/* Exclude hidden items */
|
||||
if ( in_array( 'IPS\Content\Hideable', class_implements( $className ) ) and !$className::canViewHiddenItems() )
|
||||
{
|
||||
@@ -78,6 +77,17 @@ class _Table extends \IPS\Helpers\Table\Db
|
||||
}
|
||||
}
|
||||
|
||||
/* Additional where */
|
||||
$joinContainer = $className::$containerNodeClass ? TRUE : FALSE;
|
||||
$joins = array();
|
||||
$extraWhere = $className::followWhere( $joinContainer, $joins );
|
||||
|
||||
if ( $joinContainer )
|
||||
{
|
||||
$containerClass = $className::$containerNodeClass;
|
||||
$this->joins[] = array( 'from' => $containerClass::$databaseTable, 'where' => $containerClass::$databaseTable . '.' . $containerClass::$databasePrefix . $containerClass::$databaseColumnId . '=' . $className::$databaseTable . '.' . $className::$databasePrefix . $className::$databaseColumnMap['container'], 'type' => 'STRAIGHT_JOIN' );
|
||||
}
|
||||
|
||||
/* Permissions */
|
||||
if ( in_array( 'IPS\Content\Permissions', class_implements( $className ) ) )
|
||||
{
|
||||
@@ -85,10 +95,9 @@ class _Table extends \IPS\Helpers\Table\Db
|
||||
$this->where[0] .= ' AND (' . \IPS\Db::i()->findInSet( 'core_permission_index.perm_' . $containerClass::$permissionMap['view'], \IPS\Member::loggedIn()->groups ) . ' OR core_permission_index.perm_' . $containerClass::$permissionMap['view'] . "='*' )";
|
||||
}
|
||||
|
||||
/* Additional where */
|
||||
$joinContainer = FALSE;
|
||||
$joins = array();
|
||||
if ( $extraWhere = $className::followWhere( $joinContainer, $joins ) )
|
||||
$this->joins[] = array( 'from' => 'core_permission_index', 'where' => array( "core_permission_index.app=? AND core_permission_index.perm_type=? AND core_permission_index.perm_type_id=" . $containerClass::$databaseTable . '.' . $containerClass::$databasePrefix . $containerClass::$databaseColumnId, $containerClass::$permApp, $containerClass::$permType ) );
|
||||
|
||||
if ( $extraWhere )
|
||||
{
|
||||
if( isset( $extraWhere['item'] ) )
|
||||
{
|
||||
@@ -104,11 +113,7 @@ class _Table extends \IPS\Helpers\Table\Db
|
||||
$this->where = array_merge( array( $this->where ), $extraWhere );
|
||||
}
|
||||
}
|
||||
if ( $joinContainer )
|
||||
{
|
||||
$containerClass = $className::$containerNodeClass;
|
||||
$this->joins[] = array( 'from' => $containerClass::$databaseTable, 'where' => $containerClass::$databaseTable . '.' . $containerClass::$databasePrefix . $containerClass::$databaseColumnId . '=' . $className::$databaseTable . '.' . $className::$databasePrefix . $className::$databaseColumnMap['container'] );
|
||||
}
|
||||
|
||||
$this->joins = array_merge( $this->joins, $joins );
|
||||
}
|
||||
elseif( $className == "\IPS\Member" )
|
||||
@@ -117,17 +122,17 @@ class _Table extends \IPS\Helpers\Table\Db
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->rowsTemplate = $className::nodeTableTemplate();
|
||||
$this->rowsTemplate = $className::manageFollowNodeRow();
|
||||
|
||||
$this->joins = array(
|
||||
array( 'from' => 'core_permission_index', 'where' => array( "core_permission_index.app=? AND core_permission_index.perm_type=? AND core_permission_index.perm_type_id=?", $className::$permApp, $className::$permType, $className::$databaseTable . '.' . $className::$databasePrefix . $className::$databaseColumnId ) ),
|
||||
array( 'from' => $className::$databaseTable, 'where' => array( $className::$databaseTable . '.' . $className::$databasePrefix . $className::$databaseColumnId . '=follow_rel_id AND follow_app=?', $currentType[0] ) ),
|
||||
array( 'from' => 'core_permission_index', 'where' => array( "core_permission_index.app=? AND core_permission_index.perm_type=? AND core_permission_index.perm_type_id=" . $className::$databaseTable . '.' . $className::$databasePrefix . $className::$databaseColumnId, $className::$permApp, $className::$permType ) ),
|
||||
);
|
||||
|
||||
/* Permission check? */
|
||||
if ( in_array( 'IPS\Node\Permissions', class_implements( $className ) ) )
|
||||
{
|
||||
$this->where[1] .= ' AND (' . \IPS\Db::i()->findInSet( 'core_permission_index.perm_' . $className::$permissionMap['view'], \IPS\Member::loggedIn()->groups ) . ' OR ' . 'core_permission_index.perm_' . $className::$permissionMap['view'] . "='*' )";
|
||||
$this->where[0] .= ' AND (' . \IPS\Db::i()->findInSet( 'core_permission_index.perm_' . $className::$permissionMap['view'], \IPS\Member::loggedIn()->groups ) . ' OR ' . 'core_permission_index.perm_' . $className::$permissionMap['view'] . "='*' )";
|
||||
}
|
||||
|
||||
/* Additional where */
|
||||
|
||||
Reference in new issue
Block a user