post.php.t

来自「eGroupWare is a multi-user, web-based gr」· T 代码 · 共 628 行 · 第 1/2 页

T
628
字号
		}		if (!empty($_POST['submitted']) && !isset($_POST['spell']) && !isset($_POST['preview'])) {			$_POST['btn_submit'] = 1;		}		if (!($usr->users_opt & 1048576) && isset($_POST['btn_submit']) && $frm->forum_opt & 4 && (!isset($_POST['frm_passwd']) || $frm->post_passwd != $_POST['frm_passwd'])) {			set_err('password', '{TEMPLATE: post_err_passwd}');		}		/* submit processing */		if (isset($_POST['btn_submit']) && !check_post_form()) {			$msg_post = new fud_msg_edit;			/* Process Message Data */			$msg_post->poster_id = _uid;			$msg_post->poll_id = $pl_id;			$msg_post->subject = $msg_subject;			$msg_post->body = $msg_body;			$msg_post->icon = (isset($_POST['msg_icon']) && basename($_POST['msg_icon']) == $_POST['msg_icon'] && @file_exists($WWW_ROOT_DISK.'images/message_icons/'.$_POST['msg_icon'])) ? $_POST['msg_icon'] : '';		 	$msg_post->msg_opt =  $msg_smiley_disabled ? 2 : 0;		 	$msg_post->msg_opt |= $msg_show_sig ? 1 : 0;		 	$msg_post->attach_cnt = (int) $attach_cnt;			$msg_post->body = apply_custom_replace($msg_post->body);			if ($frm->forum_opt & 16) {				$msg_post->body = tags_to_html($msg_post->body, $perms & 32768);			} else if ($frm->forum_opt & 8) {				$msg_post->body = nl2br(htmlspecialchars($msg_post->body));			}			if ($frm->forum_opt & 24) {				char_fix($msg_post->body);			}	 		if ($perms & 16384 && !($msg_post->msg_opt & 2)) {	 			$msg_post->body = smiley_to_post($msg_post->body);	 		}			fud_wordwrap($msg_post->body);			$msg_post->subject = htmlspecialchars(apply_custom_replace($msg_post->subject));			char_fix($msg_post->subject);		 	/* chose to create thread OR add message OR update message */		 	if (!$th_id) {		 		$create_thread = 1;		 		$msg_post->add($frm->id, $frm->message_threshold, $frm->forum_opt, ($perms & (64|4096)), false);		 	} else if ($th_id && !$msg_id) {				$msg_post->thread_id = $th_id;		 		$msg_post->add_reply($reply_to, $th_id, ($perms & (64|4096)), false);			} else if ($msg_id) {				$msg_post->id = $msg_id;				$msg_post->thread_id = $th_id;				$msg_post->post_stamp = $msg->post_stamp;				$msg_post->sync(_uid, $frm->id, $frm->message_threshold, ($perms & (64|4096)));				/* log moderator edit */			 	if (_uid && _uid != $msg->poster_id) {			 		logaction($usr->id, 'MSGEDIT', $msg_post->id);			 	}			} else {				std_error('systemerr');			}			/* write file attachments */			if ($perms & 256 && isset($attach_list)) {				attach_finalize($attach_list, $msg_post->id);			}			if (!$msg_id && (!($frm->forum_opt & 2) || $MOD)) {				$msg_post->approve($msg_post->id, true);			}			if (_uid && !$msg_id) {				/* deal with notifications */	 			if (isset($_POST['msg_poster_notif'])) {	 				thread_notify_add(_uid, $msg_post->thread_id);	 			} else {	 				thread_notify_del(_uid, $msg_post->thread_id);	 			}				/* register a view, so the forum marked as read */				if (isset($frm)) {					user_register_forum_view($frm->id);				}			}			/* where to redirect, to the treeview or the flat view and consider what to do for a moderated forum */			if ($frm->forum_opt & 2 && !$MOD) {				if ($FUD_OPT_2 & 262144) {					$modl = array();					$c = uq('SELECT u.email FROM {SQL_TABLE_PREFIX}mod mm INNER JOIN {SQL_TABLE_PREFIX}users u ON u.id=mm.user_id WHERE mm.forum_id='.$frm->id);					while ($r = db_rowarr($c)) {						$modl[] = $r[0];					}					if ($modl) {						send_email($NOTIFY_FROM, $modl, '{TEMPLATE: post_mod_msg_notify_title}', '{TEMPLATE: post_mod_msg_notify_msg}', '');					}				}				$data = file_get_contents($INCLUDE.'theme/'.$usr->theme_name.'/usercp.inc');				$s = strpos($data, '<?php') + 5;				eval(substr($data, $s, (strrpos($data, '?>') - $s)));				?>				{TEMPLATE: moderated_forum_post}				<?php				exit;			} else {				$t = d_thread_view;				if ($usr->returnto) {					if (!strncmp('t=selmsg', $usr->returnto, 8) || !strncmp('/sel/', $usr->returnto, 5)) {						check_return($usr->returnto);					}					if (preg_match('!t=(tree|msg)!', $usr->returnto, $tmp)) {						$t = $tmp[1];					}				}				/* redirect the user to their message */				header('Location: {ROOT}?t='.$t.'&goto='.$msg_post->id.'&'._rsidl);				exit;			}		} /* Form submitted and user redirected to own message */	} /* $prevloaded is SET, this form has been submitted */	if ($reply_to || $th_id && !$msg_id) {		ses_update_status($usr->sid, '{TEMPLATE: post_reply_update}', $frm->id, 0);	} else if ($msg_id) {		ses_update_status($usr->sid, '{TEMPLATE: post_reply_update}', $frm->id, 0);	} else  {		ses_update_status($usr->sid, '{TEMPLATE: post_topic_update}', $frm->id, 0);	}	if (isset($_POST['spell'])) {		$GLOBALS['MINIMSG_OPT']['DISABLED'] = true;	}/*{POST_HTML_PHP}*/	if (!$th_id) {		$label = '{TEMPLATE: create_thread}';	} else if ($msg_id) {		$label = '{TEMPLATE: edit_message}';	} else {		$label = '{TEMPLATE: submit_reply}';	}	$spell_check_button = ($FUD_OPT_1 & 2097152 && extension_loaded('pspell') && $usr->pspell_lang) ? '{TEMPLATE: spell_check_button}' : '';	if (isset($_POST['preview']) || isset($_POST['spell'])) {		$text = apply_custom_replace($msg_body);		$text_s = apply_custom_replace($msg_subject);		if ($frm->forum_opt & 16) {			$text = tags_to_html($text, $perms & 32768);		} else if ($frm->forum_opt & 8) {			$text = nl2br(htmlspecialchars($text));		}		if ($frm->forum_opt & 24) {			char_fix($text);		}		if ($perms & 16384 && !$msg_smiley_disabled) {			$text = smiley_to_post($text);		}		$text_s = htmlspecialchars($text_s);		char_fix($text_s);		$spell = $spell_check_button && isset($_POST['spell']);		if ($spell && $text) {			$text = check_data_spell($text, 'body', $usr->pspell_lang);		}		fud_wordwrap($text);		if ($spell && empty($no_spell_subject) && $text_s) {			$subj = check_data_spell($text_s, 'subject', $usr->pspell_lang);		} else {			$subj = $text_s;		}		if ($FUD_OPT_1 & 32768 && $msg_show_sig) {			if ($msg_id && $msg->poster_id && $msg->poster_id != _uid && !$reply_to) {				$sig = q_singleval('SELECT sig FROM {SQL_TABLE_PREFIX}users WHERE id='.$msg->poster_id);			} else {				$sig = $usr->sig;			}			$signature = $sig ? '{TEMPLATE: signature}' : '';		} else {			$signature = '';		}		$apply_spell_changes = $spell ? '{TEMPLATE: apply_spell_changes}' : '';		$preview_message = '{TEMPLATE: preview_message}';	} else {		$preview_message = '';	}	$post_error = is_post_error() ? '{TEMPLATE: post_error}' : '';	$loged_in_user = _uid ? '{TEMPLATE: loged_in_user}' : '';	/* handle password protected forums */	if ($frm->forum_opt & 4 && !$MOD) {		$pass_err = get_err('password');		$post_password = '{TEMPLATE: post_password}';	} else {		$post_password = '';	}	$msg_subect_err = get_err('msg_subject');	if (!isset($msg_subject)) {		$msg_subject = '';	}	/* handle polls */	$poll = '';	if ($perms & 128) {		if (!$pl_id) {			$poll = '{TEMPLATE: create_poll}';		} else if (($poll = db_saq('SELECT id, name FROM {SQL_TABLE_PREFIX}poll WHERE id='.$pl_id))) {			$poll = '{TEMPLATE: edit_poll}';		}	}	/* sticky/announcment controls */	if ($perms & 64 && (!isset($thr) || ($thr->root_msg_id == $msg->id && !$reply_to))) {		if (!isset($_POST['prev_loaded'])) {			if (!isset($thr)) {				$thr_ordertype = $thr_orderexpiry = '';			} else {				$thr_ordertype = ($thr->thread_opt|1) ^ 1;				$thr_orderexpiry = $thr->orderexpiry;			}		} else {			$thr_ordertype = isset($_POST['thr_ordertype']) ? (int) $_POST['thr_ordertype'] : '';			$thr_orderexpiry = isset($_POST['thr_orderexpiry']) ? (int) $_POST['thr_orderexpiry'] : '';		}		$thread_type_select = tmpl_draw_select_opt("0\n4\n2", "{TEMPLATE: post_normal}\n{TEMPLATE: post_sticky}\n{TEMPLATE: post_annoncement}", $thr_ordertype, '{TEMPLATE: sel_opt}', '{TEMPLATE: sel_opt_selected}');		$thread_expiry_select = tmpl_draw_select_opt("1000000000\n3600\n7200\n14400\n28800\n57600\n86400\n172800\n345600\n604800\n1209600\n2635200\n5270400\n10540800\n938131200", "{TEMPLATE: th_expr_never}\n{TEMPLATE: th_expr_one_hr}\n{TEMPLATE: th_expr_three_hr}\n{TEMPLATE: th_expr_four_hr}\n{TEMPLATE: th_expr_eight_hr}\n{TEMPLATE: th_expr_sixteen_hr}\n{TEMPLATE: th_expr_one_day}\n{TEMPLATE: th_expr_two_day}\n{TEMPLATE: th_expr_four_day}\n{TEMPLATE: th_expr_one_week}\n{TEMPLATE: th_expr_two_week}\n{TEMPLATE: th_expr_one_month}\n{TEMPLATE: th_expr_two_month}\n{TEMPLATE: th_expr_four_month}\n{TEMPLATE: th_expr_one_year}", $thr_orderexpiry, '{TEMPLATE: sel_opt}', '{TEMPLATE: sel_opt_selected}');		$admin_options = '{TEMPLATE: admin_options}';	} else {		$admin_options = '';	}	/* thread locking controls */	if ($perms & 4096) {		if (!isset($_POST['prev_loaded']) && isset($thr)) {			$thr_locked_checked = $thr->thread_opt & 1 ? ' checked' : '';		} else if (isset($_POST['prev_loaded'])) {			$thr_locked_checked = isset($_POST['thr_locked']) ? ' checked' : '';		} else {			$thr_locked_checked = '';		}		$mod_post_opts = '{TEMPLATE: mod_post_opts}';	} else {		$mod_post_opts = '';	}	/* message icon selection */	$post_icons = draw_post_icons((isset($_POST['msg_icon']) ? $_POST['msg_icon'] : ''));	/* tool bar icons */	$fud_code_icons = $frm->forum_opt & 16 ? '{TEMPLATE: fud_code_icons}' : '';	$post_options = tmpl_post_options($frm->forum_opt, $perms);	$message_err = get_err('msg_body', 1);	$msg_body = isset($msg_body) ? htmlspecialchars(str_replace("\r", '', $msg_body)) : '';	if (!empty($msg_subject)) {		$msg_subject = htmlspecialchars($msg_subject);		char_fix($msg_subject);	}	char_fix($msg_body);	$pivate = '';	/* handle file attachments */	if ($perms & 256) {		if ($frm->forum_opt & 32 && $MOD) {			$frm->max_attach_size = (int) ini_get('upload_max_filesize');			$t = str_replace($frm->max_attach_size, '', ini_get('upload_max_filesize'));			if ($t == 'M' || $t == 'm') {				$frm->max_attach_size *= 1024;			}			$frm->max_file_attachments = 100;		}		$file_attachments = draw_post_attachments((isset($attach_list) ? $attach_list : ''), $frm->max_attach_size, $frm->max_file_attachments, $attach_control_error, '', $msg_id);	} else {		$file_attachments = '';	}	if (_uid) {		$msg_poster_notif_check = $msg_poster_notif ? ' checked' : '';		$msg_show_sig_check = $msg_show_sig ? ' checked' : '';		$reg_user_options = '{TEMPLATE: reg_user_options}';	} else {		$reg_user_options = '';	}	/* handle smilies */	if ($perms & 16384) {		$msg_smiley_disabled_check = !empty($msg_smiley_disabled) ? ' checked' : '';		$disable_smileys = '{TEMPLATE: disable_smileys}';		$post_smilies = draw_post_smiley_cntrl();	} else {		$post_smilies = $disable_smileys = '';	}/*{POST_PAGE_PHP_CODE}*/?>{TEMPLATE: POST_PAGE}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?