vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   More Functions in Edit Post if you are an Admin (https://vborg.vbsupport.ru/showthread.php?t=33761)

Xenon 01-02-2002 10:00 PM

Hi folks!

After my server has had problems last night, so the date was incorrect, an the posts had the dateline of October, I start programming this hack, to change a bit more of the Posting informations if you are an Admin of the board.

Now you can change
1. The Userid of this Post (don't know when, but perhaps you'll need it sometimes)
2. The Threadid of the Post (if you want to take this post to another thread)
3. Date and time postet
4. IP Address saved with the Post
5. can make post uneditable for original Author/Mods/Supermods (priority level system) or even editable to the author when timelimit is over...

If you like it Please click on install Button
Screenshot

vB3 Version of this hack can be found here

TheComputerGuy 01-03-2002 06:01 PM

nice

Mystics 01-03-2002 09:15 PM

Thx! I have adjusted it a little bit, so that you don't have to duplicate the whole template editpost, you only have to insert $admineditpost into that template (I made changes in editpost.php for that, you can find it at Step 1.3 in my file).

I have attached my changed instructions!

@Xenon
Nochmals danke f?r den Hack, bei Fragen zu meinen ?nderungen, wende dich an mich :)

Bye,
Mystics

Xenon 01-03-2002 10:17 PM

Thx, have updated my Attachment too :)

@Mystics: Hab alle Anderungen gesehn, h?tt ich selber auch draufkommen k?nnen :), so ists nat?rlich um ein St?ck praktischer, danke nochmals

Screenshot Version 2.20:

Xenon 01-12-2002 03:55 PM

Have correctet a little bug.
The line which edited the date has had a little bug which changes into a wrong day whe the day is greater 9

Jawelin 01-14-2002 02:34 PM

Yeah!! Infact I got lost!! ;)
Great hack but..... !!!

I tried to edit some posts and had the date/time switched before about 9 days and 18hrs !!!! Even without touchin' the date/time field... :)

A post made today (CET date format) :

14-01-2002 15.40 went to 04-01-2002 21.40 !!!!!
(note: I'm six hours behind my server' time...)

Hope your 'patch' fixes it... Doesn't it ?
Thanks a lot.

Jawelin 01-14-2002 03:01 PM

:( :rolleyes:

Bug is only partially fixed.
I applied your new release as of 12jan, but there's still a problem with the time synchro. I think - as said - the local area time.

The example above, for instance, now becomes :
14-01-2002 21.40 !!!

Infact, cause the substr( ..., 1,2 ) instead of substr( ..., 0, 2 ), before I had the date moved to 4 instead of 14 .... (24... etc...)
But it doesn't manage the time zone info, I think.

Infact I made a correction on the time of edit setting it to 09.40 and, as output, I got the message dated :
14-01-2002 15.40

.... :)

Hope this helps you to fix completely the problem...
Thanks again for your work.

Bye

Xenon 01-14-2002 05:09 PM

i see to correct it just add the line

$datzeit=$datzeit+4*3600;

right after

$datzeit=mktime(substr($datzeit,11,2), substr($datzeit,14,2), 0, substr($datzeit,3,2), substr($datzeit,0,2), substr($datzeit,6,4));

and change the 4 to your timeoffset.

Jawelin 01-14-2002 06:06 PM

Ok. May thanks... ;)
I think you mean the offset behind the server time, not any other absolute like GMT, do you ?

I'd prefer to use a variable environment, for example useing the $timeoffset variable adding the $bbuser[timezoneoffset] ... :)
But haven't any idea how to make the global variable be seen in editpost.php... ;)

Thanks a lot.
Again

Bye

Xenon 01-14-2002 07:09 PM

Quote:

Originally posted by Jawelin

But haven't any idea how to make the global variable be seen in editpost.php... ;)

That was also my problem, thats why i use the absolute change ;)
the offset you have to set, should be like the one you set in your vb options ;)

Jawelin 01-15-2002 11:33 AM

Quote:

Originally posted by Xenon

the offset you have to set, should be like the one you set in your vb options ;)

Almost...
Actually I have GMT -5 for Server' time (EST) and GMT +1 for mine and almost users (CET)... :)
So I should make the sum of abs...

By now a fixed '6' should work great !
Thanks.

Jawelin 01-18-2002 09:29 PM

Quote:

Originally posted by Xenon
i see to correct it just add the line

$datzeit=$datzeit+4*3600;

right after

$datzeit=mktime(substr($datzeit,11,2), substr($datzeit,14,2), 0, substr($datzeit,3,2), substr($datzeit,0,2), substr($datzeit,6,4));

and change the 4 to your timeoffset.

Just a small correction... I tried myself :)
If my server is in a timezone 'on the left' of mine (as said, I'm on +1, the server is on -5), I should SUBTRACT 6 and not add it... :)

$datzeit is the time string displayed on my page, adjusted to my time... If the server time is six hours 'after' mine, I should resave the edited post with the server time...

my case: ---> $datzeit = $datzeit - 6 * 3600;

Thanks again for your help.
Bye

Shenlong 01-19-2002 12:29 AM

hey good hack

but can someone tell me the time for

Eastern Time (U.S.A.)

PM/AM Clock

What should I replace it with?

Jawelin 01-19-2002 08:06 AM

It' a RELATIVE value: where are you ?
:supwink:

Jawelin 01-19-2002 03:23 PM

Lookin' at vbdate() function source, I found out how to parametrize the admin's offset behind the server:

simply, the users of this hack - with your bugfix - should replace the code

PHP Code:

$datzeit=mktime(substr($datzeit,11,2), substr($datzeit,14,2), 0substr($datzeit,3,2), substr($datzeit,0,2), substr($datzeit,6,4));
$datzeit=$datzeit+4*3600

PHP Code:

$datzeit=mktime(substr($datzeit,11,2), substr($datzeit,14,2), 0substr($datzeit,3,2), substr($datzeit,0,2), substr($datzeit,6,4));
$offset=3600*($bbuserinfo['timezoneoffset']-$timeoffset);   // Seconds offset behind the server/post time
$datzeit=$datzeit-$offset;                                  // Traslated new post time 

That upgrade reverses, just before saving it, the traslation made at reading time from the post(server) time to the user time. Actually it acts as vbdate() with an inverse traslation.

This way there shouldn't be neither the import of global variables $bbuserinfo and $timeoffset, like functions.php has, as at the top of editpost.php there's a full global variables import.

That is !!
Bye
:stoned:

Shenlong 01-19-2002 07:14 PM

Quote:

Originally posted by Jawelin
It' a RELATIVE value: where are you ?
:supwink:

Was that to me? I just want to know what timestamp is:

EST (U.S.A.) because im not good with doing the m-y-d thing, thats all

Jawelin 01-19-2002 10:21 PM

Quote:

Originally posted by Shenlong
hey good hack
but can someone tell me the time for
Eastern Time (U.S.A.)
PM/AM Clock
What should I replace it with?

Excuse, but HOW COULD WE UNDERSTAND something different from such a question ?
:greedy:

Hwr my solution is not for you... aren't absolutely interested in, I guess..

Lucky 01-19-2002 11:12 PM

I'm sure this may come in handy!

Thanx!

Shenlong 01-19-2002 11:14 PM

Quote:

Originally posted by Jawelin


Excuse, but HOW COULD WE UNDERSTAND something different from such a question ?
:greedy:

Hwr my solution is not for you... aren't absolutely interested in, I guess..

dude, lol what are u smoking? i dont understand u.

i just am wondering what to put in for the EST U.S.A. time instead of the german time

Jawelin 01-20-2002 09:28 AM

Quote:

Originally posted by Shenlong


Was that to me? I just want to know what timestamp is:

EST (U.S.A.) because im not good with doing the m-y-d thing, thats all

I was right!!! ;)
Well.
Your server is EST (GMT -5). You are in Germany (GMT +1).
You definetively can use the hack's default $format : d.m.Y .... with all the substrings as the authod did...

Very simple, then... You have to correct the output time with a '-6 hours', just like me.
Any case, you can use along everyone the upgrade in Post#15.

:up: :up:

SirSteve 02-05-2002 01:03 PM

I'd like JUST the time/date stamp change part. Also, is there an English version?

Xenon 02-05-2002 04:24 PM

Thers no english version, but it isnt hard to make the changes into the english date-time format

just the date/time change
you must change following things in my Hack:

don't use Step 1.4

in step 1.5
change
PHP Code:

$DB_site->query("UPDATE post SET ipaddress='".addslashes($ipadd)."',dateline='$datzeit',userid='$userid',threadid='$pthreadid',title='".addslashes(htmlspecialchars($title))."',pagetext='".addslashes($message)."',allowsmilie='$allowsmilie',showsignature='$signature',iconid='$iconid'$editedbysql$attachmentsql WHERE postid='$postid'"); 

to

PHP Code:

$DB_site->query("UPDATE post SET dateline='$datzeit',title='".addslashes(htmlspecialchars($title))."',pagetext='".addslashes($message)."',allowsmilie='$allowsmilie',showsignature='$signature',iconid='$iconid'$editedbysql$attachmentsql WHERE postid='$postid'"); 

and the admineditpost template has only this part:
PHP Code:

<tr>
    <
td bgcolor="{secondaltcolor}" nowrap><normalfont><b>Date and Time:</b></normalfont></td>
    <
td bgcolor="{secondaltcolor}"><normalfont><input type="text" class="bginput" name="datzeit" value="$datzeitsize="40" maxlength="85"></normalfont></td>
</
tr

for englisch time format you have to change

$datzeit=mktime(substr($datzeit,11,2), substr($datzeit,14,2), 0, substr($datzeit,3,2), substr($datzeit,0,2), substr($datzeit,6,4));

into

$datzeit=mktime(substr($datzeit,11,2), substr($datzeit,14,2), 0, substr($datzeit,0,2), substr($datzeit,3,2), substr($datzeit,6,4));

i think and of course the line
$datzeit=vbdate("d.m.Y H:i",$postinfo[dateline]);
into
$datzeit=vbdate("m-d-Y H:i",$postinfo[dateline]);

this should be all you need i think

SirSteve 02-05-2002 05:22 PM

Thanks! :)

Logician 02-15-2002 09:56 AM

Nice hacks thanks :)

A reminder to people who use this hack: If you edit user id or thread id, dont forget to update the counters.

JBMoney 05-05-2002 04:05 PM

Has anyone tried this in 2.2.5 and gotten it to work?

I've installed it and everything looks right, but when I try to edit the time... nothing happens. No change in the post at all.

Any thoughts?

JBMoney 05-05-2002 04:08 PM

Nevermind, I think I see a pattern.

mashby 07-05-2002 01:21 PM

I just installed this hack. It was easy to install and answered my prayers [link]

Xenon 07-05-2002 01:48 PM

:)
you're welcome

Boofo 07-26-2002 05:27 AM

Ok, guys, I'm totally confused here. I'm one of them dumb Americans (although I do have some German Ancestory.) :)

Xenon: Why don't we use Step 1.4 if we are in the USA?

Jawelin: If my server is in the UK and I am in the USA, you offset fix will automatically set the time at my offset according to what I have in my time options, right? So i don't have to manually set it?

Sorry for the questions guys, but I want to make sure I get it right before I mess anything up. :)

Xenon 07-26-2002 10:53 AM

you have missunderstood something boofo: the don't use 1.4 was for SirSteve because he just wanted to add the datetime functions and nothing else ;)

th only thing you have to change as an american user are these lines:
PHP Code:

$datzeit=vbdate("d.m.Y H:i",$postinfo[dateline]); 

PHP Code:

$datzeit=mktime(substr($datzeit,11,2), substr($datzeit,14,2), 0substr($datzeit,3,2), substr($datzeit,0,2), substr($datzeit,6,4)); 

it's because you use other date/time formats as we do in german :)

Boofo 07-26-2002 06:42 PM

Ok, I put 1.4 part back in. But what does this mean?

$userid=0;
$username="Gast";

And what about Jawelin's auto date part? Will that work for me?

Xenon 07-26-2002 07:04 PM

in english you have to change "Gast" to "guest" ;)
because you can change the Authorid of the post, and when you choose 0, it must have a new Username, i took guest ;)

yes Jawelin's auto date part should work for ya

Boofo 07-26-2002 07:53 PM

Thank you very much. I just installed it and think I will leave the name as "Gast". That way I can have more of a German flair to the site (think that will work? :)). Thanks again! :)

Boofo 07-26-2002 09:10 PM

I ran into a major problem here. This is the date I got on a message I edited that I had just added a few minutes before.

Dec 31, 1969, 11:59 pm

Any ideas where I went wrong? :)

Xenon 07-26-2002 09:34 PM

hehe intresting idea to get a german flair in it ;) ^^

huh before 1970? very funny ;)
can you paste the two line of your editpost.php which handles the dates, so perhaps i can tell you whats wrong

Boofo 07-26-2002 09:57 PM

I hope these are the lines you wanted. :)

PHP Code:

 $datzeit=mktime(substr($datzeit,11,2), substr($datzeit,14,2), 0substr($datzeit,0,2), substr($datzeit,3,2), substr($datzeit,6,4));
$offset=3600*($bbuserinfo['timezoneoffset']-$timeoffset);   // Seconds offset behind the server/post time
$datzeit=$datzeit-$offset


Xenon 07-26-2002 10:19 PM

seems to be correct

can you also print your exact time-format?
i mean how does this line look in your format:
PHP Code:

$datzeit=vbdate("d.m.Y H:i",$postinfo[dateline]); 

[high]* Xenon is thinking of writing a new version easier to optimize ;)[/high]

Boofo 07-26-2002 10:38 PM

I just changed it to match the time layout I use on the board. Here it is:

PHP Code:

$datzeit=vbdate("M j, Y, g:i a",$postinfo[dateline]); 

Quote:

Originally posted by Xenon
seems to be correct

can you also print your exact time-format?
i mean how does this line look in your format:
PHP Code:

$datzeit=vbdate("d.m.Y H:i",$postinfo[dateline]); 

* Xenon is thinking of writing a new version easier to optimize ;)


Xenon 07-26-2002 10:53 PM

Ok, there's the problem ;)
by now you can just use numeric time/date formats
so for Time you must use something like H:i instead of g:i a
and some sort of d.m.Y instead of M j, Y.
it must be sure the ammount of bytes in the timestring can't change with another date ;)....
its the way mktime() works...

Boofo 07-26-2002 11:18 PM

So, what should I put in there then? And can it be fixed to work with the date like I have it? :)

Quote:

Originally posted by Xenon
Ok, there's the problem ;)
by now you can just use numeric time/date formats
so for Time you must use something like H:i instead of g:i a
and some sort of d.m.Y instead of M j, Y.
it must be sure the ammount of bytes in the timestring can't change with another date ;)....
its the way mktime() works...



All times are GMT. The time now is 04:47 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01414 seconds
  • Memory Usage 1,867KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (11)bbcode_php_printable
  • (9)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete