Login  |  Register
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome, Guest. Please login or register.
Did you miss your activation email?

August 16, 2022, 10:21:31 AM

Login with username, password and session length
Members
  • Total Members: 3842
  • Latest: Kokoro
Stats
  • Total Posts: 193479
  • Total Topics: 21088
  • Online today: 55
  • Online ever: 1035
  • (November 26, 2020, 04:45:12 AM)
Users Online
Users: 0
Guests: 56
Total: 56

Author Topic: Elkarte TinyPortal Testing  (Read 17829 times)

0 Members and 1 Guest are viewing this topic.

Offline tino

  • Developer
  • *
  • Posts: 2613
Re: Elkarte TinyPortal Testing
« Reply #140 on: February 20, 2022, 12:32:26 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:

Offline McFly

  • Jr. Member
  • **
  • Posts: 71
    • Die Annoholiker
Re: Elkarte TinyPortal Testing
« Reply #141 on: February 21, 2022, 12: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
"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

Offline tino

  • Developer
  • *
  • Posts: 2613
Re: Elkarte TinyPortal Testing
« Reply #142 on: February 27, 2022, 10:15: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.


Offline McFly

  • Jr. Member
  • **
  • Posts: 71
    • Die Annoholiker
Re: Elkarte TinyPortal Testing
« Reply #143 on: February 28, 2022, 04:49:26 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. ???

...
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)
« Last Edit: March 01, 2022, 04:51:07 AM by McFly »
"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

Offline McFly

  • Jr. Member
  • **
  • Posts: 71
    • Die Annoholiker
Re: Elkarte TinyPortal Testing
« Reply #144 on: March 01, 2022, 04:55:29 AM »
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

Offline McFly

  • Jr. Member
  • **
  • Posts: 71
    • Die Annoholiker
Re: Elkarte TinyPortal Testing
« Reply #145 on: March 01, 2022, 05:33:38 AM »
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

Offline tino

  • Developer
  • *
  • Posts: 2613
Re: Elkarte TinyPortal Testing
« Reply #146 on: March 02, 2022, 12:30:54 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.

Offline McFly

  • Jr. Member
  • **
  • Posts: 71
    • Die Annoholiker
Re: Elkarte TinyPortal Testing
« Reply #147 on: March 02, 2022, 03:11:51 PM »
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?
« Last Edit: March 04, 2022, 02:03:24 AM by McFly »
"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

Offline McFly

  • Jr. Member
  • **
  • Posts: 71
    • Die Annoholiker
Re: Elkarte TinyPortal Testing
« Reply #148 on: March 03, 2022, 02:47:19 AM »
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.
« Last Edit: March 03, 2022, 03:24:23 AM by McFly »
"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

Offline McFly

  • Jr. Member
  • **
  • Posts: 71
    • Die Annoholiker
Re: Elkarte TinyPortal Testing
« Reply #149 on: March 04, 2022, 03:25:42 AM »
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

Code: [Select]
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>';
« Last Edit: March 05, 2022, 04:36:50 AM by McFly »
"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