Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custome Intercept Page doesn't work. #43

Open
tarasinf opened this issue Sep 20, 2023 · 1 comment
Open

Custome Intercept Page doesn't work. #43

tarasinf opened this issue Sep 20, 2023 · 1 comment

Comments

@tarasinf
Copy link

tarasinf commented Sep 20, 2023

YOURLS v 1.8.1
Expiry v 2.4.1

Settings:

Default Expiry Type is Timer
Expiry Intercept Behavior is Custome URL
Custome Intercept Page is https://google.com/ (I had to set it by SQL, as after UI set it was none)

Expected behaviour:

After expiration time & clicking on a short URL, the Original URL has to be changed to https://google.com/.
postexpire has to be set to https://google.com/.

Actual behaviour:

After expiration time & clicking on a short URL, the record disappears from the table.
postexpire set to none.

mysql> SELECT * FROM yourls_options;
+-----------+-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| option_id | option_name                   | option_value                                                                                                                                                                                                                                                   |
+-----------+-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|         1 | version                       | 1.9.2                                                                                                                                                                                                                                                          |
|         2 | db_version                    | 506                                                                                                                                                                                                                                                            |
|         3 | next_id                       | 3                                                                                                                                                                                                                                                              |
|         4 | active_plugins                | a:2:{i:0;s:27:"random-shorturls/plugin.php";i:1;s:17:"expiry/plugin.php";}                                                                                                                                                                                     |
|         5 | core_version_checks           | O:8:"stdClass":4:{s:15:"failed_attempts";i:0;s:12:"last_attempt";i:1695204144;s:11:"last_result";O:8:"stdClass":2:{s:6:"latest";s:5:"1.9.2";s:6:"zipurl";s:56:"https://api.github.com/repos/YOURLS/YOURLS/zipball/1.9.2";}s:15:"version_checked";s:5:"1.8.1";} |
|         6 | random_shorturls_length       | 10                                                                                                                                                                                                                                                             |
|         7 | expiry_global_expiry          | clock                                                                                                                                                                                                                                                          |
|         8 | expiry_default_click          | 50                                                                                                                                                                                                                                                             |
|         9 | expiry_default_age            | 2                                                                                                                                                                                                                                                              |
|        10 | expiry_default_age_mod        | min                                                                                                                                                                                                                                                            |
|        11 | expiry_intercept              | custome                                                                                                                                                                                                                                                        |
|        12 | expiry_custom                 | https://google.com/                                                                                                                                                                                                                                  |
|        13 | expiry_global_post_expire_chk | true                                                                                                                                                                                                                                                           |
|        14 | expiry_expose                 | true                                                                                                                                                                                                                                                           |
|        15 | expiry_table_drop             | false                                                                                                                                                                                                                                                          |
+-----------+-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

mysql> SELECT * FROM yourls_expiry;
+------------+-------+-------+------------+-----------+--------------------+
| keyword    | type  | click | timestamp  | shelflife | postexpire         |
+------------+-------+-------+------------+-----------+--------------------+
| kbyt953qku | clock | dummy | 1695290374 | 120       | none               |
+------------+-------+-------+------------+-----------+--------------------+


mysql> SELECT * FROM yourls_url;
+------------+---------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+------------+--------+
| keyword    | url                                                     | title                                                                                                 | timestamp           | ip         | clicks |
+------------+---------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+------------+--------+
| kbyt953qku | https://github.com/joshp23/YOURLS-Expiry/issues/43      | Custome Intercept Page doesn't work. � Issue #43 � joshp23/YOURLS-Expiry � GitHub                     | 2023-09-21 09:59:34 | 172.20.0.1 |      0 |
+------------+---------------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+------------+--------+

@tarasinf
Copy link
Author

To fix the issue, I had to do the next changes. As in expiry_config under number 4 is expiry_global_post_expire thats not defined, and under number 1 in expiry_custom. Does it make sense?

  • In function expiry_check( $args ) {:
    $gpx = $opt[5] == 'false' ? null : $opt[4]; -> $gpx = $opt[5] == 'false' ? null : $opt[1];

  • In yourls_add_filter( 'add_new_link', function (:
    $gpx = $opt[5] == 'false' ? null : $opt[4]; -> $gpx = $opt[5] == 'false' ? null : $opt[1];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant