Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
meta.comment: define a default size limit for each comment
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Nov 13, 2013
1 parent bcfed71 commit e380e20
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 8 additions & 2 deletions core/src/plugins/meta.comments/class.CommentsMetaManager.php
Expand Up @@ -106,16 +106,22 @@ public function switchActions($actionName, $httpVars, $fileVars)
case "post_comment":

$uId = AuthService::getLoggedUser()->getId();
$limit = $this->getFilteredOption("COMMENT_SIZE_LIMIT");
if(!empty($limit)){
$content = substr($httpVars["content"], 0, $limit);
}else{
$content = $httpVars["content"];
}
$com = array(
"date" => time(),
"author" => $uId,
"content" => $httpVars["content"]
"content" => $content
);
$existingFeed[] = $com;
if ($feedStore!== false) {
$feedStore->persistMetaObject(
$uniqNode->getPath(),
base64_encode($com["content"]),
base64_encode($content),
$uniqNode->getRepositoryId(),
$uniqNode->getRepository()->securityScope(),
$uniqNode->getRepository()->getOwner(),
Expand Down
4 changes: 4 additions & 0 deletions core/src/plugins/meta.comments/manifest.xml
Expand Up @@ -8,6 +8,10 @@
<js file="plugins/meta.comments/class.CommentsPanel.js" className="CommentsPanel" autoload="true"/>
</resources>
</client_settings>
<server_settings>
<param name="COMMENT_SIZE_LIMIT" type="integer" label="Comment limit"
description="Maximum number of characters for each comment" default="1000" />
</server_settings>
<registry_contributions>
<hooks>
<serverCallback hookName="node.info" methodName="mergeMeta" applyCondition="$apply=($args[2]!='minimal');"></serverCallback>
Expand Down

0 comments on commit e380e20

Please sign in to comment.