Version 4.1.2

This commit is contained in:
Neo committed 2025-12-19 05:32:19 -08:00
1 parent 3ba79295ee
commit 28bd025b35
1131 files changed
+63658 -20579

No files matched your search

+93 -30
View File
@@ -16,9 +16,10 @@ spl_autoload_register( function( $class )
if ( mb_substr( $class, 0, 15 ) === 'IPS\cms\Records' and is_numeric( mb_substr( $class, 15, 1 ) ) )
{
$databaseId = mb_substr( $class, 15 );
$titleField = \IPS\cms\Databases::load( $databaseId )->field_title;
$contentField = \IPS\cms\Databases::load( $databaseId )->field_content;
$titleLang = 'content_db_lang_sl_' . $databaseId;
$databases = \IPS\cms\Databases::databases();
$titleField = $databases[ $databaseId ]->field_title;
$contentField = $databases[ $databaseId ]->field_content;
$titleLang = 'content_db_lang_su_' . $databaseId;
$data = <<<EOF
namespace IPS\cms;
@@ -62,6 +63,7 @@ spl_autoload_register( function( $class )
'last_review_name' => 'record_last_review_name',
'updated' => 'record_last_comment'
);
public static \$pagePath;
}
EOF;
eval( $data );
@@ -75,6 +77,7 @@ EOF;
namespace IPS\cms\Records;
class Comment{$databaseId} extends Comment
{
protected static \$multitons = array();
public static \$customDatabaseId = $databaseId;
public static \$itemClass = 'IPS\cms\Records{$databaseId}';
public static \$title = 'content_record_comments_title_{$databaseId}';
@@ -91,6 +94,7 @@ EOF;
namespace IPS\cms\Records;
class Review{$databaseId} extends Review
{
protected static \$multitons = array();
public static \$customDatabaseId = $databaseId;
public static \$itemClass = 'IPS\cms\Records{$databaseId}';
public static \$title = 'content_record_reviews_title_{$databaseId}';
@@ -107,8 +111,10 @@ EOF;
namespace IPS\cms;
class Categories{$databaseId} extends Categories
{
protected static \$multitons = array();
public static \$customDatabaseId = $databaseId;
public static \$contentItemClass = 'IPS\cms\Records{$databaseId}';
protected static \$containerIds = NULL;
}
EOF;
@@ -123,6 +129,7 @@ EOF;
namespace IPS\cms\Records;
class RecordsTopicSync{$databaseId} extends \IPS\cms\Records{$databaseId}
{
protected static \$multitons = array();
public static \$customDatabaseId = $databaseId;
public static \$databaseTable = 'cms_custom_database_{$databaseId}';
public static \$databaseColumnId = 'record_topicid';
@@ -145,6 +152,7 @@ EOF;
namespace IPS\cms\Records;
class CommentTopicSync{$databaseId} extends CommentTopicSync
{
protected static \$multitons = array();
public static \$customDatabaseId = $databaseId;
public static \$itemClass = 'IPS\cms\Records\RecordsTopicSync{$databaseId}';
public static \$title = 'content_record_comments_title_{$databaseId}';
@@ -233,8 +241,8 @@ class _Application extends \IPS\Application
* @return array
*/
public function extensions( $app, $extension, $construct=TRUE, $checkAccess=FALSE )
{
$classes = parent::extensions( $app, $extension, $construct );
{
$classes = parent::extensions( $app, $extension, $construct, $checkAccess );
if ( $extension === 'EditorLocations' )
{
@@ -254,35 +262,12 @@ class _Application extends \IPS\Application
{
try
{
$classes[ 'Records' . $obj->_id ] = new $classname;
$classes[ 'Records' . $obj->_id ] = new $classname( $checkAccess === TRUE ? \IPS\Member::loggedIn() : ( $checkAccess === FALSE ? NULL : $checkAccess ) );
}
catch( \RuntimeException $e ){}
}
}
}
else if ( $checkAccess and $extension === 'ContentRouter' )
{
if ( isset( $classes['Records'] ) )
{
foreach ( $classes['Records']->classes as $id => $name )
{
if ( ! $name::database()->can( 'view' ) )
{
unset( $classes['Records']->classes[ $id ] );
continue;
}
if ( isset( $name::$reviewClass ) and ! $name::database()->options['reviews'] )
{
$_class = $classes['Records']->classes[ $id ];
if ( class_exists( $_class ) )
{
$_class::$reviewClass = NULL;
}
}
}
}
}
return $classes;
}
@@ -375,12 +360,48 @@ class _Application extends \IPS\Application
$database->search = 1;
$database->comment_bump = 1; # Just new comments bump record
$database->rss = 1;
$database->fixed_field_perms = array( 'record' => array( 'visible' => true, 'perm_view' => '*', 'perm_2' => '*', 'perm_3' => '*' ) );
$database->options['comments'] = 1;
$database->field_sort = 'primary_id_field';
$database->field_direction = 'asc';
$database->field_perpage = 25;
$database->save();
/* Create default record */
$item = 'IPS\cms\Records' . $database->id;
$comment = 'IPS\cms\Records\Comment' . $database->id;
$container = 'IPS\cms\Categories' . $database->id;
$link = (string) \IPS\Http\Url::ips('pages_docs');
$content = <<<EOF
<p>Welcome to Pages!</p>
<p>Pages extends your site with custom content management designed especially for communities.
Create brand new sections of your community using features like blocks, databases and articles,
pulling in data from other areas of your community.</p>
<p>Create custom pages in your community using our drag'n'drop, WYSIWYG editor.
Build blocks that pull in all kinds of data from throughout your community to create dynamic pages,
or use one of the ready-made widgets we include with the IPS Community Suite.</p>
<p><br></p>
<p><a href="{$link}">View our Pages documentation</a></p>
EOF;
$titleField = 'field_' . $database->field_title;
$contentField = 'field_' . $database->field_content;
$category = $container::load( $database->_default_category );
$member = \IPS\Member::loggedIn()->member_id ? \IPS\Member::loggedIn() : \IPS\Member::load(1);
$record = $item::createItem( $member, \IPS\Request::i()->ipAddress(), \IPS\DateTime::ts( time() ), $category, FALSE );
$record->$titleField = "Welcome to Pages";
$record->$contentField = $content;
$record->save();
\IPS\Content\Search\Index::i()->index( $record );
$category->last_record_date = time();
$category->save();
/* Create the page */
$pageValues = array(
'page_name' => "Articles",
@@ -389,13 +410,55 @@ class _Application extends \IPS\Application
'page_folder_id' => 0,
'page_ipb_wrapper' => 1,
'page_show_sidebar' => 1,
'page_content' => '{database="' . $database->id . '"}',
'page_type' => 'builder',
'page_template' => 'page_builder__single_column__page_page_builder_single_column'
);
$page = \IPS\cms\Pages\Page::createFromForm( $pageValues, 'html' );
$page->setAsDefault();
$database->page_id = $page->id;
$database->save();
unset( \IPS\Data\Store::i()->pages_page_urls );
$defaultWidgets = array();
$buttonUrl = (string) \IPS\Http\Url::internal( 'applications/cms/interface/default/block_arrow.png', 'none' );
$defaultContent = <<<EOF
<p>
<strong>Welcome to Pages!</strong>
</p>
<p>
To get started, make sure you are logged in and click the arrow on the left hand side <img src="{$buttonUrl}"> to expand the block manager.
<br>
You can move, add and edit blocks without the need for complex coding!
</p>
EOF;
/* Default WYSIWYG widget */
$defaultWidgets[] = array(
'app' => 'cms',
'key' => 'Wysiwyg',
'unique' => uniqid(),
'configuration' => array( 'content' => $defaultContent )
);
/* Default database widget */
$defaultWidgets[] = array(
'app' => 'cms',
'key' => 'Database',
'unique' => uniqid(),
'configuration' => array( 'database' => $database->id )
);
\IPS\Db::i()->insert( 'cms_page_widget_areas', array(
'area_page_id' => $page->id,
'area_widgets' => json_encode( $defaultWidgets ),
'area_area' => 'col1',
'area_orientation' => 'horizontal'
) );
/* Add block container (custom)*/
$container = new \IPS\cms\Blocks\Container;
$container->parent_id = 0;