Jump to content
Invision Community

bfarber

IPS Staff
  • Content count

    157,056
  • Joined

  • Last visited

  • Days Won

    224

bfarber last won the day on September 14

bfarber had the most liked content!

About bfarber

  • Rank
    RBT-KS
  • Birthday 03/07/1983

Contact Methods

IPS Marketplace

  • Resources Contributor
    Total file submissions: 9

Profile Information

  • Gender
    Male
  • Location
    Southwest VA
  • Interests
    This is my interests, just for "Rikki" :)

Recent Profile Visitors

752,541 profile views
  1. Get in touch?

    I apologize for the delayed response. This was a bit of a non-standard scenario (i.e. not a general sales or support request) and is being assigned out. I see Charles responded earlier today - feel free to follow up if you have any more questions. In the mean time, we will definitely handle any support inquiries in our standard support timeframe for your account. Thanks!
  2. That's not what I'm seeing. I'm seeing "very strong" for "correct horse batter staple".
  3. I should point out that the strength meter will show "strong" for the first example and "very strong" for the second
  4. We can't speak as to why Google might do something or not do something. The message there, for instance, but be from a flag set in one server in their environment that doesn't update right away as search results are reindexed. I can confirm Google sees the page as mobile-friendly: https://search.google.com/test/mobile-friendly?url=https%3A%2F%2Farbtalk.co.uk%2Fforums%2Ftopic%2F28412-what-chainsaw-boots%2F
  5. 4.2.6 security update or not?

    Yes, sorry for not specifying this previously, however the change is not retroactive and as such if your community fetched available update data today already it may continue to show the new update is a security release (and of course the software cannot retract emails that have been sent either, so if you already received an email we can't do anything about that). As Jim noted, rechecking for available updates should reset the flag if it concerns you.
  6. 4.2.6 security update or not?

    4.2.6 is not a security a release. We apologize for any confusion. We have resolved the backend issue that caused 4.2.6 notifications to indicate otherwise in this case.
  7. Ads.txt

    Version 1.0.0

    39 downloads

    Ads.txt is an initiative by the advertising industry to help curb counterfeit ad inventory by allowing content owners the ability to specify who is allowed to sell their advertisements. You can read more about it at the official page on IAB Tech Lab. You can use this plugin to control the contents of your ads.txt file, even when using our Community In The Cloud services where you would otherwise be unable to upload the appropriate txt file needed. Note that on some hosting environments you may need to first create the ads.txt file using FTP and chmod it to allow the file to be written (e.g. 0777). This is not necessary with our Community In The Cloud offerings.

    Free

  8. I have 6 kids, my youngest daughter being 4 months old. It's like they just keep popping up out of the woodworks! (I kid, my baby is precious and was completely planned)
  9. @Mentions on this site (not my site....this site)

    Thanks, it's fixed now. @Nathan Explosion (If anyone else comes across this topic with the same issue, it's caused by an out of date includeJs theme template)
  10. Invision Community 4.2

    Please submit a ticket if you require support or have questions about the new features and how they work.
  11. Invision Community 4.2

    If you are experiencing an issue you can submit a ticket in your client area.
  12. Is this a custom application? If so you can just override the canEdit() method in your content item class to set the check however you need.
  13. Wiki based Dev Docs

    We've not made any changes yet
  14. Request Data

    The Invision Community software includes a class to work with request data, including GET, POST, and REQUEST data, cookies, and detecting certain information about the request (such as whether it was submitted via AJAX or not). You will need to use this class to perform some common actions working with web-based software. The class is accessed through \IPS\Requst::i() and implements the Singleton pattern. GET, POST and REQUEST data To access request variables, you simply call them as properties of the class. For instance, you can check if a request variable is set and output it like so if( isset( \IPS\Request::i()->someVariable ) ) { print \IPS\Request::i()->someVariable; } Request data is largely unmodified from the originally submitted data except that NULL bytes and RTL control characters are stripped from the input, and slashes are stripped if magic quotes is enabled. This means that all request data should be considered potentially tainted and you will need to take precautions not to introduce security issues by relying upon "clean" request data from this class. If the request is made using the PUT method (which happens through our REST API in some cases, for instance), this request data is also available through this class. Working with cookies Cookie values are available in the cookies property of the \IPS\Request class. print \IPS\Request::i()->cookie['member_id']; If your site uses a cookie prefix, note that it will be stripped automatically here. To set a cookie, you can use the setCookie method. As with fetching a cookie, you should not include any cookie prefix that is used. The method signature is /** * Set a cookie * * @param string $name Name * @param mixed $value Value * @param \IPS\DateTime|null $expire Expiration date, or NULL for on session end * @param bool $httpOnly When TRUE the cookie will be made accessible only through the HTTP protocol * @param string|null $domain Domain to set to. If NULL, will be detected automatically. * @param string|null $path Path to set to. If NULL, will be detected automatically. * @return bool */ public function setCookie( $name, $value, $expire=NULL, $httpOnly=TRUE, $domain=NULL, $path=NULL ) Typically you should leave $domain and $path as NULL, however these can be overridden if needed, for instance if you are working on integrating with a third party service. You can clear all login cookies through \IPS\Request::i()->clearLoginCookies() if needed, which includes the member_id and pass_hash cookies, as well as any forum password cookies (where a user may have entered a password to access a forum). Other helper methods There are several helper methods in the \IPS\Request class that you can leverage as needed to check various properties of the request \IPS\Request::i()->isAjax() Returns a boolean true or false to indicate if the request was made via AJAX \IPS\Request::i()->isSecure() Returns a boolean true or false to indicate if the request was made over SSL (https) \IPS\Request::i()->url() Returns an \IPS\Http\Url object representing the requested URL. Note that fragments (values after the hash symbol in a URL) are not sent to the server and will not be available to check at the server level. \IPS\Request::i()->ipAddress() Returns the IP address used to make the current request, taking into account proxy servers and forwarding if the administrator has chosen to do so in the AdminCP. \IPS\Request::i()->ipAddressIsBanned() Returns a boolean true or false to denote if the current request IP address is banned in the AdminCP IP address ban filters. \IPS\Request::i()->requestMethod() Returns the current request method, upper-cased. \IPS\Request::i()->isCgi() Returns a boolean true or false to indicate if the current request is being processed by a CGI wrapper in PHP \IPS\Request::i()->floodCheck() Checks the user's search flood control setting to determine if the user has recently searched and is searching again too quickly. If the user has searched recently and this method is called before the flood control time period has completed, an error will be shown to the user, otherwise their "last searched" time is updated to the current time for subsequent checks. \IPS\Request::i()->confirmedDelete( $title, $message, $submit ) When a user deletes data, it is prudent to confirm that the action was intended and not a misclick or similar. To facilitate this you can call the confirmedDelete() method which will verify if the user has confirmed the deletion already, and if not will show a confirmation screen first.
  15. URLs

    The Invision Community framework provides a powerful helper class to work with URLs, including parsing URLs and making requests to (and reading responses from) URLs. The software automatically uses cURL when available, falling back to standard sockets if not (this behavior can also be overridden by constants if an environment wishes to force cURL or sockets, specifically). Working with URLs The \IPS\Http\Url class is used to work with URLs, and two helper methods form the primary interface to create a URL object with this class: internal(): Use this method when creating an internal URL, such as a URL to a forum or topic. The method handles automatically creating friendly URLs when configured to do so. external(): Pass any full URL to this method to create a URL object out of the URL string. // Create a URL to topic ID 1 $url = \IPS\Http\Url::internal( 'app=forums&module=forums&controller=topic&id=1', 'front', 'forums_topic', array( 'topic-friendly-slug' ) ); $url = \IPS\Http\Url::external( 'https://www.google.com' ); // Create a URL object for a standard URL string The internal method accepts the following parameters: The URL query string The 'base' ('front' or 'admin', depending upon whether the URL is to a page in the AdminCP or not) The SEO template, if applicable An array of SEO slugs if the template calls for one A PROTOCOL_* constant from \IPS\Http\Url to override whether an http or https URL should be generated. You can usually omit this parameter and let the software determine the right protocol to use automatically. The external method simply accepts a URL string. If you are unsure if the URL object you are creating is internal or external, you can alternatively use the createFromString() method (passing the full URL as you would with the external() method), however note that this method is somewhat performance-intensive and the directly internal() and external() methods are preferred. The first parameter for this method is the URL, the second parameter is a boolean flag indicating if the URL may be a friendly internal URL, and the third and final parameter is a boolean flag indicating if you wish to automatically encode any components that are invalid instead of throwing an error (defaulting to FALSE - set this to TRUE if the URL is user-supplied and should not throw an error). You can make adjustments to the URL after creating the URL object by calling various methods. setScheme(): You can pass the scheme in (i.e. http or https), or pass in NULL to use a protocol-relative scheme (i.e. no scheme) setHost(): Accepts a full host name setPath(): Accepts a full valid path setQueryString(): Accepts a query string key as the first parameter and its value as the second parameter OR an array of key => value pairs as the first parameter setFragment(): Accepts a fragment stripQueryString(): Accepts a query string key or an array of query string keys and removes those query string parameters (if present) from the URL When you wish to output the URL, you can cast the \IPS\Http\Url object as a string print (string) $urlObject; The class has a few additional properties and methods you may wish to reference or call, outlined below: isInternal: This property denotes if the URL is internal or not isFriendly: This property denotes if the URL is a friendly (internal) URL or not queryString: This property is an array of key => value query string parameters in the URL hiddenQueryString: This property is an array of key => value query string parameters that would have been present if the URL were not a friendly URL. For instance, if you create an internal friendly URL object, this property will contain the associated query string parameters that are not shown (because a friendly URL is used) csrf(): Call this method to add the current viewing user's CSRF key to the URL as a query string argument. This is then later checked in controllers to prevent CSRF-style attacks. If you have a state-changing request that does not use the \IPS\Helpers\Form class, you should typically check the CSRF key. (static) seoTitle(): You can call this method to create a valid friendly URL slug. Typically this is done when content is submitted and the URL slug is stored for later reference, however you can also call this method on the fly if needed. Making requests Once you have created an \IPS\Http\Url object, you can make requests to it. To do this, you first call request() against the URL object. /** * Make a HTTP Request * * @param int|null $timeout Timeout * @param string $httpVersion HTTP Version * @param bool|int $followRedirects Automatically follow redirects? If a number is provided, will follow up to that number of redirects * @return \IPS\Http\Request */ public function request( $timeout=null, $httpVersion=null, $followRedirects=5 ) This returns an \IPS\Http\Request object. From here there are some methods you can call before executing the request: login(): Accepts a username as the first parameter and a password as the second parameter, and performs a basic authorization request against the URL. setHeaders(): Accepts an array of key => value pairs of headers that should be included with the request. sslCheck(): Accepts a boolean true or false as the only parameter, signaling whether SSL certificates should be validated or not. In most cases, this should be left default (true), unless you are aware that the SSL URL you are making a request against has an invalid certificate. forceTls(): Forces TLS for the request. This is primarily used with some payment gateways that enforce TLS requests. Afterwards, you can now make the request. To do so, you call the request method that you wish to perform (e.g. to perform a GET request you call get() and to perform a PUT request you call put()), passing along any parameters that should be included with the request (for POST and PUT requests). $request = \IPS\Http\Url::external( "http://someurl.com" )->request()->get(); This returns an \IPS\Http\Response object, which you can now inspect and manipulate as needed. Firstly, there are several useful properties you may need to reference: httpResponseVersion: This is the HTTP version of the response (1.0 or 1.1, typically) httpResponseCode: This is the HTTP response code. You may need to verify that a valid response code (i.e. 200) was returned after making a request. httpResponseText: This is the HTTP response text. For a 200 request, for instance, this will be "OK". httpHeaders: This will be an array containing all HTTP headers in the response as key => value pairs cookies: This will be an array of all Set-Cookie headers as key => value pairs. content: This is the body of the response. Casting the response as a string returns the content property noted above. There are some methods in the \IPS\Http\Response class that you can leverage to make working with certain common responses easier. decodeJson(): Calling this method will run the response through json_decode before returning it. If the response is not valid JSON, a RuntimeException will be thrown. decodeXml(): Calling this method will parse the response as XML, throwing a RuntimeException if the response is not valid XML. It is additionally worth noting that if the request fails for some reason (for instance, a time out connecting to the remote server), an \IPS\Http\Request\Exception exception will be thrown. To that end, you must wrap requests in a try/catch block. // Create a URL object $url = \IPS\Http\Url::external( "http://someurl.com" )->setQueryString( 'key', 'value' ); // Now fetch it and decode the JSON try { $response = $url->request()->get()->decodeJson(); } catch( \IPS\Http\Request\Exception $e ) { die( "There was a problem fetching the request" ); } catch( \RuntimeException $e ) { die( "The response was not valid JSON" ); } var_dump( $response ); exit;
×