public function comment() { if (!isMobile()) { if (IS_POST) { if (empty($_POST['content'])) { $this->error('请输入评论内容。'); } $project_id = $_POST['project_id']; $user_id = is_login(); $reply_id = $_POST['reply_id']; $comment = array('project_id' => $project_id, 'comment_user' => $user_id, 'content' => $_POST['content'], 'reply_id' => $reply_id, 'create_time' => NOW_TIME, 'create_id' => $user_id, 'update_time' => NOW_TIME, 'update_id' => $user_id, 'dynamicid' => I('dynamicid')); $id = M('InfoComment')->add($comment); /* $proj=M('Product')->where('id ='.$project_id)->field('name, uid')->find(); $ulink = '<a href="'.U('MCenter/profile?id='.$user_id).'">'. get_membername($user_id).'</a>'; $plink = '<a href="'.U('Product/viewdetail?pid='.$project_id).'">《'. $proj['name'].'》</a>'; if ($user_id != $proj['uid']) { $content = $ulink . '评论了您的'. $plink . '项目'; D('Message')->send(0,$proj['uid'],'', $content, 3); } */ if ($reply_id) { $rep = M('InfoComment')->where('id=' . $reply_id)->getField('comment_user'); /* if ($rep != $user_id && $rep != $proj['uid'] && !$rep) { $content = $ulink . '回复了您对'. $plink . '项目的评论'; D('Message')->send(0,$rep,'', $content, 3); } */ } $comment['id'] = $id; $comment['comment_user'] = $user_id; $comment['user_face'] = get_memberface($user_id); $comment['date'] = change_date($comment['create_time']); $comment['status'] = 1; $comment['user_name'] = get_membername($user_id); $comment['old_user'] = $_POST['old_user']; $comment['old_content'] = $_POST['old_content']; $comment['status'] = 1; $this->ajaxReturn($comment); } } else { $project_id = $_POST['project_id']; $user_id = is_login(); $reply_id = $_POST['reply_id']; $comment = array('project_id' => $project_id, 'comment_user' => $user_id, 'content' => $_POST['content'], 'reply_id' => $reply_id, 'create_time' => NOW_TIME, 'create_id' => $user_id, 'update_time' => NOW_TIME, 'update_id' => $user_id, 'dynamicid' => I('dynamicid')); $id = M('InfoComment')->add($comment); /* $proj=M('Product')->where('id ='.$project_id)->field('name, uid')->find(); $ulink = '<a href="'.U('MCenter/profile?id='.$user_id).'">'. get_membername($user_id).'</a>'; $plink = '<a href="'.U('Product/viewdetail?pid='.$project_id).'">《'. $proj['name'].'》</a>'; if ($user_id != $proj['uid']) { $content = $ulink . '评论了您的'. $plink . '项目'; D('Message')->send(0,$proj['uid'],'', $content, 3); } */ if ($reply_id) { $rep = M('InfoComment')->where('id=' . $reply_id)->getField('comment_user'); /* if ($rep != $user_id && $rep != $proj['uid'] && !$rep) { $content = $ulink . '回复了您对'. $plink . '项目的评论'; D('Message')->send(0,$rep,'', $content, 3); } */ } $comment['id'] = $id; $comment['comment_user'] = $user_id; $comment['user_face'] = get_memberface($user_id); $comment['date'] = change_date($comment['create_time']); $comment['status'] = 1; $comment['user_name'] = get_membername($user_id); $comment['old_user'] = $_POST['old_user']; $comment['old_content'] = $_POST['old_content']; $this->ajaxReturn($comment); } }
function aff_mail($servr, $user, $passwd, $folder, $mail, $verbose, $lang, $sort, $sortdir) { $mailhost = $servr; require 'conf.php'; require 'check_lang.php'; global $attach_tab; // GLOBAL $PHP_SELF; $glob_body = ''; $subject = $from = $to = $cc = ''; if (setlocale(LC_TIME, $lang_locale) != $lang_locale) { $default_date_format = $no_locale_date_format; } $current_date = strftime($default_date_format, time()); $pop = @imap_open('{' . $mailhost . '}' . $folder, $user, $passwd); // Finding the next and previous message number $sorted = imap_sort($pop, $sort, $sortdir); for ($i = 0; $i < sizeof($sorted); $i++) { if ($mail == $sorted[$i]) { $prev_msg = $sorted[$i - 1]; $next_msg = $sorted[$i + 1]; break; } } // END finding the next and previous message number $num_messages = @imap_num_msg($pop); $ref_contenu_message = @imap_header($pop, $mail); $struct_msg = @imap_fetchstructure($pop, $mail); if (sizeof($struct_msg->parts) > 0) { GetPart($struct_msg, NULL, $display_rfc822); } else { GetSinglePart($struct_msg, htmlspecialchars(imap_fetchheader($pop, $mail)), @imap_body($pop, $mail)); } if ($verbose == 1 && $use_verbose == 1) { $header = htmlspecialchars(imap_fetchheader($pop, $mail)); } else { $header = ''; } $tmp = array_pop($attach_tab); if (preg_match('/text/html/i', $tmp['mime']) || preg_match('/text/plain/i', $tmp['mime'])) { if ($tmp['transfer'] == 'QUOTED-PRINTABLE') { $glob_body = imap_qprint(imap_fetchbody($pop, $mail, $tmp['number'])); } elseif ($tmp['transfer'] == 'BASE64') { $glob_body = base64_decode(imap_fetchbody($pop, $mail, $tmp['number'])); } else { $glob_body = imap_fetchbody($pop, $mail, $tmp['number']); } $glob_body = remove_stuff($glob_body, $lang, $tmp['mime']); } else { array_push($attach_tab, $tmp); } @imap_close($pop); if ($struct_msg->subtype != 'ALTERNATIVE' && $struct_msg->subtype != 'RELATED') { switch (sizeof($attach_tab)) { case 0: $link_att = ''; break; case 1: $link_att = '<tr><td align="right" valign="top" class="mail">' . $html_att . '</td><td bgcolor="' . $glob_theme->mail_properties . '" class="mail">' . link_att($mailhost, $mail, $attach_tab, $display_part_no) . '</td></tr>'; break; default: $link_att = '<tr><td align="right" valign="top" class="mail">' . $html_atts . '</td><td bgcolor="' . $glob_theme->mail_properties . '" class="mail">' . link_att($mailhost, $mail, $attach_tab, $display_part_no) . '</td></tr>'; break; } } $subject_array = imap_mime_header_decode($ref_contenu_message->subject); for ($j = 0; $j < count($subject_array); $j++) { $subject .= $subject_array[$j]->text; } $from_array = imap_mime_header_decode($ref_contenu_message->fromaddress); for ($j = 0; $j < count($from_array); $j++) { $from .= $from_array[$j]->text; } $to_array = imap_mime_header_decode($ref_contenu_message->toaddress); for ($j = 0; $j < count($to_array); $j++) { $to .= $to_array[$j]->text; } $cc_array = imap_mime_header_decode($ref_contenu_message->ccaddress); for ($j = 0; $j < count($cc_array); $j++) { $cc .= $cc_array[$j]->text; } $content = array('from' => htmlspecialchars($from), 'to' => htmlspecialchars($to), 'cc' => htmlspecialchars($cc), 'subject' => htmlspecialchars($subject), 'date' => change_date(chop($ref_contenu_message->udate), $lang), 'att' => $link_att, 'body' => $glob_body, 'body_mime' => $tmp['mime'], 'body_transfer' => $tmp['transfer'], 'header' => $header, 'verbose' => $verbose, 'prev' => $prev_msg, 'next' => $next_msg); return $content; }