• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP comments类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: run

 public function run()
 {
     $tpl = new template();
     $id = (int) $_GET['id'];
     if ($id > 0) {
         $lead = $this->getLead($id);
         // Comments
         $comments = new comments();
         if (isset($_POST['comment']) === true) {
             $values = array('text' => $_POST['text'], 'date' => date("Y-m-d H:i:s"), 'userId' => $_SESSION['userdata']['id'], 'moduleId' => $id, 'commentParent' => $_POST['father']);
             $comments->addComment($values, 'lead');
         }
         // files
         $file = new files();
         if (isset($_POST['upload'])) {
             if (isset($_FILES['file'])) {
                 $file->upload($_FILES, 'lead', $id);
                 $tpl->setNotification('FILE_UPLOADED', 'success');
             } else {
                 $tpl->setNotification('NO_FILE', 'error');
             }
         }
         $files = new files();
         $tpl->assign('files', $files->getFilesByModule('lead', $id));
         $tpl->assign('comments', $comments->getComments('lead', $id));
         $tpl->assign('contactInfo', $this->getLeadContact($id));
         $tpl->assign('lead', $lead);
     } else {
         $tpl->display('general.error');
     }
     $tpl->display('leads.showLead');
 }
开发者ID:DevelopIdeas,项目名称:leantime,代码行数:32,代码来源:class.showLead.php


示例2: new_comment

 public function new_comment()
 {
     if (!isset($_SESSION['uid'])) {
         echo 1;
         return;
     }
     $type = $_POST['type'];
     $post_id = $_POST['post_id'];
     $author_id = $_SESSION['uid'];
     $content = '';
     if ($type == 1) {
         $content = $_POST['content'];
     } else {
         if ($type == 2) {
             if ($_FILES['file']['error'] > 0) {
                 echo 2;
                 return;
             } else {
                 $arr = split('.', $_FILES['file']['name']);
                 $suffix = $arr[1];
                 $des = 'upload/' . time() . $suffix;
                 move_uploaded_file($_FILES['file']['tmp_name'], $des);
                 $content = $des;
             }
         }
     }
     $comment = new comments();
     $suc = $comment->insert($type, $post_id, $author_id, $content);
     echo $suc ? 0 : 1;
     return;
 }
开发者ID:FebV,项目名称:forum,代码行数:31,代码来源:commentController.php


示例3: actionIndex

 public function actionIndex()
 {
     if (isset(yii::$app->request->isAjax)) {
         $page_id = yii::$app->request->get('page_id');
         $comments = new comments();
         $commentsItems = $comments->GetComments($page_id);
         $data['items'] = $commentsItems['items'];
         $data['pagination'] = $commentsItems['pagination'];
         return $this->renderAjax('index', $data);
     }
 }
开发者ID:developer-home,项目名称:project777,代码行数:11,代码来源:CommentsController.php


示例4: content_showcomments

function content_showcomments($id)
{
    global $set, $db, $apx, $user;
    $res = $db->first("SELECT allowcoms FROM " . PRE . "_content WHERE ( id='" . $id . "' AND active='1' " . section_filter() . " ) LIMIT 1");
    if (!$apx->is_module('comments') || !$set['content']['coms'] || !$res['allowcoms']) {
        return;
    }
    require_once BASEDIR . getmodulepath('comments') . 'class.comments.php';
    $coms = new comments('content', $id);
    $coms->assign_comments();
    $apx->tmpl->parse('comments', 'comments');
    require 'lib/_end.php';
}
开发者ID:bigfraggle,项目名称:open-apexx,代码行数:13,代码来源:functions.php


示例5: getPostComments

 function getPostComments($dbh, $id)
 {
     $stmt = $dbh->prepare("select * from " . comments::$table_name . " WHERE postid = :postid ORDER BY id;");
     $stmt->bindParam(":postid", $id);
     $stmt->execute();
     $result = array();
     while ($row = $stmt->fetch()) {
         $p = new comments();
         $p->copyFromRow($row);
         $result[] = $p;
     }
     return $result;
 }
开发者ID:kelmo2,项目名称:leagueOfLegendsClubSite,代码行数:13,代码来源:comments.php


示例6: index

 function index()
 {
     if (isset($this->args[0]) && $this->args[0] != "index") {
         system::setParam("page", "layout");
         $cacheID = $this->args[0] . "|ARTICLE";
         $this->smarty->setCacheID($cacheID);
         if (isset($_POST["contentID"]) && $_POST["contentID"]) {
             comments::add(intval($_POST["contentID"]));
         }
         $this->smarty->assign("isFav", blog::isFavorite($this->args[0]));
         if (!$this->smarty->isCached()) {
             $sqlData = blog::getOnePost($this->args[0], "article")->fetch();
             if ($sqlData) {
                 $this->smarty->assign("comments", comments::get(intval($sqlData["contentID"])));
                 $this->smarty->assign("post", $sqlData);
             }
         }
     } else {
         $offset = 1;
         system::setParam("page", "list");
         if (isset($this->get["offset"])) {
             $offset = intval($this->get["offset"]);
         }
         $cacheID = "ARTICLES|artoffset_{$offset}";
         $this->smarty->setCacheID($cacheID);
         if (!$this->smarty->isCached()) {
             $allCount = $this->db->query("SELECT COUNT(*) as cnt FROM `content` WHERE `type`='article'")->fetch();
             $this->smarty->assign("posts", news::getPosts(core::pagination($allCount["cnt"], $offset), "article")->fetchAll());
         }
     }
 }
开发者ID:ygres,项目名称:sblog,代码行数:31,代码来源:index.php


示例7: actionDetail

 public function actionDetail()
 {
     $model = $this->GetModel();
     $properties = new Properties();
     $options = new Options();
     $comments = new comments();
     $this->blog = $model::findOne($this->item->parent_id);
     $this->name = $options->GetOptions('name');
     $data['options'] = $options;
     $data['properties'] = $properties;
     $data['comments'] = $comments;
     $data['value'] = $this->item;
     $commentsItems = $comments->GetComments($this->item->id);
     $data['commentsItems'] = $commentsItems['items'];
     $data['commentsPager'] = $commentsItems['pagination'];
     return $this->render('detail', $data);
 }
开发者ID:developer-home,项目名称:project777,代码行数:17,代码来源:BaseController.php


示例8: get

 /**
  * Get a news post.
  * 
  * @param string $id The news id.
  * @param bool $idlib True if the Id library should be used (False for MongoIds)
  * @param bool $justOne True if only one entry should be returned.
  * @param bool $fixUTF8 True if UTF8 should be decoded.
  * 
  * @return mixed The news post as an array, or an error string.
  */
 protected function get($id, $idlib = true, $justOne = false, $fixUTF8 = true, $page = 1, $limit = self::PER_PAGE)
 {
     $query = array('ghosted' => false);
     if ($idlib) {
         $keys = Id::dissectKeys($id, 'news');
         $query['date'] = array('$gte' => $keys['date'], '$lte' => $keys['date'] + $keys['ambiguity']);
     } else {
         $query['_id'] = $this->_toMongoId($id);
     }
     $results = $this->db->find($query)->skip(($page - 1) * self::PER_PAGE)->sort(array('date' => -1));
     $total = $results->count();
     $valid = array();
     if ($limit != null) {
         $results->limit($limit);
     }
     if ($idlib) {
         foreach ($results as $result) {
             if (!Id::validateHash($id, array('ambiguity' => $keys['ambiguity'], 'reportedDate' => $keys['date'], 'date' => $result['date'], 'title' => $result['title']), 'news')) {
                 continue;
             }
             array_push($valid, $result);
         }
     } else {
         $valid = iterator_to_array($results);
     }
     if ($justOne) {
         $valid = array(reset($valid));
     }
     if (empty($valid)) {
         return array('Invalid id.', 0);
     }
     $comments = new comments(ConnectionFactory::get('mongo'));
     foreach ($valid as $key => $entry) {
         $this->resolveUser($valid[$key]['user']);
         if ($fixUTF8) {
             $this->resolveUTF8($valid[$key]);
         }
         $valid[$key]['comments'] = $comments->getCount($entry['_id']);
         $valid[$key]['rating'] = $this->getScore($entry['_id']);
     }
     if ($justOne) {
         return reset($valid);
     }
     return array($valid, $total);
 }
开发者ID:Zandemmer,项目名称:HackThisSite-Old,代码行数:55,代码来源:news.php


示例9: set_commented_object

 public function set_commented_object(ORM $underlying_object)
 {
     if (comments::can_comment_on($underlying_object)) {
         $this->underlying_object_name = $underlying_object->object_name;
         $this->underlying_object_id = $underlying_object->id;
     } else {
         throw new Comments_Not_Commentable_Object_Exception($underlying_object);
     }
 }
开发者ID:vitrinephp,项目名称:Vitrine-PHP,代码行数:9,代码来源:comment.php


示例10: new_post

 public function new_post()
 {
     if (!isset($_SESSION['uid'])) {
         echo 1;
         return;
     }
     $forum_id = $_POST['forum_id'];
     $author_id = $_SESSION['uid'];
     $title = $_POST['title'];
     $content = $_POST['content'];
     $post = new posts();
     $id = $post->insert($forum_id, $author_id, $title, $content);
     if (!$id) {
         echo 1;
         return;
     }
     $comment = new comments();
     $suc = $comment->insert($id, $author_id, $content);
     echo $suc ? 0 : 1;
     return;
 }
开发者ID:FebV,项目名称:forum,代码行数:21,代码来源:postController.php


示例11: run

 /**
  * run - display template and edit data
  *
  * @access public
  */
 public function run()
 {
     $tpl = new template();
     $id = '';
     if (isset($_GET['id']) === true) {
         $id = (int) $_GET['id'];
     }
     $client = $this->getClient($id);
     if (empty($client) === false) {
         $file = new files();
         $project = new projects();
         $msgKey = '';
         if ($_SESSION['userdata']['role'] == 'admin') {
             $tpl->assign('admin', true);
         }
         if (isset($_POST['upload'])) {
             if (isset($_FILES['file'])) {
                 $msgKey = $file->upload($_FILES, 'client', $id);
             }
         }
         $comment = new comments();
         //Add comment
         if (isset($_POST['comment']) === true) {
             $mail = new mailer();
             $values = array('text' => $_POST['text'], 'date' => date("Y-m-d H:i:s"), 'userId' => $_SESSION['userdata']['id'], 'moduleId' => $id, 'commentParent' => $_POST['father']);
             $comment->addComment($values, 'client');
         }
         $tpl->assign('userClients', $this->getClientsUsers($id));
         $tpl->assign('comments', $comment->getComments('client', $id));
         $tpl->assign('imgExtensions', array('jpg', 'jpeg', 'png', 'gif', 'psd', 'bmp', 'tif', 'thm', 'yuv'));
         $tpl->assign('info', $msgKey);
         $tpl->assign('client', $client);
         $tpl->assign('clientProjects', $project->getClientProjects($id));
         $tpl->assign('files', $file->getFilesByModule('client'));
         //var_dump($file->getFilesByModule('client')); die();
         $tpl->display('clients.showClient');
     } else {
         $tpl->display('general.error');
     }
 }
开发者ID:DevelopIdeas,项目名称:leantime,代码行数:45,代码来源:class.showClient.php


示例12: EditComment

/**
 * Выводит форму редактировая комментария в админке комментариев.
 *
 * @param int $type Тип группы комментариев
 * @param int $id   id комментария
 *
 * @return xajaxResponse
 */
function EditComment($type, $id)
{
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/comments.php';
    session_start();
    $objResponse = new xajaxResponse();
    if (!hasPermissions('comments')) {
        return $objResponse;
    }
    $comments = new comments();
    $item = $comments->GetItem(intval($type), intval($id));
    $show_title = false;
    $show_files = $type == comments::T_ARTICLES;
    $show_video = $type == comments::T_ARTICLES;
    if (!empty($item)) {
        define('IS_SITE_ADMIN', 1);
        require_once $_SERVER['DOCUMENT_ROOT'] . '/siteadmin/comments/blocks.php';
        $objResponse->assign("edit-{$type}-{$id}", 'innerHTML', CommentEditor($item, $show_title, $show_files, $show_video));
        if ($show_video) {
            $objResponse->script("\$\$('.cl-form-files li input[type=image]').addEvent('click', FilesList)");
        }
    }
    return $objResponse;
}
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:31,代码来源:comments.server.php


示例13: change_rateAction

 public function change_rateAction()
 {
     if (!isset($_SESSION['comments_rate'][system::url(2)])) {
         if ($comment = comments::get(system::url(2))) {
             if (system::url(3) == 'up') {
                 $comment->rateUp();
             } else {
                 $comment->rateDown();
             }
             $_SESSION['comments_rate'][$comment->id()] = 1;
             $comment->save();
         }
     }
     system::stop();
 }
开发者ID:sunfun,项目名称:Bagira.CMS,代码行数:15,代码来源:controller.php


示例14: make_a_comment_to

 public static function make_a_comment_to(ORM $object, $insertion_user, $title, $content, $moderated_state = 'DEFAULT', Comment_Model $in_reply_to = NULL, $url_identifier = '')
 {
     $comment_to_insert = ORM::factory('comment');
     $comment_to_insert->commented_object = $object;
     $comment_to_insert->insertion_user_id = $insertion_user->id;
     Workshop::factory()->add_as_author_of($insertion_user, $object);
     $comment_to_insert->title = $title;
     $comment_to_insert->content = $content;
     $comment_to_insert->moderated_state = $moderated_state;
     if ($in_reply_to != NULL) {
         $comment_to_insert->in_reply_to_id = $in_reply_to->id;
     }
     if ($url_identifier == '') {
         $url_identifier = comments::make_url_identifier($comment_to_insert);
     }
     $comment_to_insert->url_identifier = url_identifier::get_next_available_url_identifier($comment_to_insert, $url_identifier);
     $comment_to_insert->save();
 }
开发者ID:vitrinephp,项目名称:Vitrine-PHP,代码行数:18,代码来源:comments.php


示例15: displayResults

 protected function displayResults($entries)
 {
     $entry = $this->admin_general_options($this->url0);
     $entry_array = array();
     if (isset($entries[0]['title'])) {
         foreach ($entries as $e) {
             $e['site-url'] = SITE_URL;
             // Format the date from the timestamp
             $e['date'] = date('F d, Y', $e['created']);
             // Image options
             if (!empty($e['img']) && strlen($e['img']) > 1) {
                 // Display the latest two galleries
                 $e['image'] = $e['img'];
                 $e['preview'] = str_replace(IMG_SAVE_DIR, IMG_SAVE_DIR . 'preview/', $e['img']);
                 $e['thumb'] = str_replace(IMG_SAVE_DIR, IMG_SAVE_DIR . 'thumbs/', $e['img']);
             } else {
                 $e['image'] = '/assets/images/no-image.jpg';
                 $e['preview'] = '/assets/images/no-image.jpg';
                 $e['thumb'] = '/assets/images/no-image-thumb.jpg';
             }
             $e['comment-count'] = comments::getCommentCount($e['id']);
             $e['comment-text'] = $e['comment-count'] == 1 ? "comment" : "comments";
             $e['url'] = !empty($e['data6']) ? $e['data6'] : urlencode($e['title']);
             $e['admin'] = $this->admin_simple_options($this->url0, $e['id']);
             $entry_array[] = $e;
         }
         $template_file = $this->url0 . '.inc';
     } else {
         $entry_array[] = array('admin' => NULL, 'title' => 'No Entries Found That Match Your Search', 'body' => "<p>No entries match that query.</p>");
         $template_file = 'default.inc';
     }
     $extra['header']['title'] = 'Search Results for "' . urldecode($this->url2) . '" (' . $this->getEntryCountBySearch($this->url2, $this->url1) . ' entries found)';
     $extra['footer']['pagination'] = $this->paginateEntries();
     /*
      * Load the template into a variable
      */
     $template = UTILITIES::loadTemplate($template_file);
     $entry .= UTILITIES::parseTemplate($entry_array, $template, $extra);
     return $entry;
 }
开发者ID:RobMacKay,项目名称:Ennui-CMS,代码行数:40,代码来源:class.search.inc.php


示例16: index

 function index()
 {
     system::setParam("page", "post");
     if ($this->args[0] != "blog") {
         $cacheID = $this->args[0] . "|POST";
         $this->smarty->setCacheID($cacheID);
         if (isset($_POST["SLUG"]) && isset($_POST["comment"])) {
             blog::addCommentBySLUG($_POST["SLUG"]);
         }
         if (!$this->smarty->isCached()) {
             $sqlData = blog::getOnePost($this->args[0])->fetchAll();
             if ($sqlData) {
                 $sqlData = array_shift($sqlData);
                 $comments = comments::get($sqlData["contentID"]);
                 $this->smarty->assign("comments", $comments);
                 blog::highlightCode($sqlData["body"]);
                 $this->smarty->assign("item", $sqlData);
             }
         }
     } else {
         system::redirect("/");
     }
 }
开发者ID:ygres,项目名称:sblog,代码行数:23,代码来源:blog.php


示例17: comments

<?php

require_once "comments.php";
$comment = new comments();
if (isset($_GET['action']) and $_GET['action'] == "getComments") {
    echo $comment->getComments();
    exit;
}
if (isset($_GET['action']) and $_GET['action'] == "delete") {
    $comment->deleteComment($_GET['id']);
    exit;
}
if (isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST") {
    echo $comment->addComment($_POST);
    exit;
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Angular Demo</title>
<script type="text/javascript" src="js/angular.min.js"></script>
<script type="text/javascript">
 function commentsController($scope, $http){
	
	$http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8';
	 
	$http.get("index.php?action=getComments")
	     .success(function(data){ $scope.comments = data;  });
	
开发者ID:neevan1e,项目名称:Done,代码行数:30,代码来源:index.php


示例18: eF_redirect

<?php

/**
 *
 */
if (str_replace(DIRECTORY_SEPARATOR, "/", __FILE__) == $_SERVER['SCRIPT_FILENAME']) {
    exit;
}
if (!EfrontUser::isOptionVisible('comments')) {
    eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=control_panel&message=" . urlencode(_UNAUTHORIZEDACCESS) . "&message_type=failure");
}
//Create shorthands for user access rights, to avoid long variable names
!isset($currentUser->coreAccess['comments']) || $currentUser->coreAccess['comments'] == 'change' ? $_change_ = 1 : ($_change_ = 0);
$load_editor = true;
if ($_professor_) {
    $comments = comments::getComments($currentLesson->lesson['id'], false, $currentUnit['id'], false, false);
} else {
    $comments = comments::getComments($currentLesson->lesson['id'], $GLOBALS['currentUser'], $currentUnit['id'], false, false);
}
//An array of legal ids for editing entries
$legalValues = array();
foreach ($comments as $value) {
    //if ($value['users_LOGIN'] == $GLOBALS['currentUser'] -> user['login'] || $_professor_) {
    $legalValues[] = $value['id'];
    //}
}
//Theses values will be used for the new comment
$values = array('content_ID' => $currentUnit['id'], 'users_LOGIN' => $currentUser->user['login']);
$entityForm = new HTML_QuickForm("create_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=comments&view_unit=" . $currentUnit['id'] . (isset($_GET['add']) ? '&add=1' : '&edit=' . $_GET['edit']), "", null, true);
$entityName = 'comments';
include "entity.php";
开发者ID:bqq1986,项目名称:efront,代码行数:31,代码来源:comments.php


示例19: define

<?php

// +----------------------------------------------------------------------
// | Demila [ Beautiful Digital Content Trading System ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://demila.org All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Email [email protected]
// +----------------------------------------------------------------------
define('USING_LANGUAGE', false);
require_once '../../../config.php';
require_once $config['root_path'] . '/core/functions.php';
include_once $config['system_core'] . "/initEngine.php";
admin_login();
if (isset($_POST['delete']) && isset($_POST['id']) && isset($_SESSION['user']['access']['items'])) {
    require_once ROOT_PATH . "/apps/items/models/items.class.php";
    $cms = new items();
    $cms->delete(intval($_POST['id']));
    die(json_encode(array_merge($_POST, array('status' => 'true'))));
} elseif (isset($_POST['deleteComment']) && isset($_POST['id']) && isset($_SESSION['user']['access']['items'])) {
    require_once ROOT_PATH . "/apps/items/models/comments.class.php";
    $cms = new comments();
    $cms->delete(intval($_POST['id']));
    die(json_encode(array_merge($_POST, array('status' => 'true'))));
}
echo json_encode(array_merge($_POST, array('status' => 'unknown error')));
die;
开发者ID:yunsite,项目名称:demila,代码行数:29,代码来源:delete.php


示例20: clearDuplicates

 /**
  * Clear duplicate comments
  * 
  * There are times that the system may end up with duplicate comments, like when
  * copying content. This function is used to effectively eliminate duplicates.
  * <br/>Example:
  * <code>
  * comments :: clearDuplicates($currentLesson);
  * </code>
  * 
  * @param mixed $lesson a lesson id or an EfrontLesson object
  * @access public
  * @static
  * @since 3.6.0
  */
 public static function clearDuplicates($lesson)
 {
     if ($lesson instanceof EfrontLesson) {
         $lessonId = $lesson->lesson['id'];
     } elseif (eF_checkParameter($lesson, 'id')) {
         $lessonId = $lesson;
     } else {
         throw new EfrontLessonException(_INVALIDID . ": {$lesson}", EfrontLessonException::INVALID_ID);
     }
     $result = eF_getTableData("comments", "*", "lessons_ID=" . $lessonId, "id");
     foreach ($result as $value) {
         $commentsTerms[$value['id']] = $value;
         $id = $value['id'];
         unset($value['id']);
         $checksums[$id] = md5(serialize($value));
     }
     $uniques = array_unique($checksums);
     $duplicates = array_diff_key($checksums, $uniques);
     foreach ($duplicates as $key => $value) {
         $comments = new comments($commentsTerms[$key]);
         $comments->delete();
     }
 }
开发者ID:bqq1986,项目名称:efront,代码行数:38,代码来源:comments.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP common类代码示例发布时间:2022-05-23
下一篇:
PHP comment类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap