at link edit, I can not edit correctly the "expire" variable (tested with values as days or seconds).
I have also tested editing the {LINKEXPIREDAYS} but without affecting the expire days.
Would be great if we can use the same "expire" variable inside link edit in order to (admins only) edit the expire days as it's being actually used at link suggest.
Thank you again.
Edit:
Paul, seems that the followig code is changing correctly the "expire" variable at link edit:
You shouldn't be adding anything. edit.tpl already contains
<tr> <td class="labelscolumn"><span class="labels">Expiration:</span><br>If applicable, write the days left until the link expires or the date on which the link should expire.</td> <td class="optionscolumn"><input type="text" name="expire" size="15" value="{LINKEXPIREDAYS}"></td> </tr>
On test, there appears to be no problem editing it either.
I have found that when using: <input type="text" size="5" name="expire" value="{LINKEXPIREDAYS}"></td> at edit.tpl in order to edit the "expire" variable, it can not be set to a value higher than about 130.
For example if you edit a link, setting the expire variable to 130 days or higher, this takes the value of 0 days automatically. This also happens when you intend to set the expire variable to a higer value inicially at new link suggestion.
I was just about to post a topic on the same thing. I had my links disappear, because at the time of regenerating the counters, links that had a high number (definately over 120) of days to expire, went back to -0.
Paul, could you release the appropriate php file with a fix in it for this?
Yep, but for some odd reason, after some time, it does change it. There hasn't been a way for me to deliberately reproduce this problem, but it has happened many times already. My guess, is the counter regeneration, or addition/deletion of link from a member's personal links (no idea how that would relate though).
So for sure, there is something weird happening, just can't pinpoint the reason.
Maybe when the cron runs to expire links, or maybe when it runs to warn pending expirations. The link I've tested still says 150 though and it's been a while, so I guess those can't be it.
At thie moment (1:43am) expire variable gets a value of cero after editing it with a high number. I edit it to be a value of 150 and it gets the value of 0.
There's no such item as "expiredate" so it would have to be empty. The template only has "expire" being submitted in the form:
<tr> <td class="labelscolumn"><span class="labels">Expiration:</span><br>If applicable, write the days left until the link expires or the date on which the link should expire.</td> <td class="optionscolumn"><input type="text" name="expire" size="15" value="{LINKEXPIREDAYS}"></td> </tr>
And you will notice the lack of any instance of "expiredate" when you search edit.php as well.
If such a change does something for you, you must have a malformed template.
Edit: I see now there's nothing for expiration in the multilingual edit template, that would be the problem. Adapting it now from the default edit template as above.
Hope you have the opportunity of checking editing the expire variable at the first hours of the day as at this time I find the problem reported. This is that, at the stated time of the day editing the expire variable to a higher value(250 or 350), the value is reverted to cero.
The error is with the behaviour of strtotime($expire);
At edit.php we have:
if ($expire) { $tryit = strtotime($expire); if ($tryit > time()) $expire = $tryit; else $expire = time() + ($expire * 86400); // calculate expiration date $_POST['expire'] = $expire; }
At a current time of 3:15 am we have: time()= 1145690014
If I enter a expire value of: 365 days I have: strtotime(365)= 1145693100 -> as $tryit is > time(), $expire takes the value of 1145693100, but 1145693100 is this same day:
In your post #1, the template code you posted is certainly wrong -- you have <input type="text" size="5" name="expire" value="{LINKEXPIRE}"> when it's supposed to be <input type="text" size="5" name="expire" value="{LINKEXPIREDAYS}">
strtotime(365)= 1145693100
I'd have expected strtotime(365) to return null or false since it's nonsense to feed a number to that function. Anyhow the code there is rather shoddy so I'll change it to a more logical
if ($expire) { $tryit = strtotime($expire); if (!is_numeric($expire)) $expire = $tryit; else $expire = time() + ($expire * 86400); // calculate expiration date $_POST['expire'] = $expire; }
Thanks for tracking it down.
0/5
1
2
3
4
5
This thread is closed, so you cannot post a reply.
Comments on expiredays
Forum Regular
Usergroup: Customer
Joined: Aug 09, 2004
Location: Chile
Total Topics: 172
Total Comments: 462
Paul,
At link suggestion we have "expire" variable to suggest the days to expire.
If I insert the same code:
<td class="labelscolumn"><span class="labels">{LANG_SUGGESTLINK_EXPIRE}:</span><br>{LANG_SUGGESTLINK_EXPIREHELP}</td>
<td class="optionscolumn"> <input type="text" size="5" name="expire" value="{LINKEXPIRE}"></td>
at link edit, I can not edit correctly the "expire" variable (tested with values as days or seconds).
I have also tested editing the {LINKEXPIREDAYS} but without affecting the expire days.
Would be great if we can use the same "expire" variable inside link edit in order to (admins only) edit the expire days as it's being actually used at link suggest.
Thank you again.
Edit:
Paul, seems that the followig code is changing correctly the "expire" variable at link edit:
<input type="text" size="5" name="expire" value="{LINKEXPIREDAYS}"></td>
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
You shouldn't be adding anything. edit.tpl already contains
On test, there appears to be no problem editing it either.
Forum Regular
Usergroup: Customer
Joined: Aug 09, 2004
Location: Chile
Total Topics: 172
Total Comments: 462
Paul,
I have found that when using:
<input type="text" size="5" name="expire" value="{LINKEXPIREDAYS}"></td>
at edit.tpl in order to edit the "expire" variable,
it can not be set to a value higher than about 130.
For example if you edit a link, setting the expire variable to 130 days or higher, this takes the value of 0 days automatically. This also happens when you intend to set the expire variable to a higer value inicially at new link suggestion.
Forum Regular
Usergroup: Customer
Joined: Jun 22, 2005
Total Topics: 91
Total Comments: 305
Hey guys!
I was just about to post a topic on the same thing. I had my links disappear, because at the time of regenerating the counters, links that had a high number (definately over 120) of days to expire, went back to -0.
Paul, could you release the appropriate php file with a fix in it for this?
Much appreciated.
Thanks
David
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
I edit a link, type 150, submit. I come back to edit, it still says 150.
Forum Regular
Usergroup: Customer
Joined: Jun 22, 2005
Total Topics: 91
Total Comments: 305
Yep, but for some odd reason, after some time, it does change it. There hasn't been a way for me to deliberately reproduce this problem, but it has happened many times already. My guess, is the counter regeneration, or addition/deletion of link from a member's personal links (no idea how that would relate though).
So for sure, there is something weird happening, just can't pinpoint the reason.
Thanks
David
Forum Regular
Usergroup: Customer
Joined: Aug 09, 2004
Location: Chile
Total Topics: 172
Total Comments: 462
Yes I found it working now,
could it be something related with editing hour?
I should try reproducing it at different hours of the day.
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
Maybe when the cron runs to expire links, or maybe when it runs to warn pending expirations. The link I've tested still says 150 though and it's been a while, so I guess those can't be it.
Forum Regular
Usergroup: Customer
Joined: Aug 09, 2004
Location: Chile
Total Topics: 172
Total Comments: 462
Paul,
At thie moment (1:43am) expire variable gets a value of cero after editing it with a high number. I edit it to be a value of 150 and it gets the value of 0.
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
Mine says 145 still. Edited it back to 150, and it says 150. Give me a procedure.
Forum Regular
Usergroup: Customer
Joined: Aug 09, 2004
Location: Chile
Total Topics: 172
Total Comments: 462
Paul,
At this time 0:31 am edit is not working correctly.
Checking the edit.php, we have:
if ($expire)
{
$tryit = strtotime($expire);
if ($tryit > time()) $expire = $tryit;
else $expire = time() + ($expire * 86400); // calculate expiration date
$_POST['expire'] = $expire;
}
I have changed to:
if ($expire)
{
$tryit = strtotime($expiredate);
if ($tryit > time()) $expire = $tryit;
else $expire = time() + ($expire * 86400); // calculate expiration date
$_POST['expire'] = $expire;
}
And now I find the edit function working correctly.
Could you please confirm me if changing:
$tryit = strtotime($expire);
to
$tryit = strtotime($expiredate);
would be the correct way to solve this.
Thanks.
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
There's no such item as "expiredate" so it would have to be empty. The template only has "expire" being submitted in the form:
And you will notice the lack of any instance of "expiredate" when you search edit.php as well.
If such a change does something for you, you must have a malformed template.
Edit: I see now there's nothing for expiration in the multilingual edit template, that would be the problem. Adapting it now from the default edit template as above.
Forum Regular
Usergroup: Customer
Joined: Aug 09, 2004
Location: Chile
Total Topics: 172
Total Comments: 462
ok Paul,
Hope you have the opportunity of checking editing the expire variable at the first hours of the day as at this time I find the problem reported.
This is that, at the stated time of the day editing the expire variable to a higher value(250 or 350), the value is reverted to cero.
Thanks again.
Forum Regular
Usergroup: Customer
Joined: Aug 09, 2004
Location: Chile
Total Topics: 172
Total Comments: 462
Paul,
The error is with the behaviour of strtotime($expire);
At edit.php we have:
if ($expire)
{
$tryit = strtotime($expire);
if ($tryit > time()) $expire = $tryit;
else $expire = time() + ($expire * 86400); // calculate expiration date
$_POST['expire'] = $expire;
}
At a current time of 3:15 am we have:
time()= 1145690014
If I enter a expire value of: 365 days I have:
strtotime(365)= 1145693100 -> as $tryit is > time(), $expire takes the value of 1145693100,
but 1145693100 is this same day:
strtotime(365)-time()= 3086 seconds
(strtotime(365)-time())/60/60 = 0,85722222222222 hours
This means that this link will expire this same day, no on 365 days more. This is why {LINKEXPIREDAYS} takes the value of cero.
More checked values:
For actual time: 3:42 am:
time()= 1145691719
strtotime(120)= 1145683200
strtotime(365)= 1145693100
strtotime(450)= 1145695800
strtotime(120)-time()= -8519
strtotime(365)-time()= 1381
strtotime(450)-time()= 4081
(strtotime(120)-time())/60/60 = -2,3663888888889 hours
(strtotime(365)-time())/60/60 = 0,38361111111111 hours
(strtotime(450)-time())/60/60 = 1,1336111111111 hours
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
In your post #1, the template code you posted is certainly wrong -- you have <input type="text" size="5" name="expire" value="{LINKEXPIRE}"> when it's supposed to be <input type="text" size="5" name="expire" value="{LINKEXPIREDAYS}">
strtotime(365)= 1145693100
I'd have expected strtotime(365) to return null or false since it's nonsense to feed a number to that function. Anyhow the code there is rather shoddy so I'll change it to a more logical
Thanks for tracking it down.