Jump to content

teraßyte

Clients
  • Posts

    33,395
  • Joined

  • Days Won

    47

 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 teraßyte

  1. The \IPS\Helpers\Form\Date class does not account properly for a member's timezone when the min and/or max options are set.

     

    This is the file's code on lines 303-314 in the validate() function:

    		if ( $this->value and $this->options['min'] !== NULL and $this->options['min'] > $this->value )
    		{
    			$string = $this->options['min']->setTimeZone( $timezone )->localeDate( \IPS\Member::loggedIn() );
    			if( $this->options['time'] )
    			{
    				$string .=' ' . $this->options['min']->setTimeZone( $timezone )->localeTime( \IPS\Member::loggedIn() );
    			}
    			throw new \LengthException( \IPS\Member::loggedIn()->language()->addToStack('form_date_min', FALSE, array( 'sprintf' => array( $string ) ) ) );
    		}
    		
    		/* Check maximum */
    		if ( $this->value and $this->options['max'] !== NULL and $this->options['max'] < $this->value )
    		{
    			$string = $this->options['max']->setTimeZone( $timezone )->localeDate( \IPS\Member::loggedIn() );
    			if( $this->options['time'] )
    			{
    				$string .=' ' . $this->options['max']->setTimeZone( $timezone )->localeTime( \IPS\Member::loggedIn() );
    			}
    			throw new \LengthException( \IPS\Member::loggedIn()->language()->addToStack('form_date_max', FALSE, array( 'sprintf' => array( $string ) ) ) );
    		}

     

    The code doesn't account at all for the timezone when checking the min/max values against the entered value:

    $this->options['min'] > $this->value
    
    $this->options['max'] < $this->value

    The timezone is added only inside the IF check to display the error, but not before it for the check:

    $string = $this->options['min']->setTimeZone( $timezone )->localeDate( \IPS\Member::loggedIn() );
    
    $string = $this->options['max']->setTimeZone( $timezone )->localeDate( \IPS\Member::loggedIn() );

     

    This causes the check to fail for a user close to the UTC timezone, while it passes for a user with a more distant timezone.

     

    Here is an example with 2 different timezones (Rome & New York):

    DEBUG CODE:
    ==================================================
    print_r( $this->value );
    print_r( $this->options['min'] );
    print_r( $this->options['min']->setTimeZone( $timezone ) );
    var_dump( $this->options['min'] > $this->value );
    exit;
    ==================================================
    
    OUTPUT FOR ROME TIMEZONE:
    ==================================================
    IPS\DateTime Object
    (
        [date] => 2024-03-02 00:01:00.000000
        [timezone_type] => 3
        [timezone] => Europe/Rome
    )
    IPS\DateTime Object
    (
        [date] => 2024-03-02 00:58:41.440303
        [timezone_type] => 3
        [timezone] => UTC
    )
    IPS\DateTime Object
    (
        [date] => 2024-03-02 01:58:41.440303
        [timezone_type] => 3
        [timezone] => Europe/Rome
    )
    
    bool(true)
    ==================================================
    
    OUTPUT FOR NEW YORK TIMEZONE:
    ==================================================
    IPS\DateTime Object
    (
        [date] => 2024-03-02 02:41:00.000000
        [timezone_type] => 3
        [timezone] => America/New_York
    )
    
    IPS\DateTime Object
    (
        [date] => 2024-03-02 00:52:00.648474
        [timezone_type] => 3
        [timezone] => UTC
    )
    IPS\DateTime Object
    (
        [date] => 2024-03-01 19:52:00.648474
        [timezone_type] => 3
        [timezone] => America/New_York
    )
    
    bool(false)

     

    As you can see from the debug output above, the member with a Rome timezone fails to pass the check (TRUE triggers the error), while the New York timezone passes the check (FALSE doesn't trigger the error).

     

    The timezone must be added to the min/max checks before the check is done, and not after to display only the error.

  2. That's a rather unique problem, I've never heard this before. 😮

     

    The quote javascript already moves the cursor after the quote, but maybe you could change it to add also some text like "REPLY HERE" or something similar?

    However, it will require a custom modification since JS is not something you can edit directly like a template.

  3. If you have that code in your htaccess file then the Rewrite URLs? setting in your screenshot (which is disabled) needs to be enabled.

    Also, this is the latest .htaccess file:

    <IfModule mod_rewrite.c>
    Options -MultiViews
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule \.(js|css|jpeg|jpg|gif|png|ico|map|webp)(\?|$) /404error.php [L,NC]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    Yours is missing the webp extension.

  4. 1 hour ago, bradybarrows said:

    In the past I could view the number of views of a particular post.

    Do you mean a particular topic perhaps? There has never been a feature for individual posts, I'm not even sure how you'd track that even if you used to have a modification for it.

  5. 22 minutes ago, Jim M said:

    That is correct, it is currently only offered for Forums at the moment. I will pass this along internally.

    The Add Message option is available also in other areas:

    • Downloads Files
    • Calendar Events
    • Gallery Images
    • Blog Entries
    • Pages Database

     

    At least I'm seeing it everywhere. 🙄

  6. The column cache_sm is not a default one in the forums_topics table. It must have been added by a modification at some point. Either the modification is now disabled or uninstalled, but the column is still there, and since it doesn't accept a NULL value, the database throws that error.

    The column name itself doesn't tell what kind of modification it could be. The only way is to investigate the database/modifications on your site and pinpoint where it's coming from. And, in case the modification is already uninstalled, the column needs to be removed manually. 🤔

     

    This is not something IPS can assist with since it's caused by a 3rd party modification. Unless you know how to do it yourself, you'll need help from a 3rd party developer/provider. If you send me a PM with more details, I can take a look.

  7. 1 minute ago, Randy Calvert said:

    One thing to consider as well...  maybe they're referring to "memory" as RAM and not as disk space usage.  This may not be a storage issue, but them saying your site has too many concurrent users (guests and real).  

    Exactly this. I meant to add a mention about the RAM when I said to confirm what the hosting is asking, but forgot to. 😅

  8. 1 hour ago, Happy go Lucky said:

    I'm using Hostpapa. What are some better ones?

    Also, I'm a newb at this. Would it be a simple as having them take over hosting of my current site?

    If the site I found using that name is correct, even their smallest plan has 100GB SSD storage. Unless you have a very old plan/account with them, and it was never upgraded to one of their newest plans, you're not being told to reduce the space used.

    Maybe you should confirm better with your hosting what exactly is the issue.

     

    As for suggestions, since IPS also provides hosting (IPS Cloud), we aren't allowed to publicly mention other hosting options as far as I know.

    In case you still want to go ahead and switch hosting without using the Cloud option, send me a PM and I can at least tell you the one I'm using. But first, confirm with your hosting if the issue is indeed the space used and not something else.

  9. You can't import a CSV list of the active members, it would just duplicate the accounts or skip importing them if the same email already exists (I forget which right now).

     

    If you already have a list of active members, it would be best to:

    1. Move all members to a new group.
    2. Run a script to move the active members (based on your list) back to the correct group.
    3. Mass delete the members that remain in the new group.
    4. Delete the new group.

     

    As I mentioned, you need to write a custom script that accepts the format of the list of active members and updates the accounts. Or, for example, if you have a query based on the email field, you can do step #2 above without a custom script and simply run your query with all the active members' emails.

     

    In any case, be sure to do a backup before making any changes.

  10. I think 500 MB is a pretty small hosting package nowadays. Even the cheapest option on the hosting I use has 10 GB for $2.24 /month. 😮

     

    Rather than deleting files, which might break old posts that require those files, have you considered changing hosting? 🙄

  11. You could remove the guests' permission to see those specific forums, but it would impact the ability of search engines to index your content, too.

     

    You might be able to tell what they're doing if you look at the access logs of your server. If you're unsure where they are, try asking your hosting. Every page opened/viewed is recorded in those logs (as log as the server has the option enabled). You might be able to see what exactly they're doing that way.

  12. You can find the recommended CHMOD settings inside the init.php file:

    // File permissions
    // For example: when making folders for files to be uploaded to, what permissions
    // that should be created with
    'IPS_FOLDER_PERMISSION'				=> 0777,	// Writeable folders
    'FOLDER_PERMISSION_NO_WRITE'			=> 0755,	// Non-writeable folders
    'IPS_FILE_PERMISSION'				=> 0666,	// Writeable files
    'FILE_PERMISSION_NO_WRITE'			=> 0644,	// Non-writeable files

    Those are the default values IPS suggests (and uses), but depending on your server's configuration, you might need to adjust them. That part is best discussed with your hosting, though.

     

    As for writable folders, the default ones usually are applications, datastore, plugins, and uploads.

    Anyway, you'll get an error during upgrades if something that needs to be writable isn't. Unless you're having issues with your site (for example, files not uploading, etc), I wouldn't change anything.

×
×
  • Create New...