PDA

View Full Version : Hi.



The Man
11-08-2002, 06:22 PM
Here are some hacks you said you were going to install a long time ago. I'm posting them as attachments, so you now have less obstacles in your way to getting around to them, unless you've changed your mind.

I'm deleting this thread after the hacks have been installed.

Peace
Aaron

The Man
11-08-2002, 06:24 PM
Originally posted (http://www.vbulletin.org/forum/showthread.php?postid=68008&action=showpost) by Mas*Mind
This is what the hack does: It let's you preview a message when you're editing it, you can only preview when you're posting or replying the way it is now:

It works on my testserver, but I've not tested on a 'live' forum, but it seems to be working allright...

Instructions

1 Backup your editpost.php file!!! and open the original one...

Then:

after:


if (!isset($action) or $action=="") {
$action="editpost";
}

insert:


if($preview AND $action="updatepost")
$action = "editpost";

after:


if ($action=="editpost") {

// draw nav bar
$navbar=makenavbar($threadinfo[threadid],"thread",1);

insert:


if($preview)
{ $parseurl=iif($parseurl=="yes",1,0);
$email=iif($email=="yes",1,0);
$allowsmilie=iif($disablesmilies=="yes",0,1);
$signature=iif($signature=="yes",1,0);

$previewmessage=$message;

if ($parseurl) {
$previewmessage = $postinfo[message]=parseurl($previewmessage);
}

$previewpost=1;
$previewmessage=bbcodeparse($previewmessage,$foruminfo[forumid],$allowsmilie);
$postinfo[message]=$message;

if ($signature) {
$previewmessage.=bbcodeparse("\n__________________\n$bbuserinfo[signature]",0,$allowsmilies);
}

eval("\$postpreview=\"".gettemplate("editpost_postpreview")."\";");

$parseurlchecked=iif($parseurl,"checked","");
$postinfo[allowsmilie] = $allowsmilie;
$postinfo[showsignature] = $signature;
$postinfo[iconid] = $iconid;
$postinfo[title] = $title;
$previewchecked=0;
}
else{
$postinfo[message]=htmlspecialchars($postinfo[pagetext]);
$parseurlchecked="CHECKED";
}

Replace:


$postinfo[message]=htmlspecialchars($postinfo[pagetext]);

with:


//$postinfo[message]=htmlspecialchars($postinfo[pagetext]);

replace:


if ($checkid=$DB_site->query_first("SELECT subscribethreadid FROM subscribethread WHERE userid='$userinfo[userid]' AND threadid=$threadinfo[threadid]")) {
$emailchecked="CHECKED";
} else {
$emailchecked="";
}

with:


if(!$preview)
$email=$DB_site->query_first("SELECT subscribethreadid FROM subscribethread WHERE userid=$userinfo[userid] AND threadid=$threadinfo[threadid]");
$emailchecked=iif($email,"CHECKED","");

Make a new template called 'editpost_postpreview' with the following content:


<table width=100% border=0 cellspacing=1 cellpadding=4>
<TR bgcolor="#6c6081">
<TD valign=middle><smallfont color="#afa3c5"><B>Post Preview:</B></smallfont></TD>
</TR>

<tr bgcolor="#DEDEDE">
<td><normalfont>$previewmessage</normalfont></td>
</tr>
</table>

<br>

then edit your 'editpost' template:

insert the '$postpreview' variable at the appropiate place (look into the 'newthread' template for an example)

and replace:


<INPUT TYPE="Submit" NAME="SUBMIT" ACCESSKEY="S" VALUE="Submit Now">

with:


<INPUT TYPE="Submit" NAME="preview" ACCESSKEY="P" VALUE="Preview">
<INPUT TYPE="Submit" NAME="SUBMIT" ACCESSKEY="S" VALUE="Submit Now">

All done! Enjoy :) Peace
Aaron

The Man
11-08-2002, 06:29 PM
Originally posted (http://www.vbulletin.org/forum/newreply.php?postid=202924&action=showpost) by bira
How to install:

Open private.php

1) First we need to move "newmessage" after "dosend". Highlight the entire section between:



// ############################### start new message ###############################


Until (but not including):



// ############################### start send message ###############################



Cut this entire section (a total of 83 lines in 2.2.1) and paste it right above:



// ############################### start do stuff (move, etc) ###############################


2) Now we need to insert the following code:

a) Find:



$savecopy=iif($savecopy=="yes",1,0);


Right under it insert:



// preview hack
$pmreceipt=iif($pmreceipt=="yes",1,0);
// preview hack


b) Find:



if ($pmquota>0 and $touserinfo[usergroupid] != 6 and $bbuserinfo[usergroupid] != 6) {


Right above it insert:



// preview hack
if ($preview) {
$previewpost=1;
$previewmessage=bbcodeparse($message,0,$allowsmilie);

if ($signature) {
$post['signature'] = bbcodeparse($bbuserinfo['signature'],0,$allowsmilie);
eval("\$post[signature] = \"".gettemplate("postbit_signature")."\";");
$previewmessage.=$post['signature'];
}

eval("\$postpreview=\"".gettemplate("priv_sendpreview")."\";");

$parseurlchecked=iif($parseurl,"checked","");
$pmreceiptchecked=iif($pmreceipt,"checked","");
$savecopychecked=iif($savecopy,"checked","");
$signaturechecked=iif($signature,"checked","");
$previewchecked=0;

$title = htmlspecialchars($title);

$privatemessageid = $prevmessageid;
$forward;
$subject = $title;
$privmessage = $message;
$action="newmessage";
} else {
// preview hack


c) Find:



} #end dosend


Right above it insert:



} // preview hack


d) Find:



//show new message form


Right under it insert:



// preview hack
if (!$pagetext) {
// parse message for html if previewing
$message = htmlspecialchars($message); // Without this, a </textarea> in the message breaks the form on preview
}
// preview hack


e) Find:



if ($bbuserinfo[userid]!=0 and !$previewpost and $bbuserinfo[signature]!="") {
$signaturechecked="CHECKED";
}


Right under it insert:



// preview hack
if (!isset($parseurl)) {
$parseurlchecked="CHECKED";
}

if (!isset($savecopy)) {
$savecopychecked="CHECKED";
}

if (!isset($pmreceipt)) {
$pmreceiptchecked="CHECKED";
}
// preview hack


f) Find:



// /enhanced
eval("dooutput(\"".gettemplate("priv_sendprivmsg")."\");");


Right above it insert:



// preview hack
if (!isset($privmessage)) {
$privmessage = $message[message];
}
// preview hack



g) Find:



// enhanced
$receipt=iif($pmreceipt=="yes",1,0);
// /enhanced


And replace it with (the code to remove is marked in red):



// enhanced
$receipt=iif($pmreceipt,1,0);
// /enhanced



Save private.php and upload to server.


In the Administration control panel -> Templates

1) ADD template priv_sendpreview and insert to it:



<br>

<table cellpadding="0" cellspacing="0" border="0" bgcolor="#555576" width="100%" align="center"><tr><td>
<table cellpadding="4" cellspacing="1" border="0" width="100%">
<tr>
<td bgcolor="#8080A6"><smallfont color="#EEEEFF"><b>Message Preview:</b></smallfont></td>
</tr>
<tr>
<td bgcolor="#F1F1F1"><normalfont>$previewmessage</normalfont></td>
</tr>
</table>
</td></tr></table>


(you may edit this to your liking).

2) Open template priv_sendprivmsg

a) place $postpreview where you want the message preview to appear (normally would be under $cpnav).

b) Find:



<textarea name="message" rows="20" cols="$textareacols" wrap="virtual" tabindex="3">$message[message]</textarea>


And replace it with (change marked in red):



<textarea name="message" rows="20" cols="$textareacols" wrap="virtual" tabindex="3"> $privmessage</textarea>


c) Find:



<input type="checkbox" name="parseurl" value="yes" checked>


And replace it with (change marked in red):



<input type="checkbox" name="parseurl" value="yes" $parseurlchecked>


d) Find:



<input type="checkbox" name="savecopy" value="yes" checked>


And replace it with (change marked in red):



<input type="checkbox" name="savecopy" value="yes" $savecopychecked>


e) Find:



<input type="submit" class="bginput" name="submit" value="Send Message" accesskey="s" tabindex="4">


And replace it with (change marked in red):



<input type="submit" class="bginput" name="submit" value="Send Message" accesskey="s" tabindex="4">
<input type="submit" class="bginput" name="preview" value="Preview Message" accesskey="p" tabindex="4">



3) Open template priv_requestreceipt

Find:



<input type="checkbox" name="pmreceipt" value="yes" checked>


And replace it with (change marked in red):



<input type="checkbox" name="pmreceipt" value="yes" $pmreceiptchecked>


That's it!

Comments and additions welcome.

Cheers,

Bira Apologies for triple-posting, but table stretching is nasty, so I wanted it to happen as little as possible. You understand, I trust.

<s>You may need to quote my messages to get certain sections to display properly.</s> Fixed, I hope.

Peace
Aaron

Big Ogre Umaro
11-09-2002, 01:19 AM
attaching TXT files might have been the way to go. :aimwink:

The Man
11-09-2002, 01:37 AM
<font color=38bcee>
Originally posted by Big Ogre Umaro
attaching TXT files might have been the way to go. :aimwink: Yeah. GJ me. :aimwink: I went and replaced every &lt; with &amp;lt; though, so the HTML will display as intended. :aimsmile:

Now hopefully someone'll get around to installing these. :aimgrin:

Peace
Aaron <font size=2>

Citizen Bleys
11-09-2002, 02:37 PM
Somebody send me a PM sometime Monday night; I'll be too busy to install anything before then, and I don't want to forget.

Thanks in advance.

The Man
11-12-2002, 09:27 PM
Yay, it's so... beautiful! The only problems are: <ol><li style="font-size: '100%';">The preview PM thingy uses the wrong colours; the background is white, which I don't think is what we want.</li><li style="font-size: '100%';">A buncha extra line breaks after the edit thingy now. This is mostly an aesthetic thing; it doesn't matter that much, but you might want to fix it anyway.</li><li style="font-size: '100%';">Unfortunately, the backup messages thing reads HTML in messages as HTML rather than converting it to text. It's no big deal, though; it's not that important. A bigger problem is that line breaks get lost, but oh well.</li></ol>At any rate, life at EoFF just got much easier. Thank you muchly. <3

Peace
Aaron

Citizen Bleys
11-12-2002, 10:04 PM
I installed those hacks as per the instructions.

Problem is, the hacks, as instructed, used a bunch of hardcoded colors that match vBulletin's color scheme, instead of the variables ({firstaltcolor}, etc), so it doesn't automatically match the board.

We're probably going to have to get rid of the preview edit, though, since it's not working properly (it submits changes to the database when you press "preview", so if you want to go back to your original message, you're SOL. Plus, people can view and reply to a message you're supposedly "previewing"

It's a bad hack.

Dr Unne
11-13-2002, 12:10 AM
<i>It's a bad hack.</i> --Bleys

Slightly reworded: Hacks are bad. *nod*

Citizen Bleys
11-13-2002, 01:31 PM
Dunno, I like our shiny "Administrator", "Cid's Knight" and "Recognized Member" titles :D

Dr Unne
11-13-2002, 05:14 PM
Fine. Hacks that aren't written by Bleys are bad.

Citizen Bleys
11-13-2002, 05:24 PM
Raf wrote that hack :p

Scottie
11-13-2002, 05:49 PM
Poor Unne is gonna go postal on you.

Spatvark
11-13-2002, 05:51 PM
Hacks that aren't written by current EoFF staff are bad.

So, that dumps ACMLM out on his arse but to be fair, some of his hacks were truly terrible as well =P