Exemple #1
0
list($author, $subject, $email, $body) = censor($author, $subject, $email, $body);
if (!get_magic_quotes_gpc()) {
    $author = addslashes($author);
    $email = addslashes($email);
    $subject = addslashes($subject);
    $body = addslashes($body);
}
$datestamp = date("Y-m-d H:i:s");
$plain_author = stripslashes($author);
$plain_subject = stripslashes(strip_tags($subject));
$plain_body = stripslashes(strip_tags($body));
$author = htmlspecialchars($author);
$email = htmlspecialchars($email);
$subject = htmlspecialchars($subject);
$more = "";
if (!check_dup() && check_parent($parent)) {
    // generate a message id for the email if needed.
    $msgid = "<" . md5(uniqid(rand())) . "." . eregi("[^A-Z0-9]", "", $ForumName) . ">";
    // add the users signature if requested
    if (isset($use_sig)) {
        $body .= "\n\n" . PHORUM_SIG_MARKER;
    }
    // This will add the message to the database, and email the
    // moderator if required.
    $id = post_to_database();
    if (!$id) {
        echo $error;
        exit;
    }
    // mark this message as read in their cookies since they wrote it.
    $haveread_cookie = "phorum-haveread-{$ForumTableName}";
Exemple #2
0
 protected function _handle(&$req)
 {
     //just add method map here
     $tm = $_SERVER['REQUEST_TIME'];
     $method = $req['m'];
     $mypre = $method;
     $log_nok = false;
     if (array_key_exists($method, self::$log_NOK_methods)) {
         $log_nok = true;
     }
     $req['p']['_cid'] = $req['cid'];
     $u = $req['p']['u'];
     if (!$log_nok) {
         if (check_dup($u, $req['cid'], $ret)) {
             TTLog::record(array('s' => 'dup', 'm' => $method, 'tm' => $tm, 'u' => $u, 'p' => $this->_raw_reg));
             return $ret;
         }
     }
     if ($this->_debug) {
         CrabTools::mydump($req['p'], REQ_DATA_ROOT . $mypre . '.param');
     }
     if (isset(self::$exist_methods[$method])) {
         $caller =& self::$exist_methods[$method];
         $c =& $caller[0];
         $m = $caller[1];
     } else {
         $caller = explode('.', $method);
         $cn = $caller[0];
         $m = $caller[1];
         $file = CONTROLLER_ROOT . "{$cn}.php";
         if (!file_exists($file)) {
             throw new JsonServerExecption("method {$method} file not exist:(" . CONTROLLER_ROOT . "{$cn}.php)");
         }
         @(require_once $file);
         $c = new $cn();
         if (!method_exists($c, $m)) {
             throw new JsonServerExecption("{$cn} don't has callable method {$m}");
         }
     }
     try {
         $ret = $c->{$m}($req['p']);
         //for debug
         if (isset(self::$record_users[$u])) {
             $dt = TT::get_tt('debug');
             $dt->needSV = true;
             $dt->put(array('m' => $method, 'tm' => $_SERVER['REQUEST_TIME'], 'in' => $req['p'], 'out' => $ret));
         }
         if (!$u) {
             $u = 'nouser';
         }
     } catch (Exception $e) {
         $r['s'] = 'exc';
         $r['msg'] = $e->getMessage();
         $r['exce'] = $e->getTrace();
         error_log($method . ':' . $r['msg']);
     }
     if ($this->_debug) {
         CrabTools::myprint($ret, REQ_DATA_ROOT . $mypre . '.resp');
     }
     if (!$ret) {
         $ret['s'] = "KO";
         $ret['msg'] = "{$cn}::{$m} return null";
     }
     if ($log_nok) {
         if ($ret['s'] != 'OK') {
             TTLog::record(array('s' => 'OK', 'm' => $method, 'tm' => $tm, 'u' => $u, 'p' => $this->_raw_reg));
         }
     } else {
         if (!array_key_exists($m, self::$nolog_methods)) {
             TTLog::record(array('s' => $ret['s'], 'm' => $method, 'tm' => $tm, 'u' => $u, 'p' => $this->_raw_reg));
         }
     }
     return $ret;
 }
Exemple #3
0
    $body = addslashes($body);
}
$datestamp = date("Y-m-d H:i:s");
$plain_author = stripslashes($author);
$plain_subject = stripslashes(strip_tags($subject));
$plain_body = stripslashes(strip_tags($body));
$author = htmlspecialchars($author);
$email = htmlspecialchars($email);
$subject = htmlspecialchars($subject);
$checkfrozen = true;
$threadflags = 0;
if (!empty($phorum_user["moderator"])) {
    $checkfrozen = false;
}
$more = "";
if (!check_dup() && check_parent($parent, $thread, $checkfrozen)) {
    // check_parent will also set "$threadflags"
    // generate a message id for the email if needed.
    $msgid = "<" . md5(uniqid(rand())) . "." . eregi("[^A-Z0-9]", "", $ForumName) . ">";
    // add the users signature if requested
    if (isset($use_sig)) {
        $body .= "\n\n" . PHORUM_SIG_MARKER;
    }
    // This will add the message to the database, and email the
    // moderator if required.
    $id = post_to_database();
    if (!$id) {
        echo $error;
        exit;
    }
    // mark this message as read in their cookies since they wrote it.