TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

March 28, 2024, 08:41:43 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,104
  • Total Topics: 21,212
  • Online today: 176
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 1
  • Guests: 188
  • Total: 189
  • illori

Elkarte TinyPortal Testing

Started by tino, January 05, 2021, 01:55:34 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

tino

Quote from: tino on February 20, 2022, 07:11:55 PM
Quote from: McFly on February 14, 2022, 03:04:56 PM
Master and development. Just tested the version from this topic on the installation in my signature (homeserver). Can edit categories  :D ... but no PHP block editing.

I can't get the PHP block to break how you describe.

I've managed to track it down, slightly weird set of issues but I see what I have done. It'll take a while to fix as it impacts all the blocks.  :doh:

McFly

Glad to hear that you now have an idea what the error is and will (hopefully) have it sorted out soon.

Would also be fine to read a short summary about it, because I couldn't make any sense of it, since the PHP edit field works for the articles.

O0
"I'm not going to censor myself to comfort your ignorance."

Testsites (may be online or not ;-) )
ElkArte 1.1.x & TP on Apache2.4.48, PHP 8.1.2 FPM/FastCGI, MariaDB 10.5.12

tino

Quote from: McFly on February 21, 2022, 07:06:14 AM
Glad to hear that you now have an idea what the error is and will (hopefully) have it sorted out soon.

Would also be fine to read a short summary about it, because I couldn't make any sense of it, since the PHP edit field works for the articles.

O0

Eventually done a quick fix for this. I'll do it properly later... one day.

https://github.com/tinoest/ElkTinyPortal/blob/95e3720c9a25e8205c8ac8a4cdd32900af3dae4f/TinyPortal/Views/TPBlockAdmin.template.php#L83

The error was on this line, I had the parameters the wrong way round, as I hadn't moved the other function over to use the block they still worked.

My local was in a different state and I had the PHP block named something different and it wasn't being removed when it should be.


McFly

#143
Quote from: tino on February 27, 2022, 05:15:14 PM
...
Eventually done a quick fix for this. I'll do it properly later... one day.
...

Just installed the latest master branch on the PHP-8.0.8 ... I wanna hug someone!  ^-^
Tested the "Hello" and the mini-calendar. Calendar throws an error (Class "TinyPortal\Util" not found) and messes up the page. ???

Quote from: tino on February 27, 2022, 05:15:14 PM
...
My local was in a different state and I had the PHP block named something different and it wasn't being removed when it should be.

Sometimes the little things are the proverbial needles in the haystack.  8)
"I'm not going to censor myself to comfort your ignorance."

Testsites (may be online or not ;-) )
ElkArte 1.1.x & TP on Apache2.4.48, PHP 8.1.2 FPM/FastCGI, MariaDB 10.5.12

McFly

Now also installed under PHP 7.4.27. Besides the "Classic Recent Topics", "Hello", "Search articles", "News Box" and the "Online Users Box" PHP block, also the blocks for the Levertine gallery work!  O0

The others come along with Class "TinyPortal/Util" or "TinyPortal/Database" not found.
"I'm not going to censor myself to comfort your ignorance."

Testsites (may be online or not ;-) )
ElkArte 1.1.x & TP on Apache2.4.48, PHP 8.1.2 FPM/FastCGI, MariaDB 10.5.12

McFly

Just tried something. Fix for the calendar block:

In the PHP code, look for the line:
$title = TinyPortal\Util::htmlspecialchars(ucfirst($month_name)).' '.$year;  //note that some locales don't capitalize month and day names

Simply delete the "TinyPortal\Util::". I am not a PHP programmer, but after that the error is gone and the calendar is displayed correctly.  ::)

BTW: Any idea for an internationalized version?
"I'm not going to censor myself to comfort your ignorance."

Testsites (may be online or not ;-) )
ElkArte 1.1.x & TP on Apache2.4.48, PHP 8.1.2 FPM/FastCGI, MariaDB 10.5.12

tino

Quote from: McFly on March 01, 2022, 12:33:38 PM
Just tried something. Fix for the calendar block:

In the PHP code, look for the line:
$title = TinyPortal\Util::htmlspecialchars(ucfirst($month_name)).' '.$year;  //note that some locales don't capitalize month and day names

Simply delete the "TinyPortal\Util::". I am not a PHP programmer, but after that the error is gone and the calendar is displayed correctly.  ::)

BTW: Any idea for an internationalized version?

You mean an internationalised calendar?

I think it just needs a \ before the TinyPortal for it to work correctly. As I'm guessing the namespace isn't found correctly.

McFly

#147
A simple backslash doesn't work. But adding a "\Model" after "TinyPortal" works. The path to the php-files has changed. ...  :o

Indeed! I ment an internationalized calendar. And btw: It is not PHP8 compatible, causo of use of list() and each().

Perhaps the function of the ELK calender module (template_show_month_grid('current')) could be used?
"I'm not going to censor myself to comfort your ignorance."

Testsites (may be online or not ;-) )
ElkArte 1.1.x & TP on Apache2.4.48, PHP 8.1.2 FPM/FastCGI, MariaDB 10.5.12

McFly

#148
Weird things are happening again.  :idiot2:

Just had TP 2.1.1 installed on an SMF test system. This installation uses the same database as the ELK TP installation, but with different prefixes. So should not be a problem. After creating an article and setting it to only display articles on the home page, the panels disappeared on BOTH test installations!

Is this related to the cookies?

EDIT: After completely uninstalling both TPs and reinstalling only on the ELK system ... it was the display setting for language.

But other inputs for language control are NOT displayed in the settings of the blocks.
"I'm not going to censor myself to comfort your ignorance."

Testsites (may be online or not ;-) )
ElkArte 1.1.x & TP on Apache2.4.48, PHP 8.1.2 FPM/FastCGI, MariaDB 10.5.12

McFly

#149
Don't call me a programmer. This is just the result of copy & paste and trail & error! I can't say if this is all correct from a security point of view, or which code is possibly unnecessary.

Calendar PHP block, internationalized and PHP8 ready, only ELK with enabled calendar

global $txt, $context, $modSettings, $scripturl, $options;
loadTemplate('Calendar');
require_once(SUBSDIR . '/Calendar.subs.php');
$today = getTodayInfo();
$curPage = array(
'day' => isset($_REQUEST['day']) ? (int) $_REQUEST['day'] : $today['day'],
'month' => isset($_REQUEST['month']) ? (int) $_REQUEST['month'] : $today['month'],
'year' => isset($_REQUEST['year']) ? (int) $_REQUEST['year'] : $today['year']
);
$calendarOptions = array(
'start_day' => !empty($options['calendar_start_day']) ? $options['calendar_start_day'] : 0,
'show_birthdays' => in_array($modSettings['cal_showbdays'], array(1, 2)),
'show_events' => in_array($modSettings['cal_showevents'], array(1, 2)),
'show_holidays' => in_array($modSettings['cal_showholidays'], array(1, 2)),
'show_week_num' => true,
'short_day_titles' => false,
'show_next_prev' => true,
'show_week_links' => true,
'size' => 'large',
);
$calendarOptions['show_birthdays'] = $calendarOptions['show_events'] = $calendarOptions['show_holidays'] = false;
$calendarOptions['short_day_titles'] = true;
$calendarOptions['show_next_prev'] = false;
$calendarOptions['show_week_links'] = false;
$calendarOptions['size'] = 'small';
$context['calendar_grid_current'] = getCalendarGrid($curPage['month'], $curPage['year'], $calendarOptions);
echo '
<style type="text/css">
#month_grid {
float: none;
padding: 0;
width: 100%;
}
</style>
<div id="calendar">
<div id="month_grid">
', template_show_month_grid('current'), '
</div>
</div>';
"I'm not going to censor myself to comfort your ignorance."

Testsites (may be online or not ;-) )
ElkArte 1.1.x & TP on Apache2.4.48, PHP 8.1.2 FPM/FastCGI, MariaDB 10.5.12