Version 5.0.0 beta 4

This commit is contained in:
Neo committed 2025-12-19 16:57:00 -08:00
1 parent e86153356a
commit 2f24f9de48
276 files changed
+8614 -6044

No files matched your search

+5 -5
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/view" javascript_name="ips.view.manageCategories.js" javascript_type="controller" javascript_version="5000029" javascript_position="1000100"><![CDATA[/**
<file javascript_app="blog" javascript_location="front" javascript_path="controllers/view" javascript_name="ips.view.manageCategories.js" javascript_type="controller" javascript_version="5000030" javascript_position="1000100"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -277,7 +277,7 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="blog" javascript_location="front" javascript_path="templates" javascript_name="ips.templates.view.js" javascript_type="template" javascript_version="5000029" javascript_position="1000050"><![CDATA[/* CLASS LIST TEMPLATES */
<file javascript_app="blog" javascript_location="front" javascript_path="templates" javascript_name="ips.templates.view.js" javascript_type="template" javascript_version="5000030" javascript_position="1000050"><![CDATA[/* CLASS LIST TEMPLATES */
ips.templates.set('blog.view.addButton', "\
<button type=\"button\" class=\"ipsButton ipsButton--primary ipsHide\" data-action=\"addNew\">{{#lang}}manage_cats_new_row{{/lang}}</button>\
");
@@ -291,9 +291,9 @@ ips.templates.set('blog.view.categoryRow', "\
<a href=\"#\" data-role=\"saveChanges\" data-category-id=\"{{cat}}\" class=\"ipsHide i-flex_00 ipsButton ipsButton--positive\" data-ipstooltip=\"\" title=\"{{#lang}}save{{/lang}}\">{{#lang}}save{{/lang}}</a>\
<a href=\"#\" data-role=\"cancelChanges\" data-category-id=\"{{cat}}\" class=\"ipsHide i-flex_00 ipsButton ipsButton--negative\" data-ipstooltip=\"\" title=\"{{#lang}}cancel{{/lang}}\">{{#lang}}cancel{{/lang}}</a>\
</div>\
<div class=\"cBlog_manage_edit ipsButtonGroup ipsButton--soft\">\
<a href=\"#\" data-action=\"delete\" data-category-id=\"{{cat}}\" class=\"ipsButtonGroup__button\" data-ipstooltip title=\"{{#lang}}delete{{/lang}}\"><i class=\"fa-solid fa-circle-xmark\"></i></a>\
<a href=\"#\" data-action=\"edit\" data-category-id=\"{{cat}}\" class=\"ipsButtonGroup__button\" data-ipstooltip title=\"{{#lang}}edit{{/lang}}\"><i class\=\"fa-solid fa-pencil\"></i></a>\
<div class=\"cBlog_manage_edit ipsButtonGroup\">\
<a href=\"#\" data-action=\"delete\" data-category-id=\"{{cat}}\" class=\"ipsButton\" data-ipstooltip title=\"{{#lang}}delete{{/lang}}\"><i class=\"fa-solid fa-circle-xmark\"></i></a>\
<a href=\"#\" data-action=\"edit\" data-category-id=\"{{cat}}\" class=\"ipsButton\" data-ipstooltip title=\"{{#lang}}edit{{/lang}}\"><i class\=\"fa-solid fa-pencil\"></i></a>\
</div>\
</li>\
");
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<language>
<app key="blog" version="5000029">
<app key="blog" version="5000030">
<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>
+2
View File
@@ -1108,6 +1108,8 @@
{{endif}}
{{endif}}
{{$commentCount++;}}
<a id="findComment-{$comment->id}"></a>
<a id="comment-{$comment->id}"></a>
{$comment->html()|raw}
{{endforeach}}
{{else}}
+2 -1
View File
@@ -278,5 +278,6 @@
"5000026": "5.0.0 Beta 1",
"5000027": "5.0.0 Beta 2",
"5000028": "5.0.0 Beta 2",
"5000029": "5.0.0 Beta 3"
"5000029": "5.0.0 Beta 3",
"5000030": "5.0.0 Beta 4"
}
@@ -0,0 +1,22 @@
{
"id": 5000030,
"name": "5.0.0 Beta 4",
"steps": {
"queries": false,
"lang": false,
"theme": true,
"themeeditor": true,
"javascript": true,
"emailTemplates": false,
"acpSearchKeywords": false,
"settings": false,
"tasks": false,
"modules": false,
"widgets": false,
"customOptions": false,
"customRoutines": false
},
"forceMainUpgrader": false,
"forceManualDownloadNoCiC": false,
"forceManualDownloadCiC": false
}
@@ -0,0 +1,14 @@
{
"files": {
"added": [],
"edited": [
"blog\/front\/templates\/ips.templates.view.js"
],
"removed": []
},
"orders": {
"added": [],
"edited": [],
"removed": []
}
}
@@ -0,0 +1,19 @@
{
"html": {
"added": [],
"edited": [
"front\/view\/comments"
],
"removed": []
},
"css": {
"added": [],
"edited": [],
"removed": []
},
"resources": {
"added": [],
"edited": [],
"removed": []
}
}
@@ -0,0 +1,14 @@
{
"categories": {
"added": [],
"edited": [],
"removed": []
},
"settings": {
"added": [],
"edited": [
"layout_blog_view"
],
"removed": []
}
}
+7 -1
View File
@@ -169,12 +169,18 @@ class Comment extends ContentComment implements Embeddable,
public static function modPermission( string $type, Member $member = NULL, Model $container = NULL ): bool
{
$member = $member ?: Member::loggedIn();
if( parent::modPermission( $type, $member, $container ) )
{
return true;
}
if ( in_array( $type, array( 'edit', 'delete', 'lock' ) ) and $container and $container->member_id === $member->member_id )
{
return $member->group['g_blog_allowownmod'];
}
return parent::modPermission( $type, $member, $container );
return false;
}
/**
+11 -11
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="5000029" 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="5000030" javascript_position="1000250"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -110,7 +110,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="5000029" 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="5000030" javascript_position="1000250"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -229,7 +229,7 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="calendar" javascript_location="front" javascript_path="controllers/overview" javascript_name="ips.overview.eventList.js" javascript_type="controller" javascript_version="5000029" javascript_position="1000300"><![CDATA[/**
<file javascript_app="calendar" javascript_location="front" javascript_path="controllers/overview" javascript_name="ips.overview.eventList.js" javascript_type="controller" javascript_version="5000030" javascript_position="1000300"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -347,7 +347,7 @@ var PER_PAGE = 16;
}
});
}(jQuery, _));]]></file>
<file javascript_app="calendar" javascript_location="front" javascript_path="controllers/overview" javascript_name="ips.overview.nearMe.js" javascript_type="controller" javascript_version="5000029" javascript_position="1000300"><![CDATA[/**
<file javascript_app="calendar" javascript_location="front" javascript_path="controllers/overview" javascript_name="ips.overview.nearMe.js" javascript_type="controller" javascript_version="5000030" javascript_position="1000300"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -711,7 +711,7 @@ var PER_PAGE = 16;
}
});
}(jQuery, _));]]></file>
<file javascript_app="calendar" javascript_location="front" javascript_path="controllers/overview" javascript_name="ips.overview.search.js" javascript_type="controller" javascript_version="5000029" javascript_position="1000300"><![CDATA[/**
<file javascript_app="calendar" javascript_location="front" javascript_path="controllers/overview" javascript_name="ips.overview.search.js" javascript_type="controller" javascript_version="5000030" javascript_position="1000300"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -1265,7 +1265,7 @@ var PER_PAGE = 16;
});
}(jQuery, _));
]]></file>
<file javascript_app="calendar" javascript_location="front" javascript_path="controllers/submit" javascript_name="ips.submit.dates.js" javascript_type="controller" javascript_version="5000029" 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="5000030" javascript_position="1000100"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -1813,7 +1813,7 @@ var PER_PAGE = 16;
}
});
}(jQuery, _));]]></file>
<file javascript_app="calendar" javascript_location="front" javascript_path="controllers/venue" javascript_name="ips.venue.main.js" javascript_type="controller" javascript_version="5000029" 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="5000030" javascript_position="1000200"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -1920,7 +1920,7 @@ var PER_PAGE = 16;
}
});
}(jQuery, _));]]></file>
<file javascript_app="calendar" javascript_location="front" javascript_path="controllers/view" javascript_name="ips.view.reminderButton.js" javascript_type="controller" javascript_version="5000029" 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="5000030" javascript_position="1000150"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -2003,7 +2003,7 @@ var PER_PAGE = 16;
}
});
}(jQuery, _));]]></file>
<file javascript_app="calendar" javascript_location="front" javascript_path="controllers/view" javascript_name="ips.view.reminderForm.js" javascript_type="controller" javascript_version="5000029" 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="5000030" javascript_position="1000150">/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -2113,7 +2113,7 @@ var PER_PAGE = 16;
});
}(jQuery, _));
</file>
<file javascript_app="calendar" javascript_location="front" javascript_path="templates" javascript_name="ips.calendar.templates.js" javascript_type="framework" javascript_version="5000029" 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="5000030" javascript_position="1000050"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*/
@@ -2122,7 +2122,7 @@ var PER_PAGE = 16;
ips.templates.set('calendar.reminder.loading', " \
<div class='ipsLoading ipsLoading--tiny'></div>\
");]]></file>
<file javascript_app="calendar" javascript_location="front" javascript_path="templates" javascript_name="ips.templates.overview.js" javascript_type="template" javascript_version="5000029" javascript_position="1000050"><![CDATA[ips.templates.set("eventLoading", `
<file javascript_app="calendar" javascript_location="front" javascript_path="templates" javascript_name="ips.templates.overview.js" javascript_type="template" javascript_version="5000030" javascript_position="1000050"><![CDATA[ips.templates.set("eventLoading", `
<li class='ipsData__item ipsData__item--loading'>
<div class="ipsData__image"></div>
<div class="ipsData__content">
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<language>
<app key="calendar" version="5000029">
<app key="calendar" version="5000030">
<word key="__app_calendar" js="0">Events</word>
<word key="frontnavigation_calendar" js="0">Events</word>
<word key="__indefart_calendar_event_comment" js="0">a comment on an event</word>
+5 -5
View File
@@ -1311,26 +1311,26 @@
</li>
{{endif}}
<li>
<ul class="ipsButtonGroup ipsButton--soft ipsButton--icon">
<ul class="ipsButtonGroup">
{{if !$thisCalendar or !(\IPS\IPS::classUsesTrait( $thisCalendar, 'IPS\Content\ClubContainer' ) AND $thisCalendar->club() )}}
<li>
<a href="{url="app=calendar&module=calendar&controller=view&view=overview" seoTemplate="calendar"}" class="ipsButtonGroup__button {{if request.view=='overview'}} ipsButtonGroup__button--active{{endif}}" data-ipstooltip="" data-ipstooltip-safe="" title="{lang="event_view_overview"}" rel="nofollow">
<a href="{url="app=calendar&module=calendar&controller=view&view=overview" seoTemplate="calendar"}" class="ipsButton {{if request.view=='overview'}} ipsButton--active{{endif}}" data-ipstooltip="" data-ipstooltip-safe="" title="{lang="event_view_overview"}" rel="nofollow">
<i class="fa-solid fa-align-justify"></i>
</a>
</li>
{{endif}}
<li>
<a href="{{if $thisCalendar}}{url="app=calendar&module=calendar&controller=view&view=month&y={$date->year}&m={$date->mon}&id={$thisCalendar->_id}" seoTemplate="calendar_month"}{{else}}{url="app=calendar&module=calendar&controller=view&view=month&y={$date->year}&m={$date->mon}" seoTemplate="calendar_month"}{{endif}}" class="ipsButtonGroup__button {{if request.view=='month'}}ipsButtonGroup__button--active{{endif}}" data-ipstooltip="" data-ipstooltip-safe="" title="{lang="event_view_monthly"}" rel="nofollow">
<a href="{{if $thisCalendar}}{url="app=calendar&module=calendar&controller=view&view=month&y={$date->year}&m={$date->mon}&id={$thisCalendar->_id}" seoTemplate="calendar_month"}{{else}}{url="app=calendar&module=calendar&controller=view&view=month&y={$date->year}&m={$date->mon}" seoTemplate="calendar_month"}{{endif}}" class="ipsButton {{if request.view=='month'}}ipsButton--active{{endif}}" data-ipstooltip="" data-ipstooltip-safe="" title="{lang="event_view_monthly"}" rel="nofollow">
<i class="fa-solid fa-calendar"></i>
</a>
</li>
<li>
<a href="{{if $thisCalendar}}{url="app=calendar&module=calendar&controller=view&view=week&w={$date->year}-{$date->mon}-{$date->mday}&id={$thisCalendar->_id}" seoTemplate="calendar_week"}{{else}}{url="app=calendar&module=calendar&controller=view&view=week&w={$date->year}-{$date->mon}-{$date->mday}" seoTemplate="calendar_week"}{{endif}}" class="ipsButtonGroup__button {{if request.view=='week'}}ipsButtonGroup__button--active{{endif}}" data-ipstooltip="" data-ipstooltip-safe="" title="{lang="event_view_weekly"}" rel="nofollow">
<a href="{{if $thisCalendar}}{url="app=calendar&module=calendar&controller=view&view=week&w={$date->year}-{$date->mon}-{$date->mday}&id={$thisCalendar->_id}" seoTemplate="calendar_week"}{{else}}{url="app=calendar&module=calendar&controller=view&view=week&w={$date->year}-{$date->mon}-{$date->mday}" seoTemplate="calendar_week"}{{endif}}" class="ipsButton {{if request.view=='week'}}ipsButton--active{{endif}}" data-ipstooltip="" data-ipstooltip-safe="" title="{lang="event_view_weekly"}" rel="nofollow">
<i class="fa-regular fa-calendar-minus"></i>
</a>
</li>
<li>
<a href="{{if $thisCalendar}}{url="app=calendar&module=calendar&controller=view&view=day&y={$date->year}&m={$date->mon}&d={$date->mday}&id={$thisCalendar->_id}" seoTemplate="calendar_day"}{{else}}{url="app=calendar&module=calendar&controller=view&view=day&y={$date->year}&m={$date->mon}&d={$date->mday}" seoTemplate="calendar_day"}{{endif}}" class="ipsButtonGroup__button {{if request.view=='day'}}ipsButtonGroup__button--active{{endif}}" data-ipstooltip="" data-ipstooltip-safe="" title="{lang="event_view_daily"}" rel="nofollow">
<a href="{{if $thisCalendar}}{url="app=calendar&module=calendar&controller=view&view=day&y={$date->year}&m={$date->mon}&d={$date->mday}&id={$thisCalendar->_id}" seoTemplate="calendar_day"}{{else}}{url="app=calendar&module=calendar&controller=view&view=day&y={$date->year}&m={$date->mon}&d={$date->mday}" seoTemplate="calendar_day"}{{endif}}" class="ipsButton {{if request.view=='day'}}ipsButton--active{{endif}}" data-ipstooltip="" data-ipstooltip-safe="" title="{lang="event_view_daily"}" rel="nofollow">
<i class="fa-regular fa-calendar"></i>
</a>
</li>
+2 -1
View File
@@ -278,5 +278,6 @@
"5000026": "5.0.0 Beta 1",
"5000027": "5.0.0 Beta 2",
"5000028": "5.0.0 Beta 2",
"5000029": "5.0.0 Beta 3"
"5000029": "5.0.0 Beta 3",
"5000030": "5.0.0 Beta 4"
}
@@ -143,6 +143,15 @@ class view extends Controller
Output::i()->jsFiles = array_merge( Output::i()->jsFiles, Output::i()->js( 'front_browse.js', 'calendar', 'front' ) );
}
/* Sanitize the parameters */
foreach( [ 'y', 'm', 'd' ] as $param )
{
if( isset( Request::i()->$param ) and !is_numeric( Request::i()->$param ) )
{
unset( Request::i()->$param );
}
}
/* If there is a view requested in the URL, use it */
if( isset( Request::i()->view ) )
{
@@ -0,0 +1,22 @@
{
"id": 5000030,
"name": "5.0.0 Beta 4",
"steps": {
"queries": false,
"lang": false,
"theme": true,
"themeeditor": false,
"javascript": false,
"emailTemplates": false,
"acpSearchKeywords": false,
"settings": false,
"tasks": false,
"modules": false,
"widgets": false,
"customOptions": false,
"customRoutines": false
},
"forceMainUpgrader": false,
"forceManualDownloadNoCiC": false,
"forceManualDownloadCiC": false
}
@@ -0,0 +1,19 @@
{
"html": {
"added": [],
"edited": [
"front\/overview\/header"
],
"removed": []
},
"css": {
"added": [],
"edited": [],
"removed": []
},
"resources": {
"added": [],
"edited": [],
"removed": []
}
}
+99 -99
View File
@@ -85,7 +85,7 @@
</header>
{{if $database->can('add') or \IPS\Member::loggedIn()->member_id}}
<ul class="ipsButtons ipsButtons--main ipsButtons--margin">
<ul class="ipsButtons ipsButtons--main i-margin-block_block">
{{if $database->can('add')}}
<li>
<a class="ipsButton ipsButton--primary" {{if $database->use_categories}}data-ipsDialog="1" data-ipsDialog-size="narrow" data-ipsDialog-title="{lang="cms_select_category"}"{{endif}} href="{$url->setQueryString( array( 'do' => 'form', 'd' => \IPS\cms\Databases\Dispatcher::i()->databaseId ) )}">{lang="cms_add_new_record_button" sprintf="$database->recordWord( 1 )"}</a>
@@ -196,7 +196,7 @@
</header>
{{if $database->can('add') or \IPS\Member::loggedIn()->member_id}}
<ul class="ipsButtons ipsButtons--main ipsButtons--margin">
<ul class="ipsButtons ipsButtons--main i-margin-block_block">
{{if $database->can('add')}}
<li>
<a class="ipsButton ipsButton--primary" {{if $database->use_categories}}data-ipsDialog="1" data-ipsDialog-size="narrow" data-ipsDialog-title="{lang="cms_select_category"}"{{endif}} href="{$url->setQueryString( array( 'do' => 'form', 'd' => \IPS\cms\Databases\Dispatcher::i()->databaseId ) )}">{lang="cms_add_new_record_button" sprintf="$database->recordWord( 1 )"}</a>
@@ -300,7 +300,7 @@
</header>
{{if $database->can('add') or \IPS\Member::loggedIn()->member_id}}
<ul class="ipsButtons ipsButtons--main ipsButtons--margin">
<ul class="ipsButtons ipsButtons--main i-margin-block_block">
{{if $database->can('add')}}
<li>
<a class="ipsButton ipsButton--primary" {{if $database->use_categories}}data-ipsDialog="1" data-ipsDialog-size="narrow" data-ipsDialog-title="{lang="cms_select_category"}"{{endif}} href="{$url->setQueryString( array( 'do' => 'form', 'd' => \IPS\cms\Databases\Dispatcher::i()->databaseId ) )}">{lang="cms_add_new_record_button" sprintf="$database->recordWord( 1 )"}</a>
@@ -408,7 +408,7 @@
</header>
{{if $database->can('add') or \IPS\Member::loggedIn()->member_id}}
<ul class="ipsButtons ipsButtons--main ipsButtons--margin">
<ul class="ipsButtons ipsButtons--main i-margin-block_block">
{{if $database->can('add')}}
<li>
<a class="ipsButton ipsButton--primary" {{if $database->use_categories}}data-ipsDialog="1" data-ipsDialog-size="narrow" data-ipsDialog-title="{lang="cms_select_category"}"{{endif}} href="{$url->setQueryString( array( 'do' => 'form', 'd' => \IPS\cms\Databases\Dispatcher::i()->databaseId ) )}">{lang="cms_add_new_record_button" sprintf="$database->recordWord( 1 )"}</a>
@@ -520,7 +520,7 @@
</header>
{{if $database->can('add') or \IPS\Member::loggedIn()->member_id}}
<ul class="ipsButtons ipsButtons--main ipsButtons--margin">
<ul class="ipsButtons ipsButtons--main i-margin-block_block">
{{if $database->can('add')}}
<li>
<a class="ipsButton ipsButton--primary" {{if $database->use_categories}}data-ipsDialog="1" data-ipsDialog-size="narrow" data-ipsDialog-title="{lang="cms_select_category"}"{{endif}} href="{$url->setQueryString( array( 'do' => 'form', 'd' => \IPS\cms\Databases\Dispatcher::i()->databaseId ) )}">{lang="cms_add_new_record_button" sprintf="$database->recordWord( 1 )"}</a>
@@ -681,7 +681,7 @@ data-view-tracking-data="{expression="base64_encode(json_encode( $comment->getVi
{{endif}}
</div>
<div class='ipsPhotoPanel__secondary'>
<a href='{$comment->url()}'>{$comment->dateLine()|raw}</a>
{{if ! \IPS\Output::i()->reduceLinks()}}<a href='{$comment->shareableUrl()}'>{{endif}}{$comment->dateLine()|raw}{{if ! \IPS\Output::i()->reduceLinks()}}</a>{{endif}}
{{if $comment->editLine()}}
({lang="edited_lc"})
{{endif}}
@@ -791,7 +791,9 @@ data-view-tracking-data="{expression="base64_encode(json_encode( $comment->getVi
{{endif}}
</div>
{{endif}}
{template="sharemenu" group="global" app="core" params="$comment"}
{{if ! \IPS\Output::i()->reduceLinks()}}
{template="sharemenu" group="global" app="core" params="$comment"}
{{endif}}
</div>]]></template>
<template template_key="database_display_commentContainer" template_title="commentContainer" template_desc="" template_location="database" template_group="display" template_params="$item, $comment, $votes=array(), $otherClasses=''" template_app="" template_type="template"><![CDATA[{{$idField = $comment::$databaseColumnId;}}
{{$itemClassSafe = str_replace( '\\', '_', mb_substr( $comment::$itemClass, 4 ) );}}
@@ -808,6 +810,7 @@ data-view-tracking-data="{expression="base64_encode(json_encode( $comment->getVi
{{endif}}
<a id='comment-{$comment->$idField}'></a>
<a id='findComment-{$comment->$idField}'></a>
<article id='elComment_{$comment->$idField}' class="ipsEntry js-ipsEntry ipsEntry--simple {{if $otherClasses}}{$otherClasses}{{endif}} {{if (\IPS\IPS::classUsesTrait( $comment, 'IPS\Content\Reactable' ) and $comment->isHighlighted()) or $comment->isFeatured()}}ipsEntry--popular{{endif}} {{if $comment->author()->hasHighlightedReplies()}}ipsEntry--highlighted{{endif}} {{if $comment->isIgnored()}}ipsHide{{endif}} {{if $comment->hidden() OR $item->hidden() == -2}}ipsModerated{{endif}}" {{if $comment->author()->hasHighlightedReplies()}}data-memberGroup="{$comment->author()->member_group_id}"{{endif}}>
{template="comment" group="display" location="database" app="cms" params="$item, $comment, $item::$formLangPrefix . 'comment', $item::$application, $item::$module, $itemClassSafe"}
</article>]]></template>
@@ -897,7 +900,7 @@ data-view-tracking-data="{expression="base64_encode(json_encode( $comment->getVi
<div class="ipsBadges">{{foreach $record->badges() as $badge}}{$badge|raw}{{endforeach}}</div>
</div>
{{if $record::database()->options['reviews']}}
<div class="ipsPageHeader__rating">{template="rating" group="global" location="front" app="core" params="'', $record->averageReviewRating(), \IPS\Settings::i()->reviews_rating_out_of, $record->memberReviewRating()"} <span class='i-color_soft'>({lang="num_reviews" pluralize="$record->reviews"})</span></div>
<div class="ipsPageHeader__rating">{template="rating" group="global" location="front" app="core" params="'', $record->averageReviewRating(), \IPS\Settings::i()->reviews_rating_out_of, $record->memberReviewRating()"} <span class='i-color_soft'>({lang="num_reviews" pluralize="$record->record_reviews"})</span></div>
{{elseif $record->container()->allow_rating}}
<div class="ipsPageHeader__rating">{$record->rating()|raw}</div>
{{endif}}
@@ -1105,10 +1108,11 @@ data-view-tracking-data="{expression="base64_encode(json_encode( $review->getVie
<a href='{$review->url('report')}' {{if member.member_id or \IPS\Helpers\Form\Captcha::supportsModal()}}data-ipsDialog data-ipsDialog-remoteSubmit data-ipsDialog-size='medium' data-ipsDialog-flashMessage='{lang="report_submit_success"}' data-ipsDialog-title="{lang="report"}"{{endif}} data-action='reportComment' title='{lang="report"}'>{lang="report"}</a>
</li>
{{endif}}
{{if ! \IPS\Output::i()->reduceLinks()}}
<li class='ipsMenu_item'>
<a href='{$review->item()->url()->setQueryString( array( 'do' => 'findReview', 'review' => $review->id ) )}' title='{lang="share_this_review"}' data-ipsDialog data-ipsDialog-size='narrow' data-ipsDialog-content='#elShareReview_{$review->id}_menu' data-ipsDialog-title="{lang="share_this_review"}" id='elShareReview_{$review->id}' data-role='shareComment'>{lang="share_this_review"}</a>
<a href='{$review->shareableUrl('review')}' title='{lang="share_this_review"}' data-ipsDialog data-ipsDialog-size='narrow' data-ipsDialog-content='#elShareReview_{$review->id}_menu' data-ipsDialog-title="{lang="share_this_review"}" id='elShareReview_{$review->id}' data-role='shareComment'>{lang="share_this_review"}</a>
</li>
{{endif}}
{{if $review->canEdit() || ( $review->hidden() == -2 AND \IPS\Member::loggedIn()->modPermission('can_manage_deleted_content') ) || ( \IPS\IPS::classUsesTrait( $review, 'IPS\Content\Hideable' ) && ( ( !$review->hidden() and $review->canHide() ) || ( $review->hidden() and $review->canUnhide() ) ) ) || $review->canDelete()}}
<li class='ipsMenu_sep'><hr></li>
{{endif}}
@@ -1249,7 +1253,9 @@ data-view-tracking-data="{expression="base64_encode(json_encode( $review->getVie
{{endif}}
</div>
{{endif}}
{{if ! \IPS\Output::i()->reduceLinks()}}
{template="sharemenu" group="global" app="core" params="$review"}
{{endif}}
</div>]]></template>
<template template_key="database_display_reviewContainer" template_title="reviewContainer" template_desc="" template_location="database" template_group="display" template_params="$item, $review" template_app="" template_type="template"><![CDATA[{{if $review->isIgnored()}}
<div class='ipsEntry ipsEntry--ignored'>
@@ -1257,6 +1263,7 @@ data-view-tracking-data="{expression="base64_encode(json_encode( $review->getVie
</div>
{{else}}
<a id="review-{$review->id}"></a>
<a id="findReview-{$review->id}"></a>
<article id="review-{$review->id}" class="ipsEntry js-ipsEntry ipsEntry--simple ipsEntry--review {{if $review->hidden() OR $item->hidden() == -2}}ipsModerated{{endif}}">
{template="review" location="database" group="display" app="cms" params="$item, $review, $item::$formLangPrefix . 'review', $item::$application, $item::$module"}
</article>
@@ -1644,7 +1651,7 @@ data-view-tracking-data="{expression="base64_encode(json_encode( $review->getVie
</div>]]></template>
<template template_key="database_listing_categoryFooter" template_title="categoryFooter" template_desc="" template_location="database" template_group="listing" template_params="$category, $table, $activeFilters" template_app="" template_type="template"><![CDATA[
{{if ! \IPS\Request::i()->isAjax() AND ! isset( \IPS\Request::i()->advancedSearchForm ) AND $category->show_records}}
<ul class="ipsButtons ipsButtons--main ipsButtons--margin">
<ul class="ipsButtons ipsButtons--main i-margin-block_block">
{{if \IPS\Member::loggedIn()->member_id}}
<li>
<a class="ipsButton ipsButton--text" href="{$category->url()->setQueryString( 'do', 'markRead' )->csrf()}"><i class="fa-solid fa-check"></i> {lang="cms_mark_read"}</a>
@@ -1907,6 +1914,9 @@ data-view-tracking-data="{expression="base64_encode(json_encode( $review->getVie
{template="assignmentBadge" app="core" group="global" params="$row, ''"}
{{foreach $row->badges() as $badge}}{$badge|raw}{{endforeach}}
</div>
{{if $row->prefix()}}
{template="prefix" group="global" app="core" params="$row->prefix( TRUE ), $row->prefix()"}
{{endif}}
<h4>
{{if member.member_id}}
{{if $row->unread()}}
@@ -1926,15 +1936,9 @@ data-view-tracking-data="{expression="base64_encode(json_encode( $review->getVie
<div class='ipsData__meta'>
<span>{lang="byline_name_date" htmlsprintf="$row->author()->link( $row->warningRef(), NULL, $row->isAnonymous() ), \IPS\DateTime::ts( $row->mapped('date') )->html(FALSE)"}</span>
</div>
{{if isset( $table->extra['layout'] ) and \in_array( $table->extra['layout'], array("table", "featured", "grid"))}}
<div class='ipsData__desc'>{$row->truncated(TRUE)|raw}</div>
{{if \count( $row->tags() )}}
{template="tagsWithPrefix" group="global" app="core" params="$row->tags(), $row->prefix(), true"}
{{endif}}
{{else}}
{{if $row->prefix()}}
{template="prefix" group="global" app="core" params="$row->prefix( TRUE ), $row->prefix()"}
{{endif}}
<div class='ipsData__desc'>{$row->truncated(TRUE)|raw}</div>
{{if \count( $row->tags() )}}
{template="tags" group="global" app="core" params="$row->tags(), true"}
{{endif}}
{{if \count( $row->customFieldsForDisplay('listing') )}}
<ul class='ipsData__fields'>
@@ -1946,87 +1950,83 @@ data-view-tracking-data="{expression="base64_encode(json_encode( $review->getVie
</ul>
{{endif}}
</div>
{{if isset( $table->extra['layout'] ) and !\in_array( $table->extra['layout'], array("minimal"))}}
{{if $row->groupsPosted}}
{template="groupPostedBadges" group="global" app="core" location="front" params="$row->groupsPosted, 'topic_posted_in_groups', 'ipsResponsive_hidePhone'"}
{{endif}}
{{if $row::database()->options['reviews'] and $row->averageReviewRating() > 0}}
<ul class='ipsRating ipsRating_small'>
{{foreach range( 1, \IPS\Settings::i()->reviews_rating_out_of ) as $i}}
<li class='{{if $row->averageReviewRating() >= $i}}ipsRating_on{{else}}ipsRating_off{{endif}}'>
<i class='fa-solid fa-star'></i>
</li>
{{endforeach}}
</ul>
{{elseif $row->container()->allow_rating and $row->rating_value > 0}}
{template="rating" group="global" location="front" app="core" params="'small', $row->rating_value, \IPS\Settings::i()->reviews_rating_out_of"}
{{endif}}
<div class="ipsData__extra">
<ul class='ipsData__stats'>
{{foreach $row->stats(TRUE) as $k => $v}}
<li {{if \in_array( $k, $row->hotStats )}}class="ipsData__stats-hot" data-text='{lang="hot_item"}' data-ipsTooltip title='{lang="hot_item_desc"}'{{endif}} data-statType='{$k}' data-v="{$v}">
<span class='ipsData__stats-icon' data-stat-value='{number="$v"}' aria-hidden="true" data-ipstooltip title='{number="$v" format="short"} {lang="{$k}" pluralize="$v" format="short"}'></span>
<span class='ipsData__stats-label'>{number="$v"} {lang="content_records_stat_{$k}" pluralize="$v"}</span>
</li>
{{endforeach}}
</ul>
<div class="ipsData__last">
{{if ($row::database()->options['comments'] or $row::database()->options['reviews']) and isset( $table->extra['layout'] ) and \in_array( $table->extra['layout'], array("table", "featured"))}}
{{if $row->mapped('num_comments')}}
{template="userPhoto" app="core" group="global" params="$row->lastCommenter(), 'tiny'"}
{{else}}
{template="userPhoto" app="core" group="global" params="$row->author(), 'tiny'"}
{{endif}}
<div class='ipsData__last-text'>
<div class='ipsData__last-primary'>
{{if $row->database()->_comment_bump & \IPS\cms\Databases::BUMP_ON_COMMENT}}
{{if $row->mapped('num_comments')}}
{{if $row->mapped('last_comment_anon')}}
{template="userLink" app="core" group="global" params="$row->author(), NULL, NULL, TRUE"}
{{else}}
{lang="cms_row_commented_by" htmlsprintf="$row->lastCommenter()->link()"}
{{endif}}
{{else}}
{lang="cms_row_added_by" htmlsprintf="$row->author()->link( NULL, NULL, $row->isAnonymous() )"}
{{endif}}
{{elseif $row->database()->_comment_bump & \IPS\cms\Databases::BUMP_ON_EDIT}}
{{if $row->record_edit_time > 0}}
{lang="cms_row_updated_by" htmlsprintf="\IPS\Member::load( $row->record_edit_member_id )->link()"}
{{else}}
{lang="cms_row_added_by" htmlsprintf="$row->author()->link( NULL, NULL, $row->isAnonymous() )"}
{{endif}}
{{else}}
{{if $row->record_edit_time > 0}}
{lang="cms_row_updated_by" htmlsprintf="$row->lastCommenter()->link()"}
{{else}}
{lang="cms_row_added_by" htmlsprintf="$row->author()->link( NULL, NULL, $row->isAnonymous() )"}
{{endif}}
{{endif}}
</div>
<div class='ipsData__last-secondary'>
<a href='{$row->url( 'getLastComment' )}' title='{lang="get_last_post"}'>
{{if $row->database()->_comment_bump & \IPS\cms\Databases::BUMP_ON_COMMENT}}
{{if $row->mapped('num_comments')}}{datetime="$row->mapped('last_comment')"}{{else}}{datetime="$row->mapped('date')"}{{endif}}
{{else}}
{{if $row->record_edit_time > 0}}{datetime="$row->record_edit_time"}{{else}}{datetime="$row->mapped('date')"}{{endif}}
{{endif}}
</a>
</div>
</div>
{{else}}
{template="userPhoto" app="core" group="global" params="$row->author(), 'tiny'"}
<div class='ipsData__last-text'>
<div class='ipsData__last-primary'>{$row->author()->link()|raw}</div>
<div class='ipsData__last-secondary'>
<a href='{$row->url( "getPrefComment" )}'>
{datetime="$row->mapped('date')"}
</a>
</div>
</div>
{{endif}}
{{if $row->groupsPosted}}
{template="groupPostedBadges" group="global" app="core" location="front" params="$row->groupsPosted, 'topic_posted_in_groups'"}
{{endif}}
{{if $row::database()->options['reviews'] and $row->averageReviewRating() > 0}}
<ul class='ipsRating ipsRating_small'>
{{foreach range( 1, \IPS\Settings::i()->reviews_rating_out_of ) as $i}}
<li class='{{if $row->averageReviewRating() >= $i}}ipsRating_on{{else}}ipsRating_off{{endif}}'>
<i class='fa-solid fa-star'></i>
</li>
{{endforeach}}
</ul>
{{elseif $row->container()->allow_rating and $row->rating_value > 0}}
{template="rating" group="global" location="front" app="core" params="'small', $row->rating_value, \IPS\Settings::i()->reviews_rating_out_of"}
{{endif}}
<div class="ipsData__extra">
<div class="ipsData__last ipsData__last--author">
{template="userPhoto" app="core" group="global" params="$row->author(), 'tiny'"}
<div class='ipsData__last-text'>
<div class='ipsData__last-primary'>{$row->author()->link( NULL, NULL, $row->isAnonymous() )|raw}</div>
<div class='ipsData__last-secondary'>{datetime="$row->mapped('date')"}</div>
</div>
</div>
{{endif}}
{{if ($row::database()->options['comments'] or $row::database()->options['reviews'])}}
<div class="ipsData__last">
{{if $row->mapped('num_comments')}}
{template="userPhoto" app="core" group="global" params="$row->lastCommenter(), 'tiny'"}
{{else}}
{template="userPhoto" app="core" group="global" params="$row->author(), 'tiny'"}
{{endif}}
<div class='ipsData__last-text'>
<div class='ipsData__last-primary'>
{{if $row->database()->_comment_bump & \IPS\cms\Databases::BUMP_ON_COMMENT}}
{{if $row->mapped('num_comments')}}
{{if $row->mapped('last_comment_anon')}}
{template="userLink" app="core" group="global" params="$row->author(), NULL, NULL, TRUE"}
{{else}}
{$row->lastCommenter()->link()|raw}
{{endif}}
{{else}}
{$row->author()->link( NULL, NULL, $row->isAnonymous() )|raw}
{{endif}}
{{elseif $row->database()->_comment_bump & \IPS\cms\Databases::BUMP_ON_EDIT}}
{{if $row->record_edit_time > 0}}
{lang="cms_row_updated_by" htmlsprintf="\IPS\Member::load( $row->record_edit_member_id )->link()"}
{{else}}
{lang="cms_row_added_by" htmlsprintf="$row->author()->link( NULL, NULL, $row->isAnonymous() )"}
{{endif}}
{{else}}
{{if $row->record_edit_time > 0}}
{lang="cms_row_updated_by" htmlsprintf="$row->lastCommenter()->link()"}
{{else}}
{lang="cms_row_added_by" htmlsprintf="$row->author()->link( NULL, NULL, $row->isAnonymous() )"}
{{endif}}
{{endif}}
</div>
<div class='ipsData__last-secondary'>
<a href='{$row->url( 'getLastComment' )}' title='{lang="get_last_post"}'>
{{if $row->database()->_comment_bump & \IPS\cms\Databases::BUMP_ON_COMMENT}}
{{if $row->mapped('num_comments')}}{datetime="$row->mapped('last_comment')"}{{else}}{datetime="$row->mapped('date')"}{{endif}}
{{else}}
{{if $row->record_edit_time > 0}}{datetime="$row->record_edit_time"}{{else}}{datetime="$row->mapped('date')"}{{endif}}
{{endif}}
</a>
</div>
</div>
</div>
{{endif}}
<ul class='ipsData__stats'>
{{foreach $row->stats(TRUE) as $k => $v}}
<li {{if \in_array( $k, $row->hotStats )}}class="ipsData__stats-hot" data-text='{lang="hot_item"}' data-ipsTooltip title='{lang="hot_item_desc"}'{{endif}} data-statType='{$k}' data-v="{$v}">
<span class='ipsData__stats-icon' data-stat-value='{number="$v"}' aria-hidden="true" data-ipstooltip title='{number="$v" format="short"} {lang="{$k}" pluralize="$v" format="short"}'></span>
<span class='ipsData__stats-label'>{number="$v"} {lang="content_records_stat_{$k}" pluralize="$v"}</span>
</li>
{{endforeach}}
</ul>
</div>
</div>
{{if $table and $table->canModerate()}}
<div class='ipsData__mod'>
+54 -28
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="5000029" 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="5000030" javascript_position="1000100"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -67,15 +67,14 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="cms" javascript_location="front" javascript_path="controllers/blocks" javascript_name="ips.blocks.navigation.js" javascript_type="controller" javascript_version="5000029" javascript_position="1000050"><![CDATA[/*
+--------------------------------------------------------------------------
|
| =============================================
| by Esther Eisner
| 1/3/2024 3:35 PM
| esther@headstandconsulting.com
+--------------------------------------------------------------------------
*/
<file javascript_app="cms" javascript_location="front" javascript_path="controllers/blocks" javascript_name="ips.blocks.navigation.js" javascript_type="controller" javascript_version="5000030" javascript_position="1000050"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
* ips.blocks.navigation.js
*
* Author: Esther Eisner
*/
;(function ($, _, undefined) {
@@ -112,7 +111,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="5000029" 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="5000030" javascript_position="1000150">/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -157,7 +156,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="5000029" javascript_position="1000150"><![CDATA[/**
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/databases" javascript_name="ips.databases.form.js" javascript_type="controller" javascript_version="5000030" javascript_position="1000150"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -233,7 +232,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="5000029" 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="5000030" javascript_position="1000150"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -368,7 +367,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="5000029" javascript_position="1000200"><![CDATA[/**
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/fields" javascript_name="ips.fields.form.js" javascript_type="controller" javascript_version="5000030" javascript_position="1000200"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -395,11 +394,38 @@
if (!(form instanceof HTMLFormElement)) {
return;
}
const showMapActive = !!form.querySelector('select[name="field_type"] option[value="Address"]')?.selected;
const typeSelector = form.querySelector('select[name="field_type"]');
const showMapActive = typeSelector?.value?.toLowerCase() === 'address';
const mapEl = form.querySelectorAll('#field_show_map_listing,#field_show_map_display');
if (mapEl && !showMapActive) {
mapEl.forEach(el => e.detail.togglesOff.add(el));
}
// for these, several of the listing/display format options don't apply
if (typeSelector?.value?.match(/^(youtube|spotify|soundcloud)$/i)) {
form
.querySelectorAll("#field_display_listing_json_badge, #field_display_listing_badge_bgcolor, #field_display_listing_badge_color, #field_display_display_json_badge, #field_display_display_badge_bgcolor, #field_display_display_badge_color, #field_display_display_json_where")
.forEach(el => {
e.detail.togglesOff.add(el);
e.detail.togglesOn.delete(el);
});
} else {
form
.querySelectorAll("#media_display_listing_method, #media_display_display_method")
.forEach(el => {
e.detail.togglesOff.add(el);
e.detail.togglesOn.delete(el);
});
}
// field_truncate is an exception where there are two togglers; in this case we just target the "Show in listing template" one
const fieldTruncate = form.querySelector('#field_truncate');
if (fieldTruncate) {
if (form.querySelector('#check_field_display_listing') && !form.querySelector('#check_field_display_listing').checked) {
e.detail.togglesOff.add(fieldTruncate);
e.detail.togglesOn.delete(fieldTruncate);
}
}
})
},
@@ -431,7 +457,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="5000029" 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="5000030" javascript_position="1000300"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -1071,7 +1097,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="5000029" 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="5000030" javascript_position="1000250"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -1106,7 +1132,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="5000029" 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="5000030" javascript_position="1000250"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -1228,7 +1254,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="5000029" 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="5000030" javascript_position="1000100"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -1340,7 +1366,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="5000029" 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="5000030" javascript_position="1000100">/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -1395,7 +1421,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="5000029" 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="5000030" javascript_position="1000050">/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -1445,7 +1471,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="5000029" 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="5000030" javascript_position="1000050">/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -1517,7 +1543,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="5000029" 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="5000030" javascript_position="1000050"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -2478,7 +2504,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="5000029" 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="5000030" javascript_position="1000050"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -2770,7 +2796,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="5000029" javascript_position="1000050"><![CDATA[/**
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.main.js" javascript_type="controller" javascript_version="5000030" javascript_position="1000050"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -2939,7 +2965,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="5000029" 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="5000030" javascript_position="1000050">/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -2984,7 +3010,7 @@
}
});
}(jQuery, _));</file>
<file javascript_app="cms" javascript_location="admin" javascript_path="templates" javascript_name="ips.templates.media.js" javascript_type="template" javascript_version="5000029" 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="5000030" javascript_position="1000050"><![CDATA[ips.templates.set( 'templates.media.grid', "\
<ul class='ipsGrid ipsGrid--pages-media'>\
{{{contents}}}\
</ul>\
@@ -3001,7 +3027,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="5000029" 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="5000030" javascript_position="1000050"><![CDATA[/* TEMPLATE EDITOR TEMPLATES */
/* TEMPLATECEPTION */
ips.templates.set('templates.editor.newTab', " \
<li data-fileid='{{fileid}}' data-location='{{location}}'>\
+3 -3
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<language>
<app key="cms" version="5000029">
<app key="cms" version="5000030">
<word key="__app_cms" js="0">Pages</word>
<word key="menutab__cms" js="0">Pages</word>
<word key="menutab__cms_icon" js="0">file</word>
@@ -229,8 +229,8 @@
<word key="block_template_theme_import" js="0">Theme set</word>
<word key="template_database_group" js="0">Type</word>
<word key="cms_new_db_template_group_listing" js="0">Record Listing (Shown when clicking a category)</word>
<word key="cms_new_db_template_group_index" js="0">Featured Records (First page when viewing a database set to show featured articles)</word>
<word key="cms_new_db_template_group_categories" js="0">Category List (First page when viewing a database)</word>
<word key="cms_new_db_template_group_index" js="0">Index (First page when viewing a database)</word>
<word key="cms_new_db_template_group_categories" js="0">Category List (Shows all available database categories)</word>
<word key="cms_new_db_template_group_display" js="0">Record (Displays the record and comments)</word>
<word key="cms_new_db_template_group_form" js="0">Record Form (Used when adding/editing a record)</word>
<word key="database_template_type" js="0">Template Type</word>
+2 -1
View File
@@ -596,5 +596,6 @@
"5000026": "5.0.0 Beta 1",
"5000027": "5.0.0 Beta 2",
"5000028": "5.0.0 Beta 2",
"5000029": "5.0.0 Beta 3"
"5000029": "5.0.0 Beta 3",
"5000030": "5.0.0 Beta 4"
}
@@ -127,8 +127,19 @@ class Widgets extends EditorLocationsAbstract
$pageId = NULL;
foreach( Db::i()->select( '*', 'cms_page_widget_areas' ) as $item )
{
$areaData = json_decode( $item['area_tree'], TRUE );
$area = new Area( $areaData, $item['area_area'] );
if( $item['area_tree'] )
{
$area = new Area( json_decode( $item['area_tree'], true ), $item['area_area'] );
}
elseif( $item['area_widgets'] )
{
$area = Area::create( $item['area_area'], json_decode( $item['area_widgets'], true ) );
}
else
{
continue;
}
foreach( $area->getAllWidgets() as $widget )
{
if ( $widget['unique'] == $uniqueId )
@@ -154,7 +165,7 @@ class Widgets extends EditorLocationsAbstract
{
if( $row['tree'] )
{
$area = new Area( json_decode( $row['area_tree'], true ), $row['area'] );
$area = new Area( json_decode( $row['tree'], true ), $row['area'] );
}
elseif( $row['widgets'] )
{
@@ -35,7 +35,7 @@ if ( isset( Request::i()->file ) )
}
$file = file_get_contents( \IPS\ROOT_PATH . '/themes/' . Request::i()->file );
Output::i()->pageCaching = FALSE;
Output::setCacheTime( false );
Output::i()->sendOutput( preg_replace( '#<ips:template.+?\n#', '', $file ), 200, ( mb_substr( Request::i()->file, -4 ) === '.css' ) ? 'text/css' : 'text/javascript' );
}
+1 -1
View File
@@ -50,7 +50,7 @@ catch(OutOfRangeException $ex ){}
if( !$cache OR !Settings::i()->widget_cache_ttl )
{
Output::i()->pageCaching = FALSE;
Output::setCacheTime( false );
$headers = array();
}
else
@@ -13,6 +13,7 @@ namespace IPS\cms\modules\admin\databases;
/* To prevent PHP errors (extending class does not exist) revealing path */
use Cassandra\Set;
use Exception;
use InvalidArgumentException;
use IPS\Application;
@@ -764,7 +765,25 @@ class databases extends Controller
/* Perms */
$existingPerms = $category->permissions();
Db::i()->update( 'core_permission_index', array_merge( $perms, array( 'perm_id' => $existingPerms['perm_id'], 'perm_type_id' => $category->id ) ), array( 'perm_id=?', $existingPerms['perm_id'] ) );
/* Make sure these are at least visible */
if( $category->has_perms )
{
if( !isset( $perms['perm_view'] ) or empty( $perms['perm_view'] ) )
{
$perms['perm_view'] = '*';
}
if( !isset( $perms['perm_2'] ) or empty( $perms['perm_2'] ) )
{
$perms['perm_2'] = Settings::i()->admin_group;
}
if( !isset( $perms['perm_3'] ) or empty( $perms['perm_3'] ) )
{
$perms['perm_3'] = Settings::i()->admin_group;
}
Db::i()->update( 'core_permission_index', array_merge( $perms, array( 'perm_id' => $existingPerms['perm_id'], 'perm_type_id' => $category->id ) ), array( 'perm_id=?', $existingPerms['perm_id'] ) );
}
$next = 'template';
$doneSomething = true;
break;
@@ -1030,7 +1049,7 @@ class databases extends Controller
/* Custom fields */
$textFields = array( 'field_extra', 'field_default_value', 'field_name', 'field_description', 'field_display_json', 'field_validator_error' );
$removeFields = array( 'field_database_id' );
$removeFields = array( 'field_database_id', 'perm_id', 'perm_type', 'perm_type_id' );
$fieldSchema = $schema['cms_database_fields'];
foreach ( Db::i()->select( 'f.*, w.word_custom as field_name, w2.word_custom as field_description, w3.word_custom as field_validator_error, p.*', array('cms_database_fields', 'f'), array( 'field_database_id=?', $database->id ) )
->join( array( 'core_sys_lang_words', 'w' ), "w.word_key=CONCAT( 'content_field_', f.field_id ) and w.lang_id=" . Lang::defaultLanguage() )
@@ -1044,7 +1063,7 @@ class databases extends Controller
foreach( $row as $k => $v )
{
if ( array_key_exists( $k, $fieldSchema['columns'] ) AND ! in_array( $k, $removeFields ) AND ! in_array( $k, $textFields ) )
if ( !in_array( $k, $removeFields ) AND !in_array( $k, $textFields ) and ( mb_substr( $k, 0, 5 ) == 'perm_' or array_key_exists( $k, $fieldSchema['columns'] ) ) )
{
$xml->startAttribute( $k );
$xml->text( $v ?? '' );
@@ -1078,7 +1097,7 @@ class databases extends Controller
$textFields = array( 'category_name', 'category_description', 'category_meta_keywords', 'category_meta_description', 'category_page_title' );
$removeFields = array( 'category_database_id', 'category_last_record_id', 'category_last_record_date', 'category_last_record_member', 'category_last_record_name', 'category_last_record_seo_name', 'category_records', 'category_record_comments',
'category_record_comments_queued', 'category_rss_cache', 'category_rss_cached', 'category_rss_exclude', 'category_forum_override', 'category_forum_record', 'category_forum_comments', 'category_forum_delete', 'category_forum_suffix', 'category_forum_prefix',
'category_forum_forum', 'category_full_path', 'category_last_title', 'category_last_seo_title');
'category_forum_forum', 'category_full_path', 'category_last_title', 'category_last_seo_title', 'perm_id', 'perm_type_id', 'perm_type' );
$categorySchema = $schema['cms_database_categories'];
foreach ( Db::i()->select( 'c.*, w.word_custom as category_name, w2.word_custom as category_description, p.*', array('cms_database_categories', 'c'), array( 'category_database_id=?', $database->id ) )
->join( array( 'core_sys_lang_words', 'w' ), "w.word_key=CONCAT( 'content_cat_name_', c.category_id ) and w.lang_id=" . Lang::defaultLanguage() )
@@ -1091,7 +1110,8 @@ class databases extends Controller
foreach( $row as $k => $v )
{
if ( array_key_exists( $k, $categorySchema['columns'] ) AND ! in_array( $k, $removeFields ) AND ! in_array( $k, $textFields ) )
if ( !in_array( $k, $removeFields ) AND !in_array( $k, $textFields ) and ( mb_substr( $k, 0, 5 ) == 'perm_' or array_key_exists( $k, $categorySchema['columns'] ) ) )
{
$xml->startAttribute( $k );
$xml->text( $v ?? '' );
@@ -1655,7 +1675,7 @@ class databases extends Controller
0 => 'database_use_categories_no'
),
'toggles' => array(
1 => array( 'database_allow_club_categories' ),
1 => array( 'database_categories_layout' ),
0 => array( 'category_allow_rating', 'category_can_view_others' )
),
'disabled' => $disabled
@@ -1675,7 +1695,7 @@ class databases extends Controller
1 => 'database_allow_club_categories_yes',
),
'disabled' => ( $current?->allow_club_categories and $current->numberOfClubCategories() ),
) ) );
), null, null, null, 'database_allow_club_categories' ) );
}
Member::loggedIn()->language()->words['category_can_view_others_desc'] = Member::loggedIn()->language()->addToStack('category_can_view_others_database_desc');
@@ -1813,7 +1833,7 @@ class databases extends Controller
'options' => ( count( $templatesCat ) ? array_merge( $layouts, $custom ) : $layouts ),
'toggles' => [ 'custom' => [ 'database_template_categories' ] ],
'disabled' => ( count( $templatesCat ) ? null : [ 'custom' ] )
] ) );
], null, null, null, 'database_categories_layout' ) );
if( count( $templatesCat ) )
{
$form->add( new Select( 'database_template_categories', ( ! empty( $current ) and $current->display_settings['categories']['layout'] == 'custom' ) ? $current->display_settings['categories']['template'] : NULL, null, array( 'options' => $templatesCat ), NULL, NULL, Theme::i()->getTemplate( 'databases', 'cms' )->templateGoButton('database_template_categories'), 'database_template_categories' ) );
@@ -160,7 +160,7 @@ class ajax extends Controller
'template_key' => $template->key,
'template_title' => $template->title,
'template_desc' => $template->desc,
'template_content' => ( isset( Request::i()->noencode ) AND Request::i()->noencode ) ? $template->content : htmlentities( $template->content, ENT_DISALLOWED, 'UTF-8' ),
'template_content' => ( isset( Request::i()->noencode ) AND Request::i()->noencode ) ? ( $template->content ?? '' ) : htmlentities( ( $template->content ?? '' ), ENT_DISALLOWED, 'UTF-8' ),
'template_location' => $template->location,
'template_group' => $template->group,
'template_container' => $template->container,
@@ -0,0 +1,22 @@
{
"id": 5000030,
"name": "5.0.0 Beta 4",
"steps": {
"queries": false,
"lang": true,
"theme": false,
"themeeditor": false,
"javascript": true,
"emailTemplates": false,
"acpSearchKeywords": false,
"settings": false,
"tasks": false,
"modules": false,
"widgets": false,
"customOptions": false,
"customRoutines": false
},
"forceMainUpgrader": false,
"forceManualDownloadNoCiC": false,
"forceManualDownloadCiC": false
}
@@ -0,0 +1,15 @@
{
"files": {
"added": [],
"edited": [
"cms\/front\/controllers\/blocks\/ips.blocks.navigation.js",
"cms\/admin\/controllers\/fields\/ips.fields.form.js"
],
"removed": []
},
"orders": {
"added": [],
"edited": [],
"removed": []
}
}
@@ -0,0 +1,15 @@
{
"normal": {
"added": [],
"edited": [
"cms_new_db_template_group_index",
"cms_new_db_template_group_categories"
],
"removed": []
},
"js": {
"added": [],
"edited": [],
"removed": []
}
}
@@ -463,6 +463,26 @@ class Categories extends Model implements Permissions
return parent::roots( $permissionCheck, $member, $where, $limit );
}
/**
* Fetch All Root Nodes
*
* @param string|null $permissionCheck The permission key to check for or NULl to not check permissions
* @param Member|null $member The member to check permissions for or NULL for the currently logged in member
* @param mixed $where Additional WHERE clause
* @param string|null $order ORDER BY clause
* @param array|null $limit Limit/offset to use, or NULL for no limit (default)
* @return array
*/
protected static function nodesWithPermission( ?string $permissionCheck, ?Member $member, mixed $where=array(), string $order=NULL, array $limit=NULL ): array
{
if( static::$customDatabaseId !== null )
{
$where[] = array( 'category_database_id=?', static::$customDatabaseId );
}
return parent::nodesWithPermission( $permissionCheck, $member, $where, $order, $limit );
}
/**
* [Node] Fetch Child Nodes
@@ -186,12 +186,16 @@ class Dispatcher extends SystemDispatcher
Output::i()->error( 'page_doesnt_exist', '2T251/2', 404 );
}
$path = trim( preg_replace( '#' . Page::$currentPage->full_path . '#', '', Request::i()->path, 1 ), '/' );
/* If we visited the default page in a folder, the full_path will be like folder/page but the request path will just be folder */
if( Request::i()->path . '/' . Page::$currentPage->seo_name == Page::$currentPage->full_path )
$path = '';
if( isset( Request::i()->path ) )
{
$path = '';
$path = trim( preg_replace( '#' . Page::$currentPage->full_path . '#', '', Request::i()->path, 1 ), '/' );
/* If we visited the default page in a folder, the full_path will be like folder/page but the request path will just be folder */
if( Request::i()->path . '/' . Page::$currentPage->seo_name == Page::$currentPage->full_path )
{
$path = '';
}
}
list( $path, $pageNumber ) = Page::getStrippedPagePath( $path );
+28 -6
View File
@@ -969,16 +969,38 @@ class Fields extends CustomField implements Permissions
{
foreach( $value as $idx => $val )
{
if ( $val instanceof FileSystem )
if ( $val instanceof File )
{
$value[ $idx ] = (string) $val->url;
$fileKey = Encrypt::fromPlaintext( (string) $val )->tag();
$downloadUrl = Url::internal( 'applications/core/interface/file/cfield.php', 'none' )->setqueryString( array(
'storage' => $val->storageExtension,
'path' => $val->originalFilename,
'fileKey' => $fileKey
) );
$value[ $idx ] = Theme::i()->getTemplate( 'global', 'cms', 'front' )->uploadDisplay( File::get( static::$uploadStorageExtension, $val ), $record, $downloadUrl, $fileKey );
}
}
}
else if ( $value instanceof FileSystem )
else if ( $value instanceof File )
{
$value = (string) $value->url;
$fileKey = Encrypt::fromPlaintext( (string) $value )->tag();
$downloadUrl = Url::internal( 'applications/core/interface/file/cfield.php', 'none' )->setqueryString( array(
'storage' => $value->storageExtension,
'path' => $value->originalFilename,
'fileKey' => $fileKey
) );
$value = Theme::i()->getTemplate( 'global', 'cms', 'front' )->uploadDisplay( File::get( static::$uploadStorageExtension, $value ), $record, $downloadUrl, $fileKey );
}
/* Restructure formValue so that it has the full URL */
$updatedFormValue = [];
foreach( explode( ",", $formValue ) as $val )
{
$updatedFormValue[] = File::get( static::$uploadStorageExtension, $val )->url;
}
$formValue = implode( ",", $updatedFormValue );
}
if ( ! isset( Store::i()->$functionName ) )
{
@@ -2235,7 +2257,7 @@ class Fields extends CustomField implements Permissions
if ( ! $isTitleOrContent )
{
$form->add( new YesNo( 'field_display_listing', $this->id ? $this->display_listing : 1, FALSE, array(
'togglesOn' => array('field_truncate', 'field_display_listing_json_badge', 'field_show_map_listing' )
'togglesOn' => array('field_display_listing_json_badge', 'field_show_map_listing', 'media_display_listing_method' )
), NULL, NULL, NULL, 'field_display_listing' ) );
}
@@ -2277,7 +2299,7 @@ class Fields extends CustomField implements Permissions
if ( ! $isTitleOrContent )
{
$form->add( new YesNo( 'field_display_display', $this->id ? $this->display_display : 1, FALSE, array(
'togglesOn' => array( 'field_display_display_json_badge', 'field_show_map_display', 'field_display_display_json_where' )
'togglesOn' => array( 'field_display_display_json_badge', 'field_show_map_display', 'field_display_display_json_where', 'media_display_display_method' )
), NULL, NULL, NULL, 'field_display_display' ) );
}
@@ -182,13 +182,14 @@ class CommentTopicSync extends Comment
/**
* Report
*
* @param string $reportContent Report content message from member
* @param int $reportType Report type (see constants in \IPS\core\Reports\Report
* @param Member|null $member Member making the report (or NULL for loggedIn())
* @return Report
* @throws UnexpectedValueException If there is a permission error - you should only call this method after checking canReport
* @param string $reportContent Report content message from member
* @param int $reportType Report type (see constants in \IPS\core\Reports\Report)
* @param \IPS\Member|NULL $member Member making the report (or NULL for loggedIn())
* @param array $guestDetails Details for a guest report
* @return \IPS\core\Reports\Report
* @throws UnexpectedValueException If there is a permission error - you should only call this method after checking canReport
*/
public function report( string $reportContent, int $reportType=1, Member|null $member=null ): Report
public function report( string $reportContent, int $reportType=1, Member|null $member=null, array $guestDetails=array() ): Report
{
$comment = Post::load( $this->pid );
return $comment->report( $reportContent, $reportType, $member );
+5
View File
@@ -56,6 +56,11 @@ class Database extends Widget
* @brief Set to true if this widget must be the only one in its area
*/
public bool $soloWidget = true;
/**
* @brief If a widget should not be dropped into a particular area (e.g. a database widget in the header), list those areas here
*/
public static array $disallowedAreas = [ 'header', 'footer', 'sidebar', 'globalfooter' ];
/**
* Specify widget configuration
+4 -4
View File
@@ -115,7 +115,7 @@ class Application extends SystemApplication
*
* @return void
*/
public function installOther()
public function installOther() : void
{
static::checkConvParent();
@@ -146,7 +146,7 @@ class Application extends SystemApplication
* @param string|NULL $application The application to check, or NULL to check all.
* @return void
*/
public static function checkConvParent( $application=NULL )
public static function checkConvParent( ?string $application=NULL ) : void
{
$parents = array(
'blog' => array(
@@ -269,7 +269,7 @@ class Application extends SystemApplication
* on hardcoded potential patterns.
* @return void
*/
public function convertLegacyParameters()
public function convertLegacyParameters() : void
{
$_qs = '';
if ( isset( $_SERVER['QUERY_STRING'] ) )
@@ -320,7 +320,7 @@ class Application extends SystemApplication
*
* @return void
*/
public static function checkRedirects()
public static function checkRedirects() : void
{
/* Try each of our converted applications. We will assume the most important conversions were done first */
foreach(App::apps() as $app )
+2 -2
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="5000029" javascript_position="1000100">/**
<file javascript_app="convert" javascript_location="admin" javascript_path="controllers/convert" javascript_name="ips.convert.menu.js" javascript_type="controller" javascript_version="5000030" javascript_position="1000100">/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -45,7 +45,7 @@
}
} );
}(jQuery, _));</file>
<file javascript_app="convert" javascript_location="admin" javascript_path="controllers/forms" javascript_name="ips.forms.reactionmapper.js" javascript_type="controller" javascript_version="5000029" javascript_position="1000050">/**
<file javascript_app="convert" javascript_location="admin" javascript_path="controllers/forms" javascript_name="ips.forms.reactionmapper.js" javascript_type="controller" javascript_version="5000030" 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="convert" version="5000029">
<app key="convert" version="5000030">
<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>
+2 -1
View File
@@ -278,5 +278,6 @@
"5000026": "5.0.0 Beta 1",
"5000027": "5.0.0 Beta 2",
"5000028": "5.0.0 Beta 2",
"5000029": "5.0.0 Beta 3"
"5000029": "5.0.0 Beta 3",
"5000030": "5.0.0 Beta 4"
}
@@ -18,6 +18,7 @@ use Exception;
use IPS\Application;
use IPS\convert\App;
use IPS\Db;
use IPS\Extensions\QueueAbstract;
use IPS\forums\Topic\ArchivedPost;
use IPS\Member;
use IPS\Patterns\ActiveRecordIterator;
@@ -35,7 +36,7 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
/**
* Background Task
*/
class DeleteEmptyTopics
class DeleteEmptyTopics extends QueueAbstract
{
/**
* Parse data before queuing
@@ -69,7 +70,7 @@ class DeleteEmptyTopics
*
* @param mixed $data Data as it was passed to \IPS\Task::queue()
* @param int $offset Offset
* @return int|null New offset or NULL if complete
* @return int New offset or NULL if complete
* @throws OutOfRangeException Indicates offset doesn't exist and thus task is complete
*/
public function run( mixed &$data, int $offset ): int
@@ -109,7 +110,7 @@ class DeleteEmptyTopics
}
/* If the topic isn't archived, we can delete it */
if ( $topic->isArchived() == FALSE )
if ( !$topic->isArchived() )
{
$topic->delete();
}
@@ -17,11 +17,13 @@ use DOMElement;
use Exception;
use IPS\Application;
use IPS\convert\App;
use IPS\Extensions\QueueAbstract;
use IPS\Http\Url;
use IPS\Log;
use IPS\Member;
use IPS\Patterns\ActiveRecordIterator;
use IPS\Settings;
use IPS\Task\Queue\OutOfRangeException as QueueOutOfRangeException;
use IPS\Text\DOMParser;
use IPS\Xml\DOMDocument;
use OutOfRangeException;
@@ -39,12 +41,17 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
/**
* Background Task
*/
class InvisionCommunityRebuildContent
class InvisionCommunityRebuildContent extends QueueAbstract
{
/**
* @brief Number of content items to rebuild per cycle
*/
public $rebuild = REBUILD_SLOW;
public int $rebuild = REBUILD_SLOW;
/**
* @var App|null
*/
protected ?App $app = null;
/**
* Parse data before queuing
@@ -88,8 +95,8 @@ class InvisionCommunityRebuildContent
*
* @param mixed $data Data as it was passed to \IPS\Task::queue()
* @param int $offset Offset
* @return int|null New offset or NULL if complete
* @throws \IPS\Task\Queue\OutOfRangeException Indicates offset doesn't exist and thus task is complete
* @return int New offset or NULL if complete
* @throws QueueOutOfRangeException Indicates offset doesn't exist and thus task is complete
*/
public function run( mixed &$data, int $offset ): int
{
@@ -97,13 +104,13 @@ class InvisionCommunityRebuildContent
$exploded = explode( '\\', $classname );
if ( !class_exists( $classname ) or !Application::appIsEnabled( $exploded[1] ) )
{
throw new \IPS\Task\Queue\OutOfRangeException;
throw new QueueOutOfRangeException;
}
/* Make sure there's even content to parse */
if( !isset( $classname::$databaseColumnMap['content'] ) )
{
throw new \IPS\Task\Queue\OutOfRangeException;
throw new QueueOutOfRangeException;
}
/* Intentionally no try/catch as it means app doesn't exist */
@@ -114,12 +121,12 @@ class InvisionCommunityRebuildContent
/* This extension is ONLY for InvisionCommunity conversions */
if( $this->app->app_key != 'invisioncommunity' )
{
throw new \IPS\Task\Queue\OutOfRangeException;
throw new QueueOutOfRangeException;
}
}
catch( OutOfRangeException $e )
{
throw new \IPS\Task\Queue\OutOfRangeException;
throw new QueueOutOfRangeException;
}
$softwareClass = $this->app->getSource( FALSE, FALSE );
@@ -218,7 +225,7 @@ class InvisionCommunityRebuildContent
if( $last === NULL )
{
throw new \IPS\Task\Queue\OutOfRangeException;
throw new QueueOutOfRangeException;
}
/* Return the number rebuilt so far, so that the rebuild progress bar text makes sense */
@@ -251,7 +258,7 @@ class InvisionCommunityRebuildContent
* @param DOMElement $element DOM element
* @return void
*/
public function updateMention( DOMElement $element )
public function updateMention( DOMElement $element ) : void
{
try
{
@@ -272,7 +279,7 @@ class InvisionCommunityRebuildContent
/**
* @brief Mapping of content types to converter lookups - Add more for other apps when we support them
*/
protected $embedLocations = array( 'forums' => array( 'content' => 'forums_topics', 'comment' => 'forums_posts' ) );
protected array $embedLocations = array( 'forums' => array( 'content' => 'forums_topics', 'comment' => 'forums_posts' ) );
/**
* Update local embeds for new names, IDs
@@ -280,7 +287,7 @@ class InvisionCommunityRebuildContent
* @param DOMElement $element DOM element
* @return void
*/
public function updateEmbed( DOMElement $element )
public function updateEmbed( DOMElement $element ) : void
{
try
{
@@ -328,7 +335,7 @@ class InvisionCommunityRebuildContent
* @param DOMElement $element DOM element
* @return void
*/
public function updateQuote( DOMElement $element )
public function updateQuote( DOMElement $element ) : void
{
try
{
@@ -18,10 +18,12 @@ use InvalidArgumentException;
use IPS\Application;
use IPS\convert\App;
use IPS\Data\Store;
use IPS\Extensions\QueueAbstract;
use IPS\IPS;
use IPS\Log;
use IPS\Member;
use IPS\Patterns\ActiveRecordIterator;
use IPS\Task\Queue\OutOfRangeException as QueueOutOfRangeException;
use IPS\Text\LegacyParser;
use OutOfRangeException;
use function defined;
@@ -38,12 +40,12 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
/**
* Background Task
*/
class RebuildContent
class RebuildContent extends QueueAbstract
{
/**
* @brief Number of content items to rebuild per cycle
*/
public $rebuild = REBUILD_SLOW;
public int $rebuild = REBUILD_SLOW;
/**
* Parse data before queuing
@@ -87,8 +89,8 @@ class RebuildContent
*
* @param mixed $data Data as it was passed to \IPS\Task::queue()
* @param int $offset Offset
* @return int|null New offset or NULL if complete
* @throws \IPS\Task\Queue\OutOfRangeException Indicates offset doesn't exist and thus task is complete
* @return int New offset or NULL if complete
* @throws QueueOutOfRangeException Indicates offset doesn't exist and thus task is complete
*/
public function run( mixed &$data, int $offset ): int
{
@@ -96,13 +98,13 @@ class RebuildContent
$exploded = explode( '\\', $classname );
if ( !class_exists( $classname ) or !Application::appIsEnabled( $exploded[1] ) )
{
throw new \IPS\Task\Queue\OutOfRangeException;
throw new QueueOutOfRangeException;
}
/* Make sure there's even content to parse */
if( !isset( $classname::$databaseColumnMap['content'] ) )
{
throw new \IPS\Task\Queue\OutOfRangeException;
throw new QueueOutOfRangeException;
}
/* Intentionally no try/catch as it means app doesn't exist */
@@ -112,7 +114,7 @@ class RebuildContent
}
catch( OutOfRangeException $e )
{
throw new \IPS\Task\Queue\OutOfRangeException;
throw new QueueOutOfRangeException;
}
$softwareClass = $app->getSource( FALSE, FALSE );
@@ -213,7 +215,7 @@ class RebuildContent
}
/* Then pass off to legacy parser to bring up to 4.x */
$item->$contentColumn = LegacyParser::parseStatic( $item->$contentColumn, $member, false, $classname::$application . '_' . IPS::mb_ucfirst( $module ), $id1, $id2, NULL, isset( $classname::$itemClass ) ? $classname::$itemClass : get_class( $item ) );
$item->$contentColumn = LegacyParser::parseStatic( $item->$contentColumn, $member, false, $classname::$application . '_' . IPS::mb_ucfirst( $module ), $id1, $id2, NULL, $classname::$itemClass ?? get_class( $item ) );
}
catch( InvalidArgumentException $e )
{
@@ -242,7 +244,7 @@ class RebuildContent
if( $last === NULL )
{
throw new \IPS\Task\Queue\OutOfRangeException;
throw new QueueOutOfRangeException;
}
/* Return the number rebuilt so far, so that the rebuild progress bar text makes sense */
@@ -15,6 +15,7 @@ namespace IPS\convert\extensions\core\Queue;
use Exception;
use IPS\Db;
use IPS\Extensions\QueueAbstract;
use IPS\Member;
use IPS\Patterns\ActiveRecordIterator;
use IPS\Task\Queue\OutOfRangeException;
@@ -32,7 +33,7 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
/**
* Background Task
*/
class RebuildConversationFirstIds
class RebuildConversationFirstIds extends QueueAbstract
{
/**
* Parse data before queuing
@@ -16,6 +16,7 @@ namespace IPS\convert\extensions\core\Queue;
use Exception;
use IPS\Application;
use IPS\Db;
use IPS\Extensions\QueueAbstract;
use IPS\forums\Topic\ArchivedPost;
use IPS\Member;
use IPS\Patterns\ActiveRecordIterator;
@@ -34,7 +35,7 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
/**
* Background Task
*/
class RebuildFirstPostIds
class RebuildFirstPostIds extends QueueAbstract
{
/**
* Parse data before queuing
@@ -87,7 +88,7 @@ class RebuildFirstPostIds
foreach( new ActiveRecordIterator( Db::i()->select( '*', 'forums_topics', array( "tid>?", $offset ), "tid ASC", array( 0, REBUILD_SLOW ) ), 'IPS\forums\Topic' ) AS $topic )
{
if ( $topic->isArchived() == FALSE )
if ( !$topic->isArchived() )
{
try
{
@@ -19,6 +19,7 @@ use InvalidArgumentException;
use IPS\Application;
use IPS\convert\App;
use IPS\Db;
use IPS\Extensions\QueueAbstract;
use IPS\Member;
use IPS\Patterns\ActiveRecordIterator;
use IPS\Task\Queue\OutOfRangeException;
@@ -34,7 +35,7 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
/**
* Background Task
*/
class RebuildGalleryImages
class RebuildGalleryImages extends QueueAbstract
{
/**
* Parse data before queuing
@@ -68,7 +69,7 @@ class RebuildGalleryImages
*
* @param mixed $data Data as it was passed to \IPS\Task::queue()
* @param int $offset Offset
* @return int|null New offset or NULL if complete
* @return int New offset or NULL if complete
* @throws OutOfRangeException Indicates offset doesn't exist and thus task is complete
*/
public function run( mixed &$data, int $offset ): int
@@ -111,12 +112,7 @@ class RebuildGalleryImages
$image->buildThumbnails();
$image->save();
}
catch( DomainException $e )
{
$image->delete();
}
/* File fails the image type test */
catch( InvalidArgumentException $e )
catch( DomainException | InvalidArgumentException $e )
{
$image->delete();
}
@@ -15,6 +15,7 @@ namespace IPS\convert\extensions\core\Queue;
use IPS\Application;
use IPS\convert\App;
use IPS\Extensions\QueueAbstract;
use IPS\Member;
use IPS\Task\Queue\OutOfRangeException;
use function defined;
@@ -29,12 +30,12 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
/**
* Background Task
*/
class RebuildNonContent
class RebuildNonContent extends QueueAbstract
{
/**
* @brief Number of content items to rebuild per cycle
*/
public $rebuild = REBUILD_SLOW;
public int $rebuild = REBUILD_SLOW;
/**
* Parse data before queuing
@@ -70,12 +71,13 @@ class RebuildNonContent
*
* @param mixed $data Data as it was passed to \IPS\Task::queue()
* @param int $offset Offset
* @return int|null New offset or NULL if complete
* @return int New offset or NULL if complete
* @throws OutOfRangeException Indicates offset doesn't exist and thus task is complete
*/
public function run( array &$data, int $offset ): int
{
foreach( Application::allExtensions( 'core', 'EditorLocations', FALSE, NULL, NULL, TRUE ) as $_key => $extension )
$did = 0;
foreach( Application::allExtensions( 'core', 'EditorLocations', FALSE ) as $_key => $extension )
{
if( $_key != $data['extension'] )
{
@@ -16,6 +16,7 @@ namespace IPS\convert\extensions\core\Queue;
use Exception;
use IPS\convert\App;
use IPS\Db;
use IPS\Extensions\QueueAbstract;
use IPS\File;
use IPS\Member;
use IPS\Task\Queue\OutOfRangeException;
@@ -33,7 +34,7 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
/**
* Background Task
*/
class RebuildProfilePhotos
class RebuildProfilePhotos extends QueueAbstract
{
/**
* Parse data before queuing
@@ -67,7 +68,7 @@ class RebuildProfilePhotos
*
* @param mixed $data Data as it was passed to \IPS\Task::queue()
* @param int $offset Offset
* @return int|null New offset or NULL if complete
* @return int New offset or NULL if complete
* @throws OutOfRangeException Indicates offset doesn't exist and thus task is complete
*/
public function run( mixed &$data, int $offset ): int
@@ -17,9 +17,11 @@ use Exception;
use IPS\Application;
use IPS\convert\App;
use IPS\Db;
use IPS\Extensions\QueueAbstract;
use IPS\IPS;
use IPS\Log;
use IPS\Member;
use IPS\Task\Queue\OutOfRangeException as QueueOutOfRangeException;
use OutOfRangeException;
use function defined;
use function in_array;
@@ -34,7 +36,7 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
/**
* Background Task
*/
class RebuildTagCache
class RebuildTagCache extends QueueAbstract
{
/**
* Parse data before queuing
@@ -75,8 +77,8 @@ class RebuildTagCache
*
* @param mixed $data Data as it was passed to \IPS\Task::queue()
* @param int $offset Offset
* @return int|null New offset or NULL if complete
* @throws \IPS\Task\Queue\OutOfRangeException Indicates offset doesn't exist and thus task is complete
* @return int New offset or NULL if complete
* @throws QueueOutOfRangeException Indicates offset doesn't exist and thus task is complete
*/
public function run( mixed &$data, int $offset ): int
{
@@ -84,7 +86,7 @@ class RebuildTagCache
$exploded = explode( '\\', $classname );
if ( !class_exists( $classname ) or !Application::appIsEnabled( $exploded[1] ) OR !in_array( 'IPS\Content\Taggable', class_implements( $classname ) ) )
{
throw new \IPS\Task\Queue\OutOfRangeException;
throw new QueueOutOfRangeException;
}
/* Intentionally no try/catch as it means app doesn't exist */
@@ -94,7 +96,7 @@ class RebuildTagCache
}
catch( OutOfRangeException $e )
{
throw new \IPS\Task\Queue\OutOfRangeException;
throw new QueueOutOfRangeException;
}
Log::debug( "Running " . $classname . ", with an offset of " . $offset, 'rebuildTagCache' );
@@ -178,7 +180,7 @@ class RebuildTagCache
if( $last === NULL )
{
throw new \IPS\Task\Queue\OutOfRangeException;
throw new QueueOutOfRangeException;
}
/* Return the number rebuilt so far, so that the rebuild progress bar text makes sense */
@@ -16,6 +16,7 @@ namespace IPS\convert\extensions\core\Queue;
use IPS\Application;
use IPS\convert\App;
use IPS\Db;
use IPS\Extensions\QueueAbstract;
use IPS\Member;
use IPS\Task\Queue\OutOfRangeException;
use function defined;
@@ -30,7 +31,7 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
/**
* Background Task
*/
class RecountAnswerRatings
class RecountAnswerRatings extends QueueAbstract
{
/**
* Parse data before queuing
@@ -14,6 +14,7 @@ namespace IPS\convert\extensions\core\Queue;
/* To prevent PHP errors (extending class does not exist) revealing path */
use IPS\Db;
use IPS\Extensions\QueueAbstract;
use IPS\Member;
use IPS\Patterns\ActiveRecordIterator;
use IPS\Task\Queue\OutOfRangeException;
@@ -29,7 +30,7 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
/**
* Background Task
*/
class RecountClubMembers
class RecountClubMembers extends QueueAbstract
{
/**
* Parse data before queuing
@@ -16,6 +16,7 @@ namespace IPS\convert\extensions\core\Queue;
use IPS\Application;
use IPS\convert\App;
use IPS\Db;
use IPS\Extensions\QueueAbstract;
use IPS\Member;
use IPS\Task\Queue\OutOfRangeException;
use function defined;
@@ -30,7 +31,7 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
/**
* Background Task
*/
class RecountQuestionRatings
class RecountQuestionRatings extends QueueAbstract
{
/**
* Parse data before queuing
@@ -39,8 +39,8 @@ use function defined;
use function in_array;
use function is_array;
use function is_bool;
use const IPS\CIC;
use const IPS\CONVERTERS_DEV_UI;
use const IPS\DEMO_MODE;
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
@@ -63,9 +63,9 @@ class convert extends Controller
*
* @return void
*/
public function execute()
public function execute(): void
{
if ( \IPS\CIC )
if ( CIC )
{
Output::i()->error( 'module_no_permission', '2V368/2', 403, '' );
}
@@ -80,7 +80,7 @@ class convert extends Controller
*
* @return void
*/
protected function manage()
protected function manage() : void
{
/* Do we have an id? */
if ( ! isset( Request::i()->id ) )
@@ -193,7 +193,7 @@ class convert extends Controller
* @param bool $count Count database rows
* @return array
*/
public static function getMenuRows( $softwareClass, $filter=TRUE, $return=FALSE, $count=TRUE )
public static function getMenuRows( Software $softwareClass, bool $filter=TRUE, bool $return=FALSE, bool $count=TRUE ) : array
{
$libraryClass = $softwareClass->getLibrary();
@@ -231,7 +231,7 @@ class convert extends Controller
throw $e;
}
Output::i()->error( $e->getMessage(), '1V101/3', 500 );
Output::i()->error( $e->getMessage(), '1V101/3' );
}
return $menuRows;
@@ -243,7 +243,7 @@ class convert extends Controller
* @param App $app Application we are converting
* @return array
*/
protected function _getNextStep( $app )
protected function _getNextStep( App $app ) : array
{
/* Set our variables */
$appId = $app->app_id;
@@ -376,7 +376,7 @@ class convert extends Controller
*
* @return void
*/
protected function emptyData()
protected function emptyData() : void
{
Session::i()->csrfCheck();
@@ -418,7 +418,7 @@ class convert extends Controller
*
* @return void
*/
protected function runStep()
protected function runStep() : void
{
Session::i()->csrfCheck();
@@ -615,7 +615,7 @@ class convert extends Controller
* @param App $app App we are converting
* @return bool
*/
protected function _checkMethodConfiguration( $app )
protected function _checkMethodConfiguration( App $app ) : bool
{
$softwareClass = $app->getSource();
@@ -636,7 +636,7 @@ class convert extends Controller
foreach( $getMoreInfo as $key => $input )
{
$fieldClass = $input['field_class'];
$form->add( new $fieldClass( $key, $input['field_default'], $input['field_required'], $input['field_extra'], isset( $input['field_validation'] ) ? $input['field_validation'] : NULL ) );
$form->add( new $fieldClass( $key, $input['field_default'], $input['field_required'], $input['field_extra'], $input['field_validation'] ?? NULL ) );
if ( $input['field_hint'] !== NULL )
{
$form->addMessage( $input['field_hint'], 'ipsMessage ipsMessage--info' );
@@ -667,7 +667,7 @@ class convert extends Controller
*
* @return void
*/
public function error()
public function error() : void
{
if ( !isset( Request::i()->id ) )
{
@@ -695,7 +695,7 @@ class convert extends Controller
*
* @return void
*/
public function settings()
public function settings() : void
{
if ( !isset( Request::i()->id ) )
{
@@ -747,7 +747,7 @@ class convert extends Controller
*
* @return void
*/
public function finish()
public function finish() : void
{
if ( !isset( Request::i()->id ) )
{
@@ -43,7 +43,7 @@ use function defined;
use function in_array;
use function is_array;
use function is_bool;
use const IPS\DEMO_MODE;
use const IPS\CIC;
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
@@ -66,9 +66,9 @@ class create extends Controller
*
* @return void
*/
public function execute()
public function execute(): void
{
if ( \IPS\CIC )
if ( CIC )
{
Output::i()->error( 'module_no_permission', '2V391/3', 403, '' );
}
@@ -85,7 +85,7 @@ class create extends Controller
*
* @return void
*/
protected function manage()
protected function manage() : void
{
/* We only use the Wizard helper for starting a conversion, so we need to make sure it is always starting new and not using old session data */
Output::i()->title = Member::loggedIn()->language()->addToStack( 'convert_start' );
@@ -105,7 +105,7 @@ class create extends Controller
* @param array $data Wizard data from previous steps
* @return Form|array
*/
public function _chooseSoftware( $data )
public function _chooseSoftware( array $data ) : Form|array
{
$options = array();
foreach( Software::software()['core'] AS $key => $classname )
@@ -133,7 +133,7 @@ class create extends Controller
* @param array $data Wizard data from previous steps
* @return Form|array
*/
public function _chooseApplications( $data )
public function _chooseApplications( array $data ) : Form|array
{
/* Figure out what converter libraries we have for the selected application */
$software = $data['convert_start_source_software'];
@@ -195,7 +195,7 @@ class create extends Controller
* @param array $data Wizard data from previous steps
* @return Form|array
*/
public function _setDatabaseDetails( $data )
public function _setDatabaseDetails( array $data ) : Form|array
{
$form = new Form( 'convert_database_details', 'enter_conversion_details' );
@@ -438,7 +438,7 @@ class create extends Controller
* @param array $data Wizard data from previous steps
* @return Form
*/
public function _setConversionDetails( $data )
public function _setConversionDetails( array $data ) : Form
{
/* We may be coming here from a previously incomplete conversion setup...detect and set the parent app ID appropriately */
if( ( !isset( $data['_app_parent'] ) OR !$data['_app_parent'] ) AND isset( Request::i()->id ) )
@@ -489,7 +489,7 @@ class create extends Controller
* @param Form $form Form object
* @return void
*/
protected function _addConversionApplication( $app, &$form )
protected function _addConversionApplication( App $app, Form $form ) : void
{
$softwareClass = $app->getSource();
$libraryClass = $softwareClass->getLibrary();
@@ -504,7 +504,7 @@ class create extends Controller
}
catch( Exception $e )
{
$form->addMessage( 'nothing_convertable_found', 'ipsMessage ipsMessage--warning', TRUE );
$form->addMessage( 'nothing_convertable_found', 'ipsMessage ipsMessage--warning' );
return;
}
@@ -557,7 +557,7 @@ class create extends Controller
foreach( $getMoreInfo as $key => $input )
{
$fieldClass = $input['field_class'];
$formElements[ $key ] = new $fieldClass( $key, $input['field_default'], $input['field_required'], $input['field_extra'], isset( $input['field_validation'] ) ? $input['field_validation'] : NULL, NULL, NULL, $key );
$formElements[ $key ] = new $fieldClass( $key, $input['field_default'], $input['field_required'], $input['field_extra'], $input['field_validation'] ?? NULL, NULL, NULL, $key );
if ( $input['field_hint'] !== NULL )
{
Member::loggedIn()->language()->words[ $key . '_desc' ] = $input['field_hint'];
@@ -589,7 +589,7 @@ class create extends Controller
/* If there was nothing to convert, show an appropriate message */
if( $softwareClass::canConvertSettings() === FALSE AND !count( $menuRows ) )
{
$form->addMessage( 'nothing_convertable_found', 'ipsMessage ipsMessage--warning', TRUE );
$form->addMessage( 'nothing_convertable_found', 'ipsMessage ipsMessage--warning' );
}
/* If there is a message to show, go ahead and show it */
@@ -39,6 +39,7 @@ use function defined;
use function file_put_contents;
use function get_class;
use function in_array;
use const IPS\CIC;
use const IPS\CONVERTERS_DEV_UI;
use const IPS\DEMO_MODE;
use const IPS\FOLDER_PERMISSION_NO_WRITE;
@@ -64,7 +65,7 @@ class manage extends Controller
*
* @return void
*/
public function execute()
public function execute(): void
{
if ( DEMO_MODE === TRUE )
{
@@ -81,7 +82,7 @@ class manage extends Controller
*
* @return void
*/
protected function manage()
protected function manage() : void
{
/* If mod_rewrite is not enabled, advise the administrator that old URLs will not redirect to the new locations automatically */
if( !Settings::i()->htaccess_mod_rewrite )
@@ -149,6 +150,8 @@ class manage extends Controller
try
{
$classname = get_class( $app->getSource() );
/* @var Software $classname */
return $classname::softwareName();
}
catch( Exception $ex )
@@ -173,7 +176,7 @@ class manage extends Controller
}
);
if( !\IPS\CIC )
if( !CIC )
{
Output::i()->sidebar['actions']['start'] = [
'primary' => true,
@@ -240,12 +243,7 @@ class manage extends Controller
return $return;
}
catch( InvalidArgumentException $e )
{
return array();
}
/* Application has been uninstalled */
catch( OutOfRangeException $e )
catch( InvalidArgumentException | OutOfRangeException $e )
{
return array();
}
@@ -253,7 +251,7 @@ class manage extends Controller
/* Display */
Output::i()->title = Member::loggedIn()->language()->addToStack( 'menu__convert_manage' );
Output::i()->output .= (string) $table;
Output::i()->output .= $table;
}
/**
@@ -261,7 +259,7 @@ class manage extends Controller
*
* @return void
*/
public function software()
public function software() : void
{
if ( \IPS\IN_DEV === FALSE )
{
@@ -322,7 +320,7 @@ class manage extends Controller
*
* @return void
*/
public function library()
public function library() : void
{
if ( \IPS\IN_DEV === FALSE )
{
@@ -383,7 +381,7 @@ class manage extends Controller
*
* @return void
*/
public function edit()
public function edit() : void
{
if ( !isset( Request::i()->id ) )
{
@@ -0,0 +1,22 @@
{
"id": 5000030,
"name": "5.0.0 Beta 4",
"steps": {
"queries": false,
"lang": false,
"theme": false,
"themeeditor": false,
"javascript": false,
"emailTemplates": false,
"acpSearchKeywords": false,
"settings": false,
"tasks": false,
"modules": false,
"widgets": false,
"customOptions": false,
"customRoutines": false
},
"forceMainUpgrader": false,
"forceManualDownloadNoCiC": false,
"forceManualDownloadCiC": false
}
+45 -51
View File
@@ -19,6 +19,7 @@ use Exception;
use InvalidArgumentException;
use IPS\Data\Store;
use IPS\Db;
use IPS\Db\Exception as DbException;
use IPS\Patterns\ActiveRecord;
use IPS\Patterns\ActiveRecordIterator;
use OutOfRangeException;
@@ -66,7 +67,7 @@ class App extends ActiveRecord
/**
* @brief Array Storage of loaded ID links.
*/
protected $linkCache = array();
protected array $linkCache = array();
/**
* @brief Flag to indicate the log is simply a notice, and that it is informational only. Useful for when data is missing, but can be covered via default values.
@@ -88,7 +89,7 @@ class App extends ActiveRecord
*
* @return ActiveRecordIterator
*/
public static function apps()
public static function apps() : ActiveRecordIterator
{
return new ActiveRecordIterator( new ArrayIterator( static::getStore() ), 'IPS\convert\App' );
}
@@ -106,7 +107,7 @@ class App extends ActiveRecord
{
$rows = iterator_to_array( Db::i()->select( '*', 'convert_apps', array(), 'app_id ASC' ) );
}
catch ( \IPS\Db\Exception $e )
catch ( DbException $e )
{
if ( $e->getCode() === 1146 )
{
@@ -172,15 +173,15 @@ class App extends ActiveRecord
/**
* @brief Session data store
*/
protected $_sessionData = null;
protected ?array $_sessionData = null;
/**
* Save Session Data for this application
*
* @param array $value Session Data
* @param array|null $value Session Data
* @return void
*/
public function set__session( $value )
public function set__session( ?array $value ) : void
{
Db::i()->update( 'convert_app_sessions', array( 'session_app_data' => json_encode( $value ) ), array( 'session_app_id=?', $this->app_id ) );
@@ -192,7 +193,7 @@ class App extends ActiveRecord
*
* @return array
*/
public function get__session()
public function get__session() : array
{
/* Use ready-cached session data */
if( $this->_sessionData !== null )
@@ -221,31 +222,28 @@ class App extends ActiveRecord
*
* @return string
*/
public function get_sw()
public function get_sw() : string
{
switch( $this->_data['sw'] )
{
case 'board':
return 'forums';
break;
case 'ccs':
return 'cms';
break;
default:
return $this->_data['sw'];
break;
}
}
/**
* [Legacy] Automatically fix any legacy application keys that have changed.
*
* @param string $value App value
* @param string|null $value App value
* @return void
*/
public function set_sw( $value )
public function set_sw( ?string $value ) : void
{
switch( $value )
{
@@ -266,7 +264,7 @@ class App extends ActiveRecord
/**
* @brief Parent Store
*/
protected $parentStore = NULL;
protected ?App $parentStore = NULL;
/**
* Get parent application
@@ -274,7 +272,7 @@ class App extends ActiveRecord
* @return App
* @throws BadMethodCallException
*/
public function get__parent()
public function get__parent() : App
{
if ( is_null( $this->parentStore ) )
{
@@ -287,11 +285,7 @@ class App extends ActiveRecord
{
$this->parentStore = static::constructFromData( Db::i()->select( '*', 'convert_apps', array( "app_id=?", $this->parent ) )->first() );
}
catch( UnderflowException $e )
{
throw new BadMethodCallException;
}
catch( OutOfRangeException $e )
catch( UnderflowException|OutOfRangeException $e )
{
throw new BadMethodCallException;
}
@@ -305,7 +299,7 @@ class App extends ActiveRecord
*
* @return array|ActiveRecordIterator
*/
public function children()
public function children() : array|ActiveRecordIterator
{
/* If we have a parent, we are already a child and will not have children */
if( $this->parent )
@@ -321,13 +315,13 @@ class App extends ActiveRecord
*
* @param mixed $foreign_id The Foreign ID
* @param string|array $type The type of item, or an array of types to check.
* @param boolean $parent If set to TRUE, then retrieves from the parent application if one is available.
* @param boolean $mainTable If set to TRUE, and the type is of either 'core_message_topics', 'core_message_posts', 'core_message_topic_user_map', 'forums_topics', or 'forums_posts', then the ID is retrieved from convert_link, rather than the other link tables.
* @param bool $parent If set to TRUE, then retrieves from the parent application if one is available.
* @param bool $mainTable If set to TRUE, and the type is of either 'core_message_topics', 'core_message_posts', 'core_message_topic_user_map', 'forums_topics', or 'forums_posts', then the ID is retrieved from convert_link, rather than the other link tables.
*
* @return integer The Invision Community ID.
* @return int The Invision Community ID.
* @throws OutOfRangeException
*/
public function getLink( $foreign_id, $type, $parent=FALSE, $mainTable=FALSE )
public function getLink( mixed $foreign_id, string|array $type, bool $parent=FALSE, bool $mainTable=FALSE ) : int
{
if ( !is_array( $type ) )
{
@@ -393,7 +387,7 @@ class App extends ActiveRecord
/**
* @brief Sibling Link Cache
*/
protected $siblingLinkCache = array();
protected array $siblingLinkCache = array();
/**
* Retrieves an Invision Community iD from a Foriegn ID in a Sibling Application
@@ -401,12 +395,12 @@ class App extends ActiveRecord
* @param mixed $foreign_id The Foreign ID.
* @param string $type The type of item.
* @param string $sibling The sibling software library.
* @param boolean $mainTable If set to TRUE, and the type is of either 'core_message_topics', 'core_message_posts', 'core_message_topic_user_map', 'forums_topics', or 'forums_posts', then the ID is retrieved from convert_link, rather than the other link tables.
* @param bool $mainTable If set to TRUE, and the type is of either 'core_message_topics', 'core_message_posts', 'core_message_topic_user_map', 'forums_topics', or 'forums_posts', then the ID is retrieved from convert_link, rather than the other link tables.
*
* @return inteer The Invision Community ID.
* @return int The Invision Community ID.
* @throws OutOfRangeException
*/
public function getSiblingLink( $foreign_id, $type, $sibling, $mainTable=FALSE )
public function getSiblingLink( mixed $foreign_id, string $type, string $sibling, bool $mainTable=FALSE ) : int
{
if ( isset( $this->siblingLinkCache[$type][$sibling][$foreign_id] ) )
{
@@ -428,14 +422,14 @@ class App extends ActiveRecord
/**
* Saves a foreign ID to Invision Community ID reference to the convert_link tables.
*
* @param integer $ips_id The Invision Community ID
* @param int $ips_id The Invision Community ID
* @param mixed $foreign_id The Foreign ID
* @param string $type The type of item
* @param boolean $duplicate If TRUE, then this item is a duplicate and was merged into existing $ips_id
* @param boolean $mainTable If TRUE, then link will be stored in the main convert_link table even if $type is 'core_message_topics', 'core_message_posts', 'core_message_topic_user_map', 'forums_topics', or 'forums_posts'
* @param bool $duplicate If TRUE, then this item is a duplicate and was merged into existing $ips_id
* @param bool $mainTable If TRUE, then link will be stored in the main convert_link table even if $type is 'core_message_topics', 'core_message_posts', 'core_message_topic_user_map', 'forums_topics', or 'forums_posts'
* @return void
*/
public function addLink( $ips_id, $foreign_id, $type, $duplicate=FALSE, $mainTable=FALSE )
public function addLink( int $ips_id, mixed $foreign_id, string $type, bool $duplicate=FALSE, bool $mainTable=FALSE ) : void
{
$table = 'convert_link';
@@ -468,8 +462,9 @@ class App extends ActiveRecord
*
* @param array $data
* @param array $map
* @return void
*/
public function preCacheLinks( array $data, array $map )
public function preCacheLinks( array $data, array $map ) : void
{
$cachesToLookup = [];
$tables = [];
@@ -536,13 +531,13 @@ class App extends ActiveRecord
/**
* Checks to see if a link exists for an Invision Community ID
*
* @param integer $ips_id The Invision Community ID.
* @param int $ips_id The Invision Community ID.
* @param string $type The type of item
* @param bool $mainTable If TRUE, then link will be check against the main convert_link table even if $type is 'core_message_topics', 'core_message_posts', 'core_message_topic_user_map', 'forums_topics', or 'forums_posts'
* @return void
* @throws OutOfRangeException
*/
public function checkLink( $ips_id, $type, $mainTable=FALSE )
public function checkLink( int $ips_id, string $type, bool $mainTable=FALSE ) : void
{
$table = $this->_getLinkTableName( $type, $mainTable );
@@ -563,7 +558,7 @@ class App extends ActiveRecord
* @return void
* @throws OutOfRangeException
*/
public function checkForSibling( $software )
public function checkForSibling( string $software ) : void
{
try
{
@@ -582,7 +577,7 @@ class App extends ActiveRecord
* @param string $type The type of item
* @return void
*/
public function deleteLink( $foreignId, string $type )
public function deleteLink( mixed $foreignId, string $type ) : void
{
$table = $this->_getLinkTableName( $type );
@@ -598,7 +593,7 @@ class App extends ActiveRecord
/**
* @brief Sibling Cache
*/
protected $siblingCache = array();
protected array $siblingCache = array();
/**
* Construct an \IPS\convert\App object for a sibling application.
@@ -607,7 +602,7 @@ class App extends ActiveRecord
* @return App
* @throws OutOfRangeException
*/
public function getSibling( $software )
public function getSibling( string $software ) : App
{
if ( !isset( $this->siblingCache[$software] ) )
{
@@ -632,14 +627,13 @@ class App extends ActiveRecord
* @return Software|string
* @throws InvalidArgumentException
*/
public function getSource( $construct=TRUE, $needDB=TRUE )
public function getSource( bool $construct=TRUE, bool $needDB=TRUE ) : Software|string
{
/* Update software keys for communities converted to 3.x */
switch( $this->_data['sw'] )
{
case 'board':
case 'ccs':
$this->sw = $this->sw;
$this->save();
break;
}
@@ -717,12 +711,12 @@ class App extends ActiveRecord
*
* @param string $message The message to log.
* @param string $method The current conversion method (convert_posts, convert_topics, etc.)
* @param integer $severity The severity level of the log. Default to LOG_NOTICE
* @param int $severity The severity level of the log. Default to LOG_NOTICE
* @param int|NULL $id The item ID
* @return void
* @throws InvalidArgumentException
*/
public function log( $message, $method, $severity=1, $id=NULL )
public function log( string $message, string $method, int $severity=1, ?int $id=NULL ) : void
{
if ( ! in_array( $severity, array( static::LOG_NOTICE, static::LOG_WARNING, static::LOG_ERROR ) ) )
{
@@ -743,9 +737,9 @@ class App extends ActiveRecord
* Callback function to return all dependencies not yet converted.
*
* @param string $value Value from depency array
* @return boolean
* @return bool
*/
public function dependencies( $value )
public function dependencies( string $value ) : bool
{
if ( !in_array( $value, $this->_session['completed'] ) )
{
@@ -762,7 +756,7 @@ class App extends ActiveRecord
* @param array $values Values from the form.
* @return void
*/
public function saveMoreInfo( $method, $values=array() )
public function saveMoreInfo( string $method, array $values=array() ) : void
{
$sessionData = $this->_session;
@@ -777,7 +771,7 @@ class App extends ActiveRecord
* @param mixed $key key
* @return bool
*/
public function __isset( $key )
public function __isset( mixed $key ) : bool
{
if ( method_exists( $this, 'get_' . $key ) )
{
@@ -799,9 +793,9 @@ class App extends ActiveRecord
* @param bool $status Flag status
* @return void
*/
public function setRunningFlag( $method, $status )
public function setRunningFlag( string $method, bool $status ) : void
{
$running = isset( $this->_session['running'] ) ? $this->_session['running'] : array();
$running = $this->_session['running'] ?? array();
/* If setting running flag, set to a timestamp */
if( $status === TRUE )
@@ -820,7 +814,7 @@ class App extends ActiveRecord
* @param string $method Method name
* @return bool|int False or a timestamp
*/
public function getRunningFlag( $method )
public function getRunningFlag( string $method ) : bool|int
{
if( isset( $this->_session['running'][ $method ] ) )
{
@@ -45,7 +45,7 @@ class Reactionmapper extends FormAbstract
public function html() : string
{
/* Setup our local reaction descriptions and options */
foreach( Content\Reaction::getStore() as $ipsReaction )
foreach( Reaction::getStore() as $ipsReaction )
{
$this->options['options'][ $ipsReaction['reaction_id'] ] = (string) File::get( 'core_Reaction', $ipsReaction['reaction_icon'] )->url;
$this->options['descriptions'][ $ipsReaction['reaction_id'] ] = Member::loggedIn()->language()->addToStack('reaction_title_' . $ipsReaction['reaction_id'] );
@@ -76,9 +76,7 @@ class Reactionmapper extends FormAbstract
public function getValue(): mixed
{
$name = $this->name;
$value = Request::i()->$name;
return $value;
return Request::i()->$name;
}
/**
+41 -50
View File
@@ -15,6 +15,7 @@ namespace IPS\convert;
use ErrorException;
use Exception;
use IPS\convert\Software\Exception as SoftwareException;
use IPS\Db;
use IPS\Db\Select;
use IPS\forums\Topic\ArchivedPost;
@@ -43,37 +44,37 @@ abstract class Library
/**
* @brief Flag to indicate that we are using a specific key, and should do WHERE static::$currentKeyName > static::$currentKeyValue rather than LIMIT 0,1000
*/
public static $usingKeys = FALSE;
public static bool $usingKeys = FALSE;
/**
* @brief The name of the current key in the database for this step
*/
public static $currentKeyName = NULL;
public static ?string $currentKeyName = NULL;
/**
* @brief The current value of the key
*/
public static $currentKeyValue = 0;
public static ?int $currentKeyValue = 0;
/**
* @brief Amount of data being processed per cycle.
*/
public static $perCycle = 2000;
public static int $perCycle = 2000;
/**
* @brief If not using keys, the current start value for LIMIT clause.
*/
public static $startValue = 0;
public static int $startValue = 0;
/**
* @brief The current conversion step
*/
public static $action = NULL;
public static ?string $action = NULL;
/**
* @brief \IPS\convert\Software instance for the software we are converting from
*/
public $software = NULL;
public ?Software $software = NULL;
/**
* @brief Obscure filenames?
@@ -81,12 +82,12 @@ abstract class Library
* This is only referenced in certain content types that may be referenced in already parsed data such as attachments and emoticons
* - Designed for use with the Invision Community converter.
*/
public static $obscureFilenames = TRUE;
public static bool $obscureFilenames = TRUE;
/**
* @brief Array of field types
*/
protected static $fieldTypes = array( 'Address', 'Checkbox', 'CheckboxSet', 'Codemirror', 'Color', 'Date', 'Editor', 'Email', 'Item', 'Member', 'Number', 'Password', 'Poll', 'Radio', 'Rating', 'Select', 'Tel', 'Text', 'TextArea', 'Upload', 'Url', 'YesNo' );
protected static array $fieldTypes = array( 'Address', 'Checkbox', 'CheckboxSet', 'Codemirror', 'Color', 'Date', 'Editor', 'Email', 'Item', 'Member', 'Number', 'Password', 'Poll', 'Radio', 'Rating', 'Select', 'Tel', 'Text', 'TextArea', 'Upload', 'Url', 'YesNo' );
/**
* Constructor
@@ -104,7 +105,7 @@ abstract class Library
*
* @return array
*/
public static function libraries()
public static function libraries() : array
{
return array(
'core' => 'IPS\convert\Library\Core',
@@ -124,7 +125,7 @@ abstract class Library
* @param string $key The key to use
* @return void
*/
public static function setKey( $key )
public static function setKey( string $key ) : void
{
static::$usingKeys = TRUE;
static::$currentKeyName = $key;
@@ -136,7 +137,7 @@ abstract class Library
* @param mixed $value The current value
* @return void
*/
public function setLastKeyValue( $value )
public function setLastKeyValue( mixed $value ) : void
{
$_SESSION['currentKeyValue'] = $value;
static::$currentKeyValue = $value;
@@ -150,7 +151,7 @@ abstract class Library
* @param int|NULL $perCycle The number of results to process per cycle
* @return array|NULL Data for the MultipleRedirect
*/
public function process( $data, $method, $perCycle=NULL )
public function process( int $data, string $method, ?int $perCycle=NULL ) : ?array
{
if ( !is_null( $perCycle ) )
{
@@ -250,7 +251,7 @@ abstract class Library
}
catch( UnderflowException $e )
{
// Nothing has been ran yet
// Nothing has been run yet
$lastId = 0;
}
@@ -276,7 +277,7 @@ abstract class Library
if( $this->software->app->getRunningFlag( $method ) )
{
/* Count how many times we've seen this */
$_SESSION['convertSkipped'] = ( isset( $_SESSION['convertSkipped'] ) ? $_SESSION['convertSkipped'] : 0 ) + 1;
$_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 ))
@@ -301,7 +302,7 @@ abstract class Library
{
$this->software->$method();
}
catch( \IPS\convert\Software\Exception $e )
catch( SoftwareException $e )
{
/* A Software Exception indicates we are done */
$completed = $this->software->app->_session['completed'];
@@ -332,16 +333,6 @@ abstract class Library
$this->software->app->log( $e->getMessage(), __METHOD__, App::LOG_WARNING );
throw new Exception;
}
catch( ErrorException $e )
{
Log::log( $e, 'converters' );
/* Clear the running flag */
$this->software->app->setRunningFlag( $method, FALSE );
$this->software->app->log( $e->getMessage(), __METHOD__, App::LOG_WARNING );
throw new Exception;
}
/* Manually set running flag to save write queries */
$running = $this->software->app->_session['running'];
@@ -360,7 +351,7 @@ abstract class Library
* @param int $add Amount to add to completed count
* @return int
*/
protected function _getConvertedCount( $add = 0 )
protected function _getConvertedCount( int $add = 0 ) : int
{
if( $this->software->app->parent )
{
@@ -403,11 +394,11 @@ abstract class Library
/**
* Empty Conversion Data
*
* @param integer $data Data from the previous step.
* @param App $method The conversion method to empty results for
* @param int $data Data from the previous step.
* @param string $method The conversion method to empty results for
* @return array|NULL Data for the MultipleRedirect
*/
public function emptyData( $data, $method )
public function emptyData( int $data, string $method ) : ?array
{
$perCycle = 500;
@@ -491,17 +482,10 @@ abstract class Library
if ( isset( $def['indexes']['PRIMARY']['columns'] ) )
{
$id = array_pop( $def['indexes']['PRIMARY']['columns'] );
Db::i()->delete( $type, array( Db::i()->in( $id, array_values( $rows ) ) ) );
}
Db::i()->delete( $type, array( Db::i()->in( $id, array_values( $rows ) ) ) );
Db::i()->delete( $table, array( Db::i()->in( 'link_id', array_keys( $rows ) ) ) );
}
catch( Exception $e )
{
Log::log( $e, 'converters' );
$this->software->app->log( $e->getMessage(), __METHOD__, App::LOG_WARNING );
throw new Exception;
Db::i()->delete( $table, array( Db::i()->in( 'link_id', array_keys( $rows ) ) ) );
}
catch( ErrorException $e )
{
@@ -510,6 +494,13 @@ abstract class Library
$this->software->app->log( $e->getMessage(), __METHOD__, App::LOG_ERROR );
throw new Exception;
}
catch( Exception $e )
{
Log::log( $e, 'converters' );
$this->software->app->log( $e->getMessage(), __METHOD__, App::LOG_WARNING );
throw new Exception;
}
return array( $data + $perCycle, sprintf( Member::loggedIn()->language()->get( 'removed_x_of_x' ), ( $data + $perCycle > $total ) ? $_SESSION['emptyConvertedDataCount'] : $data + $perCycle, Member::loggedIn()->language()->addToStack( $method ), $_SESSION['emptyConvertedDataCount'] ), 100 / $_SESSION['emptyConvertedDataCount'] * ( $data + $perCycle ) );
}
@@ -521,7 +512,7 @@ abstract class Library
* @param string $method Convert method to run truncate call for
* @return void
*/
public function emptyLocalData( $method )
public function emptyLocalData( string $method ) : void
{
$truncate = $this->truncate( $method );
@@ -613,14 +604,14 @@ abstract class Library
/**
* @brief Cached convertable items
*/
protected $convertable = NULL;
protected ?array $convertable = NULL;
/**
* Return the items we can convert. Removes things that are empty.
*
* @return array
*/
public function getConvertableItems()
public function getConvertableItems() : array
{
if( $this->convertable !== NULL )
{
@@ -653,7 +644,7 @@ abstract class Library
* @param mixed $arguments Arguments to pass to the method
* @return mixed
*/
public function __call( $name, $arguments )
public function __call( string $name, mixed $arguments )
{
if ( method_exists( $this, 'convert' . $name ) )
{
@@ -676,7 +667,7 @@ abstract class Library
*
* @return string
*/
public function getPostConversionInformation()
public function getPostConversionInformation() : string
{
return '';
}
@@ -705,7 +696,7 @@ abstract class Library
* @param bool $rowCounts enable row counts
* @return array
*/
abstract public function menuRows( $rowCounts=FALSE );
abstract public function menuRows( bool $rowCounts=FALSE ) : array;
/**
* Utility method to run queries for menuRows() data
@@ -717,7 +708,7 @@ abstract class Library
* @throws UnderflowException
* @throws Exception
*/
public function getDatabaseRowCounts( array $return, $ips=TRUE, $source=TRUE )
public function getDatabaseRowCounts( array $return, bool $ips=TRUE, bool $source=TRUE ) : array
{
foreach( $return as $key => $value )
{
@@ -738,7 +729,7 @@ abstract class Library
/**
* @brief Cache menu row data
*/
protected $_menuRowCache = array( 'rows' => array(), 'noRows' => array() );
protected array $_menuRowCache = array( 'rows' => array(), 'noRows' => array() );
/**
* Get method from menu rows - abstracted to allow 'fake' entries not in menuRows()
@@ -747,7 +738,7 @@ abstract class Library
* @param bool $rowCount Count local rows
* @return array
*/
public function getMethodFromMenuRows( $method, $rowCount=FALSE )
public function getMethodFromMenuRows( string $method, bool $rowCount=FALSE ) : array
{
$key = $rowCount ? 'rows' : 'noRows';
if( isset( $this->_menuRowCache[ $key ][ $method ] ) )
@@ -755,7 +746,7 @@ abstract class Library
return $this->_menuRowCache[ $key ][ $method ];
}
/* Set to to the cache */
/* Set to the cache */
$this->_menuRowCache[ $key ] = $this->menuRows( $rowCount );
/* Cache an empty array for the response */
@@ -773,5 +764,5 @@ abstract class Library
* @param string $method The method to truncate
* @return array
*/
abstract protected function truncate( $method );
abstract protected function truncate( string $method ) : array;
}
+37 -49
View File
@@ -17,6 +17,7 @@ use ErrorException;
use Exception;
use IPS\blog\Blog as BlogClass;
use IPS\convert\App;
use IPS\convert\Software;
use IPS\DateTime;
use IPS\Db;
use IPS\File;
@@ -48,7 +49,7 @@ class Blog extends Core
/**
* @brief Application
*/
public $app = 'blog';
public string $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
@@ -56,7 +57,7 @@ class Blog extends Core
* @param bool $rowCounts enable row counts
* @return array
*/
public function menuRows( $rowCounts=FALSE )
public function menuRows( bool $rowCounts=FALSE ): array
{
$return = array();
$extraRows = $this->software->extraMenuRows();
@@ -213,11 +214,12 @@ class Blog extends Core
* @param string $method Method we are truncating
* @return array
*/
protected function truncate( $method )
protected function truncate( string $method ) : array
{
$return = array();
$classname = get_class( $this->software );
/* @var Software $classname */
if( $classname::canConvert() === NULL )
{
return array();
@@ -253,8 +255,7 @@ class Blog extends Core
break;
case 'convertAttachments':
$return['convertAttachments'] = array(
'core_attachments' => Db::i()->in( 'attach_id', (string) Db::i()->select( 'attachment_id', 'core_attachments_map', array( "location_key=?", 'blog_Entries' ) ) ),
$return['convertAttachments'] = array( 'core_attachments' => array( 'attach_id IN ( ' . Db::i()->select( 'attachment_id', 'core_attachments_map', array( "location_key=?", 'blog_Entries' ) ) . ')' ),
'core_attachments_map' => array( "location_key=?", 'blog_Entries' )
);
break;
@@ -264,11 +265,11 @@ class Blog extends Core
break;
case 'convertClubBlogEntries':
$return['convertClubBlogEntries'] = array( 'blog_entries' => array( 'entry_id IN ( ' . (string) Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_blog_entries' AND app={$this->software->app->app_id}" ) ) . ')' ) );
$return['convertClubBlogEntries'] = array( 'blog_entries' => array( 'entry_id IN ( ' . Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_blog_entries' AND app={$this->software->app->app_id}" ) ) . ')' ) );
break;
case 'convertClubBlogComments':
$return['convertClubBlogComments'] = array( 'blog_comments' => array( 'comment_id IN ( ' . (string) Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_blog_comments' AND app={$this->software->app->app_id}" ) ) . ')' ) );
$return['convertClubBlogComments'] = array( 'blog_comments' => array( 'comment_id IN ( ' . Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_blog_comments' AND app={$this->software->app->app_id}" ) ) . ')' ) );
break;
}
}
@@ -295,11 +296,11 @@ class Blog extends Core
*
* @param array $info Array of blog information
* @param array|NULL $socialgroup Array of data to be stored in core_sys_social_groups and core_sys_social_group_members
* @param string|NULL|boolean $filepath URL/Path to cover photo, NULL to use raw file data, or FALSE to not convert
* @param string|NULL|bool $filepath URL/Path to cover photo, NULL to use raw file data, or FALSE to not convert
* @param string|NULL $filedata If $filepath is NULL, this should contain the raw contents of the cover photo
* @return integer|boolean The ID of the inserted blog, or FALSE on failure.
* @return int|bool The ID of the inserted blog, or FALSE on failure.
*/
public function convertBlog( array $info, $socialgroup=NULL, $filepath=FALSE, $filedata=NULL )
public function convertBlog( array $info, ?array $socialgroup=NULL, string|null|bool $filepath=FALSE, ?string $filedata=NULL ) : bool|int
{
if ( !isset( $info['blog_id'] ) )
{
@@ -497,7 +498,7 @@ class Blog extends Core
/* Well update this later if we need too */
$info['blog_social_group'] = NULL;
if ( !is_null( $socialgroup ) AND is_array( $socialgroup ) )
if ( is_array( $socialgroup ) )
{
$socialGroupId = Db::i()->insert( 'core_sys_social_groups', array( 'owner_id' => $info['blog_member_id'] ) );
$members = array();
@@ -532,12 +533,7 @@ class Blog extends Core
$info['blog_cover_photo'] = (string) $file;
$info['blog_cover_photo_offset'] = 0;
}
catch( Exception $e )
{
$info['blog_cover_photo'] = NULL;
$info['blog_cover_photo_offset'] = NULL;
}
catch( ErrorException $e )
catch( Exception|ErrorException $e )
{
$info['blog_cover_photo'] = NULL;
$info['blog_cover_photo_offset'] = NULL;
@@ -609,9 +605,9 @@ class Blog extends Core
* Convert a Blog Category
*
* @param array $info Array of blog information
* @return integer|boolean The ID of the inserted category, or FALSE on failure.
* @return int|bool The ID of the inserted category, or FALSE on failure.
*/
public function convertBlogCategory( array $info )
public function convertBlogCategory( array $info ) : bool|int
{
if ( !isset( $info['category_id'] ) )
{
@@ -693,9 +689,9 @@ class Blog extends Core
* @param array $info Array of entry information
* @param string|NULL $filepath Path to the Cover Photo, or NULL
* @param string|NULL $filedata Binary data for cover photo, or NULL
* @return integer|boolean The ID of the inserted entry, or FALSE on failure
* @return int|bool The ID of the inserted entry, or FALSE on failure
*/
public function convertBlogEntry( array $info, $filepath=NULL, $filedata=NULL )
public function convertBlogEntry( array $info, ?string $filepath=NULL, ?string $filedata=NULL ) : bool|int
{
if ( !isset( $info['entry_id'] ) )
{
@@ -953,9 +949,9 @@ class Blog extends Core
* Convert a Blog Entry Category
*
* @param array $info Array of blog information
* @return integer|boolean The ID of the inserted category, or FALSE on failure.
* @return int|bool The ID of the inserted category, or FALSE on failure.
*/
public function convertBlogEntryCategory( array $info )
public function convertBlogEntryCategory( array $info ) : bool|int
{
if ( !isset( $info['entry_category_id'] ) )
{
@@ -969,19 +965,11 @@ class Blog extends Core
return FALSE;
}
if ( isset( $info['entry_category_blog_id'] ) )
try
{
try
{
$info['entry_category_blog_id'] = $this->software->app->getLink( $info['entry_category_blog_id'], 'blog_blogs' );
}
catch( OutOfRangeException $e )
{
$this->software->app->log( 'blog_entry_category_missing_blog_id', __METHOD__, App::LOG_WARNING, $info['entry_category_id'] );
return FALSE;
}
$info['entry_category_blog_id'] = $this->software->app->getLink( $info['entry_category_blog_id'], 'blog_blogs' );
}
else
catch( OutOfRangeException $e )
{
$this->software->app->log( 'blog_entry_category_missing_blog_id', __METHOD__, App::LOG_WARNING, $info['entry_category_id'] );
return FALSE;
@@ -1027,9 +1015,9 @@ class Blog extends Core
* Convert a blog comment
*
* @param array $info Array of comment information
* @return integer|boolean The ID of the inserted comment, or FALSE on failure.
* @return int|bool The ID of the inserted comment, or FALSE on failure.
*/
public function convertBlogComment( array $info )
public function convertBlogComment( array $info ) : bool|int
{
if ( !isset( $info['comment_id'] ) )
{
@@ -1148,9 +1136,9 @@ class Blog extends Core
* Convert a blog RSS import
*
* @param array $info Array of RSS Import information
* @return integer|boolean The ID of the inserted RSS import, or FALSE on failure
* @return int|bool The ID of the inserted RSS import, or FALSE on failure
*/
public function convertBlogRssImport( array $info )
public function convertBlogRssImport( array $info ) : bool|int
{
$info['rss_import_class'] = 'IPS\\blogs\\Entry';
@@ -1165,13 +1153,13 @@ class Blog extends Core
* @param string|NULL $filepath URL/Path to attachment or NULL to use raw file data
* @param string|NULL $filedata If $filepath is NULL, this should contain the raw contents of the attachment
* @param string|NULL $thumbnailpath Path to thumbnail, or NULL
* @return integer|boolean The ID of the inserted attachment, or FALSE on failure.
* @return int|bool The ID of the inserted attachment, or FALSE on failure.
*/
public function convertAttachment( $info=array(), $map=array(), $filepath = NULL, $filedata = NULL, $thumbnailpath = NULL )
public function convertAttachment( array $info=array(), array $map=array(), ?string $filepath = NULL, ?string $filedata = NULL, ?string $thumbnailpath = NULL ) : bool|int
{
$map['id1_type'] = 'blog_entries';
$map['id1_from_parent'] = FALSE;
if ( !isset( $map['id2'] ) OR is_null( $map['id2'] ) )
if ( !isset( $map['id2'] ) OR empty( $map['id2'] ) )
{
$map['location_key'] = 'blog_Entries';
}
@@ -1194,9 +1182,9 @@ class Blog extends Core
* Convert Club Blog
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly insertd blog, or FALSE on failure.
* @return int|bool The ID of the newly insertd blog, or FALSE on failure.
*/
public function convertClubBlog( $info=array() )
public function convertClubBlog( array $info=array() ) : bool|int
{
$insertedId = $this->convertBlog( $info );
if ( $insertedId )
@@ -1210,9 +1198,9 @@ class Blog extends Core
* Convert a Club Blog Entry
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted entry, or FALSE on failure.
* @return int|bool The ID of the newly inserted entry, or FALSE on failure.
*/
public function convertClubBlogEntry( $info=array() )
public function convertClubBlogEntry( array $info=array() ) : bool|int
{
$insertedId = $this->convertBlogEntry( $info );
if ( $insertedId )
@@ -1226,9 +1214,9 @@ class Blog extends Core
* Convert a Club Blog Comment
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted comment, or FALSE on failure.
* @return int|bool The ID of the newly inserted comment, or FALSE on failure.
*/
public function convertClubBlogComment( $info=array() )
public function convertClubBlogComment( array $info=array() ) : bool|int
{
$insertedId = $this->convertBlogComment( $info );
if ( $insertedId )
@@ -1241,9 +1229,9 @@ class Blog extends Core
/**
* Get Parent ID for Orphaned Blogs
*
* @return integer The ID of the forum created for forums that do not have a parent forum.
* @return int The ID of the forum created for forums that do not have a parent forum.
*/
protected function _getOrphanedBlogCategory()
protected function _getOrphanedBlogCategory() : int
{
try
{
@@ -19,6 +19,7 @@ use IPS\calendar\Calendar as CalendarClass;
use IPS\calendar\Date;
use IPS\calendar\Icalendar\ICSParser;
use IPS\convert\App;
use IPS\convert\Software;
use IPS\DateTime;
use IPS\Db;
use IPS\File;
@@ -50,7 +51,7 @@ class Calendar extends Core
/**
* @brief Application
*/
public $app = 'calendar';
public string $app = 'calendar';
/**
* 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
@@ -58,7 +59,7 @@ class Calendar extends Core
* @param bool $rowCounts enable row counts
* @return array
*/
public function menuRows( $rowCounts=FALSE )
public function menuRows( bool $rowCounts=FALSE ) : array
{
$return = array();
$extraRows = $this->software->extraMenuRows();
@@ -204,11 +205,12 @@ class Calendar extends Core
* @param string $method Method to truncate
* @return array
*/
protected function truncate( $method )
protected function truncate( string $method ) : array
{
$return = array();
$classname = get_class( $this->software );
/* @var Software $classname */
if( $classname::canConvert() === NULL )
{
return array();
@@ -285,9 +287,9 @@ class Calendar extends Core
* Convert a Calendar
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted calendar, or FALSE on failure.
* @return int|bool The ID of the newly inserted calendar, or FALSE on failure.
*/
public function convertCalendar( $info=array() )
public function convertCalendar( array $info=array() ) : bool|int
{
if ( !isset( $info['cal_id'] ) )
{
@@ -340,7 +342,7 @@ class Calendar extends Core
if ( !isset( $info['cal_color'] ) )
{
$genericCalendar = new Calendar;
$genericCalendar = new CalendarClass;
$info['cal_color'] = $genericCalendar->_generateColor();
}
@@ -392,9 +394,9 @@ class Calendar extends Core
* @param array $info Data to insert
* @param string|NULL $filepath Path to the event cover photo, or NULL.
* @param string|NULL $filedata Cover photo binary data, or NULL
* @return integer|boolean The ID of the newly inserted event, or FALSE on failure.
* @return int|bool The ID of the newly inserted event, or FALSE on failure.
*/
public function convertCalendarEvent( $info=array(), $filepath=NULL, $filedata=NULL )
public function convertCalendarEvent( array $info=array(), ?string $filepath=NULL, ?string $filedata=NULL ) : bool|int
{
if ( !isset( $info['event_id'] ) )
{
@@ -532,7 +534,7 @@ class Calendar extends Core
}
else if ( $info['event_start_date'] instanceof DateTime )
{
$info['event_start_date'] = Date::create( (string) $info['event_start_date'] )->mysqlDatetime();
$info['event_start_date'] = Date::ts( $info['event_start_date']->getTimestamp() )->mysqlDatetime();
}
}
else
@@ -549,7 +551,7 @@ class Calendar extends Core
}
else if ( $info['event_end_date'] instanceof DateTime )
{
$info['event_end_date'] = Date::create( (string) $info['event_end_date'] )->mysqlDatetime();
$info['event_end_date'] = Date::ts( $info['event_end_date']->getTimestamp() )->mySqlDatetime();
}
}
else
@@ -626,7 +628,7 @@ class Calendar extends Core
{
if ( is_array( $info['event_location'] ) AND isset( $info['event_location']['lat'] ) AND isset( $info['event_location']['long'] ) )
{
$info['event_location'] = (string) GeoLocation::getFromLatLong( $info['event_location']['lat'], $info['event_location']['long'] );
$info['event_location'] = (string) GeoLocation::getByLatLong( $info['event_location']['lat'], $info['event_location']['long'] );
}
else if ( $info['event_location'] instanceof GeoLocation )
{
@@ -671,11 +673,7 @@ class Calendar extends Core
$file = File::create( 'calendar_Events', $info['event_cover_photo'], $filedata );
$info['event_cover_photo'] = (string) $file;
}
catch( Exception $e )
{
$info['event_cover_photo'] = NULL;
}
catch( ErrorException $e )
catch( Exception|ErrorException $e )
{
$info['event_cover_photo'] = NULL;
}
@@ -725,9 +723,9 @@ class Calendar extends Core
* Convert a comment
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted comment, or FALSE on failure.
* @return int|bool The ID of the newly inserted comment, or FALSE on failure.
*/
public function convertCalendarComment( $info=array() )
public function convertCalendarComment( array $info=array() ) : bool|int
{
if ( !isset( $info['comment_id'] ) )
{
@@ -846,9 +844,9 @@ class Calendar extends Core
* Convert a review
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted review, or FALSE on failure.
* @return int|bool The ID of the newly inserted review, or FALSE on failure.
*/
public function convertCalendarReview( $info=array() )
public function convertCalendarReview( array $info=array() ) : bool|int
{
if ( !isset( $info['review_id'] ) )
{
@@ -1049,9 +1047,9 @@ class Calendar extends Core
* Convert an RSVP
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted RSVP, or FALSE on failure.
* @return int|bool The ID of the newly inserted RSVP, or FALSE on failure.
*/
public function convertCalendarRsvp( $info=array() )
public function convertCalendarRsvp( array $info=array() ) : bool|int
{
$hasId = TRUE;
if ( !isset( $info['rsvp_id'] ) )
@@ -1133,9 +1131,9 @@ class Calendar extends Core
* Convert a Calendar Import Feed
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted feed, or FALSE on failure.
* @return int|bool The ID of the newly inserted feed, or FALSE on failure.
*/
public function convertCalendarFeed( $info=array() )
public function convertCalendarFeed( array $info=array() ) : bool|int
{
if ( !isset( $info['feed_id'] ) )
{
@@ -1245,9 +1243,9 @@ class Calendar extends Core
* Convert a Calendar Venue
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted venue, or FALSE on failure.
* @return int|bool The ID of the newly inserted venue, or FALSE on failure.
*/
public function convertCalendarVenue( $info=array() )
public function convertCalendarVenue( array $info=array() ) : bool|int
{
if ( !isset( $info['venue_id'] ) )
{
@@ -1270,7 +1268,7 @@ class Calendar extends Core
{
if ( is_array( $info['venue_address'] ) AND isset( $info['venue_address']['lat'] ) AND isset( $info['venue_address']['long'] ) )
{
$info['venue_address'] = (string) GeoLocation::getFromLatLong( $info['venue_address']['lat'], $info['venue_address']['long'] );
$info['venue_address'] = (string) GeoLocation::getByLatLong( $info['venue_address']['lat'], $info['venue_address']['long'] );
}
else if ( $info['venue_address'] instanceof GeoLocation )
{
@@ -1307,9 +1305,9 @@ class Calendar extends Core
* Convert a Calendar Event Reminder
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted reminder, or FALSE on failure.
* @return int|bool The ID of the newly inserted reminder, or FALSE on failure.
*/
public function convertCalendarReminder( $info=array() )
public function convertCalendarReminder( array $info=array() ) : bool|int
{
if ( !isset( $info['reminder_id'] ) )
{
@@ -1387,9 +1385,9 @@ class Calendar extends Core
* @param string|NULL $filepath Path to the file, or NULL.
* @param string|NULL $filedata Binary data for the file, or NULL.
* @param string|NULL $thumbnailpath Path to thumbnail, or NULL.
* @return integer|boolean The ID of the newly inserted attachment, or FALSE on failure.
* @return int|bool The ID of the newly inserted attachment, or FALSE on failure.
*/
public function convertAttachment( $info=array(), $map=array(), $filepath=NULL, $filedata=NULL, $thumbnailpath=NULL )
public function convertAttachment( array $info=array(), array $map=array(), ?string $filepath=NULL, ?string $filedata=NULL, ?string $thumbnailpath=NULL ) : bool|int
{
$map['location_key'] = 'calendar_Calendar';
$map['id1_type'] = 'calendar_events';
+48 -74
View File
@@ -22,9 +22,11 @@ use IPS\cms\Fields;
use IPS\cms\Pages\Folder;
use IPS\cms\Pages\Page;
use IPS\convert\App;
use IPS\convert\Software;
use IPS\Data\Store;
use IPS\DateTime;
use IPS\Db;
use IPS\Db\Exception as DbException;
use IPS\File;
use IPS\Http\Url;
use IPS\IPS;
@@ -33,13 +35,11 @@ use IPS\Member;
use IPS\Patterns\ActiveRecordIterator;
use LogicException;
use OutOfRangeException;
use OutRangeException;
use UnderflowException;
use function count;
use function defined;
use function get_class;
use function in_array;
use function intval;
use function is_array;
use function is_null;
use function is_numeric;
@@ -61,14 +61,14 @@ class Cms extends Core
/**
* @brief Application
*/
public $app = 'cms';
public string $app = 'cms';
/**
* Returns a block of text, or a language string, that explains what the admin must do to complete this conversion
*
* @return string
*/
public function getPostConversionInformation()
public function getPostConversionInformation() : string
{
return parent::getPostConversionInformation() . Member::loggedIn()->language()->addToStack( 'convert_cms_info_message' );
}
@@ -79,7 +79,7 @@ class Cms extends Core
* @param bool $rowCounts enable row counts
* @return array
*/
public function menuRows( $rowCounts=FALSE )
public function menuRows( bool $rowCounts=FALSE ) : array
{
$return = array();
$extraRows = $this->software->extraMenuRows();
@@ -100,7 +100,7 @@ class Cms extends Core
'ips_rows' => Db::i()->select( 'COUNT(*)', 'cms_blocks' ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 100,
'dependencies' => array(),
'dependencies' => $dependencies,
'link_type' => 'cms_blocks',
);
break;
@@ -318,10 +318,12 @@ class Cms extends Core
* @param string $method Method to truncate
* @return array
*/
protected function truncate( $method )
protected function truncate( string $method ) : array
{
$return = array();
$classname = get_class( $this->software );
/* @var Software $classname */
foreach( $classname::canConvert() as $k => $v )
{
switch( $k )
@@ -403,7 +405,7 @@ class Cms extends Core
}
}
return isset( $return[ $method ] ) ? $return[ $method ] : array();
return $return[$method] ?? array();
}
/**
@@ -424,9 +426,9 @@ class Cms extends Core
* Convert a Folder
*
* @param array $info Data to insert.
* @return integer|boolean The ID of the newly inserted folder, or FALSE on failure.
* @return int|bool The ID of the newly inserted folder, or FALSE on failure.
*/
public function convertCmsFolder( $info=array() )
public function convertCmsFolder( array $info=array() ) : bool|int
{
if ( !isset( $info['folder_id'] ) )
{
@@ -487,9 +489,9 @@ class Cms extends Core
* Convert a Page
*
* @param array $info Data to insert.
* @return integer|boolean The ID of the newly inserted page, or FALSE on failure.
* @return int|bool The ID of the newly inserted page, or FALSE on failure.
*/
public function convertCmsPage( $info=array() )
public function convertCmsPage( array $info=array() ) : bool|int
{
if ( !isset( $info['page_id'] ) )
{
@@ -569,7 +571,7 @@ class Cms extends Core
try
{
/* Check folder */
if ( intval( $info['page_folder_id'] ) == Folder::load( $info['page_seo_name'], 'folder_name' )->parent_id )
if ( $info['page_folder_id'] == Folder::load( $info['page_seo_name'], 'folder_name' )->parent_id )
{
$info['page_seo_name'] = Url::seoTitle( $info['page_name'] . '-' . $info['page_id'] );
}
@@ -624,9 +626,9 @@ class Cms extends Core
* Convert a block container
*
* @param array $info Data to insert.
* @return integer|boolean The ID of the newly inserted container, or FALSE on failure.
* @return int|bool The ID of the newly inserted container, or FALSE on failure.
*/
public function convertCmsContainer( $info=array() )
public function convertCmsContainer( array $info=array() ) : bool|int
{
if ( !isset( $info['container_id'] ) )
{
@@ -656,7 +658,7 @@ class Cms extends Core
$info['container_parent_id'] = 0;
}
if ( !isset( $info['container_type'] ) OR !in_array( $info['container_type'], array( 'block' ) ) )
if ( !isset( $info['container_type'] ) OR $info['container_type'] != 'block' )
{
$info['container_type'] = 'block';
}
@@ -689,9 +691,9 @@ class Cms extends Core
* @note These probably won't really work unless going from Invision Community to Invision Community, but we still support them anyway so they can be refactored.
*
* @param array $info Data to insert.
* @return integer|boolean The ID of the newly inserted block, or FALSE on failure.
* @return int|bool The ID of the newly inserted block, or FALSE on failure.
*/
public function convertCmsBlock( $info )
public function convertCmsBlock( array $info ) : bool|int
{
if ( !isset( $info['block_id'] ) )
{
@@ -809,14 +811,14 @@ class Cms extends Core
/**
* @brief Orphaned Blocks Container
*/
protected $orphanedBlockContainer = NULL;
protected ?int $orphanedBlockContainer = NULL;
/**
* Returns a category to store blocks that do not have one, creating one if needed.
*
* @return integer The ID.
* @return int The ID.
*/
protected function _orphanedBlocksCategory()
protected function _orphanedBlocksCategory() : int
{
if ( $this->orphanedBlockContainer === NULL )
{
@@ -841,9 +843,9 @@ class Cms extends Core
*
* @param array $info Data to insert
* @param array $fields Custom Field Data
* @return integer|boolean The ID of the newly inserted database, or FALSE on failure.
* @return int|bool The ID of the newly inserted database, or FALSE on failure.
*/
public function convertCmsDatabase( $info=array(), $fields=array() )
public function convertCmsDatabase( array $info=array(), array $fields=array() ) : bool|int
{
/* This is about to get caaaraaaaaazy */
if ( !isset( $info['database_id'] ) )
@@ -1097,10 +1099,6 @@ class Cms extends Core
$info['database_forum_prefix'] = '';
$info['database_forum_suffix'] = '';
}
catch( LogicException $e ) # a bug
{
throw $e;
}
if ( isset( $info['database_tags_predefined'] ) )
{
@@ -1439,7 +1437,7 @@ class Cms extends Core
Db::i()->createTable( $table );
}
}
catch( \IPS\Db\Exception $ex )
catch( DbException $ex )
{
throw new LogicException( $ex );
}
@@ -1553,8 +1551,7 @@ class Cms extends Core
Db::i()->update( 'cms_pages', array( 'page_content' => $page ), array( "page_id=?", $info['database_page_id'] ) );
}
catch( UnderflowException $e ) {}
catch( \IPS\Db\Exception $e ) {}
catch( UnderflowException|DbException $e ) {}
unset( Store::i()->cms_databases );
@@ -1566,9 +1563,9 @@ class Cms extends Core
* Convert a database category
*
* @param array $info Data to insert.
* @return integer|boolean The ID of the newly inserted category, or FALSE on failure.
* @return int|bool The ID of the newly inserted category, or FALSE on failure.
*/
public function convertCmsDatabaseCategory( $info=array() )
public function convertCmsDatabaseCategory( array $info=array() ) : bool|int
{
if ( !isset( $info['category_id'] ) )
{
@@ -1582,7 +1579,7 @@ class Cms extends Core
{
$info['category_database_id'] = $this->software->app->getLink( $info['category_database_id'], 'cms_databases' );
}
catch( OutRangeException $e )
catch( OutOfRangeException $e )
{
$this->software->app->log( 'cms_database_category_missing_database', __METHOD__, App::LOG_WARNING, $info['category_id'] );
return FALSE;
@@ -1770,7 +1767,7 @@ class Cms extends Core
}
}
}
catch( OutOfRangeException $e )
catch( OutOfRangeException|InvalidArgumentException $e )
{
$info['category_forum_override'] = 0;
$info['category_forum_record'] = 0;
@@ -1780,20 +1777,6 @@ class Cms extends Core
$info['category_forum_prefix'] = NULL;
$info['category_forum_suffix'] = NULL;
}
catch( InvalidArgumentException $e )
{
$info['category_forum_override'] = 0;
$info['category_forum_record'] = 0;
$info['category_forum_comments'] = 0;
$info['category_forum_delete'] = 0;
$info['category_forum_forum'] = 0;
$info['category_forum_prefix'] = NULL;
$info['category_forum_suffix'] = NULL;
}
catch( LogicException $e )
{
throw $e;
}
if ( !isset( $info['category_full_path'] ) )
{
@@ -1884,9 +1867,9 @@ class Cms extends Core
* @param array $fields Custom Field Data.
* @param string|NULL $imagepath Path to record image
* @param string|NULL $imagedata Image data
* @return integer|boolean The ID of the newly inserted record, or FALSE on failure.
* @return int|bool The ID of the newly inserted record, or FALSE on failure.
*/
public function convertCmsDatabaseRecord( $info=array(), $fields=array(), $imagepath=NULL, $imagedata=NULL )
public function convertCmsDatabaseRecord( array $info=array(), array $fields=array(), ?string $imagepath=NULL, ?string $imagedata=NULL ) : bool|int
{
if ( !isset( $info['record_id'] ) )
{
@@ -2028,10 +2011,6 @@ class Cms extends Core
{
$info['record_topicid'] = 0;
}
catch( LogicException $e )
{
throw $e;
}
}
else
{
@@ -2212,7 +2191,7 @@ class Cms extends Core
* @param array $fieldInfo The Field Information to format. This SHOULD be in $foreign_id => $content format, however field_$foreign_id => $content is also accepted.
* @return array An array of data formatted for cms_custom_database_*
*/
protected function _formatFieldsForSaving( $fieldInfo )
protected function _formatFieldsForSaving( array $fieldInfo ) : array
{
$return = array();
@@ -2254,9 +2233,9 @@ class Cms extends Core
* Convert a Comment
*
* @param array $info Data to insert.
* @return integer|boolean The ID of the newly inserted comment, or FALSE on failure.
* @return int|bool The ID of the newly inserted comment, or FALSE on failure.
*/
public function convertCmsDatabaseComment( $info=array() )
public function convertCmsDatabaseComment( array $info=array() ) : bool|int
{
if ( !isset( $info['comment_id'] ) )
{
@@ -2427,9 +2406,9 @@ class Cms extends Core
* Convert a review
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted review, or FALSE on failure.
* @return int|bool The ID of the newly inserted review, or FALSE on failure.
*/
public function convertCmsDatabaseReview( $info=array() )
public function convertCmsDatabaseReview( array $info=array() ) : bool|int
{
if ( !isset( $info['review_id'] ) )
{
@@ -2648,9 +2627,9 @@ class Cms extends Core
* Convert a Media Folder
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted folder, or FALSE on failure.
* @return int|bool The ID of the newly inserted folder, or FALSE on failure.
*/
public function convertCmsMediaFolder( $info=array() )
public function convertCmsMediaFolder( array $info=array() ) : bool|int
{
if ( !isset( $info['media_folder_id'] ) )
{
@@ -2701,9 +2680,9 @@ class Cms extends Core
* @param array $info Data to insert
* @param string|NULL $filepath The path to the file, or NULL.
* @param string|NULL $filedata The data for the file, or NULL.
* @return integer|boolean The ID of the newly inserted media file, or FALSE on failure.
* @return int|bool The ID of the newly inserted media file, or FALSE on failure.
*/
public function convertCmsMedia( $info=array(), $filepath=NULL, $filedata=NULL )
public function convertCmsMedia( array $info=array(), ?string $filepath=NULL, ?string $filedata=NULL ) : bool|int
{
if ( !isset( $info['media_id'] ) )
{
@@ -2798,17 +2777,12 @@ class Cms extends Core
}
}
}
catch( Exception $e )
catch( Exception|ErrorException $e )
{
$this->software->app->log( $e->getMessage(), __METHOD__, App::LOG_WARNING, $info['media_id'] );
return FALSE;
}
catch( ErrorException $e )
{
$this->software->app->log( $e->getMessage(), __METHOD__, App::LOG_WARNING, $info['media_id'] );
return FALSE;
}
$id = $info['media_id'];
unset( $info['media_id'] );
@@ -2826,9 +2800,9 @@ class Cms extends Core
* @param string|NULL $filepath Path to the file, or NULL.
* @param string|NULL $filedata Binary data for the file, or NULL.
* @param string|NULL $thumbnailpath Path to the thumbnail, or NULL.
* @return integer|boolean The ID of the newly inserted attachment, or FALSE on failure.
* @return int|bool The ID of the newly inserted attachment, or FALSE on failure.
*/
public function convertAttachment( $info=array(), $map=array(), $filepath=NULL, $filedata=NULL, $thumbnailpath = NULL )
public function convertAttachment( array $info=array(), array $map=array(), ?string $filepath=NULL, ?string $filedata=NULL, ?string $thumbnailpath = NULL ) : bool|int
{
$database = $this->software->app->getLink( str_replace( '-review', '', $map['id3'] ), 'cms_databases' );
@@ -2860,11 +2834,11 @@ class Cms extends Core
* Convert a Tag - CMS, we need to verify the database in a different way that doesn't require it to be on a page
*
* @param array $info Data to insert
* @return boolean|integer The ID of the newly inserted tag, or FALSE on failure.
* @return bool|int The ID of the newly inserted tag, or FALSE on failure.
* @note Like Follows, this should be done when the actual content it's attached too is being converted.
* @note core_tags_cache and core_tags_perms need to be populated by the converter.
*/
public function convertTag( $info=array() )
public function convertTag( array $info=array() ) : bool|int
{
$classname = 'IPS\cms\\' . ucfirst( $info['tag_meta_area'] );
+136 -153
View File
@@ -19,16 +19,15 @@ use ErrorException;
use InvalidArgumentException;
use IPS\Application;
use IPS\Content;
use IPS\Content\Reaction;
use IPS\convert\App;
use IPS\convert\Library;
use IPS\convert\Software;
use IPS\core\Acronym;
use IPS\core\Announcements\Announcement;
use IPS\core\Ignore;
use IPS\core\ProfileFields\Field;
use IPS\core\StaffDirectory\User;
use IPS\Data\Store;
use IPS\Date\Time;
use IPS\DateTime;
use IPS\Db;
use IPS\Db\Exception;
@@ -46,7 +45,6 @@ use IPS\Request;
use IPS\Settings;
use IPS\Text\ConverterParser;
use IPS\Text\LegacyParser;
use IPS\Text\Parser;
use LogicException;
use OutOfRangeException;
use UnderflowException;
@@ -78,7 +76,7 @@ class Core extends Library
/**
* @brief Application
*/
public $app = 'core';
public string $app = '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
@@ -86,7 +84,7 @@ class Core extends Library
* @param bool $rowCounts enable row counts
* @return array
*/
public function menuRows( $rowCounts=FALSE )
public function menuRows( bool $rowCounts=FALSE ): array
{
$return = array();
$extraRows = $this->software->extraMenuRows();
@@ -570,11 +568,12 @@ class Core extends Library
* @param string $method Method to truncate
* @return array
*/
protected function truncate( $method )
protected function truncate( string $method ) : array
{
$return = array();
$classname = get_class( $this->software );
/* @var Software $classname */
if( $classname::canConvert() === NULL )
{
return array();
@@ -757,7 +756,7 @@ class Core extends Library
}
}
return isset( $return[ $method ] ) ? $return[ $method ] : array();
return $return[$method] ?? array();
}
/**
@@ -768,9 +767,9 @@ class Core extends Library
/**
* A note on logging -
* If the data is missing and it is unlikely that any source software would be able to provide this, we do not need to log anything and can use default data (for example, group_layout in convertLeaderGroups).
* If the data is missing and it is likely that a majority of the source software can provide this, we should log a NOTICE and use default data (for example, a_casesensitive in convertAcronyms).
* If the data is missing and it is required to convert the item, we should log a WARNING and return FALSE.
* If the data is missing, and it is unlikely that any source software would be able to provide this, we do not need to log anything and can use default data (for example, group_layout in convertLeaderGroups).
* If the data is missing, and it is likely that a majority of the source software can provide this, we should log a NOTICE and use default data (for example, a_casesensitive in convertAcronyms).
* If the data is missing, and it is required to convert the item, we should log a WARNING and return FALSE.
* If the conversion absolutely cannot proceed at all (filestorage locations not writable, for example), then we should log an ERROR and throw an \IPS\convert\Exception to completely halt the process and redirect to an error screen showing the last logged error.
*/
@@ -782,7 +781,7 @@ class Core extends Library
* @param string|NULL $imageData Binary image data, or NULL.
* @return bool|int The ID of the newly inserted badge, or FALSE on failure
*/
public function convertAchievementBadge( array $info=[], string $imagePath=NULL, string $imageData=NULL )
public function convertAchievementBadge( array $info=[], ?string $imagePath=NULL, ?string $imageData=NULL ) : bool|int
{
if ( !isset( $info['id'] ) )
{
@@ -844,7 +843,7 @@ class Core extends Library
* @param string|NULL $imageData Binary image data, or NULL.
* @return bool|int The ID of the newly inserted badge, or FALSE on failure
*/
public function convertAchievementRank( array $info=[], string $imagePath=NULL, string $imageData=NULL )
public function convertAchievementRank( array $info=[], ?string $imagePath=NULL, ?string $imageData=NULL ) : bool|int
{
/* We don't really need an ID for these, so if one isn't specified, then that's okay. */
$hasId = TRUE;
@@ -902,9 +901,9 @@ class Core extends Library
* Convert an Acronym
*
* @param array $info Data to insert
* @return boolean|integer The ID of the newly inserted acronym, or FALSE on failure
* @return bool|int The ID of the newly inserted acronym, or FALSE on failure
*/
public function convertAcronym( $info=array() )
public function convertAcronym( array $info=array() ) : bool|int
{
/**
* The below are examples of when we should use an error or a notice, depending on the situation.
@@ -950,9 +949,9 @@ class Core extends Library
* Convert an Administrator
*
* @param array $info Data to insert
* @return boolean TRUE on success, FALSE on failure
* @return bool TRUE on success, FALSE on failure
*/
public function convertAdministrator( $info=array() )
public function convertAdministrator( array $info=array() ) : bool
{
if ( !isset( $info['row_id'] ) )
{
@@ -1019,15 +1018,16 @@ class Core extends Library
}
Db::i()->insert( 'core_admin_permission_rows', $info );
return true;
}
/**
* Convert an Announcement
*
* @param array $info Data to insert
* @return boolean|integer The ID of the newly inserted announcement, or FALSE on failure
* @return bool|int The ID of the newly inserted announcement, or FALSE on failure
*/
public function convertAnnouncement( $info=array() )
public function convertAnnouncement( array $info=array() ) : bool|int
{
if ( !isset( $info['announce_id'] ) )
{
@@ -1152,9 +1152,9 @@ class Core extends Library
* @param NULL|string $filepath The path to the attachment files or NULL if loading from the database.
* @param NULL|string $filedata If loading from the database, the content of the Binary column.
* @param NULL|string $thumbnailpath Path to thumbnail image
* @return boolean|integer The ID of the newly inserted attachment, or FALSE on failure.
* @return bool|int The ID of the newly inserted attachment, or FALSE on failure.
*/
public function convertAttachment( $info=array(), $map=array(), $filepath=NULL, $filedata=NULL, $thumbnailpath=NULL )
public function convertAttachment( array $info=array(), array $map=array(), ?string $filepath=NULL, ?string $filedata=NULL, ?string $thumbnailpath=NULL ) : bool|int
{
if ( !isset( $info['attach_id'] ) )
{
@@ -1476,9 +1476,9 @@ class Core extends Library
* Convert a Ban Filter
*
* @param array $info Data to insert
* @return boolean|integer The ID of the newly inserted ban filter, or FALSE on failure
* @return bool|int The ID of the newly inserted ban filter, or FALSE on failure
*/
public function convertBanfilter( $info=array() )
public function convertBanfilter( array $info=array() ) : bool|int
{
if ( !isset( $info['ban_id'] ) )
{
@@ -1520,9 +1520,9 @@ class Core extends Library
* Convert Custom BBCode for the LegacyParser to use
*
* @param array $info Data to insert
* @return boolean|integer The ID of the newly inserted BBCode, or FALSE on failure.
* @return bool|int The ID of the newly inserted BBCode, or FALSE on failure.
*/
public function convertCustomBbcode( $info=array() )
public function convertCustomBbcode( array $info=array() ) : bool|int
{
if ( !isset( $info['bbcode_id'] ) )
{
@@ -1586,9 +1586,9 @@ class Core extends Library
* Convert Display Name History
*
* @param array $info Data to insert
* @return boolean|integer The ID of the newly inserted Display Name History, or FALSE on failure.
* @return bool|int The ID of the newly inserted Display Name History, or FALSE on failure.
*/
public function convertDnameChange( $info=array() )
public function convertDnameChange( array $info=array() ) : bool|int
{
// not sure if we really need this?
if ( !isset( $info['old_id'] ) )
@@ -1658,9 +1658,9 @@ class Core extends Library
* Convert an Edit History Log
*
* @param array $info Data to insert
* @return boolean|integer The ID of the newly inserted Edit History, or FALSE on failure.
* @return bool|int The ID of the newly inserted Edit History, or FALSE on failure.
*/
public function convertEditHistory( $info=array() )
public function convertEditHistory( array $info=array() ) : bool|int
{
if ( !isset( $info['id'] ) )
{
@@ -1668,7 +1668,7 @@ class Core extends Library
return FALSE;
}
if ( !isset( $info['class'] ) OR !in_array( $info['class'], \IPS\Content::routedClasses() ) )
if ( !isset( $info['class'] ) OR !in_array( $info['class'], Content::routedClasses() ) )
{
$this->software->app->log( 'edit_history_missing_class', __METHOD__, App::LOG_WARNING, $info['id'] );
return FALSE;
@@ -1752,7 +1752,7 @@ class Core extends Library
if ( isset( $info['public'] ) )
{
$info['public'] = (boolean) $info['public'];
$info['public'] = (bool) $info['public'];
}
else
{
@@ -1777,15 +1777,15 @@ class Core extends Library
*
* @param array $info Data to insert
* @param NULL|array $set Set to store this emoticon in.
* @param boolean $keepExisting If TRUE, then if an emoticon code already exists in our database, we'll keep that one. FALSE means overwrite it.
* @param bool $keepExisting If TRUE, then if an emoticon code already exists in our database, we'll keep that one. FALSE means overwrite it.
* @param NULL|string $filepath Path to files, or NULL if loading from the database.
* @param NULL|string $filedata If loading from the database, the content of the Binary column.
* @param NULL|string $filepathx2 Path to the x2 size emoticon, or NULL if it doesn't exist.
* @param NULL|string $filedatax2 File Data for the x2 size emoticon, or NULL if it doesn't exist.
* @return boolean|integer The ID of the newly inserted emoticon, or FALSE on failure.
* @return bool|int The ID of the newly inserted emoticon, or FALSE on failure.
* @todo Handle emoticons without a defined set.
*/
public function convertEmoticon( $info=array(), $set=NULL, $keepExisting=TRUE, $filepath=NULL, $filedata=NULL, $filepathx2=NULL, $filedatax2=NULL )
public function convertEmoticon( array $info=array(), ?array $set=NULL, bool $keepExisting=TRUE, ?string $filepath=NULL, ?string $filedata=NULL, ?string $filepathx2=NULL, ?string $filedatax2=NULL ) : bool|int
{
/* We don't really need an ID for these */
$haveID = TRUE;
@@ -1858,7 +1858,7 @@ class Core extends Library
$info['emo_set'] = $set['set'];
$info['emo_set_position'] = $set['position'];
if ( Member::loggedIn()->language()->checkKeyExists( "core_emoticon_group_{$info['emo_set']}" ) == FALSE )
if ( !Member::loggedIn()->language()->checkKeyExists( "core_emoticon_group_{$info['emo_set']}" ) )
{
Lang::saveCustom( 'core', "core_emoticon_group_{$info['emo_set']}", $set['title'] );
}
@@ -1904,11 +1904,7 @@ class Core extends Library
$filex2 = File::create( 'core_Emoticons', $info['filenamex2'], $filedatax2, 'emoticons', FALSE, NULL, static::$obscureFilenames );
$info['image_2x'] = (string) $filex2;
}
catch( \Exception $e )
{
$info['image_2x'] = NULL;
}
catch( ErrorException $e )
catch( \Exception|ErrorException $e )
{
$info['image_2x'] = NULL;
}
@@ -1935,10 +1931,10 @@ class Core extends Library
* Convert Follow Data
*
* @param array $info Data to insert
* @return boolean Unlike other methods, we do not need to return an ID for the converted follow - so simply return TRUE on success, or FALSE on failure.
* @return bool Unlike other methods, we do not need to return an ID for the converted follow - so simply return TRUE on success, or FALSE on failure.
* @note This method should not have an individual step, but rather be called during others (ex. when converting topics, insert any follows at that point)
*/
public function convertFollow( $info=array() )
public function convertFollow( array $info=array() ) : bool
{
if ( !isset( $info['follow_app'] ) )
{
@@ -2057,7 +2053,7 @@ class Core extends Library
/**
* @brief Bitwise are protected in \IPS\Member\Group, so copying here.
*/
protected static $groupBitOptions = array(
protected static array $groupBitOptions = array(
'gbw_mod_post_unit_type' => 1, // Lift moderation after x. 1 is days, 0 is posts. Corresponds to g_mod_post_unit
'gbw_ppd_unit_type' => 2, // Lift post-per-day limit after x. 1 is days, 0 is posts. Corresponds to g_ppd_unit
'gbw_displayname_unit_type' => 4, // Username change restrictions. 1 is days, 0 is posts. Corresponds to g_displayname_unit
@@ -2095,13 +2091,13 @@ class Core extends Library
* Convert a Member Group
*
* @param array $info Data to insert
* @param integer|NULL $mergeWith THe ID of the group to merge this one into, or NULL to create new.
* @param int|NULL $mergeWith THe ID of the group to merge this one into, or NULL to create new.
* @param string|NULL $iconpath Path to Icon file for the group, or NULL.
* @param string|NULL $icondata Binary Icon Data, or NULL.
* @return boolean|integer The ID of the newly inserted group, or FALSE on failure.
* @return bool|int The ID of the newly inserted group, or FALSE on failure.
* @note Other libraries will handle their own settings
*/
public function convertGroup( $info=array(), $mergeWith=NULL, $iconpath=NULL, $icondata=NULL )
public function convertGroup( array $info=array(), ?int $mergeWith=NULL, ?string $iconpath=NULL, ?string $icondata=NULL ) : bool|int
{
if ( !isset( $info['g_id'] ) )
{
@@ -2140,11 +2136,7 @@ class Core extends Library
$file = File::create( 'core_Theme', $info['g_icon'], $icondata );
$info['g_icon'] = (string) $file;
}
catch( \Exception $e )
{
$info['g_icon'] = NULL;
}
catch( ErrorException $e )
catch( \Exception|ErrorException $e )
{
$info['g_icon'] = NULL;
}
@@ -2209,7 +2201,7 @@ class Core extends Library
continue;
}
if ( isset( $info['g_bitoptions'][$key] ) AND $info['g_bitoptions'][$key] == TRUE )
if ( isset( $info['g_bitoptions'][$key] ) AND $info['g_bitoptions'][$key] )
{
$bitoptions += $value;
}
@@ -2256,10 +2248,6 @@ class Core extends Library
$info[$otherDefault] = '';
break;
case 'g_max_mass_pm':
$info[$otherDefault] = 10;
break;
case 'g_search_flood':
$info[$otherDefault] = 3;
break;
@@ -2270,6 +2258,7 @@ class Core extends Library
case 'g_rep_max_positive':
case 'g_rep_max_negative':
case 'g_max_mass_pm':
$info[$otherDefault] = 10;
break;
}
@@ -2338,15 +2327,15 @@ class Core extends Library
/**
* @brief Store group promotion values temporarily to convert after groups are done
*/
public $groupPromotions = array();
public array $groupPromotions = array();
/**
* Convert a group promotion rule
*
* @param array $info Data to insert
* @return boolean|integer The ID of the newly inserted promotion rule, or FALSE on error.
* @return bool|int The ID of the newly inserted promotion rule, or FALSE on error.
*/
public function convertGroupPromotion( $info=array() )
public function convertGroupPromotion( array $info=array() ) : bool|int
{
if ( !isset( $info['newgroup'] ) OR !isset( $info['oldgroup'] ) )
{
@@ -2415,9 +2404,9 @@ class Core extends Library
* Convert an Ignored User
*
* @param array $info Data to insert
* @return boolean|integer The ID of the newly inserted Ignore, or FALSE on error.
* @return bool|int The ID of the newly inserted Ignore, or FALSE on error.
*/
public function convertIgnoredUser( $info=array() )
public function convertIgnoredUser( array $info=array() ) : bool|int
{
if ( !isset( $info['ignore_id'] ) )
{
@@ -2480,9 +2469,9 @@ class Core extends Library
* Convert a Staff Directory Entry
*
* @param array $info Data to insert
* @return boolean|integer The ID of the newly inserted Leader, or FALSE on failure.
* @return bool|int The ID of the newly inserted Leader, or FALSE on failure.
*/
public function convertLeader( $info=array() )
public function convertLeader( array $info=array() ) : bool|int
{
if ( !isset( $info['leader_id'] ) )
{
@@ -2548,7 +2537,7 @@ class Core extends Library
$info['leader_group_id'] = $this->software->app->getLink( $info['leader_group_id'], 'core_leader_groups' );
}
catch( LogicException $e ) /* LogicException here so as to accommodate for catching both OutOfRangeException and DomainException - we don't care which was thrown */
catch( LogicException $e ) /* LogicException here to accommodate for catching both OutOfRangeException and DomainException - we don't care which was thrown */
{
try
{
@@ -2585,9 +2574,9 @@ class Core extends Library
* Convert a Staff Directory Group
*
* @param array $info Data to insert
* @return boolean|integer The ID of the newly inserted Staff Directory Group, or FALSE on failure.
* @return bool|int The ID of the newly inserted Staff Directory Group, or FALSE on failure.
*/
public function convertLeaderGroup( $info=array() )
public function convertLeaderGroup( array $info=array() ) : bool|int
{
if ( !isset( $info['group_id'] ) )
{
@@ -2630,9 +2619,9 @@ class Core extends Library
* @param array $info Data to insert
* @param string|NULL $iconpath Icon File Path, or NULL
* @param string|NULL $icondata Icon File Data, or NULL
* @return boolean|integer The ID of the newly inserted Rank, or FALSE on failure.
* @return bool|int The ID of the newly inserted Rank, or FALSE on failure.
*/
public function convertRank( $info=array(), $iconpath=NULL, $icondata=NULL )
public function convertRank( array $info=array(), ?string $iconpath=NULL, ?string $icondata=NULL ) : bool|int
{
$this->software->app->log( 'method_deprecated', __METHOD__, App::LOG_WARNING );
return FALSE;
@@ -2641,7 +2630,7 @@ class Core extends Library
/**
* @brief Cache login handlers
*/
protected static $_loginMethods = NULL;
protected static ?array $_loginMethods = NULL;
/**
* Convert a Member
@@ -2654,10 +2643,10 @@ class Core extends Library
* @param NULL|string $coverPhotoName Filename for the users Cover Photo or NULL if none set.
* @param NULL|string $coverPhotoPath Path to Cover Photos, or NULL to load from the database.
* @param NULL|string $coverFileData If loading from the database, the filedatafor the cover photo from the Binary column.
* @return boolean|integer The ID of the newly inserted member, or FALSE on failure.
* @return bool|int The ID of the newly inserted member, or FALSE on failure.
* @todo Work out if we can convert Social Login Stuff.
*/
public function convertMember( $info=array(), $profileFields=array(), $profilePhotoName=NULL, $profilePhotoPath=NULL, $profileFileData=NULL, $coverPhotoName=NULL, $coverPhotoPath=NULL, $coverFileData=NULL )
public function convertMember( array $info=array(), array $profileFields=array(), ?string $profilePhotoName=NULL, ?string $profilePhotoPath=NULL, ?string $profileFileData=NULL, ?string $coverPhotoName=NULL, ?string $coverPhotoPath=NULL, ?string $coverFileData=NULL ) : bool|int
{
if ( !isset( $info['member_id'] ) )
{
@@ -3078,7 +3067,7 @@ class Core extends Library
{
foreach( Member::$bitOptions['members_bitoptions']['members_bitoptions'] AS $key => $value )
{
if ( isset( $info['members_bitoptions'][$key] ) AND $info['members_bitoptions'][$key] == TRUE )
if ( isset( $info['members_bitoptions'][$key] ) AND $info['members_bitoptions'][$key] )
{
$bitoptions += $value;
}
@@ -3096,7 +3085,7 @@ class Core extends Library
{
foreach( Member::$bitOptions['members_bitoptions']['members_bitoptions2'] AS $key => $value )
{
if ( isset( $info['members_bitoptions2'][$key] ) AND $info['members_bitoptions2'] == TRUE )
if ( isset( $info['members_bitoptions2'][$key] ) AND $info['members_bitoptions2'] )
{
$bitoptions2 += $value;
}
@@ -3214,7 +3203,7 @@ class Core extends Library
$cover = File::create( 'core_Profile', $coverPhotoName, $coverFileData );
$info['pp_cover_photo'] = (string) $cover;
/* Designs are different so this will never likely be correct, we'll try it if one is supplied though */
$info['pp_cover_offset'] = isset( $info['pp_cover_offset'] ) ? $info['pp_cover_offset'] : 0;
$info['pp_cover_offset'] = $info['pp_cover_offset'] ?? 0;
}
catch( ErrorException | \Exception $e )
{
@@ -3270,7 +3259,7 @@ class Core extends Library
if ( isset( $info['allow_admin_mails'] ) )
{
$info['allow_admin_mails'] = (boolean) $info['allow_admin_mails'];
$info['allow_admin_mails'] = (bool) $info['allow_admin_mails'];
}
else
{
@@ -3354,9 +3343,9 @@ class Core extends Library
* Convert member history
*
* @param array $info Data to insert
* @return boolean|integer The ID of the newly inserted member history record, or FALSE on failure
* @return bool|int The ID of the newly inserted member history record, or FALSE on failure
*/
public function convertMemberHistory( $info=array() )
public function convertMemberHistory( array $info=array() ) : bool|int
{
if ( !isset( $info['log_id'] ) )
{
@@ -3492,9 +3481,9 @@ class Core extends Library
* Convert a Warning Action
*
* @param array $info Data to insert
* @return boolean|integer The ID of the newly inserted warning action, or FALSE on failure.
* @return bool|int The ID of the newly inserted warning action, or FALSE on failure.
*/
public function convertWarnAction( $info=array() )
public function convertWarnAction( array $info=array() ) : bool|int
{
/* We do not really need an ID here */
$hasId = TRUE;
@@ -3564,10 +3553,10 @@ class Core extends Library
* Convert a Warning Log
*
* @param array $info Data to insert
* @return boolean|integer The ID of the newly inserted warning log, or FALSE on failure.
* @return bool|int The ID of the newly inserted warning log, or FALSE on failure.
* @note Like Follows, this should be done when the actual content it's attached too is being converted.
*/
public function convertWarnLog( $info=array() )
public function convertWarnLog( array $info=array() ) : bool|int
{
if ( !isset( $info['wl_id'] ) )
{
@@ -3745,9 +3734,9 @@ class Core extends Library
* Convert a Warning Reason
*
* @param array $info Data to insert
* @return boolean|integer The ID of the newly inserted warning reason, or FALSE on failure.
* @return bool|int The ID of the newly inserted warning reason, or FALSE on failure.
*/
public function convertWarnReason( $info=array() )
public function convertWarnReason( array $info=array() ) : bool|int
{
if ( !isset( $info['wr_id'] ) )
{
@@ -3811,9 +3800,9 @@ class Core extends Library
*
* @param array $topic The Message Topic Data to insert
* @param array $maps The User Map Data to insert. Example: array( memberId => array( data ) )
* @return boolean|integer The ID of the newly inserted Message Topic, or FALSE on failure.
* @return bool|int The ID of the newly inserted Message Topic, or FALSE on failure.
*/
public function convertPrivateMessage( $topic=array(), $maps=array() )
public function convertPrivateMessage( array $topic=array(), array $maps=array() ) : bool|int
{
if ( !isset( $topic['mt_id'] ) )
{
@@ -3949,7 +3938,7 @@ class Core extends Library
/* We already know this */
$map['map_topic_id'] = $topicInsertedId;
if ( !isset( $map['map_folder_id'] ) OR ( isset( $map['map_folder_id'] ) AND empty( $map['map_folder_id'] ) ) )
if ( !isset( $map['map_folder_id'] ) OR empty( $map['map_folder_id'] ) )
{
$map['map_folder_id'] = 'myconvo';
}
@@ -4079,7 +4068,7 @@ class Core extends Library
* @param array $info Data to insert
* @return bool|int The ID of the newly inserted reply, or FALSE on failure.
*/
public function convertPrivateMessageReply( $info=array() )
public function convertPrivateMessageReply( array $info=array() ) : bool|int
{
if ( !isset( $info['msg_id'] ) )
{
@@ -4155,9 +4144,9 @@ class Core extends Library
* Convert a Moderator
*
* @param array $info Data to insert
* @return boolean TRUE on success, or FALSE on failure.
* @return bool TRUE on success, or FALSE on failure.
*/
public function convertModerator( $info=array() )
public function convertModerator( array $info=array() ) : bool
{
if ( !isset( $info['type'] ) OR !in_array( $info['type'], array( 'g', 'm' ) ) )
{
@@ -4224,10 +4213,10 @@ class Core extends Library
* Convert Permissions
*
* @param array $info Data to insert
* @return boolean|integer The ID of the newly inserted permission row, or FALSE on failure.
* @return bool|int The ID of the newly inserted permission row, or FALSE on failure.
* @note These should be converted when the relevant node is converted.
*/
public function convertPermission( $info=array() )
public function convertPermission( array $info=array() ) : bool|int
{
/* Valid app? */
if ( !isset( $info['app'] ) )
@@ -4240,7 +4229,7 @@ class Core extends Library
{
$application = Application::load( $info['app'] );
if ( Application::appIsEanbled( $info['app'] ) === FALSE )
if ( Application::appIsEnabled( $info['app'] ) === FALSE )
{
throw new UnexpectedValueException;
}
@@ -4392,7 +4381,7 @@ class Core extends Library
continue;
}
if ( !in_array( $currentGroups ) )
if ( !in_array( $group, $currentGroups ) )
{
$groupsToAdd[] = $group;
}
@@ -4418,10 +4407,10 @@ class Core extends Library
* Convert a Profile Field Group
*
* @param array $info Data to insert
* @param integer|NULL $mergeWith The group we are merging with, or NULL to not merge.
* @return boolean|integer The ID of the newly inserted profile field group, or FALSE on failure
* @param int|NULL $mergeWith The group we are merging with, or NULL to not merge.
* @return bool|int The ID of the newly inserted profile field group, or FALSE on failure
*/
public function convertProfileFieldGroup( $info=array(), $mergeWith=NULL )
public function convertProfileFieldGroup( array $info=array(), ?int $mergeWith=NULL ) : bool|int
{
if ( !isset( $info['pf_group_id'] ) )
{
@@ -4467,11 +4456,11 @@ class Core extends Library
* Convert a Profile Field
*
* @param array $info Data to insert
* @param integer|NULL $mergeWith THe ID of an existing profile field to merge this one with, or NULL to create new.
* @return boolean|integer The ID of the newly inserted profile field, or FALSE on failure.
* @param int|NULL $mergeWith THe ID of an existing profile field to merge this one with, or NULL to create new.
* @return bool|int The ID of the newly inserted profile field, or FALSE on failure.
* @note Profile Field Content for individual members needs to be done during the members step, not here.
*/
public function convertProfileField( $info=array(), $mergeWith=NULL )
public function convertProfileField( array $info=array(), ?int $mergeWith=NULL ) : bool|int
{
/* Get valid fields while taking hooks into account */
$validFields = array_merge( static::$fieldTypes, Field::$additionalFieldTypes );
@@ -4657,7 +4646,7 @@ class Core extends Library
/**
* @brief All local custom fields
*/
protected $cachedFields = NULL;
protected ?array $cachedFields = NULL;
/**
* Get profile fields using cache
@@ -4666,13 +4655,11 @@ class Core extends Library
* @return array
* @throws UnderflowException
*/
protected function _getField( $fieldId )
protected function _getField( int $fieldId ) : array
{
if( $this->cachedFields === NULL )
{
$fields = iterator_to_array( Db::i()->select( '*', 'core_pfields_data' )->setKeyField('pf_id') );
$this->cachedFields = ( is_array( $fields ) ) ? $fields : array();
$this->cachedFields = iterator_to_array( Db::i()->select( '*', 'core_pfields_data' )->setKeyField('pf_id') );
}
if( !isset( $this->cachedFields[ $fieldId ] ) )
@@ -4686,7 +4673,7 @@ class Core extends Library
/**
* @brief Store of field IDs to skip formatting
*/
protected $_skipFields = [];
protected array $_skipFields = [];
/**
* Format Member Profile Field Content
@@ -4695,7 +4682,7 @@ class Core extends Library
* @param array $fieldInfo The Profile Field Information to format. This SHOULD be in $foreign_id => $content format, however field_$foreign_id => $content is also accepted.
* @return array An array of data formatted for core_pfields_content
*/
protected function _formatMemberProfileFieldContent( $member_id, $fieldInfo )
protected function _formatMemberProfileFieldContent( int $member_id, array $fieldInfo ) : array
{
$return = array( 'member_id' => $member_id );
@@ -4774,10 +4761,10 @@ class Core extends Library
*
* @param array $info Data to insert
* @param array $votes Vote Data
* @return boolean|integer The ID of the newly inserted Poll, or false on failure.
* @return bool|int The ID of the newly inserted Poll, or false on failure.
* @note Like Follows, this should be done when the actual content it's attached too is being converted.
*/
public function convertPoll( $info=array(), $votes=array() )
public function convertPoll( array $info=array(), array $votes=array() ) : bool|int
{
/* Another instance where we really don't need this, but will store if we have it */
$hasId = TRUE;
@@ -4973,9 +4960,9 @@ class Core extends Library
* Convert a Profanity Filter
*
* @param array $info Data to insert
* @return boolean|integer The ID of the newly inserted profanity filter, or FALSE on failure.
* @return bool|int The ID of the newly inserted profanity filter, or FALSE on failure.
*/
public function convertProfanityFilter( $info=array() )
public function convertProfanityFilter( array $info=array() ) : bool|int
{
if ( !isset( $info['wid'] ) )
{
@@ -5016,11 +5003,11 @@ class Core extends Library
/**
* Convert Question and Answer Spam Prevention
*
* @param string $info Data to insert
* @param array $info Data to insert
* @param array $answers The answers
* @return boolean|integer The ID of the newly insert Q&A, or FALSE on failure.
* @return bool|int The ID of the newly insert Q&A, or FALSE on failure.
*/
public function convertQuestionAndAnswer( $info, $answers=array() )
public function convertQuestionAndAnswer( array $info, array $answers=array() ) : bool|int
{
$haveId = TRUE;
if ( !isset( $info['qa_id'] ) )
@@ -5067,10 +5054,10 @@ class Core extends Library
* Convert a Rating
*
* @param array $info Data to insert
* @return boolean|integer The ID of the newly inserted rating, or FALSE on failure.
* @return bool|int The ID of the newly inserted rating, or FALSE on failure.
* @note Like Follows, this should be done when the actual content it's attached too is being converted.
*/
public function convertRating( $info=array() )
public function convertRating( array $info=array() ) : bool|int
{
$haveId = TRUE;
if ( !isset( $info['id'] ) )
@@ -5158,10 +5145,10 @@ class Core extends Library
* Convert a Report Index
*
* @param array $info Data to insert
* @return boolean|integer The ID of the newly inserted report index, or FALSE on failure.
* @return bool|int The ID of the newly inserted report index, or FALSE on failure.
* @note Like Follows, this should be done when the actual content it's attached too is being converted.
*/
public function convertReportIndex( $info=array() )
public function convertReportIndex( array $info=array() ) : bool|int
{
if ( !isset( $info['id'] ) )
{
@@ -5169,7 +5156,7 @@ class Core extends Library
return FALSE;
}
$contentClasses = \IPS\Content::routedClasses();
$contentClasses = Content::routedClasses();
if ( !isset( $info['class'] ) OR !in_array( $info['class'], $contentClasses ) )
{
$this->software->app->log( 'report_index_invalid_class', __METHOD__, App::LOG_WARNING, $info['id'] );
@@ -5276,10 +5263,10 @@ class Core extends Library
* @param array $info Data to insert
* @param NULL|string $filePath Path to files, or NULL if loading from the database.
* @param NULL|string $fileData If loading from the database, the content of the Binary column.
* @param integer|NULL $mergeWith The ID of the group to merge this one into, or NULL to create new.
* @param int|NULL $mergeWith The ID of the group to merge this one into, or NULL to create new.
* @return bool|int ID of new record on success, FALSE on failure
*/
public function convertReaction( $info=array(), $filePath=NULL, $fileData=NULL, int $mergeWith=NULL )
public function convertReaction( array $info=array(), ?string $filePath=NULL, ?string $fileData=NULL, ?int $mergeWith=NULL ) : bool|int
{
if ( !isset( $info['reaction_id'] ) )
{
@@ -5345,7 +5332,7 @@ class Core extends Library
try
{
$file = File::create( 'core_Reaction', $info['filename'], $fileData, 'reactions', FALSE, NULL );
$file = File::create( 'core_Reaction', $info['filename'], $fileData, 'reactions' );
unset( $info['filename'] );
$info['reaction_icon'] = (string) $file;
$file->getImageDimensions();
@@ -5380,10 +5367,10 @@ class Core extends Library
* Convert a Report
*
* @param array $info Data to insert
* @return boolean|integer The ID of the newly inserted report, or FALSE on failure.
* @return bool|int The ID of the newly inserted report, or FALSE on failure.
* @note Like Follows, this should be done when the actual content it's attached too is being converted.
*/
public function convertReport( $info=array() )
public function convertReport( array $info=array() ) : bool|int
{
if ( !isset( $info['id'] ) )
{
@@ -5461,10 +5448,10 @@ class Core extends Library
* Convert a Report Comment
*
* @param array $info Data to insert
* @return boolean|integer The ID of the newly inserted comment, or FALSE on failure.
* @return bool|int The ID of the newly inserted comment, or FALSE on failure.
* @note UNLIKE report indexes, this can be done separately.
*/
public function convertReportComment( $info=array() )
public function convertReportComment( array $info=array() ) : bool|int
{
if ( !isset( $info['id'] ) )
{
@@ -5559,10 +5546,10 @@ class Core extends Library
* Convert Reputation
*
* @param array $info Data to insert
* @return boolean|integer The ID of the newly inserted reputation, or FALSE on failure.
* @return bool|int The ID of the newly inserted reputation, or FALSE on failure.
* @note Like Follows, this should be done when the actual content it's attached to is being converted.
*/
public function convertReputation( $info=array() )
public function convertReputation( array $info=array() ) : bool|int
{
/* Another instance where we really don't need this, but will store if we have it */
$hasId = TRUE;
@@ -5610,7 +5597,7 @@ class Core extends Library
{
try
{
/* Try to lookup a reaction ID link */
/* Try to lookup reaction ID link */
try
{
$info['reaction'] = $this->software->app->getLink( $info['reaction'], 'core_reactions' );
@@ -5777,9 +5764,9 @@ class Core extends Library
* @param array $info Data to insert
* @param string|NULL $badgepath Path to Reputation Badge file.
* @param string|NULL $badgedata Binary data for Reputation Badge file.
* @return boolean|integer The ID of the newly inserted reputation level, or FALSE on failure.
* @return bool|int The ID of the newly inserted reputation level, or FALSE on failure.
*/
public function convertReputationLevel( $info=array(), $badgepath=NULL, $badgedata=NULL )
public function convertReputationLevel( array $info=array(), ?string $badgepath=NULL, ?string $badgedata=NULL ) : bool|int
{
/* Another instance where we really don't need this, but will store if we have it */
$hasId = TRUE;
@@ -5815,11 +5802,7 @@ class Core extends Library
$file = File::create( 'core_Theme', $info['level_image'], $badgedata );
$info['level_image'] = (string) $file;
}
catch( \Exception $e )
{
$info['level_image'] = '';
}
catch( ErrorException $e )
catch( \Exception|ErrorException $e )
{
$info['level_image'] = '';
}
@@ -5851,11 +5834,11 @@ class Core extends Library
* Convert an RSS Import Feed
*
* @param array $info Data to insert
* @param array $containerType Container Link Type
* @param string $containerType Container Link Type
* @param string $newLinkType Link type to use
* @return integer|boolean The ID of the newly inserted import feed, or FALSE on failure.
* @return int|bool The ID of the newly inserted import feed, or FALSE on failure.
*/
public function convertRssImport( $info, $containerType='forums_forums', $newLinkType='core_rss_import' )
public function convertRssImport( array $info, string $containerType='forums_forums', string $newLinkType='core_rss_import' ) : bool|int
{
if ( !isset( $info['rss_import_id'] ) )
{
@@ -5975,10 +5958,10 @@ class Core extends Library
*
* @param array $info Data to insert
* @param string $type Link type for RSS Feed
* @param mixed $contentType Content Link Type
* @return boolean TRUE on success, or FALSE on failure.
* @param string $contentType Content Link Type
* @return bool TRUE on success, or FALSE on failure.
*/
public function convertRssImported( $info=array(), $type='core_rss_import', $contentType='' )
public function convertRssImported( array $info=array(), string $type='core_rss_import', string $contentType='' ) : bool
{
/* Godspeed */
if ( isset( $info['rss_imported_import_id'] ) )
@@ -6031,9 +6014,9 @@ class Core extends Library
* Convert a Setting
*
* @param array $settings Settings to convert
* @return boolean|array An array of settings changed, or FALSE on failure.
* @return bool|array An array of settings changed, or FALSE on failure.
*/
public function convertSettings( $settings=array() )
public function convertSettings( array $settings=array() ) : bool|array
{
if ( !count( $settings ) )
{
@@ -6054,17 +6037,17 @@ class Core extends Library
/**
* @brief Store valid content class set by child converters, if contentrouter verification cannot be relied upon.
*/
protected $_ipsTagContentClass = NULL;
protected ?string $_ipsTagContentClass = NULL;
/**
* Convert a Tag
*
* @param array $info Data to insert
* @return boolean|integer The ID of the newly inserted tag, or FALSE on failure.
* @return bool|int The ID of the newly inserted tag, or FALSE on failure.
* @note Like Follows, this should be done when the actual content it's attached too is being converted.
* @note core_tags_cache and core_tags_perms need to be populated by the converter.
*/
public function convertTag( $info=array() )
public function convertTag( array $info=array() ) : bool|int
{
/* Another instance where we really don't need this, but will store if we have it */
$hasId = TRUE;
@@ -6229,9 +6212,9 @@ class Core extends Library
* @param string|NULL $icondata Binary data for the icon file
* @param string|NULL $coverfile Path to the club cover photo file
* @param string|NULL $coverdata Binary data for the icon file
* @return boolean|integer The ID of the newly inserted club, or FALSE on failure.
* @return bool|int The ID of the newly inserted club, or FALSE on failure.
*/
public function convertClub( $info=array(), $iconfile=NULL, $icondata=NULL, $coverfile=NULL, $coverdata=NULL )
public function convertClub( array $info=array(), ?string $iconfile=NULL, ?string $icondata=NULL, ?string $coverfile=NULL, ?string $coverdata=NULL ) : bool|int
{
if ( !isset( $info['club_id'] ) )
{
@@ -6352,7 +6335,7 @@ class Core extends Library
if ( isset( $info['last_activity'] ) )
{
if ( $info['last_activity'] instanceof Time )
if ( $info['last_activity'] instanceof DateTime )
{
$info['last_activity'] = $info['last_activity']->getTimestamp();
}
@@ -6383,9 +6366,9 @@ class Core extends Library
* Convert a Club Member
*
* @param array $info The data to insert
* @return boolean|string The unique ID of the newly inserted club member, or FALSE on failure.
* @return bool|int The unique ID of the newly inserted club member, or FALSE on failure.
*/
public function convertClubMember( $info=array() )
public function convertClubMember( array $info=array() ) : bool|int
{
if ( !isset( $info['club_id'] ) OR !isset( $info['member_id'] ) )
{
@@ -6475,9 +6458,9 @@ class Core extends Library
* Convert a Club Member
*
* @param array $info The data to insert
* @return boolean|string The unique ID of the newly inserted club member, or FALSE on failure.
* @return bool|int The unique ID of the newly inserted club member, or FALSE on failure.
*/
public function convertClubPage( array $info=array() )
public function convertClubPage( array $info=array() ) : bool|int
{
if ( !isset( $info['page_id'] ) OR !isset( $info['page_club'] ) )
{
@@ -6512,7 +6495,7 @@ class Core extends Library
if( is_array( $info['page_can_view'] ) )
{
$info['page_can_view'] = implode( ',', array_filter( $info['page_can_view'], function( $value ) {
return (bool) in_array( $value, array( 'nonmember', 'member', 'moderator' ) );
return in_array( $value, array( 'nonmember', 'member', 'moderator' ) );
} ) );
}
}
@@ -17,6 +17,7 @@ use ErrorException;
use Exception;
use IPS\Application;
use IPS\convert\App;
use IPS\convert\Software;
use IPS\DateTime;
use IPS\Db;
use IPS\downloads\Category;
@@ -48,7 +49,7 @@ class Downloads extends Core
/**
* @brief Application
*/
public $app = 'downloads';
public string $app = 'downloads';
/**
* 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
@@ -56,7 +57,7 @@ class Downloads extends Core
* @param bool $rowCounts enable row counts
* @return array
*/
public function menuRows( $rowCounts=FALSE )
public function menuRows( bool $rowCounts=FALSE ) : array
{
$return = array();
$extraRows = $this->software->extraMenuRows();
@@ -244,11 +245,12 @@ class Downloads extends Core
* @param string $method Method to truncate
* @return array
*/
protected function truncate( $method )
protected function truncate( string $method ) : array
{
$return = array();
$classname = get_class( $this->software );
/* @var Software $classname */
if( $classname::canConvert() === NULL )
{
return array();
@@ -299,15 +301,15 @@ class Downloads extends Core
break;
case 'convertClubDownloadsFiles':
$return['convertClubDownloadsFiles'] = array( 'downloads_files' => array( 'file_id IN ( ' . (string) Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_downloads_files' AND app={$this->software->app->app_id}" ) ) . ')' ) );
$return['convertClubDownloadsFiles'] = array( 'downloads_files' => array( 'file_id IN ( ' . Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_downloads_files' AND app={$this->software->app->app_id}" ) ) . ')' ) );
break;
case 'convertClubDownloadsComments':
$return['convertClubDownloadsComments'] = array( 'downloads_comments' => array( 'comment_id IN ( ' . (string) Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_downloads_comments' AND app={$this->software->app->app_id}" ) ) . ')' ) );
$return['convertClubDownloadsComments'] = array( 'downloads_comments' => array( 'comment_id IN ( ' . Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_downloads_comments' AND app={$this->software->app->app_id}" ) ) . ')' ) );
break;
case 'convertClubDownloadsReviews':
$return['convertClubDownloadsFiles'] = array( 'downloads_reviews' => array( 'review_id IN ( ' . (string) Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_downloads_reviews' AND app={$this->software->app->app_id}" ) ) . ')' ) );
$return['convertClubDownloadsFiles'] = array( 'downloads_reviews' => array( 'review_id IN ( ' . Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_downloads_reviews' AND app={$this->software->app->app_id}" ) ) . ')' ) );
break;
}
}
@@ -323,9 +325,9 @@ class Downloads extends Core
/**
* A note on logging -
* If the data is missing and it is unlikely that any source software would be able to provide this, we do not need to log anything and can use default data (for example, group_layout in convertLeaderGroups).
* If the data is missing and it is likely that a majority of the source software can provide this, we should log a NOTICE and use default data (for example, a_casesensitive in convertAcronyms).
* If the data is missing and it is required to convert the item, we should log a WARNING and return FALSE.
* If the data is missing, and it is unlikely that any source software would be able to provide this, we do not need to log anything and can use default data (for example, group_layout in convertLeaderGroups).
* If the data is missing, and it is likely that a majority of the source software can provide this, we should log a NOTICE and use default data (for example, a_casesensitive in convertAcronyms).
* If the data is missing, and it is required to convert the item, we should log a WARNING and return FALSE.
* If the conversion absolutely cannot proceed at all (filestorage locations not writable, for example), then we should log an ERROR and throw an \IPS\convert\Exception to completely halt the process and redirect to an error screen showing the last logged error.
*/
@@ -333,9 +335,9 @@ class Downloads extends Core
* Convert a Custom Field
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted field, or FALSE on failure.
* @return int|bool The ID of the newly inserted field, or FALSE on failure.
*/
public function convertDownloadsCfield( $info=array() )
public function convertDownloadsCfield( array $info=array() ) : bool|int
{
$validFields = array_merge( static::$fieldTypes, Field::$additionalFieldTypes );
@@ -406,8 +408,8 @@ class Downloads extends Core
}
$id = $info['cf_id'];
$fieldName = isset( $info['cf_name'] ) ? $info['cf_name'] : NULL;
$fieldDescription = isset( $info['cf_desc'] ) ? $info['cf_desc'] : NULL;
$fieldName = $info['cf_name'] ?? NULL;
$fieldDescription = $info['cf_desc'] ?? NULL;
unset( $info['cf_id'], $info['cf_name'], $info['cf_desc'] );
$inserted_id = Db::i()->insert( 'downloads_cfields', $info );
@@ -511,7 +513,7 @@ class Downloads extends Core
* @param array $fieldInfo The Custom Field Information to format. This SHOULD be in $foreign_id => $content format, however field_$foreign_id => $content is also accepted.
* @return array An array of data formatted for downloads_ccontent
*/
protected function _formatCustomFieldContent( $file_id, $fieldInfo )
protected function _formatCustomFieldContent( int $file_id, array $fieldInfo ) : array
{
$return = array( 'file_id' => $file_id );
@@ -549,9 +551,9 @@ class Downloads extends Core
* Convert a category
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted category, or FALSE on failure.
* @return int|bool The ID of the newly inserted category, or FALSE on failure.
*/
public function convertDownloadsCategory( $info=array() )
public function convertDownloadsCategory( array $info=array() ) : bool|int
{
if ( !isset( $info['cid'] ) )
{
@@ -799,9 +801,9 @@ class Downloads extends Core
* @param array $info Data to insert
* @param array $records Record Data to insert
* @param array $customFields Custom Field Data to insert
* @return integer|boolean The ID of the newly inserted file, or FALSE on failure.
* @return int|bool The ID of the newly inserted file, or FALSE on failure.
*/
public function convertDownloadsFile( $info=array(), $records=array(), $customFields=array() )
public function convertDownloadsFile( array $info=array(), array $records=array(), array $customFields=array() ) : bool|int
{
if ( !isset( $info['file_id'] ) )
{
@@ -1098,7 +1100,7 @@ class Downloads extends Core
if ( !isset( $record['record_realname'] ) )
{
if ( isset( $record['file_path'] ) AND !is_null( $record['file_path'] ) )
if ( isset( $record['file_path'] ) AND !empty( $record['file_path'] ) )
{
$fileName = explode( '/', $record['file_path'] );
$fileName = array_pop( $fileName );
@@ -1194,9 +1196,9 @@ class Downloads extends Core
/**
* Get Orphaned Files Category
*
* @return integer The Category ID.
* @return int The Category ID.
*/
protected function _orphanedFilesCategory()
protected function _orphanedFilesCategory() : int
{
try
{
@@ -1215,9 +1217,9 @@ class Downloads extends Core
* Convert a comment
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted comment, or FALSE on failure.
* @return int|bool The ID of the newly inserted comment, or FALSE on failure.
*/
public function convertDownloadsComment( $info=array() )
public function convertDownloadsComment( array $info=array() ) : bool|int
{
if ( !isset( $info['comment_id'] ) )
{
@@ -1331,9 +1333,9 @@ class Downloads extends Core
* Convert a review
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted review, or FALSE on failure.
* @return int|bool The ID of the newly inserted review, or FALSE on failure.
*/
public function convertDownloadsReview( $info=array() )
public function convertDownloadsReview( array $info=array() ) : bool|int
{
if ( !isset( $info['review_id'] ) )
{
@@ -1528,9 +1530,9 @@ class Downloads extends Core
* @param string|NULL $filepath Path to the file, or NULL.
* @param string|NULL $filedata Binary data for the file, or NULL.
* @param string|NULL $thumbnailpath Path to thumbnail, or NULL.
* @return integer|boolean The ID of the newly inserted attachment, or FALSE on failure.
* @return int|bool The ID of the newly inserted attachment, or FALSE on failure.
*/
public function convertAttachment( $info=array(), $map=array(), $filepath=NULL, $filedata=NULL, $thumbnailpath = NULL )
public function convertAttachment( array $info=array(), array $map=array(), ?string $filepath=NULL, ?string $filedata=NULL, ?string $thumbnailpath = NULL ) : bool|int
{
$map['location_key'] = 'downloads_Downloads';
$map['id1_type'] = 'downloads_files';
@@ -1558,9 +1560,9 @@ class Downloads extends Core
* Convert a Club Downloads Category
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted category, or FALSE on failure.
* @return int|bool The ID of the newly inserted category, or FALSE on failure.
*/
public function convertClubDownloadsCategory( $info=array() )
public function convertClubDownloadsCategory( array $info=array() ) : bool|int
{
$insertedId = $this->convertDownloadsCategory( $info );
if ( $insertedId )
@@ -1575,9 +1577,9 @@ class Downloads extends Core
*
* @param array $info Data to insert
* @param array $records File Records
* @return integer|boolean The ID of the newly inserted file, or FALSE on failure.
* @return int|bool The ID of the newly inserted file, or FALSE on failure.
*/
public function convertClubDownloadsFile( $info=array(), $records=array() )
public function convertClubDownloadsFile( array $info=array(), array $records=array() ) : bool|int
{
$insertedId = $this->convertDownloadsFile( $info, $records );
if ( $insertedId )
@@ -1591,9 +1593,9 @@ class Downloads extends Core
* Convert a Club Downloads Comment
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted comment, or FALSE on failure.
* @return int|bool The ID of the newly inserted comment, or FALSE on failure.
*/
public function convertClubDownloadsComment( $info=array() )
public function convertClubDownloadsComment( array $info=array() ) : bool|int
{
$insertedId = $this->convertDownloadsComment( $info );
if ( $insertedId )
@@ -1607,9 +1609,9 @@ class Downloads extends Core
* Convert a Club Downloads Review
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted comment, or FALSE on failure.
* @return int|bool The ID of the newly inserted comment, or FALSE on failure.
*/
public function convertClubDownloadsReview( $info=array() )
public function convertClubDownloadsReview( array $info=array() ) : bool|int
{
$insertedId = $this->convertDownloadsReview( $info );
if ( $insertedId )
+44 -46
View File
@@ -16,6 +16,7 @@ namespace IPS\convert\Library;
use ErrorException;
use IPS\convert\App;
use IPS\convert\Exception;
use IPS\convert\Software;
use IPS\DateTime;
use IPS\Db;
use IPS\File;
@@ -50,7 +51,7 @@ class Forums extends Core
/**
* @brief Application
*/
public $app = 'forums';
public string $app = 'forums';
/**
* 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
@@ -58,7 +59,7 @@ class Forums extends Core
* @param bool $rowCounts enable row counts
* @return array
*/
public function menuRows( $rowCounts=FALSE )
public function menuRows( bool $rowCounts=FALSE ) : array
{
$return = array();
$classname = get_class( $this->software );
@@ -145,7 +146,7 @@ class Forums extends Core
$return[ $k ] = array(
'step_title' => 'convert_forums_rss_imported',
'step_method' => 'convertForumsRssImported',
'ips_rows' => Db::i()->select( 'COUNT(*)', 'core_rss_imported', array( 'rss_imported_import_id IN(' . (string) Db::i()->select( 'rss_import_id', 'core_rss_import', array( "rss_import_class='IPS\\forums\\Topic'" ) ) . ')' ) )->first(),
'ips_rows' => Db::i()->select( 'COUNT(*)', 'core_rss_imported', array( 'rss_imported_import_id IN(' . Db::i()->select( 'rss_import_id', 'core_rss_import', array( "rss_import_class='IPS\\forums\\Topic'" ) ) . ')' ) )->first(),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 200,
'dependencies' => array( 'convertForumsTopics', 'convertForumsRssImports' ),
@@ -205,7 +206,7 @@ class Forums extends Core
$return[ $k ] = array(
'step_title' => 'convert_club_topics',
'step_method' => 'convertClubTopics',
'ips_rows' => Db::i()->select( 'COUNT(tid)', 'forums_topics', array( 'forum_id IN ( ' . (string) Db::i()->select( 'id', 'forums_forums', array( "club_id IS NOT NULL" ) ) . ')' ) ),
'ips_rows' => Db::i()->select( 'COUNT(tid)', 'forums_topics', array( 'forum_id IN ( ' . Db::i()->select( 'id', 'forums_forums', array( "club_id IS NOT NULL" ) ) . ')' ) ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 200,
'dependencies' => array( 'convertClubForums' ),
@@ -254,7 +255,7 @@ class Forums extends Core
* @param bool $rowCount Count local rows
* @return array
*/
public function getMethodFromMenuRows( $method, $rowCount=FALSE )
public function getMethodFromMenuRows( string $method, bool $rowCount=FALSE ) : array
{
if( $method == 'convertForumsBoards' )
{
@@ -270,11 +271,12 @@ class Forums extends Core
* @param string $method Method to truncate
* @return array
*/
protected function truncate( $method )
protected function truncate( string $method ) : array
{
$return = array();
$classname = get_class( $this->software );
/* @var Software $classname */
if( $classname::canConvert() === NULL )
{
return array();
@@ -327,11 +329,11 @@ class Forums extends Core
break;
case 'convertForumsRssImported':
$retun['convertForumsRssImported'] = array( 'forums_rss_imported' => NULL );
$return['convertForumsRssImported'] = array( 'forums_rss_imported' => NULL );
break;
case 'convertForumsQuestionRatings':
$retun['convertForumsQuestionRatings'] = array( 'forums_question_ratings' => NULL );
$return['convertForumsQuestionRatings'] = array( 'forums_question_ratings' => NULL );
break;
case 'convertForumsAnswerRatings':
@@ -352,11 +354,11 @@ class Forums extends Core
break;
case 'convertClubTopics':
$return['convertClubTopics'] = array( 'forums_topics' => array( 'tid IN ( ' . (string) Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_topics' AND app={$this->software->app->app_id}" ) ) . ')' ) );
$return['convertClubTopics'] = array( 'forums_topics' => array( 'tid IN ( ' . Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_topics' AND app={$this->software->app->app_id}" ) ) . ')' ) );
break;
case 'convertClubPosts':
$return['convertClubPosts'] = array( 'forums_posts' => array( 'pid IN ( ' . (string) Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_posts' AND app={$this->software->app->app_id}" ) ) . ')' ) );
$return['convertClubPosts'] = array( 'forums_posts' => array( 'pid IN ( ' . Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_posts' AND app={$this->software->app->app_id}" ) ) . ')' ) );
break;
}
}
@@ -384,9 +386,9 @@ class Forums extends Core
* @param array|NULL $perms Permissions or NULL to insert no permissions.
* @param string|NULL $iconpath The path to the forums icon, or NULL.
* @param string|NULL $icondata The binary data for the forums icon, or NULL.
* @return integer|boolean The ID of the newly inserted forum, or FALSE on failure.
* @return int|bool The ID of the newly inserted forum, or FALSE on failure.
*/
public function convertForumsForum( $info=array(), $perms=NULL, $iconpath=NULL, $icondata=NULL )
public function convertForumsForum( array $info=array(), ?array $perms=NULL, ?string $iconpath=NULL, ?string $icondata=NULL ) : bool|int
{
if ( !isset( $info['id'] ) )
{
@@ -810,15 +812,11 @@ class Forums extends Core
$info['icon'] = NULL;
}
}
catch( \Exception $e )
catch( \Exception|ErrorException $e )
{
$info['icon'] = NULL;
}
catch( ErrorException $e )
{
$info['icon'] = NULL;
}
if ( isset( $info['club_id'] ) )
{
try
@@ -881,9 +879,9 @@ class Forums extends Core
/**
* Get Parent Forum ID for Orphaned Forums
*
* @return integer The ID of the forum created for forums that do not have a parent forum.
* @return int The ID of the forum created for forums that do not have a parent forum.
*/
protected function _getOrphanedForumCategory()
protected function _getOrphanedForumCategory() : int
{
try
{
@@ -905,9 +903,9 @@ class Forums extends Core
* Convert a topic
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted topic, or FALSE on failure
* @return int|bool The ID of the newly inserted topic, or FALSE on failure
*/
public function convertForumsTopic( $info=array() )
public function convertForumsTopic( array $info=array() ) : bool|int
{
if ( !isset( $info['tid'] ) )
{
@@ -1249,9 +1247,9 @@ class Forums extends Core
* Convert a Forum Post
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted post, or FALSE on failure.
* @return int|bool The ID of the newly inserted post, or FALSE on failure.
*/
public function convertForumsPost( $info=array() )
public function convertForumsPost( array $info=array() ) : bool|int
{
if ( !isset( $info['pid'] ) )
{
@@ -1441,7 +1439,7 @@ class Forums extends Core
$topicUpdate['topic_firstpost'] = $inserted_id;
}
if ( $isBestAnswer == TRUE )
if ( $isBestAnswer )
{
$topicUpdate['topic_answered_pid'] = $inserted_id;
}
@@ -1458,9 +1456,9 @@ class Forums extends Core
* Convert an Archived Post
*
* @param array $info Data to insert
* @param integer|boolean The ID of the newly inserted Archived Post, or FALSE on failure.
* @return int|bool The ID of the newly inserted Archived Post, or FALSE on failure.
*/
public function convertForumsArchivedPost( $info=array() )
public function convertForumsArchivedPost( array $info=array() ) : bool|int
{
/* This works a little differently... we actually need to insert it into the main posts table first, then move it. As such, the $info array should match that of the main posts method EXCEPT for a few keys which we'll extract out. */
if ( isset( $info['archive_added'] ) )
@@ -1478,7 +1476,7 @@ class Forums extends Core
/* If $return is FALSE, stop here. Something went wrong. */
if ( $return === FALSE )
{
return $return;
return false;
}
/* Re-extract the post. We need the topic too. */
@@ -1528,9 +1526,9 @@ class Forums extends Core
* Convert a forums topic multimod
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted Multi Mod, or FALSE on failure.
* @return int|bool The ID of the newly inserted Multi Mod, or FALSE on failure.
*/
public function convertForumsTopicMultimod( $info=array() )
public function convertForumsTopicMultimod( array $info=array() ) : bool|int
{
/* Another instance where we do not necessarily need this, but will store anyway if we have it */
$hasId = TRUE;
@@ -1687,9 +1685,9 @@ class Forums extends Core
* Convert an RSS Import Feed
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted import feed, or FALSE on failure.
* @return int|bool The ID of the newly inserted import feed, or FALSE on failure.
*/
public function convertForumsRssImport( $info=array() )
public function convertForumsRssImport( array $info=array() ) : bool|int
{
$info['rss_import_class'] = 'IPS\\forums\\Topic';
@@ -1713,9 +1711,9 @@ class Forums extends Core
* Convert an RSS Imported Topic... or try to, anyway.
*
* @param array $info Data to insert
* @return boolean TRUE on success, or FALSE on failure.
* @return bool|int TRUE on success, or FALSE on failure.
*/
public function convertForumsRssImported( $info=array() )
public function convertForumsRssImported( array $info=array() ) : bool|int
{
return parent::convertRssImported( $info, 'forums_rss_import', 'forums_topics' );
}
@@ -1724,9 +1722,9 @@ class Forums extends Core
* Convert a question rating
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted rating, or FALSE on failure.
* @return int|bool The ID of the newly inserted rating, or FALSE on failure.
*/
public function convertForumsQuestionRating( $info=array() )
public function convertForumsQuestionRating( array $info=array() ) : bool|int
{
/* We do not need to store an ID if one isn't present */
$hasId = TRUE;
@@ -1844,9 +1842,9 @@ class Forums extends Core
* Convert an Answer Rating
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted rating, or FALSE on failure.
* @return int|bool The ID of the newly inserted rating, or FALSE on failure.
*/
public function convertForumsAnswerRating( $info=array() )
public function convertForumsAnswerRating( array $info=array() ) : bool|int
{
/* We do not need to store an ID if one is not present */
$hasId = TRUE;
@@ -1968,9 +1966,9 @@ class Forums extends Core
* @param NULL|string $filepath The path to the attachment files or NULL if loading from the database.
* @param NULL|string $filedata If loading from the database, the content of the Binary column.
* @param NULL|string $thumbnailpath Path to thumbnail image
* @return boolean|integer The ID of the newly inserted attachment, or FALSE on failure.
* @return bool|int The ID of the newly inserted attachment, or FALSE on failure.
*/
public function convertAttachment( $info=array(), $map=array(), $filepath=NULL, $filedata=NULL, $thumbnailpath=NULL )
public function convertAttachment( array $info=array(), array $map=array(), ?string $filepath=NULL, ?string $filedata=NULL, ?string $thumbnailpath=NULL ) : bool|int
{
/* The Core Library handles most of this. We just need to make sure forum specific data is set. */
$map['id1_type'] = 'forums_topics';
@@ -1986,9 +1984,9 @@ class Forums extends Core
* Convert a Club Forum
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted forum, or FALSE on failure.
* @return int|bool The ID of the newly inserted forum, or FALSE on failure.
*/
public function convertClubForum( $info=array() )
public function convertClubForum( array $info=array() ) : bool|int
{
$insertedId = $this->convertForumsForum( $info );
if ( $insertedId )
@@ -2002,9 +2000,9 @@ class Forums extends Core
* Convert a Club Topic
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted topic, or FALSE on failure.
* @return int|bool The ID of the newly inserted topic, or FALSE on failure.
*/
public function convertClubTopic( $info=array() )
public function convertClubTopic( array $info=array() ) : bool|int
{
$insertedId = $this->convertForumsTopic( $info );
if ( $insertedId )
@@ -2018,9 +2016,9 @@ class Forums extends Core
* Convert a Club Post
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted post, or FALSE on failure.
* @return int|bool The ID of the newly inserted post, or FALSE on failure.
*/
public function convertClubPost( $info=array() )
public function convertClubPost( array $info=array() ) : bool|int
{
$insertedId = $this->convertForumsPost( $info );
if ( $insertedId )
@@ -16,6 +16,7 @@ namespace IPS\convert\Library;
use ErrorException;
use Exception;
use IPS\convert\App;
use IPS\convert\Software;
use IPS\DateTime;
use IPS\Db;
use IPS\File;
@@ -52,7 +53,7 @@ class Gallery extends Core
/**
* @brief Application
*/
public $app = 'gallery';
public string $app = 'gallery';
/**
* 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
@@ -60,7 +61,7 @@ class Gallery extends Core
* @param bool $rowCounts enable row counts
* @return array
*/
public function menuRows( $rowCounts=FALSE )
public function menuRows( bool $rowCounts=FALSE ) : array
{
$return = array();
$extraRows = $this->software->extraMenuRows();
@@ -277,11 +278,12 @@ class Gallery extends Core
* @param string $method Method to truncate
* @return array
*/
protected function truncate( $method )
protected function truncate( string $method ) : array
{
$return = array();
$classname = get_class( $this->software );
/* @var Software $classname */
if( $classname::canConvert() === NULL )
{
return array();
@@ -332,15 +334,15 @@ class Gallery extends Core
break;
case 'convertClubGalleryImages':
$return['convertClubGalleryImages'] = array( 'gallery_images' => array( 'image_id IN ( ' . (string) Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_gallery_images' AND app={$this->software->app->app_id}" ) ) . ')' ) );
$return['convertClubGalleryImages'] = array( 'gallery_images' => array( 'image_id IN ( ' . Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_gallery_images' AND app={$this->software->app->app_id}" ) ) . ')' ) );
break;
case 'convertClubGalleryComments':
$return['convertClubGalleryComments'] = array( 'gallery_comments' => array( 'comment_id IN ( ' . (string) Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_gallery_comments' AND app={$this->software->app->app_id}" ) ) . ')' ) );
$return['convertClubGalleryComments'] = array( 'gallery_comments' => array( 'comment_id IN ( ' . Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_gallery_comments' AND app={$this->software->app->app_id}" ) ) . ')' ) );
break;
case 'convertClubGalleryReviews':
$return['convertClubGalleryReviews'] = array( 'gallery_reviews' => array( 'review_id IN ( ' . (string) Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_gallery_reviews' AND app={$this->software->app->app_id}" ) ) . ')' ) );
$return['convertClubGalleryReviews'] = array( 'gallery_reviews' => array( 'review_id IN ( ' . Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_gallery_reviews' AND app={$this->software->app->app_id}" ) ) . ')' ) );
break;
}
}
@@ -366,9 +368,9 @@ class Gallery extends Core
* Convert a category
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly converted category, or FALSE on error.
* @return int|bool The ID of the newly converted category, or FALSE on error.
*/
public function convertGalleryCategory( $info=array() )
public function convertGalleryCategory( array $info=array() ) : bool|int
{
if ( !isset( $info['category_id'] ) )
{
@@ -519,10 +521,10 @@ class Gallery extends Core
*
* @param array $info Data to insert
* @param array|NULL $socialgroup Array of social group data, or NULL.
* @param integer|NULL $category If the source software only has albums, and not categories, an existing category ID can be passed here to store converted albums. NULL to auto-create.
* @return integer|boolean The ID of the newly converted album, or FALSE on error.
* @param int|NULL $category If the source software only has albums, and not categories, an existing category ID can be passed here to store converted albums. NULL to auto-create.
* @return int|bool The ID of the newly converted album, or FALSE on error.
*/
public function convertGalleryAlbum( $info=array(), $socialgroup=NULL, $category=NULL )
public function convertGalleryAlbum( array $info=array(), ?array $socialgroup=NULL, ?int $category=NULL ) : bool|int
{
if ( !isset( $info['album_id'] ) )
{
@@ -640,7 +642,7 @@ class Gallery extends Core
}
$info['album_allowed_access'] = NULL;
if ( !is_null( $socialgroup ) AND is_array( $socialgroup ) )
if ( is_array( $socialgroup ) )
{
$socialGroupId = Db::i()->insert( 'core_sys_social_groups', array( 'owner_id' => $info['album_owner_id'] ) );
$members = array();
@@ -678,9 +680,9 @@ class Gallery extends Core
/**
* Orphaned Albums Category
*
* @return integer Orphaned Albums Category ID
* @return int Orphaned Albums Category ID
*/
protected function _orphanedAlbumsCategory()
protected function _orphanedAlbumsCategory() : int
{
try
{
@@ -714,10 +716,10 @@ class Gallery extends Core
*
* @param array $info Data to insert
* @param string|NULL $filepath The path to the image, or NULL.
* @param string|NULL $fileinfo The binary data for the image, or NULL
* @return integer|boolean The ID of the newly inserted image, or FALSE on failure.
* @param string|NULL $filedata The binary data for the image, or NULL
* @return int|bool The ID of the newly inserted image, or FALSE on failure.
*/
public function convertGalleryImage( $info=array(), $filepath=NULL, $filedata=NULL )
public function convertGalleryImage( array $info=array(), ?string $filepath=NULL, ?string $filedata=NULL ) : bool|int
{
if ( !isset( $info['image_id'] ) )
{
@@ -759,7 +761,7 @@ class Gallery extends Core
$info['image_album_id'] = 0;
}
if ( isset( $info['image_category_id'] ) AND $categoryFound == FALSE )
if ( isset( $info['image_category_id'] ) AND !$categoryFound )
{
try
{
@@ -772,7 +774,7 @@ class Gallery extends Core
}
else
{
if ( $categoryFound == FALSE )
if ( !$categoryFound )
{
$info['image_category_id'] = $this->_orphanedAlbumsCategory();
}
@@ -918,17 +920,12 @@ class Gallery extends Core
$info['image_file_size'] = $image->filesize();
}
}
catch( Exception $e )
catch( Exception|ErrorException $e )
{
$this->software->app->log( $e->getMessage(), __METHOD__, App::LOG_WARNING, $info['image_id'] );
return FALSE;
}
catch( ErrorException $e )
{
$this->software->app->log( $e->getMessage(), __METHOD__, App::LOG_WARNING, $info['image_id'] );
return FALSE;
}
if ( !isset( $info['image_approved'] ) )
{
$info['image_approved'] = 1;
@@ -1076,9 +1073,9 @@ class Gallery extends Core
* Convert an album comment
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted comment, or FALSE on failure.
* @return int|bool The ID of the newly inserted comment, or FALSE on failure.
*/
public function convertGalleryAlbumComment( $info=array() )
public function convertGalleryAlbumComment( array $info=array() ) : bool|int
{
if ( !isset( $info['comment_id'] ) )
{
@@ -1197,9 +1194,9 @@ class Gallery extends Core
* Convert an album review
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted reiew, or FALSE on failure.
* @return int|bool The ID of the newly inserted reiew, or FALSE on failure.
*/
public function convertGalleryAlbumReview( $info=array() )
public function convertGalleryAlbumReview( array $info=array() ) : bool|int
{
if ( !isset( $info['review_id'] ) )
{
@@ -1384,9 +1381,9 @@ class Gallery extends Core
* Convert a comment
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted comment, or FALSE on failure.
* @return int|bool The ID of the newly inserted comment, or FALSE on failure.
*/
public function convertGalleryComment( $info=array() )
public function convertGalleryComment( array $info=array() ) : bool|int
{
if ( !isset( $info['comment_id'] ) )
{
@@ -1505,9 +1502,9 @@ class Gallery extends Core
* Convert a review
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted reiew, or FALSE on failure.
* @return int|bool The ID of the newly inserted reiew, or FALSE on failure.
*/
public function convertGalleryReview( $info=array() )
public function convertGalleryReview( array $info=array() ) : bool|int
{
if ( !isset( $info['review_id'] ) )
{
@@ -1696,9 +1693,9 @@ class Gallery extends Core
* @param string|NULL $filepath The path to the attachment, or NULL.
* @param string|NULL $filedata The binary data of the attachment, or NULL.
* @param string|NULL $thumbnailpath Path to thumbnail, or NULL.
* @return integer|boolean The ID of the newly inserted attachment, or FALSE on failure.
* @return int|bool The ID of the newly inserted attachment, or FALSE on failure.
*/
public function convertAttachment( $info=array(), $map=array(), $filepath=NULL, $filedata=NULL, $thumbnailpath = NULL )
public function convertAttachment( array $info=array(), array $map=array(), ?string $filepath=NULL, ?string $filedata=NULL, ?string $thumbnailpath = NULL ) : bool|int
{
$map['location_key'] = 'gallery_Gallery';
$map['id1_type'] = 'gallery_images';
@@ -1726,9 +1723,9 @@ class Gallery extends Core
* Convert a Club Gallery Category
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted category, or FALSE on failure.
* @return int|bool The ID of the newly inserted category, or FALSE on failure.
*/
public function convertClubGalleryCategory( $info=array() )
public function convertClubGalleryCategory( array $info=array() ) : bool|int
{
$insertedId = $this->convertGalleryCategory( $info );
if ( $insertedId )
@@ -1744,9 +1741,9 @@ class Gallery extends Core
* @param array $info Data to insert
* @param string|NULL $filepath The path to the image, or NULL.
* @param string|NULL $filedata The binary data for the image, or NULL
* @return integer|boolean The ID of the newly inserted image, or FALSE on failure.
* @return int|bool The ID of the newly inserted image, or FALSE on failure.
*/
public function convertClubGalleryImage( $info=array(), $filepath=NULL, $filedata=NULL )
public function convertClubGalleryImage( array $info=array(), ?string $filepath=NULL, ?string $filedata=NULL ) : bool|int
{
$insertedId = $this->convertGalleryImage( $info, $filepath, $filedata );
if ( $insertedId )
@@ -1760,9 +1757,9 @@ class Gallery extends Core
* Convert a Club Gallery Comment
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted comment, or FALSE on failure.
* @return int|bool The ID of the newly inserted comment, or FALSE on failure.
*/
public function convertClubGalleryComment( $info=array() )
public function convertClubGalleryComment( array $info=array() ) : bool|int
{
$insertedId = $this->convertGalleryComment( $info );
if ( $insertedId )
@@ -1776,9 +1773,9 @@ class Gallery extends Core
* Convert a Club Gallery Review
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted review, or FALSE on failure.
* @return int|bool The ID of the newly inserted review, or FALSE on failure.
*/
public function convertClubGalleryReview( $info=array() )
public function convertClubGalleryReview( array $info=array() ) : bool|int
{
$insertedId = $this->convertGalleryReview( $info );
if ( $insertedId )
+44 -44
View File
@@ -16,6 +16,7 @@ namespace IPS\convert\Library;
use Exception;
use IPS\convert\App;
use IPS\convert\Library;
use IPS\convert\Software;
use IPS\DateTime;
use IPS\Db;
use IPS\File;
@@ -52,7 +53,7 @@ class Nexus extends Library
/**
* @brief Application
*/
public $app = 'nexus';
public string $app = 'nexus';
/**
* 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
@@ -60,7 +61,7 @@ class Nexus extends Library
* @param bool $rowCounts enable row counts
* @return array
*/
public function menuRows( $rowCounts=FALSE )
public function menuRows( bool $rowCounts=FALSE ) : array
{
$return = array();
$extraRows = $this->software->extraMenuRows();
@@ -235,7 +236,7 @@ class Nexus extends Library
$return[ $k ] = [
'step_title' => 'convert_nexus_subscription_packages',
'step_method' => 'convertNexusSubscriptionPackages',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'nexus_member_subscription_packages' ),
'ips_rows' => Db::i()->select( 'COUNT(*)', 'nexus_member_subscription_packages' ),
'source_rows' => [ 'table' => $v['table'], 'where' => $v['where'] ],
'per_cycle' => 200,
'dependencies' => [],
@@ -433,11 +434,12 @@ class Nexus extends Library
* @param string $method Method to truncate
* @return array
*/
protected function truncate( $method )
protected function truncate( string $method ) : array
{
$return = array();
$classname = get_class( $this->software );
/* @var Software $classname */
if( $classname::canConvert() === NULL )
{
return array();
@@ -576,7 +578,7 @@ class Nexus extends Library
* @param array $fields Custom Field Data
* @return int|bool The ID of the inserted customer, or FALSE on failure
*/
public function convertNexusCustomer( $info, $fields=array() )
public function convertNexusCustomer( array $info, array $fields=array() ) : bool|int
{
if ( !isset( $info['member_id'] ) )
{
@@ -639,7 +641,7 @@ class Nexus extends Library
* @param array $fields The fields
* @return array Formatted Fields
*/
protected function _formatCustomerFields( $fields )
protected function _formatCustomerFields( array $fields ) : array
{
$return = array();
foreach( $fields as $key => $value )
@@ -667,7 +669,7 @@ class Nexus extends Library
/**
* @brief Allowed currencies
*/
protected $_allowedCurrencies = array( 'AED', 'AFN', 'ALL', 'AMD', 'ANG', 'AOA', 'ARS', 'AUD', 'AWG', 'AZN', 'BAM', 'BBD',
protected array $_allowedCurrencies = array( 'AED', 'AFN', 'ALL', 'AMD', 'ANG', 'AOA', 'ARS', 'AUD', 'AWG', 'AZN', 'BAM', 'BBD',
'BDT', 'BGN', 'BHD', 'BIF', 'BMD', 'BND', 'BOB', 'BRL', 'BSD', 'BTN', 'BWP', 'BYN', 'BYR', 'BZD', 'CAD', 'CDF', 'CHF',
'CLF', 'CLP', 'CNY', 'COP', 'CRC', 'CUC', 'CUP', 'CVE', 'CZK', 'DJF', 'DKK', 'DOP', 'DZD', 'EGP', 'ERN', 'ETB', 'EUR',
'FJD', 'FKP', 'GBP', 'GEL', 'GGP', 'GHS', 'GIP', 'GMD', 'GNF', 'GTQ', 'GYD', 'HKD', 'HNL', 'HRK', 'HTG', 'HUF', 'IDR',
@@ -682,10 +684,10 @@ class Nexus extends Library
/**
* Convert a currency
*
* @param array Info
* @param array $info Info
* @return int|bool The newly inserted currency, or FALSE on failure
*/
public function convertNexusCurrency( $info )
public function convertNexusCurrency( array $info ) : bool|int
{
if ( !isset( $info['code'] ) )
{
@@ -725,7 +727,7 @@ class Nexus extends Library
* @param array $info Info
* @return int|bool The newly inserted note ID, or FALSE on failure
*/
public function convertNexusNote( $info )
public function convertNexusNote( array $info ) : bool|int
{
$hasId = TRUE;
if ( !isset( $info['note_id'] ) )
@@ -809,7 +811,7 @@ class Nexus extends Library
* @param string|NULL $filedata Raw filedata for the groups cover photo, or NULL
* @return int|bool THe ID of the newly inserted package group, or FALSE on failure
*/
public function convertNexusPackageGroup( $info, $filepath=NULL, $filedata=NULL )
public function convertNexusPackageGroup( array $info, ?string $filepath=NULL, ?string $filedata=NULL ) : bool|int
{
if ( !isset( $info['pg_id'] ) )
{
@@ -898,7 +900,7 @@ class Nexus extends Library
* @param array $info Info
* @return int|bool The ID of the newly inserted payment gateway, or FALSE on failure
*/
public function convertNexusPaymentMethod( $info )
public function convertNexusPaymentMethod( array $info ) : bool|int
{
/* !Required: ID */
if ( !isset( $info['m_id'] ) )
@@ -962,7 +964,7 @@ class Nexus extends Library
* @param string|NULL $filePath Path to images
* @return int|bool The ID of the newly inserted package, or FALSE on failure
*/
public function convertNexusPackage( $info, $filePath=NULL )
public function convertNexusPackage( array $info, ?string $filePath=NULL ) : bool|int
{
/* !Required: ID */
if ( !isset( $info['p_id'] ) )
@@ -1025,8 +1027,6 @@ class Nexus extends Library
}
catch( OutOfRangeException $ex ) { }
}, $newGroups );
$info['p_member_group'] = $info['p_member_group'];
}
/* Primary User Group */
@@ -1088,13 +1088,13 @@ class Nexus extends Library
$renewals = array();
if( isset( $info['p_renew_options'] ) AND count( $info['p_renew_options'] ) )
{
foreach ( $info['p_renew_options'] as $currency => $options )
foreach ( $info['p_renew_options'] as $k => $options )
{
$newOptions = array(
'cost' => [],
'term' => $options['term'],
'unit' => $options['unit'],
'add' => isset( $options['add'] ) ? $options['add'] : false
'add' => $options['add'] ?? false
);
foreach ( $options['cost'] as $currency => $cost )
@@ -1112,7 +1112,7 @@ class Nexus extends Library
/* Discounts */
//@TODO
$productImages = isset( $info['p_images'] ) ? $info['p_images'] : NULL;
$productImages = $info['p_images'] ?? NULL;
unset( $info['p_images'] );
$package = array(
@@ -1178,7 +1178,7 @@ class Nexus extends Library
$default = 0;
foreach( $productImages as $image )
{
if ( ( isset( $image['data'] ) AND is_null( $image['data'] ) ) AND !is_null( $filePath ) )
if ( ( isset( $image['data'] ) AND empty( $image['data'] ) ) AND !is_null( $filePath ) )
{
$filedata = @file_get_contents( rtrim( $filePath, '/' ) . '/' . $image['filename'] );
unset( $filepath );
@@ -1267,12 +1267,12 @@ class Nexus extends Library
* @param string|NULL $filePath Path to images
* @return int|bool The ID of the newly inserted package, or FALSE on failure
*/
public function convertNexusSubscriptionPackage( $info, $filePath=NULL )
public function convertNexusSubscriptionPackage( array $info, ?string $filePath=NULL ) : bool|int
{
/* !Required: ID */
if ( !isset( $info['sp_id'] ) )
{
$this->software->app->log( 'nexus_package_missing_id', __METHOD__, \IPS\convert\App::LOG_WARNING );
$this->software->app->log( 'nexus_package_missing_id', __METHOD__, App::LOG_WARNING );
return FALSE;
}
@@ -1299,7 +1299,7 @@ class Nexus extends Library
/* !Required: Price */
if( !isset( $info['sp_price'] ) )
{
$this->software->app->log( 'nexus_subscription_missing_price', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['sp_id'] );
$this->software->app->log( 'nexus_subscription_missing_price', __METHOD__, App::LOG_WARNING, $info['sp_id'] );
return FALSE;
}
@@ -1321,7 +1321,7 @@ class Nexus extends Library
{
$newSecondaryGroups[] = $this->software->app->getLink( $group, 'core_groups', TRUE );
}
catch( \OutOfRangeException $ex ) { }
catch( OutOfRangeException $ex ) { }
}, $newSecondaryGroups );
}
@@ -1329,25 +1329,25 @@ class Nexus extends Library
{
try
{
$position = \IPS\Db::i()->select( 'MAX(p_position)', 'nexus_subscription_packages' )->first();
$position = Db::i()->select( 'MAX(p_position)', 'nexus_subscription_packages' )->first();
$info['sp_position'] = $position + 1;
}
catch( \UnderflowException $e ) { }
catch( UnderflowException $e ) { }
}
/* Base Price */
if( isset( $info['sp_price'] ) AND \count( $info['sp_price'] ) )
if( is_array( $info['sp_price'] ) AND count( $info['sp_price'] ) )
{
$newOptions = array(
'cost' => [],
'term' => $info['sp_price']['term'],
'unit' => $info['sp_price']['unit'],
'add' => isset( $info['sp_price']['add'] ) ? $info['sp_price']['add'] : false
'add' => $info['sp_price']['add'] ?? false
);
foreach ( $info['sp_price']['cost'] as $currency => $cost )
{
$price = new \IPS\nexus\Money( $cost, $currency );
$price = new Money( $cost, $currency );
$newOptions['cost'][ $currency ] = [ 'amount' => $price->amount, 'currency' => $currency ];
}
}
@@ -1356,25 +1356,25 @@ class Nexus extends Library
unset( $info['sp_price'] );
/* Renewal costs & terms */
if( isset( $info['sp_renew_options'] ) AND \count( $info['sp_renew_options'] ) )
if( isset( $info['sp_renew_options'] ) AND count( $info['sp_renew_options'] ) )
{
$newOptions = array(
'cost' => [],
'term' => $info['sp_renew_options']['term'],
'unit' => $info['sp_renew_options']['unit'],
'add' => isset( $info['sp_renew_options']['add'] ) ? $info['sp_renew_options']['add'] : false
'add' => $info['sp_renew_options']['add'] ?? false
);
foreach ( $info['sp_renew_options']['cost'] as $currency => $cost )
{
$price = new \IPS\nexus\Money( $cost, $currency );
$price = new Money( $cost, $currency );
$newOptions['cost'][ $currency ] = [ 'amount' => $price->amount, 'currency' => $currency ];
}
$info['sp_renew_options'] = json_encode( $newOptions );
}
$image = isset( $info['sp_image'] ) ? $info['sp_image'] : NULL;
$image = $info['sp_image'] ?? NULL;
unset( $info['sp_image'] );
$package = array(
@@ -1396,7 +1396,7 @@ class Nexus extends Library
/* Images */
if( $image )
{
if ( ( isset( $image['data'] ) AND \is_null( $image['data'] ) ) AND !\is_null( $filePath ) )
if ( ( isset( $image['data'] ) AND empty( $image['data'] ) ) AND !is_null( $filePath ) )
{
$filedata = @file_get_contents( rtrim( $filePath, '/' ) . '/' . $image['filename'] );
unset( $filepath );
@@ -1406,20 +1406,20 @@ class Nexus extends Library
{
try
{
$info['sp_image'] = (string) \IPS\File::create( 'nexus_Products', $image['filename'], $filedata );
$info['sp_image'] = (string) File::create( 'nexus_Products', $image['filename'], $filedata );
}
catch( \Exception $e ) {}
catch( Exception $e ) {}
}
}
/* Save Package Data */
$insertedId = \IPS\Db::i()->insert( 'nexus_member_subscription_packages', $this->_getValues( $package, $info ) );
$insertedId = Db::i()->insert( 'nexus_member_subscription_packages', $this->_getValues( $package, $info ) );
$originalId = $info['sp_id'];
unset( $info['sp_id'] );
/* Custom lang strings */
\IPS\Lang::saveCustom( 'nexus', "nexus_subs_{$insertedId}", $name );
\IPS\Lang::saveCustom( 'nexus', "nexus_subs_{$insertedId}_desc", $description );
Lang::saveCustom( 'nexus', "nexus_subs_{$insertedId}", $name );
Lang::saveCustom( 'nexus', "nexus_subs_{$insertedId}_desc", $description );
/* Add Link */
$this->software->app->addLink( $insertedId, $originalId, 'nexus_members_subs_pkg' );
@@ -1434,7 +1434,7 @@ class Nexus extends Library
* @param string $currency Invoice Currency
* @return int|bool The ID of the newly inserted invoice, or FALSE on failure
*/
public function convertNexusInvoice( $info, $currency )
public function convertNexusInvoice( array $info, string $currency ) : bool|int
{
/* !Required: ID */
if ( !isset( $info['i_id'] ) )
@@ -1535,7 +1535,7 @@ class Nexus extends Library
* @param string $currency Transaction Currency
* @return int|bool The ID of the newly inserted transaction, or FALSE on failure
*/
public function convertNexusTransaction( $info, $currency )
public function convertNexusTransaction( array $info, string $currency ) : bool|int
{
/* !Required: ID */
if ( !isset( $info['t_id'] ) )
@@ -1645,7 +1645,7 @@ class Nexus extends Library
* @param string $currency Transaction Currency
* @return int|bool The ID of the newly inserted purchase, or FALSE on failure
*/
public function convertNexusPurchase( $info, $currency )
public function convertNexusPurchase( array $info, string $currency ) : bool|int
{
/* !Required: ID */
if ( !isset( $info['ps_id'] ) )
@@ -1807,7 +1807,7 @@ class Nexus extends Library
* @param array $source User-supplied array
* @return array
*/
protected function _getValues( array $defaults, array $source )
protected function _getValues( array $defaults, array $source ) : array
{
array_walk( $defaults, function( &$value, $key, $source )
{
@@ -1823,10 +1823,10 @@ class Nexus extends Library
/**
* Check whether a given payment method is supported by Commerce
*
* @param $method
* @param string $method
* @return bool
*/
protected function _isPaymentMethodSupported( $method )
protected function _isPaymentMethodSupported( string $method ) : bool
{
$availableGateways = Gateway::gateways();
$methodKey = array_search( $method, array_keys( array_change_key_case( $availableGateways, CASE_LOWER ) ) );
+38 -37
View File
@@ -21,6 +21,7 @@ use IPS\convert\Software\Core\Vbulletin;
use IPS\convert\Software\Core\Vbulletin5;
use IPS\convert\Software\Core\Wordpress;
use IPS\Db;
use IPS\Db\Exception as DbException;
use IPS\Events\Event;
use IPS\Login as LoginClass;
use IPS\Login\Exception;
@@ -29,6 +30,7 @@ use IPS\Login\Handler\UsernamePasswordHandler;
use IPS\Member;
use IPS\Patterns\ActiveRecordIterator;
use IPS\Request;
use SoapClient;
use function count;
use function defined;
use function strlen;
@@ -75,7 +77,7 @@ class Login extends Handler
$member = new Member;
$member->email = $usernameOrEmail;
throw new Exception( Member::loggedIn()->language()->addToStack( 'login_err_no_account', FALSE, array() ), Exception::NO_ACCOUNT, NULL, $member );
throw new Exception( Member::loggedIn()->language()->addToStack( 'login_err_no_account', FALSE ), Exception::NO_ACCOUNT, NULL, $member );
}
/* Get member(s) */
@@ -101,7 +103,7 @@ class Login extends Handler
$member = new Member;
$member->email = $usernameOrEmail;
throw new Exception( Member::loggedIn()->language()->addToStack( 'login_err_no_account', FALSE, array() ), Exception::NO_ACCOUNT, NULL, $member );
throw new Exception( Member::loggedIn()->language()->addToStack( 'login_err_no_account', FALSE ), Exception::NO_ACCOUNT, NULL, $member );
}
/* Table switcher for new converters */
@@ -115,7 +117,7 @@ class Login extends Handler
}
}
}
catch( \IPS\Db\Exception $e )
catch( DbException $e )
{
/* Converter tables no longer exist */
if( $e->getCode() == 1146 )
@@ -125,13 +127,13 @@ class Login extends Handler
}
/* Still here? Throw a password incorrect exception */
throw new Exception( Member::loggedIn()->language()->addToStack( 'login_err_bad_password', FALSE, array() ), Exception::BAD_PASSWORD, NULL, isset( $member ) ? $member : NULL );
throw new Exception( Member::loggedIn()->language()->addToStack( 'login_err_bad_password', FALSE ), Exception::BAD_PASSWORD, NULL, $member ?? NULL );
}
/**
* @brief Convert app cache
*/
protected static $_apps;
protected static ?ActiveRecordIterator $_apps;
/**
* Authenticate
@@ -195,7 +197,7 @@ class Login extends Handler
$member->save();
Event::fire( 'onPassChange', $member, array( $password ) );
return $member;
return true;
}
}
@@ -231,7 +233,7 @@ class Login extends Handler
* @param object $newPassword New Password wrapped in an object that can be cast to a string so it doesn't show in any logs
* @return void
*/
public function changePassword( Member $member, $newPassword )
public function changePassword( Member $member, object $newPassword ) : void
{
$member->setLocalPassword( $newPassword );
$member->save();
@@ -255,7 +257,7 @@ class Login extends Handler
* @param string $password Password from form
* @return bool
*/
protected function aef( $member, $password )
protected function aef( Member $member, string $password ) : bool
{
if ( LoginClass::compareHashes( $member->conv_password, md5( $member->misc . $password ) ) )
{
@@ -274,7 +276,7 @@ class Login extends Handler
* @param string $password Password from form
* @return bool
*/
protected function bbpressstandalone( $member, $password )
protected function bbpressstandalone( Member $member, string $password ) : bool
{
return $this->bbpress( $member, $password );
}
@@ -286,7 +288,7 @@ class Login extends Handler
* @param string $password Password from form
* @return bool
*/
protected function bbpress( $member, $password )
protected function bbpress( Member $member, string $password ) : bool
{
$success = false;
$password = html_entity_decode( $password );
@@ -294,7 +296,7 @@ class Login extends Handler
if ( strlen( $hash ) == 32 )
{
$success = ( bool ) ( LoginClass::compareHashes( $member->conv_password, md5( $password ) ) );
$success = ( LoginClass::compareHashes( $member->conv_password, md5( $password ) ) );
}
// Nope, not md5.
@@ -332,7 +334,7 @@ class Login extends Handler
* @param string $password Password from form
* @return bool
*/
protected function bbpress23( $member, $password )
protected function bbpress23( Member $member, string $password ) : bool
{
return $this->bbpress( $member, $password );
}
@@ -344,7 +346,7 @@ class Login extends Handler
* @param string $password Password from form
* @return bool
*/
protected function cs( $member, $password )
protected function cs( Member $member, string $password ) : bool
{
$encodedHashPass = base64_encode( pack( "H*", sha1( base64_decode( $member->misc ) . $password ) ) );
@@ -365,7 +367,7 @@ class Login extends Handler
* @param string $password Password from form
* @return bool
*/
protected function csauth( $member, $password )
protected function csauth( Member $member, string $password ) : bool
{
$wsdl = 'https://internal.auth.com/Service.asmx?wsdl';
$dest = 'https://interal.auth.com/Service.asmx';
@@ -383,8 +385,7 @@ class Login extends Handler
case 'SUCCESS' :
return TRUE;
case 'WRONG_AUTH' :
return FALSE;
default :
default:
return FALSE;
}
}
@@ -401,7 +402,7 @@ class Login extends Handler
* @param string $password Password from form
* @return bool
*/
protected function discuz( $member, $password )
protected function discuz( Member $member, string $password ) : bool
{
if ( LoginClass::compareHashes( $member->conv_password, md5( md5( $password ) . $member->misc ) ) )
{
@@ -417,7 +418,7 @@ class Login extends Handler
* @param string $password Password from form
* @return bool
*/
protected function fudforum( $member, $password )
protected function fudforum( Member $member, string $password ) : bool
{
$success = false;
$single_md5_pass = md5( $password );
@@ -425,11 +426,11 @@ class Login extends Handler
if ( strlen( $hash ) == 40 )
{
$success = ( LoginClass::compareHashes( $member->conv_password, sha1( $member->misc . sha1( $password ) ) ) ) ? TRUE : FALSE;
$success = LoginClass::compareHashes( $member->conv_password, sha1( $member->misc . sha1( $password ) ) );
}
else
{
$success = ( LoginClass::compareHashes( $member->conv_password, $single_md5_pass ) ) ? TRUE : FALSE;
$success = LoginClass::compareHashes( $member->conv_password, $single_md5_pass );
}
return $success;
@@ -442,7 +443,7 @@ class Login extends Handler
* @param string $password Password from form
* @return bool
*/
protected function fusionbb( $member, $password )
protected function fusionbb( Member $member, string $password ) : bool
{
/* FusionBB Has multiple methods that can be used to check a hash, so we need to cycle through them */
@@ -474,7 +475,7 @@ class Login extends Handler
* @param string $password Password from form
* @return bool
*/
protected function ikonboard( $member, $password )
protected function ikonboard( Member $member, string $password ) : bool
{
if ( LoginClass::compareHashes( $member->conv_password, crypt( $password, $member->misc ) ) )
{
@@ -497,7 +498,7 @@ class Login extends Handler
* @param string $password Password from form
* @return bool
*/
protected function kunena( $member, $password )
protected function kunena( Member $member, string $password ) : bool
{
// Kunena authenticates using internal Joomla functions.
// This is required, however, if the member only converts from
@@ -512,7 +513,7 @@ class Login extends Handler
* @param string $password Password from form
* @return bool
*/
protected function phpbblegacy( $member, $password )
protected function phpbblegacy( Member $member, string $password ) : bool
{
return Phpbb::login( $member, $password );
}
@@ -524,7 +525,7 @@ class Login extends Handler
* @param string $password Password from form
* @return bool
*/
protected function vb51connect( $member, $password )
protected function vb51connect( Member $member, string $password ) : bool
{
return Vbulletin5::login( $member, $password );
}
@@ -536,7 +537,7 @@ class Login extends Handler
* @param string $password Password from form
* @return bool
*/
protected function vb5connect( $member, $password )
protected function vb5connect( Member $member, string $password ) : bool
{
return Vbulletin5::login( $member, $password );
}
@@ -548,7 +549,7 @@ class Login extends Handler
* @param string $password Password from form
* @return bool
*/
protected function vbulletinlegacy( $member, $password )
protected function vbulletinlegacy( Member $member, string $password ) : bool
{
return Vbulletin::login( $member, $password );
}
@@ -560,7 +561,7 @@ class Login extends Handler
* @param string $password Password from form
* @return bool
*/
protected function vbulletinlegacy36( $member, $password )
protected function vbulletinlegacy36( Member $member, string $password ) : bool
{
return Vbulletin::login( $member, $password );
}
@@ -572,7 +573,7 @@ class Login extends Handler
* @param string $password Password from form
* @return bool
*/
protected function smflegacy( $member, $password )
protected function smflegacy( Member $member, string $password ) : bool
{
if ( LoginClass::compareHashes( $member->conv_password, sha1( mb_strtolower( $member->name ) . $password ) ) )
{
@@ -591,7 +592,7 @@ class Login extends Handler
* @param string $password Password from form
* @return bool
*/
protected function telligentcs( $member, $password )
protected function telligentcs( Member $member, string $password ) : bool
{
return $this->cs( $member, $password );
}
@@ -603,7 +604,7 @@ class Login extends Handler
* @param string $password Password from form
* @return bool
*/
protected function woltlab( $member, $password )
protected function woltlab( Member $member, string $password ) : bool
{
$testHash = FALSE;
@@ -633,7 +634,7 @@ class Login extends Handler
* @param string $password Password from form
* @return bool
*/
protected function woltlablegacy( $member, $password )
protected function woltlablegacy( Member $member, string $password ) : bool
{
if ( LoginClass::compareHashes( $member->conv_password, sha1( $member->misc . sha1( $member->misc . sha1( $password ) ) ) ) )
{
@@ -652,9 +653,9 @@ class Login extends Handler
* @param string $password Password from form
* @return bool
*/
protected function phpfusion( $member, $password )
protected function phpfusion( Member $member, string $password ) : bool
{
return ( bool ) LoginClass::compareHashes( $member->conv_password, md5( md5( $password ) ) );
return LoginClass::compareHashes( $member->conv_password, md5( md5( $password ) ) );
}
/**
@@ -664,7 +665,7 @@ class Login extends Handler
* @param string $password Password from form
* @return bool
*/
protected function fluxbb( $member, $password )
protected function fluxbb( Member $member, string $password ) : bool
{
$success = false;
$hash = $member->conv_password;
@@ -682,7 +683,7 @@ class Login extends Handler
}
else
{
$success = ( LoginClass::compareHashes( $hash, md5( $password ) ) ) ? TRUE : FALSE;
$success = LoginClass::compareHashes( $hash, md5( $password ) );
}
return $success;
@@ -695,7 +696,7 @@ class Login extends Handler
* @param string $password Password from form
* @return bool
*/
protected function simplepress( $member, $password )
protected function simplepress( Member $member, string $password ) : bool
{
return Wordpress::login( $member, $password );
}
@@ -37,7 +37,7 @@ class HashCryptPrivate
* @param string $itoa64 Hash-lookup
* @return string password hash
*/
public function hashCryptPrivate( $password, $setting, &$itoa64 )
public function hashCryptPrivate( string $password, string $setting, string &$itoa64 ) : string
{
$output = '*';
@@ -101,11 +101,11 @@ class HashCryptPrivate
* Private function to encode phpBB3 hash
*
* @param string $input Input
* @param count $count Iteration
* @param int $count Iteration
* @param string $itoa64 Hash-lookup
* @return string phpbb3 password hash encoded bit
*/
protected function _hashEncode64($input, $count, &$itoa64)
protected function _hashEncode64( string $input, int $count, string &$itoa64) : string
{
$output = '';
$i = 0;
+83 -77
View File
@@ -18,6 +18,7 @@ use Exception;
use InvalidArgumentException;
use IPS\Data\Store;
use IPS\Db;
use IPS\Db\Exception as DbException;
use IPS\Db\Select;
use IPS\Http\Url;
use IPS\Log;
@@ -42,32 +43,37 @@ abstract class Software
/**
* @brief \IPS\convert\App instance
*/
public $app = NULL;
public ?App $app = NULL;
/**
* @brief \IPS\Db instance to the source application
*/
public $db = NULL;
public ?Db $db = NULL;
/**
* @brief Is UTF8
*/
public $isUtfEight = TRUE;
public bool $isUtfEight = TRUE;
/**
* @brief Flag to indicate the post data has been fixed during conversion, and we only need to use Legacy Parser
*/
public static $contentFixed = FALSE;
public static bool $contentFixed = FALSE;
/**
* @var Software|string|null
*/
public Software|string|null $parent = null;
/**
* Constructor
*
* @param App $app The application to reference for database and other information.
* @param bool $needDB If the database is needed or not.
* @param bool $needDB If the database is needed or not.
* @return void
* @throws InvalidArgumentException
*/
public function __construct(App $app, $needDB=TRUE )
public function __construct( App $app, bool $needDB=TRUE )
{
$this->app = $app;
@@ -125,7 +131,7 @@ abstract class Software
$this->db->set_charset( $this->app->db_charset );
}
}
catch( \IPS\Db\Exception $e )
catch( DbException $e )
{
throw new InvalidArgumentException( "Database Connection Failed: " . $e->getMessage() );
}
@@ -139,7 +145,7 @@ abstract class Software
* @param mixed $arguments Arguments to pass to the method
* @return mixed
*/
public function __call( $name, $arguments )
public function __call( string $name, mixed $arguments )
{
if ( method_exists( $this, 'convert' . $name ) )
{
@@ -162,7 +168,7 @@ abstract class Software
*
* @return array
*/
public static function software()
public static function software() : array
{
return array(
'core' => array(
@@ -236,10 +242,10 @@ abstract class Software
/**
* Software Name
*
* @return string
* @return string
* @throws BadMethodCallException
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
throw new BadMethodCallException( 'no_name' );
@@ -248,10 +254,10 @@ abstract class Software
/**
* Software Key
*
* @return string
* @return string
* @throws BadMethodCallException
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
throw new BadMethodCallException( 'no_key' );
@@ -260,9 +266,9 @@ abstract class Software
/**
* Requires Parent
*
* @return boolean
* @return bool
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return FALSE;
}
@@ -270,9 +276,9 @@ abstract class Software
/**
* Possible Parent Conversions
*
* @return NULL|array
* @return array|NULL
*/
public static function parents()
public static function parents(): ?array
{
return NULL;
}
@@ -280,9 +286,9 @@ abstract class Software
/**
* Uses Prefix
*
* @return bool
* @return bool
*/
public static function usesPrefix()
public static function usesPrefix(): bool
{
return TRUE;
}
@@ -290,10 +296,10 @@ abstract class Software
/**
* Content we can convert from this software.
*
* @return array|NULL
* @return array|NULL
* @throws BadMethodCallException
*/
public static function canConvert()
public static function canConvert(): ?array
{
/* Child classes must override this method */
throw new BadMethodCallException( 'nothing_to_convert' );
@@ -302,9 +308,9 @@ abstract class Software
/**
* Can we translate settings over to our Invision Community equivalents?
*
* @return boolean
* @return bool
*/
public static function canConvertSettings()
public static function canConvertSettings(): bool
{
return FALSE;
}
@@ -313,12 +319,12 @@ abstract class Software
* Settings Map
*
* @code
return array(
'source_setting_key' => array( 'ips_setting_key' );
* return array(
* 'source_setting_key' => array( 'ips_setting_key' );
* @endcode
* @return array
* @return array
*/
public function settingsMap()
public function settingsMap(): array
{
return array();
}
@@ -327,15 +333,15 @@ abstract class Software
* Settings Map List
*
* @code
return array(
'source_setting_key' => array(
'title' => 'Human Readable Name as presented in the source',
'value' => 'The value from the source',
);
* return array(
* 'source_setting_key' => array(
* 'title' => 'Human Readable Name as presented in the source',
* 'value' => 'The value from the source',
* );
* @endcode
* @return array
* @return array
*/
public function settingsMapList()
public function settingsMapList():array
{
return array();
}
@@ -343,9 +349,9 @@ abstract class Software
/**
* List of Conversion Methods that require more information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array();
}
@@ -353,24 +359,24 @@ abstract class Software
/**
* An array of steps which require more information. This method should return array like below if any steps require additional information. Otherwise, it should return NULL.
*
* @param string $method Conversion method
* @return array|NULL
* @param string $method Conversion method
* @return array|NULL
*
* @code
return array(
'convertAttachments' => array(
'upload_path' => array( // The key is the name of the field, or the first parameter of the helper class constructor.
'field_class' => 'IPS\\Helpers\\Form\\Text', // The form helper class for this field
'field_default' => NULL, // The default value for this field.
'field_required' => TRUE, // TRUE if this field is required.
'field_extra' => array(), // Array of extra data that would normally go in $options for the form helper.
'field_hint' => NULL, // A language key of hint text to display after the form (such as path to IPS Suite files). NULL for no additional text.
),
)
);
* return array(
* 'convertAttachments' => array(
* 'upload_path' => array( // The key is the name of the field, or the first parameter of the helper class constructor.
* 'field_class' => 'IPS\\Helpers\\Form\\Text', // The form helper class for this field
* 'field_default' => NULL, // The default value for this field.
* 'field_required' => TRUE, // TRUE if this field is required.
* 'field_extra' => array(), // Array of extra data that would normally go in $options for the form helper.
* 'field_hint' => NULL, // A language key of hint text to display after the form (such as path to IPS Suite files). NULL for no additional text.
* ),
* )
* );
* @endcode
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ):?array
{
return NULL;
}
@@ -378,9 +384,9 @@ abstract class Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return bool
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return FALSE;
}
@@ -388,13 +394,13 @@ abstract class Software
/**
* Count Source Rows for a specific step
*
* @param string $table The table containing the rows to count.
* @param array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @param string $table The table containing the rows to count.
* @param string|array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return int
* @throws Exception
*/
public function countRows( $table, $where=NULL, $recache=FALSE )
public function countRows( string $table, string|array|null $where=NULL, bool $recache=FALSE ): int
{
try
{
@@ -416,11 +422,11 @@ abstract class Software
/**
* Get Library Class
*
* @param string|NULL $library Specific library to fetch
* @param string|NULL $library Specific library to fetch
* @return Library
* @throws InvalidArgumentException
*/
public function getLibrary( $library=NULL )
public function getLibrary( ?string $library=NULL ): Library
{
$library = $library ?: $this->app->sw;
@@ -437,9 +443,9 @@ abstract class Software
/**
* Allows software to add additional menu row options
*
* @return array
* @return array
*/
public function extraMenuRows()
public function extraMenuRows(): array
{
return array();
}
@@ -447,9 +453,9 @@ abstract class Software
/**
* Returns a block of text, or a language string, that explains what the admin must do to start this conversion
*
* @return string|NULL
* @return string|NULL
*/
public static function getPreConversionInformation()
public static function getPreConversionInformation(): ?string
{
return NULL;
}
@@ -457,13 +463,13 @@ abstract class Software
/**
* Fetch Remote Data
*
* @param string $table The table to selected data from
* @param string $idColumn The ID column to sort on, when not using keys.
* @param string|array|NULL $where WHERE clause for specific data to fetch.
* @param string $what What to fetch
* @return Select An \IPS\Db\Select object that can be further manipulated if necessary (e.g. joins)
* @param string|array $table The table to selected data from
* @param string $idColumn The ID column to sort on, when not using keys.
* @param string|array|NULL $where WHERE clause for specific data to fetch.
* @param string $what What to fetch
* @return Select An \IPS\Db\Select object that can be further manipulated if necessary (e.g. joins)
*/
public function fetch( $table, $idColumn='id', $where=NULL, $what='*' )
public function fetch( string|array $table, string $idColumn='id', string|array|null $where=NULL, string $what='*' ): Select
{
$libraryClass = $this->getLibrary();
if ( $libraryClass::$usingKeys === FALSE )
@@ -500,9 +506,9 @@ abstract class Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
return array();
}
@@ -510,9 +516,9 @@ abstract class Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post The post
* @param string|null $className Content Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -526,7 +532,7 @@ abstract class Software
* @param Db $database Database connection
* @return array
*/
public static function getDatabaseCharsets( $database )
public static function getDatabaseCharsets( Db $database ) : array
{
$charsets = array();
$result = $database->query( "SHOW CHARACTER SET;" );
@@ -542,9 +548,9 @@ abstract class Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
return NULL;
}
@@ -12,38 +12,51 @@
namespace IPS\convert\Software\Blog;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use DomainException;
use InvalidArgumentException;
use IPS\Application;
use IPS\convert\App;
use IPS\convert\Library;
use IPS\convert\Software;
use IPS\Db;
use IPS\Db\Exception as DbException;
use IPS\Member;
use IPS\Task;
use UnderflowException;
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
class Invisioncommunity extends \IPS\convert\Software
class Invisioncommunity extends Software
{
/**
* @brief Whether the versions of IPS4 match
*/
public static $versionMatch = FALSE;
public static bool $versionMatch = FALSE;
/**
* @brief Whether the database has been required
*/
public static $dbNeeded = FALSE;
public static bool $dbNeeded = FALSE;
/**
* Constructor
*
* @param \IPS\convert\App $app The application to reference for database and other information.
* @param App $app The application to reference for database and other information.
* @param bool $needDB Establish a DB connection
* @return void
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
*/
public function __construct( \IPS\convert\App $app, $needDB=TRUE )
public function __construct( App $app, bool $needDB=TRUE )
{
/* Set filename obscuring flag */
\IPS\convert\Library::$obscureFilenames = FALSE;
Library::$obscureFilenames = FALSE;
$return = parent::__construct( $app, $needDB );
parent::__construct( $app, $needDB );
if( $needDB )
{
@@ -54,37 +67,35 @@ class Invisioncommunity extends \IPS\convert\Software
$version = $this->db->select( 'app_version', 'core_applications', array( 'app_directory=?', 'core' ) )->first();
/* We're matching against the human version since the long version can change with patches */
if ( $version == \IPS\Application::load( 'core' )->version )
if ( $version == Application::load( 'core' )->version )
{
static::$versionMatch = TRUE;
}
}
catch( \IPS\Db\Exception $e ) {}
catch( DbException $e ) {}
/* Get parent sauce */
$this->parent = $this->app->_parent->getSource();
}
return $return;
}
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return 'Invision Community (' . \IPS\Application::load( 'core' )->version . ')';
return 'Invision Community (' . Application::load( 'core' )->version . ')';
}
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "invisioncommunity";
@@ -93,9 +104,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -103,9 +114,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'invisioncommunity' ) );
}
@@ -113,10 +124,10 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Content we can convert from this software.
*
* @return array|NULL
* @return array|NULL
* @note NULL indicates this converter cannot be used yet, useful to move redirect scripts into the 4.x framework
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertBlogCategories' => array(
@@ -141,7 +152,7 @@ class Invisioncommunity extends \IPS\convert\Software
),
'convertAttachments' => array(
'table' => 'core_attachments_map',
'where' => array( \IPS\Db::i()->in( 'location_key', array( 'blog_Blogs', 'blog_Entries' ) ) )
'where' => array( Db::i()->in( 'location_key', array( 'blog_Blogs', 'blog_Entries' ) ) )
)
);
}
@@ -149,9 +160,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return FALSE;
}
@@ -159,9 +170,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Can we convert settings?
*
* @return boolean
* @return boolean
*/
public static function canConvertSettings()
public static function canConvertSettings(): bool
{
return FALSE;
}
@@ -169,9 +180,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Settings Map
*
* @return array
* @return array
*/
public function settingsMap()
public function settingsMap(): array
{
return array();
}
@@ -179,9 +190,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Settings Map Listing
*
* @return array
* @return array
*/
public function settingsMapList()
public function settingsMapList(): array
{
return array();
}
@@ -189,9 +200,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Returns a block of text, or a language string, that explains what the admin must do to start this conversion
*
* @return string|NULL
* @return string|NULL
*/
public static function getPreConversionInformation()
public static function getPreConversionInformation(): ?string
{
return NULL;
}
@@ -199,9 +210,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertAttachments'
@@ -211,26 +222,26 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Get More Information
*
* @param string $method Method name
* @return array
* @param string $method Method name
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
switch( $method )
{
case 'convertAttachments':
\IPS\Member::loggedIn()->language()->words["upload_path"] = \IPS\Member::loggedIn()->language()->addToStack( 'convert_invision_upload_input' );
\IPS\Member::loggedIn()->language()->words["upload_path_desc"] = \IPS\Member::loggedIn()->language()->addToStack( 'convert_invision_upload_input_desc' );
Member::loggedIn()->language()->words["upload_path"] = Member::loggedIn()->language()->addToStack( 'convert_invision_upload_input' );
Member::loggedIn()->language()->words["upload_path_desc"] = Member::loggedIn()->language()->addToStack( 'convert_invision_upload_input_desc' );
$return[ $method ] = array(
'upload_path' => array(
'field_class' => 'IPS\\Helpers\\Form\\Text',
'field_default' => isset( $this->parent->app->_session['more_info']['convertEmoticons']['upload_path'] ) ? $this->parent->app->_session['more_info']['convertEmoticons']['upload_path'] : NULL,
'field_default' => $this->parent->app->_session['more_info']['convertEmoticons']['upload_path'] ?? NULL,
'field_required' => TRUE,
'field_extra' => array(),
'field_hint' => \IPS\Member::loggedIn()->language()->addToStack('convert_invision_upload_path'),
'field_validation' => function( $value ) { if ( !@is_dir( $value ) ) { throw new \DomainException( 'path_invalid' ); } },
'field_hint' => Member::loggedIn()->language()->addToStack('convert_invision_upload_path'),
'field_validation' => function( $value ) { if ( !@is_dir( $value ) ) { throw new DomainException( 'path_invalid' ); } },
)
);
break;
@@ -242,36 +253,25 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Content Rebuilds */
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\blog\Entry\Category', 'count' => 0 ), 4, array( 'class' ) );
\IPS\Task::queue( 'convert', 'InvisionCommunityRebuildContent', array( 'app' => $this->app->app_id, 'link' => 'blog_entries', 'class' => 'IPS\blog\Entry' ), 2, array( 'app', 'link', 'class' ) );
\IPS\Task::queue( 'convert', 'InvisionCommunityRebuildContent', array( 'app' => $this->app->app_id, 'link' => 'blog_comments', 'class' => 'IPS\blog\Entry\Comment' ), 2, array( 'app', 'link', 'class' ) );
\IPS\Task::queue( 'convert', 'RebuildTagCache', array( 'app' => $this->app->app_id, 'link' => 'blog_entries', 'class' => 'IPS\blog\Entry' ), 3, array( 'app', 'link', 'class' ) );
Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\blog\Entry\Category', 'count' => 0 ), 4, array( 'class' ) );
Task::queue( 'convert', 'InvisionCommunityRebuildContent', array( 'app' => $this->app->app_id, 'link' => 'blog_entries', 'class' => 'IPS\blog\Entry' ), 2, array( 'app', 'link', 'class' ) );
Task::queue( 'convert', 'InvisionCommunityRebuildContent', array( 'app' => $this->app->app_id, 'link' => 'blog_comments', 'class' => 'IPS\blog\Entry\Comment' ), 2, array( 'app', 'link', 'class' ) );
Task::queue( 'convert', 'RebuildTagCache', array( 'app' => $this->app->app_id, 'link' => 'blog_entries', 'class' => 'IPS\blog\Entry' ), 3, array( 'app', 'link', 'class' ) );
return array( "f_blog_entries_rebuilding", "f_entry_comments_rebuilding", "f_blogs_recounting", "f_entry_tags_cache" );
}
/**
* Fix post data
*
* @param string raw post data
* @return string parsed post data
*/
public static function fixPostData( $post )
{
return $post;
}
/**
* Convert Blog Categories
*
* @return void
*/
public function convertBlogCategories()
public function convertBlogCategories() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'category_id' );
@@ -291,7 +291,7 @@ class Invisioncommunity extends \IPS\convert\Software
*
* @return void
*/
public function convertBlogs()
public function convertBlogs() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'blog_id' );
@@ -306,7 +306,7 @@ class Invisioncommunity extends \IPS\convert\Software
{
$socialgroup = iterator_to_array( $this->db->select( 'member_id', 'core_sys_social_group_members', array( "group_id=?", $row['blog_social_group'] ) ) );
}
catch( \UnderflowException ) { }
catch( UnderflowException ) { }
}
$cover = NULL;
@@ -333,7 +333,7 @@ class Invisioncommunity extends \IPS\convert\Software
*
* @return void
*/
public function convertBlogEntryCategories()
public function convertBlogEntryCategories() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'entry_category_id' );
@@ -350,7 +350,7 @@ class Invisioncommunity extends \IPS\convert\Software
*
* @return void
*/
public function convertBlogEntries()
public function convertBlogEntries() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'entry_id' );
@@ -387,7 +387,7 @@ class Invisioncommunity extends \IPS\convert\Software
$libraryClass->convertReputation( $rep );
}
$libraryClass->setLasyKeyValue( $row['entry_id'] );
$libraryClass->setLastKeyValue( $row['entry_id'] );
}
}
@@ -396,7 +396,7 @@ class Invisioncommunity extends \IPS\convert\Software
*
* @return void
*/
public function convertBlogComments()
public function convertBlogComments() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'comment_id' );
@@ -422,7 +422,7 @@ class Invisioncommunity extends \IPS\convert\Software
*
* @return void
*/
public function convertAttachments()
public function convertAttachments() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'attach_id' );
@@ -431,9 +431,9 @@ class Invisioncommunity extends \IPS\convert\Software
{
try
{
$attachmentMap = $this->db->select( '*', 'core_attachments_map', array( 'attachment_id=? AND ' . \IPS\Db::i()->in( 'location_key', array( 'blog_Blogs', 'blog_Entries' ) ), $row['attach_id'] ) )->first();
$attachmentMap = $this->db->select( '*', 'core_attachments_map', array( 'attachment_id=? AND ' . Db::i()->in( 'location_key', array( 'blog_Blogs', 'blog_Entries' ) ), $row['attach_id'] ) )->first();
}
catch( \UnderflowException $e )
catch( UnderflowException $e )
{
$libraryClass->setLastKeyValue( $row['attach_id'] );
continue;
@@ -45,12 +45,12 @@ class Vbulletin extends Software
/**
* @brief vBulletin 4 Stores all attachments under one table - this will store the content type for the blog app.
*/
protected static $entryContentType = NULL;
protected static mixed $entryContentType = NULL;
/**
* @brief The schematic for vB3 and vB4 is similar enough that we can make specific concessions in a single converter for either version.
*/
protected static $isLegacy = NULL;
protected static ?bool $isLegacy = NULL;
/**
* Constructor
@@ -60,9 +60,9 @@ class Vbulletin extends Software
* @return void
* @throws InvalidArgumentException
*/
public function __construct( App $app, $needDB=TRUE )
public function __construct( App $app, bool $needDB=TRUE )
{
$return = parent::__construct( $app, $needDB );
parent::__construct( $app, $needDB );
/* Is this vB3 or vB4? */
try
@@ -89,16 +89,14 @@ class Vbulletin extends Software
}
}
catch( Exception $e ) {}
return $return;
}
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "vBulletin Blog (3.8.x/4.x)";
@@ -107,9 +105,9 @@ class Vbulletin extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "vbulletin";
@@ -118,9 +116,9 @@ class Vbulletin extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
$attachmentTable = 'blog_attachment';
$attachmentWhere = NULL;
@@ -157,32 +155,30 @@ class Vbulletin extends Software
/**
* Count Source Rows for a specific step
*
* @param string $table The table containing the rows to count.
* @param array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @param string $table The table containing the rows to count.
* @param string|array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @throws \IPS\convert\Exception
*/
public function countRows( $table, $where=NULL, $recache=FALSE )
public function countRows( string $table, string|array|null $where=NULL, bool $recache=FALSE ): int
{
switch( $table )
{
default:
return parent::countRows( $table, $where );
break;
case 'blog_text':
return $this->db->select( 'COUNT(*)', 'blog_text', array( 'blogtextid NOT IN (' . (string) $this->db->select( 'firstblogtextid', 'blog' ) . ')' ) )->first();
break;
return $this->db->select( 'COUNT(*)', 'blog_text', array( 'blogtextid NOT IN (' . $this->db->select( 'firstblogtextid', 'blog' ) . ')' ) )->first();
}
}
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -190,9 +186,9 @@ class Vbulletin extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'vbulletin' ) );
}
@@ -200,9 +196,9 @@ class Vbulletin extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Content Rebuilds */
Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\blog\Entry\Category', 'count' => 0 ), 4, array( 'class' ) );
@@ -216,22 +212,22 @@ class Vbulletin extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post The post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
{
return CalendarClass::fixPostData( $post, $className, $contentId );
return VbulletinClass::fixPostData( $post, $className, $contentId );
}
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array( 'convertAttachments' );
}
@@ -239,10 +235,10 @@ class Vbulletin extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
switch( $method )
@@ -275,7 +271,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertBlogs()
public function convertBlogs() : void
{
$libraryClass = $this->getLibrary();
@@ -361,7 +357,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertBlogEntryCategories()
public function convertBlogEntryCategories() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'blogcategoryid' );
@@ -385,7 +381,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertBlogEntries()
public function convertBlogEntries() : void
{
$libraryClass = $this->getLibrary();
@@ -447,7 +443,7 @@ class Vbulletin extends Software
'entry_edit_time' => $edittime,
'entry_edit_name' => $editname,
'entry_edit_reason' => $editReason,
'entry_append_edit' => $edittime ? TRUE : FALSE,
'entry_append_edit' => (bool)$edittime,
'entry_ip_address' => long2ip( (int) $text['ipaddress'] ),
'entry_category_id' => $mainCategory
);
@@ -526,14 +522,14 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertBlogComments()
public function convertBlogComments() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'blogtextid' );
// Exclude text of blog entry from iterator
foreach( $this->fetch( 'blog_text', 'blogtextid', array( 'blogtextid NOT IN (' . (string) $this->db->select( 'firstblogtextid', 'blog' ) . ')' ) ) AS $comment )
foreach( $this->fetch( 'blog_text', 'blogtextid', array( 'blogtextid NOT IN (' . $this->db->select( 'firstblogtextid', 'blog' ) . ')' ) ) AS $comment )
{
$edittime = $editname = NULL;
try
@@ -583,7 +579,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertAttachments()
public function convertAttachments() : void
{
$libraryClass = $this->getLibrary();
@@ -679,8 +675,7 @@ class Vbulletin extends Software
Db::i()->update( 'blog_entries', array( 'entry_content' => $post ), array( "entry_id=?", $entry_id ) );
}
}
catch( UnderflowException $e ) {}
catch( OutOfRangeException $e ) {}
catch( UnderflowException|OutOfRangeException $e ) {}
}
$libraryClass->setLastKeyValue( $attachment['attachmentid'] );
@@ -690,9 +685,9 @@ class Vbulletin extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -12,38 +12,50 @@
namespace IPS\convert\Software\Calendar;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use DomainException;
use InvalidArgumentException;
use IPS\Application;
use IPS\convert\App;
use IPS\convert\Library;
use IPS\convert\Software;
use IPS\Db\Exception as DbException;
use IPS\Member;
use IPS\Task;
use UnderflowException;
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
class Invisioncommunity extends \IPS\convert\Software
class Invisioncommunity extends Software
{
/**
* @brief Whether the versions of IPS4 match
*/
public static $versionMatch = FALSE;
public static bool $versionMatch = FALSE;
/**
* @brief Whether the database has been required
*/
public static $dbNeeded = FALSE;
public static bool $dbNeeded = FALSE;
/**
* Constructor
*
* @param \IPS\convert\App $app The application to reference for database and other information.
* @param App $app The application to reference for database and other information.
* @param bool $needDB Establish a DB connection
* @return void
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
*/
public function __construct( \IPS\convert\App $app, $needDB=TRUE )
public function __construct( App $app, bool $needDB=TRUE )
{
/* Set filename obscuring flag */
\IPS\convert\Library::$obscureFilenames = FALSE;
Library::$obscureFilenames = FALSE;
$return = parent::__construct( $app, $needDB );
parent::__construct( $app, $needDB );
if( $needDB )
{
@@ -54,37 +66,35 @@ class Invisioncommunity extends \IPS\convert\Software
$version = $this->db->select( 'app_version', 'core_applications', array( 'app_directory=?', 'core' ) )->first();
/* We're matching against the human version since the long version can change with patches */
if ( $version == \IPS\Application::load( 'core' )->version )
if ( $version == Application::load( 'core' )->version )
{
static::$versionMatch = TRUE;
}
}
catch( \IPS\Db\Exception $e ) {}
catch( DbException $e ) {}
/* Get parent sauce */
$this->parent = $this->app->_parent->getSource();
}
return $return;
}
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return 'Invision Community (' . \IPS\Application::load( 'core' )->version . ')';
return 'Invision Community (' . Application::load( 'core' )->version . ')';
}
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "invisioncommunity";
@@ -93,9 +103,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -103,9 +113,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'invisioncommunity' ) );
}
@@ -113,10 +123,10 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Content we can convert from this software.
*
* @return array|NULL
* @return array|NULL
* @note NULL indicates this converter cannot be used yet, useful to move redirect scripts into the 4.x framework
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertCalendarCalendars' => array(
@@ -161,9 +171,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return FALSE;
}
@@ -171,9 +181,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Can we convert settings?
*
* @return boolean
* @return boolean
*/
public static function canConvertSettings()
public static function canConvertSettings(): bool
{
return FALSE;
}
@@ -181,9 +191,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Settings Map
*
* @return array
* @return array
*/
public function settingsMap()
public function settingsMap(): array
{
return array();
}
@@ -191,9 +201,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Settings Map Listing
*
* @return array
* @return array
*/
public function settingsMapList()
public function settingsMapList(): array
{
return array();
}
@@ -201,9 +211,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Returns a block of text, or a language string, that explains what the admin must do to start this conversion
*
* @return string|NULL
* @return string|NULL
*/
public static function getPreConversionInformation()
public static function getPreConversionInformation(): ?string
{
return NULL;
}
@@ -211,9 +221,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertAttachments'
@@ -223,26 +233,26 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Get More Information
*
* @param string $method Method name
* @return array
* @param string $method Method name
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
switch( $method )
{
case 'convertAttachments':
\IPS\Member::loggedIn()->language()->words["upload_path"] = \IPS\Member::loggedIn()->language()->addToStack( 'convert_invision_upload_input' );
\IPS\Member::loggedIn()->language()->words["upload_path_desc"] = \IPS\Member::loggedIn()->language()->addToStack( 'convert_invision_upload_input_desc' );
Member::loggedIn()->language()->words["upload_path"] = Member::loggedIn()->language()->addToStack( 'convert_invision_upload_input' );
Member::loggedIn()->language()->words["upload_path_desc"] = Member::loggedIn()->language()->addToStack( 'convert_invision_upload_input_desc' );
$return[ $method ] = array(
'upload_path' => array(
'field_class' => 'IPS\\Helpers\\Form\\Text',
'field_default' => isset( $this->parent->app->_session['more_info']['convertEmoticons']['upload_path'] ) ? $this->parent->app->_session['more_info']['convertEmoticons']['upload_path'] : NULL,
'field_default' => $this->parent->app->_session['more_info']['convertEmoticons']['upload_path'] ?? NULL,
'field_required' => TRUE,
'field_extra' => array(),
'field_hint' => \IPS\Member::loggedIn()->language()->addToStack('convert_invision_upload_path'),
'field_validation' => function( $value ) { if ( !@is_dir( $value ) ) { throw new \DomainException( 'path_invalid' ); } },
'field_hint' => Member::loggedIn()->language()->addToStack('convert_invision_upload_path'),
'field_validation' => function( $value ) { if ( !@is_dir( $value ) ) { throw new DomainException( 'path_invalid' ); } },
)
);
break;
@@ -254,36 +264,25 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Content Rebuilds */
\IPS\Task::queue( 'convert', 'InvisionCommunityRebuildContent', array( 'app' => $this->app->app_id, 'link' => 'calendar_events', 'class' => 'IPS\calendar\Event' ), 2, array( 'app', 'link', 'class' ) );
\IPS\Task::queue( 'convert', 'InvisionCommunityRebuildContent', array( 'app' => $this->app->app_id, 'link' => 'calendar_event_comments', 'class' => 'IPS\calendar\Event\Comment' ), 2, array( 'app', 'link', 'class' ) );
\IPS\Task::queue( 'convert', 'InvisionCommunityRebuildContent', array( 'app' => $this->app->app_id, 'link' => 'calendar_event_reviews', 'class' => 'IPS\calendar\Event\Review' ), 2, array( 'app', 'link', 'class' ) );
\IPS\Task::queue( 'core', 'RebuildItemCounts', array( 'class' => 'IPS\calendar\Event' ), 3, array( 'class' ) );
Task::queue( 'convert', 'InvisionCommunityRebuildContent', array( 'app' => $this->app->app_id, 'link' => 'calendar_events', 'class' => 'IPS\calendar\Event' ), 2, array( 'app', 'link', 'class' ) );
Task::queue( 'convert', 'InvisionCommunityRebuildContent', array( 'app' => $this->app->app_id, 'link' => 'calendar_event_comments', 'class' => 'IPS\calendar\Event\Comment' ), 2, array( 'app', 'link', 'class' ) );
Task::queue( 'convert', 'InvisionCommunityRebuildContent', array( 'app' => $this->app->app_id, 'link' => 'calendar_event_reviews', 'class' => 'IPS\calendar\Event\Review' ), 2, array( 'app', 'link', 'class' ) );
Task::queue( 'core', 'RebuildItemCounts', array( 'class' => 'IPS\calendar\Event' ), 3, array( 'class' ) );
return array( "f_rebuild_events", "f_recount_calendar" );
}
/**
* Fix post data
*
* @param string raw post data
* @return string parsed post data
*/
public static function fixPostData( $post )
{
return $post;
}
/**
* Convert Calendars
*
* @return void
*/
public function convertCalendarCalendars()
public function convertCalendarCalendars() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'cal_id' );
@@ -313,7 +312,7 @@ class Invisioncommunity extends \IPS\convert\Software
*
* @return void
*/
public function convertCalendarVanues()
public function convertCalendarVanues() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'venue_id' );
@@ -331,7 +330,7 @@ class Invisioncommunity extends \IPS\convert\Software
*
* @return void
*/
public function convertCalendarEvents()
public function convertCalendarEvents() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'event_id' );
@@ -376,7 +375,7 @@ class Invisioncommunity extends \IPS\convert\Software
*
* @return void
*/
public function convertCalendarComments()
public function convertCalendarComments() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'comment_id' );
@@ -402,7 +401,7 @@ class Invisioncommunity extends \IPS\convert\Software
*
* @return void
*/
public function convertCalendarReviews()
public function convertCalendarReviews() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'review_id' );
@@ -428,7 +427,7 @@ class Invisioncommunity extends \IPS\convert\Software
*
* @return void
*/
public function convertCalendarReminders()
public function convertCalendarReminders() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'reminder_id' );
@@ -446,7 +445,7 @@ class Invisioncommunity extends \IPS\convert\Software
*
* return void
*/
public function convertCalendarRsvps()
public function convertCalendarRsvps() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'rsvp_id' );
@@ -464,7 +463,7 @@ class Invisioncommunity extends \IPS\convert\Software
*
* @return void
*/
public function convertCalendarFeeds()
public function convertCalendarFeeds() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'feed_id' );
@@ -482,7 +481,7 @@ class Invisioncommunity extends \IPS\convert\Software
*
* @return void
*/
public function convertAttachments()
public function convertAttachments() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'attach_id' );
@@ -493,7 +492,7 @@ class Invisioncommunity extends \IPS\convert\Software
{
$attachmentMap = $this->db->select( '*', 'core_attachments_map', array( 'attachment_id=? AND location_key=?', $row['attach_id'], 'calendar_Calendar' ) )->first();
}
catch( \UnderflowException $e )
catch( UnderflowException $e )
{
$libraryClass->setLastKeyValue( $row['attach_id'] );
continue;
@@ -33,9 +33,9 @@ class Mybb extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "MyBB 1.8.x";
@@ -44,9 +44,9 @@ class Mybb extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "mybb";
@@ -55,9 +55,9 @@ class Mybb extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertCalendarCalendars' => array(
@@ -74,9 +74,9 @@ class Mybb extends Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -84,9 +84,9 @@ class Mybb extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'mybb' ) );
}
@@ -94,9 +94,9 @@ class Mybb extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Content Rebuilds */
Task::queue( 'convert', 'RebuildContent', array( 'app' => $this->app->app_id, 'link' => 'calendar_events', 'class' => 'IPS\calendar\Event' ), 2, array( 'app', 'link', 'class' ) );
@@ -110,7 +110,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertCalendarCalendars()
public function convertCalendarCalendars() : void
{
$libraryClass = $this->getLibrary();
@@ -133,7 +133,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertCalendarEvents()
public function convertCalendarEvents() : void
{
$libraryClass = $this->getLibrary();
@@ -33,9 +33,9 @@ class Vbulletin extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "vBulletin Calendar (3.8.x/4.x)";
@@ -44,9 +44,9 @@ class Vbulletin extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "vbulletin";
@@ -55,9 +55,9 @@ class Vbulletin extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertCalendarCalendars'=> array(
@@ -74,9 +74,9 @@ class Vbulletin extends Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -84,9 +84,9 @@ class Vbulletin extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'vbulletin' ) );
}
@@ -94,9 +94,9 @@ class Vbulletin extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Content Rebuilds */
Task::queue( 'convert', 'RebuildContent', array( 'app' => $this->app->app_id, 'link' => 'calendar_events', 'class' => 'IPS\calendar\Event' ), 2, array( 'app', 'link', 'class' ) );
@@ -108,9 +108,9 @@ class Vbulletin extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post The post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -123,7 +123,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertCalendarCalendars()
public function convertCalendarCalendars() : void
{
$libraryClass = $this->getLibrary();
@@ -147,7 +147,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertCalendarEvents()
public function convertCalendarEvents() : void
{
$libraryClass = $this->getLibrary();
@@ -33,9 +33,9 @@ class Joomla extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "Joomla";
@@ -44,9 +44,9 @@ class Joomla extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "joomla";
@@ -55,9 +55,9 @@ class Joomla extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertCmsDatabases' => array(
@@ -78,32 +78,30 @@ class Joomla extends Software
/**
* Count Source Rows for a specific step
*
* @param string $table The table containing the rows to count.
* @param array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @param string $table The table containing the rows to count.
* @param string|array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @throws \IPS\convert\Exception
*/
public function countRows( $table, $where=NULL, $recache=FALSE )
public function countRows( string $table, string|array|null $where=NULL, bool $recache=FALSE ): int
{
switch( $table )
{
case 'cms_database':
return 1;
break;
default:
return parent::countRows( $table, $where, $recache );
break;
}
}
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -111,9 +109,9 @@ class Joomla extends Software
/**
* Requires Parent?
*
* @return bool
* @return bool
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -121,9 +119,9 @@ class Joomla extends Software
/**
* Available Parents
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'joomla' ) );
}
@@ -131,9 +129,9 @@ class Joomla extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
try
{
@@ -154,7 +152,7 @@ class Joomla extends Software
*
* @return void
*/
public function convertCmsDatabases()
public function convertCmsDatabases() : void
{
$libraryClass = $this->getLibrary();
@@ -198,13 +196,13 @@ class Joomla extends Software
*
* @return void
*/
public function convertCmsDatabaseCategories()
public function convertCmsDatabaseCategories() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'id' );
foreach( $this->fetch( 'categories', 'id' ) as $row )
foreach( $this->fetch( 'categories' ) as $row )
{
$info = array(
'category_id' => $row['id'],
@@ -225,13 +223,13 @@ class Joomla extends Software
*
* @return void
*/
public function convertCmsDatabaseRecords()
public function convertCmsDatabaseRecords() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'id' );
foreach( $this->fetch( 'content', 'id' ) as $row )
foreach( $this->fetch( 'content' ) as $row )
{
/* Set the basic details */
$info = array(
@@ -43,19 +43,19 @@ class Vbulletin extends Software
/**
* @brief The schematic for vB3 and vB4 is similar enough that we can make specific concessions in a single converter for either version.
*/
protected static $isLegacy = NULL;
protected static ?bool $isLegacy = NULL;
/**
* @brief Cached article content type
*/
protected static $_articleContentType = NULL;
protected static mixed $_articleContentType = NULL;
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "vBulletin CMS (4.x only)";
@@ -64,9 +64,9 @@ class Vbulletin extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "vbulletin";
@@ -80,9 +80,9 @@ class Vbulletin extends Software
* @return void
* @throws InvalidArgumentException
*/
public function __construct( App $app, $needDB=TRUE )
public function __construct( App $app, bool $needDB=TRUE )
{
$return = parent::__construct( $app, $needDB );
parent::__construct( $app, $needDB );
/* Is this vB3 or vB4? */
try
@@ -113,19 +113,16 @@ class Vbulletin extends Software
}
catch( \Exception $e ) {}
return $return;
}
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
$return = array(
return array(
'convertCmsBlocks' => array(
'table' => 'cms_widget',
'where' => NULL,
@@ -151,20 +148,18 @@ class Vbulletin extends Software
'where' => array( "contenttypeid=?", static::$_articleContentType )
)
);
return $return;
}
/**
* Count Source Rows for a specific step
*
* @param string $table The table containing the rows to count.
* @param array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @param string $table The table containing the rows to count.
* @param string|array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @throws \IPS\convert\Exception
*/
public function countRows( $table, $where=NULL, $recache=FALSE )
public function countRows( string $table, string|array|null $where=NULL, bool $recache=FALSE ): int
{
switch( $table )
{
@@ -182,24 +177,22 @@ class Vbulletin extends Software
{
throw new \IPS\convert\Exception( sprintf( Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
}
break;
case 'page':
case 'database':
return 1;
break;
default:
return parent::countRows( $table, $where, $recache );
break;
}
}
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -207,9 +200,9 @@ class Vbulletin extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'vbulletin' ) );
}
@@ -217,9 +210,9 @@ class Vbulletin extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -233,7 +226,7 @@ class Vbulletin extends Software
* @param string $key The setting key
* @return mixed
*/
protected function _setting( $key )
protected function _setting( string $key ) : mixed
{
if ( isset( $this->settingsCache[$key] ) )
{
@@ -267,7 +260,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertCmsBlocks()
public function convertCmsBlocks() : void
{
$libraryClass = $this->getLibrary();
@@ -326,7 +319,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertCmsPages()
public function convertCmsPages() : void
{
$this->getLibrary()->convertCmsPage( array(
'page_id' => 1,
@@ -341,7 +334,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertCmsDatabases()
public function convertCmsDatabases() : void
{
$convertedForums = FALSE;
try
@@ -402,7 +395,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertCmsDatabaseCategories()
public function convertCmsDatabaseCategories() : void
{
$libraryClass = $this->getLibrary();
@@ -428,7 +421,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertCmsDatabaseRecords()
public function convertCmsDatabaseRecords() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'contentid' );
@@ -584,9 +577,9 @@ class Vbulletin extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
foreach( Db::i()->select( 'ipb_id', 'convert_link', array( 'type=? AND app=?', 'cms_databases', $this->app->app_id ) ) as $database )
{
@@ -609,7 +602,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertAttachments()
public function convertAttachments() : void
{
$libraryClass = $this->getLibrary();
@@ -712,9 +705,9 @@ class Vbulletin extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array( 'convertAttachments' );
}
@@ -722,10 +715,10 @@ class Vbulletin extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
switch( $method )
@@ -14,11 +14,15 @@ namespace IPS\convert\Software\Cms;
/* To prevent PHP errors (extending class does not exist) revealing path */
use DomainException;
use DOMXPath;
use IPS\convert\Software;
use IPS\convert\Software\Exception;
use IPS\DateTime;
use IPS\Db;
use IPS\Member;
use IPS\Task;
use IPS\Text\DOMParser;
use IPS\Xml\DOMDocument;
use OutOfRangeException;
use UnderflowException;
use function defined;
@@ -30,16 +34,16 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
}
/**
* Wordpress Pages Converter
* WordPress Pages Converter
*/
class Wordpress extends Software
{
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "WordPress (5.x)";
@@ -48,9 +52,9 @@ class Wordpress extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "wordpress";
@@ -59,9 +63,9 @@ class Wordpress extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertCmsPages' => array(
@@ -94,32 +98,30 @@ class Wordpress extends Software
/**
* Count Source Rows for a specific step
*
* @param string $table The table containing the rows to count.
* @param array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @param string $table The table containing the rows to count.
* @param string|array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @throws \IPS\convert\Exception
*/
public function countRows( $table, $where=NULL, $recache=FALSE )
public function countRows( string $table, string|array|null $where=NULL, bool $recache=FALSE ): int
{
switch( $table )
{
case 'cms_database':
return 1;
break;
default:
return parent::countRows( $table, $where, $recache );
break;
}
}
/**
* Requires Parent?
*
* @return bool
* @return bool
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -127,9 +129,9 @@ class Wordpress extends Software
/**
* Available Parents
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'wordpress', 'wpforo' ) );
}
@@ -137,9 +139,9 @@ class Wordpress extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertAttachments',
@@ -150,10 +152,10 @@ class Wordpress extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
@@ -188,9 +190,9 @@ class Wordpress extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
try
{
@@ -215,7 +217,7 @@ class Wordpress extends Software
*
* @return void
*/
public function convertCmsPages()
public function convertCmsPages() : void
{
$libraryClass = $this->getLibrary();
@@ -239,7 +241,7 @@ class Wordpress extends Software
*
* @return void
*/
public function convertCmsDatabases()
public function convertCmsDatabases() : void
{
$libraryClass = $this->getLibrary();
@@ -283,7 +285,7 @@ class Wordpress extends Software
*
* @return void
*/
public function convertCmsDatabaseCategories()
public function convertCmsDatabaseCategories() : void
{
$libraryClass = $this->getLibrary();
@@ -309,7 +311,7 @@ class Wordpress extends Software
*
* @return void
*/
public function convertCmsDatabaseRecords()
public function convertCmsDatabaseRecords() : void
{
$libraryClass = $this->getLibrary();
@@ -435,7 +437,7 @@ class Wordpress extends Software
*
* @return void
*/
public function convertCmsDatabaseComments()
public function convertCmsDatabaseComments() : void
{
$libraryClass = $this->getLibrary();
@@ -475,14 +477,14 @@ class Wordpress extends Software
}
}
protected $postContent = [];
protected array $postContent = [];
/**
* Convert attachments
*
* @return void
*/
public function convertAttachments()
public function convertAttachments() : void
{
$database = $this->app->getLink( 1, 'cms_databases' );
$contentField = $this->app->getLink( 2, 'cms_database_fields' );
@@ -499,7 +501,7 @@ class Wordpress extends Software
$libraryClass->setLastKeyValue( $row['ID'] );
continue;
}
catch( \UnderflowException $e ) {}
catch( UnderflowException $e ) {}
try
{
@@ -507,10 +509,10 @@ class Wordpress extends Software
$postId = $this->app->getLink( $wpPost['ID'], "cms_custom_database_" . $database );
if( !isset( $this->postContent[ $postId ] ) )
{
$this->postContent[ $postId ] = \IPS\Db::i()->select( 'field_' . $contentField, 'cms_custom_database_' . $database, array( "primary_id_field=?", $postId ) )->first();
$this->postContent[ $postId ] = Db::i()->select( 'field_' . $contentField, 'cms_custom_database_' . $database, array( "primary_id_field=?", $postId ) )->first();
}
}
catch( \UnderflowException | \OutOfRangeException $e )
catch( UnderflowException|OutOfRangeException $e )
{
$libraryClass->setLastKeyValue( $row['ID'] );
continue;
@@ -541,9 +543,9 @@ class Wordpress extends Software
if( $attachId !== FALSE AND mb_stristr( $this->postContent[ $postId ], $meta['_wp_attached_file'] ) )
{
$dom = new \IPS\Xml\DOMDocument( '1.0', 'UTF-8' );
$dom->loadHTML( \IPS\Xml\DOMDocument::wrapHtml( $this->postContent[ $postId ] ) );
$xPath = new \DOMXPath( $dom );
$dom = new DOMDocument( '1.0', 'UTF-8' );
$dom->loadHTML( DOMDocument::wrapHtml( $this->postContent[ $postId ] ) );
$xPath = new DOMXPath( $dom );
foreach ( $xPath->query( "//img[contains(@src, '" . $meta['_wp_attached_file'] ."')] | //a[contains(@href, '" . $meta['_wp_attached_file'] ."')]" ) as $tag )
{
@@ -552,7 +554,7 @@ class Wordpress extends Software
}
/* Get DOMDocument output */
$content = \IPS\Text\DOMParser::getDocumentBodyContents( $dom );
$content = DOMParser::getDocumentBodyContents( $dom );
/* Replace file storage tags */
$content = preg_replace( '/&lt;fileStore\.([\d\w\_]+?)&gt;/i', '<fileStore.$1>', $content );
@@ -567,7 +569,7 @@ class Wordpress extends Software
/* Do the updates */
foreach( $this->postContent as $pid => $content )
{
\IPS\Db::i()->update( 'cms_custom_database_' . $database, array( 'field_' . $contentField => $content ), array( 'primary_id_field=?', $pid ) );
Db::i()->update( 'cms_custom_database_' . $database, array( 'field_' . $contentField => $content ), array( 'primary_id_field=?', $pid ) );
}
}
}
@@ -31,9 +31,9 @@ class Xenforo extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "XenForo Page Nodes (1.5.x/2.0.x/2.1.x/2.2.x)";
@@ -42,9 +42,9 @@ class Xenforo extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "xenforo";
@@ -53,9 +53,9 @@ class Xenforo extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertCmsPages' => array(
@@ -68,9 +68,9 @@ class Xenforo extends Software
/**
* Uses Prefix
*
* @return bool
* @return bool
*/
public static function usesPrefix()
public static function usesPrefix(): bool
{
return FALSE;
}
@@ -78,9 +78,9 @@ class Xenforo extends Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -88,9 +88,9 @@ class Xenforo extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'xenforo' ) );
}
@@ -100,7 +100,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertCmsPages()
public function convertCmsPages() : void
{
$libraryClass = $this->getLibrary();
@@ -36,19 +36,19 @@ class Xenfororm extends Software
/**
* @brief The similarities between XF1 and XF2 are close enough that we can use the same converter
*/
public static $isLegacy = NULL;
public static ?bool $isLegacy = NULL;
/**
* @brief XF2 Has prefixes on RM tables
*/
public static $tablePrefix = '';
public static string $tablePrefix = '';
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "XenForo Resource Manager Articles (1.5.x/2.0.x/2.1.x/2.2.x)";
@@ -62,9 +62,9 @@ class Xenfororm extends Software
* @return void
* @throws InvalidArgumentException
*/
public function __construct( App $app, $needDB=TRUE )
public function __construct( App $app, bool $needDB=TRUE )
{
$return = parent::__construct( $app, $needDB );
parent::__construct( $app, $needDB );
if ( $needDB )
{
@@ -88,16 +88,14 @@ class Xenfororm extends Software
}
catch( \Exception $e ) {} # If we can't query, we won't be able to do anything anyway
}
return $return;
}
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "xenfororm";
@@ -106,9 +104,9 @@ class Xenfororm extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertCmsDatabases' => array(
@@ -129,32 +127,30 @@ class Xenfororm extends Software
/**
* Count Source Rows for a specific step
*
* @param string $table The table containing the rows to count.
* @param array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @param string $table The table containing the rows to count.
* @param string|array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @throws \IPS\convert\Exception
*/
public function countRows( $table, $where=NULL, $recache=FALSE )
public function countRows( string $table, string|array|null $where=NULL, bool $recache=FALSE ): int
{
switch( $table )
{
case 'cms_databases':
return 1;
break;
default:
return parent::countRows( $table, $where, $recache );
break;
}
}
/**
* Uses Prefix
*
* @return bool
* @return bool
*/
public static function usesPrefix()
public static function usesPrefix(): bool
{
return FALSE;
}
@@ -162,9 +158,9 @@ class Xenfororm extends Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -172,9 +168,9 @@ class Xenfororm extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'xenforo' ) );
}
@@ -184,7 +180,7 @@ class Xenfororm extends Software
*
* @return void
*/
public function convertCmsDatabases()
public function convertCmsDatabases() : void
{
$libraryClass = $this->getLibrary();
@@ -235,7 +231,7 @@ class Xenfororm extends Software
*
* @return void
*/
public function convertCmsDatabaseCategories()
public function convertCmsDatabaseCategories() : void
{
$libraryClass = $this->getLibrary();
@@ -254,7 +250,7 @@ class Xenfororm extends Software
$info = array(
'category_id' => $row['resource_category_id'],
'category_database_id' => 1,
'category_name' => isset( $row['category_title'] ) ? $row['category_title'] : $row['title'],
'category_name' => $row['category_title'] ?? $row['title'],
'category_parent_id' => $row['parent_category_id'],
'category_position' => $row['display_order'],
'category_fields' => array( 'resource_title', 'resource_tagline', 'resource_content' ),
@@ -271,7 +267,7 @@ class Xenfororm extends Software
*
* @return void
*/
public function convertCmsDatabaseRecords()
public function convertCmsDatabaseRecords() : void
{
$libraryClass = $this->getLibrary();
@@ -319,9 +315,9 @@ class Xenfororm extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
try
{
@@ -49,9 +49,9 @@ class Expressionengine extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
return "Expression Engine";
}
@@ -59,9 +59,9 @@ class Expressionengine extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
return 'expressionengine';
}
@@ -69,9 +69,9 @@ class Expressionengine extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertProfileFields' => array(
@@ -109,9 +109,9 @@ class Expressionengine extends Software
/**
* Allows software to add additional menu row options
*
* @return array
* @return array
*/
public function extraMenuRows()
public function extraMenuRows(): array
{
$rows = array();
$rows['convertPmAttachments'] = array(
@@ -130,9 +130,9 @@ class Expressionengine extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -140,9 +140,9 @@ class Expressionengine extends Software
/**
* Can we convert settings?
*
* @return boolean
* @return boolean
*/
public static function canConvertSettings()
public static function canConvertSettings(): bool
{
return FALSE;
}
@@ -150,9 +150,9 @@ class Expressionengine extends Software
/**
* List of Conversion Methods that require more information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertAttachments',
@@ -166,9 +166,9 @@ class Expressionengine extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -179,10 +179,10 @@ class Expressionengine extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
@@ -311,9 +311,9 @@ class Expressionengine extends Software
/**
* Finish
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -344,7 +344,7 @@ class Expressionengine extends Software
*
* @return void
*/
public function convertAttachments()
public function convertAttachments() : void
{
$libraryClass = $this->getLibrary();
@@ -389,8 +389,7 @@ class Expressionengine extends Software
Db::i()->update( 'core_members', array( 'signature' => $signature ), array( "member_id=?", $memberId ) );
}
}
catch( UnderflowException $e ) {}
catch( OutOfRangeException $e ) {}
catch( UnderflowException|OutOfRangeException $e ) {}
$libraryClass->setLastKeyValue( $row['member_id'] );
}
@@ -401,7 +400,7 @@ class Expressionengine extends Software
*
* @return void
*/
public function convertProfileFields()
public function convertProfileFields() : void
{
$libraryClass = $this->getLibrary();
@@ -432,7 +431,7 @@ class Expressionengine extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -473,7 +472,7 @@ class Expressionengine extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
@@ -579,7 +578,7 @@ class Expressionengine extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
@@ -635,7 +634,7 @@ class Expressionengine extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
@@ -662,7 +661,7 @@ class Expressionengine extends Software
*
* @return void
*/
public function convertPmAttachments()
public function convertPmAttachments() : void
{
$libraryClass = $this->getLibrary();
@@ -708,8 +707,7 @@ class Expressionengine extends Software
Db::i()->update( 'core_message_posts', array( 'msg_post' => $message ), array( "msg_id=?", $pmId ) );
}
}
catch( UnderflowException $e ) {}
catch( OutOfRangeException $e ) {}
catch( UnderflowException|OutOfRangeException $e ) {}
$libraryClass->setLastKeyValue( $row['attachment_id'] );
}
@@ -718,9 +716,9 @@ class Expressionengine extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
/* If we can't access profiles, don't bother trying to redirect */
if( !Member::loggedIn()->canAccessModule( Module::get( 'core', 'members' ) ) )
@@ -753,7 +751,7 @@ class Expressionengine extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
$length = strlen( $member->conv_password );
$providedHash = FALSE;
@@ -778,6 +776,6 @@ class Expressionengine extends Software
break;
}
return ( Login::compareHashes( $member->conv_password, $providedHash ) ) ? TRUE : FALSE;
return Login::compareHashes( $member->conv_password, $providedHash );
}
}
@@ -26,6 +26,7 @@ use IPS\convert\Software;
use IPS\Data\Cache;
use IPS\Data\Store;
use IPS\Db;
use IPS\Db\Exception as DbException;
use IPS\File;
use IPS\Http\Url;
use IPS\Member;
@@ -52,12 +53,12 @@ class Invisioncommunity extends Software
/**
* @brief Whether the versions of IPS4 match
*/
public static $versionMatch = FALSE;
public static bool $versionMatch = FALSE;
/**
* @brief Whether the database has been required
*/
public static $dbNeeded = FALSE;
public static bool $dbNeeded = FALSE;
/**
* Constructor
@@ -67,12 +68,12 @@ class Invisioncommunity extends Software
* @return void
* @throws InvalidArgumentException
*/
public function __construct( App $app, $needDB=TRUE )
public function __construct( App $app, bool $needDB=TRUE )
{
/* Set filename obscuring flag */
Library::$obscureFilenames = FALSE;
$return = parent::__construct( $app, $needDB );
parent::__construct( $app, $needDB );
if( $needDB )
{
@@ -88,18 +89,16 @@ class Invisioncommunity extends Software
static::$versionMatch = TRUE;
}
}
catch( \IPS\Db\Exception $e ) {}
catch( DbException $e ) {}
}
return $return;
}
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return 'Invision Community (' . Application::load( 'core' )->version . ')';
@@ -108,9 +107,9 @@ class Invisioncommunity extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "invisioncommunity";
@@ -119,9 +118,9 @@ class Invisioncommunity extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
if( !static::$versionMatch AND static::$dbNeeded )
{
@@ -239,9 +238,9 @@ class Invisioncommunity extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -249,9 +248,9 @@ class Invisioncommunity extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertEmoticons',
@@ -268,10 +267,10 @@ class Invisioncommunity extends Software
/**
* Get More Information
*
* @param string $method Method name
* @return array
* @param string $method Method name
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
@@ -288,7 +287,7 @@ class Invisioncommunity extends Software
$return[ $method ] = array(
'upload_path' => array(
'field_class' => 'IPS\\Helpers\\Form\\Text',
'field_default' => isset( $this->app->_session['more_info']['convertEmoticons']['upload_path'] ) ? $this->app->_session['more_info']['convertEmoticons']['upload_path'] : NULL,
'field_default' => $this->app->_session['more_info']['convertEmoticons']['upload_path'] ?? NULL,
'field_required' => TRUE,
'field_extra' => array(),
'field_hint' => Member::loggedIn()->language()->addToStack('convert_invision_upload_path'),
@@ -365,9 +364,9 @@ class Invisioncommunity extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -450,7 +449,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertAcronyms()
public function convertAcronyms() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'a_id' );
@@ -471,7 +470,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertEmoticons()
public function convertEmoticons() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'id' );
@@ -491,14 +490,14 @@ class Invisioncommunity extends Software
/* Remap rows */
$name = explode( '/', $row['image'] );
$row['filename'] = isset( $name[1] ) ? $name[1] : $name[0];
$row['filename'] = $name[1] ?? $name[0];
$path = ( isset( $name[1] ) ) ? $this->app->_session['more_info']['convertEmoticons']['upload_path'] . "/{$name[0]}" : $this->app->_session['more_info']['convertEmoticons']['upload_path'];
$path2 = NULL;
if( $row['image_2x'] )
{
$name2 = explode( '/', $row['image_2x'] );
$row['filenamex2'] = isset( $name2[1] ) ? $name2[1] : $name2[0];
$row['filenamex2'] = $name2[1] ?? $name2[0];
$path2 = ( isset( $name2[1] ) ) ? $this->app->_session['more_info']['convertEmoticons']['upload_path'] . "/{$name2[0]}" : $this->app->_session['more_info']['convertEmoticons']['upload_path'];
}
@@ -543,7 +542,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertBanFilters()
public function convertBanFilters() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'ban_id' );
@@ -563,7 +562,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'g_id' );
@@ -598,7 +597,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertProfileFieldGroups()
public function convertProfileFieldGroups() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'pf_group_id' );
@@ -621,7 +620,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertProfileFields()
public function convertProfileFields() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'pf_id' );
@@ -648,7 +647,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'member_id' );
@@ -706,7 +705,7 @@ class Invisioncommunity extends Software
unset( $row['members_bitoptions'], $row['members_bitoptions2'] );
$path = $this->app->_session['more_info']['convertMembers']['upload_path'] . '/';
$libraryClass->convertMember( $row, $profileFields, $profilePhotoName, $path . ( isset( $bits[0] ) ? $bits[0] : '' ), NULL, $coverPhotoName, $path . ( isset( $coverBits[0] ) ? $coverBits[0] : '' ) );
$libraryClass->convertMember( $row, $profileFields, $profilePhotoName, $path . ( $bits[0] ?? '' ), NULL, $coverPhotoName, $path . ( $coverBits[0] ?? '' ) );
/* Any friends need converting to followers? */
foreach( $this->db->select( '*', 'core_follow', array( 'follow_app=? AND follow_area=? AND follow_rel_id=?', 'core', 'member', $row['member_id'] ) ) as $follow )
@@ -748,7 +747,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertProfanityFilters()
public function convertProfanityFilters() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'wid' );
@@ -768,7 +767,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertQuestionAndAnswers()
public function convertQuestionAndAnswers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'qa_id' );
@@ -793,7 +792,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertReputationLevels()
public function convertReputationLevels() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'level_id' );
@@ -819,7 +818,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertReactions()
public function convertReactions() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'reaction_id' );
@@ -834,7 +833,7 @@ class Invisioncommunity extends Software
/* Remap rows */
$name = explode( '/', $row['reaction_icon'] );
$row['filename'] = isset( $name[1] ) ? $name[1] : $name[0];
$row['filename'] = $name[1] ?? $name[0];
$path = ( isset( $name[1] ) ) ? $this->app->_session['more_info']['convertReactions']['upload_path'] . "/{$name[0]}" : $this->app->_session['more_info']['convertReactions']['upload_path'];
/* We'll figure this out later */
@@ -851,7 +850,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertWarnReasons()
public function convertWarnReasons() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'wr_id' );
@@ -874,7 +873,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertAnnouncements()
public function convertAnnouncements() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'announce_id' );
@@ -894,7 +893,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertDnameChanges()
public function convertDnameChanges() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'log_id' );
@@ -915,7 +914,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertIgnoredUsers()
public function convertIgnoredUsers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'ignore_id' );
@@ -935,7 +934,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'mt_id' );
@@ -957,7 +956,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'msg_id' );
@@ -977,7 +976,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertModerators()
public function convertModerators() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'id' );
@@ -997,7 +996,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertClubs()
public function convertClubs() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'id' );
@@ -1025,7 +1024,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertClubMembers()
public function convertClubMembers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'club_id' );
@@ -1045,7 +1044,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertClubPages()
public function convertClubPages() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'page_id' );
@@ -1065,12 +1064,12 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertAttachments()
public function convertAttachments() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'attach_id' );
$mapTypes = array_keys( Application::load('core')->extensions( 'core', 'EditorLocations', FALSE, FALSE ) );
$mapTypes = array_keys( Application::load('core')->extensions( 'core', 'EditorLocations', FALSE ) );
array_walk( $mapTypes, function( &$value )
{
$value = 'core_' . $value;
@@ -1118,7 +1117,6 @@ class Invisioncommunity extends Software
// Can't convert this type
$libraryClass->setLastKeyValue( $row['attach_id'] );
continue 2;
break;
}
/* This applies to all options */
@@ -1146,7 +1144,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertMemberHistory()
public function convertMemberHistory() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'log_id' );
@@ -1165,14 +1163,14 @@ class Invisioncommunity extends Software
/**
* @brief Default language
*/
protected $_defaultLanguage = NULL;
protected ?int $_defaultLanguage = NULL;
/**
* Get default language id
*
* @return int
*/
protected function _defaultLanguage()
protected function _defaultLanguage() : int
{
if( $this->_defaultLanguage !== NULL )
{
@@ -1185,7 +1183,7 @@ class Invisioncommunity extends Software
/**
* @brief Word storage
*/
protected $_words = [];
protected array $_words = [];
/**
* Get word from language system
@@ -1193,7 +1191,7 @@ class Invisioncommunity extends Software
* @param string $key Word key
* @return string
*/
public function getWord( $key )
public function getWord( string $key ) : string
{
if( isset( $this->_words[ $key ] ) )
{
@@ -1202,7 +1200,7 @@ class Invisioncommunity extends Software
try
{
$result = $this->_words[ $key ] = $this->db->select( 'word_custom, word_default', 'core_sys_lang_words', array( 'word_key=? AND lang_id=?', $key, $this->_defaultLanguage() ) )->first();
$result = $this->db->select( 'word_custom, word_default', 'core_sys_lang_words', array( 'word_key=? AND lang_id=?', $key, $this->_defaultLanguage() ) )->first();
}
/* Can't find the word, so return the original string */
catch( UnderflowException $e )
@@ -1222,17 +1220,17 @@ class Invisioncommunity extends Software
/**
* @brief Table schema storage
*/
protected $_schemas = array();
protected array $_schemas = array();
/**
* Remove non-standard columns from row data
*
* @param array $row Database result row
* @param string $table Table name
* @param string $app App to check
* @param string|null $app App to check
* @return void
*/
public function unsetNonStandardColumns( &$row, $table, $app=NULL )
public function unsetNonStandardColumns( array &$row, string $table, ?string $app=NULL ) : void
{
if( $app === NULL )
{
@@ -1261,9 +1259,9 @@ class Invisioncommunity extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -40,9 +40,9 @@ class Joomla extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "Joomla";
@@ -51,9 +51,9 @@ class Joomla extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "joomla";
@@ -62,9 +62,9 @@ class Joomla extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertGroups' => array(
@@ -81,9 +81,9 @@ class Joomla extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -91,9 +91,9 @@ class Joomla extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertGroups'
@@ -103,10 +103,10 @@ class Joomla extends Software
/**
* Get More Information
*
* @param string $method Method name
* @return array
* @param string $method Method name
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
@@ -144,9 +144,9 @@ class Joomla extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -166,7 +166,7 @@ class Joomla extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -202,7 +202,7 @@ class Joomla extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
@@ -254,14 +254,14 @@ class Joomla extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
/* Joomla 3 */
if( preg_match( '/^\$2[ay]\$(0[4-9]|[1-2][0-9]|3[0-1])\$[a-zA-Z0-9.\/]{53}/', $member->conv_password ) )
{
require_once \IPS\ROOT_PATH . "/applications/convert/sources/Login/PasswordHash.php";
$ph = new PasswordHash( 8, TRUE );
return $ph->CheckPassword( $password, $member->conv_password ) ? TRUE : FALSE;
return $ph->CheckPassword( $password, $member->conv_password );
}
/* Joomla 2 */
@@ -51,9 +51,9 @@ class Mybb extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "MyBB 1.8.x";
@@ -62,9 +62,9 @@ class Mybb extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "mybb";
@@ -73,9 +73,9 @@ class Mybb extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertBanfilters' => array(
@@ -132,9 +132,9 @@ class Mybb extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -142,9 +142,9 @@ class Mybb extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertEmoticons',
@@ -157,10 +157,10 @@ class Mybb extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
switch( $method )
@@ -286,9 +286,9 @@ class Mybb extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -318,9 +318,9 @@ class Mybb extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post The post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -342,7 +342,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertAnnouncements()
public function convertAnnouncements() : void
{
$libraryClass = $this->getLibrary();
@@ -369,7 +369,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertBanfilters()
public function convertBanfilters() : void
{
$libraryClass = $this->getLibrary();
@@ -408,7 +408,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertEmoticons()
public function convertEmoticons() : void
{
$libraryClass = $this->getLibrary();
@@ -448,7 +448,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertWarnActions()
public function convertWarnActions() : void
{
$libraryClass = $this->getLibrary();
@@ -475,7 +475,6 @@ class Mybb extends Software
}
else
{
$suspend_unit = 'h';
$suspend = floor( $action['length'] / 3600 );
}
break;
@@ -489,7 +488,6 @@ class Mybb extends Software
}
else
{
$rpa_unit = 'h';
$rpa = floor( $action['length'] / 3600 );
}
break;
@@ -503,7 +501,6 @@ class Mybb extends Software
}
else
{
$mq_unit = 'h';
$mq = floor( $action['length'] / 3600 );
}
break;
@@ -529,7 +526,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertWarnReasons()
public function convertWarnReasons() : void
{
$libraryClass = $this->getLibrary();
@@ -553,7 +550,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertProfileFields()
public function convertProfileFields() : void
{
$libraryClass = $this->getLibrary();
@@ -597,31 +594,28 @@ class Mybb extends Software
* @param string $type MyBB Type
* @return string IPS Type
*/
protected function _fieldMap( $type )
protected function _fieldMap( string $type ) : string
{
switch( $type )
{
case 'text':
return 'Text';
break;
case 'textarea':
return "TextArea";
break;
case 'select':
case 'multiselect':
return 'Select';
break;
case 'checkbox':
return 'CheckboxSet';
break;
case 'radio':
return 'Radio';
break;
}
return '';
}
/**
@@ -629,7 +623,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -656,7 +650,6 @@ class Mybb extends Software
/* Bubble up */
throw new UnderflowException;
}
$promotion_unit = 0;
$promotion_data = array( $promotion['newusergroup'], $promotion['posts'] );
break;
@@ -665,7 +658,6 @@ class Mybb extends Software
{
throw new UnderflowException;
}
$promotion_unit = 0;
$promotion_data = array( $promotion['newusergroup'], $promotion['registered'] );
break;
}
@@ -674,8 +666,8 @@ class Mybb extends Software
/* Username Styles */
$style = explode( '{username}', $row['namestyle'] );
$prefix = isset( $style[0] ) ? $style[0] : '';
$suffix = isset( $style[1] ) ? $style[1] : '';
$prefix = $style[0] ?? '';
$suffix = $style[1] ?? '';
$info = array(
'g_id' => $row['gid'],
@@ -729,7 +721,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
@@ -982,7 +974,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
@@ -1025,7 +1017,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
@@ -1051,7 +1043,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertProfanityFilters()
public function convertProfanityFilters() : void
{
$libraryClass = $this->getLibrary();
@@ -1074,7 +1066,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertQuestionAndAnswers()
public function convertQuestionAndAnswers() : void
{
$libraryClass = $this->getLibrary();
@@ -1094,9 +1086,9 @@ class Mybb extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
/* If we can't access profiles, don't bother trying to redirect */
if( !Member::loggedIn()->canAccessModule( Module::get( 'core', 'members' ) ) )
@@ -1129,7 +1121,7 @@ class Mybb extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
if ( Login::compareHashes( $member->conv_password, md5( md5( $member->misc ) . md5( $password ) ) ) )
{
@@ -44,9 +44,9 @@ class Photopost extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "Photopost (8.x)";
@@ -55,9 +55,9 @@ class Photopost extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "photopost";
@@ -66,9 +66,9 @@ class Photopost extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertGroups' => array(
@@ -85,9 +85,9 @@ class Photopost extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertGroups',
@@ -98,10 +98,10 @@ class Photopost extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
@@ -173,9 +173,9 @@ class Photopost extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -199,7 +199,7 @@ class Photopost extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -233,7 +233,7 @@ class Photopost extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
@@ -307,9 +307,9 @@ class Photopost extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
/* If we can't access profiles, don't bother trying to redirect */
if( !Member::loggedIn()->canAccessModule( Module::get( 'core', 'members' ) ) )
@@ -54,9 +54,9 @@ class Phpbb extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "phpBB (3.1.x/3.2.x/3.3.x)";
@@ -65,9 +65,9 @@ class Phpbb extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "phpbb";
@@ -76,9 +76,9 @@ class Phpbb extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertEmoticons' => array(
@@ -128,9 +128,9 @@ class Phpbb extends Software
/**
* Allows software to add additional menu row options
*
* @return array
* @return array
*/
public function extraMenuRows()
public function extraMenuRows(): array
{
$rows = array();
$rows['convertBanfilters2'] = array(
@@ -149,13 +149,13 @@ class Phpbb extends Software
/**
* Count Source Rows for a specific step
*
* @param string $table The table containing the rows to count.
* @param array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @param string $table The table containing the rows to count.
* @param string|array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @throws \IPS\convert\Exception
*/
public function countRows( $table, $where=NULL, $recache=FALSE )
public function countRows( string $table, string|array|null $where=NULL, bool $recache=FALSE ): int
{
switch( $table )
{
@@ -172,20 +172,18 @@ class Phpbb extends Software
throw new \IPS\convert\Exception( sprintf( Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
}
return $count;
break;
default:
return parent::countRows( $table, $where, $recache );
break;
}
}
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -193,9 +191,9 @@ class Phpbb extends Software
/**
* Returns a block of text, or a language string, that explains what the admin must do to start this conversion
*
* @return string
* @return string|null
*/
public static function getPreConversionInformation()
public static function getPreConversionInformation(): ?string
{
return 'convert_phpbb_preconvert';
}
@@ -203,9 +201,9 @@ class Phpbb extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertEmoticons',
@@ -218,10 +216,10 @@ class Phpbb extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
switch( $method )
{
@@ -349,9 +347,9 @@ class Phpbb extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -384,7 +382,7 @@ class Phpbb extends Software
* @note PHPBB does bbcode like '[b:lsu27ljs]Bold text here[/b:lsu27ljs]' so we need to strip these uids to parse properly
* @return string
*/
public static function stripUid( $post, $uid )
public static function stripUid( string $post, string $uid ) : string
{
return str_replace( ":" . $uid . "]", "]", $post );
}
@@ -392,9 +390,9 @@ class Phpbb extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post The post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -463,7 +461,7 @@ class Phpbb extends Software
*
* @return void
*/
public function convertEmoticons()
public function convertEmoticons() : void
{
$libraryClass = $this->getLibrary();
@@ -493,7 +491,7 @@ class Phpbb extends Software
*
* @return void
*/
public function convertProfileFields()
public function convertProfileFields() : void
{
$libraryClass = $this->getLibrary();
@@ -537,11 +535,6 @@ class Phpbb extends Software
$default = json_encode( $options );
break;
case 'googleplus':
case 'string':
$type = 'Text';
break;
case 'int':
$type = 'Number';
break;
@@ -553,7 +546,9 @@ class Phpbb extends Software
case 'url':
$type = 'Url';
break;
case 'googleplus':
case 'string':
default:
$type = 'Text';
break;
@@ -586,7 +581,7 @@ class Phpbb extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -634,14 +629,14 @@ class Phpbb extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'user_id' );
try
{
/* Try to auto detect the salt */
/* Try to auto-detect the salt */
$avatarSalt = $this->db->select( 'config_value', 'config', array( 'config_name=?', 'avatar_salt' ) )->first();
if( empty( $avatarSalt ) )
@@ -735,7 +730,7 @@ class Phpbb extends Software
'last_activity' => $row['user_lastmark'],
'mgroup_others' => $groups,
'timezone' => $timezone,
'allow_admin_mails' => ( $row['user_allow_massemail'] ) ? TRUE : FALSE,
'allow_admin_mails' => (bool)$row['user_allow_massemail'],
'members_disable_pm' => ( $row['user_allow_pm'] ) ? 0 : 1,
'member_posts' => $row['user_posts'],
'member_last_post' => $row['user_lastpost_time'],
@@ -864,7 +859,7 @@ class Phpbb extends Software
'wl_moderator' => $log['user_id'],
'wl_date' => $warn['warning_time'],
'wl_points' => 1,
'wl_note_member' => isset( $data[0] ) ? $data[0] : NULL,
'wl_note_member' => $data[0] ?? NULL,
) );
/* Add a member history record for this member */
@@ -888,7 +883,7 @@ class Phpbb extends Software
*
* @return void
*/
public function convertIgnoredUsers()
public function convertIgnoredUsers() : void
{
$libraryClass = $this->getLibrary();
@@ -914,7 +909,7 @@ class Phpbb extends Software
*
* @return void
*/
public function convertProfanityFilters()
public function convertProfanityFilters() : void
{
$libraryClass = $this->getLibrary();
@@ -938,7 +933,7 @@ class Phpbb extends Software
*
* @return void
*/
public function convertBanfilters()
public function convertBanfilters() : void
{
$libraryClass = $this->getLibrary();
@@ -980,7 +975,7 @@ class Phpbb extends Software
*
* @return void
*/
public function convertBanfilters2()
public function convertBanfilters2() : void
{
$libraryClass = $this->getLibrary();
@@ -1004,7 +999,7 @@ class Phpbb extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
@@ -1064,7 +1059,7 @@ class Phpbb extends Software
'map_user_id' => $to['user_id'],
'map_is_starter' => 0,
'map_last_topic_reply' => $row['message_time'],
'map_folder_id' => ( $to['folder_id'] > 0 ) ? $this->_getPmFolder( $to['user_id'], $to['folder_id'] ) : FALSE
'map_folder_id' => $to['folder_id'] > 0 and $this->_getPmFolder( $to['user_id'], $to['folder_id'] )
);
}
@@ -1079,7 +1074,7 @@ class Phpbb extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
@@ -1103,9 +1098,9 @@ class Phpbb extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
/* If we can't access profiles, don't bother trying to redirect */
if( !Member::loggedIn()->canAccessModule( Module::get( 'core', 'members' ) ) )
@@ -1134,12 +1129,12 @@ class Phpbb extends Software
/**
* @brief Lookup cache
*/
protected static $pmFolders = array();
protected static array $pmFolders = array();
/**
* @brief PhpBB Source Folders
*/
protected static $phpBbFolders = NULL;
protected static ?array $phpBbFolders = NULL;
/**
* Get array key for the folder
@@ -1148,7 +1143,7 @@ class Phpbb extends Software
* @param string $folderId Folder Name
* @return boolean
*/
protected function _getPmFolder( $user, $folderId )
protected function _getPmFolder( int $user, string $folderId ) : bool
{
/* Check for cached folder info */
if( isset( static::$pmFolders[ $user ][ $folderId ] ) )
@@ -1170,7 +1165,7 @@ class Phpbb extends Software
throw new OutOfRangeException;
}
$member = Member::load( $this->app->getLink( (int) $user, 'core_members' ) );
$member = Member::load( $this->app->getLink( $user, 'core_members' ) );
$filters = json_decode( $member->pconversation_filters, TRUE );
/* No PM Folders or it's a guest */
@@ -1195,7 +1190,7 @@ class Phpbb extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
$password = html_entity_decode( $password );
$success = FALSE;
@@ -1206,7 +1201,7 @@ class Phpbb extends Software
{
require_once \IPS\ROOT_PATH . "/applications/convert/sources/Login/PasswordHash.php";
$ph = new PasswordHash( 8, TRUE );
$success = $ph->CheckPassword( $password, $member->conv_password ) ? TRUE : FALSE;
$success = $ph->CheckPassword( $password, $member->conv_password );
}
$hashLibrary = new HashCryptPrivate;
@@ -1218,18 +1213,18 @@ class Phpbb extends Software
if ( strlen( $hash ) == 34 )
{
$success = ( Login::compareHashes( $hash, $hashLibrary->hashCryptPrivate( $password, $hash, $itoa64 ) ) ) ? TRUE : FALSE;
$success = Login::compareHashes( $hash, $hashLibrary->hashCryptPrivate( $password, $hash, $itoa64 ) );
}
else
{
$success = ( Login::compareHashes( $hash, $single_md5_pass ) ) ? TRUE : FALSE;
$success = Login::compareHashes( $hash, $single_md5_pass );
}
}
/* phpBB2 */
if ( !$success )
{
$success = ( Login::compareHashes( $hash, $hashLibrary->hashCryptPrivate( $single_md5_pass, $hash, $itoa64 ) ) ) ? TRUE : FALSE ;
$success = Login::compareHashes( $hash, $hashLibrary->hashCryptPrivate( $single_md5_pass, $hash, $itoa64 ) );
}
/* Fallback to password_verify(), this applies to PhpBB 3.3+ where Argon may be used */
@@ -36,9 +36,9 @@ class Phpmyforum extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "PhpMyForum";
@@ -47,9 +47,9 @@ class Phpmyforum extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "phpmyforum";
@@ -58,9 +58,9 @@ class Phpmyforum extends Software
/**
* Content we can convert from this software.
*
* @return NULL
* @return array|NULL
*/
public static function canConvert()
public static function canConvert(): ?array
{
return NULL;
}
@@ -68,9 +68,9 @@ class Phpmyforum extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
/* If we can't access profiles, don't bother trying to redirect */
if( !Member::loggedIn()->canAccessModule( Module::get( 'core', 'members' ) ) )
@@ -44,9 +44,9 @@ class Punbb extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "PunBB (1.x)";
@@ -55,9 +55,9 @@ class Punbb extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "punbb";
@@ -66,9 +66,9 @@ class Punbb extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertGroups' => array(
@@ -93,9 +93,9 @@ class Punbb extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -103,9 +103,9 @@ class Punbb extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertGroups',
@@ -116,10 +116,10 @@ class Punbb extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
@@ -179,9 +179,9 @@ class Punbb extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -206,9 +206,9 @@ class Punbb extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post The post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -224,7 +224,7 @@ class Punbb extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -254,7 +254,7 @@ class Punbb extends Software
$libraryClass->convertGroup( $info );
$libraryClass->setLastKeyValue( $row['g_id'], $merge );
$libraryClass->setLastKeyValue( $row['g_id'] );
}
/* Now check for group promotions */
@@ -272,7 +272,7 @@ class Punbb extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
@@ -343,7 +343,7 @@ class Punbb extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
@@ -394,7 +394,7 @@ class Punbb extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
@@ -419,9 +419,9 @@ class Punbb extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
/* If we can't access profiles, don't bother trying to redirect */
if( !Member::loggedIn()->canAccessModule( Module::get( 'core', 'members' ) ) )
@@ -454,7 +454,7 @@ class Punbb extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
$success = FALSE;
@@ -49,9 +49,9 @@ class Smf extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "Simple Machines Forum (2.0.x)";
@@ -60,9 +60,9 @@ class Smf extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "smf";
@@ -71,9 +71,9 @@ class Smf extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertBanfilters' => array(
@@ -114,9 +114,9 @@ class Smf extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -124,9 +124,9 @@ class Smf extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertEmoticons',
@@ -139,13 +139,13 @@ class Smf extends Software
/**
* Count Source Rows for a specific step
*
* @param string $table The table containing the rows to count.
* @param array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @param string $table The table containing the rows to count.
* @param string|array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @throws \IPS\convert\Exception
*/
public function countRows( $table, $where=NULL, $recache=FALSE )
public function countRows( string $table, string|array|null $where=NULL, bool $recache=FALSE ): int
{
switch( $table )
{
@@ -162,21 +162,19 @@ class Smf extends Software
{
throw new \IPS\convert\Exception( sprintf( Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
}
break;
default:
return parent::countRows( $table, $where, $recache );
break;
}
}
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
switch( $method )
@@ -306,9 +304,9 @@ class Smf extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -337,9 +335,9 @@ class Smf extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post The post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -364,7 +362,7 @@ class Smf extends Software
*
* @return void
*/
public function convertBanfilters()
public function convertBanfilters() : void
{
$libraryClass = $this->getLibrary();
@@ -406,7 +404,7 @@ class Smf extends Software
*
* @return void
*/
public function convertEmoticons()
public function convertEmoticons() : void
{
$libraryClass = $this->getLibrary();
@@ -435,7 +433,7 @@ class Smf extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
@@ -493,7 +491,7 @@ class Smf extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
@@ -518,7 +516,7 @@ class Smf extends Software
*
* @return void
*/
public function convertProfileFields()
public function convertProfileFields() : void
{
$libraryClass = $this->getLibrary();
@@ -580,7 +578,7 @@ class Smf extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -627,7 +625,7 @@ class Smf extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
@@ -866,7 +864,7 @@ class Smf extends Software
*
* @return void
*/
public function convertIgnoredUsers()
public function convertIgnoredUsers() : void
{
$libraryClass = $this->getLibrary();
@@ -900,10 +898,10 @@ class Smf extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
* @note Current profile URL format: /index.php?action=profile;u=123
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
/* If we can't access profiles, don't bother trying to redirect */
if( !Member::loggedIn()->canAccessModule( Module::get( 'core', 'members' ) ) )
@@ -954,7 +952,7 @@ class Smf extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
if ( Login::compareHashes( $member->conv_password, sha1( mb_strtolower( $member->name ) . html_entity_decode( $password ) ) ) )
{
@@ -17,6 +17,7 @@ use Exception;
use IPS\Application\Module;
use IPS\Content\Search\Index;
use IPS\convert\Software;
use IPS\convert\Software\Exception as SoftwareException;
use IPS\core\Ignore;
use IPS\Data\Cache;
use IPS\Data\Store;
@@ -48,25 +49,25 @@ class UBBthreads extends Software
* @brief Emoticons WHERE statement
* @see convertEmoticons()
*/
protected static $emoticonsWhere = 'GRAEMLIN_IS_ACTIVE=1';
protected static string $emoticonsWhere = 'GRAEMLIN_IS_ACTIVE=1';
/**
* @brief Groups WHERE statement
* @see convertGroups()
*/
protected static $groupsWhere = 'GROUP_IS_DISABLED=0';
protected static string $groupsWhere = 'GROUP_IS_DISABLED=0';
/**
* @brief Ignored users WHERE statement
* @see convertIgnoredUsers()
*/
protected static $ignoredUsersWhere = "USER_IGNORE_LIST IS NOT NULL AND USER_IGNORE_LIST NOT IN ( '', '-' )";
protected static string $ignoredUsersWhere = "USER_IGNORE_LIST IS NOT NULL AND USER_IGNORE_LIST NOT IN ( '', '-' )";
/**
* @brief Members WHERE statement
* @see convertMembers()
*/
protected static $membersWhere = array( 'u.USER_LOGIN_NAME<>?', '**DONOTDELETE**' );
protected static array $membersWhere = array( 'u.USER_LOGIN_NAME<>?', '**DONOTDELETE**' );
/**
* This is.. kind of hacky, but it's used so we can try and support non-exact profanity matches without converting
@@ -75,7 +76,7 @@ class UBBthreads extends Software
* @brief Profanity filters WHERE statement
* @see convertProfanityFilters()
*/
protected static $profanityFiltersWhere = '(
protected static string $profanityFiltersWhere = '(
CENSOR_WORD NOT LIKE "%(.*)%" AND (
CENSOR_WORD NOT LIKE "%(.*?)%" OR (
CENSOR_WORD LIKE "%(.*?)" AND CENSOR_WORD NOT LIKE "%(.*?)%(.*?)"
@@ -86,9 +87,9 @@ class UBBthreads extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "UBBthreads";
@@ -97,9 +98,9 @@ class UBBthreads extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "ubbthreads";
@@ -108,9 +109,9 @@ class UBBthreads extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertEmoticons' => array(
@@ -156,9 +157,9 @@ class UBBthreads extends Software
/**
* Allows software to add additional menu row options
*
* @return array
* @return array
*/
public function extraMenuRows()
public function extraMenuRows(): array
{
$rows = array();
$count = $this->countRows( static::canConvert()['convertMembersFollowers']['table'], static::canConvert()['convertMembersFollowers']['where'] );
@@ -182,9 +183,9 @@ class UBBthreads extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -192,13 +193,13 @@ class UBBthreads extends Software
/**
* Count Source Rows for a specific step
*
* @param string $table The table containing the rows to count.
* @param array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @param string $table The table containing the rows to count.
* @param string|array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @throws \IPS\convert\Exception
*/
public function countRows( $table, $where=NULL, $recache=FALSE )
public function countRows( string $table, string|array|null $where=NULL, bool $recache=FALSE ): int
{
switch ( $table )
{
@@ -214,9 +215,9 @@ class UBBthreads extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertEmoticons',
@@ -231,7 +232,7 @@ class UBBthreads extends Software
* @param string $date Date to try to convert
* @return DateTime|null
*/
protected function stringToDateTime( $date )
protected function stringToDateTime( string $date ) : ?DateTime
{
try
{
@@ -246,10 +247,10 @@ class UBBthreads extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
switch( $method )
@@ -347,9 +348,9 @@ class UBBthreads extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -379,9 +380,9 @@ class UBBthreads extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post The post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -398,7 +399,7 @@ class UBBthreads extends Software
*
* @return void
*/
public function convertBanfilters()
public function convertBanfilters() : void
{
$libraryClass = $this->getLibrary();
@@ -432,7 +433,7 @@ class UBBthreads extends Software
) );
}
throw new \IPS\convert\Software\Exception;
throw new SoftwareException;
}
/**
@@ -440,7 +441,7 @@ class UBBthreads extends Software
*
* @return void
*/
public function convertEmoticons()
public function convertEmoticons() : void
{
$libraryClass = $this->getLibrary();
@@ -474,7 +475,7 @@ class UBBthreads extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'GROUP_ID' );
@@ -508,7 +509,7 @@ class UBBthreads extends Software
*
* @return void
*/
public function convertIgnoredUsers()
public function convertIgnoredUsers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'USER_ID' );
@@ -547,7 +548,7 @@ class UBBthreads extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'u.USER_ID' );
@@ -635,7 +636,7 @@ class UBBthreads extends Software
}
$fieldColumn = 'USER_' . strtoupper( $pseudo );
$pfields[ $pseudo ] = isset( $row[ $fieldColumn ] ) ? $row[ $fieldColumn ] : NULL;
$pfields[ $pseudo ] = $row[$fieldColumn] ?? NULL;
}
/* Profile photo */
@@ -670,7 +671,7 @@ class UBBthreads extends Software
*
* @return void
*/
public function convertMembersFollowers()
public function convertMembersFollowers() : void
{
$libraryClass = $this->getLibrary();
@@ -692,7 +693,7 @@ class UBBthreads extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'TOPIC_ID' );
@@ -735,7 +736,7 @@ class UBBthreads extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
@@ -761,7 +762,7 @@ class UBBthreads extends Software
*
* @return void
*/
public function convertProfanityFilters()
public function convertProfanityFilters() : void
{
$libraryClass = $this->getLibrary();
@@ -783,15 +784,15 @@ class UBBthreads extends Software
) );
}
throw new \IPS\convert\Software\Exception;
throw new SoftwareException;
}
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -829,7 +830,7 @@ class UBBthreads extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
$hash = $member->members_pass_hash;
$salt = $member->members_pass_salt;
@@ -14,10 +14,7 @@ namespace IPS\convert\Software\Core;
use DateTimeZone;
use erusev\Parsedown;
use Exception;
use InvalidArgumentException;
use IPS\Content\Search\Index;
use IPS\convert\App;
use IPS\convert\Software;
use IPS\Data\Cache;
use IPS\Data\Store;
@@ -51,9 +48,9 @@ class Vanilla extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "Vanilla (3.x)";
@@ -62,9 +59,9 @@ class Vanilla extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "vanilla";
@@ -73,9 +70,9 @@ class Vanilla extends Software
/**
* Can we convert settings?
*
* @return boolean
* @return boolean
*/
public static function canConvertSettings()
public static function canConvertSettings(): bool
{
return TRUE;
}
@@ -83,9 +80,9 @@ class Vanilla extends Software
/**
* Settings Map Listing
*
* @return array
* @return array
*/
public function settingsMapList()
public function settingsMapList(): array
{
$settings = array(
'fluid' => array( 'title' => Member::loggedIn()->language()->addToStack( 'use_fluid_view_convert' ), 'value' => true, 'our_key' => 'use_fluid_view_convert', 'our_title' => Member::loggedIn()->language()->addToStack( 'use_fluid_view_convert' ) )
@@ -100,9 +97,9 @@ class Vanilla extends Software
* @param array $settings Settings to convert
* @return void
*/
public function convertSettings( $settings=array() )
public function convertSettings( array $settings=array() ) : void
{
if ( !isset( $settings['use_fluid_view_convert'] ) OR $settings['use_fluid_view_convert'] == FALSE )
if ( !isset( $settings['use_fluid_view_convert'] ) OR !$settings['use_fluid_view_convert'] )
{
return;
}
@@ -116,9 +113,9 @@ class Vanilla extends Software
*
* @param string $location File location retrieved from the database
* @param string $uploadsPath Configured uploads path
* @return Url|string|void
* @return Url|string|null
*/
public static function parseMediaLocation( $location, $uploadsPath )
public static function parseMediaLocation( string $location, string $uploadsPath ) : Url|string|null
{
$uploadsPath = str_replace( '\\', '/', $uploadsPath );
@@ -148,7 +145,7 @@ class Vanilla extends Software
{
if ( !isset( $parts['path'], $parts['host'] ) )
{
return;
return null;
}
// This is a url in the format type:://domain/path.
@@ -173,7 +170,7 @@ class Vanilla extends Software
* @param string $date Date(Time) string
* @return DateTime Timestamp on successful conversion, otherwise NULL
*/
public static function mysqlToDateTime( $date )
public static function mysqlToDateTime( string $date ) : DateTime
{
return DateTime::ts( strtotime( $date ) ?: time() );
}
@@ -181,9 +178,9 @@ class Vanilla extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertGroups' => array(
@@ -208,9 +205,9 @@ class Vanilla extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -218,9 +215,9 @@ class Vanilla extends Software
/**
* Returns a block of text, or a language string, that explains what the admin must do to start this conversion
*
* @return string
* @return string|null
*/
public static function getPreConversionInformation()
public static function getPreConversionInformation(): ?string
{
return 'convert_vanilla_preconvert';
}
@@ -228,9 +225,9 @@ class Vanilla extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertGroups',
@@ -241,10 +238,10 @@ class Vanilla extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
switch( $method )
{
@@ -294,9 +291,9 @@ class Vanilla extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -325,14 +322,14 @@ class Vanilla extends Software
/**
* @brief Store parsedown object
*/
protected static $_parseDown = NULL;
protected static ?Parsedown $_parseDown = NULL;
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post The post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -419,7 +416,7 @@ class Vanilla extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'r.RoleID' );
@@ -454,7 +451,7 @@ class Vanilla extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'u.UserID' );
@@ -542,7 +539,7 @@ class Vanilla extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'ConversationID' );
@@ -569,14 +566,14 @@ class Vanilla extends Software
$maps = array();
$rows = iterator_to_array( $this->db->select( '*', 'UserConversation', array( 'ConversationID=?', $row['ConversationID'] ) ) );
$this->app->preCacheLinks( $rows, [ 'core_members' => 'UserID' ] );
foreach ( $rows as $row )
foreach ( $rows as $r )
{
$maps[ $row['UserID'] ] = array(
'map_user_id' => $row['UserID'],
'map_read_time' => static::mysqlToDateTime( $row['DateLastViewed'] ),
$maps[ $r['UserID'] ] = array(
'map_user_id' => $r['UserID'],
'map_read_time' => static::mysqlToDateTime( $r['DateLastViewed'] ),
//'map_folder_id' => TODO: Create a Bookmarks folder for "Bookmarked" conversations?
'map_user_active' => $row['Deleted'] == 0 ? 1 : 0,
'map_last_topic_reply' => static::mysqlToDateTime( $row['DateConversationUpdated'] )
'map_user_active' => $r['Deleted'] == 0 ? 1 : 0,
'map_last_topic_reply' => static::mysqlToDateTime( $r['DateConversationUpdated'] )
);
}
@@ -590,7 +587,7 @@ class Vanilla extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'MessageID' );
@@ -626,14 +623,14 @@ class Vanilla extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
/* Vanilla 2.2 */
if( preg_match( '/^\$2[ay]\$(0[4-9]|[1-2][0-9]|3[0-1])\$[a-zA-Z0-9.\/]{53}/', $member->conv_password ) OR mb_substr( $member->conv_password, 0, 3 ) == '$P$' )
{
require_once \IPS\ROOT_PATH . "/applications/convert/sources/Login/PasswordHash.php";
$ph = new PasswordHash( 8, TRUE );
return $ph->CheckPassword( $password, $member->conv_password ) ? TRUE : FALSE;
return $ph->CheckPassword( $password, $member->conv_password );
}
if ( Login::compareHashes( $member->conv_password, md5( md5( str_replace( '&#39;', "'", html_entity_decode( $password ) ) ) . $member->misc ) ) )
@@ -62,17 +62,17 @@ class Vbulletin extends Software
/**
* @brief vBulletin 4 Stores all attachments under one table - this will store the content type for the forums app.
*/
protected static $postContentType = NULL;
protected static ?string $postContentType = NULL;
/**
* @brief The schematic for vB3 and vB4 is similar enough that we can make specific concessions in a single converter for either version.
*/
protected static $isLegacy = NULL;
protected static ?bool $isLegacy = NULL;
/**
* @brief Flag to indicate the post data has been fixed during conversion, and we only need to use Legacy Parser
*/
public static $contentFixed = TRUE;
public static bool $contentFixed = TRUE;
/**
* Constructor
@@ -82,9 +82,9 @@ class Vbulletin extends Software
* @return void
* @throws InvalidArgumentException
*/
public function __construct( App $app, $needDB=TRUE )
public function __construct( App $app, bool $needDB=TRUE )
{
$return = parent::__construct( $app, $needDB );
parent::__construct( $app, $needDB );
if ( $needDB )
{
@@ -113,16 +113,14 @@ class Vbulletin extends Software
}
catch( \Exception $e ) {} # If we can't query, we won't be able to do anything anyway
}
return $return;
}
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "vBulletin (3.8.x/4.x)";
@@ -131,9 +129,9 @@ class Vbulletin extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "vbulletin";
@@ -142,9 +140,9 @@ class Vbulletin extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertEmoticons' => array(
@@ -210,9 +208,9 @@ class Vbulletin extends Software
/**
* Allows software to add additional menu row options
*
* @return array
* @return array
*/
public function extraMenuRows()
public function extraMenuRows(): array
{
$rows = array();
$count = $this->countRows( static::canConvert()['convertMembersFollowers']['table'], static::canConvert()['convertMembersFollowers']['where'] );
@@ -236,13 +234,13 @@ class Vbulletin extends Software
/**
* Count Source Rows for a specific step
*
* @param string $table The table containing the rows to count.
* @param array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @param string $table The table containing the rows to count.
* @param string|array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @throws \IPS\convert\Exception
*/
public function countRows( $table, $where=NULL, $recache=FALSE )
public function countRows( string $table, string|array|null $where=NULL, bool $recache=FALSE ): int
{
switch( $table )
{
@@ -255,7 +253,6 @@ class Vbulletin extends Software
{
throw new \IPS\convert\Exception( sprintf( Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
}
break;
case 'pm':
try
@@ -276,20 +273,18 @@ class Vbulletin extends Software
}
return parent::countRows( $table, $where, $recache );
break;
default:
return parent::countRows( $table, $where, $recache );
break;
}
}
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -297,9 +292,9 @@ class Vbulletin extends Software
/**
* Can we convert settings?
*
* @return boolean
* @return boolean
*/
public static function canConvertSettings()
public static function canConvertSettings(): bool
{
return TRUE;
}
@@ -307,9 +302,9 @@ class Vbulletin extends Software
/**
* Settings Map
*
* @return array
* @return array
*/
public function settingsMap()
public function settingsMap(): array
{
return array(
'bbtitle' => 'board_name',
@@ -319,9 +314,9 @@ class Vbulletin extends Software
/**
* Settings Map Listing
*
* @return array
* @return array
*/
public function settingsMapList()
public function settingsMapList(): array
{
$settings = array();
foreach( $this->settingsMap() AS $theirs => $ours )
@@ -353,9 +348,9 @@ class Vbulletin extends Software
/**
* Returns a block of text, or a language string, that explains what the admin must do to start this conversion
*
* @return string
* @return string|null
*/
public static function getPreConversionInformation()
public static function getPreConversionInformation(): ?string
{
return 'convert_vb4_preconvert';
}
@@ -363,9 +358,9 @@ class Vbulletin extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertEmoticons',
@@ -380,10 +375,10 @@ class Vbulletin extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
@@ -587,9 +582,9 @@ class Vbulletin extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -623,9 +618,9 @@ class Vbulletin extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -695,7 +690,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertEmoticons()
public function convertEmoticons() : void
{
$libraryClass = $this->getLibrary();
@@ -758,7 +753,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertProfileFieldGroups()
public function convertProfileFieldGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -792,7 +787,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertProfileFields()
public function convertProfileFields() : void
{
$libraryClass = $this->getLibrary();
@@ -887,7 +882,7 @@ class Vbulletin extends Software
* @param string $type The vB Field Type
* @return string The IPS Field Type
*/
protected static function _pfieldMap( $type )
protected static function _pfieldMap( string $type ) : string
{
switch( mb_strtolower( $type ) )
{
@@ -895,20 +890,16 @@ class Vbulletin extends Software
case 'radio':
case 'checkbox':
return ucwords( $type );
break;
case 'textarea':
return 'TextArea';
break;
case 'select_multiple':
return 'Select';
break;
/* Just do Text as default */
default:
return 'Text';
break;
}
}
@@ -917,7 +908,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -929,7 +920,7 @@ class Vbulletin extends Software
$self = $this;
$checkpermission = function ( $name, $perm ) use ( $group, $self )
{
if ( $group[$name] & $self::$bitOptions[$name][$perm] )
if ( $group[$name] & self::$bitOptions[$name][$perm] )
{
return TRUE;
}
@@ -1054,14 +1045,14 @@ class Vbulletin extends Software
/**
* @brief Member history type map
*/
protected static $changeLogTypes = array( 'username' => 'display_name', 'email' => 'email_change', 'usergroupid' => 'group', 'membergroupids' => 'group' );
protected static array $changeLogTypes = array( 'username' => 'display_name', 'email' => 'email_change', 'usergroupid' => 'group', 'membergroupids' => 'group' );
/**
* Convert member history
*
* @return void
*/
public function convertMemberHistory()
public function convertMemberHistory() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'changeid' );
@@ -1092,14 +1083,14 @@ class Vbulletin extends Software
/**
* @brief default pseudo fields to convert
*/
protected static $pseudoFields = [ 'homepage', 'icq', 'aim', 'yahoo', 'msn', 'skype', 'user_title' ];
protected static array $pseudoFields = [ 'homepage', 'icq', 'aim', 'yahoo', 'msn', 'skype', 'user_title' ];
/**
* Convert members
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'user.userid' );
@@ -1131,7 +1122,7 @@ class Vbulletin extends Software
$key = $name;
}
if ( $user[$key] & $self::$bitOptions[$name][$perm] )
if ( $user[$key] & self::$bitOptions[$name][$perm] )
{
return TRUE;
}
@@ -1462,8 +1453,8 @@ class Vbulletin extends Software
'vid' => md5( $activation['activationid'] . $activation['useractivationid'] ),
'member_id' => $memberId,
'entry_date' => $activation['dateline'],
'new_reg' => ( $activation['emailchange'] == 0 ? TRUE : FALSE ),
'email_chg' => ( $activation['emailchange'] == 1 ? TRUE : FALSE ),
'new_reg' => $activation['emailchange'] == 0,
'email_chg' => $activation['emailchange'] == 1,
'user_verified' => FALSE,
'ip_address' => $user['ipaddress'],
'email_sent' => $activation['dateline']
@@ -1513,7 +1504,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertMembersFollowers()
public function convertMembersFollowers() : void
{
$libraryClass = $this->getLibrary();
@@ -1536,11 +1527,11 @@ class Vbulletin extends Software
* @param array $settings Settings to convert
* @return void
*/
public function convertSettings( $settings=array() )
public function convertSettings( array $settings=array() ) : void
{
foreach( $this->settingsMap() AS $theirs => $ours )
{
if ( !isset( $values[$ours] ) OR $values[$ours] == FALSE )
if ( !isset( $settings[$ours] ) OR !$settings[$ours] )
{
continue;
}
@@ -1563,7 +1554,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertIgnoredUsers()
public function convertIgnoredUsers() : void
{
$libraryClass = $this->getLibrary();
@@ -1589,7 +1580,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertCustomBbcode()
public function convertCustomBbcode() : void
{
$libraryClass = $this->getLibrary();
@@ -1615,7 +1606,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertAnnouncements()
public function convertAnnouncements() : void
{
$libraryClass = $this->getLibrary();
@@ -1643,7 +1634,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
@@ -1669,7 +1660,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
@@ -1706,7 +1697,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertClubs()
public function convertClubs() : void
{
$libraryClass = $this->getLibrary();
@@ -1773,7 +1764,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertClubMembers()
public function convertClubMembers() : void
{
$libraryClass = $this->getLibrary();
foreach( $this->fetch( 'socialgroupmember', 'groupid' ) AS $member )
@@ -1996,7 +1987,7 @@ class Vbulletin extends Software
/**
* @brief Fetched Settings Cache
*/
protected $settingsCache = array();
protected array $settingsCache = array();
/**
* Get Setting Value - useful for global settings that need to be translated to group or member settings
@@ -2004,7 +1995,7 @@ class Vbulletin extends Software
* @param string $key The setting key
* @return mixed
*/
protected function _setting( $key )
protected function _setting( string $key ) : mixed
{
if ( isset( $this->settingsCache[$key] ) )
{
@@ -2036,9 +2027,9 @@ class Vbulletin extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -2148,7 +2139,7 @@ class Vbulletin extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
if ( Login::compareHashes( $member->conv_password, md5( md5( str_replace( '&#39;', "'", html_entity_decode( $password ) ) ) . $member->conv_password_extra ) ) )
{
@@ -2167,7 +2158,7 @@ class Vbulletin extends Software
* @param $pm array
* @return mixed
*/
protected function _convertPm( Library $libraryClass, array $pm )
protected function _convertPm( Library $libraryClass, array $pm ) : mixed
{
try
{
@@ -2242,7 +2233,7 @@ class Vbulletin extends Software
return $libraryClass->convertPrivateMessage( $topic, $maps );
}
protected $_avatars = array();
protected array $_avatars = array();
/**
* Fetch Avatar from Avatar Gallery
@@ -2250,7 +2241,7 @@ class Vbulletin extends Software
* @param int $id Avatar ID
* @return array|bool Array of data/name or FALSE
*/
protected function _getFromAvatarGallery( int $id )
protected function _getFromAvatarGallery( int $id ) : array|bool
{
if( isset( $this->_avatars[ $id ] ) )
{
@@ -20,6 +20,7 @@ use IPS\Application\Module;
use IPS\Content\Search\Index;
use IPS\convert\App;
use IPS\convert\Software;
use IPS\convert\Software\Exception as SoftwareException;
use IPS\core\Ignore;
use IPS\Data\Cache;
use IPS\Data\Store;
@@ -55,7 +56,7 @@ class Vbulletin5 extends Software
/**
* @brief is vB 5.5.3 or newer
*/
protected static $skipCustomProfilePic = NULL;
protected static ?bool $skipCustomProfilePic = NULL;
/**
* Constructor
@@ -65,9 +66,9 @@ class Vbulletin5 extends Software
* @return void
* @throws InvalidArgumentException
*/
public function __construct( App $app, $needDB=TRUE )
public function __construct( App $app, bool $needDB=TRUE )
{
$return = parent::__construct( $app, $needDB );
parent::__construct( $app, $needDB );
if ( $needDB )
{
@@ -82,16 +83,14 @@ class Vbulletin5 extends Software
}
catch( Exception $e ) {} # If we can't query, we won't be able to do anything anyway
}
return $return;
}
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "vBulletin (5.x)";
@@ -100,9 +99,9 @@ class Vbulletin5 extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "vbulletin5";
@@ -111,9 +110,9 @@ class Vbulletin5 extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertEmoticons' => array(
@@ -166,9 +165,9 @@ class Vbulletin5 extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -176,13 +175,13 @@ class Vbulletin5 extends Software
/**
* Count Source Rows for a specific step
*
* @param string $table The table containing the rows to count.
* @param array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @param string $table The table containing the rows to count.
* @param string|array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @throws \IPS\convert\Exception
*/
public function countRows( $table, $where=NULL, $recache=FALSE )
public function countRows( string $table, string|array|null $where=NULL, bool $recache=FALSE ): int
{
switch( $table )
{
@@ -201,7 +200,6 @@ class Vbulletin5 extends Software
{
throw new \IPS\convert\Exception( sprintf( Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
}
break;
case 'node':
if ( $where === 'clubs' )
@@ -212,7 +210,6 @@ class Vbulletin5 extends Software
{
return parent::countRows( $table, $where, $recache );
}
break;
case 'groupintopic':
$clubs = array();
@@ -223,7 +220,6 @@ class Vbulletin5 extends Software
$where = array( $this->db->in( 'nodeid', $clubs ) );
return parent::countRows( $table, $where, $recache );
break;
case 'userchangelog':
try
@@ -234,20 +230,18 @@ class Vbulletin5 extends Software
{
throw new \IPS\convert\Exception( sprintf( Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
}
break;
default:
return parent::countRows( $table, $where, $recache );
break;
}
}
/**
* Can we convert settings?
*
* @return boolean
* @return boolean
*/
public static function canConvertSettings()
public static function canConvertSettings(): bool
{
return TRUE;
}
@@ -255,9 +249,9 @@ class Vbulletin5 extends Software
/**
* Settings Map
*
* @return array
* @return array
*/
public function settingsMap()
public function settingsMap(): array
{
return array(
'bbtitle' => 'board_name',
@@ -267,9 +261,9 @@ class Vbulletin5 extends Software
/**
* Settings Map Listing
*
* @return array
* @return array
*/
public function settingsMapList()
public function settingsMapList(): array
{
$settings = array();
foreach( $this->settingsMap() AS $theirs => $ours )
@@ -301,9 +295,9 @@ class Vbulletin5 extends Software
/**
* Returns a block of text, or a language string, that explains what the admin must do to start this conversion
*
* @return string
* @return string|null
*/
public static function getPreConversionInformation()
public static function getPreConversionInformation(): ?string
{
return 'convert_vb5_preconvert';
}
@@ -311,9 +305,9 @@ class Vbulletin5 extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertEmoticons',
@@ -328,10 +322,10 @@ class Vbulletin5 extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
@@ -525,9 +519,9 @@ class Vbulletin5 extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -559,9 +553,9 @@ class Vbulletin5 extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post The post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -651,7 +645,7 @@ class Vbulletin5 extends Software
*
* @return void
*/
public function convertEmoticons()
public function convertEmoticons() : void
{
$libraryClass = $this->getLibrary();
@@ -698,7 +692,7 @@ class Vbulletin5 extends Software
*
* @return void
*/
public function convertProfileFieldGroups()
public function convertProfileFieldGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -732,7 +726,7 @@ class Vbulletin5 extends Software
*
* @return void
*/
public function convertProfileFields()
public function convertProfileFields() : void
{
$libraryClass = $this->getLibrary();
@@ -806,7 +800,7 @@ class Vbulletin5 extends Software
* @param string $type The vB Field Type
* @return string The IPS Field Type
*/
protected static function _pfieldMap( $type )
protected static function _pfieldMap( string $type ) : string
{
switch( mb_strtolower( $type ) )
{
@@ -814,20 +808,16 @@ class Vbulletin5 extends Software
case 'radio':
case 'checkbox':
return ucwords( $type );
break;
case 'textarea':
return 'TextArea';
break;
case 'select_multiple':
return 'Select';
break;
/* Just do Text as default */
default:
return 'Text';
break;
}
}
@@ -836,7 +826,7 @@ class Vbulletin5 extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -848,7 +838,7 @@ class Vbulletin5 extends Software
$self = $this;
$checkpermission = function ( $name, $perm ) use ( $group, $self )
{
if ( $group[$name] & $self::$bitOptions[$name][$perm] )
if ( $group[$name] & self::$bitOptions[$name][$perm] )
{
return TRUE;
}
@@ -973,14 +963,14 @@ class Vbulletin5 extends Software
/**
* @brief Member history type map
*/
protected static $changeLogTypes = array( 'username' => 'display_name', 'email' => 'email_change', 'usergroupid' => 'group', 'membergroupids' => 'group' );
protected static array $changeLogTypes = array( 'username' => 'display_name', 'email' => 'email_change', 'usergroupid' => 'group', 'membergroupids' => 'group' );
/**
* Convert member history
*
* @return void
*/
public function convertMemberHistory()
public function convertMemberHistory() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'changeid' );
@@ -1014,7 +1004,7 @@ class Vbulletin5 extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
@@ -1038,7 +1028,7 @@ class Vbulletin5 extends Software
$key = $name;
}
if ( $user[$key] & $self::$bitOptions[$name][$perm] )
if ( $user[$key] & self::$bitOptions[$name][$perm] )
{
return TRUE;
}
@@ -1353,8 +1343,8 @@ class Vbulletin5 extends Software
'vid' => md5( $activation['activationid'] . $activation['useractivationid'] ),
'member_id' => $memberId,
'entry_date' => $activation['dateline'],
'new_reg' => ( $activation['emailchange'] == 0 ? TRUE : FALSE ),
'email_chg' => ( $activation['emailchange'] == 1 ? TRUE : FALSE ),
'new_reg' => $activation['emailchange'] == 0,
'email_chg' => $activation['emailchange'] == 1,
'user_verified' => FALSE,
'ip_address' => $user['ipaddress'],
'email_sent' => $activation['dateline']
@@ -1417,11 +1407,11 @@ class Vbulletin5 extends Software
* @param array $settings Settings to convert
* @return void
*/
public function convertSettings( $settings=array() )
public function convertSettings( array $settings=array() ) : void
{
foreach( $this->settingsMap() AS $theirs => $ours )
{
if ( !isset( $values[$ours] ) OR $values[$ours] == FALSE )
if ( !isset( $settings[$ours] ) OR !$settings[$ours] )
{
continue;
}
@@ -1444,7 +1434,7 @@ class Vbulletin5 extends Software
*
* @return void
*/
public function convertIgnoredUsers()
public function convertIgnoredUsers() : void
{
$libraryClass = $this->getLibrary();
@@ -1470,7 +1460,7 @@ class Vbulletin5 extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$node = $this->db->select( 'nodeid', 'channel', array( "guid=?", 'vbulletin-4ecbdf567f3da8.31769341' ) )->first();
@@ -1549,7 +1539,7 @@ class Vbulletin5 extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$node = $this->db->select( 'nodeid', 'channel', array( "guid=?", 'vbulletin-4ecbdf567f3da8.31769341' ) )->first();
@@ -1586,7 +1576,7 @@ class Vbulletin5 extends Software
*
* @return void
*/
public function convertClubs()
public function convertClubs() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'nodeid' );
@@ -1598,7 +1588,7 @@ class Vbulletin5 extends Software
catch( UnderflowException $e )
{
/* shrug */
throw new \IPS\convert\Software\Exception;
throw new SoftwareException;
}
$categories = array();
@@ -1682,7 +1672,7 @@ class Vbulletin5 extends Software
*
* @return void
*/
public function convertClubMembers()
public function convertClubMembers() : void
{
$libraryClass = $this->getLibrary();
$clubs = array();
@@ -1885,7 +1875,7 @@ class Vbulletin5 extends Software
/**
* @brief Fetched Settings Cache
*/
protected $settingsCache = array();
protected array $settingsCache = array();
/**
* Get Setting Value - useful for global settings that need to be translated to group or member settings
@@ -1893,7 +1883,7 @@ class Vbulletin5 extends Software
* @param string $key The setting key
* @return mixed
*/
protected function _setting( $key )
protected function _setting( string $key ) : mixed
{
if ( isset( $this->settingsCache[$key] ) )
{
@@ -1925,9 +1915,9 @@ class Vbulletin5 extends Software
/**
* Helper method to retrieve forums from nodes
*
* @return void
* @return array
*/
protected function fetchForums()
protected function fetchForums() : array
{
$forums = array();
@@ -1943,7 +1933,7 @@ class Vbulletin5 extends Software
* @brief Channel GUID Mappins.
* @note As far as I can tell, these are static and not unique per installation. Only the ones that are used are present.
*/
public static $guids = array(
public static array $guids = array(
'clubs' => 'vbulletin-4ecbdf567f3a38.99555306',
'private_messages' => 'vbulletin-4ecbdf567f3da8.31769341'
);
@@ -1953,7 +1943,7 @@ class Vbulletin5 extends Software
*
* @return array
*/
protected function fetchClubs()
protected function fetchClubs() : array
{
$clubs = array();
@@ -1982,7 +1972,7 @@ class Vbulletin5 extends Software
/**
* @brief Types Cache
*/
protected $typesCache = array();
protected array $typesCache = array();
/**
* Helper method to retrieve content type ids
@@ -1990,7 +1980,7 @@ class Vbulletin5 extends Software
* @param string $type Content type
* @return string
*/
protected function fetchType( $type )
protected function fetchType( string $type ) : string
{
if ( !empty( $this->typesCache ) )
{
@@ -2010,9 +2000,9 @@ class Vbulletin5 extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
/* If we can't access profiles, don't bother trying to redirect */
if( !Member::loggedIn()->canAccessModule( Module::get( 'core', 'members' ) ) )
@@ -2045,7 +2035,7 @@ class Vbulletin5 extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
/* If no algorithm is defined, use the legacy handler */
if ( strpos( $member->misc, 'blowfish' ) === FALSE and strpos( $member->misc, 'legacy' ) === FALSE )
@@ -2064,7 +2054,6 @@ class Vbulletin5 extends Software
require_once \IPS\ROOT_PATH . "/applications/convert/sources/Login/PasswordHash.php";
$ph = new PasswordHash( $algo[ 1 ], FALSE );
return $ph->CheckPassword( $md5_once_password, $member->conv_password );
break;
case 'legacy':
/* Legacy Passwords are stored in a format of HASH SALT so we need to explode on the space. */
@@ -2072,7 +2061,7 @@ class Vbulletin5 extends Software
$member->conv_password = $token[0];
$member->conv_password_extra = $token[1];
return Vbulletin::login( $member, $password );
break;
/** vBulletin 5.6.2 was able to also use the Argon2id password hashing scheme. */
case 'argon2id':
if( defined('PASSWORD_ARGON2ID') ) {
@@ -2082,8 +2071,8 @@ class Vbulletin5 extends Software
{
return FALSE;
}
break;
}
return false;
}
}
@@ -46,14 +46,14 @@ class Woltlab extends Software
/**
* @brief The WCF table prefix can change depending on the number of installs
*/
public static $installId = 1;
public static int $installId = 1;
/**
* Software Name
*
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "WoltLab Suite (3.1)";
@@ -64,7 +64,7 @@ class Woltlab extends Software
*
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "woltlab";
@@ -73,9 +73,9 @@ class Woltlab extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertProfileFieldGroups' => array(
@@ -116,13 +116,13 @@ class Woltlab extends Software
/**
* Count Source Rows for a specific step
*
* @param string $table The table containing the rows to count.
* @param array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @param string $table The table containing the rows to count.
* @param string|array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @throws Exception
*/
public function countRows( $table, $where=NULL, $recache=FALSE )
public function countRows( string $table, string|array|null $where=NULL, bool $recache=FALSE ): int
{
switch( $table )
{
@@ -136,20 +136,18 @@ class Woltlab extends Software
{
throw new Exception( sprintf( Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
}
break;
default:
return parent::countRows( $table, $where, $recache );
break;
}
}
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -157,9 +155,9 @@ class Woltlab extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertProfileFieldGroups',
@@ -173,10 +171,10 @@ class Woltlab extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
switch( $method )
@@ -329,9 +327,9 @@ class Woltlab extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -362,9 +360,9 @@ class Woltlab extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -377,7 +375,7 @@ class Woltlab extends Software
*
* @return void
*/
public function convertProfileFieldGroups()
public function convertProfileFieldGroups() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'categoryID' );
@@ -403,7 +401,7 @@ class Woltlab extends Software
*
* @return void
*/
public function convertProfileFields()
public function convertProfileFields() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'optionID' );
@@ -476,7 +474,7 @@ class Woltlab extends Software
*
* @return void
*/
public function convertEmoticons()
public function convertEmoticons() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'smileyID' );
@@ -515,7 +513,7 @@ class Woltlab extends Software
'emo_position' => $row['showOrder'],
);
$libraryClass->convertEmoticon( $info, $set, $this->app->_session['more_info']['convertEmoticons']['keep_existing_emoticons'], $filepath, NULL, $filepathx2, NULL );
$libraryClass->convertEmoticon( $info, $set, $this->app->_session['more_info']['convertEmoticons']['keep_existing_emoticons'], $filepath, NULL, $filepathx2 );
$libraryClass->setLastKeyValue( $row['smileyID'] );
}
}
@@ -525,7 +523,7 @@ class Woltlab extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'groupID' );
@@ -534,8 +532,8 @@ class Woltlab extends Software
{
/* Username Styles */
$style = explode( '%s', $row['userOnlineMarking'] );
$prefix = isset( $style[0] ) ? $style[0] : '';
$suffix = isset( $style[1] ) ? $style[1] : '';
$prefix = $style[0] ?? '';
$suffix = $style[1] ?? '';
$info = array(
'g_id' => $row['groupID'],
@@ -565,7 +563,7 @@ class Woltlab extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'userID' );
@@ -717,7 +715,7 @@ class Woltlab extends Software
*
* @return void
*/
public function convertIgnoredUsers()
public function convertIgnoredUsers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'ignoreID' );
@@ -742,7 +740,7 @@ class Woltlab extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'conversationID' );
@@ -789,7 +787,7 @@ class Woltlab extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'messageID' );
@@ -812,13 +810,13 @@ class Woltlab extends Software
/**
* @brief Cache default language
*/
static $_defaultLanguage = NULL;
static ?int $_defaultLanguage = NULL;
/**
* Helper to fetch a WCF lang string
*
* @param string $itemName WCF Language Name
* @param string $itemPrefix WCF Prefix for end-user input
* @param string|null $itemPrefix WCF Prefix for end-user input
* @return string Translated string, or original if no customisation exists
* @throws UnderflowException
*/
@@ -852,7 +850,7 @@ class Woltlab extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
/* If it's not blowfish, then we don't have a salt for it. fail. */
if( preg_match( '/^\$2[ay]\$(0[4-9]|[1-2][0-9]|3[0-1])\$[a-zA-Z0-9.\/]{53}/', $member->conv_password ) )
@@ -41,9 +41,9 @@ class Wordpress extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "WordPress (5.x/6.x)";
@@ -52,9 +52,9 @@ class Wordpress extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "wordpress";
@@ -63,9 +63,9 @@ class Wordpress extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertMembers' => array(
@@ -78,9 +78,9 @@ class Wordpress extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -88,9 +88,9 @@ class Wordpress extends Software
/**
* Returns a block of text, or a language string, that explains what the admin must do to start this conversion
*
* @return string
* @return string|null
*/
public static function getPreConversionInformation()
public static function getPreConversionInformation(): ?string
{
return 'convert_wordpress_preconvert';
}
@@ -98,9 +98,9 @@ class Wordpress extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertMembers',
@@ -110,9 +110,9 @@ class Wordpress extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -123,10 +123,10 @@ class Wordpress extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
@@ -171,7 +171,7 @@ class Wordpress extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
@@ -243,9 +243,9 @@ class Wordpress extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -255,7 +255,7 @@ class Wordpress extends Software
Cache::i()->clearAll();
/* Attachments */
\IPS\Task::queue( 'core', 'RebuildAttachmentThumbnails', array( 'app' => $this->app->app_id ), 1, array( 'app' ) );
Task::queue( 'core', 'RebuildAttachmentThumbnails', array( 'app' => $this->app->app_id ), 1, array( 'app' ) );
/* Content Counts */
Task::queue( 'core', 'RecountMemberContent', array( 'app' => $this->app->app_id ), 4, array( 'app' ) );
@@ -270,14 +270,14 @@ class Wordpress extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
$success = FALSE;
// If the hash is still md5...
if ( strlen( $member->conv_password ) <= 32 )
{
$success = ( Login::compareHashes( $member->conv_password, md5( $password ) ) ) ? TRUE : FALSE;
$success = Login::compareHashes( $member->conv_password, md5( $password ) );
}
// New pass hash check
else
@@ -287,7 +287,7 @@ class Wordpress extends Software
$ph = new PasswordHash( 8, TRUE );
// Check it
$success = $ph->CheckPassword( $password, $member->conv_password ) ? TRUE : FALSE;
$success = $ph->CheckPassword( $password, $member->conv_password );
}
return $success;
@@ -29,6 +29,7 @@ use IPS\Request;
use IPS\Task;
use OutOfRangeException;
use UnderflowException;
use ValueError;
use function count;
use function defined;
use function in_array;
@@ -52,9 +53,9 @@ class Wpforo extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "wpForo (2.1.x)";
@@ -63,9 +64,9 @@ class Wpforo extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "wpforo";
@@ -74,9 +75,9 @@ class Wpforo extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return [
'convertGroups' => [
@@ -105,9 +106,9 @@ class Wpforo extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -115,9 +116,9 @@ class Wpforo extends Software
/**
* Returns a block of text, or a language string, that explains what the admin must do to start this conversion
*
* @return string
* @return string|null
*/
public static function getPreConversionInformation()
public static function getPreConversionInformation(): ?string
{
return 'convert_wpforo_preconvert';
}
@@ -125,9 +126,9 @@ class Wpforo extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return [
'convertMembers',
@@ -138,9 +139,9 @@ class Wpforo extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -172,10 +173,10 @@ class Wpforo extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = [];
@@ -246,14 +247,14 @@ class Wpforo extends Software
/**
* @brief temporarily store post content
*/
protected $_postContent = [];
protected array $_postContent = [];
/**
* Convert attachments
*
* @return void
*/
public function convertAttachments()
public function convertAttachments() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'pmid' );
@@ -316,8 +317,7 @@ class Wpforo extends Software
$this->_postContent[ $messagePostId ] = str_replace( $matches[0][ $key ], '[attachment=' . $attachId . ':name]', $this->_postContent[ $messagePostId ] );
}
}
catch( UnderflowException $e ) {}
catch( OutOfRangeException $e ) {}
catch( UnderflowException|OutOfRangeException $e ) {}
}
}
@@ -358,8 +358,7 @@ class Wpforo extends Software
$this->_postContent[ $messagePostId ] = str_replace( $matches[0][ $key ], '[attachment=' . $attachId . ':name]', $this->_postContent[ $messagePostId ] );
}
}
catch( UnderflowException $e ) {}
catch( OutOfRangeException $e ) {}
catch( UnderflowException|OutOfRangeException $e ) {}
}
}
@@ -378,7 +377,7 @@ class Wpforo extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'groupid' );
@@ -420,14 +419,14 @@ class Wpforo extends Software
/**
* @brief Hardcoded wpForo profile fields
*/
protected $_profileFields = [ 'site', 'icq', 'aim', 'yahoo', 'msn', 'facebook', 'twitter', 'gtalk', 'skype', 'about', 'occupation', 'location' ];
protected array $_profileFields = [ 'site', 'icq', 'aim', 'yahoo', 'msn', 'facebook', 'twitter', 'gtalk', 'skype', 'about', 'occupation', 'location' ];
/**
* Convert members
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'users.ID' );
@@ -438,7 +437,7 @@ class Wpforo extends Software
{
$joined = ( new DateTime( $user['user_registered'] ) )->getTimestamp();
}
catch( \ValueError $e )
catch( ValueError $e )
{
$joined = time();
}
@@ -523,7 +522,7 @@ class Wpforo extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'folderid' );
@@ -593,7 +592,7 @@ class Wpforo extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'pmid' );
@@ -615,9 +614,9 @@ class Wpforo extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -652,7 +651,7 @@ class Wpforo extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
return Wordpress::login( $member, $password );
}
@@ -660,9 +659,9 @@ class Wpforo extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
$wpForoSlug = defined('WPFORO_SLUG') ? WPFOROSLUG : 'community';
@@ -21,7 +21,7 @@ use IPS\Application\Module;
use IPS\Content\Search\Index;
use IPS\convert\App;
use IPS\convert\Software;
use IPS\convert\Tools\Xenforo;
use IPS\convert\Tools\Xenforo as XenforoTrait;
use IPS\Data\Cache;
use IPS\Data\Store;
use IPS\Db;
@@ -58,22 +58,22 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
*/
class Xenforo extends Software
{
use Xenforo;
use XenforoTrait;
/**
* @brief The similarities between XF1 and XF2 are close enough that we can use the same converter
*/
public static $isLegacy = NULL;
public static ?bool $isLegacy = NULL;
/**
* @brief XF2.1 changed serialized data to json decoded
*/
public static $useJson = FALSE;
public static bool $useJson = FALSE;
/**
* @brief XF1&2 have different pseudo fields
*/
public static $pseudoFields = array(
public static array $pseudoFields = array(
1 => array( 'homepage', 'location', 'occupation', 'about', 'custom_title' ),
2 => array( 'website', 'location', 'about', 'custom_title' )
);
@@ -86,9 +86,9 @@ class Xenforo extends Software
* @return void
* @throws InvalidArgumentException
*/
public function __construct( App $app, $needDB=TRUE )
public function __construct( App $app, bool $needDB=TRUE )
{
$return = parent::__construct( $app, $needDB );
parent::__construct( $app, $needDB );
if ( $needDB )
{
@@ -117,16 +117,14 @@ class Xenforo extends Software
}
catch( Exception $e ) {} # If we can't query, we won't be able to do anything anyway
}
return $return;
}
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
return "XenForo (1.5.x/2.0.x/2.1.x/2.2.x)";
}
@@ -134,9 +132,9 @@ class Xenforo extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
return 'xenforo';
}
@@ -144,9 +142,9 @@ class Xenforo extends Software
/**
* Returns a block of text, or a language string, that explains what the admin must do to start this conversion
*
* @return string
* @return string|null
*/
public static function getPreConversionInformation()
public static function getPreConversionInformation(): ?string
{
return 'convert_xf_preconvert';
}
@@ -154,9 +152,9 @@ class Xenforo extends Software
/**
* Uses Prefix
*
* @return bool
* @return bool
*/
public static function usesPrefix()
public static function usesPrefix(): bool
{
return FALSE;
}
@@ -164,9 +162,9 @@ class Xenforo extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
$return = array(
'convertEmoticons' => array(
@@ -226,13 +224,13 @@ class Xenforo extends Software
/**
* Count Source Rows for a specific step
*
* @param string $table The table containing the rows to count.
* @param array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @param string $table The table containing the rows to count.
* @param string|array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @throws \IPS\convert\Exception
*/
public function countRows( $table, $where=NULL, $recache=FALSE )
public function countRows( string $table, string|array|null $where=NULL, bool $recache=FALSE ): int
{
switch( $table )
{
@@ -246,7 +244,7 @@ class Xenforo extends Software
{
throw new \IPS\convert\Exception( sprintf( Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
}
break;
/* XF2 */
case 'xf_change_log':
try
@@ -257,20 +255,18 @@ class Xenforo extends Software
{
throw new \IPS\convert\Exception( sprintf( Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
}
break;
default:
return parent::countRows( $table, $where, $recache );
break;
}
}
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -278,9 +274,9 @@ class Xenforo extends Software
/**
* Can we convert settings?
*
* @return boolean
* @return boolean
*/
public static function canConvertSettings()
public static function canConvertSettings(): bool
{
return TRUE;
}
@@ -288,9 +284,9 @@ class Xenforo extends Software
/**
* List of Conversion Methods that require more information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
$return = array(
'convertAttachments',
@@ -312,10 +308,10 @@ class Xenforo extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
@@ -487,9 +483,9 @@ class Xenforo extends Software
/**
* Settings Map
*
* @return array
* @return array
*/
public function settingsMap()
public function settingsMap(): array
{
return array(
'boardTitle' => 'board_name',
@@ -499,9 +495,9 @@ class Xenforo extends Software
/**
* Settings Map Listing
*
* @return array
* @return array
*/
public function settingsMapList()
public function settingsMapList(): array
{
$settings = array();
foreach( $this->settingsMap() AS $theirs => $ours )
@@ -532,9 +528,9 @@ class Xenforo extends Software
/**
* Finish
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -567,9 +563,9 @@ class Xenforo extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -664,7 +660,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertAttachments()
public function convertAttachments() : void
{
$libraryClass = $this->getLibrary();
@@ -731,8 +727,7 @@ class Xenforo extends Software
Db::i()->update( 'core_message_posts', array( 'msg_post' => $post ), array( "msg_id=?", $messagePostId ) );
}
}
catch( UnderflowException $e ) {}
catch( OutOfRangeException $e ) {}
catch( UnderflowException|OutOfRangeException $e ) {}
$libraryClass->setLastKeyValue( $row['attachment_id'] );
}
@@ -743,7 +738,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertEmoticons()
public function convertEmoticons() : void
{
$libraryClass = $this->getLibrary();
@@ -790,7 +785,7 @@ class Xenforo extends Software
$fileurl = explode( '/', $row['image_url'] );
$filename = array_pop( $fileurl );
if( static::$isLegacy == FALSE AND !empty( $row['image_url_2x'] ) )
if( !static::$isLegacy AND !empty( $row['image_url_2x'] ) )
{
$filedata = file_get_contents( $row['image_url_2x'] );
$fileurlx2 = explode( '/', $row['image_url_2x'] );
@@ -803,7 +798,7 @@ class Xenforo extends Software
$filename = array_pop( $fileurl );
$filepath = rtrim( $this->app->_session['more_info']['convertEmoticons']['emoticon_path'], '/' ) . '/' . implode( '/', $fileurl );
if( static::$isLegacy == FALSE AND !empty( $row['image_url_2x'] ) )
if( !static::$isLegacy AND !empty( $row['image_url_2x'] ) )
{
$fileurlx2 = explode( '/', $row['image_url_2x'] );
$filenamex2 = array_pop( $fileurlx2 );
@@ -861,7 +856,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertProfileFields()
public function convertProfileFields() : void
{
$libraryClass = $this->getLibrary();
@@ -895,7 +890,7 @@ class Xenforo extends Software
* @param string $type XF Field Type
* @return string IPS Field Type
*/
protected function _fieldMap( $type )
protected function _fieldMap( string $type ) : string
{
switch( $type )
{
@@ -903,19 +898,15 @@ class Xenforo extends Software
case 'radio':
case 'checkbox':
return ucwords( $type );
break;
case 'textarea':
return 'TextArea';
break;
case 'multiselect':
return 'Select';
break;
default:
return 'Text';
break;
}
}
@@ -924,7 +915,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -958,10 +949,6 @@ class Xenforo extends Software
$info['g_view_board'] = ($perm['permission_value'] == 'allow') ? 1 : 0;
break;
case 'deleteOwnPost' :
$info['g_delete_own_posts'] = ($perm['permission_value'] == 'allow') ? 1 : 0;
break;
case 'editOwnPost':
$info['g_edit_posts'] = ($perm['permission_value'] == 'allow') ? 1 : 0;
break;
@@ -975,6 +962,7 @@ class Xenforo extends Software
break;
case 'deleteOwnThread':
case 'deleteOwnPost' :
$info['g_delete_own_posts'] = ($perm['permission_value'] == 'allow') ? 1 : 0;
break;
@@ -1010,7 +998,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertWarnReasons()
public function convertWarnReasons() : void
{
$libraryClass = $this->getLibrary();
@@ -1053,14 +1041,14 @@ class Xenforo extends Software
/**
* @brief Member history type map
*/
protected static $changeLogTypes = array( 'username' => 'display_name', 'email' => 'email_change', 'user_group_id' => 'group', 'secondary_group_ids' => 'group' );
protected static array $changeLogTypes = array( 'username' => 'display_name', 'email' => 'email_change', 'user_group_id' => 'group', 'secondary_group_ids' => 'group' );
/**
* Convert member history
*
* @return void
*/
public function convertMemberHistory()
public function convertMemberHistory() : void
{
$libraryClass = $this->getLibrary();
@@ -1108,7 +1096,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
@@ -1381,11 +1369,11 @@ class Xenforo extends Software
* @param array $settings Settings to convert
* @return void
*/
public function convertSettings( $settings=array() )
public function convertSettings( array $settings=array() ) : void
{
foreach( $this->settingsMap() AS $theirs => $ours )
{
if ( !isset( $values[ $ours ] ) OR $values[ $ours ] == FALSE )
if ( !isset( $settings[ $ours ] ) OR !$settings[$ours] )
{
continue;
}
@@ -1408,7 +1396,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertIgnoredUsers()
public function convertIgnoredUsers() : void
{
$libraryClass = $this->getLibrary();
@@ -1427,7 +1415,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertReactions()
public function convertReactions() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'reaction_id' );
@@ -1510,7 +1498,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
@@ -1566,7 +1554,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
@@ -1602,10 +1590,10 @@ class Xenforo extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
* @todo The proxy.php redirection is not validating the hash that XenForo set previously, derived from the globalSalt and the option imageLinkProxyKey. We need to either validate the hash (there is an open proxy concern), or we need to convert all calls to proxy.php in posted content to prevent broken images in posts.
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -1646,7 +1634,7 @@ class Xenforo extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
$password = html_entity_decode( $password );
@@ -45,12 +45,12 @@ class Invisioncommunity extends Software
/**
* @brief Whether the versions of IPS4 match
*/
public static $versionMatch = FALSE;
public static bool $versionMatch = FALSE;
/**
* @brief Whether the database has been required
*/
public static $dbNeeded = FALSE;
public static bool $dbNeeded = FALSE;
/**
* Constructor
@@ -60,12 +60,12 @@ class Invisioncommunity extends Software
* @return void
* @throws InvalidArgumentException
*/
public function __construct( App $app, $needDB = TRUE )
public function __construct( App $app, bool $needDB = TRUE )
{
/* Set filename obscuring flag */
Library::$obscureFilenames = FALSE;
$return = parent::__construct( $app, $needDB );
parent::__construct( $app, $needDB );
if ( $needDB )
{
@@ -86,8 +86,6 @@ class Invisioncommunity extends Software
/* Get parent sauce */
$this->parent = $this->app->_parent->getSource();
}
return $return;
}
/**
@@ -95,7 +93,7 @@ class Invisioncommunity extends Software
*
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return 'Invision Community (' . Application::load( 'core' )->version . ')';
@@ -106,7 +104,7 @@ class Invisioncommunity extends Software
*
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "invisioncommunity";
@@ -115,9 +113,9 @@ class Invisioncommunity extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
if ( !static::$versionMatch and static::$dbNeeded )
{
@@ -157,7 +155,7 @@ class Invisioncommunity extends Software
*
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -165,9 +163,9 @@ class Invisioncommunity extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'invisioncommunity' ) );
}
@@ -177,7 +175,7 @@ class Invisioncommunity extends Software
*
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertAttachments',
@@ -188,9 +186,9 @@ class Invisioncommunity extends Software
/**
* Finish
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
Task::queue( 'core', 'RebuildItemCounts', array( 'class' => 'IPS\downloads\File', 'count' => 0 ), 4, array( 'class' ) );
Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\downloads\Category', 'count' => 0 ), 5, array( 'class' ) );
@@ -206,7 +204,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertAttachments()
public function convertAttachments() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'attach_id' );
@@ -247,9 +245,9 @@ class Invisioncommunity extends Software
* Get More Information
*
* @param string $method Method name
* @return array
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
@@ -262,7 +260,7 @@ class Invisioncommunity extends Software
$return[ $method ] = array(
'upload_path' => array(
'field_class' => 'IPS\\Helpers\\Form\\Text',
'field_default' => isset( $this->parent->app->_session['more_info']['convertEmoticons']['upload_path'] ) ? $this->parent->app->_session['more_info']['convertEmoticons']['upload_path'] : NULL,
'field_default' => $this->parent->app->_session['more_info']['convertEmoticons']['upload_path'] ?? NULL,
'field_required' => TRUE,
'field_extra' => array(),
'field_hint' => Member::loggedIn()->language()->addToStack( 'convert_invision_upload_path' ),
@@ -285,7 +283,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertDownloadsCategories()
public function convertDownloadsCategories() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'cid' );
@@ -325,7 +323,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertDownloadsCfields()
public function convertDownloadsCfields() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'cf_id' );
@@ -349,7 +347,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertDownloadsComments()
public function convertDownloadsComments() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'comment_id' );
@@ -382,7 +380,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertDownloadsFiles()
public function convertDownloadsFiles() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'file_id' );
@@ -445,7 +443,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertDownloadsReviews()
public function convertDownloadsReviews() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'comment_id' );
@@ -476,9 +474,9 @@ class Invisioncommunity extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -19,7 +19,7 @@ use InvalidArgumentException;
use IPS\Content;
use IPS\convert\App;
use IPS\convert\Software;
use IPS\convert\Tools\Xenforo;
use IPS\convert\Tools\Xenforo as XenforoTrait;
use IPS\Db;
use IPS\Http\Url;
use IPS\Member;
@@ -44,22 +44,22 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
*/
class Xenforo extends Software
{
use Xenforo;
use XenforoTrait;
/**
* @brief The similarities between XF1 and XF2 are close enough that we can use the same converter
*/
public static $isLegacy = NULL;
public static ?bool $isLegacy = NULL;
/**
* @brief XF2 Has prefixes on RM tables
*/
public static $tablePrefix = '';
public static string $tablePrefix = '';
/**
* @brief XF2.1 changed serialized data to json decoded
*/
public static $useJson = FALSE;
public static bool $useJson = FALSE;
/**
* Constructor
@@ -69,9 +69,9 @@ class Xenforo extends Software
* @return void
* @throws InvalidArgumentException
*/
public function __construct( App $app, $needDB=TRUE )
public function __construct( App $app, bool $needDB=TRUE )
{
$return = parent::__construct( $app, $needDB );
parent::__construct( $app, $needDB );
if ( $needDB )
{
@@ -101,16 +101,14 @@ class Xenforo extends Software
}
catch( Exception $e ) {} # If we can't query, we won't be able to do anything anyway
}
return $return;
}
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "XenForo Resource Manager (1.5.x/2.0.x/2.1.x/2.2.x)";
@@ -119,9 +117,9 @@ class Xenforo extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "xenforo";
@@ -130,9 +128,9 @@ class Xenforo extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertDownloadsCfields' => array(
@@ -157,13 +155,13 @@ class Xenforo extends Software
/**
* Count Source Rows for a specific step
*
* @param string $table The table containing the rows to count.
* @param array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @param string $table The table containing the rows to count.
* @param string|array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @throws \IPS\convert\Exception
*/
public function countRows( $table, $where=NULL, $recache=FALSE )
public function countRows( string $table, string|array|null $where=NULL, bool $recache=FALSE ): int
{
switch( $table )
{
@@ -177,21 +175,21 @@ class Xenforo extends Software
{
return $this->db->select( 'COUNT(*)', 'xf_rm_resource_field' )->first();
}
break;
default:
return parent::countRows( $table, $where, $recache );
break;
}
return 0;
}
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -199,9 +197,9 @@ class Xenforo extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'xenforo' ) );
}
@@ -209,9 +207,9 @@ class Xenforo extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertDownloadsFiles',
@@ -222,9 +220,9 @@ class Xenforo extends Software
/**
* Finish
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
Task::queue( 'core', 'RebuildItemCounts', array( 'class' => 'IPS\downloads\File', 'count' => 0 ), 4, array( 'class' ) );
Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\downloads\Category', 'count' => 0 ), 5, array( 'class' ) );
@@ -237,10 +235,10 @@ class Xenforo extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
switch( $method )
@@ -276,7 +274,7 @@ class Xenforo extends Software
* @param string $xfTwoTitle XF2 Phrase Title
* @return string|null
*/
protected function getPhrase( $xfOneTitle, $xfTwoTitle )
protected function getPhrase( string $xfOneTitle, string $xfTwoTitle ) : ?string
{
try
{
@@ -294,7 +292,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertDownloadsCfields()
public function convertDownloadsCfields() : void
{
$libraryClass = $this->getLibrary();
@@ -303,7 +301,7 @@ class Xenforo extends Software
$inputFormat = '';
if( $row['match_type'] == 'regex' AND static::$isLegacy === FALSE )
{
$inputFormat = ( $row['match_type'] == 'regex' ) ? '/' . $row['match_regex'] .'/i' : '';
$inputFormat = '/' . $row['match_regex'] .'/i';
}
elseif( $row['match_type'] == 'regex' )
{
@@ -331,9 +329,9 @@ class Xenforo extends Software
*
* @param string $type Custom field type
* @param string $match Match type
* @return void
* @return string
*/
protected function _mapFieldType( $type, $match )
protected function _mapFieldType( string $type, string $match ) : string
{
switch( $type )
{
@@ -343,39 +341,32 @@ class Xenforo extends Software
{
case 'email':
return 'Email';
break;
case 'url':
return 'Url';
break;
case 'number':
return 'Number';
break;
default:
return 'Text';
break;
}
break;
case 'textarea':
return 'TextArea';
break;
case 'bbcode':
return 'Editor';
break;
case 'multiselect':
case 'select':
return 'Select';
break;
case 'checkbox':
return 'CheckboxSet';
break;
}
return '';
}
/**
@@ -383,7 +374,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertDownloadsCategories()
public function convertDownloadsCategories() : void
{
$libraryClass = $this->getLibrary();
@@ -413,8 +404,8 @@ class Xenforo extends Software
$info = array(
'cid' => $row['resource_category_id'],
'cparent' => $row['parent_category_id'],
'cname' => isset( $row['category_title'] ) ? $row['category_title'] : $row['title'],
'cdesc' => isset( $row['category_description'] ) ? $row['category_description'] : $row['description'],
'cname' => $row['category_title'] ?? $row['title'],
'cdesc' => $row['category_description'] ?? $row['description'],
'copen' => ( $row['allow_local'] OR $row['allow_external'] ) ? 1 : 0,
'cposition' => $row['display_order'],
'ccfields' => $ccfields,
@@ -452,7 +443,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertDownloadsFiles()
public function convertDownloadsFiles() : void
{
$libraryClass = $this->getLibrary();
@@ -614,7 +605,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertDownloadsReviews()
public function convertDownloadsReviews() : void
{
$libraryClass = $this->getLibrary();
@@ -673,9 +664,9 @@ class Xenforo extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -33,9 +33,9 @@ class Bbpress extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "bbPress (for WordPress)";
@@ -44,9 +44,9 @@ class Bbpress extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "bbpress";
@@ -55,9 +55,9 @@ class Bbpress extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertForumsForums' => array(
@@ -78,9 +78,9 @@ class Bbpress extends Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -88,9 +88,9 @@ class Bbpress extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'wordpress' ) );
}
@@ -98,9 +98,9 @@ class Bbpress extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Content Rebuilds */
Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\forums\Forum', 'count' => 0 ), 4, array( 'class' ) );
@@ -44,9 +44,9 @@ class Expressionengine extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "ExpressionEngine";
@@ -55,9 +55,9 @@ class Expressionengine extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "expressionengine";
@@ -66,9 +66,9 @@ class Expressionengine extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertForumsForums' => array(
@@ -98,9 +98,9 @@ class Expressionengine extends Software
/**
* Allows software to add additional menu row options
*
* @return array
* @return array
*/
public function extraMenuRows()
public function extraMenuRows(): array
{
$rows = array();
$rows['convertOtherPosts'] = array(
@@ -120,9 +120,9 @@ class Expressionengine extends Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -130,9 +130,9 @@ class Expressionengine extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'expressionengine' ) );
}
@@ -140,9 +140,9 @@ class Expressionengine extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertAttachments'
@@ -152,10 +152,10 @@ class Expressionengine extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
switch( $method )
@@ -180,9 +180,9 @@ class Expressionengine extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Content Rebuilds */
Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\forums\Forum', 'count' => 0 ), 4, array( 'class' ) );
@@ -473,9 +473,9 @@ class Expressionengine extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -94,9 +94,9 @@ class Invisioncommunity extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return 'Invision Community (' . Application::load( 'core' )->version . ')';
@@ -105,9 +105,9 @@ class Invisioncommunity extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "invisioncommunity";
@@ -116,9 +116,9 @@ class Invisioncommunity extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
if( !static::$versionMatch AND static::$dbNeeded )
{
@@ -168,13 +168,13 @@ class Invisioncommunity extends Software
/**
* Count Source Rows for a specific step
*
* @param string $table The table containing the rows to count.
* @param array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @param string $table The table containing the rows to count.
* @param string|array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @throws \IPS\convert\Exception
*/
public function countRows( $table, $where=NULL, $recache=FALSE )
public function countRows( string $table, string|array|null $where=NULL, bool $recache=FALSE ): int
{
switch( $table )
{
@@ -198,9 +198,9 @@ class Invisioncommunity extends Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -208,9 +208,9 @@ class Invisioncommunity extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertAttachments'
@@ -220,10 +220,10 @@ class Invisioncommunity extends Software
/**
* Get More Information
*
* @param string $method Method name
* @return array
* @param string $method Method name
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
@@ -251,9 +251,9 @@ class Invisioncommunity extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'invisioncommunity' ) );
}
@@ -261,9 +261,9 @@ class Invisioncommunity extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Content Rebuilds */
Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\forums\Forum', 'count' => 0 ), 4, array( 'class' ) );
@@ -569,9 +569,9 @@ class Invisioncommunity extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -44,9 +44,9 @@ class Mybb extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "MyBB 1.8.x";
@@ -55,9 +55,9 @@ class Mybb extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "mybb";
@@ -66,9 +66,9 @@ class Mybb extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertForumsForums' => array(
@@ -93,9 +93,9 @@ class Mybb extends Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -103,9 +103,9 @@ class Mybb extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'mybb' ) );
}
@@ -113,9 +113,9 @@ class Mybb extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertAttachments',
@@ -126,10 +126,10 @@ class Mybb extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
@@ -185,9 +185,9 @@ class Mybb extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Content Rebuilds */
Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\forums\Forum', 'count' => 0 ), 4, array( 'class' ) );
@@ -639,9 +639,9 @@ class Mybb extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
Loaded 100 of 276 files, more files were not shown because too many files have changed in this diff. Show more