Jump to content

CodingJungle

Clients
  • Posts

    3,066
  • Joined

  • Days Won

    31

 Content Type 

Downloads

Release Notes

IPS4 Guides

IPS4 Developer Documentation

Invision Community Blog

Development Blog

Deprecation Tracker

Providers Directory

Forums

Events

Store

Gallery

Posts posted by CodingJungle

  1. 2 hours ago, Matt said:

    I was curious as to what changes you'd like to see, and what changes do you think are coming?

    • constant adoption of new php features and faster bumps in the min. required PHP. PHP is releasing newer versions faster than ever before and killing off the older versions just as fast. the biggest problem i had with IPS 4.x, was that it never really evolved. sure it changed, but it never really embraced features even found in php 5.4, let alone features added thru out 7's life. 
    • Adoption of PSR for your code standards. gonna be honest here, i find your "coding standard" (the formatting of your code) to be the visual equivalent of an angry monkey biting down on a vibrator.  it is a serious amount of unpleasantness to view your code. i think the adoption of PSR, would be more welcoming to third party who has worked out in the wild on other things that use the PSR standard (which most frameworks/libs do now days and by nature a lot of apps have just adopted it from them). 
    • this is a minor one, the embracing of imports+aliases when needed over FQN. FQN can make code look ugly,messy and add a fair amount of bulk. using imports, i can just look at the top of the file and see instantly what it is using.
    • full adoption of semantic versioning. a lot of the problems that you have with 3rd party is cause you guys never stuck with a standard. you would throw in backward breaking changes in patch versions. it is pretty insane that a professional level software company wouldn't use a standard like semantic at the very least.
    • Events Manager. i like the hook system just as much as the next guy, but i think polling of all the apps in the market place to see what is being hooked and how often, and then prioritize event triggers for those, you could probably ease a lot of your woes. 
    • a better form class. i've said it plenty of times over the last several years, i really dislike the form building in 4. i think it was a step in the right direction, but i honestly think it could've been done better. i think it produces an extremely ugly code that could've easily been abstracted better.
    • better use of traits/interfaces/abstract.  there are a lot of times where traits/interfaces/abstract classes should be used in 4.x, and they are simply not. a good example of this is extensions. there have been times where you have updated an extension, where you have removed methods or added in new ones and i had no idea. this is a good place where each extension gets an abstract class, where you can add/remove these methods, so if we don't implement them, they wont blow up. 
    • search. have the search actually use the objects. you currently have things like "titleFromIndexData" and "urlFromIndexData", amongst other methods that attempt (and poorly i might add) to usurp the object class you have given us to do these very things. there are a few of my apps, who do not use the cookie cutter nature you've assigned here, so these methods require addition work from me and at times, impossible to do anything with the provided data, so i have to load the object anyway. 
    • clubs. clubs are sort of a nightmare to implement. cause they are implemented on the item class, but god forbid you use a container/sub container class. then it becomes a huge annoyance to properly implement. clubs should be seriously revisited and much better implemented.

    i'm sure i have more, but i get the feeling as it is, its already too late in the development of 5.x to serious take into consideration anything i would like to see changed. too bad you guys didn't ask this at more of the start of the development, we might've been able to create something wonderful together :). 

  2. 1 hour ago, Stuart Silvester said:

    However, it's important to note that when customers manually write custom code to interact with our framework, it's their responsibility to ensure that it's compatible. While we do our best to provide support and address issues as they arise, we cannot guarantee that every possible combination of custom code will work seamlessly with our framework.

    this is one i would disagree on. the documentation states this:

    Quote

    Under the hood, each template group is compiled into a PHP class, with a method for each template. You can extend this class by manually editing the file which will have been created in /plugins/<your plugin>/hooks.

    It is important to note that when using this mode, you are overloading the compiled template group so the return value will be the HTML that will be displayed, without any template logic or template tags.

    so this tells me that my hook is being extended by the compiled theme class, which looks like this:

    Could contain: Page, Text, File

    any developer worth their weight in salt, would come to the same conclusion that calling a parent in an overloaded method, should not be a problem. its a basic feature of OOP in php. so i would still argue that the problem is an engineering one inside the framework. 

    this is why i get extremely frustrated with IPS. its a substantial investment on my part to be apart of the third party community (renewal fees + time), then to be told that a lot of the support issues IPS faces if from third party and frankly a lot of that is on IPS hands. you give us almost no tools, no real sdk (like example or boilerplate code), IDE plugins, cli generators, etc, that a lot of free frameworks will have available.  like most of the "incompatibilities" created by third party i've ever run into in IPS could be eradicated with with included developer tools like a  proxy class generator or a way for hooks to be understood by IDE's. 

    sure i understand IPS isn't a multibillion company and doesn't have the resources to develop like a IDE plugin for its framework, but most of the other things i mentioned, i was able to create without any of that and i'm just one guy with a linux PC and a deskcat. 

    any way, i'm not even suppose to be here today!

    clerks-not-supposed-to-be-here.gif.3aed8c9e2f493eff31d62f4a2097cf6d.gif

     

  3. On 12/16/2022 at 8:03 PM, Daniel F said:

    That’s an issue with a 3rd party app! Disable all your 3rd party apps and plugins to resolve the issue. Then make sure that you have the recent version installed


    sorry Daniel, but this is NOT a third party issue. This is an engineering problem inside the framework. This was an issue reported/showed up almost 2 years ago and u guys did nothing to fix it or even comment on it, it was left up to me to debug it and come out with a solution. This is a good example of us using features of php (and of IPS) and since the framework is still mostly a pho 5.3 framework, it not playing nice with the modern versions. This is honestly the kind of nonsense of why I left.

    2 hours ago, IBResource ltd. said:

    By doing that you have excluded theme plugins from templates compilation. This is temporary solution until next recompilation.

    There is an issue with PHP8 uncatchable error, which was deprecated in PHP7.4. Some theme plugin hooks use trick with parent template function overloading in addition to documented hookData() method:

    public function includeCSS()
    {
      \IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'somePlugin.css', 'core', 'front' ) );
      return parent::includeCSS();
    }

    As a workaround you can fool the interpreter by changing 

    return parent::includeCSS();

    to

    return \call_user_func_array( 'parent::' . __FUNCTION__, func_get_args() );

    The difficulty is that these new errors are not catchable by error handler, so you can't know which hook file is causing them. This often happens with this plugin https://invisioncommunity.com/files/file/9966-back-2-top/ and this app https://invisioncommunity.com/files/file/7940-iawards/

     

    These are not third party developer issues, don’t let IPS TELL U THEY ARE. these are issues caused by an engineering problem with in the framework as demonstrated by the topic Adriano linked too. They are eval’ing a non extended class to check for errors or something like that and that is where it throws the deprecate notice in 7.4 and the fatal in 8.0+. Put IPS’s feet to the fire, demand better from a software company that charges $300 a year for renewals for mediocre improvements and many years of outstanding bugs they ignore or refuse to fix.

  4. On 9/16/2022 at 8:34 PM, Schaken said:

    I am not real good with PHP, but it seems the $Container is no longer a function, I believe it was replaced by accessing via \IPS\downloads\Category::roots('view');

    But im am not sure how to get this exactly short of:
    $category = \IPS\downloads\Category::roots('view');

    but i never used PHP, I use C#. the language is alot alike though

     

    On 9/14/2022 at 7:21 AM, Refsmmat said:

    I just updated to 4.7.2 and it seems that Downloads Plus is not compatible. It got automatically deactivated, rendering all downloads on my page inaccessible at the moment.

    @CodingJungle Are we getting an update for Downloads Plus to get it working again?

     

    i've tested the code in php 8, the only thing that i see that is the problem is with scanner.php itself introduced by IPS. I used an import instead of a FQN. imports are supported by php and are not incompatible with PHP 8. 

    I'll release a fix for it, but i really shouldn't have too tbh. 

     

  5. this is still a problem. i've reported the issue to symfony, but haven't heard anything back from them. I've changed the file manually, but since it is a file that is NEVER used in what i'm calling, its existestance is the problem. been running php 8 for a long while now on my dev for other project and it is ONLY this software suite that seems to have any issues or needs this tool, why is that?

  6. shouldn't the solution to becoming php 8+ compliant, be to start updating and using php 7.x features yourself in your codebase instead of the onus of us not using them?

    or at least change the error message, instead of making what is being done is php 8 incompatible, its cause the overridden method (on different return types at least) are cause the method being overridden doesn't use php 7 features, cause it is sending the wrong message that these improvements in php 8 aren't php 8 compatible when they are. 

  7. Application	Dev Toolbox	Mismatching parameter list 	\Symfony\Component\VarDumper\Dumper\AbstractDumper::dumpLine()	N/A	/applications/toolbox/sources/vendor/symfony/var-dumper/Dumper/CliDumper.php:551
    

    so i have to be sure third party libs pulled in via composer match whatever criteria scanner.php sets out? i wasn't even aware IPS uses anything from symfony, if you do, you probably should namespace it differently since the autoloader isn't psr-4 compliant and there is no way to load/check/compare to your composer.json

  8. foreach( \IPS\Db::i()->getTables() as $table){
        $def =  \IPS\Db::i()->getTableDefinition($table);
        if($def['engine'] === 'MyISAM') {
            $query = 'ALTER TABLE ' . $table . ' ENGINE=InnoDB;';
            \IPS\Db::i()->query($query);
        }
    }

    i use this snippet to convert them over to innodb. it is likely your databases default engine type is myisam instead of innodb (cause not every schema has the engine type when the table is created, so the db installer lets the db server select it. this is what looks like what is happening here). 

  9. Error thrown with message "Call to undefined function IPS\Application\preq_quote()"
    
    Stacktrace:
    #16 Error in /opt/homebrew/var/www/dev/system/Application/Scanner.php:139

    it should be preg_quote, not preq_quote 🙂 

    and if i change it to preg_quote, i get this error:

    Whoops\Exception\ErrorException thrown with message "preg_match(): Unknown modifier 'o'"
    
    Stacktrace:
    #17 Whoops\Exception\ErrorException in /opt/homebrew/var/www/dev/system/Application/Scanner.php:169

     

  10. Whoops\Exception\ErrorException thrown with message "explode(): Passing null to parameter #2 ($string) of type string is deprecated"
    
    Stacktrace:
    #13 Whoops\Exception\ErrorException in /private/var/tmp/theme_core_global_forms_texta0ayPh:10
    #12 explode in /private/var/tmp/theme_core_global_forms_texta0ayPh:10
    #11 IPS\Theme\theme_core_global_forms_text in /opt/homebrew/var/www/dev/system/Theme/Dev/Template.php:171
    #10 IPS\Theme\Dev\_Template:__call in /opt/homebrew/var/www/dev/system/Helpers/Form/Text.php:156
    #9 IPS\Helpers\Form\_Text:html in /private/var/tmp/theme_core_admin_support_guideSearchFormUsUAi0:60
    #8 IPS\Theme\theme_core_admin_support_guideSearchForm in /opt/homebrew/var/www/dev/system/Theme/Dev/Template.php:171
    #7 IPS\Theme\Dev\_Template:__call in /opt/homebrew/var/www/dev/system/Helpers/Form/Form.php:519
    #6 IPS\Helpers\_Form:customTemplate in /private/var/tmp/theme_core_admin_support_dashboardXIikwy:249
    #5 IPS\Theme\theme_core_admin_support_dashboard in /opt/homebrew/var/www/dev/system/Theme/Dev/Template.php:171
    #4 IPS\Theme\Dev\_Template:__call in /opt/homebrew/var/www/dev/applications/core/modules/admin/support/support.php:67
    #3 IPS\core\modules\admin\support\_support:manage in /opt/homebrew/var/www/dev/system/Dispatcher/Controller.php:118
    #2 IPS\Dispatcher\_Controller:execute in /opt/homebrew/var/www/dev/applications/core/modules/admin/support/support.php:48
    #1 IPS\core\modules\admin\support\_support:execute in /opt/homebrew/var/www/dev/system/Dispatcher/Dispatcher.php:153
    #0 IPS\_Dispatcher:run in /opt/homebrew/var/www/dev/admin/index.php:13

    I keep getting this error when switching over to test my apps in php 8.1 when using ips 4.7.1 and 4.7.2 beta 2. 

  11. Could contain: Text, File, Page,.

    i went to go renew my license this morning, and being super early and not having my coffee yet, i didn't want to pull out my debit card and type out the really complicated strings of numbers 😛 (as the card on file is super outdated lol) and i'm done paying paypal fees this month, so i was excited to see "apple pay". So i selected it, thought it was odd it was showing 'GPay', was like "alright, that will work too, i have that". however when i clicked on it, nothing happened. so i thought maybe it was me using chrome, so i tried safari, same thing. it showed the 'GPay" logo, but when i clicked on it, nothing happened. So i ended up having to get my debit card. this is no biggy, just thought i'd let you know, maybe apple pay is too big brained for me, but i couldn't get it to work for renewal. 

  12. plus \IPS\Dispatcher already loads these values:

    $app = null;
    $module = null;
    if(\IPS\Dispatcher::hasInstance()){
    	$dispatcher = \IPS\Dispatcher::i();
    	$app = $dispatcher->application;
    	$module = $dispatcher->module;
    }
    
    if($app !== null && $app->default && $module->default){
    	//if we are here, we on the default app/module, lets do our thing
    }

     

  13. a possible solution is to check the data in the \IPS\Request::i()->url() method.

    if it is the default app on the "homepage", then ->path should be empty:

    IPS\Http\Url\Friendly Object
    (
        [url:protected] => https://dev.codingjungle.com/
        [data] => Array
            (
                [scheme] => https
                [host] => dev.codingjungle.com
                [port] => 
                [user] => 
                [pass] => 
                [path] => /
                [query] => 
                [fragment] => 
            )
    
        [queryString] => Array
            (
            )
    
        [hiddenQueryString] => Array
            (
                [app] => stratagem
                [module] => view
                [controller] => projects
            )
    
        [seoPagination] => 
        [base] => front
        [seoTemplate] => stratagem
        [seoTitles] => Array
            (
            )
    
        [friendlyUrlComponent] => 
    )

    otherwise it will be populated with the path from the furl:

    IPS\Http\Url\Friendly Object
    (
        [url:protected] => https://dev.codingjungle.com/stratagem
        [data] => Array
            (
                [scheme] => https
                [host] => dev.codingjungle.com
                [port] => 
                [user] => 
                [pass] => 
                [path] => /stratagem
                [query] => 
                [fragment] => 
            )
    
        [queryString] => Array
            (
            )
    
        [hiddenQueryString] => Array
            (
                [app] => stratagem
                [module] => view
                [controller] => projects
            )
    
        [seoPagination] => 
        [base] => front
        [seoTemplate] => stratagem
        [seoTitles] => Array
            (
            )
    
        [friendlyUrlComponent] => stratagem
    )

    there might be a caveat to this, as i haven't fully tested this. it was something off the top of my head. 

    45 minutes ago, IPCommerceFan said:

    These work for me:

    Default app:

    $defaultApp = \IPS\Application::load(\IPS\Request::i()->app)->default;

    Default module:

    $defaultModule = \IPS\Application\Module::get(\IPS\Request::i()->app, \IPS\Request::i()->module)->default;

     

    37 minutes ago, DawPi said:

    Hm, load app info every page check isn't much efficient. Maybe someone else has better idea.

    But thanks for sharing it!

    btw this could be a good method too, as applications and modules get cached, so it shouldn't cost anything noticeable in loads, well nothing more than most servers can afford to use.

  14. 1 minute ago, media said:

    Sorry, I have disabled the APP....

    More problem arrived...

    TypeError: Cannot access offset of type string on string (0)
    #0 /home/media/public_html/forum/applications/n2a/sources/Colors/Colors.php(442): IPS\n2a\_Colors->colors()
    #1 /home/media/public_html/forum/applications/n2a/sources/Colors/Colors.php(565): IPS\n2a\_Colors->parseName('thoughtful :))')
    #2 /home/media/public_html/forum/applications/n2a/sources/Colors/Colors.php(388): IPS\n2a\_Colors->generateImage('thoughtful :))')
    #3 /home/media/public_html/forum/init.php(927) : eval()'d code(30): IPS\n2a\_Colors->parse('thoughtful :))', 110589, NULL)
    #4 /home/media/public_html/forum/system/Member/Member.php(1255): IPS\n2a_hook_Member::photoUrl(Array, true, true)
    #5 /home/media/public_html/forum/applications/forums/modules/front/forums/topic.php(480): IPS\_Member->get_photo(true, true)
    #6 /home/media/public_html/forum/system/Dispatcher/Controller.php(118): IPS\forums\modules\front\forums\_topic->manage()
    #7 /home/media/public_html/forum/system/Content/Controller.php(50): IPS\Dispatcher\_Controller->execute()
    #8 /home/media/public_html/forum/applications/forums/modules/front/forums/topic.php(39): IPS\Content\_Controller->execute()
    #9 /home/media/public_html/forum/system/Dispatcher/Dispatcher.php(153): IPS\forums\modules\front\forums\_topic->execute()
    #10 /home/media/public_html/forum/index.php(13): IPS\_Dispatcher->run()
    #11 {main}

    backtrace

    #0 /home/media/public_html/forum/init.php(1029): IPS\_Log::log('TypeError: Cann...', 'uncaught_except...')
    #1 [internal function]: IPS\IPS::exceptionHandler(Object(TypeError))
    #2 {main}

     

    you must have a setting enabled i didn't when testing, but the error is the same method, in the same area, so it the new version i release should fix it. i pushed the update here already, so i'm not sure when it will be available, i also release it on my site, but i don't recall where you purchased it from. 

  15. 1 hour ago, media said:

    PHP 8.1 Version: 4.7.1

    Name 2 avatar version: 5.0.3

    The URL of page the error occurred on was https://www.site.com/forum/admin/?app=core&module=overview&controller=notifications&highlightedId=52

     

    TypeError: Cannot access offset of type string on string in /home/media/public_html/forum/applications/n2a/sources/Colors/Colors.php:491
    Stack trace:
    #0 /home/media/public_html/forum/applications/n2a/sources/Colors/Colors.php(442): IPS\n2a\_Colors->colors()
    #1 /home/media/public_html/forum/applications/n2a/sources/Colors/Colors.php(565): IPS\n2a\_Colors->parseName('sasahin')
    #2 /home/media/public_html/forum/applications/n2a/sources/Colors/Colors.php(388): IPS\n2a\_Colors->generateImage('sasahin')
    #3 /home/media/public_html/forum/init.php(927) : eval()'d code(30): IPS\n2a\_Colors->parse('sasahin', 182396, NULL)
    #4 /home/media/public_html/forum/system/Member/Member.php(1255): IPS\n2a_hook_Member::photoUrl(Array, true, false)
    #5 /home/media/public_html/forum/system/Patterns/ActiveRecord.php(335): IPS\_Member->get_photo()
    #6 /home/media/public_html/forum/system/Theme/Theme.php(885) : eval()'d code(4132): IPS\Patterns\_ActiveRecord->__get('photo')
    #7 /home/media/public_html/forum/system/Theme/SandboxedTemplate.php(61): IPS\Theme\class_core_admin_global->userPhoto(Object(IPS\Member), 'mini')
    #8 /home/media/public_html/forum/system/Theme/Theme.php(885) : eval()'d code(785): IPS\Theme\_SandboxedTemplate->__call('userPhoto', Array)
    #9 /home/media/public_html/forum/system/Theme/SandboxedTemplate.php(61): IPS\Theme\class_core_admin_notifications->newMember(Array, Object(IPS\core\extensions\core\AdminNotifications\NewRegComplete), -9)
    #10 /home/media/public_html/forum/applications/core/extensions/core/AdminNotifications/NewRegComplete.php(188): IPS\Theme\_SandboxedTemplate->__call('newMember', Array)
    #11 /home/media/public_html/forum/system/Theme/Theme.php(885) : eval()'d code(391): IPS\core\extensions\core\AdminNotifications\_NewRegComplete->body()
    #12 /home/media/public_html/forum/system/Theme/SandboxedTemplate.php(61): IPS\Theme\class_core_admin_notifications->indexBlock(Object(IPS\core\extensions\core\AdminNotifications\NewRegComplete), true)
    #13 /home/media/public_html/forum/system/Theme/Theme.php(885) : eval()'d code(283): IPS\Theme\_SandboxedTemplate->__call('indexBlock', Array)
    #14 /home/media/public_html/forum/system/Theme/SandboxedTemplate.php(61): IPS\Theme\class_core_admin_notifications->index(Array)
    #15 /home/media/public_html/forum/applications/core/modules/admin/overview/notifications.php(47): IPS\Theme\_SandboxedTemplate->__call('index', Array)
    #16 /home/media/public_html/forum/system/Dispatcher/Controller.php(118): IPS\core\modules\admin\overview\_notifications->manage()
    #17 /home/media/public_html/forum/system/Dispatcher/Dispatcher.php(153): IPS\Dispatcher\_Controller->execute()
    #18 /home/media/public_html/forum/admin/index.php(13): IPS\_Dispatcher->run()
    #19 {main}

    Trace

    #0 /home/media/public_html/forum/system/Theme/SandboxedTemplate.php(71): IPS\_Log::log(Object(TypeError), 'template_error')
    #1 /home/media/public_html/forum/system/Theme/Theme.php(885) : eval()'d code(785): IPS\Theme\_SandboxedTemplate->__call('userPhoto', Array)
    #2 /home/media/public_html/forum/system/Theme/SandboxedTemplate.php(61): IPS\Theme\class_core_admin_notifications->newMember(Array, Object(IPS\core\extensions\core\AdminNotifications\NewRegComplete), -9)
    #3 /home/media/public_html/forum/applications/core/extensions/core/AdminNotifications/NewRegComplete.php(188): IPS\Theme\_SandboxedTemplate->__call('newMember', Array)
    #4 /home/media/public_html/forum/system/Theme/Theme.php(885) : eval()'d code(391): IPS\core\extensions\core\AdminNotifications\_NewRegComplete->body()
    #5 /home/media/public_html/forum/system/Theme/SandboxedTemplate.php(61): IPS\Theme\class_core_admin_notifications->indexBlock(Object(IPS\core\extensions\core\AdminNotifications\NewRegComplete), true)
    #6 /home/media/public_html/forum/system/Theme/Theme.php(885) : eval()'d code(283): IPS\Theme\_SandboxedTemplate->__call('indexBlock', Array)
    #7 /home/media/public_html/forum/system/Theme/SandboxedTemplate.php(61): IPS\Theme\class_core_admin_notifications->index(Array)
    #8 /home/media/public_html/forum/applications/core/modules/admin/overview/notifications.php(47): IPS\Theme\_SandboxedTemplate->__call('index', Array)
    #9 /home/media/public_html/forum/system/Dispatcher/Controller.php(118): IPS\core\modules\admin\overview\_notifications->manage()
    #10 /home/media/public_html/forum/system/Dispatcher/Dispatcher.php(153): IPS\Dispatcher\_Controller->execute()
    #11 /home/media/public_html/forum/admin/index.php(13): IPS\_Dispatcher->run()
    #12 {main}

    Throwing this I disabled Name 2 Avatar....

    okay i'll test it out, i'm currently only on 8.0, but i think this is an error that 8.0 would throw too.

  16. Could contain: Word, Text

    On my production site, with light or dark mode ACP, scope selection for oauth looks like this and it just sucks. i know its not suppose to look like this, cause most of the time it looks normal on my dev site (most of the time, every once in awhile it goes spastic).

    I can't figure out why it is like this on my production site, but it simply just sucks. i've tried everything, i've disabled everything, changed themes, regenerated a stock them, cleared caches, etc, and it always looks like a spruce tree in minecraft got grifted.

    Could contain: Tree, Plant, Minecraft

    so lets get one of your many talented themers on this 🙂 

  17. 2 hours ago, BankFodder said:

    Hi, we bought this great app sometime ago but it is now asking us to buy again rather than simply providing the update.

     

    Can you help, please?

     

    Thanks

    yeah they expire if you let them lapse. you'd have to see if what @Nathan Explosion said fixes this, you might have to contact IPS to see if they can reissue it. 

  18. yes, https://dev.codingjungle.com is what i would like to use for my test url, as i don't have any plans on changing my main url anytime soon.

    9 minutes ago, Jim M said:

    Additionally, in the future, please feel free to submit these requests to our contact us form for our accounts team

    the "contact support" in the acp brought me here when it said my license data was invalid 🙂 

  19. I'm trying to change my test url to dev.codingjungle.com so I can use a cert to do some oauth api work on my local. it is telling me my license information is invalid. my main url for my site should be codingjungle.com, and i'm just using a subdomain of that url, so it should be working, correct? i am appending -TESTINSTALL to my license key, but it still saying it is invalid. I had in the past use codingjungle.dev but that URL is being used for something else atm. 

  20. 5 hours ago, cst3124 said:

    is it possible to make it support page -> block?
    it works for me for forums and etc. But it doesn't works in customise page block.

    it currently only works for apps that use the content item class from IPS, blocks use nodes. The reason it supports the content item classes, is cause it has a structure to display the output, nodes don't have this. so it is not as easy. I'll see about expanding it to blocks, but can't make any promises here. 

  21. I'm not entirely sure if this is \IPS\Http\Request\Curl bug or a problem with the IPS api, but i'm assuming it is a problem with \IPS\Http\Request\Curl cause when forcing \IPS\Http\Request\Sockets this error doesn't happen.

    example code:

    $category = 2;
    $author = 1;
    $communityUrl = 'http://codingjungle.test/dev';
    $apiKey = '214befc90239f63bc16dd89b4dfbd300';
     
    $endpoint = '/downloads/files';
    $response = \IPS\Http\Url::external($communityUrl . '/api/index.php?' . $endpoint. '&key=' . $apiKey)->request()->get(['category' => $category]);

    if i send the API parameters in get, I receive the following response:

    {
        "errorCode": "1S303\/8",
        "errorMessage": "NO_AUTHOR"
    }

    which is strange, cause when i got look up this error, i only find it in \IPS\downloads\api\files\POSTindex, but i'm calling $response->get(), so i should be hitting \IPS\downloads\api\files\GETindex with that endpoint. looking a bit further into what is going, this code is in \IPS\Http\Request\Curl::get()

    	/**
    	 * HTTP GET
    	 *
    	 * @param	mixed	$data	Data to send with the GET request
    	 * @return	\IPS\Http\Response
    	 * @throws	\IPS\Http\Request\CurlException
    	 */
    	public function get( $data=NULL )
    	{
    		/* Specify that this is a GET request */
    		curl_setopt( $this->curl, CURLOPT_HTTPGET, TRUE );
    		$this->dataForLog = NULL;
    		
    		if ( $data )
    		{
    			curl_setopt( $this->curl, CURLOPT_POSTFIELDS, $data );
    		}
    		return $this->_executeAndFollowRedirects( 'GET', NULL );
    	}

    it appears the CURLOPT_POSTFIELDS is triggering the POST for the API instead of GET (when i use this same code, by using \IPS\Http\Request\Sockets::get() instead by setting \IPS\BYPASS_CURL to true, it works as intended. i get the requested data from the API).

    I believe the \IPS\Http\Request\Curl::get() should be:

    /**
     * HTTP GET
     *
     * @param	mixed	$data	Data to send with the GET request
     * @return	\IPS\Http\Response
     * @throws	\IPS\Http\Request\CurlException
     */
    public function get( $data=NULL )
    {
        /* Specify that this is a GET request */
        curl_setopt( $this->curl, CURLOPT_HTTPGET, TRUE );
        $this->dataForLog = NULL;
    
        if ( \is_array($data) && empty($data) === false )
        {
            $this-url->setQueryString($data);
        }
        elseif( $data !== null){
            $queryString = [];
            \parse_str($foo, $queryString );
            $this-url->setQueryString($queryString);
        }
    
        return $this->_executeAndFollowRedirects( 'GET', NULL );
    }

     

×
×
  • Create New...