TheDoggyBrad Software Lab
3 years ago
•Component Name: Speedtest
•ID: speedtest
•Menu Name: OpenSpeedTest
•Author: TheDoggyBrad
•Description: Offer speedtest to your users, powered by OpenSpeedTest
•License: OSSN License v4
•Author URL: https://github.com/thedoggybrad/
•License URL: https://www.opensource-socialnetwork.org/licence/v4.0.html
•Latest Version: 1.8 (Available here on OSSN Website and on Github)
•Older Versions: 1.7, 1.6, 1.5.1, 1.5, 1.4, 1.3, 1.2, 1.1 and 1.0 (Available only on Github)
•Requires OSSN: version 5.6
•Tested up to: OSSN version 7.0
Alternate Download Link: https://github.com/thedoggybrad/speedtest-ossn/releases/download/1.8/speedtest.zip

This component is 100% stable and working in OSSN version 7.0. But, please always use the latest version to avoid any problems. By the way, the older versions are not maintained on this listing but they are available on my Github repository.
Note: I am willing to fix any problems related to this component, just please let me know.
Very Special Thanks to
https://www.opensource-socialnetwork.org/u/arsalanshah
https://www.opensource-socialnetwork.org/u/zetman
TheDoggyBrad Software Lab
Replied 3 years ago
But I do think that it is fine to actually even I initially register it to everyone.
Since this line exists:
if (ossn_isLoggedin())
TheDoggyBrad Software Lab
Replied 3 years ago
if(!ossn_isLoggedin()) {
ossn_error_page();
}
Ah! this one. What should I do about the register you are saying?
TheDoggyBrad Software Lab
Replied 3 years ago
Line 43 ({) and 57 (}) - Opening and Closing this:
$title = ossn_print('com:ossn:speedtest');
$contents['content'] = ossn_plugin_view('pages/speedtest', array(
));
$content = ossn_set_page_layout('newsfeed', $contents);
echo ossn_view_page($title, $content);
Michael Zülsdorff
Replied 3 years ago
Next:
What are these strange curly braces on line 43 and 57 good for?
And:
Since you don't seem to want logged-off users to execute your speedtest page - why do you initially register that page for everyone?
If you would register that page for logged-in user only (as you did for the menu) you would not need that extra check inside your speedtest_pages function
TheDoggyBrad Software Lab
Replied 3 years ago
Version 1.3 - Made the URL from https://example.com/speedtest/speedtest to just simply https://example.com/speedtest
Version 1.2 will be recalled to avoid user problems. But the older versions 1.0 to 1.2 will still be available on my Github repository.
TheDoggyBrad Software Lab
Replied 3 years ago
Version 1.2 removes:
$guid = $pages;
and
switch($pages[0])
case 'speedtest':
And still results into a functional component.
TheDoggyBrad Software Lab
Replied 3 years ago
Version 1.2
Fixes issues reported by https://www.opensource-socialnetwork.org/u/zetman
Version 1.1 has been taken down by me.
Thanks to @Michael Zülsdorff
Michael Zülsdorff
Replied 3 years ago
Thanks for applying the first fixes.
Still in place: that obsolete $guid = $pages; please remove it.
Then, let's go ahead and see what's still strange:
You coded: ossn_register_page('speedtest', 'speedtest_pages');
That is, whenever you enter https://somesite/speedtest in your browser, your accompanying function speedtest_pages() will be reliably executed.
So, why do you have that extra switch which is comparing again on 'speedtest' ?
A switch only makes sense if you are expecting different cases you need to handle.
TheDoggyBrad Software Lab
Replied 3 years ago
The original version 1.0 has been taken down by me just for you not to download the version with component naming issues.
TheDoggyBrad Software Lab
Replied 3 years ago
Version 1.1 - Fixes unecessary passing of guid to ossn_plugin_view and component naming issues
Thanks to Michael Zülsdorff