コード例 #1
0
ファイル: delete_comment.php プロジェクト: rratcliffe/fsen
if (!fse_try_to_login()) {
    $ret_info->detail = t('Not signed in.');
    echo $json->encode($ret_info);
    exit(0);
}
if (!in_array($domain_handle, ProjectInfo::$mDomainList)) {
    $ret_info->detail = t('Bad domain');
    echo $json->encode($ret_info);
    exit(0);
}
if (!preg_match("/^[a-f0-9]{32}\$/", $section_id)) {
    $ret_info->detail = t('Bad section');
    echo $json->encode($ret_info);
    exit(0);
}
$comment_info = DocSectionManager::getCommentInfo($domain_handle, $section_id, $comment_id);
if ($comment_info == false) {
    $ret_info->detail = t('Not existed comment.');
    echo $json->encode($ret_info);
    exit(0);
}
if ($_SESSION['FSEInfo']['fse_id'] != $comment_info['author_id']) {
    $ret_info->detail = t('Not the author.');
    echo $json->encode($ret_info);
    exit(0);
}
$section_info = DocSectionManager::cancelComment($domain_handle, $section_id, $comment_id);
if ($section_info == false) {
    $ret_info->detail = t('Unknown error.');
    echo $json->encode($ret_info);
    exit(0);