Jump to content

Community

CodingJungle

+Clients
  • Posts

    3,001
  • Joined

  • Days Won

    30

 Content Type 

Profiles

Downloads

IPS4 Providers

Release Notes

IPS4 Guides

IPS4 Developer Documentation

Invision Community Blog

Forums

Store

Everything posted by CodingJungle

  1. yeah i originally thought it was the hookData, cause when i looked at the IPS code in the section the error was referencing i thought that was the only one that it could be, cause hookData() use to do something and use to be required to call it πŸ™‚ , so i'm not entirely sure when they changed that, cause it is almost identical to the 4.5 code and my sister has my laptop so i can't look up previous versions atm. anyway, if you are overloading a template, you need to put that container code in it, to check to see if it is callable, then use call_user_func_array to call the method instead of parent.
  2. @Adriano Faria its not 4.6 that is at fault per se, IPS is at some fault here due to the way they engineered how the theme hooks work, but it's the latest php 7.4 and 8.0 that is the issue. example: <?php class myclass { public function myfunction(){ return parent::myfunction(); } } this will error out on the new versions of 7.4 and 8.0, cause myclass isn't a child class of anything, so there is no parent to call. the theme hooks get eval'ed as stand alone classes, they replaced the " extends _HOOK_FILE" with "_tmp" (same with parent::hookData() gets replaced with array() ), so the class would be something like class my_theme_hook_temp {}. during the eval process, it it validating the code and that validation is failing on anything with parent::myfunction() that is being called in the code, that is why the call_user_func_array is working for toolbox, cause it passes the validation, so the template will build. so its not the parent::hookData() that i original thought it was, cause i just took a cursory look at the code, patched my files, it seemed to work cause my datastore wasn't cleared, but as soon as it cleared, i got that error. so in any template overrides you are doing, you need to wrap it with a if(\is_callable('parent::myfunction')){} and then inside the if statement, call the parent method with: return \call_user_func_array( 'parent::' . __FUNCTION__, \func_get_args() ); like i have done in the example hook i posted a few post up. if you need further help, send me the app, and i will make the changes so you can see within your code what i'm talking about πŸ™‚
  3. on the hookData() method, just do: public static function hookData(){ return []; } or public static function hookData(){ return parent::hookData(); } it gets replaced by an empty array anyway before its eval'ed the solution i came up with last night is to overridden templates methods, look at the test.tar hooks folder, you will see what i mean. its a theme hook in php mode. the other thing you should do, is manually delete everything in the datastore folder, there would be times when i was testing that would be causing the issue. here is one of the them hooks i use in my toolbox apps, i have two template methods i'm overriding to be able to manipulate their parameters. //<?php /* To prevent PHP errors (extending class does not exist) revealing path */ use IPS\Output; use IPS\Request; use IPS\Theme; if (!defined('\IPS\SUITE_UNIQUE_KEY')) { exit; } class toolbox_hook_adminGlobalTemplate extends _HOOK_CLASS_ { /* !Hook Data - DO NOT REMOVE */ public static function hookData() { if (\is_callable('parent::hookData')) { return array_merge_recursive( [ 'globalTemplate' => [ 0 => [ 'selector' => '#ipsLayout_header', 'type' => 'add_inside_start', 'content' => '{{if $menu = \IPS\toolbox\Menu::i()->build()}} {$menu|raw} {{endif}}', ], 1 => [ 'selector' => 'html > body', 'type' => 'add_inside_end', 'content' => '<!--ipsQueryLog-->', ], ], ], parent::hookData() ); } return []; } /* End Hook Data */ public function globalTemplate($title, $html, $location = []) { Output::i()->cssFiles = array_merge( Output::i()->cssFiles, Theme::i()->css('devbar.css', 'toolbox', 'admin') ); if ( \is_callable('parent::globalTemplate') ) { return \call_user_func_array( 'parent::' . __FUNCTION__, \func_get_args() ); } } public function tabs( $tabNames, $activeId, $defaultContent, $url, $tabParam = 'tab', $tabClasses = '', $panelClasses = '' ) { if (Request::i()->app === 'core' && Request::i()->module === 'applications' && Request::i( )->controller === 'developer' && !Request::i()->do) { $tabNames['SchemaImports'] = 'dtdevplus_schema_imports'; } if ( \is_callable('parent::tabs') ) { return \call_user_func_array( 'parent::' . __FUNCTION__, [$tabNames, $activeId, $defaultContent, $url, $tabParam, $tabClasses, $panelClasses] ); } } }
  4. let me know, it seems to have worked for the toolbox, now i possibly gotta figure out a clever way to automate this for the future πŸ™‚
  5. @Adriano Faria if ( \is_callable('parent::includeCSS') ) { return \call_user_func_array( 'parent::' . __FUNCTION__, \func_get_args() ); } something like this appears to work (change the if statement to the method you are overriding). i haven't tested it exhaustively, but it might be better than waiting for ips 4.12 for a fix πŸ˜›
  6. test 1.0.0.tar here is a proof of concept app for this issue, it is just one theme hook in php mode, overriding 'includeCss': //<?php /* To prevent PHP errors (extending class does not exist) revealing path */ if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) ) { exit; } class test_hook_globalTemplate extends _HOOK_CLASS_ { /* !Hook Data - DO NOT REMOVE */ public static function hookData() { return parent::hookData(); } /* End Hook Data */ public function includeCSS(){ return parent::includeCSS(); } } parent::hookData() gets replaced with an empty array before you eval it, so the only thing that can be causing it is the parent call to includeCss()
  7. [Thu Jul 08 19:00:59.697206 2021] [proxy_fcgi:error] [pid 3910:tid 6158315520] [client ::1:51242] AH01071: Got error 'PHP message: PHP Fatal error: Cannot use "parent" when current class scope has no parent in /Users/michael/public_html/dev/system/Theme/Theme.php(2613) : eval()'d code on line 57', referer: http://localhost/~michael/dev/ this is the error that shows up in my apache log. i've tried several different things, even checking if parent is callable on the overloaded templates in the hook, still causes this error to pop up in php 8, not sure about 7.4, but i'd imagine it will there too as well. the line number might be a bit off for Theme.php as inserted some code to try to catch which theme hooks were erroring out.
  8. Okay after a bit more digging into the code, i see why this can happen. it is any theme hook, that has an override for a template in it or aka "theme hook in php mode" try{ if ( eval( "namespace IPS\\Theme;\n\n" . str_replace( array( ' extends _HOOK_CLASS_', 'parent::hookData()' ), array( '_tmp', 'array()' ), file_get_contents( $path . '/' . $data['file'] ) ) ) !== FALSE ) { $class = "IPS\\Theme\\" . $data['class'] . "_tmp"; $templateHooks = array_merge_recursive( $templateHooks, $class::hookData() ); } } catch ( \ParseError $e ) { } in php 8.0 it is now a fatal error to call a non existing parent class/method, in the latest php 7.4 it is a deprecated. so since at this point, the hook in php mode isn't actually extending another class, it is blowing up. this is def an engineering issue on IPS side of things. so technically any theme hook in php mode, that eval and try to call a parent method that doesn't exist, will throw this fatal/warning in the current versions of php. we don't see it while IN_DEV cause templates are compiled differently there. i wonder now if it happens with class hooks, that get wrapped up by IPS try/catch block they place inside every method, even if the method doesn't exist in the parent.
  9. yeah, after further debugging, that wasn't the solution, might've been a stale opcache on my end that made me think it was working. I really don't know now toolbox has a ton of hooks, its gonna take a lot of work to go thru each one and try to find the culprit.
  10. i submitted an update for it a few days ago to the market, so i don't know how long it will be till it is approved.
  11. i've released 2.4.0 of stratagem to the marketplace and my website (the marketplace one might take a little bit to be approved, i heard they have quite a backlog). here is the changelog for 2.4.0, a few new features and several fixes. fixed issue with project filters (they now work again :)), also fixed it showing cards that meet 1 or 2 of the criteria for filters instead of all of them. fixed issue for notifications, when a user is removed from a private project, they should now no longer be able to receive new notifications. fixed issue with "limit card view", due to a permission misconfiguration, wouldn't show all cards with a team member who had the permission to "card sort" or "card assign" fixed/change how calendar integration works. now we use a more custom solution, instead of directly using the calendar app. (still requires the calendar app to be installed, as this new method uses the css/js from calendar). this solution should prevent duplication of strategem calendars and duplicate stratagem events on that calendar, the calendar is now generated at access time, and the card events are generated then and there as well. NOTE: you can safely delete any stratagem calendars that were created by previous versions, as they will no longer be used. Copying: added in copying of project/column/cards. you will enable in project settings if you want copying to be enabled, and then assign the permissions to the teams as you see fit. Note: if a project is has limit card view enabled, then team members will only be able to copy the cards they can see (this also applies if they copy the project, it will only copy the cards they can see). This also applies to columns that have restrictions, if they aren't on the allow list (een if they can see the column and its cards), they will not have the copy option nor will they be copied if the project is copied. Note2: copying cards is a instant action, but copying a column or project runs thru a task, so there might be a delay between copying the column/project, before it shows up or is completed. Note3: A lot of the settings for a project will be copied, but things like "real time mode", "due date", "publish date", "slack hooks", "git repos", and a few others, will not carry over to a copied project, nor will teams. all copied cards from a project, will have their creation date and author updated to the time it was copied and the user who copied the project. Several new history entries, mostly related to copying cards/columns/projects. fixed issue with quick access, it should now update properly for any changes to columns. fixed "lock project" and limit card view settings, before if you locked a project with limit card view enabled, it would show the restricted cards to anyone who viewed the project, now it will function as it would before locking the project.
  12. just fyi, i got annoyed with the interface issues, and on my toolbox app, one of the tabs that is added is "table imports", this allows you to insert the data thru like phpmyadmin/adminer and then import it into your application.
  13. i'm working on a 4.6 update. one of the bigger aspects of this update i'm working on, will be is a custom calendar section, as trying to integrate into the calendar has had varying amounts of success and issues, so i've decided to add a calendar section to stratagem, it will still require calendar as it uses its JS and css, but it doesn't actually use the calendar app itself. this should allow for more things i can do with it eventually πŸ™‚
  14. On my localhost, with php 7.4 i have E_ALL enabled, and if i am not in_dev mode, my theme hooks for my toolbox app causes this error: Cannot use β€œparent” when current class scope has no parent i've tracked it down to the hookData() method: public static function hookData() { return parent::hookData(); } i've been able to correct it with this code: public static function hookData() { if (is_callable('parent::hookData')) { return parent::hookData(); } return []; } now i am not entirely sure why i have to do this, it only seem to have started with 4.6 (maybe its a change i'm unware of, but i am not sure if it is happening in any of my other apps, as i don't often make theme hooks nor am i often not IN_DEV). now on a proper production server, E_DEPRECATED should be suppressed and this isn't a super priority, its more of a curiosity why it is happening, and why i had to make the change, was it a change in 4.6 theme hooks? is my code just bad? i mean i know some of it is clunky and nonsensical sometimes, but its happening even on the theme hooks that i don't add a theme hook, but i'm overloading a theme method, so the hookData() is just empty, returning the parent. it happens both on my mac and linux pc, so i'm not sure what to think. php version is the latest 7.4 on both. so any ideas?
  15. First off, great interview. Secondly, who's next? please be @Lindy πŸ˜› Thirdly, since linux was mentioned in this thread, and having been a long time user and advocate of opensource software and using linux as my daily driver for the last 15 to 16 years. I must say, i'm glad to see the passion still out there for linux and the hopes of the "year of the linux desktop", it takes me back :). However, I don't believe linux is quite for everyone, or even sure it ever will be. I'm a very experienced user with it and there are things that i still run into that make me bash my head into my desk. Linux and its distro's (just being plural) shows how fragmented the linux ecosystem truly is. so much resources/code and developers are spread out over so many different things. Like example, the desktop managers, there are possibly hundreds of them (i'm including window managers as well). sure these things give users choice, but also at the same time, it keeps linux on the fringe. Not to mention some of the absolute state of some of the subsystems, like audio and display. The audio sub-system has been a mess for years, pulse was a bandage, but that bandage has been peeling off for years. I can't count how many times a week i have to switch back to my speakers from waking up or restarting, cause pulse thinks my micronphone is a speaker...I guess there are some new bandaids out there on the horizon, like pipewire that fedora is using, but i don't think it addresses the underlying problem, that audio is crap under linux and i don't really see it getting better. Same with xorg and wayland, they are both in absolute embarrassing state. xorg cause it is bogged down by 1980's backwards compatibility and tacked on "modern" features, as well as its security issues. then you have wayland, which just completely lacks direction, the developers of it are hostile, and considering how much money and other resources that have been dumped into it, its debut date was suppose to be back in ubuntu 11.04, we are now on ubuntu 21.04 and it only supports a small fraction of gpu's out there and even less compatible with popular applications. sure we can get into a petty fight like apple does about how nvidia is the worst, but nvidia is like that, cause they are popular and on top and have been for a very long time, so they've sorta earned the right, where a project like wayland has no real credibility to be telling the largest gpu manufacturer in the world what they should be doing. Sure you can make a lot of things work with it, but as i've grown older, i've also become frustrated with linux. One reason why i am hoping wsl becomes a shiny beacon in the night in windows for development (cause development in windows just sucks, sucks so much that it has made me endure the inadequacies of linux all these years). I also just purchased a mac mini, god help me that i don't become one of "those" computer users πŸ™‚. the appeal of the new architecture, with most of the benefits that linux offers, without most of the headache, is very appealing to me at this point in my life. on a finally note to steer the conversation back, I would like to add my two cents about anonymity and toxicity. I have over the years, as many of you can attest, have been toxic myself. I will say things i would never say in real life to others, as well as try to purposely raise the temperature just to get a reaction out of people. A lot of that is cause i've always viewed the internet as sort of the "wild wild west", that it offered a level of "freedom" that polite society doesn't offer. It is also easy to forget that the avatar/username you are replying to, has a person at the other end, they lack humanity unless they are in your circle. as for a solution to that, i don't know if there is one. any way, good interview, will look forward to future ones.
  16. sorry for the delay, my minion seems to have skipped out on me. I've been in the hospital for the last month and just got released last week. I installed the app to 4.6 and it seems to be working with 4.6 without any issue, i'll double check and do a version bump as a maintenance release.
  17. shown in the video, if i have no csrf, it complains about needing one. so i add one, then it complains about having one.
  18. my request: can we get documentation for adding API to our apps, I'm having to add it to 3 different apps atm for a project for a client, and i'm really sorta winging it. looking at what you guys have done, but even then its not all that clear what is being done or why. please document the graphql api you've added, i'm assuming you are using this in your mobile app, since i can't find any reference to it in any of your php/js code. '/^\s*\*\s*@([a-z]*)(\t+([^\t]*))?(\t+([^\t]*))?(\t+([^\t]*))?$/', found in /system/Api/Controller.php line 319. hopefully I can express how much misery this regex has caused me. you guys are literally the only software or framework i know of, in php or not, that uses tabs in their code. I use spaces, the rest of the world uses spaces, I have git hooks that will actually reject code for using tabs instead of spaces, my IDE is configured to use spaces. so for like .00001% of the over all app, on stuff that isn't even code, i have to undo ALL of that, just so the api reference docs are processed and shown in the ACP for the other devs on this project to have easy access to that info. I spent a good long while trying to figure out why it was not showing or throwing an exception in the api references, as there was no clear indication as to what was causing it or why. so for sanity sake, please make this regex more robust to look for tabs or space (or better yet, not rely on phpdoc block for api reference, make it a json/xml/txt in <app>/data that can be read and parsed out). $this->_respond( json_encode( $output, JSON_PRETTY_PRINT ), $response->httpCode, NULL, $shouldLog, TRUE ); /system/Dispatcher/Api.php line 338/342/348., this code does not always produce valid json. it looks like json, but its not, its corrupted. I've had to add 'JSON_HEX_QUOT | JSON_HEX_TAG ' to the flags section of json_encode to get it to produce valid json (i did this thru a hook, but had to overload the entire method, cause there was no point in the code execution, i would be able to add those 2 flags). So please either add those flags or move the json_encode to a method inside the dispatcher, where all it does is json_encode, that way i can hook it and add those flags or any other flags i might need in the near future. editor content from the api doesn't not get the file or url place holders replaced, i was pulling articles and blogs records, and none of the internal links or attachments were showing up, cause they still had the <___base_url___> and <filestore> stuff still in them, so i had to go hook blogs and articles api to parse them (haven't gotten to the other apps yet). embed/iframe content also is not loaded, cause the src attribute is empty, as the source is still on data-embed-src (i'm assuming this is apart of the IPS lazy loading that didn't get scrubbed properly). on db records, you include a title property but in 'fields' property, it also includes the title field content as well, so if that can be removed or at least give us the ID of which field_# is the title, same for description. can you also include for any dates, a rfc2822 format along with the rfc3339, as javascript does not like the rfc3339 one (example: DateTime::ts($sometimestamp)->format(RFC::882), this will return a rfc2822 formatted date). heck even a raw unix timestamp would be better than a rfc3339 :). to be completely honest, the api has not been a pleasure to write code for or to work with. it is one of the most difficult API's i've used. I have spent about 20 times longer debugging and finding solutions, than i have actually writing code to use the api. any way, i hope you guys can address these issues, if not, I might be forced to abandon the api and find another solution.
  19. I am not entirely sure when this began. I first noticed it 2 to 4 months ago on my local dev environment, but when i moved from a lamp to docker, the problem went away, so i figured it was just something funky in my lamp stack (as one of the reasons i wanted to move away from LAMP to docker, was using different mysql & php version, along with nginx or apache, to tailor the dev environment to my own clients servers). However, I've been getting reports trickling in that a few of my apps, that the settings will not save. so i've been looking into it, and tonight i installed a few of my apps on my clients site. I configured the apps, all went as fine, and then i went back to change another setting, and the new value would not take. so i thought maybe it was a funky cache of settings, so i ran the support tool, nada. I messed around with it for about 20 minutes, decided to back burner it for now, as i had other things i needed to install and do on the site. I did discover, if I installed/updated an app or plugin, the settings that did not change after they were saved or when i did a cache clear. However if i installed or updated an app or plugin, the values would get updated. of course with this being third party code it is happening on, i wanted to completely rule out my own code (which btw is pretty boiler plate way to save the settings from the form, but i wanted to remove the possibility it was something in my own code). so i created a test plugin, put a few settings in it, tested it on 3 different servers (my own production server, and 2 of my clients) and sure enough on my server and one of my clients, once after the initial setup of the settings and saving, any subsequent changes/saves, will not be reflected. (i checked their values in the DB and they had been updated, but the store was stale), however running the support tool did not fix this, only installing/updating an app would have the changed settings reflected. next to further debug this, i went over to the dev sites of my clients and my site (again on 3 different servers), i disabled all the 3rd party apps and plugins, with the exception of my test plugin. Again on my server and one of the client server that wouldn't change the settings in the previous test, same thing. the settings would update in the DB, clearing the store with the support tool did not work, but installing/updating an app or plugin, they would (even enabling or disabling an app would have no effect). my next test was just try to update the settings manually with changeValues(), my code was simple. $settings = [ 'test_plugin_setting_a' => 1, 'test_plugin_setting_b' => 2, 'test_plugin_setting_c' => 3, 'test_plugin_setting_d' => json_encode([1,2,3,4,5,6]) ]; \IPS\Settings::i()->changeValues($settings); still no joy. the settings do exist, they don't have default values, they've been set by the plugins setting panel. as before, they would be updated in the DB, but not when viewing the settings, they would only show the new values after installing/updating a new app. this is only happening with some 3rd party apps (more on that later) on my server and my clients, i can not duplicate it with IPS settings in IPS apps, but comparing the code, they are virtually identical. I am unable to figure out what is going on, as i've scoured logs too, nothing. there are no errors. servers are all running the latest version of php 7.4, fpm and apache. they all have filesystem as their storage location for the store, mysql versions variate between the servers, but they are different versions but all above the min. version required by IPS. there is no cloudflare, or any other cdn or cache programs installed. So i re-enabled all the third party apps and plugins (some mine, some not). So i began to change settings in all of them, to see which ones would update and which ones wouldn't. It was just completely random, some of my apps would do it, but others would not, some other third parties apps created by other devs would do it, others would not. looking at their code and mine, its pretty basic stuff, example: if ($values = $form->values()) { $form->saveAsSettings($values); Output::i()->redirect(Request::i()->url()->setQueryString(['do' => 'manage', 'params' => 1])->csrf()); } the above is from my applications stratagem. if ( $values = $form->values() ) { if ( isset( $values['forums_popular_now']['never'] ) ) { $values['forums_popular_now'] = json_encode( array( 'posts' => 0, 'minutes' => 0 ) ); } else { $values['forums_popular_now'] = json_encode( $values['forums_popular_now'] ); } if ( isset( $values['forums_default_view_choose'] ) ) { $values['forums_default_view_choose'] = ( \is_array( $values['forums_default_view_choose'] ) AND !\count( $values['forums_default_view_choose'] ) ) ? NULL : json_encode( $values['forums_default_view_choose'] ); } if ( isset( $values['forums_topic_activity'] ) ) { $values['forums_topic_activity'] = json_encode( $values['forums_topic_activity'] ); } if ( isset( $values['forums_topic_activity_features'] ) ) { $values['forums_topic_activity_features'] = json_encode( $values['forums_topic_activity_features'] ); } if ( isset( $values['forums_topics_show_meta'] ) ) { $values['forums_topics_show_meta'] = json_encode( $values['forums_topics_show_meta'] ); } $form->saveAsSettings( $values ); /* Clear guest page caches */ \IPS\Data\Cache::i()->clearAll(); \IPS\Session::i()->log( 'acplogs__forums_settings' ); \IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=forums&module=forums&controller=settings&tab=settings' ), 'saved' ); } the above is from forums. they both assign $form->values() to $values, and they both user $form->saveAsSettings($values);, the only difference is you guys are doing some post submit processing on the values, i don't need to, but even on the apps that do some post submit processing, this problem creeps up. I'm pretty confident its not a code issue, but a server configuration issue of some kind (as to what configuration is causing this i have no clue). I've compared php and mysql config file between my production server, the other client server that is having this issue, with my local dev and the other clients site that isn't having this issue, but nothing is really all the different, and the configs that were different, i made the changes on my production server without any effect. I can say with the exception of my local dev, the 3 servers are all running centOS 7, with cpanel, with all the latest updates available to them. I only have a server sample of about 10 different servers i can access to test this issue on my own, you guys have potentially access to thousands, has this problem arose else where or been reported to you and you guys pushed it back to the third party dev thinking it was something wrong with their app? has any third party dev reading this, come across this? were you able to find a solution? any help would be appreciated, at this point my only possibly option would be to hack my around \IPS\Settings on the servers that are affected. P.S. I did think maybe it was opcache, but i disabled this on all 3 servers once i noticed the issue, still no joy.
  20. the app doesn't use IP addresses as the only metric, it should be extremely rare that it would even fall back to IP's. how certain are you they aren't duplicates?
  21. https://codingjungle.com/babble/?app=babbleadmin&module=license&controller=demo you can sign up here for a demo πŸ™‚
  22. they must not be on the latest version, cause it has a try/catch around that section for this reason.
  23. those are my settings. my template is the Material Theme UI (i use the night owl theme) and i have rainbow brackets plugin installed so it might be a combination of those things that make it a tad bit more "lively"
  24. https://github.com/codingjungle/toolbox you can grab it from here, make sure you checkout the dev branch as it is the most up to date.
  25. about all it does for "templates" is in a limited fashion gives you a template function list for getTemplate (based on the group param) and if it finds the template, will give you param hints (but this is only in phpstorm and if you have the phptoolbox plugin installed for phpstorm). for an IDE like phpstorm, i usually assign *.phtml to twig in file types, it doesn't do much, but does add some color. before being assign to twig: after being assigned to twig: but other than that, there isn't any plugin i know of that will assist with IPS templates and i'm not crafty enough with java to make one πŸ™‚
Γ—
Γ—
  • Create New...

Important Information

We use technologies, such as cookies, to customise content and advertising, to provide social media features and to analyse traffic to the site. We also share information about your use of our site with our trusted social media, advertising and analytics partners. See more about cookies and our Privacy Policy