Results 1 to 14 of 14

Thread: Hi.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    pirate heartbreaker The Man's Avatar
    Join Date
    Mar 2002
    Location
    Sarasota, FL
    Posts
    10,946

    Default Preview Edit

    Originally posted 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:

    PHP Code:
    if (!isset($action) or $action=="") {
      
    $action="editpost";

    insert:

    PHP Code:
    if($preview AND $action="updatepost")
        
    $action "editpost"
    after:

    PHP Code:
    if ($action=="editpost") {

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

    PHP Code:
      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:

    PHP Code:
     $postinfo[message]=htmlspecialchars($postinfo[pagetext]); 
    with:

    PHP Code:
    //$postinfo[message]=htmlspecialchars($postinfo[pagetext]); 
    replace:

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

    PHP Code:
       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:

    Code:
     <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:

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

    Code:
    <INPUT TYPE="Submit" NAME="preview" ACCESSKEY="P" VALUE="Preview">
    <INPUT TYPE="Submit" NAME="SUBMIT" ACCESSKEY="S" VALUE="Submit Now">
    All done! Enjoy
    Peace
    Aaron
    Last edited by The Man; 11-12-2002 at 09:23 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •