View Single Post
  #4  
Old 06-08-2003, 02:50 PM
MetroSports82's Avatar
MetroSports82 MetroSports82 is offline
 
Join Date: Nov 2002
Location: NJ
Posts: 89
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok, tell ya what.. i'm gonna try this again, even thought i came up flat out my face the first time. i'll let you know if i get anything to work properly, with the correct functions. in the meantime, this is the block of code that i will be working on, to see what needs to be tweaked around, to get this feature working.

- editpost.php -
PHP Code:
// ############################### start update post ###############################
if ($HTTP_POST_VARS['action']=="updatepost") {

  
// check for message
  
if ($message=="") {
    eval(
"standarderror(\"".gettemplate("error_nosubject")."\");");
    exit;
  }

  
// decode check boxes
  
$parseurl=iif($parseurl=="yes",1,0);
  
$email=iif($email=="yes",1,0);
  
$allowsmilie=iif($disablesmilies=="yes",0,1);
  
$signature=iif($signature=="yes",1,0);

  
$editedbysql="";
  if (
$showeditedby and $postinfo[dateline]<(time()-($noeditedbytime*60)) and !($getperms[ismoderator] and !$showeditedbyadmin)) {
    
$editedbysql=",edituserid='$bbuserinfo[userid]',editdate='".time()."'";
  }

  
// check max images
  
if ($maximages!=0) {
    
$parsedmessage=bbcodeparse($message,$threadinfo['forumid'],$allowsmilie);
    if (
countchar($parsedmessage,"<img")>$maximages) {
      eval(
"standarderror(\"".gettemplate("error_toomanyimages")."\");");
      exit;
    }
  }

  if (!isset(
$iconid) or $iconid=="") {
    
$iconid=0;
  }
  
$iconid=intval($iconid);

  if (
$parseurl) {
    
$message=parseurl($message);
  }

  
$attachmentsql="";
  if (
$postinfo[attachmentid]!=0) {
    
// check attachment status
    // keep, delete, update
    
if (trim($attachmentaction)=="delete") {
      
$attachmentsql=",attachmentid=0";
      
$DB_site->query("DELETE FROM attachment WHERE attachmentid=$postinfo[attachmentid]");
      
updatethreadcount($threadinfo[threadid]);
    }
    if (
trim($attachmentaction)=="new") {
            
// sort attachement
            
if (is_array($HTTP_POST_FILES)) {
                
$attachment $HTTP_POST_FILES['attachment']['tmp_name'];
                
$attachment_name $HTTP_POST_FILES['attachment']['name'];
                
$attachment_size $HTTP_POST_FILES['attachment']['size'];
            }
            if (
trim($attachment)!="none" and trim($attachment)!="" and trim($attachment_name)!="") {
                
$attachmentid=acceptupload($foruminfo[moderateattach]);
              
$attachmentsql=",attachmentid='$attachmentid'";
              
$DB_site->query("DELETE FROM attachment WHERE attachmentid=$postinfo[attachmentid]");
            }
    }
  }

  
// remove sessionhash from urls:
  
$message stripsession($message);

  
$title=censortext($title);
  
$message=censortext($message);

  if (
strlen($message)>$postmaxchars and $postmaxchars!=0) {
    eval(
"standarderror(\"".gettemplate("error_toolong")."\");");
  }

  
// find out if first post
  
$getpost=$DB_site->query_first("SELECT postid FROM post WHERE threadid=$threadinfo[threadid] ORDER BY dateline LIMIT 1");
  if (
$getpost[postid]==$postid) {
    
$isfirst=1;
  } else {
    
$isfirst=0;
  }
  if (
$isfirst and $title!="" and $postinfo[dateline]+$editthreadtitlelimit*60>time()) {
    
$DB_site->query("UPDATE thread SET title='".addslashes(htmlspecialchars($title))."', iconid=".intval($iconid)." WHERE threadid=$threadinfo[threadid]");
    
//$title="";
  
}

  if (
$email) {
    if (!
$checkid=$DB_site->query_first("SELECT subscribethreadid FROM subscribethread WHERE userid=$postinfo[userid] AND threadid=$threadinfo[threadid]")) {
      
$DB_site->query("INSERT INTO subscribethread (subscribethreadid,userid,threadid) VALUES (NULL,$postinfo[userid],$threadinfo[threadid])");
    } 
// else : already subscribed, so no need to do that again
  
} else {
    if (
$checkid=$DB_site->query_first("SELECT subscribethreadid FROM subscribethread WHERE userid=$postinfo[userid] AND threadid=$threadinfo[threadid]")) {
      
$DB_site->query("DELETE FROM subscribethread WHERE userid=$postinfo[userid] AND threadid=$threadinfo[threadid]");
    } 
// else : already unsubscribed, so no need to unsubscribe
  
}

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

  eval(
"standardredirect(\"".gettemplate("redirect_editthanks")."\",\"showthread.php?s=$session[sessionhash]&postid=$postid#post$postid\");");
}

if (
$action=="deletepost") {
  if (
$deletepost=="yes") {
    
//get first post in thread
    
$getfirst=$DB_site->query_first("SELECT postid,dateline FROM post WHERE threadid='$threadid' ORDER BY dateline LIMIT 1");
    if (
$getfirst[postid]==$postid) {
      
// delete thread
      
if ($getperms[candeletethread]) {
        
deletethread($threadinfo[threadid],$foruminfo[countposts]);
        
updateforumcount($threadinfo[forumid]);
        eval(
"standardredirect(\"".gettemplate("redirect_deletethread")."\",\"forumdisplay.php?s=$session[sessionhash]&forumid=$threadinfo[forumid]\");");
      } else {
        
show_nopermission();
      }
    } else {
      
//delete just this post
      
$foruminfo=getforuminfo($threadinfo[forumid]);
      
deletepost($postid,$foruminfo[countposts],$threadinfo[threadid]);

      
updatethreadcount($threadinfo[threadid]);
      
updateforumcount($threadinfo[forumid]);

     eval(
"standardredirect(\"".gettemplate("redirect_deletepost")."\",\"showthread.php?s=$session[sessionhash]&threadid=$threadinfo[threadid]\");");
    }
  } else {
    eval(
"standardredirect(\"".gettemplate("redirect_nodelete")."\",\"showthread.php?s=$session[sessionhash]&postid=$postid#post$postid\");");
  }

hopefully for me anyway, the 2nd time around will be a charm. though i'm very pesimistic.. :disappointed:

Metro.
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01235 seconds
  • Memory Usage 1,884KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete