Version 4.3.6

This commit is contained in:
Neo committed 2025-12-19 05:49:12 -08:00
1 parent fe1acf984a
commit 1a0c7fd3c2
609 files changed
+14707 -5726

No files matched your search

+2 -2
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<javascript app="blog">
<file javascript_app="blog" javascript_location="front" javascript_path="controllers/browse" javascript_name="ips.browse.grid.js" javascript_type="controller" javascript_version="103005" javascript_position="1000050"><![CDATA[/**
<file javascript_app="blog" javascript_location="front" javascript_path="controllers/browse" javascript_name="ips.browse.grid.js" javascript_type="controller" javascript_version="103038" javascript_position="1000050"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -37,7 +37,7 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="blog" javascript_location="front" javascript_path="controllers/browse" javascript_name="ips.browse.list.js" javascript_type="controller" javascript_version="103005" javascript_position="1000050">/**
<file javascript_app="blog" javascript_location="front" javascript_path="controllers/browse" javascript_name="ips.browse.list.js" javascript_type="controller" javascript_version="103038" javascript_position="1000050">/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<language>
<app key="blog" version="103005">
<app key="blog" version="103038">
<word key="__app_blog" js="0">Blogs</word>
<word key="frontnavigation_blogs" js="0">Blogs</word>
<word key="__indefart_blog_entry_comment" js="0">a comment on a blog entry</word>
+4 -4
View File
@@ -491,9 +491,9 @@
"comment": "",
"decimals": null,
"default": "0",
"length": 10,
"length": 20,
"name": "entry_author_id",
"type": "INT",
"type": "BIGINT",
"unsigned": false,
"values": [],
"zerofill": false
@@ -603,9 +603,9 @@
"comment": "",
"decimals": null,
"default": null,
"length": 10,
"length": 20,
"name": "entry_last_comment_mid",
"type": "INT",
"type": "BIGINT",
"unsigned": false,
"values": [],
"zerofill": false
+16 -12
View File
@@ -57,7 +57,7 @@
<div class='ipsBox'>
{$table|raw}
</div>]]></template>
<template template_group="browse" template_name="indexButtons" template_data="$blogs=array(), $viewMode" template_location="front" template_app="blog"><![CDATA[{{if count( $blogs ) || \IPS\blog\Blog::canCreate()}}
<template template_group="browse" template_name="indexButtons" template_data="$blogs=array(), $viewMode" template_location="front" template_app="blog"><![CDATA[{{if count( $blogs ) || \IPS\blog\Blog::canCreate() || \IPS\Settings::i()->blog_allow_grid}}
<ul class="ipsToolList ipsToolList_horizontal ipsClearfix ipsSpacer_bottom">
{{if count( $blogs )}}
<li class='ipsToolList_primaryAction'>
@@ -85,7 +85,8 @@
{{endforeach}}
{{endif}}
</li>
{{if \IPS\Settings::i()->blog_allow_grid}}
{{endif}}
{{if \IPS\Settings::i()->blog_allow_grid}}
<li class='ipsType_center'>
<ul class='ipsButton_split'>
<li class='ipsType_center'>
@@ -96,7 +97,8 @@
</li>
</ul>
</li>
{{endif}}
{{endif}}
{{if count( $blogs )}}
{{if count( $blogs ) > 1}}
<li class='ipsType_center'>
<a href='{url="app=blog&module=blogs&controller=browse&page=1&filter=my_blogs&sortby=blog_last_edate" seoTemplate="blogs"}' data-ipsMenu id='elMyBlogs' class='ipsButton ipsButton_medium ipsButton_fullWidth ipsButton_link'>{lang="my_blogs"} <i class='fa fa-caret-down'></i></a>
@@ -171,7 +173,7 @@
{template="pagination" app="core" location="global" group="global" params="$pagination['url'], $pagination['pages'], $pagination['page'], $pagination['perpage'], TRUE, 'page'"}
{{endif}}]]></template>
<template template_group="browse" template_name="indexGridEntry" template_data="$entry, $primary=false, $table=false" template_location="front" template_app="blog"><![CDATA[<article class='cBlog_grid_item ipsClear ipsClearfix ipsBox ipsSpacer_bottom {{if $entry->hidden() OR $entry->status === 'draft'}}ipsModerated{{endif}}'>
<div class='cBlog_grid_catBadge'><a href="{$entry->container()->url()}">{$entry->container()->_title}</a></div>
{{if !\IPS\Request::i()->id}}<div class='cBlog_grid_catBadge'><a href="{$entry->container()->url()}">{$entry->container()->_title}</a></div>{{endif}}
{{if $table and $table->canModerate()}}
{{$idField = $entry::$databaseColumnId;}}
<input type='checkbox' data-role='moderation' name="moderate[{$entry->$idField}]" data-actions="{expression="implode( ' ', $table->multimodActions( $entry ) )"}" data-state='{{if $entry->tableStates()}}{$entry->tableStates()}{{endif}}'>
@@ -384,7 +386,7 @@
<p class='ipsType_normal ipsType_light ipsType_blendLinks ipsType_reset'>
{{if $entry->container()->owner() instanceof \IPS\Member}}
{lang="blog_by" htmlsprintf="$entry->container()->owner()->link()"}
{{elseif $club = $blog->club()}}
{{elseif $club = $entry->container()->club()}}
<i class='fa fa-users'></i> {lang="club_blog_for" sprintf="$club->name"}
{{else}}
<i class='fa fa-users'></i> {lang="group_blog_by" sprintf="\IPS\Member::loggedIn()->language()->addToStack( 'blogs_groupblog_name_' . $entry->container()->id )"}
@@ -450,7 +452,7 @@
{{if $blog->latestEntry()}}
<hr class='ipsHr'>
<p class='ipsType_medium ipsType_reset ipsSpacer_top ipsSpacer_half ipsType_blendLinks'>
<span class='ipsType_light'>{lang="latest_entry"}:</span> <a href='{$blog->latestEntry()->url}' title="{$blog->latestEntry()->mapped('title')}">{$blog->latestEntry()->mapped('title')}</a>
<span class='ipsType_light'>{lang="latest_entry"}:</span> <a href='{$blog->latestEntry()->url()}' title="{$blog->latestEntry()->mapped('title')}">{$blog->latestEntry()->mapped('title')}</a>
</p>
{{endif}}
</div>
@@ -1410,11 +1412,11 @@
<li class='ipsMenu_item'>
<a href='{$blog->url()->setQueryString( array( 'do' => 'editBlog', 'csrfKey' => \IPS\Session::i()->csrfKey ) )}' title="{lang="edit_blog"}" data-ipsDialog data-ipsDialog-title="{lang="edit_blog"}">{lang="edit_blog"}</a>
</li>
{{if \IPS\Settings::i()->blog_allow_rssimport }}
<li class='ipsMenu_item'>
<a href='{$blog->url()->setQueryString( array( 'do' => 'rssImport', 'csrfKey' => \IPS\Session::i()->csrfKey ) )}' title="{lang="blog_rss_import"}" data-ipsDialog data-ipsDialog-title="{lang="blog_rss_import"}">{lang="blog_rss_import"}</a>
</li>
{{endif}}
{{endif}}
{{if $blog->canEdit() AND \IPS\Settings::i()->blog_allow_rssimport }}
<li class='ipsMenu_item'>
<a href='{$blog->url()->setQueryString( array( 'do' => 'rssImport', 'csrfKey' => \IPS\Session::i()->csrfKey ) )}' title="{lang="blog_rss_import"}" data-ipsDialog data-ipsDialog-title="{lang="blog_rss_import"}">{lang="blog_rss_import"}</a>
</li>
{{endif}}
{{if $blog->pinned and \IPS\Member::loggedIn()->modPermission('can_unpin_content')}}
@@ -1841,7 +1843,7 @@ html[dir="rtl"] .cBlogInfo {
}
.cBlockView_stats {
max-width: 300px;
max-width: 80%;
}
.cBlockView_stats > li {
@@ -2076,6 +2078,8 @@ html[dir=&quot;rtl&quot;] .cBlogEmbed .ipsRichEmbed_moreInfo .ipsNotificationCou
flex-direction: column;
cursor: pointer;
position: relative;
-webkit-flex-basis: calc(50% - 2px);
flex-basis: calc(50% - 2px);
}
.cBlog_grid .cBlog_grid_item [data-role='moderation'] {
+35 -1
View File
@@ -245,9 +245,43 @@
"102046": "4.2.7",
"102047": "4.2.8",
"102048": "4.2.8",
"102049": "4.2.9",
"103000": "4.3.0 Beta 1",
"103002": "4.3.0 Beta 2",
"103003": "4.3.0 Beta 3",
"103004": "4.3.0 Beta 4",
"103005": "4.3.0"
"103005": "4.3.0",
"103006": "4.3.1",
"103007": "4.3.1",
"103008": "4.3.1",
"103009": "4.3.2",
"103010": "4.3.2",
"103011": "4.3.3",
"103012": "4.3.3",
"103013": "4.3.3",
"103014": "4.3.3",
"103015": "4.3.3",
"103016": "4.3.3",
"103017": "4.3.3",
"103018": "4.3.3",
"103019": "4.3.3",
"103020": "4.3.3",
"103021": "4.3.4",
"103022": "4.3.4",
"103023": "4.3.4",
"103024": "4.3.4",
"103025": "4.3.4",
"103026": "4.3.5 Beta 1",
"103027": "4.3.5 Beta 2",
"103028": "4.3.5",
"103029": "4.3.5",
"103030": "4.3.5",
"103031": "4.3.5",
"103032": "4.3.5",
"103033": "4.3.6 Beta 1",
"103034": "4.3.6 Beta 2",
"103035": "4.3.6",
"103036": "4.3.6",
"103037": "4.3.6",
"103038": "4.3.6"
}
@@ -49,14 +49,15 @@ class _Blogs
/**
* Permission check for attachments
*
* @param \IPS\Member $member The member
* @param int|null $id1 Primary ID
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @param \IPS\Member $member The member
* @param int|null $id1 Primary ID
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @param array $attachment The attachment data
* @param bool $viewOnly If true, just check if the user can see the attachment rather than download it
* @return bool
*/
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment )
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment, $viewOnly=FALSE )
{
/* The attachment is attached to a comment */
if ( $id2 )
@@ -49,14 +49,15 @@ class _Entries
/**
* Permission check for attachments
*
* @param \IPS\Member $member The member
* @param int|null $id1 Primary ID
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @param \IPS\Member $member The member
* @param int|null $id1 Primary ID
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @param array $attachment The attachment data
* @param bool $viewOnly If true, just check if the user can see the attachment rather than download it
* @return bool
*/
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment )
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment, $viewOnly=FALSE )
{
return \IPS\blog\Entry::load( $id1 )->canView( $member );
}
@@ -70,13 +70,13 @@ class _Blog
* Get where clause to add to the member retrieval database query
*
* @param mixed $data The array returned from the save() method
* @return string|array|NULL Where clause
* @return array|NULL Where clause - must be a single array( "clause", ...binds )
*/
public function getQueryWhereClause( $data )
{
if( isset( $data['has_blog'] ) )
{
return ( $data['has_blog'] == 'yes' ) ? array( array( "blog_blogs.blog_id IS NOT NULL" ) ) : array( array( "blog_blogs.blog_id IS NULL" ) );
return ( $data['has_blog'] == 'yes' ) ? array( "blog_blogs.blog_id IS NOT NULL" ) : array( "blog_blogs.blog_id IS NULL" );
}
return NULL;
+23 -10
View File
@@ -94,40 +94,53 @@ class _blogs extends \IPS\Node\Controller
}
);
/* Row buttons */
$table->rowButtons = function( $row )
{
$blog = \IPS\blog\Blog::constructFromData( $row );
return array(
'edit' => array(
$return = array();
if ( $blog->canEdit() )
{
$return['edit'] = array(
'icon' => 'pencil',
'title' => 'edit',
'link' => \IPS\Http\Url::internal( 'app=blog&module=blogs&controller=blogs&do=form&id=' ) . $row['blog_id'],
'data' => array(),
'hotkey'=> 'e return'
),
'copy' => array(
);
}
$return['copy'] = array(
'icon' => 'files-o',
'title' => 'copy',
'link' => \IPS\Http\Url::internal( 'app=blog&module=blogs&controller=blogs&do=copy&id=' ) . $row['blog_id'],
'data' => array()
),
'content' => array(
);
$return['content'] =
array(
'icon' => 'arrow-right',
'title' => 'mass_manage_content',
'link' => \IPS\Http\Url::internal( 'app=blog&module=blogs&controller=blogs&do=massManageContent&id=' ) . $row['blog_id'],
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('empty') ),
'hotkey'=> 'm'
),
'delete' => array(
);
if ( $blog->canDelete() )
{
$return['delete'] = array(
'icon' => 'times-circle',
'title' => 'delete',
'link' => \IPS\Http\Url::internal( 'app=blog&module=blogs&controller=blogs&do=delete&id=' ) . $row['blog_id'],
'data' => ( $blog->getContentItemCount() ) ? array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('delete') ) : array( 'delete' => '' ),
'hotkey'=> 'd'
)
);
);
}
return $return;
};
/* Root buttons */
@@ -64,8 +64,8 @@ class _browse extends \IPS\Dispatcher\Controller
}
/* @note We cannot check individual member permissions here, so entries in draft status are excluded. */
$count = \IPS\blog\Entry::getItemsWithPermission( array( "entry_status!=?", 'draft' ), 'entry_date desc', NULL, 'read', \IPS\Content\Hideable::FILTER_AUTOMATIC, 0, NULL, FALSE, FALSE, FALSE, TRUE );
$entries = \IPS\blog\Entry::getItemsWithPermission( array( "entry_status!=?", 'draft' ), 'entry_date desc', array( ( $perpage * ( $page - 1 ) ), $perpage ) );
$count = \IPS\blog\Entry::getItemsWithPermission( array( array( "entry_status!=?", 'draft' ) ), 'entry_date desc', NULL, 'read', \IPS\Content\Hideable::FILTER_AUTOMATIC, 0, NULL, FALSE, FALSE, FALSE, TRUE );
$entries = \IPS\blog\Entry::getItemsWithPermission( array( array( "entry_status!=?", 'draft' ) ), 'entry_date desc', array( ( $perpage * ( $page - 1 ) ), $perpage ) );
$pagination = array(
'page' => $page,
'pages' => ceil( $count / $perpage ),
@@ -44,7 +44,11 @@ class _entry extends \IPS\Content\Controller
\IPS\Output::i()->error( 'node_error', '2B202/1', 403, '' );
}
if ( $this->entry->container()->cover_photo )
if( $this->entry->cover_photo )
{
\IPS\Output::i()->metaTags['og:image'] = \IPS\File::get( 'blog_Entries', $this->entry->cover_photo )->url;
}
elseif ( $this->entry->container()->cover_photo )
{
\IPS\Output::i()->metaTags['og:image'] = \IPS\File::get( 'blog_Blogs', $this->entry->container()->cover_photo )->url;
}
+4 -9
View File
@@ -171,11 +171,6 @@ class _Blog extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\E
if ( $club = $this->club() )
{
if ( !$member->member_id )
{
return FALSE;
}
switch ( $permission )
{
case 'add':
@@ -249,7 +244,7 @@ class _Blog extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\E
if ( $club = $this->club() )
{
if ( $club->type == $club::TYPE_PUBLIC or $club->type == $club::TYPE_READONLY )
if ( $club->type == $club::TYPE_PUBLIC or $club->type == $club::TYPE_READONLY or $club->type == $club::TYPE_OPEN)
{
return 'ca';
}
@@ -1221,14 +1216,14 @@ class _Blog extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\E
{
$member = $member ?: \IPS\Member::loggedIn();
$where[] = array( 'blog_club_id IS NOT NULL' );
if ( $member->modPermission('can_access_all_clubs') )
{
return static::nodesWithPermission( NULL, $member, $where );
}
else
{
$where[] = array( 'blog_club_id IS NOT NULL' );
if ( $permissionCheck === 'add' )
{
$statuses = array( \IPS\Member\Club::STATUS_LEADER, \IPS\Member\Club::STATUS_MODERATOR );
@@ -1239,7 +1234,7 @@ class _Blog extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\E
}
$where[] = array( \IPS\Db::i()->in( 'status', $statuses ) );
return new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'blog_blogs', $where )->join( 'core_clubs_memberships', array( 'club_id=blog_club_id AND member_id=?', \IPS\Member::loggedIn()->member_id ) ), get_called_class() );
return new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'blog_blogs', $where )->join( 'core_clubs_memberships', array( 'club_id=blog_club_id AND member_id=?', $member->member_id ) ), get_called_class() );
}
}
}
+3 -2
View File
@@ -84,7 +84,6 @@ class _Feed extends \IPS\Patterns\ActiveRecord
$entry = \IPS\blog\Entry::createItem( \IPS\Member::load( $this->member ), NULL, $article['date'], $container );
$entry->name = $article['title'];
$entry->content = \IPS\Text\Parser::parseStatic( $article['content'], TRUE );
if ( $article['link'] )
{
@@ -107,8 +106,10 @@ class _Feed extends \IPS\Patterns\ActiveRecord
}
$link = htmlspecialchars( $this->import_show_link, ENT_QUOTES | ENT_DISALLOWED, 'UTF-8', FALSE );
$entry->content .= "<br><p><a href='{$article['link']}' {$linkRelPart}>{$link}</a></p>";
$article['content'] .= "<br><p><a href='{$article['link']}' {$linkRelPart}>{$link}</a></p>";
}
$entry->content = \IPS\Text\Parser::parseStatic( $article['content'], TRUE, NULL, \IPS\Member::load( $this->member ) );
$entry->status = 'published';
$entry->save();
+6 -4
View File
@@ -323,11 +323,11 @@ class _Entry extends \IPS\Content\Item implements
$joins[] = array( 'from' => 'core_clubs', 'where' => 'core_clubs.id=blog_blogs.blog_club_id' );
if ( $member->member_id )
{
$where[] = array( '( blog_blogs.blog_club_id IS NULL OR ' . \IPS\Db::i()->in( 'blog_blogs.blog_club_id', $member->clubs() ) . ' OR core_clubs.type=? OR core_clubs.type=? )', \IPS\Member\Club::TYPE_PUBLIC, \IPS\Member\Club::TYPE_READONLY );
$where[] = array( '( blog_blogs.blog_club_id IS NULL OR ' . \IPS\Db::i()->in( 'blog_blogs.blog_club_id', $member->clubs() ) . ' OR core_clubs.type=? OR core_clubs.type=? OR core_clubs.type=?)', \IPS\Member\Club::TYPE_PUBLIC, \IPS\Member\Club::TYPE_READONLY, \IPS\Member\Club::TYPE_OPEN, );
}
else
{
$where[] = array( '( blog_blogs.blog_club_id IS NULL OR core_clubs.type=? OR core_clubs.type=? )', \IPS\Member\Club::TYPE_PUBLIC, \IPS\Member\Club::TYPE_READONLY );
$where[] = array( '( blog_blogs.blog_club_id IS NULL OR core_clubs.type=? OR core_clubs.type=? OR core_clubs.type=? )', \IPS\Member\Club::TYPE_PUBLIC, \IPS\Member\Club::TYPE_READONLY, \IPS\Member\Club::TYPE_OPEN, );
}
}
}
@@ -427,14 +427,16 @@ class _Entry extends \IPS\Content\Item implements
*/
public function processForm( $values )
{
$new = $this->_new;
parent::processForm( $values );
if ( !$this->_new )
if ( !$new )
{
$oldContent = $this->content;
}
$this->content = $values['blog_entry_content'];
if ( !$this->_new )
if ( !$new )
{
$this->sendAfterEditNotifications( $oldContent );
}
+2 -1
View File
@@ -145,7 +145,8 @@ class _Application extends \IPS\Application
foreach ( \IPS\calendar\Event::retrieveEvents( $_today, $endDate, NULL, NULL, FALSE, $member ) as $event )
{
$document->addItem( $event->title, $event->url(), $event->content, \IPS\DateTime::ts( $event->saved ), $event->id );
$next = ( (int) \IPS\Settings::i()->calendar_rss_feed_order === 0 ) ? $event->nextOccurrence( $_today, 'startDate' ) : \IPS\DateTime::ts( $event->saved );
$document->addItem( $event->title, $event->url(), $event->content, $next, $event->id );
}
/* @note application/rss+xml is not a registered IANA mime-type so we need to stick with text/xml for RSS */
+7 -7
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<javascript app="calendar">
<file javascript_app="calendar" javascript_location="front" javascript_path="controllers/browse" javascript_name="ips.browse.main.js" javascript_type="controller" javascript_version="103005" javascript_position="1000250"><![CDATA[/**
<file javascript_app="calendar" javascript_location="front" javascript_path="controllers/browse" javascript_name="ips.browse.main.js" javascript_type="controller" javascript_version="103038" javascript_position="1000250"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -112,7 +112,7 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="calendar" javascript_location="front" javascript_path="controllers/browse" javascript_name="ips.browse.monthView.js" javascript_type="controller" javascript_version="103005" javascript_position="1000250"><![CDATA[/**
<file javascript_app="calendar" javascript_location="front" javascript_path="controllers/browse" javascript_name="ips.browse.monthView.js" javascript_type="controller" javascript_version="103038" javascript_position="1000250"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -254,7 +254,7 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="calendar" javascript_location="front" javascript_path="controllers/submit" javascript_name="ips.submit.dates.js" javascript_type="controller" javascript_version="103005" javascript_position="1000100"><![CDATA[/**
<file javascript_app="calendar" javascript_location="front" javascript_path="controllers/submit" javascript_name="ips.submit.dates.js" javascript_type="controller" javascript_version="103038" javascript_position="1000100"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -699,7 +699,7 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="calendar" javascript_location="front" javascript_path="controllers/venue" javascript_name="ips.venue.main.js" javascript_type="controller" javascript_version="103005" javascript_position="1000200"><![CDATA[/**
<file javascript_app="calendar" javascript_location="front" javascript_path="controllers/venue" javascript_name="ips.venue.main.js" javascript_type="controller" javascript_version="103038" javascript_position="1000200"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -811,7 +811,7 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="calendar" javascript_location="front" javascript_path="controllers/view" javascript_name="ips.view.reminderButton.js" javascript_type="controller" javascript_version="103005" javascript_position="1000150"><![CDATA[/**
<file javascript_app="calendar" javascript_location="front" javascript_path="controllers/view" javascript_name="ips.view.reminderButton.js" javascript_type="controller" javascript_version="103038" javascript_position="1000150"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -894,7 +894,7 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="calendar" javascript_location="front" javascript_path="controllers/view" javascript_name="ips.view.reminderForm.js" javascript_type="controller" javascript_version="103005" javascript_position="1000150">/**
<file javascript_app="calendar" javascript_location="front" javascript_path="controllers/view" javascript_name="ips.view.reminderForm.js" javascript_type="controller" javascript_version="103038" javascript_position="1000150">/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -1004,7 +1004,7 @@
});
}(jQuery, _));
</file>
<file javascript_app="calendar" javascript_location="front" javascript_path="templates" javascript_name="ips.calendar.templates.js" javascript_type="framework" javascript_version="103005" javascript_position="1000050"><![CDATA[/**
<file javascript_app="calendar" javascript_location="front" javascript_path="templates" javascript_name="ips.calendar.templates.js" javascript_type="framework" javascript_version="103038" javascript_position="1000050"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*/
+6 -2
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<language>
<app key="calendar" version="103005">
<app key="calendar" version="103038">
<word key="__app_calendar" js="0">Calendar</word>
<word key="frontnavigation_calendar" js="0">Calendar</word>
<word key="__indefart_calendar_event_comment" js="0">a comment on a calendar event</word>
@@ -48,6 +48,9 @@
<word key="calendar_rss_feed" js="0">Enable upcoming events RSS feed</word>
<word key="calendar_rss_feed_desc" js="0"><![CDATA[Only content that is available to guests will be shown. For more options, create a <a href='{internal.app=core&module=discovery&controller=rss}'>Custom RSS Feed</a>]]></word>
<word key="calendar_rss_feed_days" js="0">Number of forthcoming days to include in the feed</word>
<word key="calendar_rss_feed_order" js="0">Order feed by</word>
<word key="calendar_rss_feed_order_date" js="0">Event Date</word>
<word key="calendar_rss_feed_order_publish" js="0">Publish Date</word>
<word key="acplogs__calendar_settings" js="0">Updated calendar settings</word>
<word key="calendar_default_view" js="0">Default layout</word>
<word key="calendar_default_view_desc" js="0">This setting allows you to control the default layout of the calendar homepage. Users can override the default view if they wish.</word>
@@ -64,7 +67,7 @@
<word key="calendar_custom_df" js="0">Or specify a custom date format</word>
<word key="calendar_date_format" js="0">Date format for events</word>
<word key="calendar_date_format_custom" js="0">Custom date format</word>
<word key="calendar_date_format_custom_desc" js="0"><![CDATA[You can use any <a href='{external.php-strftime}' target='_blank'>PHP strftime</a> options to specify a custom format for dates in calendar]]></word>
<word key="calendar_date_format_custom_desc" js="0"><![CDATA[You can use any <a href='{external.php-strftime}' target='_blank' rel='noopener'>PHP strftime</a> options to specify a custom format for dates in calendar]]></word>
<word key="calendar_no_date_format" js="0">You must either choose a predefined date format or specify a custom date format</word>
<word key="calendars" js="0">Calendars</word>
<word key="calendars_sg" js="0">Calendar</word>
@@ -258,6 +261,7 @@
<word key="end_date_before_start" js="0">Please select an end date after the event start date</word>
<word key="invalid_start_date" js="0">The provided start date is not valid</word>
<word key="invalid_end_date" js="0">The provided end date is not valid</word>
<word key="invalid_recurrence" js="0">The event cannot repeat that frequently. Each occurrence must end before the next starts.</word>
<word key="event__save" js="0">Save</word>
<word key="calendar_delete_title" js="0">Delete this event</word>
<word key="blurb_date_with_time" js="0">%s %s</word>
+1 -1
View File
@@ -1471,7 +1471,7 @@
"comment": "The member ID of the review author",
"decimals": null,
"default": "0",
"length": 8,
"length": 20,
"name": "review_mid",
"type": "BIGINT",
"unsigned": true,
+5
View File
@@ -29,6 +29,11 @@
"default": "30",
"report": "full"
},
{
"key": "calendar_rss_feed_order",
"default": "0",
"report": "full"
},
{
"key": "calendar_venues_enabled",
"default": "0",
+26 -7
View File
@@ -288,7 +288,7 @@
<li class='cEvents_ranged'>
<ul class='cEvents'>
{{foreach $events[ $date->year . '-' . $date->mon . '-' . $k ]['ranged'] as $event }}
<li class='cEvents_event cEvents_style{$event->calendar_id}{{if $event->nextOccurrence( \IPS\calendar\Date::getDate( $date->year, $date->mon, $k ), 'startDate' ) AND $event->nextOccurrence( \IPS\calendar\Date::getDate( $date->year, $date->mon, $k ), 'startDate' )->mysqlDatetime( FALSE, TRUE ) == $date->year . '-' . $date->mon . '-' . $k }}{{$startDates[ $event->id ] = $date->year . '-' . $date->mon . '-' . $k;}} cEvents_first{{endif}}{{if $event->nextOccurrence( \IPS\calendar\Date::getDate( $date->year, $date->mon, $k ) ?: $event->nextOccurrence( \IPS\calendar\Date::getDate( $date->year, $date->mon, $k ), 'startDate' ), 'endDate' ) AND $event->nextOccurrence( \IPS\calendar\Date::getDate( $date->year, $date->mon, $k ) ?: $event->nextOccurrence( \IPS\calendar\Date::getDate( $date->year, $date->mon, $k ), 'startDate' ), 'endDate' )->mysqlDatetime( FALSE, TRUE ) == $date->year . '-' . $date->mon . '-' . $k }} cEvents_last{{endif}}' data-eventID='{$event->id}'>
<li class='cEvents_event cEvents_style{$event->calendar_id}{{if $event->nextOccurrence( \IPS\calendar\Date::getDate( $date->year, $date->mon, $k ), 'startDate' ) AND $event->nextOccurrence( \IPS\calendar\Date::getDate( $date->year, $date->mon, $k ), 'startDate' )->mysqlDatetime( FALSE ) == $date->year . '-' . $date->mon . '-' . $k }}{{$startDates[ $event->id ] = $date->year . '-' . $date->mon . '-' . $k;}} cEvents_first{{endif}}{{if $event->nextOccurrence( \IPS\calendar\Date::getDate( $date->year, $date->mon, $k ) ?: $event->nextOccurrence( \IPS\calendar\Date::getDate( $date->year, $date->mon, $k ), 'startDate' ), 'endDate' ) AND $event->nextOccurrence( \IPS\calendar\Date::getDate( $date->year, $date->mon, $k ) ?: $event->nextOccurrence( \IPS\calendar\Date::getDate( $date->year, $date->mon, $k ), 'startDate' ), 'endDate' )->mysqlDatetime( FALSE ) == $date->year . '-' . $date->mon . '-' . $k }} cEvents_last{{endif}}' data-eventID='{$event->id}'>
<a href='{$event->url()}' data-ipsHover data-ipsHover-target='{$event->url('hovercard')->setQuerystring( 'sd', isset( $startDates[ $event->id ] ) ? $startDates[ $event->id ] : $date->year . '-' . $date->mon . '-' . $k )}' title='{$event->title}'>{{if !$event->all_day}}<span class='cEvents_time'>{$event->_start_date->localeTime( FALSE )}</span> {{endif}}{truncate="$event->title" length="15"}{{if $event->hidden() === 1}} <i class='fa fa-warning'></i>{{endif}}</a>
</li>
{{endforeach}}
@@ -431,7 +431,7 @@
<li class='cEvents_ranged'>
<ul class='cEvents'>
{{foreach $events[ $day->year . '-' . $day->mon . '-' . $day->mday ]['ranged'] as $event }}
<li class='cEvents_event cEvents_style{$event->calendar_id}{{if $event->nextOccurrence( $day, 'startDate' ) AND $event->nextOccurrence( $day, 'startDate' )->mysqlDatetime( FALSE, TRUE ) == $day->mysqlDatetime( FALSE ) }}{{$startDates[ $event->id ] = $day->mysqlDatetime( FALSE );}} cEvents_first{{endif}}{{if $event->nextOccurrence( $day ?: $event->nextOccurrence( $day, 'startDate' ), 'endDate' ) AND $event->nextOccurrence( $day ?: $event->nextOccurrence( $day, 'startDate' ), 'endDate' )->mysqlDatetime( FALSE, TRUE ) == $day->mysqlDatetime( FALSE ) }} cEvents_last{{endif}}'>
<li class='cEvents_event cEvents_style{$event->calendar_id}{{if $event->nextOccurrence( $day, 'startDate' ) AND $event->nextOccurrence( $day, 'startDate' )->mysqlDatetime( FALSE ) == $day->mysqlDatetime( FALSE ) }}{{$startDates[ $event->id ] = $day->mysqlDatetime( FALSE );}} cEvents_first{{endif}}{{if $event->nextOccurrence( $day ?: $event->nextOccurrence( $day, 'startDate' ), 'endDate' ) AND $event->nextOccurrence( $day ?: $event->nextOccurrence( $day, 'startDate' ), 'endDate' )->mysqlDatetime( FALSE ) == $day->mysqlDatetime( FALSE ) }} cEvents_last{{endif}}'>
<a href='{$event->url()}' data-ipsHover data-ipsHover-target='{$event->url('hovercard')->setQuerystring( 'sd', isset( $startDates[ $event->id ] ) ? $startDates[ $event->id ] : $day->mysqlDatetime( FALSE ) )}'>{$event->title}{{if $event->hidden() === 1}} <i class='fa fa-warning'></i>{{endif}}</a>
</li>
{{endforeach}}
@@ -1158,13 +1158,13 @@
</div>
<div class='cCalendarSubmit_field' id='end_time_wrap'>
<i class='fa fa-clock-o'></i>
<input name="event_dates[end_time]" id="end_time" type="time" size='12' class="ipsField_short" placeholder="{lang="_time_format_hhmm"}" step='60' min='00:00' value="{$value['end_time']}">
<input name="event_dates[end_time]" id="end_time" type="time" size='12' class="ipsField_short" placeholder="{lang="_time_format_hhmm"}" step='60' min='00:00' value="{{if isset( $value['end_time'] )}}{$value['end_time']}{{endif}}">
</div>
<br><br>
<ul class='ipsList_inline' id='end_date_controls'>
<li>
<span class='ipsCustomInput'>
<input type="checkbox" role="checkbox" name="event_dates[no_end_time]" {{if !$value['end_time']}}checked aria-checked='true'{{endif}} value="1" id="check_no_end_time">
<input type="checkbox" role="checkbox" name="event_dates[no_end_time]" {{if !isset( $value['end_time'] ) OR !$value['end_time']}}checked aria-checked='true'{{endif}} value="1" id="check_no_end_time">
<span></span>
</span> <label for='check_no_end_time'>{lang="no_end_time"}</label>
</li>
@@ -1557,7 +1557,13 @@
<time content='{expression="$event->_end_date->format( 'Y-m-d' )"}'>
{{$sameDay = !( ($event->_start_date->mday != $event->_end_date->mday) or ($event->_start_date->mon != $event->_end_date->mon) or ($event->_start_date->year != $event->_end_date->year) );}}
{{if $event->nextOccurrence( $event->nextOccurrence( \IPS\calendar\Date::getDate(), 'startDate' ) ?: \IPS\calendar\Date::getDate(), 'endDate' )}}
{{if !$sameDay}}{$event->nextOccurrence( $event->nextOccurrence( \IPS\calendar\Date::getDate(), 'startDate' ) ?: \IPS\calendar\Date::getDate(), 'endDate' )->calendarDate()}{{endif}}{{if !$event->all_day}}{{if !$sameDay}}, {{endif}}{$event->nextOccurrence( $event->nextOccurrence( \IPS\calendar\Date::getDate(), 'startDate' ) ?: \IPS\calendar\Date::getDate(), 'endDate' )->localeTime( FALSE )}{{endif}}
{{if !$sameDay}}
{$event->nextOccurrence( $event->nextOccurrence( \IPS\calendar\Date::getDate(), 'startDate' ) ?: \IPS\calendar\Date::getDate(), 'endDate' )->calendarDate()}
{{endif}}
{{if !$event->all_day}}
{{if !$sameDay}}, {{endif}}
{$event->nextOccurrence( $event->nextOccurrence( \IPS\calendar\Date::getDate(), 'startDate' ) ?: \IPS\calendar\Date::getDate(), 'endDate' )->localeTime( FALSE )}
{{endif}}
{{else}}
{$event->lastOccurrence( 'endDate' )->calendarDate()}{{if !$event->all_day}} {$event->lastOccurrence( 'endDate' )->localeTime( FALSE )}{{endif}}
{{endif}}
@@ -1590,10 +1596,18 @@
{{$startDate = $event->nextOccurrence( \IPS\calendar\Date::getDate( $date->year, $date->mon, 1 ), 'startDate' );}}
{{endif}}
{{if $startDate}}
{{$sameDay = ( $event->nextOccurrence( $startDate ?: $date, 'endDate' ) ) AND ( $startDate->calendarDate() == $event->nextOccurrence( $startDate ?: $date, 'endDate' )->calendarDate() );}}
{{$nextEndDate = $event->nextOccurrence( $startDate ?: $date, 'endDate' );}}
{{$sameDay = ( $nextEndDate AND $startDate->calendarDate() == $nextEndDate->calendarDate() );}}
{$startDate->calendarDate()}{{if !$event->all_day}} {$startDate->localeTime( FALSE )} {{endif}}
{{if $event->_end_date AND $event->nextOccurrence( $startDate ?: $date, 'endDate' ) }}
&nbsp;&nbsp;<i class='fa fa-arrow-circle-right ipsType_large ipsType_light'></i>&nbsp;&nbsp;{{if !$sameDay}}{$event->nextOccurrence( $startDate ?: $date, 'endDate' )->calendarDate()}{{endif}}{{if !$event->all_day}}{{if !$sameDay}} {{endif}}{$event->nextOccurrence( $startDate ?: $date, 'endDate' )->localeTime( FALSE )}{{endif}}
&nbsp;&nbsp;<i class='fa fa-arrow-circle-right ipsType_large ipsType_light'></i>&nbsp;&nbsp;
{{if !$sameDay}}
{$event->nextOccurrence( $startDate ?: $date, 'endDate' )->calendarDate()}
{{endif}}
{{if !$event->all_day}}
{{if !$sameDay}} {{endif}}
{$event->nextOccurrence( $startDate ?: $date, 'endDate' )->localeTime( FALSE )}
{{endif}}
{{endif}}
{{else}}
{$event->lastOccurrence( 'startDate' )->calendarDate()}{{if !$event->all_day}} {$event->lastOccurrence( 'startDate' )->localeTime( FALSE )} {{endif}}
@@ -2602,6 +2616,11 @@
#elEventHeader_details time p .fa-arrow-circle-right:before{
content:"\f0ab";
}
.cCalendarBlock .cCalendarBlock_map {
display: block;
float: none;
}
}]]></css>
<css css_location="front" css_app="calendar" css_attributes="" css_path="." css_name="calendar.css"><![CDATA[.cCalendar {
width: 100%;
+35 -1
View File
@@ -217,9 +217,43 @@
"102046": "4.2.7",
"102047": "4.2.8",
"102048": "4.2.8",
"102049": "4.2.9",
"103000": "4.3.0 Beta 1",
"103002": "4.3.0 Beta 2",
"103003": "4.3.0 Beta 3",
"103004": "4.3.0 Beta 4",
"103005": "4.3.0"
"103005": "4.3.0",
"103006": "4.3.1",
"103007": "4.3.1",
"103008": "4.3.1",
"103009": "4.3.2",
"103010": "4.3.2",
"103011": "4.3.3",
"103012": "4.3.3",
"103013": "4.3.3",
"103014": "4.3.3",
"103015": "4.3.3",
"103016": "4.3.3",
"103017": "4.3.3",
"103018": "4.3.3",
"103019": "4.3.3",
"103020": "4.3.3",
"103021": "4.3.4",
"103022": "4.3.4",
"103023": "4.3.4",
"103024": "4.3.4",
"103025": "4.3.4",
"103026": "4.3.5 Beta 1",
"103027": "4.3.5 Beta 2",
"103028": "4.3.5",
"103029": "4.3.5",
"103030": "4.3.5",
"103031": "4.3.5",
"103032": "4.3.5",
"103033": "4.3.6 Beta 1",
"103034": "4.3.6 Beta 2",
"103035": "4.3.6",
"103036": "4.3.6",
"103037": "4.3.6",
"103038": "4.3.6"
}
@@ -23,9 +23,15 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
*/
class _Calendars
{
/**
* @brief ID Field
*/
public static $idField = "id";
public static $controllers = array();
/**
* @brief Controller classes
*/
public static $controllers = array( "IPS\\calendar\\modules\\front\\calendar\\view" );
/**
* Get Setting Field
@@ -48,14 +48,15 @@ class _Calendar
/**
* Permission check for attachments
*
* @param \IPS\Member $member The member
* @param int|null $id1 Primary ID
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @param \IPS\Member $member The member
* @param int|null $id1 Primary ID
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @param array $attachment The attachment data
* @param bool $viewOnly If true, just check if the user can see the attachment rather than download it
* @return bool
*/
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment )
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment, $viewOnly=FALSE )
{
try
{
@@ -54,9 +54,10 @@ class _Venue
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @param array $attachment The attachment data
* @param bool $viewOnly If true, just check if the user can see the attachment rather than download it
* @return bool
*/
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment )
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment, $viewOnly=FALSE )
{
return TRUE;
}
@@ -47,10 +47,14 @@ class _StreamItems
}
foreach ( \IPS\Db::i()->select( '*', 'calendar_event_rsvp', $where, 'rsvp_date DESC', 10 ) as $rsvp )
{
$member = \IPS\Member::load( $rsvp['rsvp_member_id'] );
$event = \IPS\calendar\Event::load( $rsvp[ 'rsvp_event_id' ] );
$title = htmlspecialchars( $event->title, ENT_DISALLOWED, 'UTF-8', FALSE );
$rsvps[] = new \IPS\Content\Search\Result\Custom( \IPS\DateTime::ts( $rsvp[ 'rsvp_date' ] ), \IPS\Member::loggedIn()->language()->addToStack( 'calendar_activity_stream_rsvp', FALSE, array( 'htmlsprintf' => array( \IPS\Theme::i()->getTemplate( 'global', 'core', 'front' )->userLink( $member ), $event->url(), $title ) ) ) );
if( $event->canView() )
{
$member = \IPS\Member::load( $rsvp['rsvp_member_id'] );
$title = htmlspecialchars( $event->title, ENT_DISALLOWED, 'UTF-8', FALSE );
$rsvps[] = new \IPS\Content\Search\Result\Custom( \IPS\DateTime::ts( $rsvp[ 'rsvp_date' ] ), \IPS\Member::loggedIn()->language()->addToStack( 'calendar_activity_stream_rsvp', FALSE, array( 'htmlsprintf' => array( \IPS\Theme::i()->getTemplate( 'global', 'core', 'front' )->userLink( $member ), $event->url(), $title ) ) ) );
}
}
/* Return */
@@ -255,7 +255,7 @@ class _ical extends \IPS\Dispatcher\Controller
try
{
$icsParser = new \IPS\calendar\Icalendar\ICSParser;
$count = $icsParser->parse( \file_get_contents( $values['feed_file'] ), $values['feed_calendar_id'], $values['feed_member_id'], $values['feed_venue_id'] );
$count = $icsParser->parse( \file_get_contents( $values['feed_file'] ), $values['feed_calendar_id'], $values['feed_member_id'], ( isset( $values['feed_venue_id'] ) ) ? $values['feed_venue_id']->_id : NULL );
}
catch( \UnexpectedValueException $e )
{
@@ -53,8 +53,15 @@ class _settings extends \IPS\Dispatcher\Controller
$form->add( new \IPS\Helpers\Form\YesNo( 'show_bday_calendar', \IPS\Settings::i()->show_bday_calendar ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'ipb_calendar_mon', \IPS\Settings::i()->ipb_calendar_mon ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'calendar_rss_feed', \IPS\Settings::i()->calendar_rss_feed, FALSE, array( 'togglesOn' => array( 'calendar_rss_feed_days' ) ) ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'calendar_rss_feed', \IPS\Settings::i()->calendar_rss_feed, FALSE, array( 'togglesOn' => array( 'calendar_rss_feed_days', 'calendar_rss_feed_order' ) ) ) );
$form->add( new \IPS\Helpers\Form\Number( 'calendar_rss_feed_days', \IPS\Settings::i()->calendar_rss_feed_days, FALSE, array( 'unlimited' => -1 ), NULL, NULL, NULL, 'calendar_rss_feed_days' ) );
$form->add( new \IPS\Helpers\Form\Radio( 'calendar_rss_feed_order', \IPS\Settings::i()->calendar_rss_feed_order, FALSE, array( 'options' => array(
0 => 'calendar_rss_feed_order_date',
1 => 'calendar_rss_feed_order_publish'
) ), NULL, NULL, NULL, 'calendar_rss_feed_order' ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'calendar_venues_enabled', \IPS\Settings::i()->calendar_venues_enabled ) );
@@ -150,7 +150,7 @@ class _event extends \IPS\Content\Controller
$this->event->lastOccurrence( 'endDate' )->format( \IPS\DateTime::ISO8601 );
}
if( $this->event->container()->allow_reviews AND $this->event->reviews )
if( $this->event->container()->allow_reviews AND $this->event->reviews AND $this->event->averageReviewRating() )
{
\IPS\Output::i()->jsonLd['event']['aggregateRating'] = array(
'@type' => 'AggregateRating',
@@ -178,6 +178,13 @@ class _submit extends \IPS\Dispatcher\Controller
{
$obj = \IPS\calendar\Event::createFromForm( $values );
/* Set cover photo offset from original if we're using the same photo */
if( $existing->cover_photo == $obj->cover_photo )
{
$obj->cover_offset = $existing->cover_offset;
$obj->save();
}
if ( !\IPS\Member::loggedIn()->member_id and $obj->hidden() )
{
\IPS\Output::i()->redirect( $obj->container()->url(), 'mod_queue_message' );
@@ -547,7 +547,7 @@ class _view extends \IPS\Dispatcher\Controller
{
/* Build the form */
$form = new \IPS\Helpers\Form;
$form->add( new \IPS\Helpers\Form\Date( 'jump_to', $this->_today, TRUE, array(), NULL, NULL, NULL, 'jump_to' ) );
$form->add( new \IPS\Helpers\Form\Date( 'jump_to', \IPS\DateTime::create(), TRUE, array(), NULL, NULL, NULL, 'jump_to' ) );
if( $values = $form->values() )
{
@@ -75,5 +75,18 @@
]
}
]
},
"5": {
"method": "update",
"params": [
"core_sys_lang_words",
{
"word_app": "calendar"
},
[
"word_app=? AND word_key LIKE '%calendar_venue_%'",
"venues"
]
]
}
}
@@ -28,19 +28,19 @@
]
},
"5": {
"method": "dropIndex",
"params": [
"cal_events",
"approved"
]
},
"6": {
"method": "renameTable",
"params": [
"cal_events",
"calendar_events"
]
},
"6": {
"method": "dropIndex",
"params": [
"calendar_events",
"approved"
]
},
"7": {
"method": "changeColumn",
"params": [
+20 -13
View File
@@ -95,9 +95,14 @@ class _Date extends \IPS\DateTime
public static function getDate( $year=NULL, $month=NULL, $day=NULL, $hour=0, $minute=0, $second=0, $offset=NULL )
{
/* Get our time zone offset */
$timezone = NULL;
if ( $offset === NULL and \IPS\Member::loggedIn()->timezone )
{
$offset = \IPS\DateTime::create()->setTimezone( new \DateTimeZone( \IPS\Member::loggedIn()->timezone ) )->getOffset();
$timezone = \IPS\DateTime::create();
$timezone->setTimezone( new \DateTimeZone( \IPS\Member::loggedIn()->timezone ) );
$offset = $timezone->getOffset();
}
/* Set appropriate defaults for values not supplied, which is normal */
@@ -125,6 +130,14 @@ class _Date extends \IPS\DateTime
/* Create the timestamp */
$timeStamp = gmmktime( $hour, $minute, $second, $month, $day, $year );
/* Recalculate offset in case we go over DST boundary */
if( $timezone )
{
$timeZoneCheck = $timezone->setTimestamp( $timeStamp );
$offset = $timeZoneCheck->getOffset();
}
/* Store the information and return the object */
$obj = static::ts( $timeStamp - $offset );
$obj->getDateInformation( $timeStamp );
@@ -180,7 +193,7 @@ class _Date extends \IPS\DateTime
*
* @note This is basically a timezone aware wrapper for getdate
* @param int $time Timestamp
* @return void
* @return array
*/
public function getDateInformation( $time )
{
@@ -197,6 +210,7 @@ class _Date extends \IPS\DateTime
'month' => $this->strFormat( '%B' ),
0 => $time
);
return $this->dateInformation;
}
/**
@@ -519,25 +533,18 @@ class _Date extends \IPS\DateTime
/**
* Return the MySQL-style datetime value
*
* @param bool $includeTime Whether to include time or not
* @param bool $timezoned Whether to adjust for timezone or not. This will usually be FALSE for database purposes, but set to TRUE if you're using this to compare if two dates are on the same day
* @param bool $includeTime Whether to include time or not
* @return string
*/
public function mysqlDatetime( $includeTime=TRUE, $timezoned = FALSE )
public function mysqlDatetime( $includeTime=TRUE )
{
$timeStamp = isset( $this->dateInformation[0] ) ? $this->dateInformation[0] : $this->getTimestamp();
if ( $timezoned )
{
$timeStamp += $this->getTimezone()->getOffset( $this );
}
if( $includeTime )
{
return date( 'Y-m-d H:i:s', $timeStamp );
return date( 'Y-m-d H:i:s', isset( $this->dateInformation[0] ) ? $this->dateInformation[0] : $this->getTimestamp() );
}
else
{
return date( 'Y-m-d', $timeStamp );
return date( 'Y-m-d', isset( $this->dateInformation[0] ) ? $this->dateInformation[0] : $this->getTimestamp() );
}
}
+68 -23
View File
@@ -564,7 +564,8 @@ class _Event extends \IPS\Content\Item implements
( $eDate !== NULL AND $date->mysqlDatetime( FALSE ) <= $startDate->mysqlDatetime( FALSE ) AND $eDate->mysqlDatetime( FALSE ) >= $endDate->mysqlDatetime( FALSE ) )
)
{
$results[] = array( 'startDate' => new \IPS\calendar\Date( $dateOccurrence->mysqlDatetime( FALSE, TRUE ) ), 'endDate' => $eDate );
$thisOccurrence = $dateOccurrence->getDateInformation( $dateOccurrence->getTimestamp() );
$results[] = array( 'startDate' => \IPS\calendar\Date::getDate( $thisOccurrence['year'], $thisOccurrence['mon'], $thisOccurrence['mday'], $thisOccurrence['hours'], $thisOccurrence['minutes'], $thisOccurrence['seconds'] ), 'endDate' => $eDate );
}
$eDate = ( $eDate !== NULL ) ? $eDate->adjust( "+{$recurringData['event_repeat_freq']} {$keyword}" ) : NULL;
@@ -584,7 +585,8 @@ class _Event extends \IPS\Content\Item implements
( $eDate !== NULL AND $date->mysqlDatetime( FALSE ) <= $startDate->mysqlDatetime( FALSE ) AND $eDate->mysqlDatetime( FALSE ) >= $endDate->mysqlDatetime( FALSE ) )
)
{
$results[] = array( 'startDate' => new \IPS\calendar\Date( $dateOccurrence->mysqlDatetime( FALSE, TRUE ) ), 'endDate' => $eDate );
$thisOccurrence = $dateOccurrence->getDateInformation( $dateOccurrence->getTimestamp() );
$results[] = array( 'startDate' => \IPS\calendar\Date::getDate( $thisOccurrence['year'], $thisOccurrence['mon'], $thisOccurrence['mday'], $thisOccurrence['hours'], $thisOccurrence['minutes'], $thisOccurrence['seconds'] ), 'endDate' => $eDate );
}
$eDate = ( $eDate !== NULL ) ? $eDate->adjust( "+{$recurringData['event_repeat_freq']} {$keyword}" ) : NULL;
@@ -602,7 +604,8 @@ class _Event extends \IPS\Content\Item implements
( $eDate !== NULL AND $date->mysqlDatetime( FALSE ) <= $startDate->mysqlDatetime( FALSE ) AND $eDate->mysqlDatetime( FALSE ) >= $endDate->mysqlDatetime( FALSE ) )
)
{
$results[] = array( 'startDate' => new \IPS\calendar\Date( $dateOccurrence->mysqlDatetime( FALSE, TRUE ) ), 'endDate' => $eDate );
$thisOccurrence = $dateOccurrence->getDateInformation( $dateOccurrence->getTimestamp() );
$results[] = array( 'startDate' => \IPS\calendar\Date::getDate( $thisOccurrence['year'], $thisOccurrence['mon'], $thisOccurrence['mday'], $thisOccurrence['hours'], $thisOccurrence['minutes'], $thisOccurrence['seconds'] ), 'endDate' => $eDate );
}
$eDate = ( $eDate !== NULL ) ? $eDate->adjust( "+{$recurringData['event_repeat_freq']} {$keyword}" ) : NULL;
@@ -1132,9 +1135,9 @@ class _Event extends \IPS\Content\Item implements
$val['start_time'] = str_replace( '.', ':', $val['start_time'] );
}
if( isset( $val['no_end_time'] ) AND $val['no_end_time'] AND isset( $val['end_time'] ) )
if ( isset( $val['no_end_time'] ) AND $val['no_end_time'] AND ( isset( $val['end_time'] ) OR isset( $val['end_date'] ) ) )
{
unset( $val['end_time'] );
unset( $val['end_time'], $val['end_date'] );
}
if( isset( $val['end_time'] ) )
@@ -1152,7 +1155,7 @@ class _Event extends \IPS\Content\Item implements
}
$end = null;
if( isset( $val['end_date'] ) AND $val['end_date'] )
{
if( !isset( $val['single_day'] ) OR !$val['single_day'] )
@@ -1169,7 +1172,7 @@ class _Event extends \IPS\Content\Item implements
}
}
}
else
elseif( isset( $val['end_time'] ) )
{
try
{
@@ -1214,6 +1217,38 @@ class _Event extends \IPS\Content\Item implements
}
}
/* Check we are not trying to recur in such a way that a new occurance starts before
the last ends, which could cause timeouts if someone does something like sets an
event to recur every day and span many days */
if ( isset( $val['event_repeat'] ) and $val['event_repeat'] and $end )
{
$diff = intval( strtotime( $end ) ) - intval( strtotime( $start ) );
switch ( $val['event_repeats'] )
{
case 'daily':
$maxDiff = intval( $val['event_repeat_freq'] ) * 86400;
break;
case 'weekly':
$maxDiff = intval( $val['event_repeat_freq'] ) * 86400 * 7;
break;
case 'monthly':
$maxDiff = intval( $val['event_repeat_freq'] ) * 86400 * 31;
break;
case 'yearly':
$maxDiff = intval( $val['event_repeat_freq'] ) * 86400 * 365;
break;
}
if ( $diff > $maxDiff )
{
throw new \DomainException( "invalid_recurrence" );
}
}
}, NULL, NULL, 'event_dates' );
/* Init */
@@ -1230,16 +1265,18 @@ class _Event extends \IPS\Content\Item implements
/* Get default elements */
$return = array_merge( $return, parent::formElements( $item, $container ) );
/* Event description */
$return['description'] = new \IPS\Helpers\Form\Editor( 'event_content', $item ? $item->content : NULL, TRUE, array( 'app' => 'calendar', 'key' => 'Calendar', 'autoSaveKey' => 'calendar-event', 'attachIds' => ( $item === NULL ? NULL : array( $item->id, NULL, 'description' ) ) ) );
$return['description'] = new \IPS\Helpers\Form\Editor( 'event_content', $item ? $item->content : NULL, TRUE, array( 'app' => 'calendar', 'key' => 'Calendar', 'autoSaveKey' => ( $item === NULL ) ? 'calendar-event' : "calendar-event-{$item->id}", 'attachIds' => ( $item === NULL ? NULL : array( $item->id, NULL, 'description' ) ) ) );
/* Cover photo and location */
$return['header'] = new \IPS\Helpers\Form\Upload( 'event_cover_photo', ( $item AND $item->cover_photo ) ? \IPS\File::get( 'calendar_Events', $item->cover_photo ) : NULL, FALSE, array( 'image' => TRUE, 'storageExtension' => 'calendar_Events' ) );
if( \IPS\Settings::i()->calendar_venues_enabled )
{
$return['venue'] = new \IPS\Helpers\Form\Node( static::$formLangPrefix . 'venue', ( $item ) ? $item->venue ?: 0 : ( isset( \IPS\Request::i()->venue ) ? \IPS\Request::i()->venue : NULL ), FALSE, array(
$roots = \IPS\calendar\Venue::roots();
$return['venue'] = new \IPS\Helpers\Form\Node( static::$formLangPrefix . 'venue', ( $item ) ? $item->venue ?: 0 : ( isset( \IPS\Request::i()->venue ) ? \IPS\Request::i()->venue : ( count( $roots ) ? NULL : 0 ) ), FALSE, array(
'url' => \IPS\Http\Url::internal( 'app=calendar&module=calendar&controller=submit', 'front', 'calendar_submit' ),
'class' => 'IPS\calendar\Venue',
'zeroVal' => 'venues_not_listed',
@@ -1355,7 +1392,7 @@ class _Event extends \IPS\Content\Item implements
$this->end_date = \IPS\calendar\Date::createFromForm( $values['event_dates']['end_date'], ( ( !isset( $values['event_dates']['all_day'] ) OR !$values['event_dates']['all_day'] ) ? $values['event_dates']['end_time'] : NULL ), ( isset( $values['event_dates']['all_day'] ) AND $values['event_dates']['all_day'] ) ? 'UTC' : $values['event_dates']['event_timezone'] )->format( 'Y-m-d H:i' );
}
}
else if( ( !isset( $values['event_dates']['all_day'] ) OR !$values['event_dates']['all_day'] ) AND $values['event_dates']['end_time'] != $values['event_dates']['start_time'] )
else if( ( !isset( $values['event_dates']['all_day'] ) OR !$values['event_dates']['all_day'] ) AND isset( $values['event_dates']['end_time'] ) AND $values['event_dates']['end_time'] != $values['event_dates']['start_time'] )
{
$this->end_date = \IPS\calendar\Date::createFromForm( $values['event_dates']['start_date'], $values['event_dates']['end_time'], ( isset( $values['event_dates']['all_day'] ) AND $values['event_dates']['all_day'] ) ? 'UTC' : $values['event_dates']['event_timezone'] )->format( 'Y-m-d H:i' );
}
@@ -1679,20 +1716,20 @@ class _Event extends \IPS\Content\Item implements
foreach( $events as $event )
{
/* Is this a ranged event? */
if( $event->_end_date !== NULL AND $event->_start_date->mysqlDatetime( FALSE ) < $event->_end_date->mysqlDatetime( FALSE ) )
if( $event->_end_date !== NULL AND $event->_start_date->mysqlDatetime( FALSE, TRUE ) < $event->_end_date->mysqlDatetime( FALSE, TRUE ) )
{
$date = $event->_start_date;
while( $date->mysqlDatetime( FALSE ) < $event->_end_date->mysqlDatetime( FALSE ) )
while( $date->mysqlDatetime( FALSE, TRUE ) < $event->_end_date->mysqlDatetime( FALSE, TRUE ) )
{
$formattedEvents[ $date->mysqlDatetime( FALSE ) ]['ranged'][ $event->id ] = $event;
$date = $date->adjust( '+1 day' );
}
$formattedEvents[ $event->_end_date->mysqlDatetime( FALSE ) ]['ranged'][ $event->id ] = $event;
$formattedEvents[ $event->_end_date->mysqlDatetime( FALSE, TRUE ) ]['ranged'][ $event->id ] = $event;
}
else
{
$formattedEvents[ $event->_start_date->mysqlDatetime( FALSE ) ]['single'][ $event->id ] = $event;
$formattedEvents[ $event->_start_date->mysqlDatetime( FALSE, TRUE ) ]['single'][ $event->id ] = $event;
}
}
}
@@ -1723,18 +1760,26 @@ class _Event extends \IPS\Content\Item implements
if( $occurrence['endDate'] !== NULL )
{
$date = $occurrence['startDate'];
$eDate = ( $thisEndDate->mysqlDatetime( FALSE ) < $occurrence['endDate']->mysqlDatetime( FALSE ) ) ? $thisEndDate : $occurrence['endDate'];
while( $date->mysqlDatetime( FALSE ) < $eDate->mysqlDatetime( FALSE ) )
{
$formattedEvents[ $date->mysqlDatetime( FALSE ) ]['ranged'][ $event->id ] = $event;
$date = $date->adjust( '+1 day' );
}
$eDate = ( $thisEndDate->mysqlDatetime( FALSE, TRUE ) < $occurrence['endDate']->mysqlDatetime( FALSE, TRUE ) ) ? $thisEndDate : $occurrence['endDate'];
$formattedEvents[ $occurrence['endDate']->mysqlDatetime( FALSE ) ]['ranged'][ $event->id ] = $event;
if( $date->mysqlDatetime( FALSE, TRUE ) < $eDate->mysqlDatetime( FALSE, TRUE ) )
{
while( $date->mysqlDatetime( FALSE, TRUE ) < $eDate->mysqlDatetime( FALSE, TRUE ) )
{
$formattedEvents[ $date->mysqlDatetime( FALSE ) ]['ranged'][ $event->id ] = $event;
$date = $date->adjust( '+1 day' );
}
$formattedEvents[ $occurrence['endDate']->mysqlDatetime( FALSE, TRUE ) ]['ranged'][ $event->id ] = $event;
}
else
{
$formattedEvents[ $date->mysqlDatetime( FALSE, TRUE ) ]['single'][ $event->id ] = $event;
}
}
else
{
$formattedEvents[ $occurrence['startDate']->mysqlDatetime( FALSE ) ]['single'][ $event->id ] = $event;
$formattedEvents[ $occurrence['startDate']->mysqlDatetime( FALSE, TRUE ) ]['single'][ $event->id ] = $event;
}
}
}
@@ -449,11 +449,20 @@ class _ICSParser
/* Basics */
$newEvent->title = ( isset( $event['summary'] ) AND $event['summary'] ) ? $event['summary'] : mb_substr( strip_tags( $event['description'] ), 0, 100 );
$newEvent->content = ( isset( $event['description'] ) AND $event['description'] ) ? nl2br( $event['description'] ) : $event['summary'] . ( isset( $event['location'] ) ? '<br>' . $event['location'] : '' );
$content = ( isset( $event['description'] ) AND $event['description'] ) ? nl2br( $event['description'] ) : $event['summary'] . ( isset( $event['location'] ) ? '<br>' . $event['location'] : '' );
$newEvent->content = \IPS\Text\Parser::parseStatic( $content, TRUE, NULL, $this->member );
$newEvent->sequence = ( isset( $event['sequence'] ) ? intval( $event['sequence'] ) : 0 );
/* Times and dates */
$newEvent->lastupdated = ( isset( $event['last_modified'] ) AND $event['last_modified'] AND $event['last_modified'] < time() ) ? $event['last_modified'] : ( ( isset( $event['created'] ) AND $event['created'] AND $event['created'] < time() ) ? $event['created'] : time() );
if( isset( $event['last_modified'] ) AND $event['last_modified'] AND $event['last_modified'] < time() )
{
$newEvent->lastupdated = $event['last_modified'];
}
elseif( !$eventId )
{
$newEvent->lastupdated = ( isset( $event['created'] ) AND $event['created'] AND $event['created'] < time() ) ? $event['created'] : time();
}
$newEvent->all_day = $event_all_day;
$newEvent->recurring = ( isset( $event['recurr'] ) ) ? $event['recurr'] : NULL;
$newEvent->start_date = $event_unix_from->setTimezone( new \DateTimeZone( 'UTC' ) )->format( 'Y-m-d H:i:s' );
@@ -462,11 +471,27 @@ class _ICSParser
/* Geolocation? */
if( isset( $event['geo'] ) AND is_array( $event['geo'] ) AND count( $event['geo'] ) )
{
try
/* If we are updating an event, don't pull geo data if we already have it and it hasn't changed */
$update = TRUE;
if( $newEvent->location )
{
$newEvent->location = json_encode( \IPS\GeoLocation::getByLatLong( $event['geo']['lat'], $event['geo']['long'] ) );
$existingLocation = json_decode( $newEvent->location, true );
if( isset( $existingLocation['lat'] ) AND $existingLocation['lat'] == $event['geo']['lat'] AND isset( $existingLocation['long'] ) AND $existingLocation['long'] == $event['geo']['long'] )
{
$update = FALSE;
}
}
if( $update === TRUE )
{
try
{
$newEvent->location = json_encode( \IPS\GeoLocation::getByLatLong( $event['geo']['lat'], $event['geo']['long'] ) );
}
catch( \BadFunctionCallException $e ){}
}
catch( \BadFunctionCallException $e ){}
}
elseif( isset( $event['location'] ) )
{
@@ -474,10 +499,9 @@ class _ICSParser
{
$location = new \IPS\GeoLocation;
$location->addressLines = array( $event['location'] );
$location->getLatLong();
$location->getLatLong( TRUE );
/* We get by LatLong because getLatLong() does not populate the other address data. */
$newEvent->location = json_encode( \IPS\GeoLocation::getByLatLong( $location->lat, $location->long ) );
$newEvent->location = json_encode( $location );
}
catch( \BadFunctionCallException $e ){}
}
@@ -190,6 +190,7 @@ class _Venue extends \IPS\Node\Model
*/
public function delete()
{
\IPS\Lang::deleteCustom( 'calendar', 'calendar_venue_' . $this->id );
\IPS\Lang::deleteCustom( 'calendar', 'calendar_venue_' . $this->id . '_desc' );
return parent::delete();
+2 -2
View File
@@ -49,11 +49,11 @@ class _icalendar extends \IPS\Task
}
catch( \Exception $e )
{
throw new \IPS\Task\Exception( $this, \IPS\Member::loggedIn()->language()->addToStack( 'task_' . $e->getMessage(), FALSE, array( 'sprintf' => array( $next['feed_title'] ) ) ) );
throw new \IPS\Task\Exception( $this, array( 'task_' . $e->getMessage(), $next['feed_title'] ) );
}
/* Task log */
return \IPS\Member::loggedIn()->language()->addToStack( 'acplog__icalfeed_refreshed', FALSE, array( 'sprintf' => array( $count['imported'], $count['skipped'] ) ) );
return NULL;
}
}
catch( \UnderflowException $e )
@@ -38,6 +38,25 @@ class _todaysBirthdays extends \IPS\Widget
*/
public $plugin = '';
/**
* Constructor
*
* @param String $uniqueKey Unique key for this specific instance
* @param array $configuration Widget custom configuration
* @param null|string|array $access Array/JSON string of executable apps (core=sidebar only, content=IP.Content only, etc)
* @param null|string $orientation Orientation (top, bottom, right, left)
* @param boolean $allowReuse If true, when the block is used, it will remain in the sidebar so it can be used again.
* @param string $menuStyle Menu is a drop down menu, modal is a bigger modal panel.
* @return void
*/
public function __construct( $uniqueKey, array $configuration, $access=null, $orientation=null )
{
parent::__construct( $uniqueKey, $configuration, $access, $orientation );
/* We need to adjust for timezone too */
$this->cacheKey = "widget_{$this->key}_" . $this->uniqueKey . '_' . md5( json_encode( $configuration ) . "_" . \IPS\Member::loggedIn()->language()->id . "_" . \IPS\Member::loggedIn()->skin . "_" . json_encode( \IPS\Member::loggedIn()->groups ) . "_" . $orientation . \IPS\Member::loggedIn()->timezone );
}
/**
* Specify widget configuration
*
+2 -2
View File
@@ -135,11 +135,11 @@ class _reviews extends \IPS\Content\Api\CommentController
$class = 'IPS\cms\Records\Review' . $database->id;
if ( $this->member )
{
$object = $class::loadAndCheckPerms( $id, $this->member );
$object = $class::loadAndCheckPerms( $review, $this->member );
}
else
{
$object = $class::load( $id );
$object = $class::load( $review );
}
return new \IPS\Api\Response( 200, $object->apiOutput( $this->member ) );
+1 -1
View File
@@ -588,7 +588,7 @@
<li><a href='{$comment->url('report')}' data-ipsDialog data-ipsDialog-remoteSubmit data-ipsDialog-size='medium' data-ipsDialog-flashMessage='{lang="report_submit_success"}' data-ipsDialog-title="{lang="report"}" data-action='reportComment' title='{lang="report_content"}'><span class='ipsResponsive_showPhone ipsResponsive_inline'><i class='fa fa-flag'></i></span><span class='ipsResponsive_hidePhone ipsResponsive_inline'>{lang="report_reply"}</span></a></li>
{{endif}}
{{if \IPS\Member::loggedIn()->modPermission('can_use_ip_tools') and \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'modcp' ) )}}
{{if $comment->ip_address and \IPS\Member::loggedIn()->modPermission('can_use_ip_tools') and \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'modcp' ) )}}
<li><span class='ipsResponsive_hidePhone ipsType_blendLinks'>(<a href="{url="app=core&module=modcp&controller=modcp&tab=ip_tools&ip=$comment->ip_address" seoTemplate="modcp_ip_tools"}">{lang="ip_prefix" sprintf="$comment->ip_address"}</a>) </span></li>
{{endif}}
+4 -4
View File
@@ -25,9 +25,9 @@
"comment": "",
"decimals": null,
"default": "0",
"length": 11,
"length": 20,
"name": "member_id",
"type": "INT",
"type": "BIGINT",
"unsigned": false,
"values": [
@@ -697,9 +697,9 @@
"comment": "",
"decimals": null,
"default": "0",
"length": 10,
"length": 20,
"name": "record_edit_member_id",
"type": "INT",
"type": "BIGINT",
"unsigned": true,
"values": [
+24 -24
View File
@@ -1,52 +1,52 @@
{
"Database": {
"type": "C",
"class": "\\IPS\\Data\\Store\\Database"
},
"Topic": {
"type": "C",
"class": "\\IPS\\forums\\Topic"
},
"Widget": {
"type": "C",
"class": "\\IPS\\Widget"
},
"Post": {
"type": "C",
"class": "\\IPS\\forums\\Topic\\Post"
},
"Url": {
"type": "C",
"class": "\\IPS\\Http\\Url"
},
"InternalUrl": {
"type": "C",
"class": "\\IPS\\Http\\Url\\Internal"
},
"FriendlyUrl": {
"type": "C",
"class": "\\IPS\\Http\\Url\\Friendly"
},
"Lang": {
"type": "C",
"class": "\\IPS\\Lang"
},
"Output": {
"type": "C",
"class": "\\IPS\\Output"
},
"Database": {
"type": "C",
"class": "\\IPS\\Data\\Store\\Database"
},
"Widget": {
"type": "C",
"class": "\\IPS\\Widget"
},
"Lang": {
"type": "C",
"class": "\\IPS\\Lang"
},
"topics": {
"type": "S",
"class": "\\IPS\\Theme\\class_forums_front_topics"
},
"Post": {
"type": "C",
"class": "\\IPS\\forums\\Topic\\Post"
},
"Parser": {
"type": "C",
"class": "\\IPS\\Text\\Parser"
},
"Url": {
"type": "C",
"class": "\\IPS\\Http\\Url"
},
"forums": {
"type": "C",
"class": "\\IPS\\forums\\modules\\admin\\forums\\forums"
},
"InternalUrl": {
"type": "C",
"class": "\\IPS\\Http\\Url\\Internal"
},
"Forum": {
"type": "C",
"class": "\\IPS\\forums\\Forum"
+22 -21
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<javascript app="cms">
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/blocks" javascript_name="ips.blocks.form.js" javascript_type="controller" javascript_version="103005" javascript_position="1000100"><![CDATA[/**
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/blocks" javascript_name="ips.blocks.form.js" javascript_type="controller" javascript_version="103038" javascript_position="1000100"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -142,7 +142,7 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/databases" javascript_name="ips.databases.download.js" javascript_type="controller" javascript_version="103005" javascript_position="1000150">/**
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/databases" javascript_name="ips.databases.download.js" javascript_type="controller" javascript_version="103038" javascript_position="1000150">/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -187,7 +187,7 @@
}
});
}(jQuery, _));</file>
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/databases" javascript_name="ips.databases.form.js" javascript_type="controller" javascript_version="103005" javascript_position="1000150">/**
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/databases" javascript_name="ips.databases.form.js" javascript_type="controller" javascript_version="103038" javascript_position="1000150">/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -250,7 +250,7 @@
}
});
}(jQuery, _));</file>
<file javascript_app="cms" javascript_location="front" javascript_path="controllers/external" javascript_name="ips.external.communication.js" javascript_type="controller" javascript_version="103005" javascript_position="1000150"><![CDATA[/**
<file javascript_app="cms" javascript_location="front" javascript_path="controllers/external" javascript_name="ips.external.communication.js" javascript_type="controller" javascript_version="103038" javascript_position="1000150"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -385,7 +385,7 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/fields" javascript_name="ips.fields.form.js" javascript_type="controller" javascript_version="103005" javascript_position="1000200">/**
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/fields" javascript_name="ips.fields.form.js" javascript_type="controller" javascript_version="103038" javascript_position="1000200">/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -422,7 +422,7 @@
}
});
}(jQuery, _));</file>
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/media" javascript_name="ips.media.main.js" javascript_type="controller" javascript_version="103005" javascript_position="1000300"><![CDATA[/**
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/media" javascript_name="ips.media.main.js" javascript_type="controller" javascript_version="103038" javascript_position="1000300"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -730,11 +730,12 @@
}
var itemId = this._getSelected().closest('[data-role="mediaItem"]').attr('data-fileid');
$( e.currentTarget ).ipsDialog( {
remoteSubmit: true,
forceReload: true,
url: $( e.currentTarget ).attr('data-baseUrl') + itemId,
destructOnClose : true,
title: ips.getString('replaceMediaFile')
});
},
@@ -1060,7 +1061,7 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/pages" javascript_name="ips.pages.embed.js" javascript_type="controller" javascript_version="103005" javascript_position="1000250"><![CDATA[/**
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/pages" javascript_name="ips.pages.embed.js" javascript_type="controller" javascript_version="103038" javascript_position="1000250"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -1106,7 +1107,7 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/pages" javascript_name="ips.pages.form.js" javascript_type="controller" javascript_version="103005" javascript_position="1000250"><![CDATA[/**
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/pages" javascript_name="ips.pages.form.js" javascript_type="controller" javascript_version="103038" javascript_position="1000250"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -1199,7 +1200,7 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="cms" javascript_location="front" javascript_path="controllers/records" javascript_name="ips.records.form.js" javascript_type="controller" javascript_version="103005" javascript_position="1000100"><![CDATA[/**
<file javascript_app="cms" javascript_location="front" javascript_path="controllers/records" javascript_name="ips.records.form.js" javascript_type="controller" javascript_version="103038" javascript_position="1000100"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -1311,7 +1312,7 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="cms" javascript_location="front" javascript_path="controllers/records" javascript_name="ips.records.revisions.js" javascript_type="controller" javascript_version="103005" javascript_position="1000100">/**
<file javascript_app="cms" javascript_location="front" javascript_path="controllers/records" javascript_name="ips.records.revisions.js" javascript_type="controller" javascript_version="103038" javascript_position="1000100">/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -1366,7 +1367,7 @@
}
});
}(jQuery, _));</file>
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.addForm.js" javascript_type="controller" javascript_version="103005" javascript_position="1000050">/**
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.addForm.js" javascript_type="controller" javascript_version="103038" javascript_position="1000050">/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -1416,7 +1417,7 @@
}
});
}(jQuery, _));</file>
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.conflict.js" javascript_type="controller" javascript_version="103005" javascript_position="1000050">/**
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.conflict.js" javascript_type="controller" javascript_version="103038" javascript_position="1000050">/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -1488,7 +1489,7 @@
}
});
}(jQuery, _));</file>
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.fileEditor.js" javascript_type="controller" javascript_version="103005" javascript_position="1000050"><![CDATA[/**
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.fileEditor.js" javascript_type="controller" javascript_version="103038" javascript_position="1000050"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -2354,7 +2355,7 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.fileList.js" javascript_type="controller" javascript_version="103005" javascript_position="1000050"><![CDATA[/**
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.fileList.js" javascript_type="controller" javascript_version="103038" javascript_position="1000050"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -2696,7 +2697,7 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.main.js" javascript_type="controller" javascript_version="103005" javascript_position="1000050">/**
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.main.js" javascript_type="controller" javascript_version="103038" javascript_position="1000050">/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -2737,7 +2738,7 @@
});
}(jQuery, _));</file>
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.variablesDialog.js" javascript_type="controller" javascript_version="103005" javascript_position="1000050">/**
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.variablesDialog.js" javascript_type="controller" javascript_version="103038" javascript_position="1000050">/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -2775,7 +2776,7 @@
}
});
}(jQuery, _));</file>
<file javascript_app="cms" javascript_location="front" javascript_path="mixins" javascript_name="ips.cms.builder.area.js" javascript_type="mixins" javascript_version="103005" javascript_position="1000050"><![CDATA[/**
<file javascript_app="cms" javascript_location="front" javascript_path="mixins" javascript_name="ips.cms.builder.area.js" javascript_type="mixins" javascript_version="103038" javascript_position="1000050"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -2844,7 +2845,7 @@
});
}(jQuery, _));]]></file>
<file javascript_app="cms" javascript_location="front" javascript_path="mixins" javascript_name="ips.cms.builder.block.js" javascript_type="mixins" javascript_version="103005" javascript_position="1000050"><![CDATA[/**
<file javascript_app="cms" javascript_location="front" javascript_path="mixins" javascript_name="ips.cms.builder.block.js" javascript_type="mixins" javascript_version="103038" javascript_position="1000050"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -2952,7 +2953,7 @@
});
}(jQuery, _));]]></file>
<file javascript_app="cms" javascript_location="admin" javascript_path="templates" javascript_name="ips.templates.media.js" javascript_type="template" javascript_version="103005" javascript_position="1000050"><![CDATA[ips.templates.set( 'templates.media.grid', "\
<file javascript_app="cms" javascript_location="admin" javascript_path="templates" javascript_name="ips.templates.media.js" javascript_type="template" javascript_version="103038" javascript_position="1000050"><![CDATA[ips.templates.set( 'templates.media.grid', "\
<ul class='ipsGrid' data-ipsGrid data-ipsGrid-minItemSize='100' data-ipsGrid-maxItemSize='200'>\
{{{contents}}}\
</ul>\
@@ -2969,7 +2970,7 @@ ips.templates.set( 'templates.media.noSearchResults', "\
{{#lang}}mediaNoResults{{/lang}}\
</div>\
");]]></file>
<file javascript_app="cms" javascript_location="admin" javascript_path="templates" javascript_name="ips.templates.templates.js" javascript_type="template" javascript_version="103005" javascript_position="1000050"><![CDATA[/* TEMPLATE EDITOR TEMPLATES */
<file javascript_app="cms" javascript_location="admin" javascript_path="templates" javascript_name="ips.templates.templates.js" javascript_type="template" javascript_version="103038" javascript_position="1000050"><![CDATA[/* TEMPLATE EDITOR TEMPLATES */
/* TEMPLATECEPTION */
ips.templates.set('templates.editor.newTab', " \
<li data-fileid='{{fileid}}' data-location='{{location}}'>\
+10 -6
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<language>
<app key="cms" version="103005">
<app key="cms" version="103038">
<word key="__app_cms" js="0">Pages</word>
<word key="menutab__cms" js="0">Pages</word>
<word key="menutab__cms_icon" js="0">files-o</word>
@@ -174,7 +174,7 @@
<word key="cms_db_relational_with_name_disabled" js="0">Cannot use database '%s' as this database is not assigned to a page</word>
<word key="cms_block_form_display" js="0">Templates</word>
<word key="block_key" js="0">Template Key</word>
<word key="block_key_desc" js="0"><![CDATA[<p class='ipsMessage ipsMessage_info'>The block key ('my_block_key') can be used in HTML templates and manual pages to fetch a specific block, for instance: <span class='ipsType_monospace'>{block="my_block_key"}</span></p><br>The key must be unique for this database. If omitted, a key will be automatically generated.]]></word>
<word key="block_key_desc" js="0"><![CDATA[<p class='ipsMessage ipsMessage_info'>The block key ('my_block_key') can be used in HTML templates and manual pages to fetch a specific block, for instance: <span class='ipsType_monospace'>{block="my_block_key"}</span></p><br>The key must be unique for this block. If omitted, a key will be automatically generated.]]></word>
<word key="cms_block_key_not_unique" js="0">The block key is not unique</word>
<word key="block_cache" js="0">Cache this block</word>
<word key="block_cache_desc" js="0">If your block contains dynamic elements, such as member data, database counts, etc, you will need to prevent this block from being cached.</word>
@@ -229,9 +229,11 @@
<word key="template_group_new_desc" js="0">Please use only a-z and 0-9 without any special characters or spaces. The group name must start with a letter or underscore.</word>
<word key="template_title_desc" js="0">Please use only a-z and 0-9 without any special characters or spaces. The title must start with a letter or underscore.</word>
<word key="template_reserved_word" js="0">The template name may not be any of the following: %s</word>
<word key="cms_theme_designer_mode_warning" js="0"><![CDATA[Theme editing is currently unavailabe in the ACP as you have designers' mode enabled.<br /><a href='%s'>Switch off designers' mode.</a>]]></word>
<word key="cms_theme_designer_mode_warning" js="0"><![CDATA[Theme editing is currently unavailable in the ACP as you have designers' mode enabled.<br /><a href='%s'>Switch off designers' mode.</a>]]></word>
<word key="cms_media_designer_mode_warning" js="0"><![CDATA[Media editing is currently unavailable in the ACP as you have designers' mode enabled.<br /><a href='%s'>Switch off designers' mode.</a>]]></word>
<word key="cms_templates_export_title" js="0">Download Templates</word>
<word key="cms_templates_export_description" js="0">Select the templates to export from the list below. These templates will be added to a single XML file that can be imported to other Invision Community communities.</word>
<word key="cms_templates_export_return" js="0">Return to the template editor</word>
<word key="templates_block" js="0">Blocks</word>
<word key="templates_database" js="0">Database</word>
<word key="templates_page" js="0">Pages</word>
@@ -288,7 +290,7 @@
<word key="cms_err_db_does_not_exist" js="0">That database does not exist.</word>
<word key="cms_err_db_in_use_other_page" js="0">The database added is being used by another page.</word>
<word key="content_acp_page_builder_msg_new" js="0">You can edit this page's content by visiting the page once it has been created.</word>
<word key="content_acp_page_builder_msg_edit" js="0"><![CDATA[You can edit this page's content by visiting the <a href='%s' target='_blank'>page.</a>]]></word>
<word key="content_acp_page_builder_msg_edit" js="0"><![CDATA[You can edit this page's content by visiting the <a href='%s' target='_blank' rel='noopener'>page.</a>]]></word>
<word key="content_launch_page_builder" js="0">Open page builder</word>
<word key="content_launch_page_view" js="0">View page</word>
<word key="page_theme" js="0">Theme</word>
@@ -312,12 +314,12 @@
<word key="cms_page_error_bad_syntax" js="0">The syntax of tags or HTML logic is badly formatted.</word>
<word key="cms_pages_settings" js="0">Advanced Settings</word>
<word key="cms_use_different_gateway" js="0">Use a gateway under your suite root?</word>
<word key="cms_use_different_gateway_desc" js="0"><![CDATA[You can enable this if you have your suite installed in a sub directory but want Pages to appear as your website root. <a href='{external.devdocs-pages_different_root}' target='_blank'>More information</a>]]></word>
<word key="cms_use_different_gateway_desc" js="0"><![CDATA[You can enable this if you have your suite installed in a sub directory but want Pages to appear as your website root. <a href='{external.devdocs-pages_different_root}' target='_blank' rel='noopener'>More information</a>]]></word>
<word key="cms_root_page_url" js="0">URL to gateway file</word>
<word key="pages_gateway_url_not_exist" js="0">The URL could not be found.</word>
<word key="cms_pages_different_gateway_impossible" js="0">Your Invision Community suite is already installed at the root of your domain.</word>
<word key="pages_different_gateway_load_error" js="0">Could not load Pages in this location. Have you uploaded the 'index.php' file?</word>
<word key="pages_different_gateway_load_error_rewrite" js="0"><![CDATA[Could not load Pages in this location. Have you uploaded the 'index.php' file and installed the .htaccess file? <a href='{external.devdocs-pages_different_root}' target='_blank'>More information</a>]]></word>
<word key="pages_different_gateway_load_error_rewrite" js="0"><![CDATA[Could not load Pages in this location. Have you uploaded the 'index.php' file and installed the .htaccess file? <a href='{external.devdocs-pages_different_root}' target='_blank' rel='noopener'>More information</a>]]></word>
<word key="cms_root_page_url_rewrite_desc" js="0"><![CDATA[In order to support this you must <a href='{internal.app=cms&module=pages&controller=pages&do=htaccess}'><strong><u>download this file</u></strong></a>, rename it to '.htaccess' (with no file extension) and upload it to the same location as the special 'index.php' for Pages. If there is already a .htaccess file, add the contents of this one to the existing.<br>If you are not sure how to do this, contact technical support for assistance.]]></word>
<word key="cms_tag_blocks" js="0">Blocks</word>
<word key="cms_tag_databases" js="0">Databases</word>
@@ -640,6 +642,7 @@
<word key="database_field__approved" js="0">Approved</word>
<word key="database_field__comments" js="0">Comments</word>
<word key="database_field__locked" js="0">Locked</word>
<word key="database_field__last_comment" js="0">Last Comment Date</word>
<word key="database_sort_asc" js="0">Ascending (0-9)</word>
<word key="database_sort_desc" js="0">Descending (9-0)</word>
<word key="content_database_form_options_forums" js="0">Forums</word>
@@ -800,6 +803,7 @@
<word key="content_locked_records" js="0">Locked</word>
<word key="content_locked_record" js="0">This record is locked</word>
<word key="content_record_last_comment" js="0">Last comment date</word>
<word key="sort_record_updated" js="0">Last Updated</word>
<word key="content_record_comments" js="0">Number of comments</word>
<word key="content_record_views" js="0">Number of views</word>
<word key="content_record_title" js="0">Title</word>
+4 -4
View File
@@ -1706,9 +1706,9 @@
"comment": "",
"decimals": null,
"default": "0",
"length": 11,
"length": 20,
"name": "comment_user",
"type": "INT",
"type": "BIGINT",
"unsigned": false,
"values": [],
"zerofill": false
@@ -3313,9 +3313,9 @@
"comment": "",
"decimals": null,
"default": "0",
"length": 10,
"length": 20,
"name": "review_author",
"type": "INT",
"type": "BIGINT",
"unsigned": false,
"values": [],
"zerofill": false
+2 -2
View File
@@ -112,7 +112,7 @@
</div>]]></template>
<template template_group="databases" template_name="manageDatabaseName" template_data="$database, $row, $page" template_location="admin" template_app="cms"><![CDATA[<strong>{$database->_title}</strong>
{{if $page}}
<a class="ipsPos_right ipsBadge ipsBadge_style1" href="{$page->url()}" target="_blank">{lang="cms_db_used_on_page" sprintf="$page->_title"}</a>
<a class="ipsPos_right ipsBadge ipsBadge_style1" href="{$page->url()}" target="_blank" rel="noopener">{lang="cms_db_used_on_page" sprintf="$page->_title"}</a>
{{endif}}
<p class='ipsType_light'>{$database->_description}</p>]]></template>
<template template_group="databases" template_name="rebuildCommentCounts" template_data="$id" template_location="admin" template_app="cms"><![CDATA[
@@ -991,7 +991,7 @@
{{$categories = $catClass::roots();}}
{{if !empty( $categories )}}
<h3 class='ipsWidget_title ipsType_reset'>{lang="categories"}</h3>
<div class='ipsSideMenu ipsAreaBackground_reset ipsPad_half'>
<div class='ipsSideMenu ipsCategoriesMenu ipsAreaBackground_reset ipsPad_half'>
<ul class='ipsSideMenu_list'>
{{foreach $categories as $category}}
<li>
+35 -1
View File
@@ -253,9 +253,43 @@
"102046": "4.2.7",
"102047": "4.2.8",
"102048": "4.2.8",
"102049": "4.2.9",
"103000": "4.3.0 Beta 1",
"103002": "4.3.0 Beta 2",
"103003": "4.3.0 Beta 3",
"103004": "4.3.0 Beta 4",
"103005": "4.3.0"
"103005": "4.3.0",
"103006": "4.3.1",
"103007": "4.3.1",
"103008": "4.3.1",
"103009": "4.3.2",
"103010": "4.3.2",
"103011": "4.3.3",
"103012": "4.3.3",
"103013": "4.3.3",
"103014": "4.3.3",
"103015": "4.3.3",
"103016": "4.3.3",
"103017": "4.3.3",
"103018": "4.3.3",
"103019": "4.3.3",
"103020": "4.3.3",
"103021": "4.3.4",
"103022": "4.3.4",
"103023": "4.3.4",
"103024": "4.3.4",
"103025": "4.3.4",
"103026": "4.3.5 Beta 1",
"103027": "4.3.5 Beta 2",
"103028": "4.3.5",
"103029": "4.3.5",
"103030": "4.3.5",
"103031": "4.3.5",
"103032": "4.3.5",
"103033": "4.3.6 Beta 1",
"103034": "4.3.6 Beta 2",
"103035": "4.3.6",
"103036": "4.3.6",
"103037": "4.3.6",
"103038": "4.3.6"
}
+1 -4
View File
@@ -11,10 +11,7 @@
},
"Wysiwyg": {
"class": "\\IPS\\Widget\\StaticCache",
"restrict": [
"sidebar",
"cms"
],
"restrict": [],
"default_area": "",
"allow_reuse": true,
"menu_style": "modal",
@@ -35,7 +35,7 @@ class _Records
foreach( \IPS\cms\Databases::databases() as $database )
{
$theOnlyCategory = NULL;
if ( $database->page_id > 0 and $database->can('add') )
if ( $database->page_id > 0 and $database->can('view') and $database->can('add') )
{
$catClass = '\IPS\cms\Categories' . $database->id;
if ( $catClass::canOnAny('add') )
@@ -47,13 +47,13 @@ class _Records
if( $database->use_categories AND $theOnlyCategory = $catClass::theOnlyNode() )
{
$items[ 'cms_create_menu_records_' . $database->id ] = array(
'link' => $theOnlyCategory->url()->setQueryString('do', 'form')
'link' => $theOnlyCategory->url()->setQueryString( array( 'do' => 'form', 'd' => $database->id ) )
);
continue;
}
$items[ 'cms_create_menu_records_' . $database->id ] = array(
'link' => $page->url()->setQueryString('do', 'form'),
'link' => $page->url()->setQueryString( array( 'do' => 'form', 'd' => $database->id ) ),
'extraData' => ( $database->use_categories ) ? array( 'data-ipsDialog' => true, 'data-ipsDialog-size' => "narrow" ) : array(),
'title' => 'cms_select_category'
);
@@ -48,14 +48,15 @@ class _BlockContent
/**
* Permission check for attachments
*
* @param \IPS\Member $member The member
* @param int|null $id1 Primary ID
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @param \IPS\Member $member The member
* @param int|null $id1 Primary ID
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @param array $attachment The attachment data
* @param bool $viewOnly If true, just check if the user can see the attachment rather than download it
* @return bool
*/
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment )
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment, $viewOnly=FALSE )
{
try
{
@@ -59,14 +59,15 @@ class _Records
/**
* Permission check for attachments
*
* @param \IPS\Member $member The member
* @param int|null $id1 Primary ID
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @param \IPS\Member $member The member
* @param int|null $id1 Primary ID
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @param array $attachment The attachment data
* @param bool $viewOnly If true, just check if the user can see the attachment rather than download it
* @return bool
*/
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment )
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment, $viewOnly=FALSE )
{
if ( ! $id3 )
{
@@ -48,14 +48,15 @@ class _Widgets
/**
* Permission check for attachments
*
* @param \IPS\Member $member The member
* @param int|null $id1 Primary ID
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @param \IPS\Member $member The member
* @param int|null $id1 Primary ID
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @param array $attachment The attachment data
* @param bool $viewOnly If true, just check if the user can see the attachment rather than download it
* @return bool
*/
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment )
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment, $viewOnly=FALSE )
{
if ( ! $id3 )
{
@@ -12,24 +12,15 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
/**
* Front Navigation Extension: Pages
*/
class _Cms extends \IPS\core\FrontNavigation\FrontNavigationAbstract
class _Cms
{
/**
* Get Title
* @deprecated
*
* @return string
* @return bool
*/
public function title()
{
}
/**
* Get Link
*
* @return \IPS\Http\Url
*/
public function link()
final public function deprecated()
{
return TRUE;
}
}
@@ -80,6 +80,7 @@ class _RebuildCategories
{
$cat = $class::constructFromData( $row );
$cat->setLastComment();
$cat->setLastReview();
$cat->save();
$parsed++;
@@ -84,7 +84,15 @@ class _ResyncTopicContent
$class = '\IPS\cms\Records' . $data['databaseId'];
$where = NULL;
$parsed = 0;
$database = \IPS\cms\Databases::load( $data['databaseId'] );
try
{
$database = \IPS\cms\Databases::load( $data['databaseId'] );
}
catch ( \OutOfRangeException $e )
{
throw new \IPS\Task\Queue\OutOfRangeException;
}
if ( ! $database->forum_record )
{
$cats = iterator_to_array( \IPS\Db::i()->select( 'category_id', 'cms_database_categories', array( 'category_forum_record=1 AND category_database_id=?', $data['databaseId'] ) ) );
@@ -43,6 +43,24 @@ class _Databases
'sitemap_databases_priority' => new \IPS\Helpers\Form\Select( 'sitemap_databases_priority', \IPS\Settings::i()->sitemap_databases_priority, FALSE, array( 'options' => \IPS\Sitemap::$priorities, 'unlimited' => '-1', 'unlimitedLang' => 'sitemap_dont_include' ), NULL, NULL, NULL, 'sitemap_databases_priority' )
);
}
/**
* Save settings for ACP configuration
*
* @param array $values Values
* @return void
*/
public function saveSettings( $values )
{
if ( $values['sitemap_configuration_info'] )
{
\IPS\Settings::i()->changeValues( array( 'sitemap_databases_count' => $this->recommendedSettings['sitemap_databases_count'], 'sitemap_databases_priority' => $this->recommendedSettings['sitemap_databases_priority'] ) );
}
else
{
\IPS\Settings::i()->changeValues( array( 'sitemap_databases_count' => $values['sitemap_databases_count'], 'sitemap_databases_priority' => $values['sitemap_databases_priority'] ) );
}
}
/**
* Get the sitemap filename(s)
@@ -115,6 +133,12 @@ class _Databases
*/
public function generateSitemap( $filename, $sitemap )
{
/* We have elected to not add databases to the sitemap */
if ( ! \IPS\Settings::i()->sitemap_databases_count )
{
return NULL;
}
$tmp = explode( '_', $filename );
$databaseId = intval( array_shift( $tmp ) );
$database = \IPS\cms\Databases::load( $databaseId );
@@ -165,7 +189,14 @@ class _Databases
$totalLimit = \IPS\Settings::i()->sitemap_databases_count;
if ( $totalLimit > -1 and ( $offset + $limit ) > $totalLimit )
{
$limit = $totalLimit - $offset;
if ( $totalLimit < $limit )
{
$limit = $totalLimit;
}
else
{
$limit = $totalLimit - $offset;
}
}
foreach ( $class::getItemsWithPermission( $class::sitemapWhere(), NULL, array( $offset, $limit ), 'read', \IPS\Content\Hideable::FILTER_PUBLIC_ONLY, 0, new \IPS\Member, TRUE ) as $item )
@@ -43,6 +43,24 @@ class _Pages
'sitemap_pages_priority' => new \IPS\Helpers\Form\Select( 'sitemap_pages_priority', \IPS\Settings::i()->sitemap_pages_priority, FALSE, array( 'options' => \IPS\Sitemap::$priorities, 'unlimited' => '-1', 'unlimitedLang' => 'sitemap_dont_include' ), NULL, NULL, NULL, 'sitemap_pages_priority' )
);
}
/**
* Save settings for ACP configuration
*
* @param array $values Values
* @return void
*/
public function saveSettings( $values )
{
if ( $values['sitemap_configuration_info'] )
{
\IPS\Settings::i()->changeValues( array( 'sitemap_pages_count' => $this->recommendedSettings['sitemap_pages_count'], 'sitemap_pages_priority' => $this->recommendedSettings['sitemap_pages_priority'] ) );
}
else
{
\IPS\Settings::i()->changeValues( array( 'sitemap_pages_count' => $values['sitemap_pages_count'], 'sitemap_pages_priority' => $values['sitemap_pages_priority'] ) );
}
}
/**
* Get the sitemap filename(s)
@@ -82,6 +100,12 @@ class _Pages
*/
public function generateSitemap( $filename, $sitemap )
{
/* We have elected to not add databases to the sitemap */
if ( ! \IPS\Settings::i()->sitemap_pages_count )
{
return NULL;
}
$class = '\IPS\cms\Pages\Page';
$count = 0;
$member = new \IPS\Member;
@@ -97,7 +121,14 @@ class _Pages
$totalLimit = \IPS\Settings::i()->sitemap_pages_count;
if ( $totalLimit > -1 and ( $offset + $limit ) > $totalLimit )
{
$limit = $totalLimit - $offset;
if ( $totalLimit < $limit )
{
$limit = $totalLimit;
}
else
{
$limit = $totalLimit - $offset;
}
}
$where = array( array( '(' . \IPS\Db::i()->findInSet( 'perm_' . $class::$permissionMap[ $permissionCheck ], $member->groups ) . ' OR ' . 'perm_' . $class::$permissionMap[ $permissionCheck ] . '=? )', '*' ) );
+26
View File
@@ -8,6 +8,32 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
class cms_hook_Topic extends _HOOK_CLASS_
{
/**
* Can view?
*
* @param \IPS\Member|NULL $member The member to check for or NULL for the currently logged in member
* @return bool
*/
public function canView( $member=NULL )
{
$canView = parent::canView( $member );
$member = $member ? $member : \IPS\Member::loggedIn();
/* Whitelist which types of do we allow */
$do = array( 'editComment' );
if ( ! $canView )
{
/* Check to see if it's attached to a database record and we are not a guest */
if ( isset( \IPS\Request::i()->do ) and in_array( \IPS\Request::i()->do, $do ) and $record = \IPS\cms\Records::getLinkedRecord( $this ) and $member->member_id )
{
return $record->canView();
}
}
return $canView;
}
/**
* Do Moderator Action
*
+10
View File
@@ -22,6 +22,16 @@ public static function hookData() {
<li class=\'ipsMenu_item\'>
<a href=\'{url="app=cms&module=database&controller=topic&id=$topic->tid&_new=1" base="front" seoTemplate="topic_copy" seoTitle="$topic->title_seo"}\' data-ipsDialog data-ipsDialog-size=\'narrow\' data-ipsDialog-remoteVerify=\'false\' data-ipsDialog-title=\'{lang="copy_select_database"}\'>{lang="copy_topic_to_database"}</a>
</li>
{{endif}}',
),
1 =>
array (
'selector' => '#elTopicActionsBottom_menu',
'type' => 'add_inside_start',
'content' => '{{if $topic->hidden() != -2 and \IPS\Member::loggedIn()->modPermission( \'can_copy_topic_database\' )}}
<li class=\'ipsMenu_item\'>
<a href=\'{url="app=cms&module=database&controller=topic&id=$topic->tid&_new=1" base="front" seoTemplate="topic_copy" seoTitle="$topic->title_seo"}\' data-ipsDialog data-ipsDialog-size=\'narrow\' data-ipsDialog-remoteVerify=\'false\' data-ipsDialog-title=\'{lang="copy_select_database"}\'>{lang="copy_topic_to_database"}</a>
</li>
{{endif}}',
),
),
@@ -27,7 +27,16 @@ if ( \IPS\Theme::designersModeEnabled() )
if ( isset( \IPS\Request::i()->file ) )
{
$file = file_get_contents( \IPS\ROOT_PATH . '/' . \IPS\Request::i()->file );
$realPath = realpath( \IPS\ROOT_PATH . '/themes/' . \IPS\Request::i()->file );
$pathContainer = realpath(\IPS\ROOT_PATH . '/themes/' );
if( $realPath === FALSE OR mb_substr( $realPath, 0, mb_strlen( $pathContainer ) ) !== $pathContainer )
{
\IPS\Output::i()->error( 'node_error', '3C171/8', 403, '' );
exit;
}
$file = file_get_contents( \IPS\ROOT_PATH . '/themes/' . \IPS\Request::i()->file );
\IPS\Output::i()->sendOutput( preg_replace( '#<ips:template.+?\n#', '', $file ), 200, ( mb_substr( \IPS\Request::i()->file, -4 ) === '.css' ) ? 'text/css' : 'text/javascript' );
}
@@ -35,6 +35,12 @@ class _categories extends \IPS\Node\Controller
*/
public function execute()
{
/* This controller can not be accessed without a database ID */
if( !\IPS\Request::i()->database_id )
{
\IPS\Output::i()->error( 'node_error', '2S390/1', 404, '' );
}
$this->url = $this->url->setQueryString( array( 'database_id' => \IPS\Request::i()->database_id ) );
/* Assign the correct nodeClass so contentItem is specified */
@@ -1593,11 +1593,12 @@ class _databases extends \IPS\Node\Controller
), NULL, NULL, NULL, 'database_cat_index_type' ) );
$fields = array(
'primary_id_field' => 'database_field__id',
'member_id' => 'database_field__member',
'record_publish_date' => 'database_field__saved',
'record_last_comment' => ( $current and $current->_comment_bump === \IPS\cms\Databases::BUMP_ON_EDIT ) ? 'database_field__edited' : 'database_field__updated',
'record_rating' => 'database_field__rating'
'primary_id_field' => 'database_field__id',
'member_id' => 'database_field__member',
'record_publish_date' => 'database_field__saved',
'record_updated' => ( $current and $current->_comment_bump === \IPS\cms\Databases::BUMP_ON_EDIT ) ? 'database_field__edited' : 'database_field__updated',
'record_last_comment' => "database_field__last_comment",
'record_rating' => 'database_field__rating'
);
if ( $current )
@@ -351,14 +351,14 @@ class _records extends \IPS\Dispatcher\Controller
$fieldsClass = 'IPS\cms\Fields' . \IPS\Request::i()->database_id;
$catClass = 'IPS\cms\Categories' . \IPS\Request::i()->database_id;
$container = ( $current ) ? $catClass::load( $current->category_id ) : ( isset( \IPS\Request::i()->category_id ) ? $catClass::load( \IPS\Request::i()->category_id ) : NULL );
$customFields = $fieldsClass::fields( $customValues, 'view', $container, 0, $current );
$manuallyHandledFields = array( 'record_publish_date', 'record_expiry_date', 'record_allow_comments', 'record_comment_cutoff', 'record_meta_keywords', 'record_meta_description' );
$form = new \IPS\Helpers\Form();
$form->addTab( 'content_database_record_tab_content' );
$formElements = $class::formElements( $current, $container );
$formElements = $class::formElements( $current, $container );
$customFields = $class::$customFields;
foreach( $formElements as $name => $field )
{
@@ -457,13 +457,15 @@ class _records extends \IPS\Dispatcher\Controller
}
$current = $recordClass::createFromForm( $values, $category );
}
else
{
/* Claim attachments */
foreach( $fieldClass::data() as $key => $field )
{
if ( mb_ucfirst( $field->type ) === 'Editor' )
{
\IPS\File::claimAttachments( 'RecordField_'. $field->id , $current->id, NULL, 'RecordField_'. $field->id, FALSE );
\IPS\File::claimAttachments( 'RecordField_' . ( $new ? 'new' : $current->primary_id_field ) . '_' . $field->id , $current->primary_id_field, $field->id, \IPS\Request::i()->database_id );
}
}
}
+101 -85
View File
@@ -107,92 +107,100 @@ class _media extends \IPS\Node\Controller
*/
protected function manage()
{
$url = \IPS\Http\Url::internal( "app=cms&module=pages&controller=media" );
/* Display the table */
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__cms_pages_media');
$output = new \IPS\Helpers\Tree\Tree( $url, 'menu__cms_pages_media',
/* Get Roots */
function () use ( $url )
{
$data = \IPS\cms\modules\admin\pages\media::getRowsForTree( 0 );
$rows = array();
foreach ( $data as $id => $row )
{
if( ( \IPS\Request::i()->isAjax() && $row instanceof \IPS\cms\Media ) || !\IPS\Request::i()->isAjax() )
{
$rows[ $id ] = ( $row instanceof \IPS\cms\Media) ? \IPS\cms\modules\admin\pages\media::getItemRow( $row, $url ) : \IPS\cms\modules\admin\pages\media::getFolderRow( $row, $url );
}
}
if( \IPS\Request::i()->isAjax() ){
\IPS\Output::i()->sendOutput( json_encode( $rows ), 200, 'application/json', \IPS\Output::i()->httpHeaders );
}
return $data;
},
/* Get Row */
function ( $id, $root ) use ( $url )
{
if ( $root )
{
return \IPS\cms\modules\admin\pages\media::getFolderRow( \IPS\cms\Media\Folder::load( $id ), $url );
}
else
{
return \IPS\cms\modules\admin\pages\media::getItemRow( \IPS\cms\Media::load( $id ), $url );
}
},
/* Get Row Parent ID*/
function ()
{
return NULL;
},
/* Get Children */
function ( $id ) use ( $url )
{
$rows = array();
$data = \IPS\cms\modules\admin\pages\media::getRowsForTree( $id );
if ( ! isset( \IPS\Request::i()->subnode ) )
{
foreach ( $data as $id => $row )
{
if( \IPS\Request::i()->get == 'folders' && !( $row instanceof \IPS\cms\Media ) )
{
$rows[ $id ] = \IPS\cms\modules\admin\pages\media::getFolderRow( $row, $url );
}
elseif ( \IPS\Request::i()->get == 'files' && $row instanceof \IPS\cms\Media )
{
$rows[ $id ] = \IPS\cms\modules\admin\pages\media::getItemRow( $row, $url );
}
}
}
if( \IPS\Request::i()->isAjax() ){
\IPS\Output::i()->sendOutput( json_encode( $rows ), 200, 'application/json', \IPS\Output::i()->httpHeaders );
}
return $rows;
},
array( $this, '_getRootButtons' ),
TRUE,
FALSE,
FALSE
);
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'admin_media.js', 'cms' ) );
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'media/media.css', 'cms', 'admin' ) );
if( \IPS\Request::i()->isAjax() )
if ( \IPS\Theme::designersModeEnabled() )
{
\IPS\Output::i()->sendOutput( $output, 200, 'text/html', \IPS\Output::i()->httpHeaders );
$link = \IPS\Http\Url::internal( 'app=core&module=customization&controller=themes&do=designersmode' );
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' )->message( \IPS\Member::loggedIn()->language()->addToStack('cms_media_designer_mode_warning', NULL, array( 'sprintf' => array( $link ) ) ), 'information', NULL, FALSE );
}
else
{
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'media', 'cms', 'admin' )->media( $output );
$url = \IPS\Http\Url::internal( "app=cms&module=pages&controller=media" );
/* Display the table */
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__cms_pages_media');
$output = new \IPS\Helpers\Tree\Tree( $url, 'menu__cms_pages_media',
/* Get Roots */
function () use ( $url )
{
$data = \IPS\cms\modules\admin\pages\media::getRowsForTree( 0 );
$rows = array();
foreach ( $data as $id => $row )
{
if( ( \IPS\Request::i()->isAjax() && $row instanceof \IPS\cms\Media ) || !\IPS\Request::i()->isAjax() )
{
$rows[ $id ] = ( $row instanceof \IPS\cms\Media) ? \IPS\cms\modules\admin\pages\media::getItemRow( $row, $url ) : \IPS\cms\modules\admin\pages\media::getFolderRow( $row, $url );
}
}
if( \IPS\Request::i()->isAjax() ){
\IPS\Output::i()->sendOutput( json_encode( $rows ), 200, 'application/json', \IPS\Output::i()->httpHeaders );
}
return $data;
},
/* Get Row */
function ( $id, $root ) use ( $url )
{
if ( $root )
{
return \IPS\cms\modules\admin\pages\media::getFolderRow( \IPS\cms\Media\Folder::load( $id ), $url );
}
else
{
return \IPS\cms\modules\admin\pages\media::getItemRow( \IPS\cms\Media::load( $id ), $url );
}
},
/* Get Row Parent ID*/
function ()
{
return NULL;
},
/* Get Children */
function ( $id ) use ( $url )
{
$rows = array();
$data = \IPS\cms\modules\admin\pages\media::getRowsForTree( $id );
if ( ! isset( \IPS\Request::i()->subnode ) )
{
foreach ( $data as $id => $row )
{
if( \IPS\Request::i()->get == 'folders' && !( $row instanceof \IPS\cms\Media ) )
{
$rows[ $id ] = \IPS\cms\modules\admin\pages\media::getFolderRow( $row, $url );
}
elseif ( \IPS\Request::i()->get == 'files' && $row instanceof \IPS\cms\Media )
{
$rows[ $id ] = \IPS\cms\modules\admin\pages\media::getItemRow( $row, $url );
}
}
}
if( \IPS\Request::i()->isAjax() ){
\IPS\Output::i()->sendOutput( json_encode( $rows ), 200, 'application/json', \IPS\Output::i()->httpHeaders );
}
return $rows;
},
array( $this, '_getRootButtons' ),
TRUE,
FALSE,
FALSE
);
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'admin_media.js', 'cms' ) );
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'media/media.css', 'cms', 'admin' ) );
if( \IPS\Request::i()->isAjax() )
{
\IPS\Output::i()->sendOutput( $output, 200, 'text/html', \IPS\Output::i()->httpHeaders );
}
else
{
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'media', 'cms', 'admin' )->media( $output );
}
}
}
@@ -220,7 +228,7 @@ class _media extends \IPS\Node\Controller
$form = new \IPS\Helpers\Form( 'form', 'upload' );
$form->class = 'ipsForm_vertical ipsForm_noLabels';
$form->add( new \IPS\Helpers\Form\Upload( 'media_filename', NULL, FALSE, array( 'allowedFileTypes' => array_merge( \IPS\File::$safeFileExtensions, array( 'pdf' ) ), 'obscure' => FALSE, 'maxFileSize' => 5, 'storageExtension' => 'core_Theme', 'storageContainer' => 'pages_media', 'multiple' => FALSE, 'minimize' => FALSE ), NULL, NULL, NULL, 'media_filename' ) );
$form->add( new \IPS\Helpers\Form\Upload( 'media_filename', NULL, FALSE, array( 'allowedFileTypes' => array_merge( \IPS\File::$safeFileExtensions, array( 'pdf' ) ), 'obscure' => FALSE, 'maxFileSize' => 5, 'storageExtension' => 'cms_Media', 'storageContainer' => 'pages_media', 'multiple' => FALSE, 'minimize' => FALSE ), NULL, NULL, NULL, 'media_filename' ) );
if ( $values = $form->values() )
{
@@ -250,7 +258,11 @@ class _media extends \IPS\Node\Controller
$values['media_filename']->delete();
}
catch( \Exception $ex ) { }
/* Wipe out included JS just in case we're using this media thing */
\IPS\cms\Templates::deleteCompiledFiles();
\IPS\cms\Pages\Page::deleteCachedIncludes();
if ( \IPS\Request::i()->isAjax() )
{
$url = \IPS\Http\Url::internal( "app=cms&module=pages&controller=media" );
@@ -286,7 +298,7 @@ class _media extends \IPS\Node\Controller
$form = new \IPS\Helpers\Form( 'form', 'upload' );
$form->class = 'ipsForm_vertical ipsForm_noLabels';
$form->add( new \IPS\Helpers\Form\Upload( 'media_filename', NULL, FALSE, array( 'allowedFileTypes' => array_merge( \IPS\File::$safeFileExtensions, array( 'pdf', 'svg' ) ), 'obscure' => FALSE, 'maxFileSize' => 5, 'storageExtension' => 'core_Theme', 'storageContainer' => 'pages_media', 'multiple' => true, 'minimize' => FALSE ), NULL, NULL, NULL, 'media_filename' ) );
$form->add( new \IPS\Helpers\Form\Upload( 'media_filename', NULL, FALSE, array( 'allowedFileTypes' => array_merge( \IPS\File::$safeFileExtensions, array( 'pdf', 'svg' ) ), 'obscure' => FALSE, 'maxFileSize' => 5, 'storageExtension' => 'cms_Media', 'storageContainer' => 'pages_media', 'multiple' => true, 'minimize' => FALSE ), NULL, NULL, NULL, 'media_filename' ) );
if ( ! isset( \IPS\Request::i()->media_parent ) and ! \IPS\Request::i()->media_parent )
{
@@ -350,6 +362,10 @@ class _media extends \IPS\Node\Controller
$count++;
}
/* Wipe out included JS just in case we're using this media thing */
\IPS\cms\Templates::deleteCompiledFiles();
\IPS\cms\Pages\Page::deleteCachedIncludes();
if ( \IPS\Request::i()->isAjax() )
{
$url = \IPS\Http\Url::internal( "app=cms&module=pages&controller=media" );
@@ -214,6 +214,7 @@ class _templates extends \IPS\Dispatcher\Controller
{
$form->add( new \IPS\Helpers\Form\CheckboxSet( 'templates_' . $location, FALSE, FALSE, array( 'options' => $data ) ) );
}
$form->addButton( 'cms_templates_export_return', 'link', \IPS\Http\Url::internal( "app=cms&module=pages&controller=templates" ) );
if ( $values = $form->values() )
{
@@ -331,7 +332,10 @@ class _templates extends \IPS\Dispatcher\Controller
\IPS\Output::i()->error( 'cms_no_templates_selected', '1T285/1', 403, '' );
}
}
\IPS\Output::i()->breadcrumb[] = array( \IPS\Http\Url::internal( "app=cms&module=pages&controller=templates" ), \IPS\Member::loggedIn()->language()->addToStack( 'menu__cms_pages_templates' ) );
\IPS\Output::i()->breadcrumb[] = array( NULL, \IPS\Member::loggedIn()->language()->addToStack('cms_templates_export_title') );
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('cms_templates_export_title');
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global', 'core', 'admin' )->block( 'cms_templates_export_title', $form, FALSE );
}
@@ -435,7 +439,6 @@ class _templates extends \IPS\Dispatcher\Controller
'icon' => 'download',
'title' => 'cms_templates_export_title',
'link' => \IPS\Http\Url::internal( "app=cms&module=pages&controller=templates&do=export" ),
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('cms_templates_export_title') )
);
\IPS\Output::i()->sidebar['actions']['upload'] = array(
@@ -956,16 +959,64 @@ class _templates extends \IPS\Dispatcher\Controller
foreach( \IPS\cms\Templates::$databaseDefaults as $field => $template )
{
\IPS\Db::i()->update( 'cms_databases', array( 'database_template_' . $field => $new ), array( 'database_template_' . $field . ' =?', \IPS\Request::i()->group ) );
\IPS\Db::i()->update( 'cms_databases', array( 'database_template_' . $field => mb_strtolower( $new ) ), array( 'database_template_' . $field . ' =?', \IPS\Request::i()->group ) );
}
unset( \IPS\Data\Store::i()->cms_databases );
$this->findAndUpdateTemplates( $new, \IPS\Request::i()->group );
}
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=cms&module=pages&controller=templates' . ( isset( \IPS\Request::i()->t_location ) ? '&t_location=' . \IPS\Request::i()->t_location : '' ) ), 'deleted' );
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=cms&module=pages&controller=templates' . ( isset( \IPS\Request::i()->t_location ) ? '&t_location=' . \IPS\Request::i()->t_location : '' ) ), 'saved' );
}
/* Display */
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global', 'core' )->block( \IPS\Member::loggedIn()->language()->addToStack('cms_template_database_options'), $form, FALSE, '', NULL, TRUE );
}
/**
* Find templates referencing a template and update them
*
* @param string $new New template group name
* @param string $old Old template group name
* @return void
*/
protected function findAndUpdateTemplates( $new, $old )
{
foreach( \IPS\Db::i()->select( '*', 'cms_templates', array( 'template_content LIKE ?', '%' . $old . '%' ) ) as $template )
{
/* Make sure template tags call the correct group */
if ( mb_stristr( $template['template_content'], '{template' ) )
{
preg_match_all( '/\{([a-z]+?=([\'"]).+?\\2 ?+)}/', $template['template_content'], $matches, PREG_SET_ORDER );
/* Work out the plugin and the values to pass */
foreach( $matches as $index => $array )
{
preg_match_all( '/(.+?)=' . $array[ 2 ] . '(.+?)' . $array[ 2 ] . '\s?/', $array[ 1 ], $submatches );
$plugin = array_shift( $submatches[ 1 ] );
if ( $plugin == 'template' )
{
$value = array_shift( $submatches[ 2 ] );
$options = array();
foreach ( $submatches[ 1 ] as $k => $v )
{
$options[ $v ] = $submatches[ 2 ][ $k ];
}
if ( isset( $options['app'] ) and $options['app'] == 'cms' and isset( $options['location'] ) and $options['location'] == 'database' and isset( $options['group'] ) and $options['group'] == mb_strtolower( $old ) )
{
$replace = '{template="' . $value . '" app="' . $options['app'] . '" location="' . $options['location'] . '" group="' . mb_strtolower( $new ) . '" params="' . ( isset( $options['params'] ) ? $options['params'] : NULL ) . '"}';
\IPS\Db::i()->update( 'cms_templates', array( 'template_content' => str_replace( $matches[$index][0], $replace, $template['template_content'] ) ), array( 'template_id=?', $template['template_id'] ) );
}
}
}
}
}
}
/**
* Delete the template group! OH NOES
@@ -184,16 +184,16 @@ class _category extends \IPS\cms\Databases\Controller
$sortFields[ $database->field_title ] = $fieldClass::load( $database->field_title );
foreach( $sortFields as $id => $obj )
{
if ( $table->sortBy == 'field_' . $id )
if ( $table->sortBy == $RecordsClass::$databaseTable . '.' . 'field_' . $id OR $table->sortBy == 'field_' . $id )
{
if ( $obj->type == 'Number' )
{
$table->sortBy = 'LENGTH(`field_' . $id . '`) ' . $table->sortDirection . ',`field_' . $id . '`';
$table->sortOptions[ $table->sortBy ] = 'LENGTH(`field_' . $id . '`) ' . $table->sortDirection . ',`field_' . $id . '`';
break;
}
elseif( $obj->type == 'Date' )
{
$table->sortBy = 'CAST(`field_' . $id . '` AS UNSIGNED)';
$table->sortOptions[ $table->sortBy ] = 'CAST(`field_' . $id . '` AS UNSIGNED)';
break;
}
}
@@ -231,7 +231,7 @@ class _category extends \IPS\cms\Databases\Controller
}
$sortBy = array(
'record_last_comment' => 'content_record_last_comment',
'record_updated' => 'content_record_last_updated',
'record_comments' => 'content_record_comments',
'record_views' => 'content_record_views',
'field_' . $database->field_title => 'content_record_title',
@@ -241,6 +241,9 @@ class _category extends \IPS\cms\Databases\Controller
/* Ensure we have all sort options available */
$table->sortOptions = array_unique( array_merge( $table->sortOptions, array_combine( array_keys( $sortBy ), array_keys( $sortBy ) ) ) );
/* To avoid confusion, label 'updated' as 'Recently Updated' as last comment */
\IPS\Member::loggedIn()->language()->words[ $table->langPrefix . 'sort_updated' ] = \IPS\Member::loggedIn()->language()->addToStack('content_record_last_comment');
if ( !isset( $sortBy[ $database->field_sort ] ) )
{
switch ( $database->field_sort )
@@ -325,7 +328,18 @@ class _category extends \IPS\cms\Databases\Controller
$table->advancedSearch['sort_by'][1]['options']['field_' . $obj->id ] = 'content_field_' . $obj->id;
}
$table->sortOptions[ 'field_' . $obj->id ] = isset( $table->sortOptions[ 'field_' . $obj->id ] ) ? $table->sortOptions[ 'field_' . $obj->id ] : 'field_' . $obj->id;
if ( in_array( $obj->type, array( 'Date', 'DateRange' ) ) )
{
$table->sortOptions[ 'field_' . $obj->id ] = 'CAST(`field_' . $obj->id . '` AS UNSIGNED)';
}
else if ( $obj->type == 'Number' )
{
$table->sortOptions[ 'field_' . $obj->id ] = 'LENGTH(`field_' . $obj->id . '`) ' . $table->sortDirection . ',`field_' . $obj->id . '`';
}
else
{
$table->sortOptions[ 'field_' . $obj->id ] = isset( $table->sortOptions[ 'field_' . $obj->id ] ) ? $table->sortOptions[ 'field_' . $obj->id ] : 'field_' . $obj->id;
}
}
$table->advancedSearchCallback = function( $table, $values ) use ( $database, $sortBy, $customFields )
@@ -414,17 +428,18 @@ class _category extends \IPS\cms\Databases\Controller
{
if ( isset( $customFields[ mb_substr( $values['sort_by'], 6 ) ] ) and $customFields[ mb_substr( $values['sort_by'], 6 ) ]->type == 'Number' )
{
$table->sortBy = 'LENGTH(`' . $values['sort_by'] . '`) ' . $table->sortDirection . ',`' . $values['sort_by'] . '`';
$table->sortOptions[ $values['sort_by'] ] = 'LENGTH(`' . $values['sort_by'] . '`) ' . $table->sortDirection . ',`' . $values['sort_by'] . '`';
}
elseif( isset( $customFields[ mb_substr( $values['sort_by'], 6 ) ] ) and $customFields[ mb_substr( $values['sort_by'], 6 ) ]->type == 'Date' )
{
$table->sortBy = 'CAST(`' . $values['sort_by'] . '` AS UNSIGNED)';
$table->sortOptions[ $values['sort_by'] ] = 'CAST(`' . $values['sort_by'] . '` AS UNSIGNED)';
}
else
{
$table->sortBy = $values['sort_by'];
$table->sortOptions[ $values['sort_by'] ] = $values['sort_by'];
}
$table->sortBy = $values['sort_by'];
$table->sortDirection = $values['sort_direction'];
}
@@ -163,10 +163,29 @@ class _index extends \IPS\cms\Databases\Controller
*/
protected function form()
{
/* If the page is the default page and Pages is the default app, the node selector cannot find the page as it bypasses the Database dispatcher */
if ( \IPS\cms\Pages\Page::$currentPage === NULL and \IPS\cms\Databases\Dispatcher::i()->databaseId === NULL and isset( \IPS\Request::i()->page_id ) )
{
try
{
\IPS\cms\Pages\Page::$currentPage = \IPS\cms\Pages\Page::load( \IPS\Request::i()->page_id );
$database = \IPS\cms\Pages\Page::$currentPage->getDatabase();
}
catch( \OutOfRangeException $e )
{
\IPS\Output::i()->error( 'content_err_page_404', '2T389/1', 404, '' );
}
}
else if ( \IPS\cms\Pages\Page::$currentPage === NULL and \IPS\cms\Databases\Dispatcher::i()->databaseId === NULL and isset( \IPS\Request::i()->d ) )
{
\IPS\cms\Pages\Page::$currentPage = \IPS\cms\Pages\Page::loadByDatabaseId( \IPS\Request::i()->d );
}
$form = new \IPS\Helpers\Form( 'select_category', 'continue' );
$form->class = 'ipsForm_vertical ipsForm_noLabels';
$form->add( new \IPS\Helpers\Form\Node( 'category', NULL, TRUE, array(
'url' => \IPS\cms\Pages\Page::$currentPage->url()->setQueryString('do', 'form'),
'url' => \IPS\cms\Pages\Page::$currentPage->url()->setQueryString( array( 'do' => 'form', 'page_id' => \IPS\cms\Pages\Page::$currentPage->id ) ),
'class' => 'IPS\cms\Categories' . \IPS\cms\Databases\Dispatcher::i()->databaseId,
'permissionCheck' => function( $node )
{
@@ -262,17 +262,17 @@ class _record extends \IPS\Content\Controller
\IPS\Output::i()->jsonLd['article']['aggregateRating'] = array(
'@type' => 'AggregateRating',
'ratingValue' => $record->averageReviewRating(),
'ratingCount' => $record->rating_hits,
'reviewCount' => $record->record_reviews,
'bestRating' => \IPS\Settings::i()->reviews_rating_out_of
);
}
elseif( $record->container()->allow_rating )
elseif( $record->container()->allow_rating AND $record->averageRating() AND $record->numberOfRatings() )
{
\IPS\Output::i()->jsonLd['article']['aggregateRating'] = array(
'@type' => 'AggregateRating',
'ratingValue' => $record->averageRating(),
'ratingCount' => $record->numberOfRatings(),
'bestRating' => \IPS\Settings::i()->reviews_rating_out_of
);
}
@@ -605,10 +605,21 @@ class _record extends \IPS\Content\Controller
$title = \IPS\Member::loggedIn()->language()->addToStack( 'content_record_form_edit_record', FALSE, array( 'sprintf' => array( $record->_title ) ) );
$formElements = $recordClass::formElements( $record, $category );
if ( \IPS\Request::i()->id AND ! $record->canEdit() )
// We check if the form has been submitted to prevent the user loosing their content
if ( isset( \IPS\Request::i()->form_submitted ) )
{
\IPS\Output::i()->error( 'module_no_permission', '2T252/D', 403, '' );
if ( ! $record->couldEdit() )
{
\IPS\Output::i()->error( 'module_no_permission', '2T252/G', 403, '' );
}
}
else
{
if ( ! $record->canEdit() )
{
\IPS\Output::i()->error( 'module_no_permission', '2T252/D', 403, '' );
}
}
$form = new \IPS\Helpers\Form( 'form', isset( \IPS\Member::loggedIn()->language()->words[ $recordClass::$formLangPrefix . '_save' ] ) ? $recordClass::$formLangPrefix . '_save' : 'save' );
@@ -356,7 +356,7 @@ class _builder extends \IPS\core\modules\front\system\widgets
*
* @param string $uniqueId The unique key of the widget (eg: wzsj1233)
* @param array $widgets Current widgets (eg from core_widget_areas.widgets (json decoded))
* @return boolen True if something removed, false if not
* @return bool True if something removed, false if not
*/
protected function _checkAndDeleteFromCoreWidgets( $uniqueId, $widgets )
{
+1 -1
View File
@@ -397,7 +397,7 @@ class _Upgrade
if ( $field['field_type'] == 'checkbox' and count( $json ) )
{
$field['field_type'] = 'CheckboxSet';
$save['field_type'] = 'CheckboxSet';
}
}
else if ( $field['field_type'] == 'upload' )
+1 -1
View File
@@ -818,7 +818,7 @@ EOF;
}
else
{
$theValue[] = $eachValue;
$theValue[ $eachKey ] = $eachValue;
}
}
$v = $theValue;
@@ -159,9 +159,9 @@ class _Categories extends \IPS\Node\Model implements \IPS\Node\Permissions
protected static $loadedCatsFromPath = array();
/**
* @brief [Records] Database object
* @brief [Records] Database objects
*/
protected static $database = NULL;
protected static $database = array();
/**
* @brief Latest posted record
@@ -223,12 +223,12 @@ class _Categories extends \IPS\Node\Model implements \IPS\Node\Permissions
*/
public static function database()
{
if ( static::$database === NULL )
if ( !isset( static::$database[ static::$customDatabaseId ] ) )
{
static::$database = \IPS\cms\Databases::load( static::$customDatabaseId );
static::$database[ static::$customDatabaseId ] = \IPS\cms\Databases::load( static::$customDatabaseId );
}
return static::$database;
return static::$database[ static::$customDatabaseId ];
}
/**
@@ -793,6 +793,20 @@ class _Categories extends \IPS\Node\Model implements \IPS\Node\Permissions
return parent::canDelete();
}
/**
* Save Changed Columns
*
* @return void
*/
public function save()
{
if ( !$this->_new AND isset( $this->changed['can_view_others'] ) )
{
$this->updateSearchIndexPermissions();
}
parent::save();
}
/**
* Delete
*
@@ -1002,13 +1016,13 @@ class _Categories extends \IPS\Node\Model implements \IPS\Node\Permissions
/**
* Get URL
*
* @return \IPS\Http\Url
* @return \IPS\Http\Url|NULL
*/
public function url()
{
if( $this->_url === NULL )
{
if ( \IPS\cms\Pages\Page::$currentPage and static::database()->page_id == \IPS\cms\Pages\Page::$currentPage->id )
if ( \IPS\cms\Pages\Page::$currentPage and \IPS\cms\Databases::load( $this->database_id )->page_id == \IPS\cms\Pages\Page::$currentPage->id )
{
$pagePath = \IPS\cms\Pages\Page::$currentPage->full_path;
}
@@ -812,10 +812,7 @@ class _Databases extends \IPS\Node\Model implements \IPS\Node\Permissions
parent::save();
/* Clear cache */
if ( isset( \IPS\Data\Store::i()->cms_databases ) )
{
unset( \IPS\Data\Store::i()->cms_databases );
}
unset( \IPS\Data\Store::i()->cms_databases );
/* If this database isn't searchable, make sure its content is not in the search index */
if( $removeSearchIndex )
@@ -860,11 +857,6 @@ class _Databases extends \IPS\Node\Model implements \IPS\Node\Permissions
{
$field->delete( TRUE );
}
if ( isset( \IPS\Data\Store::i()->cms_databases ) )
{
unset( \IPS\Data\Store::i()->cms_databases );
}
/* Delete comments */
\IPS\Db::i()->delete( 'cms_database_comments', array( 'comment_database_id=?', $this->id ) );
@@ -926,17 +918,18 @@ class _Databases extends \IPS\Node\Model implements \IPS\Node\Permissions
\IPS\Lang::deleteCustom( 'cms', "cms_records" . $this->id . '_pl' );
\IPS\Lang::deleteCustom( 'cms', "module__cms_records" . $this->id );
/* Unclaim attachments */
/* Unclaim attachments */
\IPS\File::unclaimAttachments( 'cms_Records', NULL, NULL, $this->id );
\IPS\File::unclaimAttachments( 'cms_Records' . $this->id );
/* Remove widgets */
$this->removeWidgets();
/* Best remove the stored data */
unset( \IPS\Data\Store::i()->database_reciprocal_links );
/* Delete the database record */
parent::delete();
/* Best remove the stored data */
unset( \IPS\Data\Store::i()->database_reciprocal_links, \IPS\Data\Store::i()->cms_databases );
}
/**
@@ -983,10 +976,7 @@ class _Databases extends \IPS\Node\Model implements \IPS\Node\Permissions
parent::setPermissions( $insert, $matrix );
/* Clear cache */
if ( isset( \IPS\Data\Store::i()->cms_databases ) )
{
unset( \IPS\Data\Store::i()->cms_databases );
}
unset( \IPS\Data\Store::i()->cms_databases );
/* Clone these permissions to all categories that do not have permissions */
$class = '\IPS\cms\Categories' . $this->id;
+45 -13
View File
@@ -400,17 +400,7 @@ class _Fields extends \IPS\CustomField implements \IPS\Node\Permissions
{
$customValidationCode = function( $val ) use ( $database, $row, $record )
{
$where = array( array( 'field_' . $row->id . '=?', $val ) );
if ( $record !== NULL )
{
$where[] = array( 'primary_id_field != ?', $record->_id );
}
if ( \IPS\Db::i()->select( 'COUNT(*)', 'cms_custom_database_' . $database->id, $where )->first() )
{
throw new \LogicException( \IPS\Member::loggedIn()->language()->addToStack( "field_unique_entry_not_unique", FALSE, array( 'sprintf' => array( $database->recordWord( 1 ) ) ) ) );
}
call_user_func_array( 'IPS\cms\Fields' . static::$customDatabaseId . '::validateUnique', array( $val, $row, $record ) );
};
}
@@ -996,6 +986,32 @@ class _Fields extends \IPS\CustomField implements \IPS\Node\Permissions
}
}
/**
* Checks to see if this value is unique
* Used in custom validation for fomr helpers
*
* @param string $val The value to check
* @param \IPS\cms\Fields $field The field
* @param \IPS\cms\Records $record The record (if any)
* @throws \LogicException
*/
public static function validateUnique( $val, $field, $record )
{
$database = \IPS\cms\Databases::load( static::$customDatabaseId );
$where = array( array( 'field_' . $field->id . '=?', $val ) );
if ( $record !== NULL )
{
$where[] = array( 'primary_id_field != ?', $record->_id );
}
if ( \IPS\Db::i()->select( 'COUNT(*)', 'cms_custom_database_' . $database->id, $where )->first() )
{
throw new \LogicException( \IPS\Member::loggedIn()->language()->addToStack( "field_unique_entry_not_unique", FALSE, array( 'sprintf' => array( $database->recordWord( 1 ) ) ) ) );
}
}
/**
* [ActiveRecord] Duplicate
*
@@ -2737,7 +2753,10 @@ class _Fields extends \IPS\CustomField implements \IPS\Node\Permissions
{
unset( \IPS\Data\Store::i()->$key );
}
/* Remove reciprocal map data */
\IPS\Db::i()->delete( 'cms_database_fields_reciprocal_map', array( 'map_origin_database_id=? AND map_field_id=? ', static::$customDatabaseId, $this->id ) );
/* Best remove the stored data */
unset( \IPS\Data\Store::i()->database_reciprocal_links );
@@ -2996,7 +3015,20 @@ class _Fields extends \IPS\CustomField implements \IPS\Node\Permissions
{
case 'Text':
case 'TextArea':
$customValidationCode = 'IPS\cms\Fields' . static::$customDatabaseId . '::validateInput_' . $this->id;
if ( $this->unique )
{
$field = $this;
$customValidationCode = function( $val ) use ( $field, $record )
{
call_user_func_array( 'IPS\cms\Fields' . static::$customDatabaseId . '::validateUnique', array( $val, $field, $record ) );
return call_user_func( 'IPS\cms\Fields' . static::$customDatabaseId . '::validateInput_' . $field->id, $val );
};
}
else
{
$customValidationCode = 'IPS\cms\Fields' . static::$customDatabaseId . '::validateInput_' . $this->id;
}
break;
}
}
+8 -1
View File
@@ -276,7 +276,7 @@ class _Media extends \IPS\Node\Model
public function form( &$form )
{
/* Build form */
$form->add( new \IPS\Helpers\Form\Upload( 'media_filename', ( ( $this->filename ) ? \IPS\File::get( 'cms_Media', $this->file_object ) : NULL ), FALSE, array( 'obscure' => FALSE, 'maxFileSize' => 5, 'storageExtension' => 'core_Theme', 'storageContainer' => 'pages_media' ), NULL, NULL, NULL, 'media_filename' ) );
$form->add( new \IPS\Helpers\Form\Upload( 'media_filename', ( ( $this->filename ) ? \IPS\File::get( 'cms_Media', $this->file_object ) : NULL ), FALSE, array( 'obscure' => FALSE, 'maxFileSize' => 5, 'storageExtension' => 'cms_Media', 'storageContainer' => 'pages_media' ), NULL, NULL, NULL, 'media_filename' ) );
$form->add( new \IPS\Helpers\Form\Node( 'media_parent', $this->parent ? $this->parent : 0, FALSE, array(
'class' => '\IPS\cms\Media\Folder',
@@ -379,6 +379,13 @@ class _Media extends \IPS\Node\Model
*/
public static function exportDesignersModeMedia()
{
/* Make sure our media folder exists */
if ( !is_dir( \IPS\ROOT_PATH . '/themes/cms/media' ) )
{
mkdir( \IPS\ROOT_PATH . '/themes/cms/media', \IPS\IPS_FOLDER_PERMISSION );
chmod( \IPS\ROOT_PATH . '/themes/cms/media', \IPS\IPS_FOLDER_PERMISSION );
}
foreach( \IPS\Db::i()->select( '*', 'cms_media' ) as $media )
{
/* We could use recursive mode but it wouldn't correctly chmod the intermediate dirs */
+9 -1
View File
@@ -1045,7 +1045,7 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
$template = \IPS\cms\Templates::load( $key );
$return[ $thing ][ $key ] = \IPS\Http\Url::createFromString( \IPS\Http\Url::baseUrl() . "/applications/cms/interface/developer/developer.php" )
->setQueryString( 'file', '/themes/cms/' . $template->location . '/' . $template->group . '/' . $template->title );
->setQueryString( 'file', 'cms/' . $template->location . '/' . $template->group . '/' . $template->title );
}
catch( \OutOfRangeException $e )
{
@@ -1933,6 +1933,11 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
*/
public function mapToDatabase( $databaseId )
{
/* Ensure this page has an ID (as in, $page->save() has not been called yet on a new page) */
if ( ! $this->id )
{
throw new \LogicException('cms_err_page_id_is_empty');
}
try
{
/* is this page already in use */
@@ -2021,6 +2026,9 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
unset( \IPS\Data\Store::i()->frontNavigation );
/* Remove any widgets for this page */
\IPS\Db::i()->delete( 'cms_page_widget_areas', array( 'area_page_id=?', $this->id ) );
parent::delete();
if ( $this->full_path and \IPS\Theme::designersModeEnabled() )
+60 -5
View File
@@ -1812,6 +1812,7 @@ class _Records extends \IPS\Content\Item implements
$class = '\IPS\cms\Categories' . static::$customDatabaseId;
$category = $class::load( $this->category_id );
$category->setLastComment();
$category->setLastReview();
$category->save();
}
}
@@ -2256,7 +2257,11 @@ class _Records extends \IPS\Content\Item implements
if ( $topic === NULL )
{
$this->syncTopic();
try
{
$this->syncTopic();
}
catch( \Exception $ex ) { }
/* Try again */
$topic = $this->topic( FALSE );
@@ -2323,7 +2328,11 @@ class _Records extends \IPS\Content\Item implements
}
else if ( $this->_forum_forum )
{
$this->syncTopic();
try
{
$this->syncTopic();
}
catch( \Exception $ex ) { }
}
}
}
@@ -2368,7 +2377,11 @@ class _Records extends \IPS\Content\Item implements
}
elseif ( $this->_forum_forum and ! $this->isFutureDate() )
{
$this->syncTopic();
try
{
$this->syncTopic();
}
catch( \Exception $ex ) { };
}
}
}
@@ -2443,6 +2456,35 @@ class _Records extends \IPS\Content\Item implements
return FALSE;
}
/**
* Is this topic linked to a record?
*
* @param \IPS\forums\Topic $topic Forums topic
* @return \IPS\cms\Records|NULL
*/
public static function getLinkedRecord( $topic )
{
foreach( \IPS\cms\Databases::databases() as $database )
{
try
{
if ( $database->forum_record and $database->forum_forum == $topic->container()->_id )
{
$class = '\IPS\cms\Records' . $database->id;
$record = $class::load( $topic->tid, 'record_topicid' );
if ( $record->_forum_record )
{
return $record;
}
}
}
catch( \Exception $e ) { }
}
return NULL;
}
/**
* Get Topic (checks member's permissions)
*
@@ -2465,10 +2507,10 @@ class _Records extends \IPS\Content\Item implements
return NULL;
}
/**
* Post this record as a forum topic
*
*
* @return void
*/
public function syncTopic()
@@ -2488,6 +2530,19 @@ class _Records extends \IPS\Content\Item implements
throw new \UnexpectedValueException('content_record_bad_forum_for_topic');
}
/* Run a test for the record url, this call will throw an LogicException if the database isn't associated to a page */
try
{
$this->url();
}
catch ( \LogicException $e )
{
$idColumn = static::$databaseColumnId;
\IPS\Log::log( sprintf( "Record %s in database %s tried to sync the topic, but failed because it has no valid url", $this->$idColumn , static::$customDatabaseId), 'cms_topicsync' );
return;
}
/* Existing topic */
if ( $this->record_topicid )
{
@@ -680,7 +680,7 @@ class _Templates extends \IPS\Patterns\ActiveRecord
$content = $this->content;
/* Build on demand */
if ( $this->type != 'js' and ( mb_stristr( $this->content, "{block=" ) or mb_stristr( $this->content, "{{if" ) ) )
if ( $this->type != 'js' and ( mb_stristr( $this->content, "{block=" ) or mb_stristr( $this->content, "{{if" ) or mb_stristr( $this->content, "{media=" ) ) )
{
$functionName = 'css_' . mt_rand();
\IPS\Theme::makeProcessFunction( str_replace( '\\', '\\\\', $content ), $functionName );
+7
View File
@@ -120,6 +120,13 @@ class _Database extends \IPS\Widget
try
{
$database = \IPS\cms\Databases::load( intval( $this->configuration['database'] ) );
if ( ! $database->page_id and \IPS\cms\Pages\Page::$currentPage )
{
$database->page_id = \IPS\cms\Pages\Page::$currentPage->id;
$database->save();
}
static::$html = \IPS\cms\Databases\Dispatcher::i()->setDatabase( $database->id )->run();
}
catch ( \OutOfRangeException $e )
+20 -16
View File
@@ -88,14 +88,15 @@ class _RecordFeed extends \IPS\Content\Widget
$form = parent::configuration( $form );
/* Tags */
if ( $database and $database->tags_enabled )
if ( $database )
{
/* Sort */
$sortOptions = array(
'primary_id_field' => 'database_field__id',
'member_id' => 'database_field__member',
'record_publish_date' => 'database_field__saved',
'record_last_comment' => ( $database and $database->_comment_bump === \IPS\cms\Databases::BUMP_ON_EDIT ) ? 'database_field__edited' : 'database_field__updated',
'record_updated' => ( $database and $database->_comment_bump === \IPS\cms\Databases::BUMP_ON_EDIT ) ? 'database_field__edited' : 'database_field__updated',
'record_last_comment' => 'sort_record_last_comment',
'record_rating' => 'database_field__rating'
);
@@ -124,22 +125,25 @@ class _RecordFeed extends \IPS\Content\Widget
}
$form->add( new \IPS\Helpers\Form\Select( 'widget_feed_sort_on', isset( $this->configuration['widget_feed_sort_on'] ) ? $this->configuration['widget_feed_sort_on'] : $class::$databaseColumnMap['updated'], FALSE, array( 'options' => $sortOptions ) ), NULL, NULL, NULL, 'widget_feed_sort_on' );
$options = array( 'autocomplete' => array( 'unique' => TRUE, 'source' => NULL, 'freeChoice' => TRUE ) );
if ( \IPS\Settings::i()->tags_force_lower )
if ( $database->tags_enabled )
{
$options['autocomplete']['forceLower'] = TRUE;
$options = array( 'autocomplete' => array( 'unique' => TRUE, 'source' => NULL, 'freeChoice' => TRUE ) );
if ( \IPS\Settings::i()->tags_force_lower )
{
$options['autocomplete']['forceLower'] = TRUE;
}
if ( \IPS\Settings::i()->tags_clean )
{
$options['autocomplete']['filterProfanity'] = TRUE;
}
$options['autocomplete']['prefix'] = FALSE;
$form->add( new \IPS\Helpers\Form\Text( 'widget_feed_tags', ( isset( $this->configuration['widget_feed_tags'] ) ? $this->configuration['widget_feed_tags'] : array( 'tags' => NULL ) ), FALSE, $options ) );
}
if ( \IPS\Settings::i()->tags_clean )
{
$options['autocomplete']['filterProfanity'] = TRUE;
}
$options['autocomplete']['prefix'] = FALSE;
$form->add( new \IPS\Helpers\Form\Text( 'widget_feed_tags', ( isset( $this->configuration['widget_feed_tags'] ) ? $this->configuration['widget_feed_tags'] : array( 'tags' => NULL ) ), FALSE, $options ) );
}
/* Any filterable fields */
+1 -1
View File
@@ -111,7 +111,7 @@ class _Rss extends \IPS\Widget\StaticCache
{
$items[ $guid ] = array(
'title' => $article['title'],
'content' => \IPS\Text\Parser::parseStatic( $article['content'] ),
'content' => \IPS\Text\Parser::parseStatic( $article['content'], TRUE, NULL, new \IPS\Member ),
'link' => (string) $article['link'],
'date' => ( $article['date'] instanceof \IPS\DateTime ) ? $article['date']->getTimestamp() : $article['date']
);
+1
View File
@@ -107,6 +107,7 @@ class _Wysiwyg extends \IPS\Widget\StaticCache
*/
public function render()
{
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'front_core.js', 'core' ) );
return $this->output( isset( $this->configuration['content'] ) ? $this->configuration['content'] : '' );
}
}
@@ -28,9 +28,10 @@ class _<#CLASS#> extends \IPS\convert\Library
/**
* Returns an array of items that we can convert, including the amount of rows stored in the Community Suite as well as the recommend value of rows to convert per cycle
*
* @param bool $rowCounts enable row counts
* @return array
*/
public function menuRows()
public function menuRows( $rowCounts=FALSE )
{
return array();
}
+4
View File
@@ -10,5 +10,9 @@
"LoginHandler": {
"type": "C",
"class": "\\IPS\\Login\\Handler"
},
"LegacyParser": {
"type": "C",
"class": "\\IPS\\Text\\LegacyParser"
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<javascript app="convert">
<file javascript_app="convert" javascript_location="admin" javascript_path="controllers/convert" javascript_name="ips.convert.menu.js" javascript_type="controller" javascript_version="103005" javascript_position="1000050">/**
<file javascript_app="convert" javascript_location="admin" javascript_path="controllers/convert" javascript_name="ips.convert.menu.js" javascript_type="controller" javascript_version="103038" javascript_position="1000050">/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
+3 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<language>
<app key="convert" version="103005">
<app key="convert" version="103038">
<word key="__app_convert" js="0">Converter</word>
<word key="menu__convert_manage" js="0">Conversions</word>
<word key="menu__convert_manage_manage_start" js="0">Start New Conversion</word>
@@ -139,7 +139,9 @@
<word key="reconfigure" js="0">Reconfigure</word>
<word key="cannot_convert" js="0">Cannot Convert Yet</word>
<word key="cannot_convert_desc" js="0">This step cannot be run until the steps before this one have been run.</word>
<word key="waiting_previous_process" js="0">Waiting for a previous conversion cycle to finish</word>
<word key="no_conversion_app" js="0">The conversion you attempted to run could not be found.</word>
<word key="converter_could_not_continue" js="0"><![CDATA[There was a problem proceeding with the conversion, a previous cycle was still running. Please go back to <a href='{internal.app=convert&module=manage&controller=manage}'>the conversion</a> to continue.]]></word>
<word key="convert_custom_bbcode" js="0">Custom BBCode</word>
<word key="convert_emoticons" js="0">Emoticons</word>
<word key="emoticon_path" js="0">Path to emoticons</word>
+9 -3
View File
@@ -558,7 +558,9 @@
}
},
"collation": "utf8mb4_unicode_ci",
"engine": "InnoDB"
"engine": "InnoDB",
"comment": "",
"reporting": "count"
},
"convert_link_posts": {
"name": "convert_link_posts",
@@ -705,7 +707,9 @@
}
},
"collation": "utf8mb4_unicode_ci",
"engine": "InnoDB"
"engine": "InnoDB",
"comment": "",
"reporting": "count"
},
"convert_link_topics": {
"name": "convert_link_topics",
@@ -852,7 +856,9 @@
}
},
"collation": "utf8mb4_unicode_ci",
"engine": "InnoDB"
"engine": "InnoDB",
"comment": "",
"reporting": "count"
},
"convert_logs": {
"name": "convert_logs",
+35 -1
View File
@@ -120,9 +120,43 @@
"102046": "4.2.7",
"102047": "4.2.8",
"102048": "4.2.8",
"102049": "4.2.9",
"103000": "4.3.0 Beta 1",
"103002": "4.3.0 Beta 2",
"103003": "4.3.0 Beta 3",
"103004": "4.3.0 Beta 4",
"103005": "4.3.0"
"103005": "4.3.0",
"103006": "4.3.1",
"103007": "4.3.1",
"103008": "4.3.1",
"103009": "4.3.2",
"103010": "4.3.2",
"103011": "4.3.3",
"103012": "4.3.3",
"103013": "4.3.3",
"103014": "4.3.3",
"103015": "4.3.3",
"103016": "4.3.3",
"103017": "4.3.3",
"103018": "4.3.3",
"103019": "4.3.3",
"103020": "4.3.3",
"103021": "4.3.4",
"103022": "4.3.4",
"103023": "4.3.4",
"103024": "4.3.4",
"103025": "4.3.4",
"103026": "4.3.5 Beta 1",
"103027": "4.3.5 Beta 2",
"103028": "4.3.5",
"103029": "4.3.5",
"103030": "4.3.5",
"103031": "4.3.5",
"103032": "4.3.5",
"103033": "4.3.6 Beta 1",
"103034": "4.3.6 Beta 2",
"103035": "4.3.6",
"103036": "4.3.6",
"103037": "4.3.6",
"103038": "4.3.6"
}
@@ -0,0 +1,38 @@
//<?php
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
exit;
}
class convert_hook_LegacyParser extends _HOOK_CLASS_
{
/**
* Parse statically
*
* @param string $value The value to parse
* @param \IPS\Member|null $member The member posting. NULL will use currently logged in member.
* @param bool $allowHtml Allow HTML
* @param string $attachClass Key to use for attachments
* @param int $id1 ID1 to use for attachments
* @param int $id2 ID2 to use for attachments
* @param int|NULL $id3 ID3 to use for attachments
* @param string $itemClass The *item* classname (e.g. IPS\forums\Topic)
* @return string
* @see __construct
*/
public static function parseStatic( $value, $member=NULL, $allowHtml=FALSE, $attachClass=null, $id1=0, $id2=0, $id3=NULL, $itemClass=NULL )
{
/* This content has previously been parsed, don't do it again
* -- This can occur with the rebuildNonContent background tasks as they cannot confirm if
* -- content was converted, or already present
*/
if( mb_stristr( $value, '<___base_url___>' ) OR mb_stristr( $value, 'data-ips' ) )
{
return $value;
}
return parent::parseStatic( $value, $member, $allowHtml, $attachClass, $id1, $id2, $id3, $itemClass );
}
}
@@ -60,7 +60,7 @@ class _convert extends \IPS\Dispatcher\Controller
/* Build our table. If I can do this using only the Table helper, I'll be impressed */
try
{
$menuRows = $libraryClass->menuRows();
$menuRows = $libraryClass->menuRows( TRUE );
/* "Extra steps" should not show in the list of things to convert, but still need to be defined in menu rows */
$extraSteps = array();
@@ -41,7 +41,7 @@ class _manage extends \IPS\Dispatcher\Controller
}
/* Remind the user that they must configure permissions after the conversion is complete */
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'global', 'core' )->message( 'convert_configure_permissions', 'information' );
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'global', 'core' )->message( 'convert_configure_permissions', 'warning' );
/* Create the table */
$table = new \IPS\Helpers\Table\Db( 'convert_apps', \IPS\Http\Url::internal( 'app=convert&module=manage&controller=manage' ) );
@@ -31,7 +31,25 @@ class _Upgrade
public function step1()
{
/* Install new login handler */
\IPS\Application::load('convert')->installOther();
try
{
\IPS\Db::i()->select( '*', 'core_login_methods', array( "login_classname=?", 'IPS\\convert\\Login' ) )->first();
}
catch( \UnderflowException $e )
{
$position = \IPS\Db::i()->select( 'MAX(login_order)', 'core_login_methods' )->first();
$handler = new \IPS\convert\Login;
$handler->classname = 'IPS\\convert\\Login';
$handler->order = $position + 1;
$handler->acp = TRUE;
$handler->settings = array( 'auth_types' => \IPS\Login::AUTH_TYPE_USERNAME + \IPS\Login::AUTH_TYPE_EMAIL );
$handler->enabled = TRUE;
$handler->register = FALSE;
$handler->save();
\IPS\Lang::saveCustom( 'core', "login_method_{$handler->id}", 'Converter' );
}
/* Remove legacy login handler */
\IPS\Db::i()->delete( 'core_login_handlers', array( 'login_key=?', 'Convert' ) );
+74 -1
View File
@@ -554,9 +554,45 @@ class _App extends \IPS\Patterns\ActiveRecord
switch( $this->data['app_key'] )
{
case 'photopost8':
case 'photopost7':
$this->app_key = 'photopost';
$this->save();
break;
case 'bbpress23':
case 'bbpress_standalone':
$this->app_key = 'bbpress';
$this->save();
break;
case 'mybb_legacy':
$this->app_key = 'mybb';
$this->save();
break;
case 'phpbb_legacy':
$this->app_key = 'phpbb';
$this->save();
break;
case 'smf_legacy':
$this->app_key = 'smf';
$this->save();
break;
case 'vbulletin_legacy':
case 'vbulletin_legacy36':
case 'vbulletin_subs':
case 'vbblog':
case 'vbdynamics':
$this->app_key = 'vbulletin';
$this->save();
break;
case 'vb5connect':
$this->app_key = 'vbulletin5';
$this->save();
break;
}
if ( ! class_exists( 'IPS\\convert\\Software\\' . ucwords( $this->_data['sw'] ) . '\\' . ucwords( $this->_data['app_key'] ) ) )
@@ -650,7 +686,44 @@ class _App extends \IPS\Patterns\ActiveRecord
{
return TRUE;
}
return FALSE;
}
/**
* Set running flag
*
* @param string $method Method name
* @param bool $status Flag status
*/
public function setRunningFlag( $method, $status )
{
$running = isset( $this->_session['running'] ) ? $this->_session['running'] : array();
/* If setting running flag, set to a timestamp */
if( $status === TRUE )
{
$status = time();
}
$running[ $method ] = $status;
$this->_session = array_merge( $this->_session, array( 'running' => $running ) );
}
/**
* Get running flag
*
* @param string $method Method name
* @return bool|int False or a timestamp
*/
public function getRunningFlag( $method )
{
if( isset( $this->_session['running'][ $method ] ) )
{
return $this->_session['running'][ $method ];
}
return FALSE;
}
}
+154 -23
View File
@@ -149,7 +149,12 @@ abstract class _Library
{
$completed[] = $method;
}
$this->software->app->_session = array( 'working' => array(), 'more_info' => $more_info, 'completed' => $completed );
/* Manually set running flag to save write queries */
$running = $this->software->app->_session['running'];
$running[ $method ] = FALSE;
$this->software->app->_session = array( 'working' => array(), 'more_info' => $more_info, 'completed' => $completed, 'running' => $running );
unset( $_SESSION['currentKeyValue'] );
unset( $_SESSION['convertCountRows'][ $method ] );
unset( $_SESSION['convertContinue'] );
@@ -194,10 +199,41 @@ abstract class _Library
/* Set as last key value */
$this->setLastKeyValue( $lastId );
/* Clear the running flag but only after we've given previous runs a chance to clear */
if( $this->software->app->getRunningFlag( $method ) AND $this->software->app->getRunningFlag( $method ) < ( time() - 45 ) )
{
unset( $_SESSION['convertSkipped'] );
$this->software->app->setRunningFlag( $method, FALSE );
}
/* Unset this so we don't do this again. */
unset( $_SESSION['convertContinue'] );
}
/* Conversion process is still running, process may have broken out of the multiredirector */
if( $this->software->app->getRunningFlag( $method ) )
{
/* Count how many times we've seen this */
$_SESSION['convertSkipped'] = ( isset( $_SESSION['convertSkipped'] ) ? $_SESSION['convertSkipped'] : 0 ) + 1;
/* If we've shown this 5 times, and the flag was set more than 60 seconds ago, there's a good chance something is wrong */
if( $_SESSION['convertSkipped'] > 5 AND $this->software->app->getRunningFlag( $method ) < ( time() - 60 ))
{
unset( $_SESSION['convertSkipped'] );
\IPS\Output::i()->error( 'converter_could_not_continue', '2V387/1', 403, '' );
}
/* Generate dots for UI to show that processing is still occuring */
$dots = str_repeat( '.', $_SESSION['convertSkipped'] );
/* Sleep to allow the other process to complete without hammering the server */
sleep(5);
return array( $data, \IPS\Member::loggedIn()->language()->get( 'waiting_previous_process' ) . $dots, 100 / $total * ( $data ) );
}
/* Set conversion as running */
$this->software->app->setRunningFlag( $method, TRUE );
/* Fetch data from the software */
try
{
@@ -212,7 +248,12 @@ abstract class _Library
{
$completed[] = $method;
}
$this->software->app->_session = array( 'working' => array(), 'more_info' => $more_info, 'completed' => $completed );
/* Manually set running flag to save write queries */
$running = $this->software->app->_session['running'];
$running[ $method ] = FALSE;
$this->software->app->_session = array( 'working' => array(), 'more_info' => $more_info, 'completed' => $completed, 'running' => $running );
unset( $_SESSION['currentKeyValue'] );
unset( $_SESSION['convertContinue'] );
return NULL;
@@ -221,6 +262,9 @@ abstract class _Library
{
\IPS\Log::log( $e, 'converters' );
/* Clear the running flag */
$this->software->app->setRunningFlag( $method, FALSE );
$this->software->app->log( $e->getMessage(), __METHOD__, \IPS\convert\App::LOG_WARNING );
throw new \IPS\convert\Exception;
}
@@ -228,11 +272,18 @@ abstract class _Library
{
\IPS\Log::log( $e, 'converters' );
/* Clear the running flag */
$this->software->app->setRunningFlag( $method, FALSE );
$this->software->app->log( $e->getMessage(), __METHOD__, \IPS\convert\App::LOG_WARNING );
throw new \IPS\convert\Exception;
}
$this->software->app->_session = array_merge( $this->software->app->_session, array( 'working' => array( $method => $data + static::$perCycle ) ) );
/* Manually set running flag to save write queries */
$running = $this->software->app->_session['running'];
$running[ $method ] = FALSE;
$this->software->app->_session = array_merge( $this->software->app->_session, array( 'working' => array( $method => $data + static::$perCycle ), 'running' => $running ) );
return array( $data + static::$perCycle, sprintf( \IPS\Member::loggedIn()->language()->get( 'converted_x_of_x' ), ( $data + static::$perCycle > $total ) ? $total : $data + static::$perCycle, \IPS\Member::loggedIn()->language()->addToStack( $this->getMethodFromMenuRows( $method )['step_title'] ), $total ), 100 / $total * ( $data + static::$perCycle ) );
}
}
@@ -365,6 +416,9 @@ abstract class _Library
/* Get the link type */
$menuRows = $this->menuRows();
/* Delete these */
$toDelete = array( 'convert_link' => array(), 'convert_link_pms' => array(), 'convert_link_posts' => array(), 'convert_link_topics' => array() );
foreach( $truncate as $table => $where )
{
/* Kind of a hacky way to make sure we truncate the right forums archive table */
@@ -383,20 +437,55 @@ abstract class _Library
{
$linkType = $menuRows[ $method ]['link_type'];
}
/* Remove links... we don't really care about which table they are in right now */
foreach( array( 'convert_link', 'convert_link_pms', 'convert_link_posts', 'convert_link_topics' ) as $linkTable )
{
if( $linkType !== NULL )
{
\IPS\Db::i()->delete( $linkTable, array( "type=? AND app=?", $linkType, $this->software->app->app_id ) );
continue;
}
\IPS\Db::i()->delete( $linkTable, array( "type=? AND app=?", $table, $this->software->app->app_id ) );
switch( $linkType )
{
default:
$key = $linkType ?: $table;
$toDelete['convert_link'][ $key ] = $key;
break;
case 'core_message_topics':
case 'core_message_posts':
$toDelete['convert_link_pms'][ $linkType ] = $linkType;
break;
case 'forums_topics':
$toDelete['convert_link_topics'][ $linkType ] = $linkType;
break;
case 'forums_posts':
$toDelete['convert_link_posts'][ $linkType ] = $linkType;
break;
}
}
unset( $_SESSION['currentKeyValue'] );
foreach( $toDelete AS $table => $links )
{
if( !\count( $links ) )
{
continue;
}
/* If posts or topics we may be able to truncate */
if( \in_array( $table, array( 'convert_link_topics', 'convert_link_posts' ) ) )
{
try
{
/* Check for other app data in this table */
\IPS\Db::i()->select( 'link_id', $table, array('app<>?', $this->software->app->app_id ), NULL, 1 )->first();
}
catch ( \UnderflowException $e )
{
/* There isn't any other app data in this table, truncate */
\IPS\Db::i()->delete( $table );
continue;
}
}
\IPS\Db::i()->delete( $table, array( \IPS\Db::i()->in( 'type', $links ) . " AND app=?", $this->software->app->app_id ) );
}
/* Clear the running flag */
$this->software->app->setRunningFlag( $method, FALSE );
}
/**
@@ -472,29 +561,71 @@ abstract class _Library
(string) \IPS\Http\Url::internal( "app=convert&module=manage&controller=convert&do=finish&id={$appId}" )
) ) );
}
/**
* Returns an array of items that we can convert, including the amount of rows stored in the Community Suite as well as the recommend value of rows to convert per cycle
*
* @param bool $rowCounts enable row counts
* @return array
*/
abstract public function menuRows();
abstract public function menuRows( $rowCounts=FALSE );
/**
* Utility method to run queries for menuRows() data
*
* @param array $return menuRow() data
* @return array
* @throws \UnderflowException
* @throws \IPS\convert\Exception
*/
public function getDatabaseRowCounts( array $return )
{
foreach( $return as $key => $value )
{
if( isset( $value['ips_rows'] ) AND $value['ips_rows'] instanceof \IPS\Db\Select )
{
$return[ $key ]['ips_rows'] = (int) $value['ips_rows']->first();
}
if( isset( $return[ $key ]['source_rows']['table'] ) )
{
$return[ $key ]['source_rows'] = $this->software->countRows( $value['source_rows']['table'], $value['source_rows']['where'] );
}
}
return $return;
}
/**
* @brief Cache menu row data
*/
protected $_menuRowCache = array( 'rows' => array(), 'noRows' => array() );
/**
* Get method from menu rows - abstracted to allow 'fake' entries not in menuRows()
*
* @param string $method Method requested
* @param string $method Method requested
* @param bool $rowCount Count local rows
* @return array
*/
public function getMethodFromMenuRows( $method )
public function getMethodFromMenuRows( $method, $rowCount=FALSE )
{
$menuRows = $this->menuRows();
if( isset( $menuRows[ $method ] ) )
$key = $rowCount ? 'rows' : 'noRows';
if( isset( $this->_menuRowCache[ $key ][ $method ] ) )
{
return $menuRows[ $method ];
return $this->_menuRowCache[ $key ][ $method ];
}
return array();
/* Set to to the cache */
$this->_menuRowCache[ $key ] = $this->menuRows( $rowCount );
/* Cache an empty array for the response */
if( !isset( $this->_menuRowCache[ $key ][ $method ] ) )
{
$this->_menuRowCache[ $key ][ $method ] = array();
}
return $this->_menuRowCache[ $key ][ $method ];
}
/**
+25 -18
View File
@@ -27,13 +27,14 @@ class _Blog extends Core
* @brief Application
*/
public $app = 'blog';
/**
* Returns an array of items that we can convert, including the amount of rows stored in the Community Suite as well as the recommend value of rows to convert per cycle
*
* @param bool $rowCounts enable row counts
* @return array
*/
public function menuRows()
public function menuRows( $rowCounts=FALSE )
{
$return = array();
@@ -45,8 +46,8 @@ class _Blog extends Core
$return[ $k ] = array(
'step_title' => 'convert_blogs',
'step_method' => 'convertBlogs',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'blog_blogs' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'blog_blogs' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 1000,
'dependencies' => array(),
'link_type' => 'blog_blogs',
@@ -57,8 +58,8 @@ class _Blog extends Core
$return[ $k ] = array(
'step_title' => 'convert_blog_entries',
'step_method' => 'convertBlogEntries',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'blog_entries' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'blog_entries' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 1500,
'dependencies' => array( 'convertBlogs' ),
'link_type' => 'blog_entries',
@@ -69,8 +70,8 @@ class _Blog extends Core
$return[ $k ] = array(
'step_title' => 'convert_blog_comments',
'step_method' => 'convertBlogComments',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'blog_comments' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'blog_comments' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 1500,
'dependencies' => array( 'convertBlogEntries' ),
'link_type' => 'bog_comments',
@@ -81,8 +82,8 @@ class _Blog extends Core
$return[ $k ] = array(
'step_title' => 'convert_blog_rss_import',
'step_method' => 'convertBlogRssImport',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'blog_rss_import' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'blog_rss_import' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 2000,
'dependencies' => array( 'convertBlogs' ),
'link_type' => 'blog_rss_import',
@@ -93,8 +94,8 @@ class _Blog extends Core
$return[ $k ] = array(
'step_title' => 'convert_club_blogs',
'step_method' => 'convertClubBlogs',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'blog_blogs', array( "blog_club_id IS NOT NULL" ) )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'blog_blogs', array( "blog_club_id IS NOT NULL" ) ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 2000,
'dependencies' => array( 'convertClubs' ),
'link_type' => 'core_club_blogs'
@@ -105,8 +106,8 @@ class _Blog extends Core
$return[ $k ] = array(
'step_title' => 'convert_club_blog_entries',
'step_method' => 'convertClubBlogEntries',
'ips_rows' => (int) \IPS\Db::i()->select( 'SUM(blog_entries)', 'blog_blogs', array( "blog_club_id IS NOT NULL" ) )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'SUM(blog_entries)', 'blog_blogs', array( "blog_club_id IS NOT NULL" ) ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 1000,
'dependencies' => array( 'convertClubBlogs' ),
'link_type' => 'core_club_blogs_entries',
@@ -118,8 +119,8 @@ class _Blog extends Core
$return[ $k ] = array(
'step_title' => 'convert_club_blog_comments',
'step_method' => 'convertClubBlogComments',
'ips_rows' => (int) \IPS\Db::i()->select( 'SUM(blog_comments)', 'blog_blogs', array( "blog_club_id IS NOT NULL" ) )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'SUM(blog_comments)', 'blog_blogs', array( "blog_club_id IS NOT NULL" ) ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 1000,
'dependencies' => array( 'convertClubBlogEntries' ),
'link_type' => 'core_club_blogs_comments',
@@ -131,8 +132,8 @@ class _Blog extends Core
$return[ $k ] = array(
'step_title' => 'convert_blog_attachments',
'step_method' => 'convertAttachments',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_attachments_map', array( 'location_key=? AND id1<>? AND id2 IS NULL', 'blog_Entries', 0 ) )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_attachments_map', array( 'location_key=? AND id1<>? AND id2 IS NULL', 'blog_Entries', 0 ) ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 250,
'dependencies' => array( 'convertBlogEntries', 'convertBlogComments' ),
'link_type' => 'core_attachments',
@@ -143,6 +144,12 @@ class _Blog extends Core
$return = $this->software->extraMenuRows( $return );
/* Run the queries if we want row counts */
if( $rowCounts )
{
$return = $this->getDatabaseRowCounts( $return );
}
return $return;
}
@@ -28,9 +28,10 @@ class _Calendar extends Core
/**
* Returns an array of items that we can convert, including the amount of rows stored in the Community Suite as well as the recommend value of rows to convert per cycle
*
* @param bool $rowCounts enable row counts
* @return array
*/
public function menuRows()
public function menuRows( $rowCounts=FALSE )
{
$return = array();
@@ -42,8 +43,8 @@ class _Calendar extends Core
$return[ $k ] = array(
'step_title' => 'convert_calendar_calendars',
'step_method' => 'convertCalendarCalendars',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_calendars' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_calendars' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => array(),
'link_type' => 'calendar_calendars',
@@ -54,8 +55,8 @@ class _Calendar extends Core
$return[ $k ] = array(
'step_title' => 'convert_calendar_venues',
'step_method' => 'convertCalendarVenues',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_venues' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_venues' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => array( 'convertCalendarCalendars' ),
'link_type' => 'calendar_venues',
@@ -66,8 +67,8 @@ class _Calendar extends Core
$return[ $k ] = array(
'step_title' => 'convert_calendar_events',
'step_method' => 'convertCalendarEvents',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_events' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_events' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 1500,
'dependencies' => array( 'convertCalendarCalendars' ),
'link_type' => 'calendar_events',
@@ -79,8 +80,8 @@ class _Calendar extends Core
$return[ $k ] = array(
'step_title' => 'convert_calendar_comments',
'step_method' => 'convertCalendarComments',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_event_comments' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_event_comments' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 2000,
'dependencies' => array( 'convertCalendarEvents' ),
'link_type' => 'calendar_event_comments',
@@ -92,8 +93,8 @@ class _Calendar extends Core
$return[ $k ] = array(
'step_title' => 'convert_calendar_reviews',
'step_method' => 'convertCalendarReviews',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_event_reviews' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_event_reviews' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 2000,
'dependencies' => array( 'convertCalendarEvents' ),
'link_type' => 'calendar_event_reviews',
@@ -105,8 +106,8 @@ class _Calendar extends Core
$return[ $k ] = array(
'step_title' => 'convert_calendar_rsvps',
'step_method' => 'convertCalendarRsvps',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_event_rsvp' )->first(),
'source_rows' => $this->sofrware->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_event_rsvp' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 2000,
'dependencies' => array( 'convertCalendarEvents' ),
'link_type' => 'calendar_event_rsvp',
@@ -117,8 +118,8 @@ class _Calendar extends Core
$return[ $k ] = array(
'step_title' => 'convert_calendar_feeds',
'step_method' => 'convertCalendarFeeds',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_import_feeds' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_import_feeds' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => array( 'convertCalendarCalendars' ),
'link_type' => 'calendar_import_feeds',
@@ -129,8 +130,8 @@ class _Calendar extends Core
$return[ $k ] = array(
'step_title' => 'convert_calendar_reminders',
'step_method' => 'convertCalendarReminders',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_event_reminders' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_event_reminders' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => array( 'convertCalendarEvents' ),
'link_type' => 'calendar_reminders',
@@ -141,10 +142,10 @@ class _Calendar extends Core
$return[ $k ] = array(
'step_title' => 'convert_attachments',
'step_method' => 'convertAttachments',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_attachments', array( "location_key=?", 'calendar_Events' ) )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_attachments_map', array( "location_key=?", 'calendar_Calendar' ) ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => array( 'convertCalendarEvents', 'convertCalendarComments', 'convertCalendarReviews' ),
'dependencies' => array( 'convertCalendarEvents' ),
'link_type' => 'core_attachments',
);
break;
@@ -152,7 +153,13 @@ class _Calendar extends Core
}
$return = $this->software->extraMenuRows( $return );
/* Run the queries if we want row counts */
if( $rowCounts )
{
$return = $this->getDatabaseRowCounts( $return );
}
return $return;
}
@@ -210,9 +217,13 @@ class _Calendar extends Core
case 'convertCalendarReminders':
$return['convertCalendarReminders'] = array( 'calender_reminders' => NULL );
break;
case 'convertAttachments':
$return['convertAttachments'] = array( 'core_attachments' => array( "location_key=?", 'calendar_Events' ) );
$attachIds = array();
foreach( \IPS\Db::i()->select( 'attachment_id', 'core_attachments_map', array( 'location_key=?', 'calendar_Calendar' ) ) AS $attachment )
{
$attachIds[] = $attachment;
}
$return['convertAttachments'] = array( 'core_attachments' => \IPS\Db::i()->in( 'attach_id', $attachIds ), 'core_attachments_map' => array( "location_key=?", 'calendar_Calendar' ) );
break;
}
}
@@ -321,6 +332,8 @@ class _Calendar extends Core
\IPS\Lang::saveCustom( 'calendar', "calendar_calendar_{$inserted_id}", $name );
\IPS\Lang::saveCustom( 'calendar', "calendar_calendar_{$inserted_id}_desc", $desc );
\IPS\Db::i()->insert( 'core_permission_index', array( 'app' => 'calendar', 'perm_type' => 'calendar', 'perm_type_id' => $inserted_id, 'perm_view' => '' ) );
if ( $info['cal_club_id'] )
{
@@ -1318,13 +1331,14 @@ class _Calendar extends Core
$map['id1_type'] = 'calendar_events';
$map['id1_from_parent'] = FALSE;
$map['id2_from_parent'] = FALSE;
/* Some set up */
if ( !isset( $info['id3'] ) )
if ( !isset( $map['id3'] ) )
{
$info['id3'] = NULL;
$map['id3'] = NULL;
}
if ( is_null( $info['id3'] ) OR $info['id3'] != 'review' )
if ( is_null( $map['id3'] ) OR $map['id3'] != 'review' )
{
$map['id2_type'] = 'calendar_event_comments';
}
+46 -27
View File
@@ -37,16 +37,17 @@ class _Cms extends Core
{
return parent::getPostConversionInformation() . \IPS\Member::loggedIn()->language()->addToStack( 'convert_cms_info_message' );
}
/**
* Returns an array of items that we can convert, including the amount of rows stored in the Community Suite as well as the recommend value of rows to convert per cycle
*
* @param bool $rowCounts enable row counts
* @return array
*/
public function menuRows()
public function menuRows( $rowCounts=FALSE )
{
$return = array();
$classname = get_class( $this->software );
foreach( $this->getConvertableItems() as $k => $v )
{
switch( $k )
@@ -60,8 +61,8 @@ class _Cms extends Core
$return[ $k ] = array(
'step_title' => 'convert_cms_blocks',
'step_method' => 'convertCmsBlocks',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_blocks' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_blocks' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => array(),
'link_type' => 'cms_blocks',
@@ -72,8 +73,8 @@ class _Cms extends Core
$return[ $k ] = array(
'step_title' => 'convert_cms_containers',
'step_method' => 'convertCmsContainers',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_containers' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_containers' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => array(),
'link_type' => 'cms_containers',
@@ -89,8 +90,8 @@ class _Cms extends Core
$return[ $k ] = array(
'step_title' => 'convert_cms_databases',
'step_method' => 'convertCmsDatabases',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_databases' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_databases' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => $dependencies,
'link_type' => 'cms_databases',
@@ -101,8 +102,8 @@ class _Cms extends Core
$return[ $k ] = array(
'step_title' => 'convert_cms_database_categories',
'step_method' => 'convertCmsDatabaseCategories',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_database_categories' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_database_categories' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => array( 'convertCmsDatabases' ),
'link_type' => 'cms_database_categories',
@@ -114,7 +115,10 @@ class _Cms extends Core
$links = array();
foreach( \IPS\Db::i()->select( 'database_id', 'cms_databases' ) AS $database )
{
$count += \IPS\Db::i()->select( 'COUNT(*)', "cms_custom_database_{$database}" )->first();
if( $rowCounts )
{
$count += \IPS\Db::i()->select( 'COUNT(*)', "cms_custom_database_{$database}" )->first();
}
$links[] = "cms_custom_database_{$database}";
}
@@ -128,7 +132,7 @@ class _Cms extends Core
'step_title' => 'convert_cms_database_records',
'step_method' => 'convertCmsDatabaseRecords',
'ips_rows' => $count,
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => array( 'convertCmsDatabases' ),
'link_type' => $links,
@@ -140,8 +144,8 @@ class _Cms extends Core
$return[ $k ] = array(
'step_title' => 'convert_cms_database_comments',
'step_method' => 'convertCmsDatabaseComments',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_database_comments' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_database_comments' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 2000,
'dependencies' => array( 'convertCmsDatabaseRecords' ),
'link_type' => 'cms_database_comments',
@@ -153,8 +157,8 @@ class _Cms extends Core
$return[ $k ] = array(
'step_title' => 'convert_cms_database_reviews',
'step_method' => 'convertCmsDatabaseReviews',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_database_reviews' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_database_reviews' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 2000,
'dependencies' => array( 'convertCmsDatabaseRecords' ),
'link_type' => 'cms_database_reviews',
@@ -166,8 +170,8 @@ class _Cms extends Core
$return[ $k ] = array(
'step_title' => 'convert_cms_folders',
'step_method' => 'convertCmsFolders',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_folders' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_folders' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => array(),
'link_type' => 'cms_folders',
@@ -184,8 +188,8 @@ class _Cms extends Core
$return[ $k ] = array(
'step_title' => 'convert_cms_media',
'step_method' => 'convertCmsMedia',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_media' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_media' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => $dependencies,
'link_type' => 'cms_media',
@@ -196,8 +200,8 @@ class _Cms extends Core
$return[ $k ] = array(
'step_title' => 'convert_cms_media_folders',
'step_method' => 'convertCmsMediaFolders',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_media_folders' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_media_folders' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => array(),
'link_type' => 'cms_media_folders',
@@ -214,8 +218,8 @@ class _Cms extends Core
$return[ $k ] = array(
'step_title' => 'convert_cms_pages',
'step_method' => 'convertCmsPages',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_pages' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'cms_pages' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => $dependencies,
'link_type' => 'cms_pages',
@@ -232,8 +236,8 @@ class _Cms extends Core
$return[ $k ] = array(
'step_title' => 'convert_cms_attachments',
'step_method' => 'convertAttachments',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_attachments_map', array( \IPS\Db::i()->in( 'id3', $in ) . " AND location_key=?", 'cms_Records' ) )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_attachments_map', array( \IPS\Db::i()->in( 'id3', $in ) . " AND location_key=?", 'cms_Records' ) ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
#'dependencies' => array( 'convertCmsDatabaseRecords', 'convertCmsDatabaseComments', 'convertCmsDatabaseReviews' ),
'dependencies' => array( 'convertCmsDatabaseRecords' ), //TODO dear code reviewer... please review this part.. i had to remove it for my further work
@@ -245,6 +249,12 @@ class _Cms extends Core
$return = $this->software->extraMenuRows( $return );
/* Run the queries if we want row counts */
if( $rowCounts )
{
$return = $this->getDatabaseRowCounts( $return );
}
return $return;
}
@@ -546,6 +556,8 @@ class _Cms extends Core
$inserted_id = \IPS\Db::i()->insert( 'cms_pages', $info );
$this->software->app->addLink( $inserted_id, $id, 'cms_pages' );
\IPS\Lang::saveCustom( 'cms', "cms_page_{$inserted_id}", $info['page_name'] );
\IPS\Db::i()->insert( 'core_permission_index', array( 'app' => 'cms', 'perm_type' => 'pages', 'perm_type_id' => $inserted_id, 'perm_view' => '' ) );
return $inserted_id;
}
@@ -730,6 +742,8 @@ class _Cms extends Core
\IPS\Lang::saveCustom( 'cms', "content_block_name_{$inserted_id}", $name );
\IPS\Lang::saveCustom( 'cms', "content_block_name_{$inserted_id}_desc", $desc );
\IPS\Db::i()->insert( 'core_permission_index', array( 'app' => 'cms', 'perm_type' => 'blocks', 'perm_type_id' => $inserted_id, 'perm_view' => '' ) );
return $inserted_id;
}
@@ -1060,6 +1074,8 @@ class _Cms extends Core
$inserted_id = \IPS\Db::i()->insert( 'cms_databases', $info );
$this->software->app->addLink( $inserted_id, $id, 'cms_databases' );
\IPS\Db::i()->insert( 'core_permission_index', array( 'app' => 'cms', 'perm_type' => 'databases', 'perm_type_id' => $inserted_id, 'perm_view' => '' ) );
/* And now fields */
$validFields = array_merge( static::$fieldTypes, \IPS\cms\Fields::$additionalFieldTypes, array( 'Youtube', 'Spotify', 'Soundcloud' ) );
@@ -1297,6 +1313,8 @@ class _Cms extends Core
\IPS\Lang::saveCustom( 'cms', "content_field_{$fieldInsertedId}", $fieldName );
\IPS\Lang::saveCustom( 'cms', "content_field_{$fieldInsertedId}_desc", $fieldDesc );
$this->software->app->addLink( $fieldInsertedId, $fieldId, 'cms_database_fields' );
\IPS\Db::i()->insert( 'core_permission_index', array( 'app' => 'cms', 'perm_type' => 'fields', 'perm_type_id' => $fieldInsertedId, 'perm_view' => '' ) );
if ( $haveTitleField AND $titleField == 0 )
{
@@ -1777,6 +1795,7 @@ class _Cms extends Core
$this->software->app->addLink( $inserted_id, $id, 'cms_database_categories' );
\IPS\Db::i()->update( 'cms_database_categories', array( "category_parent_id" => $inserted_id ), array( "category_conv_parent=? AND category_conv_parent<>?", $id, 0 ) );
\IPS\Db::i()->insert( 'core_permission_index', array( 'app' => 'cms', 'perm_type' => 'categories', 'perm_type_id' => $inserted_id, 'perm_view' => '' ) );
\IPS\Lang::saveCustom( 'cms', "content_cat_name_{$inserted_id}", $info['category_name'] );
\IPS\Lang::saveCustom( 'cms', "content_cat_name_{$inserted_id}_desc", $desc );
+115 -116
View File
@@ -29,9 +29,10 @@ class _Core extends \IPS\convert\Library
/**
* Returns an array of items that we can convert, including the amount of rows stored in the Community Suite as well as the recommend value of rows to convert per cycle
*
* @param bool $rowCounts enable row counts
* @return array
*/
public function menuRows()
public function menuRows( $rowCounts=FALSE )
{
$return = array();
@@ -43,8 +44,8 @@ class _Core extends \IPS\convert\Library
$return[ $k ] = array(
'step_title' => 'convert_acronyms',
'step_method' => 'convertAcronyms',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_acronyms' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_acronyms' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 1000,
'dependencies' => array(),
'link_type' => 'core_acronyms',
@@ -64,8 +65,8 @@ class _Core extends \IPS\convert\Library
$return[ $k ] = array(
'step_title' => 'convert_administrators',
'step_method' => 'convertAdministrators',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_admin_permission_rows' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_admin_permission_rows' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => $dependencies,
'link_type' => 'core_administrators',
@@ -76,8 +77,8 @@ class _Core extends \IPS\convert\Library
$return[ $k ] = array(
'step_title' => 'convert_announcements',
'step_method' => 'convertAnnouncements',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_announcements' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_announcements' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => array( 'convertMembers' ),
'link_type' => 'core_announcements',
@@ -88,8 +89,8 @@ class _Core extends \IPS\convert\Library
$return[ $k ] = array(
'step_title' => 'convert_attachments',
'step_method' => 'convertAttachments',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_attachments' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_attachments' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => array( 'convertMembers' ),
'link_type' => 'core_attachments',
@@ -100,8 +101,8 @@ class _Core extends \IPS\convert\Library
$return[ $k ] = array(
'step_title' => 'convert_banfilters',
'step_method' => 'convertBanfilters',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_banfilters' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_banfilters' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => array(),
'link_type' => 'core_banfilters',
@@ -112,8 +113,8 @@ class _Core extends \IPS\convert\Library
$return[$k] = array(
'step_title' => 'convert_custom_bbcode',
'step_method' => 'convertCustomBbcode',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'custom_bbcode' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'custom_bbcode' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 2000,
'dependencies' => array(),
'link_type' => 'core_bbcode',
@@ -124,8 +125,8 @@ class _Core extends \IPS\convert\Library
$return[ $k ] = array(
'step_title' => 'convert_dname_changes',
'step_method' => 'convertDnameChanges',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_member_history', array( 'log_app=? AND log_type=?', 'core', 'display_name' ) )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_member_history', array( 'log_app=? AND log_type=?', 'core', 'display_name' ) ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 2000,
'dependencies' => array( 'convertMembers' ),
'link_type' => 'core_dname_changes',
@@ -136,8 +137,8 @@ class _Core extends \IPS\convert\Library
$return[ $k ] = array(
'step_title' => 'convert_edit_history',
'step_method' => 'convertEditHistory',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_edit_history' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_edit_history' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 1500,
'dependencies' => array( 'convertMembers' ),
'link_type' => 'core_edit_history',
@@ -148,8 +149,8 @@ class _Core extends \IPS\convert\Library
$return[ $k ] = array(
'step_title' => 'convert_emoticons',
'step_method' => 'convertEmoticons',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_emoticons' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_emoticons' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => array(),
'link_type' => 'core_emoticons',
@@ -160,8 +161,8 @@ class _Core extends \IPS\convert\Library
$return[ $k ] = array(
'step_title' => 'convert_groups',
'step_method' => 'convertGroups',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_groups' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_groups' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => array(),
'link_type' => 'core_groups',
@@ -172,8 +173,8 @@ class _Core extends \IPS\convert\Library
$return[ $k ] = array(
'step_title' => 'convert_ignored_users',
'step_method' => 'convertIgnoredUsers',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_ignored_users' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_ignored_users' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 2000,
'dependencies' => array( 'convertMembers' ),
'link_type' => 'core_ignored_users',
@@ -184,8 +185,8 @@ class _Core extends \IPS\convert\Library
$return[ $k ] = array(
'step_title' => 'convert_leader_groups',
'step_method' => 'convertLeaderGroups',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_leaders_groups' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_leaders_groups' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => array(),
'link_type' => 'core_leader_groups',
@@ -211,8 +212,8 @@ class _Core extends \IPS\convert\Library
$return[ $k ] = array(
'step_title' => 'convert_leaders',
'step_method' => 'convertLeaders',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_leaders' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_leaders' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => $dependencies,
'link_type' => 'core_leaders',
@@ -223,8 +224,8 @@ class _Core extends \IPS\convert\Library
$return[ $k ] = array(
'step_title' => 'convert_ranks',
'step_method' => 'convertRanks',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_member_ranks' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_member_ranks' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => array(),
'link_type' => 'core_member_ranks',
@@ -235,8 +236,8 @@ class _Core extends \IPS\convert\Library
$return[ $k ] = array(
'step_title' => 'convert_reactions',
'step_method' => 'convertReactions',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_reactions' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_reactions' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => array(),
'link_type' => 'core_reactions',
@@ -247,8 +248,8 @@ class _Core extends \IPS\convert\Library
$return[ $k ] = array(
'step_title' => 'convert_statuses',
'step_method' => 'convertStatuses',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_member_status_updates' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_member_status_updates' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 1500,
'dependencies' => array( 'convertMembers' ),
'link_type' => 'core_member_status_updates',
@@ -259,8 +260,8 @@ class _Core extends \IPS\convert\Library
$return[ $k ] = array(
'step_title' => 'convert_status_replies',
'step_method' => 'convertStatusReplies',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_member_status_replies' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_member_status_replies' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 2000,
'dependencies' => array( 'convertMembers', 'convertStatuses' ),
'link_type' => 'core_member_status_replies',
@@ -284,8 +285,8 @@ class _Core extends \IPS\convert\Library
$return[ $k ] = array(
'step_title' => 'convert_members',
'step_method' => 'convertMembers',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_members' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_members' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 250,
'dependencies' => $dependencies,
'link_type' => 'core_members',
@@ -296,8 +297,8 @@ class _Core extends \IPS\convert\Library
$return[ $k ] = array(
'step_title' => 'convert_member_history',
'step_method' => 'convertMemberHistory',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_member_history' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_member_history' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 250,
'dependencies' => array( 'convertMembers' ),
'link_type' => 'core_member_history',
@@ -308,8 +309,8 @@ class _Core extends \IPS\convert\Library
$return[ $k ] = array(
'step_title' => 'convert_warn_actions',
'step_method' => 'convertWarnActions',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_members_warn_actions' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_members_warn_actions' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => array(),
'link_type' => 'core_members_warn_actions',
@@ -320,8 +321,8 @@ class _Core extends \IPS\convert\Library
$return[ $k ] = array(
'step_title' => 'convert_warn_reasons',
'step_method' => 'convertWarnReasons',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_members_warn_reasons' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_members_warn_reasons' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => array(),
'link_type' => 'core_members_warn_reasons',
@@ -332,8 +333,8 @@ class _Core extends \IPS\convert\Library
$return[ $k ] = array(
'step_title' => 'convert_private_messages',
'step_method' => 'convertPrivateMessages',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_message_topics' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_message_topics' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 1000,
'dependencies' => array( 'convertMembers' ),
'link_type' => array( 'core_message_topics', 'core_message_topic_user_map' ),
@@ -344,8 +345,8 @@ class _Core extends \IPS\convert\Library
$return[ $k ] = array(
'step_title' => 'convert_private_message_replies',
'step_method' => 'convertPrivateMessageReplies',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_message_posts' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_message_posts' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 1000,
'dependencies' => array( 'convertPrivateMessages' ),
'link_type' => array( 'core_message_posts' ),
@@ -357,8 +358,8 @@ class _Core extends \IPS\convert\Library
$return[ $k ] = array(
'step_title' => 'convert_moderators',
'step_method' => 'convertModerators',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_moderators' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_moderators' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => array( 'convertMembers' ),
'link_type' => 'core_members',
@@ -369,8 +370,8 @@ class _Core extends \IPS\convert\Library
$return[ $k ] = array(
'step_title' => 'convert_profile_field_groups',
'step_method' => 'convertProfileFieldGroups',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_pfields_groups' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_pfields_groups' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => array(),
'link_type' => 'core_pfields_groups',
@@ -388,8 +389,8 @@ class _Core extends \IPS\convert\Library
$return[ $k ] = array(
'step_title' => 'convert_profile_fields',
'step_method' => 'convertProfileFields',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_pfields_data' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_pfields_data' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => $dependencies,
'link_type' => 'core_pfields_data',
@@ -400,8 +401,8 @@ class _Core extends \IPS\convert\Library
$return[ $k ] = array(
'step_title' => 'convert_profanity_filters',
'step_method' => 'convertProfanityFilters',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_profanity_filters' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_profanity_filters' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 2000,
'dependencies' => array(),
'link_type' => 'core_profanity_filters',
@@ -412,8 +413,8 @@ class _Core extends \IPS\convert\Library
$return[ $k ] = array(
'step_title' => 'convert_question_and_answers',
'step_method' => 'convertQuestionAndAnswers',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_question_and_answer' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_question_and_answer' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 2000,
'dependencies' => array(),
'link_type' => 'core_question_and_answer',
@@ -424,8 +425,8 @@ class _Core extends \IPS\convert\Library
$return[ $k ] = array(
'step_title' => 'convert_report_comments',
'step_method' => 'convertReportComments',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_rc_comments' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_rc_comments' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 1500,
'dependencies' => array(),
'link_type' => 'core_report_comments',
@@ -436,8 +437,8 @@ class _Core extends \IPS\convert\Library
$return[ $k ] = array(
'step_title' => 'convert_reputation_levels',
'step_method' => 'convertReputationLevels',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_reputation_levels' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_reputation_levels' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 2000,
'dependencies' => array(),
'link_type' => 'core_reputation_levels',
@@ -448,8 +449,8 @@ class _Core extends \IPS\convert\Library
$return[ $k ] = array(
'step_title' => 'convert_clubs',
'step_method' => 'convertClubs',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_clubs' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_clubs' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 2000,
'dependencies' => array( 'convertMembers' ),
'link_type' => 'core_clubs'
@@ -460,8 +461,8 @@ class _Core extends \IPS\convert\Library
$return[ $k ] = array(
'step_title' => 'convert_club_members',
'step_method' => 'convertClubMembers',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_clubs_memberships' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_clubs_memberships' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 2000,
'dependencies' => array( 'convertClubs' ),
'link_type' => 'core_clubs_memberships'
@@ -471,7 +472,13 @@ class _Core extends \IPS\convert\Library
}
$return = $this->software->extraMenuRows( $return );
/* Run the queries if we want row counts */
if( $rowCounts )
{
$return = $this->getDatabaseRowCounts( $return );
}
return $return;
}
@@ -764,7 +771,7 @@ class _Core extends \IPS\convert\Library
if ( isset( $info['row_updated'] ) )
{
if ( $info['row_update'] instanceof \IPS\DateTIme )
if ( $info['row_update'] instanceof \IPS\DateTime )
{
$info['row_updated'] = $info['row_updated']->getTimestamp();
}
@@ -893,7 +900,7 @@ class _Core extends \IPS\convert\Library
if ( !isset( $info['announce_page_location'] ) )
{
$info['announce_page_location'] = 'sidebar';
$info['announce_page_location'] = array( 'sidebar' );
}
elseif( !is_array( $info['announce_page_location'] ) )
{
@@ -1047,16 +1054,17 @@ class _Core extends \IPS\convert\Library
$info['attach_location'] = (string) $file;
}
catch( \Exception $e )
{
$this->software->app->log( 'attachment_creation_fail', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['attach_id'] );
return FALSE;
}
catch( \ErrorException $e )
{
$this->software->app->log( $e->getMessage(), __METHOD__, \IPS\convert\App::LOG_WARNING, $info['attach_id'] );
return FALSE;
}
catch( \Exception $e )
{
\IPS\Log::log( array( 'exception' => $e, 'file' => $info ), 'converter_attachment_fail' );
$this->software->app->log( 'attachment_creation_fail_exception', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['attach_id'] );
return FALSE;
}
if( $file === NULL )
{
@@ -1090,14 +1098,14 @@ class _Core extends \IPS\convert\Library
$info['attach_thumb_location'] = (string) $thumbnail;
}
catch( \Exception $e )
{
$this->software->app->log( 'attachment_thumb_creation_fail', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['attach_id'] );
}
catch( \ErrorException $e )
{
$this->software->app->log( $e->getMessage(), __METHOD__, \IPS\convert\App::LOG_WARNING, $info['attach_id'] );
}
catch( \Exception $e )
{
$this->software->app->log( 'attachment_thumb_creation_fail', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['attach_id'] );
}
}
else
{
@@ -1674,7 +1682,6 @@ class _Core extends \IPS\convert\Library
$filepathx2 = NULL;
}
$filex2 = \IPS\File::create( 'core_Emoticons', $info['filenamex2'], $filedatax2, 'emoticons', FALSE, NULL, static::$obscureFilenames );
unset( $info['filenamex2'] );
$info['image_2x'] = (string) $filex2;
}
catch( \Exception $e )
@@ -1686,7 +1693,8 @@ class _Core extends \IPS\convert\Library
$info['image_2x'] = NULL;
}
}
unset( $info['filenamex2'] );
if ( $haveID )
{
$id = $info['id'];
@@ -3209,7 +3217,7 @@ class _Core extends \IPS\convert\Library
$photo = \IPS\File::create( 'core_Profile', $profilePhotoName, $profileFileData );
$info['pp_photo_type'] = 'custom';
$info['pp_main_photo'] = (string) $photo;
$info['pp_thumb_photo'] = (string) $photo->thumbnail( 'core_Profile', \IPS\PHOTO_THUMBNAIL_SIZE, \IPS\PHOTO_THUMBNAIL_SIZE );
$info['pp_thumb_photo'] = (string) $photo->thumbnail( 'core_Profile', \IPS\PHOTO_THUMBNAIL_SIZE, \IPS\PHOTO_THUMBNAIL_SIZE, TRUE );
}
catch( \Exception $e )
{
@@ -4359,7 +4367,7 @@ class _Core extends \IPS\convert\Library
'friend_only' => NULL,
);
$permId = \IPS\Db::i()->insert( 'core_permission_index', $perm );
$permId = \IPS\Db::i()->replace( 'core_permission_index', $perm );
$perm['perm_id'] = $permId;
}
@@ -4545,16 +4553,16 @@ class _Core extends \IPS\convert\Library
$name = $info['pf_name'];
unset( $info['pf_name'] );
}
if ( !isset( $info['pf_desc'] ) )
if ( !isset( $info['pf_desc'] ) OR empty( $info['pf_desc'] ) )
{
$desc = '';
}
else
{
$desc = $info['pf_desc'];
unset( $info['pf_desc'] );
}
unset( $info['pf_desc'] );
if ( isset( $info['pf_content'] ) )
{
@@ -4613,47 +4621,38 @@ class _Core extends \IPS\convert\Library
{
$info['pf_format'] = NULL;
}
if ( isset( $info['pf_group_id'] ) )
/* !Profile Field Group */
try
{
try
if ( isset( $info['pf_group_id'] ) )
{
$info['pf_group_id'] = $this->software->app->getLink( $info['pf_group_id'], 'core_pfields_groups' );
}
catch( \OutOfRangeException $e )
{
/* Create an orphan group */
$info['pf_group_id'] = $this->convertProfileFieldGroup( array(
'pf_group_id' => '__orphaned__',
'pf_group_name' => 'Converted',
) );
}
}
else
{
try
else
{
$info['pf_group_id'] = $this->software->app->getLink( '__orphaned__', 'core_pfields_groups' );
}
/* Make sure it exists */
try
{
\IPS\Db::i()->select( 'pf_group_id', 'core_pfields_groups', array( 'pf_group_id=?', $info['pf_group_id'] ) )->first();
}
catch( \UnderflowException $e )
{
/* Delete the relation if it no longer exists */
$this->software->app->deleteLink( '__orphaned__', 'core_pfields_groups' );
throw new \OutOfRangeException;
}
}
catch( \OutOfRangeException $e )
/* Make sure it exists */
try
{
$info['pf_group_id'] = $this->convertProfileFieldGroup( array(
'pf_group_id' => '__orphaned__',
'pf_group_name' => 'Converted',
) );
\IPS\Db::i()->select( 'pf_group_id', 'core_pfields_groups', array( 'pf_group_id=?', $info['pf_group_id'] ) )->first();
}
catch( \UnderflowException $e )
{
/* Delete the relation if it no longer exists */
$this->software->app->deleteLink( '__orphaned__', 'core_pfields_groups' );
throw new \OutOfRangeException;
}
}
catch( \OutOfRangeException $e )
{
/* Create an orphan group */
$info['pf_group_id'] = $this->convertProfileFieldGroup( array(
'pf_group_id' => '__orphaned__',
'pf_group_name' => 'Converted',
) );
}
if ( !isset( $info['pf_search_type'] ) )
@@ -28,12 +28,12 @@ class _Downloads extends Core
/**
* Returns an array of items that we can convert, including the amount of rows stored in the Community Suite as well as the recommend value of rows to convert per cycle
*
* @param bool $rowCounts enable row counts
* @return array
*/
public function menuRows()
public function menuRows( $rowCounts=FALSE )
{
$return = array();
$classname = get_class( $this->software );
foreach( $this->getConvertableItems() as $k => $v )
{
@@ -43,8 +43,8 @@ class _Downloads extends Core
$return[ $k ] = array(
'step_method' => 'convertDownloadsCfields',
'step_title' => 'convert_downloads_cfields',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'downloads_cfields' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'downloads_cfields' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => array(),
'link_type' => 'downloads_cfields',
@@ -62,8 +62,8 @@ class _Downloads extends Core
$return[ $k ] = array(
'step_method' => 'convertDownloadsCategories',
'step_title' => 'convert_downloads_categories',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'downloads_categories' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'downloads_categories' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => $dependencies,
'link_type' => 'downloads_categories',
@@ -85,8 +85,8 @@ class _Downloads extends Core
$return[ $k ] = array(
'step_method' => 'convertDownloadsFiles',
'step_title' => 'convert_downloads_files',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'downloads_files' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'downloads_files' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 250,
'dependencies' => $dependencies,
'link_type' => 'downloads_files',
@@ -98,8 +98,8 @@ class _Downloads extends Core
$return[ $k ] = array(
'step_method' => 'convertDownloadsComments',
'step_title' => 'convert_downloads_comments',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'downloads_comments' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'downloads_comments' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 1500,
'dependencies' => array( 'convertDownloadsFiles' ),
'link_type' => 'downloads_comments',
@@ -111,8 +111,8 @@ class _Downloads extends Core
$return[ $k ] = array(
'step_method' => 'convertDownloadsReviews',
'step_title' => 'convert_downloads_reviews',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'downloads_reviews' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'downloads_reviews' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 1500,
'dependencies' => array( 'convertDownloadsFiles' ),
'link_type' => 'downloads_reviews',
@@ -124,8 +124,8 @@ class _Downloads extends Core
$return[ $k ] = array(
'step_title' => 'convert_club_downloads_categories',
'step_method' => 'convertClubDownloadsCategories',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'downloads_categories', array( "cclub_id IS NOT NULL" ) )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'downloads_categories', array( "cclub_id IS NOT NULL" ) ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 1000,
'dependencies' => array( 'convertClubs' ),
'link_type' => 'core_club_downloads_categories',
@@ -136,8 +136,8 @@ class _Downloads extends Core
$return[ $k ] = array(
'step_title' => 'convert_club_downloads_files',
'step_method' => 'convertClubDownloadsFiles',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'downloads_files', array( \IPS\Db::i()->in( 'file_category_id', \IPS\Db::i()->select( 'cid', 'downloads_categories', array( "cclub_id IS NOT NULL" ) ) ) ) )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'downloads_files', array( \IPS\Db::i()->in( 'file_category_id', \IPS\Db::i()->select( 'cid', 'downloads_categories', array( "cclub_id IS NOT NULL" ) ) ) ) ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => array( 'convertClubDownloadsCategories' ),
'link_type' => 'core_club_downloads_files'
@@ -148,8 +148,8 @@ class _Downloads extends Core
$return[ $k ] = array(
'step_title' => 'convert_club_downloads_comments',
'step_method' => 'convertClubDownloadsComments',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'downloads_comments', array( \IPS\Db::i()->in( 'comment_file_id', \IPS\Db::i()->select( 'file_id', 'downloads_files', array( \IPS\Db::i()->in( 'file_category_id', \IPS\Db::i()->select( 'cid', 'downloads_categories', array( "cclub_id IS NOT NULL" ) ) ) ) ) ) ) )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'downloads_comments', array( \IPS\Db::i()->in( 'comment_file_id', \IPS\Db::i()->select( 'file_id', 'downloads_files', array( \IPS\Db::i()->in( 'file_category_id', \IPS\Db::i()->select( 'cid', 'downloads_categories', array( "cclub_id IS NOT NULL" ) ) ) ) ) ) ) ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 1000,
'dependencies' => array( 'convertClubDownloadsFiles' ),
'link_type' => 'core_club_downloads_comments',
@@ -160,8 +160,8 @@ class _Downloads extends Core
$return[ $k ] = array(
'step_title' => 'convert_club_downloads_reviews',
'step_method' => 'convertClubDownloadsReviews',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'downloads_files_reviews', array( \IPS\Db::i()->in( 'review_file_id', \IPS\Db::i()->select( 'file_id', 'downloads_files', array( \IPS\Db::i()->in( 'file_category_id', \IPS\Db::i()->select( 'cid', 'downloads_categories', array( "cclub_id IS NOT NULL" ) ) ) ) ) ) ) )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'downloads_files_reviews', array( \IPS\Db::i()->in( 'review_file_id', \IPS\Db::i()->select( 'file_id', 'downloads_files', array( \IPS\Db::i()->in( 'file_category_id', \IPS\Db::i()->select( 'cid', 'downloads_categories', array( "cclub_id IS NOT NULL" ) ) ) ) ) ) ) ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 1000,
'dependencies' => array( 'convertClubDownloadsFiles' ),
'link_type' => 'core_club_downloads_reviews',
@@ -172,8 +172,8 @@ class _Downloads extends Core
$return[ $k ] = array(
'step_method' => 'convertAttachments',
'step_title' => 'convert_attachments',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_attachments_map', array( "location_key=?", 'downloads_Downloads' ) )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_attachments_map', array( "location_key=?", 'downloads_Downloads' ) ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => array( 'convertDownloadsFiles', 'convertDownloadsComments', 'convertDownloadsReviews' ),
'link_type' => 'core_attachments',
@@ -183,7 +183,13 @@ class _Downloads extends Core
}
$return = $this->software->extraMenuRows( $return );
/* Run the queries if we want row counts */
if( $rowCounts )
{
$return = $this->getDatabaseRowCounts( $return );
}
return $return;
}
@@ -222,7 +228,11 @@ class _Downloads extends Core
break;
case 'convertDownloadsFiles':
$return['convertDownloadsFiles'] = array( 'downloads_files' => NULL, 'downloads_files_records' => NULL );
$return['convertDownloadsFiles'] = array(
'downloads_files' => NULL,
'downloads_files_records' => NULL,
'core_tags' => array( 'tag_meta_app=? AND tag_meta_area=?', 'downloads', 'downloads' )
);
break;
case 'convertDownloadsComments':
@@ -700,12 +710,12 @@ class _Downloads extends Core
$inserted_id = \IPS\Db::i()->insert( 'downloads_categories', $info );
$this->software->app->addLink( $inserted_id, $id, 'downloads_categories' );
\IPS\Lang::saveCustom( 'downloads', "downloads_category_{$inserted_id}", $name );
\IPS\Lang::saveCustom( 'downloads', "downloads_category_{$inserted_id}_desc", $desc );
\IPS\Db::i()->update( 'downloads_categories', array( "cparent" => $inserted_id ), array( "cconv_parent=? AND cconv_parent<>?", $id, 0 ) );
\IPS\Db::i()->insert( 'core_permission_index', array( 'app' => 'downloads', 'perm_type' => 'category', 'perm_type_id' => $inserted_id, 'perm_view' => '' ) );
if ( $info['cclub_id'] )
{
@@ -1281,7 +1291,7 @@ class _Downloads extends Core
}
catch( \OutOfRangeException $e )
{
$this->software->app->log( 'download_review_missing_image', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['review_id'] );
$this->software->app->log( 'download_review_missing_file', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['review_id'] );
return FALSE;
}
}
+40 -31
View File
@@ -31,9 +31,10 @@ class _Forums extends Core
/**
* Returns an array of items that we can convert, including the amount of rows stored in the Community Suite as well as the recommend value of rows to convert per cycle
*
* @param bool $rowCounts enable row counts
* @return array
*/
public function menuRows()
public function menuRows( $rowCounts=FALSE )
{
$return = array();
$classname = get_class( $this->software );
@@ -46,8 +47,8 @@ class _Forums extends Core
$return[ $k ] = array(
'step_title' => 'convert_forums_forums',
'step_method' => 'convertForumsForums',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'forums_forums' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'forums_forums' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => array(),
'link_type' => 'forums_forums',
@@ -58,8 +59,8 @@ class _Forums extends Core
$return[ $k ] = array(
'step_title' => 'convert_forums_topics',
'step_method' => 'convertForumsTopics',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'forums_topics' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'forums_topics' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 1000,
'dependencies' => array( 'convertForumsForums' ),
'link_type' => 'forums_topics',
@@ -70,8 +71,8 @@ class _Forums extends Core
$return[ $k ] = array(
'step_title' => 'convert_forums_posts',
'step_method' => 'convertForumsPosts',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'forums_posts' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'forums_posts' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 1000,
'dependencies' => array( 'convertForumsTopics' ),
'link_type' => 'forums_posts',
@@ -83,8 +84,8 @@ class _Forums extends Core
$return[ $k ] = array(
'step_title' => 'convert_forums_archive_posts',
'step_method' => 'convertForumsArchivePosts',
'ips_rows' => \IPS\forums\Topic\ArchivedPost::db()->select( 'COUNT(*)', 'forums_archive_posts' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\forums\Topic\ArchivedPost::db()->select( 'COUNT(*)', 'forums_archive_posts' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 1000,
'dependencies' => array( 'convertForumsTopics' ),
'link_type' => 'forums_posts',
@@ -95,8 +96,8 @@ class _Forums extends Core
$return[ $k ] = array(
'step_title' => 'convert_forums_topic_multimods',
'step_method' => 'convertForumsTopicMultimods',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'forums_topic_mmod' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'forums_topic_mmod' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => array( 'convertForumsForums' ),
'link_type' => 'forums_topic_mmod',
@@ -107,8 +108,8 @@ class _Forums extends Core
$return[ $k ] = array(
'step_title' => 'convert_forums_rss_imports',
'step_method' => 'convertForumsRssImports',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'forums_rss_import' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'forums_rss_import' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => array( 'convertForumsForums' ),
'link_type' => 'forums_rss_import',
@@ -119,8 +120,8 @@ class _Forums extends Core
$return[ $k ] = array(
'step_title' => 'convert_forums_rss_imported',
'step_method' => 'convertForumsRssImported',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'forums_rss_imported' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'forums_rss_imported' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 2000,
'dependencies' => array( 'convertForumsTopics', 'convertForumsRssImports' ),
'link_type' => 'forums_rss_imported',
@@ -131,8 +132,8 @@ class _Forums extends Core
$return[ $k ] = array(
'step_title' => 'convert_forums_question_ratings',
'step_method' => 'convertForumsQuestionRatings',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'forums_question_ratings' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'forums_question_ratings' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 2000,
'dependencies' => array( 'convertForumsTopics' ),
'link_type' => 'forums_question_ratings',
@@ -143,8 +144,8 @@ class _Forums extends Core
$return[ $k ] = array(
'step_title' => 'convert_forums_answer_ratings',
'step_method' => 'convertForumsAnswerRatings',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'forums_answer_ratings' )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'forums_answer_ratings' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 2000,
'dependencies' => array( 'convertForumsPosts' ),
'link_type' => 'forums_answer_ratings',
@@ -155,8 +156,8 @@ class _Forums extends Core
$return[ $k ] = array(
'step_title' => 'convert_forums_attachments',
'step_method' => 'convertAttachments',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_attachments_map', array( "location_key=?", 'forums_Forums' ) )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_attachments_map', array( "location_key=?", 'forums_Forums' ) ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 50,
'dependencies' => array( 'convertForumsPosts' ),
'link_type' => 'core_attachments',
@@ -167,8 +168,8 @@ class _Forums extends Core
$return[ $k ] = array(
'step_title' => 'convert_club_forums',
'step_method' => 'convertClubForums',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'forums_forums', array( "club_id IS NOT NULL" ) )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'forums_forums', array( "club_id IS NOT NULL" ) ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 2000,
'dependencies' => array( 'convertForumsForums' ),
'link_type' => 'core_club_forums'
@@ -179,8 +180,8 @@ class _Forums extends Core
$return[ $k ] = array(
'step_title' => 'convert_club_topics',
'step_method' => 'convertClubTopics',
'ips_rows' => (int) \IPS\Db::i()->select( 'COUNT(tid)', 'forums_topics', array( 'forum_id IN ( ' . (string) \IPS\Db::i()->select( 'id', 'forums_forums', array( "club_id IS NOT NULL" ) ) . ')' ) )->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(tid)', 'forums_topics', array( 'forum_id IN ( ' . (string) \IPS\Db::i()->select( 'id', 'forums_forums', array( "club_id IS NOT NULL" ) ) . ')' ) ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 1000,
'dependencies' => array( 'convertClubForums' ),
'link_type' => 'core_club_topics'
@@ -191,10 +192,10 @@ class _Forums extends Core
$return[ $k ] = array(
'step_title' => 'convert_club_posts',
'step_method' => 'convertClubPosts',
'ips_rows' => (int) \IPS\Db::i()->select( 'COUNT(pid)', 'forums_forums', array( "club_id IS NOT NULL" ) )
'ips_rows' => \IPS\Db::i()->select( 'COUNT(pid)', 'forums_forums', array( "club_id IS NOT NULL" ) )
->join( 'forums_topics', 'forums_topics.forum_id=forums_forums.id')
->join( 'forums_posts', 'forums_posts.topic_id=forums_topics.tid')->first(),
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
->join( 'forums_posts', 'forums_posts.topic_id=forums_topics.tid'),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 1000,
'dependencies' => array( 'convertClubTopics' ),
'link_type' => 'core_club_posts'
@@ -204,6 +205,12 @@ class _Forums extends Core
}
$return = $this->software->extraMenuRows( $return );
/* Run the queries if we want row counts */
if( $rowCounts )
{
$return = $this->getDatabaseRowCounts( $return );
}
return $return;
}
@@ -211,17 +218,18 @@ class _Forums extends Core
/**
* Get method from menu rows - abstracted to allow 'fake' entries not in menuRows()
*
* @param string $method Method requested
* @param string $method Method requested
* @param bool $rowCount Count local rows
* @return array
*/
public function getMethodFromMenuRows( $method )
public function getMethodFromMenuRows( $method, $rowCount=FALSE )
{
if( $method == 'convertForumsBoards' )
{
$method = 'convertForumsForums';
}
return parent::getMethodFromMenuRows( $method );
return parent::getMethodFromMenuRows( $method, $rowCount );
}
/**
@@ -824,6 +832,7 @@ class _Forums extends Core
\IPS\Lang::saveCustom( 'forums', "forums_forum_{$inserted_id}_desc", $desc );
\IPS\Db::i()->update( 'forums_forums', array( "parent_id" => $inserted_id ), array( "conv_parent=? AND conv_parent<>?", $id, 0 ) );
\IPS\Db::i()->insert( 'core_permission_index', array( 'app' => 'forums', 'perm_type' => 'forum', 'perm_type_id' => $inserted_id, 'perm_view' => '' ) );
if ( $info['club_id'] )
{
Loaded 100 of 609 files, more files were not shown because too many files have changed in this diff. Show more