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


PHP comments类代码示例

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


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


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