コード例 #1
0
ファイル: _class_user.php プロジェクト: bireme/proethos
    /**
     * Liberar Usuario
     * @return Booblean
     */
    function show_user_name()
    {
        /* Parametros default */
        global $hd;
        $sx = '';
        $msg = 'logout';
        $page = 'logout.php';
        $link_usr = '';
        /* Modo Ghost */
        $ghost = $this->user_ghost;
        if (strlen($ghost) > 0) {
            /* Ghost Mode */
            $link_usr = '******' . $ghost . '&dd90=' . checkpost($ghost) . '"
				 				class="user_ghost" 
				 				title="logout ghost mode"
				 				>';
            $sx .= '<TD width="*" align="right"><NOBR>' . $link_usr . $this->user_nome . '</A></TD>' . chr(13) . chr(10);
            //$sx .= '<TD><nobr>&nbsp;&nbsp;</nobr></TD>'.chr(13).chr(10);
        } else {
            /* Normal Mode */
            $sx .= '	<TD width="*" align="right"><NOBR>' . $this->shortname($this->user_nome) . '</nobr></TD>' . chr(13) . chr(10);
            $sx .= '	<TD><nobr>&nbsp;&nbsp;</nobr></TD>' . chr(13) . chr(10);
            $sx .= '	' . $hd->mount_button(msg($msg), $page) . chr(13) . chr(10);
        }
        return $sx;
    }
コード例 #2
0
 function report_002()
 {
     global $cep;
     $sql = "select * from cep_protocolos \n\t\t\t\t\t\twhere cep_tipo = 'PRO'\n\t\t\t\t\t\tand cep_status = 'P'\n\t\t\t\t\t\t\n\t\t\t\t\t\torder by cep_monitoring\t\t\t\t\n\t\t\t\t";
     $rlt = db_query($sql);
     $id = 0;
     $sx = '<table width="100%" class="table_proj">';
     $sx .= '<TR><TH>' . msg('caae');
     $sx .= '<TH>' . msg('protocol_title');
     $sx .= '<TH><nobr>' . msg('monitoring');
     $sx .= '<TH>' . msg('status');
     while ($line = db_read($rlt)) {
         $bgcor = '';
         if ($line['cep_monitoring'] < date("Ymd")) {
             $bgcor = 'style="background-color:#FF8080; " ';
         }
         $id++;
         $link = '<A HREF="protocolo_detalhe_investigator.php?dd0=' . $line['id_cep'] . '&dd90=' . checkpost($line['id_cep']) . '">';
         $sx .= chr(13);
         $sx .= '<TR valign="top">';
         $sx .= '<TD>' . $link;
         $sx .= $line['cep_caae'];
         $sx .= '<TD>' . $link;
         $sx .= $line['cep_titulo'];
         $sx .= '<TD ' . $bgcor . '>' . $link;
         $sx .= stodbr($line['cep_monitoring']);
         $sx .= '<TD>' . $link;
         $sx .= $cep->mostra_status($line['cep_status']);
     }
     $sx .= '</table>';
     return $sx;
 }
コード例 #3
0
 public function index()
 {
     if (!checkpost()) {
         exit('error');
     }
     if (!$GLOBALS['islogin']) {
         exit('{"stat":9, "errno":"未登录", "error":"未登录}');
     }
     $receiver_uid = postvar('uid', 1);
     $msgModel = D('Msg');
     if (!$msgModel->check_link($receiver_uid)) {
         $msgModel->exitError();
     }
     $u = $msgModel->check_contact('uid', 'sex, uid');
     $msgModel->send_1($u['uid'], 0);
     echo '{"stat":9,"error":"打招呼成功","msg":"打招呼成功"}';
 }
コード例 #4
0
ファイル: _class_oms.php プロジェクト: bireme/proethos
    function icone($id = '')
    {
        $sx .= '<div id="xml_oms">';
        $sx .= '<div id="xml_oms_right">';
        $sx .= 'OMS';
        $sx .= '</div>';
        $sx .= '<div id="xml_oms_left">';
        $sx .= 'XML';
        $sx .= '</div>';
        $sx .= '</div>';
        $sx .= '<script>' . chr(13);
        $sx .= '$("#xml_oms").click(function() {
							newxy2(\'oms_xml.php?dd0=' . $id . '&dd90=' . checkpost($id) . '\',600,400);
					});' . chr(13);
        $sx .= '</script>' . chr(13);
        return $sx;
    }
コード例 #5
0
ファイル: WenwenAction.class.php プロジェクト: laiello/qinhan
 public function answer()
 {
     if (!$GLOBALS['islogin']) {
         exit;
     }
     if (!checkpost()) {
         exit;
     }
     $qid = postvar('qid', 1);
     $uid = $GLOBALS['i']['uid'];
     $wenwen_question = M('wenwen_question');
     $wq = $wenwen_question->where("qid={$qid}")->find();
     if (!$wq) {
         exit('not found');
     }
     $answer = M("wenwen_answer");
     $data['qid'] = $qid;
     $data['content'] = postvar('content');
     $data['rsync_tsina'] = postvar('rsync_tsina', 1);
     $data['uid'] = $GLOBALS['i']['uid'];
     $data['username'] = $GLOBALS['i']['username'];
     $date['add_time'] = time();
     $condition['qid'] = $qid;
     $condition['uid'] = $GLOBALS['i']['uid'];
     $a = $answer->where($condition)->find();
     if ($a) {
         $id = $a['id'];
         $answer->where($condition)->save($data);
     } else {
         $id = $answer->where($condition)->add($data);
         $member_field = M('member_field');
         $data1['wenwen_num'] = array('exp', 'wenwen_num+1');
         $member_field->where("uid={$uid}")->save($data1);
         //echo $member_field->getLastSql();
     }
     $body = array('id' => $id, 'qid' => $qid, 'wenwen_question' => $wq['wenwen_question'], 'wenwen_answer' => $data['content']);
     $body_arr[$id] = $body;
     //feed_publish(6, $body_arr);
     $feedModel = D('Feed');
     $feedModel->feed_publish(6, $body_arr);
     //echo $answer->getLastSql();
     echo 0;
 }
コード例 #6
0
 public function other()
 {
     if (checkpost()) {
         $act = getvar('act', array('b', 'c', 'd'));
         $uid = postvar('uid', 1);
         $content = postvar('content');
         if ($act == 'b') {
             $member = M('member');
             $member->where("uid={$uid}")->setField('group_type', 2);
         } elseif ($act == 'c') {
             $photo = M('photo');
             $photo->where("uid={$uid} AND gid=0")->setField('is_pass', 0);
         } elseif ($act == 'd') {
             $msgModel = D('Msg');
             $msgModel->sys_notifi($uid, $content);
         }
         exit(1);
     }
     $this->display();
 }
コード例 #7
0
 private function _load_feed($type = 'more')
 {
     if (!checkpost()) {
         exit;
     }
     $face_size = postvar('face_size', 1);
     $page = postvar('page', 1);
     $is_last = postvar('is_last', 1);
     $last_id = postvar('last_id', 1);
     $this->_assign_feed($face_size, $type, $page, $is_last, $last_id);
     $feed = $this->fetch('feed');
     //if(!$feed) exit();
     $arr = array('errno' => 200, 'more' => $feed, 'page' => $page, 'is_new_dt' => 0);
     if ($type == 'more') {
         $arr['is_last'] = 0;
         $arr['last_id'] = 555484;
         $arr['show_member_tips'] = 0;
         $arr['show_member_tips_ssesion'] = NULL;
     }
     echo json_encode($arr);
 }
コード例 #8
0
ファイル: LinkAction.class.php プロジェクト: laiello/qinhan
 public function forbid()
 {
     if (!$GLOBALS['islogin']) {
         exit;
     }
     if (!checkpost()) {
         exit;
     }
     $forbid_uid = postvar('forbid_uid', 1);
     $data['uid'] = $GLOBALS['i']['uid'];
     $data['forbid_uid'] = $forbid_uid;
     $link = M('link');
     $rs = $link->where($data)->find();
     if ($rs) {
         echo '-2';
     } else {
         $status = postvar('status', array(1, 2));
         $data['status'] = $status;
         $data['add_time'] = time();
         $link->add($data);
         echo $status == 2 ? 1 : 2;
     }
 }
コード例 #9
0
ファイル: DiaryAction.class.php プロジェクト: laiello/qinhan
 public function praise()
 {
     if (!$GLOBALS['islogin']) {
         exit;
     }
     if (!checkpost()) {
         exit;
     }
     $did = postvar('diary_id', 1);
     $type = postvar('type', array(0, 1));
     $diary = M('diary');
     $d = $diary->where("did={$did}")->find();
     if (!$d) {
         exit;
     }
     if (strstr($d['praise_uids'], ",{$GLOBALS['i']['uid']},")) {
         exit('{"errno":500, "msg":"\\u60a8\\u5df2\\u7ecf\\u9001\\u8fc7\\u4e86"}');
     }
     $data['praise_' . $type] = array('exp', "praise_{$type}+1");
     $data['praise_uids'] = rtrim($d['praise_uids'], ',') . ",{$GLOBALS['i']['uid']},";
     $diary->where("did={$did}")->save($data);
     //echo $diary->getLastSql();
     $msgModel = D('Msg');
     //$msgModel->comment($d['uid'], 26, $type, $did);
     $str = "<div class=\"textbg f_6\"><p class=\"word_break\">“写两句”:{$d['content']}</p></div>";
     $classifier = $img = '';
     if ($type == 0) {
         $classifier = $GLOBALS['i']['sex'] == 1 ? '朵' : '片';
         $img = $GLOBALS['i']['sex'] == 1 ? 'ico_diay.gif' : 'ico_diay1.gif';
     } else {
         $classifier = '块';
         $img = 'ico_brick.gif';
     }
     $str .= "<p><a target=\"_blank\" href=\"{$GLOBALS['s']['urlsite']}/{$GLOBALS['i']['uid']}\">{$GLOBALS['i']['username']}</a>给了你一{$classifier}<img src=\"{$GLOBALS['s']['urlstatic']}/img/{$img}\" class=\"ico\"></p>";
     $msgModel->sys_notifi($d['uid'], $str);
     echo '{"errno":200, "msg":""}';
 }
コード例 #10
0
ファイル: post_newreply.php プロジェクト: Kingson4Wu/php_demo
    }
    if ($_G['group']['allowpostattach'] || $_G['group']['allowpostimage']) {
        $attachlist = getattach($pid);
        $attachs = $attachlist['attachs'];
        $imgattachs = $attachlist['imgattachs'];
        unset($attachlist);
    }
    getgpc('infloat') ? include template('forum/post_infloat') : (include template('forum/post'));
} else {
    if ($subject == '' && $message == '' && $thread['special'] != 2) {
        showmessage('post_sm_isnull');
    } elseif ($thread['closed'] && !$_G['forum']['ismoderator']) {
        showmessage('post_thread_closed');
    } elseif ($post_autoclose = checkautoclose($thread)) {
        showmessage($post_autoclose, '', array('autoclose' => $_G['forum']['autoclose']));
    } elseif ($post_invalid = checkpost($subject, $message, $special == 2 && $_G['group']['allowposttrade'])) {
        showmessage($post_invalid, '', array('minpostsize' => $_G['setting']['minpostsize'], 'maxpostsize' => $_G['setting']['maxpostsize']));
    } elseif (checkflood()) {
        showmessage('post_flood_ctrl', '', array('floodctrl' => $_G['setting']['floodctrl']));
    }
    if (!empty($_G['gp_trade']) && $thread['special'] == 2 && $_G['group']['allowposttrade']) {
        $item_price = floatval($_G['gp_item_price']);
        $item_credit = intval($_G['gp_item_credit']);
        if (!trim($_G['gp_item_name'])) {
            showmessage('trade_please_name');
        } elseif ($_G['group']['maxtradeprice'] && $item_price > 0 && ($_G['group']['mintradeprice'] > $item_price || $_G['group']['maxtradeprice'] < $item_price)) {
            showmessage('trade_price_between', '', array('mintradeprice' => $_G['group']['mintradeprice'], 'maxtradeprice' => $_G['group']['maxtradeprice']));
        } elseif ($_G['group']['maxtradeprice'] && $item_credit > 0 && ($_G['group']['mintradeprice'] > $item_credit || $_G['group']['maxtradeprice'] < $item_credit)) {
            showmessage('trade_credit_between', '', array('mintradeprice' => $_G['group']['mintradeprice'], 'maxtradeprice' => $_G['group']['maxtradeprice']));
        } elseif (!$_G['group']['maxtradeprice'] && $item_price > 0 && $_G['group']['mintradeprice'] > $item_price) {
            showmessage('trade_price_more_than', '', array('mintradeprice' => $_G['group']['mintradeprice']));
コード例 #11
0
ファイル: index.php プロジェクト: yszar/linuxwp
<?php

require dirname(__FILE__) . '/../../../../wp-load.php';
$a = checkpost('key');
$b = checkpost('pid');
$c = get_post_permalink($b);
if ($a !== 'like' && !$c && !isInStr($c, 'post_type=post')) {
    print_r(json_encode(array('error' => 1)));
    exit;
}
$d = false;
$e = false;
if (is_user_logged_in()) {
    $f = get_current_user_id();
    $d = get_user_meta($f, 'like-posts', true);
    $d = unserialize($d);
    $e = in_array($b, $d);
}
if (!$d || !$e) {
    if (!$d) {
        $d = array($b);
    } else {
        array_unshift($d, $b);
    }
    upmeta($d);
    $g = (int) get_post_meta($b, $a, true);
    if (!$g) {
        $g = 0;
    }
    update_post_meta($b, $a, $g + 1);
    print_r(json_encode(array('error' => 0, 'like' => 1, 'response' => $g + 1)));
コード例 #12
0
ファイル: submit_13.php プロジェクト: bireme/proethos
 * @access public
 * @version v0.12.22
 * @package Class
 * @subpackage UC0001 - Sumissão de protocolo de pesquisa
 */
require "_class/_class_cep_submit_institution.php";
$inst = new instituicao();
$pag = 3;
echo '<B>' . msg('submit_checklist') . '</B>';
require 'submit_checklist_amendment.php';
echo '<BR>';
$sx = '<span id="create_pdf" class="form_submit">' . msg('create_PDF') . '</span>';
$sx .= '
				<script>
				$("#create_pdf").click(function() {
					window.open(\'submit_amendment_pdf.php?dd0=' . $protocolo . '&dd90=' . checkpost($protocolo . $secu) . '\', \'pdf\', \'create pdf\');
				});
				</script>
				';
echo $sx;
echo '<BR><BR>';
/* Compromisso */
//if (strlen($dd[81]) == 0) { $xok = 0; }
if ($xok == 1) {
    if (strlen($dd[81]) > 0) {
        redirecina('submit_end_monitoreo.php');
    }
    /* Termo */
    require 'submit_pages.php';
    echo '<form action="submit.php">';
    echo '<BR>';
コード例 #13
0
ファイル: MsgAction.class.php プロジェクト: laiello/qinhan
 public function send()
 {
     if (!checkpost()) {
         exit('error');
     }
     if (!$GLOBALS['islogin']) {
         exit('{"stat":9, "errno":"未登录", "error":"未登录}');
     }
     $receiver_uid = postvar('receiver_uid', 1);
     $msgModel = D('Msg');
     if (!$msgModel->check_link($receiver_uid)) {
         $msgModel->exitError();
     }
     $u = $msgModel->check_contact('receiver_uid', 'sex, uid');
     $type = postvar('type', 1);
     $action = 'send_' . $type;
     $id = postvar('related', 1);
     $msgModel->{$action}($u['uid'], $id);
     echo '{"stat":0,"error":"\\u53d1\\u9001\\u6210\\u529f","pay_card":0}';
 }
コード例 #14
0
ファイル: post_editpost.php プロジェクト: kleitz/sports
            if ($option['type'] == 'image') {
                foreach ($imgattachs['used'] as $k => $sortattach) {
                    if ($sortattach['aid'] == $option['value']['aid']) {
                        unset($imgattachs['used'][$k]);
                        break;
                    }
                }
            }
        }
    }
    $imgattachs['unused'] = !$sortid ? $imgattachs['unused'] : '';
    include template('forum/post');
} else {
    $redirecturl = "forum.php?mod=viewthread&tid={$_G['tid']}&page={$_G['gp_page']}&extra={$extra}" . ($vid && $isfirstpost ? "&vid={$vid}" : '') . "#pid{$pid}";
    if (empty($_G['gp_delete'])) {
        if ($post_invalid = checkpost($subject, $message, $isfirstpost && ($special || $sortid))) {
            showmessage($post_invalid, '', array('minpostsize' => $_G['setting']['minpostsize'], 'maxpostsize' => $_G['setting']['maxpostsize']));
        }
        if (!$isorigauthor && !$_G['group']['allowanonymous']) {
            if ($orig['anonymous'] && !$isanonymous) {
                $isanonymous = 0;
                $authoradd = ', author=\'' . addslashes($orig['author']) . '\'';
                $anonymousadd = ', anonymous=\'0\'';
            } else {
                $isanonymous = $orig['anonymous'];
                $authoradd = $anonymousadd = '';
            }
        } else {
            $authoradd = ', author=\'' . ($isanonymous ? '' : addslashes($orig['author'])) . '\'';
            $anonymousadd = ", anonymous='{$isanonymous}'";
        }
コード例 #15
0
ファイル: submit_team.php プロジェクト: bireme/proethos
// Copyright 2013, PAHO. All rights reserved. You can redistribute it and/or modify
// ProEthos under the terms of the ProEthos License as published by PAHO, which
// restricts commercial use of the Software.
//
// ProEthos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
// PARTICULAR PURPOSE. See the ProEthos License for more details.
//
// You should have received a copy of the ProEthos License along with the ProEthos
// Software. If not, see
// https://raw.githubusercontent.com/bireme/proethos/master/LICENSE.txt
echo '<TR>';
echo '<TD class="lt2" colspan=2>';
echo 'Registros';
$ref = 'register_' . $r;
$link = 'submit_team_ajax.php?dd1=' . $protocolo . '&dd2=listar&dd3=' . $autor . '&dd4=' . $campo . '&dd6=' . $ref . '&dd90=' . checkpost($protocol . $campo);
?>
<div id="<?php 
echo $ref;
?>
">
</div>

<script>
	var $tela01 = $.ajax('<?php 
echo $link;
?>
')
		.done(function(data) { $("#<?php 
echo $ref;
?>
コード例 #16
0
ファイル: editpost.inc.php プロジェクト: lilhorse/cocoa
        }
        $attachfind && ($postinfo['message'] = preg_replace($attachfind, $attachreplace, $postinfo['message']));
    }
    if ($special == 2 && $trade['aid'] && !empty($imgattachs['used']) && is_array($imgattachs['used'])) {
        foreach ($imgattachs['used'] as $k => $tradeattach) {
            if ($tradeattach['aid'] == $trade['aid']) {
                unset($imgattachs['used'][$k]);
                break;
            }
        }
    }
    include template('post');
} else {
    $redirecturl = "viewthread.php?tid={$tid}&page={$page}&extra={$extra}" . ($vid && $isfirstpost ? "&vid={$vid}" : '') . "#pid{$pid}";
    if (empty($delete)) {
        if ($post_invalid = checkpost($isfirstpost && $special)) {
            showmessage($post_invalid);
        }
        if (!$isorigauthor && !$allowanonymous) {
            if ($orig['anonymous'] && !$isanonymous) {
                $isanonymous = 0;
                $authoradd = ', author=\'' . addslashes($orig['author']) . '\'';
                $anonymousadd = ', anonymous=\'0\'';
            } else {
                $isanonymous = $orig['anonymous'];
                $authoradd = $anonymousadd = '';
            }
        } else {
            $authoradd = ', author=\'' . ($isanonymous ? '' : addslashes($orig['author'])) . '\'';
            $anonymousadd = ", anonymous='{$isanonymous}'";
        }
コード例 #17
0
ファイル: newreply.inc.php プロジェクト: lilhorse/cocoa
    if ($allowpostattach) {
        $attachlist = getattach();
        $attachs = $attachlist['attachs'];
        $imgattachs = $attachlist['imgattachs'];
        unset($attachlist);
    }
    $infloat ? include template('post_infloat') : (include template('post'));
} else {
    require_once DISCUZ_ROOT . './include/forum.func.php';
    if ($subject == '' && $message == '' && $thread['special'] != 2) {
        showmessage('post_sm_isnull');
    } elseif ($thread['closed'] && !$forum['ismoderator']) {
        showmessage('post_thread_closed');
    } elseif ($post_autoclose = checkautoclose()) {
        showmessage($post_autoclose);
    } elseif ($post_invalid = checkpost($special == 2 && $allowposttrade)) {
        showmessage($post_invalid);
    } elseif (checkflood()) {
        showmessage('post_flood_ctrl');
    }
    if (!empty($trade) && $thread['special'] == 2 && $allowposttrade) {
        $item_price = floatval($item_price);
        $item_credit = intval($item_credit);
        if (!trim($item_name)) {
            showmessage('trade_please_name');
        } elseif ($maxtradeprice && $item_price > 0 && ($mintradeprice > $item_price || $maxtradeprice < $item_price)) {
            showmessage('trade_price_between');
        } elseif ($maxtradeprice && $item_credit > 0 && ($mintradeprice > $item_credit || $maxtradeprice < $item_credit)) {
            showmessage('trade_credit_between');
        } elseif (!$maxtradeprice && $item_price > 0 && $mintradeprice > $item_price) {
            showmessage('trade_price_more_than');
コード例 #18
0
ファイル: protocol_submit.php プロジェクト: bireme/proethos
$submit = new submit();
require '_class/_class_cep_email.php';
$comm = new comunication();
/* recupara ID do projeto */
$ID = strzero($dd[0], 7);
$submit->le($ID);
$doc_tipo = $submit->doc_tipo;
/* Action */
$acao = $dd[5];
if ($acao == 'TO_SUBMIT') {
    $submit->protocolo_to_submit();
    redirecina('submit.php?dd0=' . $dd[0] . '&dd90=' . checkpost($dd[0]));
}
if ($acao == 'TO_AMED') {
    $submit->protocolo_to_submit();
    redirecina('submit_amendment.php?dd0=' . $dd[0] . '&dd90=' . checkpost($dd[0]));
}
echo '<h1>Protocolo: ' . $submit->status_show($submit->doc_status) . '</h1>';
echo $submit->protocolo_mostrar();
$status = trim($submit->doc_status);
echo '<BR>';
require "_ged_config.php";
$ged->protocol = $ID;
echo $ged->filelist();
/*
 * Hidden Other information
 */
if ($acao == 'TO_CANCEL_ASK') {
    $status = '@@';
}
if ($acao == 'TO_CANCEL') {
コード例 #19
0
 * Admin Menu
 * @author Rene Faustino Gabriel Junior  (Analista-Desenvolvedor)
 * @copyright © Pan American Health Organization, 2013. All rights reserved.
 * @access public
 * @version v0.13.46
 * @package ProEthos-Admin
 * @subpackage ghost user
 */
require "cab.php";
/* Admin Common */
$ok = ($perfil->valid('#ADM') or $perfil->valid('#SCR') or $perfil->valid('#COO') or $ss->user_ghost > 0);
if ($ok == 0) {
    redirecina('main.php');
}
/* Valid Submit */
$chk = checkpost($dd[0]);
$ch2 = $dd[90];
if ($chk == $ch2) {
    /* Active Mode Ghost */
    if (strlen($dd[1]) == 0) {
        /* Save original user */
        $ss->set_user_original();
        $ss->le($dd[0]);
        /* Active mode ghost */
        $ss->set_ghost();
        $ss->ghost_user();
        redirecina("main.php");
    }
    /* DesActive Mode Ghost */
    if (strlen($dd[1]) > 0) {
        $ss->reset_user_original();
コード例 #20
0
ファイル: FavAction.class.php プロジェクト: laiello/qinhan
 public function delete_ifav()
 {
     if (!$GLOBALS['islogin']) {
         exit;
     }
     if (!checkpost()) {
         exit;
     }
     $fav_uid = postvar('uid', 1);
     $fav = M("fav");
     $map['uid'] = $GLOBALS['i']['uid'];
     $map['fav_uid'] = $fav_uid;
     $fav->where($map)->delete();
     $map2['uid'] = $fav_uid;
     $map2['fav_uid'] = $GLOBALS['i']['uid'];
     $fav_too = $fav->where($map2)->getField('fav_too');
     if ($fav_too && $fav_too == 1) {
         $fav->where($map2)->setField('fav_too', 0);
     }
     $member_field = M('member_field');
     $data1['fav_in_num'] = array('exp', 'fav_in_num-1');
     $member_field->where("uid={$fav_uid}")->save($data1);
     $data2['fav_out_num'] = array('exp', 'fav_out_num-1');
     //收藏人的uid冗余 start
     $data2['ifav_uids'] = str_replace(",{$fav_uid},", '', $GLOBALS['i']['ifav_uids']);
     //dump($data2['ifav_uids']);
     //收藏人的uid冗余 end
     $member_field->where("uid={$GLOBALS['i']['uid']}")->save($data2);
     echo 1;
 }
コード例 #21
0
ファイル: post_newtrade.php プロジェクト: Kingson4Wu/php_demo
if (!$_G['group']['allowposttrade']) {
    showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
}
if (!$_G['uid'] && !(!$_G['forum']['postperm'] && $_G['group']['allowpost'] || $_G['forum']['postperm'] && forumperm($_G['forum']['postperm']))) {
    showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
} elseif (empty($_G['forum']['allowpost'])) {
    if (!$_G['forum']['postperm'] && !$_G['group']['allowpost']) {
        showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
    } elseif ($_G['forum']['postperm'] && !forumperm($_G['forum']['postperm'])) {
        showmessage('post_forum_newthread_nopermission', NULL);
    }
} elseif ($_G['forum']['allowpost'] == -1) {
    showmessage('post_forum_newthread_nopermission', NULL);
}
checklowerlimit('post');
if ($post_invalid = checkpost($subject, $message, 1)) {
    showmessage($post_invalid, '', array('minpostsize' => $_G['setting']['minpostsize'], 'maxpostsize' => $_G['setting']['maxpostsize']));
}
if (checkflood()) {
    showmessage('post_flood_ctrl', '', array('floodctrl' => $_G['setting']['floodctrl']));
}
$item_price = floatval($_G['gp_item_price']);
$item_credit = intval($_G['gp_item_credit']);
$_G['gp_item_name'] = censor($_G['gp_item_name']);
if (!trim($_G['gp_item_name'])) {
    showmessage('trade_please_name');
} elseif ($_G['group']['maxtradeprice'] && $item_price > 0 && ($_G['group']['mintradeprice'] > $item_price || $_G['group']['maxtradeprice'] < $item_price)) {
    showmessage('trade_price_between', '', array('mintradeprice' => $_G['group']['mintradeprice'], 'maxtradeprice' => $_G['group']['maxtradeprice']));
} elseif ($_G['group']['maxtradeprice'] && $item_credit > 0 && ($_G['group']['mintradeprice'] > $item_credit || $_G['group']['maxtradeprice'] < $item_credit)) {
    showmessage('trade_credit_between', '', array('mintradeprice' => $_G['group']['mintradeprice'], 'maxtradeprice' => $_G['group']['maxtradeprice']));
} elseif (!$_G['group']['maxtradeprice'] && $item_price > 0 && $_G['group']['mintradeprice'] > $item_price) {
コード例 #22
0
 public function editpost($parameters)
 {
     $this->_init_parameters($parameters);
     $isfirstpost = $this->post['first'] ? 1 : 0;
     $isorigauthor = $this->member['uid'] && $this->member['uid'] == $this->post['authorid'];
     $this->param['audit'] = $this->post['invisible'] == -2 || $this->thread['displayorder'] == -2 ? $this->param['audit'] : 0;
     list($this->param['modnewthreads'], $this->param['modnewreplies']) = threadmodstatus($this->param['subject'] . "\t" . $this->param['message'] . $this->param['extramessage']);
     if ($post_invalid = checkpost($this->param['subject'], $this->param['message'], $isfirstpost && ($this->param['special'] || $this->param['sortid']))) {
         showmessage($post_invalid, '', array('minpostsize' => $this->setting['minpostsize'], 'maxpostsize' => $this->setting['maxpostsize']));
     }
     if (!$isorigauthor && !$this->group['allowanonymous']) {
         if ($this->post['anonymous'] && !$this->param['isanonymous']) {
             $this->param['isanonymous'] = 0;
             $this->param['threadupdatearr']['author'] = $this->post['author'];
             $anonymousadd = 0;
         } else {
             $this->param['isanonymous'] = $this->post['anonymous'];
             $anonymousadd = '';
         }
     } else {
         $this->param['threadupdatearr']['author'] = $this->param['isanonymous'] ? '' : $this->post['author'];
         $anonymousadd = $this->param['isanonymous'];
     }
     if ($isfirstpost) {
         if (trim($this->param['subject']) == '' && $this->thread['special'] != 2) {
             showmessage('post_sm_isnull');
         }
         if (!$this->param['sortid'] && !$this->thread['special'] && trim($this->param['message']) == '') {
             showmessage('post_sm_isnull');
         }
         $publishdate = null;
         if ($this->group['allowsetpublishdate'] && $this->thread['displayorder'] == -4) {
             $cron_publish_ids = dunserialize($this->cache('cronpublish'));
             if (!$this->param['cronpublish'] && in_array($this->thread['tid'], $cron_publish_ids) || $this->param['modnewthreads']) {
                 $this->param['threadupdatearr']['dateline'] = $publishdate = TIMESTAMP;
                 unset($cron_publish_ids[$this->thread['tid']]);
                 $cron_publish_ids = serialize($cron_publish_ids);
                 savecache('cronpublish', $cron_publish_ids);
             } elseif ($this->param['cronpublish'] && $this->param['cronpublishdate']) {
                 $this->param['threadupdatearr']['dateline'] = $publishdate = strtotime($this->param['cronpublishdate']);
                 $this->param['save'] = 1;
                 if (!in_array($this->thread['tid'], $cron_publish_ids)) {
                     $cron_publish_ids[$this->thread['tid']] = $this->thread['tid'];
                     $cron_publish_ids = serialize($cron_publish_ids);
                     savecache('cronpublish', $cron_publish_ids);
                 }
             }
         }
         $this->param['readperm'] = $this->group['allowsetreadperm'] ? intval($this->param['readperm']) : ($isorigauthor ? 0 : 'ignore');
         if ($this->thread['special'] != 3) {
             $this->param['price'] = intval($this->param['price']);
             $this->param['price'] = $this->thread['price'] < 0 && !$this->thread['special'] ? $isorigauthor || !$this->param['price'] ? -1 : $this->param['price'] : ($this->group['maxprice'] ? $this->param['price'] <= $this->group['maxprice'] ? $this->param['price'] > 0 ? $this->param['price'] : 0 : $this->group['maxprice'] : ($isorigauthor ? $this->param['price'] : $this->thread['price']));
             if ($this->param['price'] > 0 && floor($this->param['price'] * (1 - $this->setting['creditstax'])) == 0) {
                 return $this->showmessage('post_net_price_iszero');
             }
         }
         $this->thread['status'] = setstatus(4, $this->param['ordertype'], $this->thread['status']);
         $this->thread['status'] = setstatus(15, $this->param['imgcontent'], $this->thread['status']);
         if ($this->param['imgcontent']) {
             stringtopic($this->param['message'], $this->post['tid'], true, $this->param['imgcontentwidth']);
         }
         $this->thread['status'] = setstatus(2, $this->param['hiddenreplies'], $this->thread['status']);
         $this->thread['status'] = setstatus(6, $this->param['allownoticeauthor'] ? 1 : 0, $this->thread['status']);
         $displayorder = empty($this->param['save']) ? $this->thread['displayorder'] == -4 ? -4 : $this->thread['displayorder'] : -4;
         $this->param['threadupdatearr']['typeid'] = $this->param['typeid'];
         $this->param['threadupdatearr']['sortid'] = $this->param['sortid'];
         $this->param['threadupdatearr']['subject'] = $this->param['subject'];
         if ($this->param['readperm'] !== 'ignore') {
             $this->param['threadupdatearr']['readperm'] = $this->param['readperm'];
         }
         $this->param['threadupdatearr']['price'] = $this->param['price'];
         $this->param['threadupdatearr']['status'] = $this->thread['status'];
         if (getglobal('forum_auditstatuson') && $this->param['audit'] == 1) {
             $this->param['threadupdatearr']['displayorder'] = 0;
             $this->param['threadupdatearr']['moderated'] = 1;
         } else {
             $this->param['threadupdatearr']['displayorder'] = $displayorder;
         }
         C::t('forum_thread')->update($this->thread['tid'], $this->param['threadupdatearr'], true);
         if ($this->thread['tid'] > 1) {
             if ($this->thread['closed'] > 1) {
                 C::t('forum_thread')->update($this->thread['closed'], array('subject' => $this->param['subject']), true);
             } elseif (empty($this->thread['isgroup'])) {
                 $threadclosed = C::t('forum_threadclosed')->fetch($thread['tid']);
                 if ($threadclosed['redirect']) {
                     C::t('forum_thread')->update($threadclosed['redirect'], array('subject' => $this->param['subject']), true);
                 }
             }
         }
         $class_tag = new tag();
         $tagstr = $class_tag->update_field($this->param['tags'], $this->thread['tid'], 'tid', $this->thread);
     } else {
         if ($this->param['subject'] == '' && $this->param['message'] == '' && $this->thread['special'] != 2) {
             showmessage('post_sm_isnull');
         }
     }
     $this->param['htmlon'] = $this->group['allowhtml'] && !empty($this->param['htmlon']) ? 1 : 0;
     if ($this->setting['editedby'] && TIMESTAMP - $this->post['dateline'] > 60 && $this->member['adminid'] != 1) {
         $editor = $this->param['isanonymous'] && $isorigauthor ? lang('forum/misc', 'anonymous') : $this->member['username'];
         $edittime = dgmdate(TIMESTAMP);
         $this->param['message'] = lang('forum/misc', $this->param['htmlon'] ? 'post_edithtml' : (!$this->forum['allowbbcode'] || $this->param['bbcodeoff'] ? 'post_editnobbcode' : 'post_edit'), array('editor' => $editor, 'edittime' => $edittime)) . $this->param['message'];
     }
     $this->param['bbcodeoff'] = checkbbcodes($this->param['message'], !empty($this->param['bbcodeoff']));
     $this->param['smileyoff'] = checksmilies($this->param['message'], !empty($this->param['smileyoff']));
     $tagoff = $isfirstpost ? !empty($tagoff) : 0;
     if (getglobal('forum_auditstatuson') && $this->param['audit'] == 1) {
         C::t('forum_post')->update($this->thread['posttableid'], $this->post['pid'], array('status' => 4), false, false, null, -2, null, 0);
         updatepostcredits('+', $this->post['authorid'], $isfirstpost ? 'post' : 'reply', $this->forum['fid']);
         updatemodworks('MOD', 1);
         updatemodlog($this->thread['tid'], 'MOD');
     }
     $displayorder = $pinvisible = 0;
     if ($isfirstpost) {
         $displayorder = $this->param['modnewthreads'] ? -2 : $this->thread['displayorder'];
         $pinvisible = $this->param['modnewthreads'] ? -2 : (empty($this->param['save']) ? 0 : -3);
     } else {
         $pinvisible = $this->param['modnewreplies'] ? -2 : ($this->thread['displayorder'] == -4 ? -3 : 0);
     }
     $this->param['message'] = preg_replace('/\\[attachimg\\](\\d+)\\[\\/attachimg\\]/is', '[attach]\\1[/attach]', $this->param['message']);
     $this->param['parseurloff'] = !empty($this->param['parseurloff']);
     $setarr = array('message' => $this->param['message'], 'usesig' => $this->param['usesig'], 'htmlon' => $this->param['htmlon'], 'bbcodeoff' => $this->param['bbcodeoff'], 'parseurloff' => $this->param['parseurloff'], 'smileyoff' => $this->param['smileyoff'], 'subject' => $this->param['subject'], 'tags' => $tagstr, 'port' => getglobal('remoteport'));
     $setarr['status'] = $this->post['status'];
     if ($this->param['modstatus']) {
         foreach ($this->param['modstatus'] as $modbit => $modvalue) {
             $setarr['status'] = setstatus($modbit, $modvalue, $setarr['status']);
         }
     }
     if ($anonymousadd !== '') {
         $setarr['anonymous'] = $anonymousadd;
     }
     if ($publishdate) {
         $setarr['dateline'] = $publishdate;
     }
     if (getglobal('forum_auditstatuson') && $this->param['audit'] == 1) {
         $setarr['invisible'] = 0;
     } else {
         $setarr['invisible'] = $pinvisible;
     }
     C::t('forum_post')->update('tid:' . $this->thread['tid'], $this->post['pid'], $setarr);
     $this->forum['lastpost'] = explode("\t", $this->forum['lastpost']);
     if ($this->post['dateline'] == $this->forum['lastpost'][2] && ($this->post['author'] == $this->forum['lastpost'][3] || $this->forum['lastpost'][3] == '' && $this->post['anonymous'])) {
         $lastpost = $this->thread['tid'] . "\t" . ($isfirstpost ? $this->param['subject'] : $this->thread['subject']) . "\t" . $this->post['dateline'] . "\t" . ($this->param['isanonymous'] ? '' : $this->post['author']);
         C::t('forum_forum')->update($this->forum['fid'], array('lastpost' => $lastpost));
     }
     if (!getglobal('forum_auditstatuson') || $this->param['audit'] != 1) {
         if ($isfirstpost && $this->param['modnewthreads']) {
             C::t('forum_thread')->update($this->thread['tid'], array('displayorder' => -2));
             manage_addnotify('verifythread');
         } elseif (!$isfirstpost && $this->param['modnewreplies']) {
             C::t('forum_thread')->increase($this->thread['tid'], array('replies' => -1));
             manage_addnotify('verifypost');
         }
         if ($this->param['modnewreplies'] || $this->param['modnewthreads']) {
             C::t('forum_forum')->update($this->forum['fid'], array('modworks' => '1'));
         }
     }
     if ($this->thread['lastpost'] == $this->post['dateline'] && (!$this->post['anonymous'] && $this->thread['lastposter'] == $this->post['author'] || $this->post['anonymous'] && $this->thread['lastposter'] == '') && $this->post['anonymous'] != $this->param['isanonymous']) {
         C::t('forum_thread')->update($this->thread['tid'], array('lastposter' => $this->param['isanonymous'] ? '' : $this->post['author']), true);
     }
     if (!$isorigauthor) {
         updatemodworks('EDT', 1);
         require_once libfile('function/misc');
         modlog($this->thread, 'EDT');
     }
     if ($isfirstpost && $this->thread['displayorder'] == -4 && empty($this->param['save'])) {
         threadpubsave($this->thread['tid']);
     }
 }
コード例 #23
0
ファイル: _class_ajax_pais.php プロジェクト: bireme/proethos
 function country_list($protocol)
 {
     global $tab_max;
     $sql = "select * from cep_submit_country \n\t\t\t\tinner join " . $this->tabela . " on ctr_country = pais_codigo\n\t\t\t\twhere ctr_protocol = '" . $protocol . "' and ctr_ativo = 1\n\t\t\t\torder by pais_nome";
     $rlt = db_query($sql);
     $it = 0;
     $tot = 0;
     $toti = 0;
     $sx .= '<table width="' . $tab_max . '" class="lt1">';
     $sx .= '<TR>';
     $sx .= '<TH width="5%">' . msg('budget_item');
     $sx .= '<TH>' . msg('country_desc');
     $sx .= '<TH>' . msg('country_sample_size');
     while ($line = db_read($rlt)) {
         $link = "<A HREF=\"javascript:country_del(" . $line['id_ctr'];
         $link .= ",'" . checkpost($line['id_ctr']) . "');\">";
         $it++;
         $toti = $toti + $line['sorca_unid'];
         $tot = $tot + $line['sorca_unid'] * $line['sorca_valor'];
         $sx .= '<TR>';
         $sx .= '<TD align="center">' . $it;
         $sx .= '<TD align="left">' . trim($line['pais_nome']);
         $sx .= '<TD align="center">' . trim($line['ctr_target']);
         $sx .= '<TD align="right" width="10">';
         $sx .= $link;
         $sx .= '<img src="img/icone_remove.png" border=0>';
         $sx .= '</A>';
     }
     $sx .= '</table>';
     $s .= chr(13) . '<script type="text/javascript">';
     $s .= chr(13) . 'function country_del(id) {';
     $s .= chr(13) . 'var $tela = $.ajax({ url: "submit_ajax.php", type: "POST", ';
     $s .= chr(13) . 'data: { dd0: id, dd10: "country" ,dd12 :"DEL" ,dd11: "' . $protocol . '" }';
     $s .= chr(13) . '})';
     $s .= chr(13) . '.fail(function() { alert("error #02"); })';
     $s .= chr(13) . '.success(function(data) { $("#country").html(data); });';
     $s .= chr(13) . '}';
     $s .= chr(13) . '</script>';
     $sx .= chr(13) . $s;
     return $sx;
 }
コード例 #24
0
            }
            $vtypeselect .= '</select>';
        }
    }
    if ($special == 4) {
        $activitytypelist = $activitytype ? explode("\n", trim($activitytype)) : '';
    }
    include template('post');
} else {
    if ($subject == '') {
        showmessage('post_sm_isnull');
    }
    if (!$sortid && !$special && $message == '') {
        showmessage('post_sm_isnull');
    }
    if ($post_invalid = checkpost($special)) {
        showmessage($post_invalid);
    }
    if (checkflood()) {
        showmessage('post_flood_ctrl');
    }
    if ($allowpostattach && is_array($_FILES['attach'])) {
        foreach ($_FILES['attach']['name'] as $attachname) {
            if ($attachname != '') {
                checklowerlimit($postattachcredits);
                break;
            }
        }
    }
    $typeid = isset($typeid) && isset($forum['threadtypes']['types'][$typeid]) ? $typeid : 0;
    $iconid = !empty($iconid) && isset($_DCACHE['icons'][$iconid]) ? $iconid : 0;
コード例 #25
0
ファイル: TaskAction.class.php プロジェクト: laiello/qinhan
 public function answer_task()
 {
     if (!$GLOBALS['islogin']) {
         exit('error');
     }
     if (!checkpost()) {
         exit;
     }
     $uid = postvar('receiver_uid', 1);
     $tid = postvar('related', 1);
     $task = M('task');
     $t = $task->where("tid={$tid}")->find();
     if (!$t) {
         exit('error');
     }
     $task_answer = M('task_answer');
     $rs = $task_answer->where("tid={$tid} AND uid={$GLOBALS['i']['uid']}")->find();
     if ($rs) {
         exit('{"stat":5,"error":"\\u60a8\\u5df2\\u7ecf\\u5e2e\\u8fc7\\u4e86"}');
     }
     $data['tid'] = $t['tid'];
     $data['uid'] = $GLOBALS['i']['uid'];
     $data['username'] = $GLOBALS['i']['username'];
     $data['default_pic'] = $GLOBALS['i']['default_pic'];
     $data['content'] = exp_content(postvar('content'));
     $data['is_anonymity'] = postvar('is_anonymity', 1);
     $data['add_time'] = time();
     $rs = $task_answer->add($data);
     if ($rs) {
         $edit['answer_count'] = array('exp', 'answer_count+1');
         $task->where("tid={$t['tid']}")->save($edit);
         $msgModel = D('Msg');
         $ta = $GLOBALS['i']['sex'] == 1 ? '她' : '他';
         $ta2 = $GLOBALS['i']['sex'] == 1 ? '他' : '她';
         $content = exp_content(postvar('content'));
         $str = "<div class=\"textbg f_6\"><b>你参与了{$ta}发布的任务:{$t['title']}</b></div>";
         $str2 = "<div class=\"textbg f_6\"><b>{$ta2}参与了你发布的任务:{$t['title']}</b></div>";
         $str3 = "<div class=\"textbg f_6\"><b>任务:{$t['title']}</b></div>";
         $main = "<p class=\"word_break\"><span class=\"word_break\">回应:{$data['content']}</span></p>";
         $str = $str . $main;
         $str2 = $str2 . $main;
         $str3 = $str3 . $main;
         $msgModel->chat($GLOBALS['i']['uid'], $uid, $str, 0, $str2, $str3);
     }
     //echo $task->getLastSql();
     exit('{"stat":0}');
 }
コード例 #26
0
ファイル: TopicAdminAction.php プロジェクト: caidongyun/CS
 private function sendPost($extract)
 {
     global $_G;
     extract($extract);
     // 获取主题和帖子要插入的状态信息
     $topicStatus = ForumUtils::getPostSendStatus('topic', $_GET['platType']);
     $postStatus = ForumUtils::getPostSendStatus('post', $_GET['platType']);
     //copy from dz source/include/post/post_newthread.php
     if (empty($_G['forum']['fid']) || $_G['forum']['type'] == 'group') {
         return WebUtils::makeErrorInfo_oldVersion($res, 'forum_nonexistence');
     }
     if ($special == 1 && !$_G['group']['allowpostpoll'] || $special == 2 && !$_G['group']['allowposttrade'] || $special == 3 && !$_G['group']['allowpostreward'] || $special == 4 && !$_G['group']['allowpostactivity'] || $special == 5 && !$_G['group']['allowpostdebate']) {
         return WebUtils::makeErrorInfo_oldVersion($res, 'group_nopermission', array('{grouptitle}' => $_G['group']['grouptitle']));
     }
     if (!$_G['uid'] && !(!$_G['forum']['postperm'] && $_G['group']['allowpost'] || $_G['forum']['postperm'] && forumperm($_G['forum']['postperm']))) {
         if (!defined('IN_MOBILE')) {
             return WebUtils::makeErrorInfo_oldVersion($res, 'postperm_login_nopermission', array('{login}' => 1));
         } else {
             return WebUtils::makeErrorInfo_oldVersion($res, 'postperm_login_nopermission_mobile', array('{login}' => 1));
         }
     } elseif (empty($_G['forum']['allowpost'])) {
         if (!$_G['forum']['postperm'] && !$_G['group']['allowpost']) {
             return WebUtils::makeErrorInfo_oldVersion($res, 'postperm_none_nopermission');
         } elseif ($_G['forum']['postperm'] && !forumperm($_G['forum']['postperm'])) {
             $msg = mobcent_showmessagenoperm('postperm', $_G['fid'], $_G['forum']['formulaperm']);
             return WebUtils::makeErrorInfo_oldVersion($res, $msg['message'], $msg['params']);
         }
     } elseif ($_G['forum']['allowpost'] == -1) {
         return WebUtils::makeErrorInfo_oldVersion($res, 'post_forum_newthread_nopermission');
     }
     if (!$_G['uid'] && ($_G['setting']['need_avatar'] || $_G['setting']['need_email'] || $_G['setting']['need_friendnum'])) {
         return WebUtils::makeErrorInfo_oldVersion($res, 'postperm_login_nopermission');
     }
     if (trim($subject) == '') {
         return WebUtils::makeErrorInfo_oldVersion($res, 'post_sm_isnull');
     }
     if (!$sortid && !$special && trim($message) == '') {
         return WebUtils::makeErrorInfo_oldVersion($res, 'post_sm_isnull');
     }
     if ($post_invalid = checkpost($subject, $message, $special || $sortid)) {
         return WebUtils::makeErrorInfo_oldVersion($res, $post_invalid, array('{minpostsize}' => $_G['setting']['minpostsize'], '{maxpostsize}' => $_G['setting']['maxpostsize']));
         //showmessage($post_invalid, '', array('minpostsize' => $_G['setting']['minpostsize'], 'maxpostsize' => $_G['setting']['maxpostsize']));
     }
     if (checkflood()) {
         return WebUtils::makeErrorInfo_oldVersion($res, 'post_flood_ctrl', array('{floodctrl}' => $_G['setting']['floodctrl']));
     } elseif (checkmaxperhour('tid')) {
         return WebUtils::makeErrorInfo_oldVersion($res, 'thread_flood_ctrl_threads_per_hour', array('{threads_per_hour}' => $_G['group']['maxthreadsperhour']));
     }
     $_GET['save'] = $_G['uid'] ? $_GET['save'] : 0;
     if ($_G['group']['allowsetpublishdate'] && $_GET['cronpublish'] && $_GET['cronpublishdate']) {
         $publishdate = strtotime($_GET['cronpublishdate']);
         if ($publishdate > $_G['timestamp']) {
             $_GET['save'] = 1;
         } else {
             $publishdate = $_G['timestamp'];
         }
     } else {
         $publishdate = $_G['timestamp'];
     }
     $typeid = isset($typeid) && isset($_G['forum']['threadtypes']['types'][$typeid]) && (empty($_G['forum']['threadtypes']['moderators'][$typeid]) || $_G['forum']['ismoderator']) ? $typeid : 0;
     $displayorder = $modnewthreads ? -2 : ($_G['forum']['ismoderator'] && $_G['group']['allowstickthread'] && !empty($_GET['sticktopic']) ? 1 : (empty($_GET['save']) ? 0 : -4));
     if ($displayorder == -2) {
         C::t('forum_forum')->update($_G['fid'], array('modworks' => '1'));
     } elseif ($displayorder == -4) {
         $_GET['addfeed'] = 0;
     }
     $digest = $_G['forum']['ismoderator'] && $_G['group']['allowdigestthread'] && !empty($_GET['addtodigest']) ? 1 : 0;
     $readperm = $_G['group']['allowsetreadperm'] ? $readperm : 0;
     $isanonymous = $_G['group']['allowanonymous'] && $_GET['isanonymous'] ? 1 : 0;
     $price = intval($price);
     $price = $_G['group']['maxprice'] && !$special ? $price <= $_G['group']['maxprice'] ? $price : $_G['group']['maxprice'] : 0;
     //强制主题类别判断
     if (!$typeid && $_G['forum']['threadtypes']['required'] && !$special) {
         return WebUtils::makeErrorInfo_oldVersion($res, 'post_type_isnull');
     }
     //强制主题分类判断
     if (!$sortid && $_G['forum']['threadsorts']['required'] && !$special) {
         return WebUtils::makeErrorInfo_oldVersion($res, 'post_sort_isnull');
     }
     //主题售价 客户端暂不支持
     if ($price > 0 && floor($price * (1 - $_G['setting']['creditstax'])) == 0) {
         return WebUtils::makeErrorInfo_oldVersion($res, 'forum_passwd');
         showmessage('post_net_price_iszero');
     }
     //投票贴相关
     if ($special == 1) {
         $polloption = $_GET['tpolloption'] == 2 ? explode("\n", $_GET['polloptions']) : $_GET['polloption'];
         $pollarray = array();
         foreach ($polloption as $key => $value) {
             $polloption[$key] = censor($polloption[$key]);
             if (trim($value) === '') {
                 unset($polloption[$key]);
             }
         }
         if (count($polloption) > $_G['setting']['maxpolloptions']) {
             return WebUtils::makeErrorInfo_oldVersion($res, 'forum_passwd');
             showmessage('post_poll_option_toomany', '', array('maxpolloptions' => $_G['setting']['maxpolloptions']));
         } elseif (count($polloption) < 2) {
             return WebUtils::makeErrorInfo_oldVersion($res, 'forum_passwd');
             showmessage('post_poll_inputmore');
         }
         $curpolloption = count($polloption);
         $pollarray['maxchoices'] = empty($_GET['maxchoices']) ? 0 : ($_GET['maxchoices'] > $curpolloption ? $curpolloption : $_GET['maxchoices']);
         $pollarray['multiple'] = empty($_GET['maxchoices']) || $_GET['maxchoices'] == 1 ? 0 : 1;
         $pollarray['options'] = $polloption;
         $pollarray['visible'] = empty($_GET['visibilitypoll']);
         $pollarray['overt'] = !empty($_GET['overt']);
         if (preg_match("/^\\d*\$/", trim($_GET['expiration']))) {
             if (empty($_GET['expiration'])) {
                 $pollarray['expiration'] = 0;
             } else {
                 $pollarray['expiration'] = TIMESTAMP + 86400 * $_GET['expiration'];
             }
         } else {
             return WebUtils::makeErrorInfo_oldVersion($res, 'forum_passwd');
             showmessage('poll_maxchoices_expiration_invalid');
         }
     }
     // 分类信息有效期
     $_GET['typeexpiration'] = $_GET['typeoption']['typeexpiration'];
     $sortid = $special && $_G['forum']['threadsorts']['types'][$sortid] ? 0 : $sortid;
     $typeexpiration = intval($_GET['typeexpiration']);
     if ($_G['forum']['threadsorts']['expiration'][$typeid] && !$typeexpiration) {
         return WebUtils::makeErrorInfo_oldVersion($res, 'threadtype_expiration_invalid');
     }
     $_G['forum_optiondata'] = array();
     if ($_G['forum']['threadsorts']['types'][$sortid] && !$_G['forum']['allowspecialonly']) {
         Mobcent::import(MOBCENT_APP_ROOT . '/components/discuz/source/function/function_threadsort.php');
         $_G['forum_optiondata'] = mobcent_threadsort_validator($_GET['typeoption'], $pid);
         if ($_G['forum_optiondata']['message'] != '') {
             return WebUtils::makeErrorInfo_oldVersion($res, $_G['forum_optiondata']['message'], $_G['forum_optiondata']['params']);
         }
     }
     $author = !$isanonymous ? $_G['username'] : '';
     $moderated = $digest || $displayorder > 0 ? 1 : 0;
     $thread['status'] = 0;
     $_GET['ordertype'] && ($thread['status'] = setstatus(4, 1, $thread['status']));
     $_GET['hiddenreplies'] && ($thread['status'] = setstatus(2, 1, $thread['status']));
     /*             if($_G['group']['allowpostrushreply'] && $_GET['rushreply']) {
              $_GET['rushreplyfrom'] = strtotime($_GET['rushreplyfrom']);
             $_GET['rushreplyto'] = strtotime($_GET['rushreplyto']);
             $_GET['rewardfloor'] = trim($_GET['rewardfloor']);
             $_GET['stopfloor'] = intval($_GET['stopfloor']);
             $_GET['creditlimit'] = $_GET['creditlimit'] == '' ? '-996' : intval($_GET['creditlimit']);
             if($_GET['rushreplyfrom'] > $_GET['rushreplyto'] && !empty($_GET['rushreplyto'])) {
             return WebUtils::makeErrorInfo_oldVersion($res, 'forum_passwd');
             showmessage('post_rushreply_timewrong');
             }
             if(($_GET['rushreplyfrom'] > $_G['timestamp']) || (!empty($_GET['rushreplyto']) && $_GET['rushreplyto'] < $_G['timestamp']) || ($_GET['stopfloor'] == 1) ) {
             $closed = true;
             }
             if(!empty($_GET['rewardfloor']) && !empty($_GET['stopfloor'])) {
             $floors = explode(',', $_GET['rewardfloor']);
             if(!empty($floors) && is_array($floors)) {
             foreach($floors AS $key => $floor) {
             if(strpos($floor, '*') === false) {
             if(intval($floor) == 0) {
             unset($floors[$key]);
             } elseif($floor > $_GET['stopfloor']) {
             unset($floors[$key]);
             }
             }
             }
             $_GET['rewardfloor'] = implode(',', $floors);
             }
             }
             $thread['status'] = setstatus(3, 1, $thread['status']);
             $thread['status'] = setstatus(1, 1, $thread['status']);
             } */
     $_GET['allownoticeauthor'] && ($thread['status'] = setstatus(6, 1, $thread['status']));
     $isgroup = $_G['forum']['status'] == 3 ? 1 : 0;
     /*  if($_G['group']['allowreplycredit']) {
              $_GET['replycredit_extcredits'] = intval($_GET['replycredit_extcredits']);
             $_GET['replycredit_times'] = intval($_GET['replycredit_times']);
             $_GET['replycredit_membertimes'] = intval($_GET['replycredit_membertimes']);
             $_GET['replycredit_random'] = intval($_GET['replycredit_random']);
     
             $_GET['replycredit_random'] = $_GET['replycredit_random'] < 0 || $_GET['replycredit_random'] > 99 ? 0 : $_GET['replycredit_random'] ;
             $replycredit = $replycredit_real = 0;
             if($_GET['replycredit_extcredits'] > 0 && $_GET['replycredit_times'] > 0) {
             $replycredit_real = ceil(($_GET['replycredit_extcredits'] * $_GET['replycredit_times']) + ($_GET['replycredit_extcredits'] * $_GET['replycredit_times'] *  $_G['setting']['creditstax']));
             if($replycredit_real > getuserprofile('extcredits'.$_G['setting']['creditstransextra'][10])) {
             return WebUtils::makeErrorInfo_oldVersion($res, 'forum_passwd');
             showmessage('replycredit_morethan_self');
             } else {
             $replycredit = ceil($_GET['replycredit_extcredits'] * $_GET['replycredit_times']);
             }
             }
             } */
     $newthread = array('fid' => $_G['fid'], 'posttableid' => 0, 'readperm' => $readperm, 'price' => $price, 'typeid' => $typeid, 'sortid' => $sortid, 'author' => $author, 'authorid' => $_G['uid'], 'subject' => $subject, 'dateline' => $publishdate, 'lastpost' => $publishdate, 'lastposter' => $author, 'displayorder' => $displayorder, 'digest' => $digest, 'special' => $special, 'attachment' => 0, 'moderated' => $moderated, 'status' => $thread['status'] | $topicStatus, 'isgroup' => $isgroup, 'replycredit' => $replycredit, 'closed' => $closed ? 1 : 0);
     $tid = C::t('forum_thread')->insert($newthread, true);
     useractionlog($_G['uid'], 'tid');
     if (!getuserprofile('threads') && $_G['setting']['newbie']) {
         C::t('forum_thread')->update($tid, array('icon' => $_G['setting']['newbie']));
     }
     if ($publishdate != $_G['timestamp']) {
         loadcache('cronpublish');
         $cron_publish_ids = dunserialize($_G['cache']['cronpublish']);
         $cron_publish_ids[$tid] = $tid;
         $cron_publish_ids = serialize($cron_publish_ids);
         savecache('cronpublish', $cron_publish_ids);
     }
     if (!$isanonymous) {
         C::t('common_member_field_home')->update($_G['uid'], array('recentnote' => $subject));
     }
     if ($special == 3 && $_G['group']['allowpostreward']) {
         updatemembercount($_G['uid'], array($_G['setting']['creditstransextra'][2] => -$realprice), 1, 'RTC', $tid);
     }
     if ($moderated) {
         updatemodlog($tid, $displayorder > 0 ? 'STK' : 'DIG');
         updatemodworks($displayorder > 0 ? 'STK' : 'DIG', 1);
     }
     /* if($special == 1) {
     
             foreach($pollarray['options'] as $polloptvalue) {
             $polloptvalue = dhtmlspecialchars(trim($polloptvalue));
             C::t('forum_polloption')->insert(array('tid' => $tid, 'polloption' => $polloptvalue));
             }
             $polloptionpreview = '';
             $query = C::t('forum_polloption')->fetch_all_by_tid($tid, 1, 2);
             foreach($query as $option) {
             $polloptvalue = preg_replace("/\[url=(https?){1}:\/\/([^\[\"']+?)\](.+?)\[\/url\]/i", "<a href=\"\\1://\\2\" target=\"_blank\">\\3</a>", $option['polloption']);
             $polloptionpreview .= $polloptvalue."\t";
             }
     
             $polloptionpreview = daddslashes($polloptionpreview);
     
             $data = array('tid' => $tid, 'multiple' => $pollarray['multiple'], 'visible' => $pollarray['visible'], 'maxchoices' => $pollarray['maxchoices'], 'expiration' => $pollarray['expiration'], 'overt' => $pollarray['overt'], 'pollpreview' => $polloptionpreview);
             C::t('forum_poll')->insert($data);
             } */
     if ($_G['forum']['threadsorts']['types'][$sortid] && !empty($_G['forum_optiondata']) && is_array($_G['forum_optiondata'])) {
         $filedname = $valuelist = $separator = '';
         foreach ($_G['forum_optiondata'] as $optionid => $value) {
             if ($value) {
                 $filedname .= $separator . $_G['forum_optionlist'][$optionid]['identifier'];
                 $valuelist .= $separator . "'" . daddslashes($value) . "'";
                 $separator = ' ,';
             }
             if ($_G['forum_optionlist'][$optionid]['type'] == 'image') {
                 $identifier = $_G['forum_optionlist'][$optionid]['identifier'];
                 $sortaids[] = intval($_GET['typeoption'][$identifier]['aid']);
             }
             C::t('forum_typeoptionvar')->insert(array('sortid' => $sortid, 'tid' => $tid, 'fid' => $_G['fid'], 'optionid' => $optionid, 'value' => censor($value), 'expiration' => $typeexpiration ? $publishdate + $typeexpiration : 0));
         }
         if ($filedname && $valuelist) {
             C::t('forum_optionvalue')->insert($sortid, "({$filedname}, tid, fid) VALUES ({$valuelist}, '{$tid}', '{$_G['fid']}')");
         }
     }
     if ($_G['group']['allowat']) {
         $atlist = $atlist_tmp = array();
         preg_match_all("/@([^\r\n]*?)\\s/i", $message . ' ', $atlist_tmp);
         $atlist_tmp = array_slice(array_unique($atlist_tmp[1]), 0, $_G['group']['allowat']);
         if (!empty($atlist_tmp)) {
             if (empty($_G['setting']['at_anyone'])) {
                 foreach (C::t('home_follow')->fetch_all_by_uid_fusername($_G['uid'], $atlist_tmp) as $row) {
                     $atlist[$row['followuid']] = $row['fusername'];
                 }
                 if (count($atlist) < $_G['group']['allowat']) {
                     $query = C::t('home_friend')->fetch_all_by_uid_username($_G['uid'], $atlist_tmp);
                     foreach ($query as $row) {
                         $atlist[$row['fuid']] = $row['fusername'];
                     }
                 }
             } else {
                 foreach (C::t('common_member')->fetch_all_by_username($atlist_tmp) as $row) {
                     $atlist[$row['uid']] = $row['username'];
                 }
             }
         }
         if ($atlist) {
             foreach ($atlist as $atuid => $atusername) {
                 $atsearch[] = "/@" . str_replace('/', '\\/', preg_quote($atusername)) . " /i";
                 $atreplace[] = "[url=home.php?mod=space&uid={$atuid}]@{$atusername}[/url] ";
             }
             $message = preg_replace($atsearch, $atreplace, $message . ' ', 1);
         }
     }
     $bbcodeoff = checkbbcodes($message, !empty($_GET['bbcodeoff']));
     $smileyoff = checksmilies($message, !empty($_GET['smileyoff']));
     $parseurloff = !empty($_GET['parseurloff']);
     $htmlon = $_G['group']['allowhtml'] && !empty($_GET['htmlon']) ? 1 : 0;
     $usesig = !empty($_GET['usesig']) && $_G['group']['maxsigsize'] ? 1 : 0;
     $class_tag = new tag();
     $tagstr = $class_tag->add_tag($_GET['tags'], $tid, 'tid');
     /* if($_G['group']['allowreplycredit']) {
         if($replycredit > 0 && $replycredit_real > 0) {
        updatemembercount($_G['uid'], array('extcredits'.$_G['setting']['creditstransextra'][10] => -$replycredit_real), 1, 'RCT', $tid);
        $insertdata = array(
                'tid' => $tid,
                'extcredits' => $_GET['replycredit_extcredits'],
                'extcreditstype' => $_G['setting']['creditstransextra'][10],
                'times' => $_GET['replycredit_times'],
                'membertimes' => $_GET['replycredit_membertimes'],
                'random' => $_GET['replycredit_random']
        );
        C::t('forum_replycredit')->insert($insertdata);
        }
        } */
     if ($_G['group']['allowpostrushreply'] && $_GET['rushreply']) {
         $rushdata = array('tid' => $tid, 'stopfloor' => $_GET['stopfloor'], 'starttimefrom' => $_GET['rushreplyfrom'], 'starttimeto' => $_GET['rushreplyto'], 'rewardfloor' => $_GET['rewardfloor'], 'creditlimit' => $_GET['creditlimit']);
         C::t('forum_threadrush')->insert($rushdata);
     }
     $pinvisible = $modnewthreads ? -2 : (empty($_GET['save']) ? 0 : -3);
     $message = preg_replace('/\\[attachimg\\](\\d+)\\[\\/attachimg\\]/is', '[attach]\\1[/attach]', $message);
     $pid = insertpost(array('fid' => $_G['fid'], 'tid' => $tid, 'first' => '1', 'author' => $_G['username'], 'authorid' => $_G['uid'], 'subject' => $subject, 'dateline' => $publishdate, 'message' => $message, 'useip' => $_G['clientip'], 'invisible' => $pinvisible, 'anonymous' => $isanonymous, 'usesig' => $usesig, 'htmlon' => $htmlon, 'bbcodeoff' => $bbcodeoff, 'smileyoff' => $smileyoff, 'parseurloff' => $parseurloff, 'attachment' => '0', 'tags' => $tagstr, 'replycredit' => 0, 'status' => (defined('IN_MOBILE') ? 8 : 0) | $postStatus));
     if ($_G['group']['allowat'] && $atlist) {
         foreach ($atlist as $atuid => $atusername) {
             notification_add($atuid, 'at', 'at_message', array('from_id' => $tid, 'from_idtype' => 'at', 'buyerid' => $_G['uid'], 'buyer' => $_G['username'], 'tid' => $tid, 'subject' => $subject, 'pid' => $pid, 'message' => messagecutstr($message, 150)));
         }
         set_atlist_cookie(array_keys($atlist));
     }
     $threadimageaid = 0;
     $threadimage = array();
     if ($special == 4 && $_GET['activityaid']) {
         $threadimageaid = $_GET['activityaid'];
         convertunusedattach($_GET['activityaid'], $tid, $pid);
     }
     if ($_G['forum']['threadsorts']['types'][$sortid] && !empty($_G['forum_optiondata']) && is_array($_G['forum_optiondata']) && $sortaids) {
         foreach ($sortaids as $sortaid) {
             convertunusedattach($sortaid, $tid, $pid);
         }
     }
     if (($_G['group']['allowpostattach'] || $_G['group']['allowpostimage']) && ($_GET['attachnew'] || $sortid || !empty($_GET['activityaid']))) {
         updateattach($displayorder == -4 || $modnewthreads, $tid, $pid, $_GET['attachnew']);
         if (!$threadimageaid) {
             $threadimage = C::t('forum_attachment_n')->fetch_max_image('tid:' . $tid, 'tid', $tid);
             $threadimageaid = $threadimage['aid'];
         }
     }
     $values = array('fid' => $_G['fid'], 'tid' => $tid, 'pid' => $pid, 'coverimg' => '', 'sechash' => !empty($_GET['sechash']) ? $_GET['sechash'] : '');
     $param = array();
     Mobcent::import(MOBCENT_APP_ROOT . '/components/discuz/source/function/function_post.php');
     if ($_G['forum']['picstyle']) {
         if (!mobcent_setthreadcover($pid, 0, $threadimageaid)) {
             preg_match_all("/(\\[img\\]|\\[img=\\d{1,4}[x|\\,]\\d{1,4}\\])\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/img\\]/is", $message, $imglist, PREG_SET_ORDER);
             $values['coverimg'] = "<p id=\"showsetcover\">" . lang('message', 'post_newthread_set_cover') . "<span id=\"setcoverwait\"></span></p><script>if(\$('forward_a')){\$('forward_a').style.display='none';setTimeout(\"\$('forward_a').style.display=''\", 5000);};ajaxget('forum.php?mod=ajax&action=setthreadcover&tid={$tid}&pid={$pid}&fid={$_G['fid']}&imgurl={$imglist[0][2]}&newthread=1', 'showsetcover', 'setcoverwait')</script>";
             $param['clean_msgforward'] = 1;
             $param['timeout'] = $param['refreshtime'] = 15;
         }
     }
     if ($threadimageaid) {
         if (!$threadimage) {
             $threadimage = C::t('forum_attachment_n')->fetch('tid:' . $tid, $threadimageaid);
         }
         $threadimage = daddslashes($threadimage);
         C::t('forum_threadimage')->insert(array('tid' => $tid, 'attachment' => $threadimage['attachment'], 'remote' => $threadimage['remote']));
     }
     $statarr = array(0 => 'thread', 1 => 'poll', 2 => 'trade', 3 => 'reward', 4 => 'activity', 5 => 'debate', 127 => 'thread');
     include_once libfile('function/stat');
     updatestat($isgroup ? 'groupthread' : $statarr[$special]);
     if ($modnewthreads) {
         updatemoderate('tid', $tid);
         C::t('forum_forum')->update_forum_counter($_G['fid'], 0, 0, 1);
         manage_addnotify('verifythread');
         return WebUtils::makeErrorInfo_oldVersion($res, 'post_newthread_mod_succeed', array('noError' => 1));
         //showmessage('post_newthread_mod_succeed', $returnurl, $values, $param);
     } else {
         if ($displayorder >= 0 && helper_access::check_module('follow') && !empty($_GET['adddynamic']) && !$isanonymous) {
             require_once libfile('function/discuzcode');
             require_once libfile('function/followcode');
             $feedcontent = array('tid' => $tid, 'content' => followcode($message, $tid, $pid, 1000));
             C::t('forum_threadpreview')->insert($feedcontent);
             C::t('forum_thread')->update_status_by_tid($tid, '512');
             $followfeed = array('uid' => $_G['uid'], 'username' => $_G['username'], 'tid' => $tid, 'note' => '', 'dateline' => TIMESTAMP);
             $values['feedid'] = C::t('home_follow_feed')->insert($followfeed, true);
             C::t('common_member_count')->increase($_G['uid'], array('feeds' => 1));
         }
         $feed = array('icon' => '', 'title_template' => '', 'title_data' => array(), 'body_template' => '', 'body_data' => array(), 'title_data' => array(), 'images' => array());
         if ($displayorder != -4) {
             if ($digest) {
                 updatepostcredits('+', $_G['uid'], 'digest', $_G['fid']);
             }
             //updatepostcredits('+',  $_G['uid'], 'post', $_G['fid']);
             Mobcent::import(MOBCENT_APP_ROOT . '/components/discuz/source/function/function_post.php');
             //Yii::import('application.components.discuz.source.function.function_post', true);
             mobcent_updatepostcredits('+', $_G['uid'], 'post', $_G['fid']);
             if ($isgroup) {
                 C::t('forum_groupuser')->update_counter_for_user($_G['uid'], $_G['fid'], 1);
             }
             $subject = str_replace("\t", ' ', $subject);
             $lastpost = "{$tid}\t" . $subject . "\t{$_G['timestamp']}\t{$author}";
             C::t('forum_forum')->update($_G['fid'], array('lastpost' => $lastpost));
             C::t('forum_forum')->update_forum_counter($_G['fid'], 1, 1, 1);
             if ($_G['forum']['type'] == 'sub') {
                 C::t('forum_forum')->update($_G['forum']['fup'], array('lastpost' => $lastpost));
             }
         }
         if ($_G['forum']['status'] == 3) {
             C::t('forum_forumfield')->update($_G['fid'], array('lastupdate' => TIMESTAMP));
             require_once libfile('function/grouplog');
             updategroupcreditlog($_G['fid'], $_G['uid']);
         }
         /*如果显示地理位置,入库到表里*/
         if ($jsonInfo['isShowPostion']) {
             $data = DB::query('INSERT INTO  %t VALUES(null,%f,%f,%d,%d,%s)', array('home_surrounding_user', $jsonInfo['longitude'], $jsonInfo['latitude'], $tid, 3, (string) $jsonInfo['location']));
         }
         /*  //客户端发表主题积分入库
                $temp = DB::fetch_first('SELECT extcredits3  FROM '.DB::table('common_credit_rule').' WHERE rid =%d ',array(1));
                $extcredits3 = DB::fetch_first('SELECT extcredits3 FROM '.DB::table('common_member_count').' WHERE uid = %d',array($_G['uid']));
                $temp = $extcredits3['extcredits3'] + $temp['extcredits3'];
                DB::query('UPDATE '.DB::table('common_member_count').' set extcredits3 = %d WHERE uid = %d',array($temp,$_G['uid']));
             */
         //showmessage('post_newthread_succeed', $returnurl, $values, $param);
         // return array('rs'=>1,'errcode'=>WebUtils::t('发贴成功'));
         return $this->makeErrorInfo($res, 'mobcent_post_newthread_success', array('noError' => 1));
     }
 }
コード例 #27
0
 if (empty($forum['allowreply']) && (!$forum['replyperm'] && !$allowreply || $forum['replyperm'] && !forumperm($forum['replyperm']))) {
     wapmsg('post_newreply_nopermission');
 }
 if ($thread['closed'] && !$forum['ismoderator']) {
     wapmsg('post_thread_closed');
 }
 if ($post_autoclose = checkautoclose()) {
     wapmsg($post_autoclose);
 }
 if (empty($message)) {
     echo "<p>{$lang['message']}<input type=\"text\" name=\"message\" value=\"\" format=\"M*m\" /><br />\n" . "<anchor title=\"{$lang['submit']}\">{$lang['submit']}" . "<go method=\"post\" href=\"index.php?action=post&amp;do=reply&amp;fid={$fid}&amp;tid={$tid}&amp;sid={$sid}\">\n" . "<postfield name=\"subject\" value=\"\$(subject)\" />\n" . "<postfield name=\"message\" value=\"\$(message)\" />\n" . "<postfield name=\"formhash\" value=\"" . formhash() . "\" />\n" . "</go></anchor><br /><br />\n" . "<a href=\"index.php?action=thread&amp;tid={$tid}\">{$lang['return_thread']}</a><br />\n" . "<a href=\"index.php?action=forum&amp;fid={$fid}\">{$lang['return_forum']}</a></p>\n";
 } else {
     if ($message == '') {
         wapmsg('post_sm_isnull');
     }
     if ($post_invalid = checkpost()) {
         wapmsg($post_invalid);
     }
     if ($formhash != formhash()) {
         wapmsg('wap_submit_invalid');
     }
     if (checkflood()) {
         wapmsg('post_flood_ctrl');
     }
     $pinvisible = $modnewreplies ? -2 : 0;
     $db->query("INSERT INTO {$tablepre}posts (fid, tid, first, author, authorid, dateline, message, useip, invisible, usesig, htmlon, bbcodeoff, smileyoff, parseurloff, attachment)\r\n\t\t\t\tVALUES ('{$fid}', '{$tid}', '0', '{$discuz_user}', '{$discuz_uid}', '{$timestamp}', '{$message}', '{$onlineip}', '{$pinvisible}', '1', '0', '0', '0', '0', '0')");
     $pid = $db->insert_id();
     $db->query("REPLACE INTO {$tablepre}myposts (uid, tid, pid, position, dateline) VALUES ('{$discuz_uid}', '{$tid}', '{$pid}', '" . ($thread['replies'] + 1) . "', '{$timestamp}')", 'UNBUFFERED');
     if ($modnewreplies) {
         wapmsg('post_mod_succeed', array('title' => 'post_mod_forward', 'link' => "index.php?action=forum&amp;fid={$fid}"));
     } else {
コード例 #28
0
 public function newthread($parameters)
 {
     require_once libfile('function/post');
     $this->tid = $this->pid = 0;
     $this->_init_parameters($parameters);
     if (trim($this->param['subject']) == '') {
         return $this->showmessage('post_sm_isnull');
     }
     if (!$this->param['sortid'] && !$this->param['special'] && trim($this->param['message']) == '') {
         return $this->showmessage('post_sm_isnull');
     }
     list($this->param['modnewthreads'], $this->param['modnewreplies']) = threadmodstatus($this->param['subject'] . "\t" . $this->param['message'] . $this->param['extramessage']);
     if ($post_invalid = checkpost($this->param['subject'], $this->param['message'], $this->param['special'] || $this->param['sortid'])) {
         return $this->showmessage($post_invalid, '', array('minpostsize' => $this->setting['minpostsize'], 'maxpostsize' => $this->setting['maxpostsize']));
     }
     if (checkflood()) {
         return $this->showmessage('post_flood_ctrl', '', array('floodctrl' => $this->setting['floodctrl']));
     } elseif (checkmaxperhour('tid')) {
         return $this->showmessage('thread_flood_ctrl_threads_per_hour', '', array('threads_per_hour' => $this->group['maxthreadsperhour']));
     }
     $this->param['save'] = $this->member['uid'] ? $this->param['save'] : 0;
     $this->param['typeid'] = isset($this->param['typeid']) && isset($this->forum['threadtypes']['types'][$this->param['typeid']]) && (!$this->forum['threadtypes']['moderators'][$this->param['typeid']] || $this->forum['ismoderator']) ? $this->param['typeid'] : 0;
     $this->param['displayorder'] = $this->param['modnewthreads'] ? -2 : ($this->forum['ismoderator'] && $this->group['allowstickthread'] && !empty($this->param['sticktopic']) ? 1 : (empty($this->param['save']) ? 0 : -4));
     if ($this->param['displayorder'] == -2) {
         C::t('forum_forum')->update($this->forum['fid'], array('modworks' => '1'));
     }
     $this->param['digest'] = $this->forum['ismoderator'] && $this->group['allowdigestthread'] && !empty($this->param['digest']) ? 1 : 0;
     $this->param['readperm'] = $this->group['allowsetreadperm'] ? $this->param['readperm'] : 0;
     $this->param['isanonymous'] = $this->group['allowanonymous'] && $this->param['isanonymous'] ? 1 : 0;
     $this->param['price'] = intval($this->param['price']);
     if (!$this->param['special']) {
         $this->param['price'] = $this->group['maxprice'] ? $this->param['price'] <= $this->group['maxprice'] ? $this->param['price'] : $this->group['maxprice'] : 0;
     }
     if (!$this->param['typeid'] && $this->forum['threadtypes']['required'] && !$this->param['special']) {
         return $this->showmessage('post_type_isnull');
     }
     if (!$this->param['sortid'] && $this->forum['threadsorts']['required'] && !$this->param['special']) {
         return $this->showmessage('post_sort_isnull');
     }
     if (!$this->param['special'] && $this->param['price'] > 0 && floor($this->param['price'] * (1 - $this->setting['creditstax'])) == 0) {
         return $this->showmessage('post_net_price_iszero');
     }
     $this->param['sortid'] = $this->param['special'] && $this->forum['threadsorts']['types'][$this->param['sortid']] ? 0 : $this->param['sortid'];
     $this->param['typeexpiration'] = intval($this->param['typeexpiration']);
     if ($this->forum['threadsorts']['expiration'][$this->param['typeid']] && !$this->param['typeexpiration']) {
         return $this->showmessage('threadtype_expiration_invalid');
     }
     $author = !$this->param['isanonymous'] ? $this->member['username'] : '';
     $this->param['moderated'] = $this->param['digest'] || $this->param['displayorder'] > 0 ? 1 : 0;
     $this->param['ordertype'] && ($this->param['tstatus'] = setstatus(4, 1, $this->param['tstatus']));
     $this->param['imgcontent'] && ($this->param['tstatus'] = setstatus(15, $this->param['imgcontent'], $this->param['tstatus']));
     $this->param['hiddenreplies'] && ($this->param['tstatus'] = setstatus(2, 1, $this->param['tstatus']));
     $this->param['allownoticeauthor'] && ($this->param['tstatus'] = setstatus(6, 1, $this->param['tstatus']));
     $this->param['isgroup'] = $this->forum['status'] == 3 ? 1 : 0;
     $this->param['publishdate'] = !$this->param['modnewthreads'] ? $this->param['publishdate'] : TIMESTAMP;
     $newthread = array('fid' => $this->forum['fid'], 'posttableid' => 0, 'readperm' => $this->param['readperm'], 'price' => $this->param['price'], 'typeid' => $this->param['typeid'], 'sortid' => $this->param['sortid'], 'author' => $author, 'authorid' => $this->member['uid'], 'subject' => $this->param['subject'], 'dateline' => $this->param['publishdate'], 'lastpost' => $this->param['publishdate'], 'lastposter' => $author, 'displayorder' => $this->param['displayorder'], 'digest' => $this->param['digest'], 'special' => $this->param['special'], 'attachment' => 0, 'moderated' => $this->param['moderated'], 'status' => $this->param['tstatus'], 'isgroup' => $this->param['isgroup'], 'replycredit' => $this->param['replycredit'], 'closed' => $this->param['closed'] ? 1 : 0);
     $this->tid = C::t('forum_thread')->insert($newthread, true);
     C::t('forum_newthread')->insert(array('tid' => $this->tid, 'fid' => $this->forum['fid'], 'dateline' => $this->param['publishdate']));
     useractionlog($this->member['uid'], 'tid');
     if (!getuserprofile('threads') && $this->setting['newbie']) {
         C::t('forum_thread')->update($this->tid, array('icon' => $this->setting['newbie']));
     }
     if ($this->param['publishdate'] != TIMESTAMP) {
         $cron_publish_ids = dunserialize($this->cache('cronpublish'));
         $cron_publish_ids[$this->tid] = $this->tid;
         $cron_publish_ids = serialize($cron_publish_ids);
         savecache('cronpublish', $cron_publish_ids);
     }
     if (!$this->param['isanonymous']) {
         C::t('common_member_field_home')->update($this->member['uid'], array('recentnote' => $this->param['subject']));
     }
     if ($this->param['moderated']) {
         updatemodlog($this->tid, $this->param['displayorder'] > 0 ? 'STK' : 'DIG');
         updatemodworks($this->param['displayorder'] > 0 ? 'STK' : 'DIG', 1);
     }
     $this->param['bbcodeoff'] = checkbbcodes($this->param['message'], !empty($this->param['bbcodeoff']));
     $this->param['smileyoff'] = checksmilies($this->param['message'], !empty($this->param['smileyoff']));
     $this->param['parseurloff'] = !empty($this->param['parseurloff']);
     $this->param['htmlon'] = $this->group['allowhtml'] && !empty($this->param['htmlon']) ? 1 : 0;
     $this->param['usesig'] = !empty($this->param['usesig']) && $this->group['maxsigsize'] ? 1 : 0;
     $class_tag = new tag();
     $this->param['tagstr'] = $class_tag->add_tag($this->param['tags'], $this->tid, 'tid');
     $this->param['pinvisible'] = $this->param['modnewthreads'] ? -2 : (empty($this->param['save']) ? 0 : -3);
     $this->param['message'] = preg_replace('/\\[attachimg\\](\\d+)\\[\\/attachimg\\]/is', '[attach]\\1[/attach]', $this->param['message']);
     $this->param['pstatus'] = intval($this->param['pstatus']);
     defined('IN_MOBILE') && ($this->param['pstatus'] = setstatus(4, 1, $this->param['pstatus']));
     if ($this->param['imgcontent']) {
         stringtopic($this->param['message'], $this->tid, true, $this->param['imgcontentwidth']);
     }
     $this->pid = insertpost(array('fid' => $this->forum['fid'], 'tid' => $this->tid, 'first' => '1', 'author' => $this->member['username'], 'authorid' => $this->member['uid'], 'subject' => $this->param['subject'], 'dateline' => $this->param['publishdate'], 'message' => $this->param['message'], 'useip' => $this->param['clientip'] ? $this->param['clientip'] : getglobal('clientip'), 'port' => $this->param['remoteport'] ? $this->param['remoteport'] : getglobal('remoteport'), 'invisible' => $this->param['pinvisible'], 'anonymous' => $this->param['isanonymous'], 'usesig' => $this->param['usesig'], 'htmlon' => $this->param['htmlon'], 'bbcodeoff' => $this->param['bbcodeoff'], 'smileyoff' => $this->param['smileyoff'], 'parseurloff' => $this->param['parseurloff'], 'attachment' => '0', 'tags' => $this->param['tagstr'], 'replycredit' => 0, 'status' => $this->param['pstatus']));
     $statarr = array(0 => 'thread', 1 => 'poll', 2 => 'trade', 3 => 'reward', 4 => 'activity', 5 => 'debate', 127 => 'thread');
     include_once libfile('function/stat');
     updatestat($this->param['isgroup'] ? 'groupthread' : $statarr[$this->param['special']]);
     if ($this->param['geoloc'] && IN_MOBILE == 2) {
         list($mapx, $mapy, $location) = explode('|', $this->param['geoloc']);
         if ($mapx && $mapy && $location) {
             C::t('forum_post_location')->insert(array('pid' => $this->pid, 'tid' => $this->tid, 'uid' => $this->member['uid'], 'mapx' => $mapx, 'mapy' => $mapy, 'location' => $location));
         }
     }
     if ($this->param['modnewthreads']) {
         updatemoderate('tid', $this->tid);
         C::t('forum_forum')->update_forum_counter($this->forum['fid'], 0, 0, 1);
         manage_addnotify('verifythread');
         return 'post_newthread_mod_succeed';
     } else {
         if ($this->param['displayorder'] != -4) {
             if ($this->param['digest']) {
                 updatepostcredits('+', $this->member['uid'], 'digest', $this->forum['fid']);
             }
             updatepostcredits('+', $this->member['uid'], 'post', $this->forum['fid']);
             if ($this->param['isgroup']) {
                 C::t('forum_groupuser')->update_counter_for_user($this->member['uid'], $this->forum['fid'], 1);
             }
             $subject = str_replace("\t", ' ', $this->param['subject']);
             $lastpost = "{$this->tid}\t" . $subject . "\t" . TIMESTAMP . "\t{$author}";
             C::t('forum_forum')->update($this->forum['fid'], array('lastpost' => $lastpost));
             C::t('forum_forum')->update_forum_counter($this->forum['fid'], 1, 1, 1);
             if ($this->forum['type'] == 'sub') {
                 C::t('forum_forum')->update($this->forum['fup'], array('lastpost' => $lastpost));
             }
         }
         if ($this->param['isgroup']) {
             C::t('forum_forumfield')->update($this->forum['fid'], array('lastupdate' => TIMESTAMP));
             require_once libfile('function/grouplog');
             updategroupcreditlog($this->forum['fid'], $this->member['uid']);
         }
         C::t('forum_sofa')->insert(array('tid' => $this->tid, 'fid' => $this->forum['fid']));
         return 'post_newthread_succeed';
     }
 }
コード例 #29
0
<?php

// This file is part of the ProEthos Software.
//
// Copyright 2013, PAHO. All rights reserved. You can redistribute it and/or modify
// ProEthos under the terms of the ProEthos License as published by PAHO, which
// restricts commercial use of the Software.
//
// ProEthos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
// PARTICULAR PURPOSE. See the ProEthos License for more details.
//
// You should have received a copy of the ProEthos License along with the ProEthos
// Software. If not, see
// https://raw.githubusercontent.com/bireme/proethos/master/LICENSE.txt
require "db.php";
require "_class/_class_message.php";
$file = 'messages/msg_' . $LANG . '.php';
if (file_exists($file)) {
    require $file;
} else {
    echo 'message not found ' . $file;
}
require $include . 'sisdoc_data.php';
$check = $dd[90];
$chk = checkpost($dd[0] . $secu);
if ($check == $chk) {
    require "submit_pdf_projeto.php";
} else {
    echo '<font color="red">CSRF Injection</font>';
}
コード例 #30
-1
ファイル: HotAction.class.php プロジェクト: laiello/qinhan
 public function photo_ping()
 {
     if (!checkpost()) {
         exit('error');
     }
     if (!$GLOBALS['islogin']) {
         exit('{"stat":9, "errno":"未登录", "error":"未登录}');
     }
     $msgModel = D('Msg');
     $u = $msgModel->check_contact('uid', 'uid');
     $photo = M('photo');
     $pid = postvar('photo_id', 1);
     $p = $photo->where("uid={$u['uid']} AND pid={$pid}")->find();
     //echo $photo->getLastSql();
     if (!$p) {
         exit('error');
     }
     $data['pid'] = $pid;
     $data['photo_uid'] = $u['uid'];
     $data['uid'] = $GLOBALS['i']['uid'];
     $data['add_time'] = time();
     $photo_hot = M('photo_hot');
     $hot = $photo_hot->where($data)->find();
     if ($hot) {
         exit('hot yet');
     }
     $score = floatval(postvar('score'));
     $data['score'] = $score;
     $photo_hot->add($data);
     $edit['score'] = ($data['score'] - $p['score']) / ($p['score_num'] + 1) + $p['score'];
     $edit['score_num'] = array('exp', 'score_num+1');
     $photo->where("uid={$u['uid']} AND pid={$pid}}")->save($edit);
     echo '{"stat":1,"ping_score":"' . $p['score'] . '","errno":""}';
 }