当前位置: 首页>>代码示例>>PHP>>正文


PHP add_comment函数代码示例

本文整理汇总了PHP中add_comment函数的典型用法代码示例。如果您正苦于以下问题:PHP add_comment函数的具体用法?PHP add_comment怎么用?PHP add_comment使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了add_comment函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_comments

function get_comments($file_id)
{
    include 'database.php';
    $result = mysqli_query($connect, "SELECT * FROM `comments` WHERE `file_id`='{$file_id}' AND `is_child`=FALSE ORDER BY `date` DESC");
    $row_cnt = mysqli_num_rows($result);
    echo '<h1>Comments (' . $row_cnt . ')</h1>';
    echo '<div class="comment">';
    new_comment();
    echo '</div>';
    foreach ($result as $item) {
        $date = new dateTime($item['date']);
        $date = date_format($date, 'M j, Y | H:i:s');
        $auth = $item['author'];
        $par_code = $item['com_code'];
        $chi_result = mysqli_query($connect, "SELECT * FROM `comments` WHERE `par_code`='{$par_code}' AND `is_child`=TRUE");
        $chi_cnt = mysqli_num_rows($chi_result);
        echo '<div class="comment" name="' . $item['com_code'] . '">' . '<span class="author">' . $auth . '</span><br />' . $item['comment'] . '<br />' . '<span class="date">Posted: ' . $date . '</span><br />';
        if ($chi_cnt == 0) {
            echo '<span class="replies">No replies</span>' . '<span class="replies">&emsp;Reply</span>';
        } else {
            echo '<span class="replies">[+] ' . $chi_cnt . ' replies</span>' . '<span class="replies"&emsp;Reply</span>';
            add_comment($item['author'], $item['com_code']);
            echo '<div name="children" id="children">';
            foreach ($chi_result as $com) {
                $chi_date = new dateTime($com['date']);
                $chi_date = date_format($chi_date, 'M j, Y | H:i:s');
                echo '<div class="child" name="' . $com['com_code'] . '">' . '<span class="author">' . $com['author'] . '</span><br />' . $com['comment'] . '<br />' . '<span class="date">Posted: ' . $chi_date . '</span><br />' . '</div>';
            }
            echo '</div>';
        }
        echo '</div>';
    }
    mysqli_close($connect);
}
开发者ID:jahanzaibbahadur,项目名称:comment-system,代码行数:34,代码来源:functions.php

示例2: module_info_main

function module_info_main()
{
    switch (post('cmd')) {
        case 'add_message':
            add_message();
            break;
        case 'add_comment':
            add_comment();
            break;
    }
}
开发者ID:jechiy,项目名称:xiu-cms,代码行数:11,代码来源:info_main.php

示例3: die

<?php

if (!defined("_BASE_URL")) {
    die("Pirate reconnu !");
}
if (!empty($_SESSION['user_ID']) && !empty($_SESSION['team_ID'])) {
    if (!empty($_GET['projet'])) {
        if (!isset($_POST['bug_ID'])) {
            header('Location: ?module=home');
        } else {
            if ($_POST['com_content'] == "") {
                header('Location: ?module=bug&action=simple-bug&projet=' . $_GET['projet'] . '&bugid=' . $_POST['bug_ID'] . '&notif=empty');
            } else {
                require_once 'model/comment/add-comment.php';
                $form = $_POST;
                $form['com_date'] = date('Y-m-d');
                $form['user_ID'] = $_SESSION['user_ID'];
                $com = add_comment($form);
                if ($com) {
                    header('Location: ?module=bug&action=simple-bug&projet=' . $_GET['projet'] . '&bugid=' . $_POST['bug_ID'] . '&notif=com_add');
                } else {
                    header('Location: ?module=bug&action=simple-bug&projet=' . $_GET['projet'] . '&bugid=' . $_POST['bug_ID'] . '&notif=com_bug');
                }
            }
        }
    } else {
        header('Location: ?module=home');
    }
} else {
    header('Location: ?module=auth');
}
开发者ID:xeewi,项目名称:xwBugTracker,代码行数:31,代码来源:add-comment.php

示例4: setInfoJigoshop

 protected function setInfoJigoshop()
 {
     include_once PLUGIN_PATH_SHIPWORKSWORDPRESS . 'functions/jigoshop/functionsJigoshop.php';
     global $wpdb;
     $status = $this->status;
     $table = $wpdb->prefix . "term_taxonomy";
     $row = $wpdb->get_row("SELECT * FROM " . $table . " WHERE term_id = " . $status, ARRAY_A);
     $table = $wpdb->prefix . "term_relationships";
     $this->result = $wpdb->update($table, array('term_taxonomy_id' => $row['term_taxonomy_id']), array('object_id' => $this->order));
     if ($this->result === false) {
         $this->code = 'ERR004';
         $this->description = "The Status coudn't be update in the database";
     } else {
         if ($this->comment != '') {
             add_comment($this->comment, $this->order);
         }
     }
 }
开发者ID:bear12345678,项目名称:keylessoption,代码行数:18,代码来源:StatusManager.class.php

示例5: trim

<?php

if (isset($_POST['post'])) {
    $user = trim($_POST['name']);
    $comments = trim($_POST['comments']);
    if (!empty($user) and !empty($comments)) {
        add_comment($page, $user, $comments);
    }
}
$comments = get_comments($page);
?>


<html>
	<head>
		<style>
			/*td{width:120px;}*/
			.form-group {
				max-width: 330px;
				padding: 15px;
				margin: 0 auto;
			}
			.comment {color:black;}
			.date {font-size:1.0em;color:green;}
			.name {color:blue;} 
		</style>
	</head>
	<body>
	<div style="margin:0 auto; padding:10px 0 10px 0; background-color:#3399ff; border: #fff 2px solid; padding:24px; filter:alpha(opacity=10); -moz-opacity=.7; opacity:.9; border-radius:20px;">
		<table border="0" class="table table-striped">
		<caption><b><font style="color:green;">&nbsp;&nbsp;&nbsp;Educational Bakground:</font></b></caption>
开发者ID:Jack082595,项目名称:PHP_PROJECT,代码行数:31,代码来源:education.php

示例6: intval

    $url = $_POST["url"];
} else {
    if (check_url($_POST["url"]) == "nohttp") {
        $url = "http://" . $_POST["url"];
    } else {
        $url = "";
    }
}
global $config;
$parent_id = intval($_POST["parent"]);
require_once 'plog-functions.php';
$redirect = str_replace("&amp;", "&", generate_url("picture", $parent_id, array(), true));
// If the captcha is required, check it here
if ($_SESSION['require_captcha'] == true) {
    if ($_POST['captcha'] != $_SESSION['captcha'] || !$_POST['captcha']) {
        $_SESSION["comment_post_error"] = "CAPTCHA check failed!";
        header("Location: {$redirect}");
        exit;
    }
}
$rv = add_comment($parent_id, $_POST["author"], $_POST["email"], $url, $_POST["comment"]);
// redirect back to picture page
if ($rv["errors"]) {
    // will this work?
    $_SESSION["comment_post_error"] = $rv["errors"];
} else {
    if ($config['comments_moderate']) {
        $_SESSION["comment_moderated"] = 1;
    }
}
header("Location: {$redirect}");
开发者ID:alanhaggai,项目名称:plogger,代码行数:31,代码来源:plog-comment.php

示例7: AND

                            if ($_SESSION['user_id'] > 0) {
                                $sql = "SELECT o.order_id" . " FROM " . $ecs->table('order_info') . " AS o, " . $ecs->table('order_goods') . " AS og " . " WHERE o.order_id = og.order_id" . " AND o.user_id = '" . $_SESSION['user_id'] . "'" . " AND og.goods_id = '" . $cmt->id . "'" . " AND (o.order_status = '" . OS_CONFIRMED . "' or o.order_status = '" . OS_SPLITED . "') " . " AND (o.pay_status = '" . PS_PAYED . "' OR o.pay_status = '" . PS_PAYING . "') " . " AND (o.shipping_status = '" . SS_SHIPPED . "' OR o.shipping_status = '" . SS_RECEIVED . "') " . " LIMIT 1";
                                $tmp = $db->getOne($sql);
                                if (empty($tmp)) {
                                    $result['error'] = 1;
                                    $result['message'] = $_LANG['comment_brought'];
                                }
                            } else {
                                $result['error'] = 1;
                                $result['message'] = $_LANG['comment_brought'];
                            }
                    }
                }
                /* 无错误就保存留言 */
                if (empty($result['error'])) {
                    add_comment($cmt);
                    $_SESSION['send_time'] = $cur_time;
                }
            }
        }
    }
} else {
    /*
     * act 参数不为空
     * 默认为评论内容列表
     * 根据 _GET 创建一个静态对象
     */
    $cmt = new stdClass();
    $cmt->id = !empty($_GET['id']) ? intval($_GET['id']) : 0;
    $cmt->type = !empty($_GET['type']) ? intval($_GET['type']) : 0;
    $cmt->page = isset($_GET['page']) && intval($_GET['page']) > 0 ? intval($_GET['page']) : 1;
开发者ID:ChanHarold,项目名称:ecshop,代码行数:31,代码来源:comment.php

示例8: htmlentities

    if (isset($_GET['id'])) {
        $id = htmlentities($_GET['id']);
    } else {
        if (isset($_POST['id'])) {
            $id = htmlentities($_POST['id']);
        }
    }
    // Get the details of the risk
    $risk = get_risk_by_id($id);
    $subject = htmlentities($risk[0]['subject']);
}
// Check if a new risk mitigation was submitted
if (isset($_POST['submit'])) {
    $comment = addslashes($_POST['comment']);
    // Add the comment
    add_comment($id, $_SESSION['uid'], $comment);
    // Audit log
    $risk_id = $id;
    $message = "A comment was added to risk ID \"" . $risk_id . "\" by username \"" . $_SESSION['user'] . "\".";
    write_log($risk_id, $_SESSION['uid'], $message);
    // Redirect to plan mitigations page
    header('Location: /management/view.php?id=' . $id . '&comment=true');
}
?>

<!doctype html>
<html>
  
  <head>
    <script src="/js/jquery.min.js"></script>
    <script src="/js/bootstrap.min.js"></script>
开发者ID:google-code-backups,项目名称:simplerisk,代码行数:31,代码来源:comment.php

示例9: header

<?php

header('Location:search_post.php');
require_once 'db.php';
// this is a person.
if (count($_POST) != 0) {
    if (isset($_POST['action']) && $_POST['action'] == 'comment') {
        add_comment($_GET['id'], $_POST);
    } elseif (isset($_POST['action']) && $_POST['action'] == 'photo') {
        handle_upload($_GET['id']);
    } else {
        update_record($_GET['id'], $_POST);
    }
}
if (!isset($_GET['id'])) {
    header('Location: /');
    exit;
}
$person = load_record($_GET['id']);
if (empty($person)) {
    header('Location: /');
    exit;
}
$updates = get_updates($_GET['id']);
$comments = get_comments($_GET['id']);
$photos = get_photos($_GET['id']);
$searcher = get_searcher($_GET['id']);
$title = $person['fullname'];
//$title = msg('People');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
开发者ID:rmunro,项目名称:SMS-Turks,代码行数:31,代码来源:person.php

示例10: get_post_by_id

$post_id = $_GET['id'];
$post = get_post_by_id($post_id);
if (!$post) {
    display_not_found_page();
}
$comments = get_post_comments($post_id);
$comment_text = '';
$errors = [];
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $comment_text = $_POST['comment'];
    if ($comment_text == '') {
        $errors[] = "Коментар не може бути порожнім.";
    }
    if (!$errors) {
        $user_id = get_current_user_id();
        add_comment($post_id, $user_id, $comment_text);
        redirect(APP_URL . '/view_post.php?id=' . $post_id);
    }
}
?>

<!DOCTYPE html>
<head>
    <meta charset="utf-8">
    <title>Tubogram</title>
    <?php 
echo js_and_css();
?>
</head>

<?php 
开发者ID:afalina,项目名称:Tubogram,代码行数:31,代码来源:view_post.php

示例11: add_poll_comment

                            add_poll_comment($poll, $comment);
                            $result = "<p>" . get_text('Comment_added_successfully') . "</p>";
                        }
                    } else {
                        if (isset($_POST['save_questions'])) {
                            change_poll_status($poll, 'Opgeslagen');
                            if (isset($_POST['comment']) && !empty($_POST['comment']) && trim($_POST['comment']) != '') {
                                $comment = $_POST['comment'];
                                add_poll_comment($poll, $comment);
                                $result = "<p>" . get_text('Comment_added_successfully') . "</p>";
                            }
                            $result = "<p>" . get_text('Poll_saved_successfully') . "</p>";
                        }
                    }
                } else {
                    add_comment($reviewee_id, $_POST['comment']);
                }
            }
            ?>
                <div class="topContent">
                    <?php 
            if ($result) {
                echo $result;
            }
            ?>
                    <p><?php 
            echo get_text('Click_next_to_select_new_poll');
            ?>
</p>

                    <p><?php 
开发者ID:google-code-backups,项目名称:threesixtieweb,代码行数:31,代码来源:index.php

示例12: die

(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR  TORT 
(INCLUDING  NEGLIGENCE  OR  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
if (!(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest')) {
    die("Call not allowed");
}
//
// Change this email to the real moderator's email
//
$moderator_email = "jswidget@gmail.com";
$flag = processText($_POST["flag"]);
if ($flag === "1") {
    add_comment($moderator_email);
}
if ($flag === "2") {
    read_comment();
}
function strleft($s1, $s2)
{
    return substr($s1, 0, strpos($s1, $s2));
}
function add_comment($moderator_email)
{
    $caller = strtolower($_POST["url"]);
    //$_SERVER['HTTP_REFERER'];
    $filename = md5($caller);
    $abs_comment_file = realpath('.') . '/' . $filename . '.xml';
    $date_value = time();
开发者ID:rahul1205,项目名称:summerproject,代码行数:31,代码来源:ec-comment.php

示例13: trim

     }
     $callback = trim($_REQUEST['callback']);
     $json = $callback . '({
                     "proposals": 
             ';
     $json .= $response;
     $json .= '})';
     echo $json;
     break;
 case "check_user_status":
     echo check_user_status($_REQUEST['phone'], $_REQUEST['client_id'], $_REQUEST['callback']);
     break;
     //**********************COMMENTS******************************************************************************
 //**********************COMMENTS******************************************************************************
 case "add_comment":
     $valid = add_comment($_REQUEST['aid'], $_REQUEST['username'], $_REQUEST['comment'], @$_REQUEST['client_id']);
     $response = '{"success":"1","message":"success"}';
     if (!$valid) {
         $response = $callback . '({"proposals":{"success":"0","message":"failed"}})';
     } else {
         $response = get_comments_article($_REQUEST['aid'], @$_REQUEST['callback']);
     }
     echo $response;
     break;
 case "get_comments_article":
     $response = get_comments_article($_REQUEST['aid']);
     echo $response;
     break;
 case "delete_comment":
     $valid = delete_comment($_REQUEST['comment_id'], $_REQUEST['uid']);
     $response = '{"success":"1","message":"success"}';
开发者ID:arh922,项目名称:ain,代码行数:31,代码来源:index.php

示例14: comment_add

function comment_add()
{
    date_default_timezone_set('PRC');
    // 中国时区
    if (add_comment(user_name(), _post('content'), date('Y-m-d H:i:s'), _post('tid')) > 0) {
        return ajax_echo('评论成功');
    }
}
开发者ID:Ethennoob,项目名称:flat,代码行数:8,代码来源:common.function.php

示例15: defined

<?php

defined("CATALOG") or die("Access denied");
include 'models/main_model.php';
include "models/{$view}_model.php";
echo add_comment();
开发者ID:dimonoov,项目名称:catalog.loc,代码行数:6,代码来源:add_comment_controller.php


注:本文中的add_comment函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。